diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
1949 files changed, 23240 insertions, 23240 deletions
diff --git a/build/rules/contrib_restricted.policy b/build/rules/contrib_restricted.policy index a83ead19043..c64704c71ff 100644 --- a/build/rules/contrib_restricted.policy +++ b/build/rules/contrib_restricted.policy @@ -190,4 +190,4 @@ ALLOW yandex_io -> contrib/restricted/patched/hostap_client # All peerdirs to contrib/restricted from outside are prohibited # ALLOW contrib -> contrib/restricted -DENY .* -> contrib/restricted +DENY .* -> contrib/restricted diff --git a/build/scripts/build_mn.py b/build/scripts/build_mn.py index 5bb03c247c9..66594dfaa0a 100755 --- a/build/scripts/build_mn.py +++ b/build/scripts/build_mn.py @@ -113,12 +113,12 @@ class BuildMns(BuildMnBase): self.mnrankingSuffix = mnrankingSuffix self.mnlistname = listname + mnrankingSuffix self.mnlistelem = "const NMatrixnet::TMnSsePtr*" - mnlisttype = "TMap< TString, {0} >".format(self.mnlistelem) + mnlisttype = "TMap< TString, {0} >".format(self.mnlistelem) self.mnlist = "const {0} {1}".format(mnlisttype, self.mnlistname) self.mnmultilistname = "{0}{1}Multi".format(listname, self.mnrankingSuffix) self.mnmultilistelem = "const NMatrixnet::TMnMultiCategPtr*" - mnmultilisttype = "TMap< TString, {0} >".format(self.mnmultilistelem) + mnmultilisttype = "TMap< TString, {0} >".format(self.mnmultilistelem) self.mnmultilist = "const {0} {1}".format(mnmultilisttype, self.mnmultilistname) def InitForAll(self, argv): @@ -264,10 +264,10 @@ class BuildMns(BuildMnBase): if mnnames: mndata = self.mnlistname + "_data" - tmpSrcFile.write("static const std::pair< TString, {0} > {1}[] = {{\n".format(self.mnlistelem, mndata)) + tmpSrcFile.write("static const std::pair< TString, {0} > {1}[] = {{\n".format(self.mnlistelem, mndata)) for item in mnnames: mnname = re.sub("[^-a-zA-Z0-9_]", "_", item) - tmpSrcFile.write(" std::make_pair(TString(\"{0}\"), &staticMn{1}{2}Ptr),\n".format(item, self.mnrankingSuffix, mnname)) + tmpSrcFile.write(" std::make_pair(TString(\"{0}\"), &staticMn{1}{2}Ptr),\n".format(item, self.mnrankingSuffix, mnname)) tmpSrcFile.write("};\n") tmpSrcFile.write("{0}({1},{1} + sizeof({1}) / sizeof({1}[0]));\n\n".format(self.mnlist, mndata)) else: @@ -275,10 +275,10 @@ class BuildMns(BuildMnBase): if mnmultinames: mnmultidata = self.mnmultilistname + "_data" - tmpSrcFile.write("static const std::pair< TString, {0} > {1}[] = {{\n".format(self.mnmultilistelem, mnmultidata)) + tmpSrcFile.write("static const std::pair< TString, {0} > {1}[] = {{\n".format(self.mnmultilistelem, mnmultidata)) for item in mnmultinames: mnname = re.sub("[^-a-zA-Z0-9_]", "_", item) - tmpSrcFile.write(" std::make_pair(TString(\"{0}\"), &staticMnMulti{1}{2}Ptr),\n".format(item, self.mnrankingSuffix, mnname)) + tmpSrcFile.write(" std::make_pair(TString(\"{0}\"), &staticMnMulti{1}{2}Ptr),\n".format(item, self.mnrankingSuffix, mnname)) tmpSrcFile.write("};\n") tmpSrcFile.write("{0}({1},{1} + sizeof({1}) / sizeof({1}[0]));\n".format(self.mnmultilist, mnmultidata)) else: diff --git a/build/scripts/gen_mx_table.py b/build/scripts/gen_mx_table.py index 187c21c539f..3a83ce3d94b 100644 --- a/build/scripts/gen_mx_table.py +++ b/build/scripts/gen_mx_table.py @@ -28,7 +28,7 @@ namespace { } }; - struct TFormulas: public THashMap<size_t, TAutoPtr<TFml>> { + struct TFormulas: public THashMap<size_t, TAutoPtr<TFml>> { inline TFormulas() { TBlob b = TBlob::NoCopy(MxFormulas, MxFormulasSize); TArchiveReader ar(b); diff --git a/build/stdafx.hpp b/build/stdafx.hpp index 98b15adda05..5c00eaf4165 100644 --- a/build/stdafx.hpp +++ b/build/stdafx.hpp @@ -132,7 +132,7 @@ #include <util/system/fstat.h> #include <util/system/madvise.h> #include <util/system/valgrind.h> -#include <util/system/shmat.h> +#include <util/system/shmat.h> #include <util/system/rusage.h> #include <util/system/yassert.h> #include <util/system/tempfile.h> @@ -236,7 +236,7 @@ #include <util/generic/function.h> #include <util/generic/flags.h> #include <util/generic/strfcpy.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/fastqueue.h> #include <util/generic/explicit_type.h> #include <util/generic/queue.h> diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 081833998b8..4d08923b190 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -1027,7 +1027,7 @@ macro GRPC() { # Java JAVA_PROTO_PLUGIN(grpc_java contrib/tools/protoc/plugins/grpc_java DEPS $JAVA_GRPC_STUB $JAVA_GRPC_PROTOBUF) -} +} # tag:fbs FLATC_FLAGS_VALUE= @@ -2034,7 +2034,7 @@ macro DISABLE_DATA_VALIDATION() { TEST_DATA_VALUE= ### @usage: DATA([path...]) ### -### Specifies the path to the data necessary test. +### Specifies the path to the data necessary test. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>. ### In the latter case resource will be brought to the working directory of the test before it is started ### @@ -4694,7 +4694,7 @@ macro ANNOTATION_PROCESSOR(Args...) { EXCLUDE_VALUE= ### EXCLUDE(prefixes) ### -### The macro is in development. +### The macro is in development. ### Specifies which libraries should be excluded from the classpath. macro EXCLUDE(Args...) { SET_APPEND(EXCLUDE_VALUE $ARGS_DELIM $Args) @@ -4709,7 +4709,7 @@ JAVA_SRCS_VALUE= ### 1. X SRCDIR - specify the directory x is performed relatively to search the source code for these patterns. If there is no SRCDIR, the source will be searched relative to the module directory. ### 2. PACKAGE_PREFIX x - use if source paths relative to the SRCDIR does not coincide with the full class names. For example, if all sources of module are in the same package, you can create a directory package/name , and just put the source code in the SRCDIR and specify PACKAGE_PREFIX package.name. ### -### @example: +### @example: ### - example/ya.make ### ### JAVA_PROGRAM() @@ -6398,7 +6398,7 @@ macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) { ### @usage: ARCHIVE_ASM(NAME archive_name files...) ### ### Similar to the macro ARCHIVE, but: -### 1. works faster and it is better to use for large files. +### 1. works faster and it is better to use for large files. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test) macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", REQUIREMENTS[], Files...) { .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;chksum;suf=$OBJ_SUF.rodata:NAME} ${requirements;hide:REQUIREMENTS} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"} @@ -6618,7 +6618,7 @@ macro NO_COMPILER_WARNINGS() { ### @usage: WERROR() ### Consider warnings as errors in the current module. -### In the bright future will be removed, since WERROR is the default. +### In the bright future will be removed, since WERROR is the default. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR. macro WERROR() { ENABLE(WERROR) @@ -6635,8 +6635,8 @@ macro NO_WERROR() { ### Disable C++ shadowing warnings. macro NO_WSHADOW() { ENABLE(NO_WSHADOW) -} - +} + # tag:internal ### @usage: NO_PLATFORM_RESOURCES() # internal ### Exclude dependency on platform resources libraries. @@ -6813,7 +6813,7 @@ macro GENERATE_ENUM_SERIALIZATION(File) { .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;chksum;suf=_serialized.cpp:File} ${output_include;hide:File} ${output_include;hide:"util/generic/serialized_enum.h"} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"} .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser/bin"} PEERDIR(tools/enum_parser/enum_serialization_runtime) -} +} ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h) ### @@ -6941,17 +6941,17 @@ SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc ### ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected). ### -### 1. ${scheeme_name}.inc - the name of the generated file. +### 1. ${scheeme_name}.inc - the name of the generated file. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser ### -### @example: +### @example: ### ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::") ### ### all options are passed to structparser (in this example --final_only - do not export heirs with public base that contains the required field,,- m "::" only from the root namespace) -### sets in extra option +### sets in extra option ### -### @example: +### @example: ### ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\" ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export @@ -7266,7 +7266,7 @@ TOUCH_JAVA_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"java NO_CHECK_IMPORTS_FOR_VALUE=None ### @usage: NO_CHECK_IMPORTS([patterns]) ### -### Do not run checks on imports of Python modules. +### Do not run checks on imports of Python modules. ### Optional parameter mask patterns describes the names of the modules that do not need to check. macro NO_CHECK_IMPORTS(Masks...) { SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks) diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 30219eb85ed..f8e6491892a 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -1394,7 +1394,7 @@ class GnuCompiler(Compiler): self.c_defines.append('-D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE') if self.target.is_ios: - self.c_defines.extend(['-D_XOPEN_SOURCE', '-D_DARWIN_C_SOURCE']) + self.c_defines.extend(['-D_XOPEN_SOURCE', '-D_DARWIN_C_SOURCE']) if preset('MAPSMOBI_BUILD_TARGET') and self.target.is_arm: self.c_foptions.append('-fembed-bitcode') @@ -1524,7 +1524,7 @@ class GnuCompiler(Compiler): emit('CXX_COMPILER', '${quo:CXX_COMPILER_UNQUOTED}') emit('NOGCCSTACKCHECK', 'yes') emit('SFDL_FLAG', self.sfdl_flags, '-o', '$SFDL_TMP_OUT') - emit('WERROR_FLAG', '-Werror') + emit('WERROR_FLAG', '-Werror') # TODO(somov): Убрать чтение настройки из os.environ emit('USE_ARC_PROFILE', 'yes' if preset('USE_ARC_PROFILE') or os.environ.get('USE_ARC_PROFILE') else 'no') emit('DEBUG_INFO_FLAGS', self.debug_info_flags) diff --git a/contrib/libs/antlr3_cpp_runtime/ya.make b/contrib/libs/antlr3_cpp_runtime/ya.make index 5c019aa3963..1430ac95d16 100644 --- a/contrib/libs/antlr3_cpp_runtime/ya.make +++ b/contrib/libs/antlr3_cpp_runtime/ya.make @@ -10,7 +10,7 @@ VERSION(2016-03-31-a4d1928e03b2b3f74579e54a6211cd1d695001b9) LICENSE( BSD-3-Clause AND Unicode-Mappings -) +) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) diff --git a/contrib/libs/base64/avx2/ya.make b/contrib/libs/base64/avx2/ya.make index b0dc5ce7720..4df2786b33e 100644 --- a/contrib/libs/base64/avx2/ya.make +++ b/contrib/libs/base64/avx2/ya.make @@ -1,7 +1,7 @@ OWNER( yazevnul g:contrib - g:cpp-contrib + g:cpp-contrib ) LIBRARY() diff --git a/contrib/libs/base64/neon32/ya.make b/contrib/libs/base64/neon32/ya.make index 435b1127bb3..a9efdd50541 100644 --- a/contrib/libs/base64/neon32/ya.make +++ b/contrib/libs/base64/neon32/ya.make @@ -1,7 +1,7 @@ OWNER( yazevnul g:contrib - g:cpp-contrib + g:cpp-contrib ) LIBRARY() diff --git a/contrib/libs/base64/neon64/ya.make b/contrib/libs/base64/neon64/ya.make index 82d821b4eec..5acb36a44d9 100644 --- a/contrib/libs/base64/neon64/ya.make +++ b/contrib/libs/base64/neon64/ya.make @@ -1,7 +1,7 @@ OWNER( yazevnul g:contrib - g:cpp-contrib + g:cpp-contrib ) LIBRARY() diff --git a/contrib/libs/base64/plain32/ya.make b/contrib/libs/base64/plain32/ya.make index 1f5a9ad2040..41d68a870d0 100644 --- a/contrib/libs/base64/plain32/ya.make +++ b/contrib/libs/base64/plain32/ya.make @@ -1,7 +1,7 @@ OWNER( yazevnul g:contrib - g:cpp-contrib + g:cpp-contrib ) LIBRARY() diff --git a/contrib/libs/base64/plain64/ya.make b/contrib/libs/base64/plain64/ya.make index 1f5a9ad2040..41d68a870d0 100644 --- a/contrib/libs/base64/plain64/ya.make +++ b/contrib/libs/base64/plain64/ya.make @@ -1,7 +1,7 @@ OWNER( yazevnul g:contrib - g:cpp-contrib + g:cpp-contrib ) LIBRARY() diff --git a/contrib/libs/base64/ssse3/ya.make b/contrib/libs/base64/ssse3/ya.make index c9cf6470015..bcf9b6267d3 100644 --- a/contrib/libs/base64/ssse3/ya.make +++ b/contrib/libs/base64/ssse3/ya.make @@ -1,7 +1,7 @@ OWNER( yazevnul g:contrib - g:cpp-contrib + g:cpp-contrib ) LIBRARY() diff --git a/contrib/libs/base64/ya.make b/contrib/libs/base64/ya.make index 659983fe66a..54726c4c33c 100644 --- a/contrib/libs/base64/ya.make +++ b/contrib/libs/base64/ya.make @@ -1,7 +1,7 @@ OWNER( yazevnul g:contrib - g:cpp-contrib + g:cpp-contrib ) VERSION(0.3.0) diff --git a/contrib/libs/brotli/common/ya.make b/contrib/libs/brotli/common/ya.make index 6c4157831c9..d3f17570902 100644 --- a/contrib/libs/brotli/common/ya.make +++ b/contrib/libs/brotli/common/ya.make @@ -4,11 +4,11 @@ LICENSE(MIT) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( +OWNER( pg g:contrib g:cpp-contrib -) +) NO_UTIL() diff --git a/contrib/libs/brotli/dec/ya.make b/contrib/libs/brotli/dec/ya.make index 0f482f36ed2..4bc1504aeae 100644 --- a/contrib/libs/brotli/dec/ya.make +++ b/contrib/libs/brotli/dec/ya.make @@ -4,11 +4,11 @@ LICENSE(MIT) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( +OWNER( pg g:contrib g:cpp-contrib -) +) NO_UTIL() diff --git a/contrib/libs/brotli/enc/ya.make b/contrib/libs/brotli/enc/ya.make index 67da82ec4d5..b9c06659275 100644 --- a/contrib/libs/brotli/enc/ya.make +++ b/contrib/libs/brotli/enc/ya.make @@ -4,11 +4,11 @@ LICENSE(MIT) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( +OWNER( pg g:contrib g:cpp-contrib -) +) NO_UTIL() diff --git a/contrib/libs/cctz/test/ya.make b/contrib/libs/cctz/test/ya.make index 8815f9769df..f65dcfca160 100644 --- a/contrib/libs/cctz/test/ya.make +++ b/contrib/libs/cctz/test/ya.make @@ -4,10 +4,10 @@ LICENSE(Apache-2.0) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( +OWNER( dfyz petrk -) +) PEERDIR( contrib/libs/cctz diff --git a/contrib/libs/cctz/tzdata/ya.make b/contrib/libs/cctz/tzdata/ya.make index 3b9ff5cc673..f94958c2f03 100644 --- a/contrib/libs/cctz/tzdata/ya.make +++ b/contrib/libs/cctz/tzdata/ya.make @@ -4,10 +4,10 @@ WITHOUT_LICENSE_TEXTS() LICENSE(Apache-2.0) -OWNER( +OWNER( dfyz petrk -) +) PEERDIR( contrib/libs/cctz diff --git a/contrib/libs/crcutil/ya.make b/contrib/libs/crcutil/ya.make index 2da8ef940f7..4e010a67a42 100644 --- a/contrib/libs/crcutil/ya.make +++ b/contrib/libs/crcutil/ya.make @@ -6,10 +6,10 @@ VERSION(1.0) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) NO_UTIL() diff --git a/contrib/libs/cxxsupp/builtins/ya.make b/contrib/libs/cxxsupp/builtins/ya.make index d2c319c927c..7005a43c581 100644 --- a/contrib/libs/cxxsupp/builtins/ya.make +++ b/contrib/libs/cxxsupp/builtins/ya.make @@ -22,12 +22,12 @@ VERSION(2016-03-03-08f0372c351a57b01afee6c64066961203da28c5) ORIGINAL_SOURCE(https://github.com/llvm/llvm-project) -OWNER( +OWNER( pg somov g:contrib g:cpp-contrib -) +) # Check MUSL before NO_PLATFORM() disables it. IF (MUSL) diff --git a/contrib/libs/cxxsupp/libcxx/ya.make b/contrib/libs/cxxsupp/libcxx/ya.make index 15403fe6d5f..2e2e00b262c 100644 --- a/contrib/libs/cxxsupp/libcxx/ya.make +++ b/contrib/libs/cxxsupp/libcxx/ya.make @@ -12,12 +12,12 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) VERSION(2021-04-02-7959d59028dd126416cdf10dbbd22162922e1336) -OWNER( +OWNER( halyavin somov g:cpp-committee g:cpp-contrib -) +) ADDINCL( GLOBAL contrib/libs/cxxsupp/libcxx/include diff --git a/contrib/libs/cxxsupp/libcxxrt/ya.make b/contrib/libs/cxxsupp/libcxxrt/ya.make index 12dccbd505a..bb6852d2202 100644 --- a/contrib/libs/cxxsupp/libcxxrt/ya.make +++ b/contrib/libs/cxxsupp/libcxxrt/ya.make @@ -11,13 +11,13 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( +OWNER( pg setser somov g:cpp-committee g:cpp-contrib -) +) VERSION(2021-09-08-14bf5d5526056ae1cc16f03b7b8e96108a1e38d0) diff --git a/contrib/libs/cxxsupp/libsan/ya.make b/contrib/libs/cxxsupp/libsan/ya.make index 2fb16630be8..9ed45cd8169 100644 --- a/contrib/libs/cxxsupp/libsan/ya.make +++ b/contrib/libs/cxxsupp/libsan/ya.make @@ -15,7 +15,7 @@ OWNER(somov) PYTHON( generate_symbolizer.py ${CXX_COMPILER} STDOUT symbolizer.c -) +) CFLAGS(-fPIC) diff --git a/contrib/libs/cxxsupp/openmp/ya.make b/contrib/libs/cxxsupp/openmp/ya.make index 2c644683751..a0ccee456a9 100644 --- a/contrib/libs/cxxsupp/openmp/ya.make +++ b/contrib/libs/cxxsupp/openmp/ya.make @@ -9,11 +9,11 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) VERSION(5.0) -OWNER( +OWNER( pg g:contrib g:cpp-contrib -) +) NO_UTIL() diff --git a/contrib/libs/cxxsupp/system_stl/include/ya.make b/contrib/libs/cxxsupp/system_stl/include/ya.make index 06f1a0286ce..525fe3844dc 100644 --- a/contrib/libs/cxxsupp/system_stl/include/ya.make +++ b/contrib/libs/cxxsupp/system_stl/include/ya.make @@ -1,4 +1,4 @@ -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) diff --git a/contrib/libs/cxxsupp/system_stl/ya.make b/contrib/libs/cxxsupp/system_stl/ya.make index 75317898ac9..0531a905211 100644 --- a/contrib/libs/cxxsupp/system_stl/ya.make +++ b/contrib/libs/cxxsupp/system_stl/ya.make @@ -4,11 +4,11 @@ WITHOUT_LICENSE_TEXTS() LICENSE(YandexOpen) -OWNER( +OWNER( g:contrib g:cpp-contrib somov -) +) NO_PLATFORM() diff --git a/contrib/libs/cxxsupp/ya.make b/contrib/libs/cxxsupp/ya.make index 6cd299ac8a1..10e5b4c0f1e 100644 --- a/contrib/libs/cxxsupp/ya.make +++ b/contrib/libs/cxxsupp/ya.make @@ -5,10 +5,10 @@ WITHOUT_LICENSE_TEXTS() # Proxy library LICENSE(Not-Applicable) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) NO_PLATFORM() DISABLE(OPENSOURCE_EXPORT) diff --git a/contrib/libs/double-conversion/ya.make b/contrib/libs/double-conversion/ya.make index 52e59b09891..11db59678c3 100644 --- a/contrib/libs/double-conversion/ya.make +++ b/contrib/libs/double-conversion/ya.make @@ -6,11 +6,11 @@ LICENSE(BSD-3-Clause) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( +OWNER( pg g:contrib g:cpp-contrib -) +) NO_COMPILER_WARNINGS() diff --git a/contrib/libs/farmhash/arch/ya.make b/contrib/libs/farmhash/arch/ya.make index 7e2e9835f59..7aad18465b9 100644 --- a/contrib/libs/farmhash/arch/ya.make +++ b/contrib/libs/farmhash/arch/ya.make @@ -1,3 +1,3 @@ -OWNER( - somov -) +OWNER( + somov +) diff --git a/contrib/libs/farmhash/farmhash.cc b/contrib/libs/farmhash/farmhash.cc index 27b344fc652..2e2b29478d6 100644 --- a/contrib/libs/farmhash/farmhash.cc +++ b/contrib/libs/farmhash/farmhash.cc @@ -20,7 +20,7 @@ // // FarmHash, by Geoff Pike -#include <util/system/compiler.h> +#include <util/system/compiler.h> #include "farmhash.h" // FARMHASH ASSUMPTIONS: Modify as needed, or use -DFARMHASH_ASSUME_SSE42 etc. // Note that if you use -DFARMHASH_ASSUME_SSE42 you likely need -msse42 @@ -1602,8 +1602,8 @@ STATIC_INLINE uint32_t Hash32Len5to12(const char *s, size_t len) { return fmix(Mur(c, Mur(b, Mur(a, d)))); } -Y_PRAGMA_DIAGNOSTIC_PUSH -Y_PRAGMA_NO_WSHADOW +Y_PRAGMA_DIAGNOSTIC_PUSH +Y_PRAGMA_NO_WSHADOW uint32_t Hash32(const char *s, size_t len) { if (len <= 24) { return len <= 12 ? @@ -1672,7 +1672,7 @@ uint32_t Hash32(const char *s, size_t len) { h = Rotate(h, 17) * c1; return h; } -Y_PRAGMA_DIAGNOSTIC_POP +Y_PRAGMA_DIAGNOSTIC_POP uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) { if (len <= 24) { diff --git a/contrib/libs/farmhash/ut/ya.make b/contrib/libs/farmhash/ut/ya.make index 94c6d152081..8d8cff97357 100644 --- a/contrib/libs/farmhash/ut/ya.make +++ b/contrib/libs/farmhash/ut/ya.make @@ -1,8 +1,8 @@ UNITTEST_FOR(contrib/libs/farmhash) -OWNER( - somov -) +OWNER( + somov +) NO_COMPILER_WARNINGS() diff --git a/contrib/libs/fastlz/ya.make b/contrib/libs/fastlz/ya.make index 7f31ac0becf..5addb7e8bc6 100644 --- a/contrib/libs/fastlz/ya.make +++ b/contrib/libs/fastlz/ya.make @@ -6,10 +6,10 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) VERSION(0.1.0) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) NO_UTIL() diff --git a/contrib/libs/grpc/python/ya.make b/contrib/libs/grpc/python/ya.make index f22d3393fc5..19b9f35935d 100644 --- a/contrib/libs/grpc/python/ya.make +++ b/contrib/libs/grpc/python/ya.make @@ -4,11 +4,11 @@ WITHOUT_LICENSE_TEXTS() LICENSE(Apache-2.0) -OWNER( +OWNER( akastornov g:contrib g:cpp-contrib -) +) PEERDIR( contrib/libs/grpc/src/python/grpcio diff --git a/contrib/libs/grpc/src/compiler/generator_helpers.h b/contrib/libs/grpc/src/compiler/generator_helpers.h index 265713a16b3..5edc1804612 100644 --- a/contrib/libs/grpc/src/compiler/generator_helpers.h +++ b/contrib/libs/grpc/src/compiler/generator_helpers.h @@ -25,7 +25,7 @@ #include <util/generic/string.h> #include <vector> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/split.h> #include <util/stream/str.h> @@ -181,8 +181,8 @@ inline void Split(const TStringType& s, char /*delim*/, } template <> -inline void Split(const TString &s, char delim, - std::vector<TString> *append_to) { +inline void Split(const TString &s, char delim, + std::vector<TString> *append_to) { TVector<TString> parts; Split(s, TString(1, delim), parts); for (auto& p : parts) { diff --git a/contrib/libs/grpc/src/proto/grpc/core/ya.make b/contrib/libs/grpc/src/proto/grpc/core/ya.make index 856c34ee53f..760a8a6ed64 100644 --- a/contrib/libs/grpc/src/proto/grpc/core/ya.make +++ b/contrib/libs/grpc/src/proto/grpc/core/ya.make @@ -7,7 +7,7 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) OWNER( akastornov g:contrib - g:cpp-contrib + g:cpp-contrib ) PROTO_NAMESPACE( diff --git a/contrib/libs/grpc/src/proto/grpc/health/v1/ya.make b/contrib/libs/grpc/src/proto/grpc/health/v1/ya.make index 7bb8b0dff91..269d551e0da 100644 --- a/contrib/libs/grpc/src/proto/grpc/health/v1/ya.make +++ b/contrib/libs/grpc/src/proto/grpc/health/v1/ya.make @@ -7,7 +7,7 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) OWNER( akastornov g:contrib - g:cpp-contrib + g:cpp-contrib ) PROTO_NAMESPACE( diff --git a/contrib/libs/grpc/src/proto/grpc/testing/duplicate/ya.make b/contrib/libs/grpc/src/proto/grpc/testing/duplicate/ya.make index b94aa415f80..0a7650b3b8e 100644 --- a/contrib/libs/grpc/src/proto/grpc/testing/duplicate/ya.make +++ b/contrib/libs/grpc/src/proto/grpc/testing/duplicate/ya.make @@ -7,7 +7,7 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) OWNER( akastornov g:contrib - g:cpp-contrib + g:cpp-contrib ) EXCLUDE_TAGS( diff --git a/contrib/libs/grpc/src/proto/grpc/testing/ya.make b/contrib/libs/grpc/src/proto/grpc/testing/ya.make index 2704585a373..e244033f23e 100644 --- a/contrib/libs/grpc/src/proto/grpc/testing/ya.make +++ b/contrib/libs/grpc/src/proto/grpc/testing/ya.make @@ -7,7 +7,7 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) OWNER( akastornov g:contrib - g:cpp-contrib + g:cpp-contrib ) EXCLUDE_TAGS( diff --git a/contrib/libs/grpc/src/python/grpcio/ya.make b/contrib/libs/grpc/src/python/grpcio/ya.make index 5cdb0230c41..458277575e9 100644 --- a/contrib/libs/grpc/src/python/grpcio/ya.make +++ b/contrib/libs/grpc/src/python/grpcio/ya.make @@ -4,11 +4,11 @@ LICENSE(Apache-2.0) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( +OWNER( akastornov g:contrib g:cpp-contrib -) +) PEERDIR( contrib/libs/grpc/grpc diff --git a/contrib/libs/grpc/ya.make b/contrib/libs/grpc/ya.make index 29848d23ea5..8930d43624a 100644 --- a/contrib/libs/grpc/ya.make +++ b/contrib/libs/grpc/ya.make @@ -9,11 +9,11 @@ VERSION(1.33.2) ORIGINAL_SOURCE(https://github.com/grpc/grpc) -OWNER( +OWNER( akastornov g:contrib g:cpp-contrib -) +) PEERDIR( contrib/libs/grpc/grpc diff --git a/contrib/libs/hdr_histogram/ya.make b/contrib/libs/hdr_histogram/ya.make index b20d977b573..ce9a9c6a90d 100644 --- a/contrib/libs/hdr_histogram/ya.make +++ b/contrib/libs/hdr_histogram/ya.make @@ -12,7 +12,7 @@ VERSION(0.9.5) OWNER( jamel g:contrib - g:cpp-contrib + g:cpp-contrib ) NO_UTIL() diff --git a/contrib/libs/highwayhash/arch/ya.make b/contrib/libs/highwayhash/arch/ya.make index 7e2e9835f59..7aad18465b9 100644 --- a/contrib/libs/highwayhash/arch/ya.make +++ b/contrib/libs/highwayhash/arch/ya.make @@ -1,3 +1,3 @@ -OWNER( - somov -) +OWNER( + somov +) diff --git a/contrib/libs/libaio/static/ya.make b/contrib/libs/libaio/static/ya.make index c4a7e200bbe..94585b5db8c 100644 --- a/contrib/libs/libaio/static/ya.make +++ b/contrib/libs/libaio/static/ya.make @@ -16,11 +16,11 @@ ENDIF() LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( +OWNER( vskipin g:contrib g:cpp-contrib -) +) NO_UTIL() diff --git a/contrib/libs/libaio/ya.make b/contrib/libs/libaio/ya.make index 3eb09b549bb..52063065b99 100644 --- a/contrib/libs/libaio/ya.make +++ b/contrib/libs/libaio/ya.make @@ -9,10 +9,10 @@ WITHOUT_LICENSE_TEXTS() VERSION(2015-07-01-5a546a834c36070648158d19dd564762d59f8eb8) -OWNER( +OWNER( g:contrib g:cpp-contrib -) +) NO_RUNTIME() diff --git a/contrib/libs/libc_compat/memfd_create.c b/contrib/libs/libc_compat/memfd_create.c index 6805d807d6e..a33a52209a8 100644 --- a/contrib/libs/libc_compat/memfd_create.c +++ b/contrib/libs/libc_compat/memfd_create.c @@ -1,9 +1,9 @@ -#define _GNU_SOURCE 1 -#include <sys/mman.h> -#include "syscall.h" +#define _GNU_SOURCE 1 +#include <sys/mman.h> +#include "syscall.h" #include <linux/unistd.h> - -int memfd_create(const char *name, unsigned flags) -{ + +int memfd_create(const char *name, unsigned flags) +{ return syscall(__NR_memfd_create, name, flags); -} +} diff --git a/contrib/libs/libevent/ya.make b/contrib/libs/libevent/ya.make index acfe9868c6a..e1f4d3f0891 100644 --- a/contrib/libs/libevent/ya.make +++ b/contrib/libs/libevent/ya.make @@ -37,7 +37,7 @@ ADDINCL( NO_COMPILER_WARNINGS() NO_RUNTIME() - + CFLAGS( -DHAVE_CONFIG_H -DEVENT__HAVE_STRLCPY=1 diff --git a/contrib/libs/libiconv/dynamic/ya.make b/contrib/libs/libiconv/dynamic/ya.make index f3a979206c3..6910aeb2502 100644 --- a/contrib/libs/libiconv/dynamic/ya.make +++ b/contrib/libs/libiconv/dynamic/ya.make @@ -1,8 +1,8 @@ DYNAMIC_LIBRARY(iconv) -OWNER( +OWNER( g:contrib g:cpp-contrib -) +) VERSION(1.13) diff --git a/contrib/libs/libiconv/ya.make b/contrib/libs/libiconv/ya.make index e7c4e35e4c9..9e8d15d9a45 100644 --- a/contrib/libs/libiconv/ya.make +++ b/contrib/libs/libiconv/ya.make @@ -1,7 +1,7 @@ -OWNER( +OWNER( g:contrib g:cpp-contrib -) +) LIBRARY() diff --git a/contrib/libs/libidn/dynamic/ya.make b/contrib/libs/libidn/dynamic/ya.make index c307c1950fb..31be9babfba 100644 --- a/contrib/libs/libidn/dynamic/ya.make +++ b/contrib/libs/libidn/dynamic/ya.make @@ -1,7 +1,7 @@ -OWNER( +OWNER( g:contrib g:cpp-contrib -) +) DYNAMIC_LIBRARY(idn) diff --git a/contrib/libs/libxml/ya.make b/contrib/libs/libxml/ya.make index b7ee2eb058a..a83e5398859 100644 --- a/contrib/libs/libxml/ya.make +++ b/contrib/libs/libxml/ya.make @@ -28,7 +28,7 @@ ADDINCL( contrib/libs/libiconv/include contrib/libs/libxml ) - + NO_COMPILER_WARNINGS() CFLAGS( diff --git a/contrib/libs/linuxvdso/original/ya.make b/contrib/libs/linuxvdso/original/ya.make index c5b41c3586e..2c0c8a707fe 100644 --- a/contrib/libs/linuxvdso/original/ya.make +++ b/contrib/libs/linuxvdso/original/ya.make @@ -4,10 +4,10 @@ LICENSE(BSD-3-Clause) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) NO_UTIL() diff --git a/contrib/libs/linuxvdso/ya.make b/contrib/libs/linuxvdso/ya.make index 4da8d3d0769..5d37dd59db4 100644 --- a/contrib/libs/linuxvdso/ya.make +++ b/contrib/libs/linuxvdso/ya.make @@ -8,10 +8,10 @@ VERSION(2.0) ORIGINAL_SOURCE(https://github.com/gperftools/gperftools) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) NO_UTIL() diff --git a/contrib/libs/lz4/generated/ya.make b/contrib/libs/lz4/generated/ya.make index f37d13bddb6..dfb50bd2e4b 100644 --- a/contrib/libs/lz4/generated/ya.make +++ b/contrib/libs/lz4/generated/ya.make @@ -4,11 +4,11 @@ WITHOUT_LICENSE_TEXTS() LICENSE(BSD-2-Clause) -OWNER( +OWNER( orivej g:contrib g:cpp-contrib -) +) NO_UTIL() diff --git a/contrib/libs/lz4/lz4.h b/contrib/libs/lz4/lz4.h index 66b8547bbc2..dbd6939cfff 100644 --- a/contrib/libs/lz4/lz4.h +++ b/contrib/libs/lz4/lz4.h @@ -677,10 +677,10 @@ union LZ4_streamDecode_u { * before including the header file. */ -#ifndef LZ4_DISABLE_DEPRECATE_WARNINGS -# define LZ4_DISABLE_DEPRECATE_WARNINGS -#endif - +#ifndef LZ4_DISABLE_DEPRECATE_WARNINGS +# define LZ4_DISABLE_DEPRECATE_WARNINGS +#endif + #ifdef LZ4_DISABLE_DEPRECATE_WARNINGS # define LZ4_DEPRECATED(message) /* disable deprecation warnings */ #else diff --git a/contrib/libs/lz4/ya.make b/contrib/libs/lz4/ya.make index 282dfe39203..6b41cd5a1d0 100644 --- a/contrib/libs/lz4/ya.make +++ b/contrib/libs/lz4/ya.make @@ -25,7 +25,7 @@ PEERDIR( ADDINCL( contrib/libs/xxhash ) - + NO_RUNTIME() SRCS( diff --git a/contrib/libs/lzmasdk/ya.make b/contrib/libs/lzmasdk/ya.make index db0a55788d7..ed5c7ad53fc 100644 --- a/contrib/libs/lzmasdk/ya.make +++ b/contrib/libs/lzmasdk/ya.make @@ -4,10 +4,10 @@ LICENSE(Public-Domain) LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) # https://www.7-zip.org/sdk.html VERSION(19.00) diff --git a/contrib/libs/nayuki_md5/ya.make b/contrib/libs/nayuki_md5/ya.make index 15a6141c7a5..4d8a3de3028 100644 --- a/contrib/libs/nayuki_md5/ya.make +++ b/contrib/libs/nayuki_md5/ya.make @@ -8,11 +8,11 @@ VERSION(2016) ORIGINAL_SOURCE(https://www.nayuki.io/page/fast-md5-hash-implementation-in-x86-assembly) -OWNER( +OWNER( pg g:contrib g:cpp-contrib -) +) IF (OS_LINUX AND ARCH_X86_64) SRCS( diff --git a/contrib/libs/openssl/dynamic/ya.make b/contrib/libs/openssl/dynamic/ya.make index d68bbe8c4cd..d246d1f963a 100644 --- a/contrib/libs/openssl/dynamic/ya.make +++ b/contrib/libs/openssl/dynamic/ya.make @@ -4,5 +4,5 @@ OWNER( somov elantsev g:contrib - g:cpp-contrib + g:cpp-contrib ) diff --git a/contrib/libs/pire/pire/classes.cpp b/contrib/libs/pire/pire/classes.cpp index bbf021737df..2a7b8f5a818 100644 --- a/contrib/libs/pire/pire/classes.cpp +++ b/contrib/libs/pire/pire/classes.cpp @@ -53,9 +53,9 @@ namespace { return r; } - TSet<wchar32> ToSet() const + TSet<wchar32> ToSet() const { - TSet<wchar32> ret; + TSet<wchar32> ret; for (auto&& bound : m_bounds) for (wchar32 c = bound.first; c <= bound.second; ++c) ret.insert(c); @@ -63,7 +63,7 @@ namespace { } private: - TVector<ypair<wchar32, wchar32> > m_bounds; + TVector<ypair<wchar32, wchar32> > m_bounds; }; public: @@ -72,7 +72,7 @@ namespace { return (m_classes.find(to_lower(wc & ~ControlMask)) != m_classes.end()); } - TSet<wchar32> Get(wchar32 wc) const + TSet<wchar32> Get(wchar32 wc) const { auto it = m_classes.find(to_lower(wc & ~ControlMask)); if (it == m_classes.end()) @@ -102,7 +102,7 @@ namespace { m_classes['t'] = CharClass('\t'); } - TMap<wchar32, CharClass> m_classes; + TMap<wchar32, CharClass> m_classes; }; class CharClassesImpl: public Feature { diff --git a/contrib/libs/pire/pire/determine.h b/contrib/libs/pire/pire/determine.h index fb48fdd0b35..61428ec501b 100644 --- a/contrib/libs/pire/pire/determine.h +++ b/contrib/libs/pire/pire/determine.h @@ -48,7 +48,7 @@ namespace Pire { typedef Partition<char, ImplementationSpecific2> LettersTbl; /// A container used for storing map of states to thier indices. - typedef TMap<State, size_t> InvStates; + typedef TMap<State, size_t> InvStates; /// Should return used letters' partition. const LettersTbl& Letters() const; @@ -63,7 +63,7 @@ namespace Pire { bool IsRequired(const State& /*state*/) const { return true; } /// Called when the set of new states is closed. - void AcceptStates(const TVector<State>& newstates); + void AcceptStates(const TVector<State>& newstates); /// Called for each transition from one new state to another. void Connect(size_t from, size_t to, Char letter); @@ -94,12 +94,12 @@ namespace Pire { { typedef typename Task::State State; typedef typename Task::InvStates InvStates; - typedef TDeque< TVector<size_t> > TransitionTable; + typedef TDeque< TVector<size_t> > TransitionTable; - TVector<State> states; + TVector<State> states; InvStates invstates; TransitionTable transitions; - TVector<size_t> stateIndices; + TVector<size_t> stateIndices; states.push_back(task.Initial()); invstates.insert(typename InvStates::value_type(states[0], 0)); @@ -123,14 +123,14 @@ namespace Pire { stateIndices.push_back(stateIdx); } - TVector<Char> invletters(task.Letters().Size()); + TVector<Char> invletters(task.Letters().Size()); for (auto&& letter : task.Letters()) invletters[letter.second.first] = letter.first; task.AcceptStates(states); size_t from = 0; for (TransitionTable::iterator i = transitions.begin(), ie = transitions.end(); i != ie; ++i, ++from) { - TVector<Char>::iterator l = invletters.begin(); + TVector<Char>::iterator l = invletters.begin(); for (TransitionTable::value_type::iterator j = i->begin(), je = i->end(); j != je; ++j, ++l) task.Connect(stateIndices[from], *j, *l); } diff --git a/contrib/libs/pire/pire/easy.h b/contrib/libs/pire/pire/easy.h index c70e965353b..d38145f331b 100644 --- a/contrib/libs/pire/pire/easy.h +++ b/contrib/libs/pire/pire/easy.h @@ -196,7 +196,7 @@ private: void Init(ypair<const char*, const char*> rawPattern, Options options) { - TVector<wchar32> pattern; + TVector<wchar32> pattern; options.Encoding().FromLocal(rawPattern.first, rawPattern.second, std::back_inserter(pattern)); Lexer lexer(pattern); @@ -216,7 +216,7 @@ private: static bool BeginsWithCircumflex(const Fsm& fsm) { typedef Fsm::StatesSet Set; - TDeque<size_t> queue; + TDeque<size_t> queue; BitSet handled(fsm.Size()); queue.push_back(fsm.Initial()); @@ -231,7 +231,7 @@ private: } } - TSet<Char> lets = fsm.OutgoingLetters(queue.front()); + TSet<Char> lets = fsm.OutgoingLetters(queue.front()); lets.erase(SpecialChar::Epsilon); lets.erase(SpecialChar::BeginMark); if (!lets.empty()) diff --git a/contrib/libs/pire/pire/extra/count.cpp b/contrib/libs/pire/pire/extra/count.cpp index 468ff61d924..89ea43f0c7f 100644 --- a/contrib/libs/pire/pire/extra/count.cpp +++ b/contrib/libs/pire/pire/extra/count.cpp @@ -766,15 +766,15 @@ CountingScanner::CountingScanner(const Fsm& re, const Fsm& sep) // Make a full Cartesian product of two sep_res sep_re.Determine(); sep_re.Unsparse(); - TSet<size_t> dead = sep_re.DeadStates(); + TSet<size_t> dead = sep_re.DeadStates(); PIRE_IFDEBUG(Cdbg << "=== Original FSM ===" << Endl << sep_re << ">>> " << sep_re.Size() << " states, dead: [" << Join(dead.begin(), dead.end(), ", ") << "]" << Endl); Fsm sq; typedef ypair<size_t, size_t> NewState; - TVector<NewState> states; - TMap<NewState, size_t> invstates; + TVector<NewState> states; + TMap<NewState, size_t> invstates; states.push_back(NewState(sep_re.Initial(), sep_re.Initial())); invstates.insert(ymake_pair(states.back(), states.size() - 1)); @@ -815,7 +815,7 @@ CountingScanner::CountingScanner(const Fsm& re, const Fsm& sep) PIRE_IFDEBUG(if (ns != savedNs) Cdbg << "Diverted transition to (" << savedNs.first << ", " << savedNs.second << ") on " << (char) letter << " to (" << ns.first << ", " << ns.second << ")" << dbgout << Endl); - TMap<NewState, size_t>::iterator nsi = invstates.find(ns); + TMap<NewState, size_t>::iterator nsi = invstates.find(ns); if (nsi == invstates.end()) { PIRE_IFDEBUG(Cdbg << "New state " << states.size() << " = (" << ns.first << ", " << ns.second << ")" << Endl); states.push_back(ns); @@ -823,7 +823,7 @@ CountingScanner::CountingScanner(const Fsm& re, const Fsm& sep) sq.Resize(states.size()); } - for (TVector<Char>::const_iterator li = lit->second.second.begin(), le = lit->second.second.end(); li != le; ++li) + for (TVector<Char>::const_iterator li = lit->second.second.begin(), le = lit->second.second.end(); li != le; ++li) sq.Connect(curstate, nsi->second, *li); if (outputs) sq.SetOutput(curstate, nsi->second, outputs); @@ -885,14 +885,14 @@ public: using typename ScannerGlueCommon<Scanner>::State; using TAction = typename Scanner::Action; using InternalState = typename Scanner::InternalState; - typedef TMap<State, size_t> InvStates; + typedef TMap<State, size_t> InvStates; CountingScannerGlueTask(const Scanner& lhs, const Scanner& rhs) : ScannerGlueCommon<Scanner>(lhs, rhs, LettersEquality<Scanner>(lhs.m_letters, rhs.m_letters)) { } - void AcceptStates(const TVector<State>& states) + void AcceptStates(const TVector<State>& states) { States = states; this->SetSc(THolder<Scanner>(new Scanner)); @@ -909,7 +909,7 @@ public: } protected: - TVector<State> States; + TVector<State> States; TAction Action(const Scanner& sc, InternalState state, Char letter) const { size_t state_index = sc.StateIdx(state); diff --git a/contrib/libs/pire/pire/extra/glyphs.cpp b/contrib/libs/pire/pire/extra/glyphs.cpp index a14d2baa567..cd4c8465b3c 100644 --- a/contrib/libs/pire/pire/extra/glyphs.cpp +++ b/contrib/libs/pire/pire/extra/glyphs.cpp @@ -45,12 +45,12 @@ namespace { */ class GlyphTable { private: - TList< TVector<wchar32> > m_classes; - TMap<wchar32, TVector<wchar32>*> m_map; + TList< TVector<wchar32> > m_classes; + TMap<wchar32, TVector<wchar32>*> m_map; struct GlyphClass { - TVector<wchar32>* m_class; - TMap<wchar32, TVector<wchar32>*> *m_map; + TVector<wchar32>* m_class; + TMap<wchar32, TVector<wchar32>*> *m_map; GlyphClass& operator << (wchar32 c) { @@ -63,7 +63,7 @@ namespace { GlyphClass Class() { GlyphClass cl; - m_classes.push_back(TVector<wchar32>()); + m_classes.push_back(TVector<wchar32>()); cl.m_class = &m_classes.back(); cl.m_map = &m_map; return cl; @@ -71,13 +71,13 @@ namespace { public: - const TVector<wchar32>& Klass(wchar32 x) const + const TVector<wchar32>& Klass(wchar32 x) const { - TMap<wchar32, TVector<wchar32>*>::const_iterator i = m_map.find(x); + TMap<wchar32, TVector<wchar32>*>::const_iterator i = m_map.find(x); if (i != m_map.end()) return *i->second; else - return DefaultValue< TVector<wchar32> >(); + return DefaultValue< TVector<wchar32> >(); } GlyphTable() @@ -119,7 +119,7 @@ namespace { const CharSet& old = range.first; CharSet altered; for (auto&& i : old) { - const TVector<wchar32>* klass = 0; + const TVector<wchar32>* klass = 0; if (i.size() == 1 && !(klass = &m_table->Klass(i[0]))->empty()) for (auto&& j : *klass) altered.insert(Term::String(1, j)); diff --git a/contrib/libs/pire/pire/fsm.cpp b/contrib/libs/pire/pire/fsm.cpp index 984d708dfab..909de9e3223 100644 --- a/contrib/libs/pire/pire/fsm.cpp +++ b/contrib/libs/pire/pire/fsm.cpp @@ -11,7 +11,7 @@ * it under the terms of the GNU Lesser Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * Pire is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -42,7 +42,7 @@ #include "platform.h" namespace Pire { - + ystring CharDump(Char c) { char buf[8]; @@ -75,7 +75,7 @@ ystring CharDump(Char c) void Fsm::DumpState(yostream& s, size_t state) const { // Fill in a 'row': Q -> exp(V) (for current state) - TVector< ybitset<MaxChar> > row(Size()); + TVector< ybitset<MaxChar> > row(Size()); for (auto&& transition : m_transitions[state]) for (auto&& transitionState : transition.second) { if (transitionState >= Size()) { @@ -157,7 +157,7 @@ void Fsm::DumpState(yostream& s, size_t state) const if (oit2 == oit->second.end()) ; else { - TVector<int> payload; + TVector<int> payload; for (unsigned i = 0; i < sizeof(oit2->second) * 8; ++i) if (oit2->second & (1ul << i)) payload.push_back(i); @@ -236,9 +236,9 @@ const Fsm::StatesSet& Fsm::Destinations(size_t from, Char c) const return (i != m_transitions[from].end()) ? i->second : DefaultValue<StatesSet>(); } -TSet<Char> Fsm::OutgoingLetters(size_t state) const +TSet<Char> Fsm::OutgoingLetters(size_t state) const { - TSet<Char> ret; + TSet<Char> ret; for (auto&& i : m_transitions[state]) ret.insert(i.first); return ret; @@ -291,7 +291,7 @@ Fsm& Fsm::Append(char c) determined = false; return *this; } - + Fsm& Fsm::Append(const ystring& str) { for (auto&& i : str) @@ -309,7 +309,7 @@ Fsm& Fsm::AppendSpecial(Char c) return *this; } -Fsm& Fsm::AppendStrings(const TVector<ystring>& strings) +Fsm& Fsm::AppendStrings(const TVector<ystring>& strings) { for (auto&& i : strings) if (i.empty()) @@ -326,15 +326,15 @@ Fsm& Fsm::AppendStrings(const TVector<ystring>& strings) // state #0 cannot appear in LTRs. Thus we can use this // criteria to test whether a transition has been created or not. typedef ypair<size_t, char> Transition; - TMap<char, size_t> startLtr; - TMap<Transition, size_t> ltr; + TMap<char, size_t> startLtr; + TMap<Transition, size_t> ltr; // A presense of a transition in this set indicates that // a that transition already points somewhere (either to end // or somewhere else). Another attempt to create such transition // will clear `determined flag. - TSet<Transition> usedTransitions; - TSet<char> usedFirsts; + TSet<Transition> usedTransitions; + TSet<char> usedFirsts; for (const auto& str : strings) { if (str.size() > 1) { @@ -398,7 +398,7 @@ void Fsm::Import(const Fsm& rhs) auto dest = m_transitions.begin() + oldsize; for (auto outer = rhs.m_transitions.begin(), outerEnd = rhs.m_transitions.end(); outer != outerEnd; ++outer, ++dest) { for (auto&& inner : *outer) { - TSet<size_t> targets; + TSet<size_t> targets; std::transform(inner.second.begin(), inner.second.end(), std::inserter(targets, targets.begin()), std::bind2nd(std::plus<size_t>(), oldsize)); dest->insert(ymake_pair(inner.first, targets)); @@ -504,7 +504,7 @@ Fsm& Fsm::operator |= (const Fsm& rhs) Import(rhs); for (auto&& final : rhs.m_final) m_final.insert(final + lhsSize); - + if (!isAlternative && !rhs.isAlternative) { Resize(Size() + 1); Connect(Size() - 1, initial); @@ -598,40 +598,40 @@ void Fsm::MakeSuffix() Connect(initial, i); ClearHints(); } - + Fsm& Fsm::Reverse() -{ +{ Fsm out; out.Resize(Size() + 1); out.letters = Letters(); - + // Invert transitions for (size_t from = 0; from < Size(); ++from) for (auto&& i : m_transitions[from]) for (auto&& j : i.second) out.Connect(j, from, i.first); - + // Invert initial and final states out.m_final.clear(); out.SetFinal(initial, true); for (auto i : m_final) out.Connect(Size(), i, Epsilon); out.SetInitial(Size()); - + // Invert outputs for (auto&& i : outputs) for (auto&& j : i.second) out.SetOutput(j.first, i.first, j.second); - + // Preserve tags (although thier semantics are usually heavily broken at this point) out.tags = tags; - + // Apply Swap(out); return *this; } -TSet<size_t> Fsm::DeadStates() const +TSet<size_t> Fsm::DeadStates() const { TSet<size_t> res; @@ -697,7 +697,7 @@ void Fsm::RemoveDeadEnds() { PIRE_IFDEBUG(Cdbg << "Removing dead ends on:" << Endl << *this << Endl); - TSet<size_t> dead = DeadStates(); + TSet<size_t> dead = DeadStates(); // Erase all useless states for (auto&& i : dead) { PIRE_IFDEBUG(Cdbg << "Removing useless state " << i << Endl); @@ -726,7 +726,7 @@ void Fsm::MergeEpsilonConnection(size_t from, size_t to) // Merge transitions from 'to' state into transitions from 'from' state for (auto&& transition : m_transitions[to]) { - TSet<size_t> connStates; + TSet<size_t> connStates; std::copy(transition.second.begin(), transition.second.end(), std::inserter(m_transitions[from][transition.first], m_transitions[from][transition.first].end())); @@ -766,7 +766,7 @@ void Fsm::MergeEpsilonConnection(size_t from, size_t to) // finds all states which are Epsilon-reachable from 'thru' and connects // them directly to 'from' with Epsilon transition having proper output. // Updates inverse map of epsilon transitions as well. -void Fsm::ShortCutEpsilon(size_t from, size_t thru, TVector< TSet<size_t> >& inveps) +void Fsm::ShortCutEpsilon(size_t from, size_t thru, TVector< TSet<size_t> >& inveps) { PIRE_IFDEBUG(Cdbg << "In Fsm::ShortCutEpsilon(" << from << ", " << thru << ")\n"); const StatesSet& to = Destinations(thru, Epsilon); @@ -778,7 +778,7 @@ void Fsm::ShortCutEpsilon(size_t from, size_t thru, TVector< TSet<size_t> >& inv inveps[toElement].insert(from); if (outIt != outputs.end()) outIt->second[toElement] |= (fromThruOut | Output(thru, toElement)); - } + } } // Removes all Epsilon-connections by iterating though states and merging each Epsilon-connection @@ -786,15 +786,15 @@ void Fsm::ShortCutEpsilon(size_t from, size_t thru, TVector< TSet<size_t> >& inv void Fsm::RemoveEpsilons() { Unsparse(); - + // Build inverse map of epsilon transitions - TVector< TSet<size_t> > inveps(Size()); // We have to use TSet<> here since we want it sorted + TVector< TSet<size_t> > inveps(Size()); // We have to use TSet<> here since we want it sorted for (size_t from = 0; from != Size(); ++from) { const StatesSet& tos = Destinations(from, Epsilon); for (auto&& to : tos) inveps[to].insert(from); } - + // Make a transitive closure of all epsilon transitions (Floyd-Warshall algorithm) // (if there exists an epsilon-path between two states, epsilon-connect them directly) for (size_t thru = 0; thru != Size(); ++thru) @@ -802,9 +802,9 @@ void Fsm::RemoveEpsilons() // inveps[thru] may alter during loop body, hence we cannot cache ivneps[thru].end() if (from != thru) ShortCutEpsilon(from, thru, inveps); - + PIRE_IFDEBUG(Cdbg << "=== After epsilons shortcut\n" << *this << Endl); - + // Iterate through all epsilon-connected state pairs, merging states together for (size_t from = 0; from != Size(); ++from) { const StatesSet& to = Destinations(from, Epsilon); @@ -812,13 +812,13 @@ void Fsm::RemoveEpsilons() if (toElement != from) MergeEpsilonConnection(from, toElement); // it's a NOP if to == from, so don't waste time } - + PIRE_IFDEBUG(Cdbg << "=== After epsilons merged\n" << *this << Endl); - + // Drop all epsilon transitions for (auto&& i : m_transitions) i.erase(Epsilon); - + Sparse(); ClearHints(); } @@ -859,9 +859,9 @@ void Fsm::Unsparse() // Returns a set of 'terminal states', which are those of the final states, // from which a transition to themselves on any letter is possible. -TSet<size_t> Fsm::TerminalStates() const +TSet<size_t> Fsm::TerminalStates() const { - TSet<size_t> terminals; + TSet<size_t> terminals; for (auto&& final : m_final) { bool ok = true; for (auto&& letter : letters) { @@ -877,10 +877,10 @@ TSet<size_t> Fsm::TerminalStates() const namespace Impl { class FsmDetermineTask { public: - typedef TVector<size_t> State; + typedef TVector<size_t> State; typedef Fsm::LettersTbl LettersTbl; - typedef TMap<State, size_t> InvStates; - + typedef TMap<State, size_t> InvStates; + FsmDetermineTask(const Fsm& fsm) : mFsm(fsm) , mTerminals(fsm.TerminalStates()) @@ -888,7 +888,7 @@ public: PIRE_IFDEBUG(Cdbg << "Terminal states: [" << Join(mTerminals.begin(), mTerminals.end(), ", ") << "]" << Endl); } const LettersTbl& Letters() const { return mFsm.letters; } - + State Initial() const { return State(1, mFsm.initial); } bool IsRequired(const State& state) const { @@ -897,7 +897,7 @@ public: return false; return true; } - + State Next(const State& state, Char letter) const { State next; @@ -913,8 +913,8 @@ public: << "--> [" << Join(next.begin(), next.end(), ", ") << "]" << Endl); return next; } - - void AcceptStates(const TVector<State>& states) + + void AcceptStates(const TVector<State>& states) { mNewFsm.Resize(states.size()); mNewFsm.initial = 0; @@ -924,7 +924,7 @@ public: for (size_t ns = 0; ns < states.size(); ++ns) { PIRE_IFDEBUG(Cdbg << "State " << ns << " = [" << Join(states[ns].begin(), states[ns].end(), ", ") << "]" << Endl); for (auto&& j : states[ns]) { - + // If it was a terminal state, connect it to itself if (mTerminals.find(j) != mTerminals.end()) { for (auto&& letter : Letters()) @@ -943,7 +943,7 @@ public: // hence weve done with this state and got nothing more to do. break; } - + // Bitwise OR all tags in states auto ti = mFsm.tags.find(j); if (ti != mFsm.tags.end()) { @@ -953,12 +953,12 @@ public: } } // For each old state, prepare a list of new state it is contained in - typedef TMap< size_t, TVector<size_t> > Old2New; + typedef TMap< size_t, TVector<size_t> > Old2New; Old2New old2new; for (size_t ns = 0; ns < states.size(); ++ns) for (auto&& j : states[ns]) old2new[j].push_back(ns); - + // Copy all outputs for (auto&& i : mFsm.outputs) { for (auto&& j : i.second) { @@ -973,7 +973,7 @@ public: } PIRE_IFDEBUG(Cdbg << "New terminals = [" << Join(mNewTerminals.begin(), mNewTerminals.end(), ",") << "]" << Endl); } - + void Connect(size_t from, size_t to, Char letter) { PIRE_IFDEBUG(Cdbg << "Connecting " << from << " --" << letter << "--> " << to << Endl); @@ -1004,13 +1004,13 @@ public: } Result Failure() { return false; } - + Fsm& Output() { return mNewFsm; } private: const Fsm& mFsm; Fsm mNewFsm; - TSet<size_t> mTerminals; - TSet<size_t> mNewTerminals; + TSet<size_t> mTerminals; + TSet<size_t> mNewTerminals; }; } @@ -1021,10 +1021,10 @@ bool Fsm::Determine(size_t maxsize /* = 0 */) return true; PIRE_IFDEBUG(Cdbg << "=== Initial ===" << Endl << *this << Endl); - + RemoveEpsilons(); PIRE_IFDEBUG(Cdbg << "=== After all epsilons removed" << Endl << *this << Endl); - + Impl::FsmDetermineTask task(*this); if (Pire::Impl::Determine(task, maxsize ? maxsize : MaxSize)) { task.Output().Swap(*this); @@ -1162,7 +1162,7 @@ void Fsm::Minimize() Fsm& Fsm::Canonize(size_t maxSize /* = 0 */) { if (!IsDetermined()) { - if (!Determine(maxSize)) + if (!Determine(maxSize)) throw Error("regexp pattern too complicated"); } Minimize(); @@ -1175,7 +1175,7 @@ void Fsm::PrependAnything() Resize(Size() + 1); for (size_t letter = 0; letter < MaxChar; ++letter) Connect(newstate, newstate, letter); - + Connect(newstate, initial); initial = newstate; @@ -1188,7 +1188,7 @@ void Fsm::AppendAnything() Resize(Size() + 1); for (size_t letter = 0; letter < MaxChar; ++letter) Connect(newstate, newstate, letter); - + ConnectFinal(newstate); ClearFinal(); SetFinal(newstate, 1); diff --git a/contrib/libs/pire/pire/fsm.h b/contrib/libs/pire/pire/fsm.h index 4dad06ca065..dd1784377d1 100644 --- a/contrib/libs/pire/pire/fsm.h +++ b/contrib/libs/pire/pire/fsm.h @@ -60,7 +60,7 @@ namespace Pire { /// and case-insensitive comparison of multibyte characters, /// when one string represents a lowercase variant of a character, /// while another string represents its uppercase variant. - Fsm& AppendStrings(const TVector<ystring>& strings); + Fsm& AppendStrings(const TVector<ystring>& strings); /// Appends a part matching a single byte (any). Fsm& AppendDot(); @@ -108,7 +108,7 @@ namespace Pire { Fsm& Reverse(); /// Returns a set of states from which no final states are reachable - TSet<size_t> DeadStates() const; + TSet<size_t> DeadStates() const; /// Removes all dead end paths from FSM void RemoveDeadEnds(); @@ -122,9 +122,9 @@ namespace Pire { void DumpState(yostream& s, size_t state) const; void DumpTo(yostream& s, const ystring& name = "") const; - typedef TSet<size_t> StatesSet; - typedef TMap<size_t, StatesSet> TransitionRow; - typedef TVector<TransitionRow> TransitionTable; + typedef TSet<size_t> StatesSet; + typedef TMap<size_t, StatesSet> TransitionRow; + typedef TVector<TransitionRow> TransitionTable; struct LettersEquality { LettersEquality(const Fsm::TransitionTable& tbl): m_tbl(&tbl) {} @@ -133,7 +133,7 @@ namespace Pire { const Fsm::TransitionTable* m_tbl; }; - typedef TSet<size_t> FinalTable; + typedef TSet<size_t> FinalTable; typedef Partition<Char, LettersEquality> LettersTbl; @@ -174,7 +174,7 @@ namespace Pire { bool Connected(size_t from, size_t to, Char c) const; /// Returns a set of letters on which a transition from the specified state exists - TSet<Char> OutgoingLetters(size_t state) const; + TSet<Char> OutgoingLetters(size_t state) const; /// Returns a set of states where a transition from the given state using the given letter is possible const StatesSet& Destinations(size_t from, Char letter) const; @@ -226,19 +226,19 @@ namespace Pire { bool determined; /// Output - typedef TMap< size_t, TMap<size_t, unsigned long> > Outputs; + typedef TMap< size_t, TMap<size_t, unsigned long> > Outputs; Outputs outputs; - typedef TMap<size_t, unsigned long> Tags; + typedef TMap<size_t, unsigned long> Tags; Tags tags; /// Heuristics hit: true iff this FSM is a union of two other FSMs bool isAlternative; - void ShortCutEpsilon(size_t from, size_t thru, TVector< TSet<size_t> >& inveps); ///< internal + void ShortCutEpsilon(size_t from, size_t thru, TVector< TSet<size_t> >& inveps); ///< internal void MergeEpsilonConnection(size_t from, size_t to); ///< internal - TSet<size_t> TerminalStates() const; + TSet<size_t> TerminalStates() const; Char Translate(Char c) const; @@ -252,7 +252,7 @@ namespace Pire { template<class Scanner> void BuildScanner(const Fsm& fsm, Scanner& r) { - TSet<size_t> dead; + TSet<size_t> dead; if (Scanner::DeadFlag) dead = fsm.DeadStates(); diff --git a/contrib/libs/pire/pire/glue.h b/contrib/libs/pire/pire/glue.h index bac086f2f00..96e8957feba 100644 --- a/contrib/libs/pire/pire/glue.h +++ b/contrib/libs/pire/pire/glue.h @@ -105,7 +105,7 @@ private: } TArrayHolder<value_type> mMap; - TVector<bool> mFilled; + TVector<bool> mFilled; // Noncopyable GluedStateLookupTable(const GluedStateLookupTable&); diff --git a/contrib/libs/pire/pire/inline.l b/contrib/libs/pire/pire/inline.l index a4d2e1a836f..ba7eb7a8390 100644 --- a/contrib/libs/pire/pire/inline.l +++ b/contrib/libs/pire/pire/inline.l @@ -37,7 +37,7 @@ ystring filename = ""; int line = 1; -TVector<ystring> args; +TVector<ystring> args; #ifdef _WIN32 #if _MCS_VER >= 1600 diff --git a/contrib/libs/pire/pire/partition.h b/contrib/libs/pire/pire/partition.h index 85a9af88635..fd9ae6f1aa5 100644 --- a/contrib/libs/pire/pire/partition.h +++ b/contrib/libs/pire/pire/partition.h @@ -37,7 +37,7 @@ namespace Pire { template<class T, class Eq> class Partition { private: - typedef TMap< T, ypair< size_t, TVector<T> > > Set; + typedef TMap< T, ypair< size_t, TVector<T> > > Set; public: Partition(const Eq& eq) @@ -103,7 +103,7 @@ public: } /// Returns the whole equivalence class of @p t (i.e. item @p i /// is returned iff representative(i) == representative(t)). - const TVector<T>& Klass(const T& t) const + const TVector<T>& Klass(const T& t) const { auto it = m_inv.find(t); if (it == m_inv.end()) @@ -143,7 +143,7 @@ public: private: Eq m_eq; Set m_set; - TMap<T, T> m_inv; + TMap<T, T> m_inv; size_t m_maxidx; void DoAppend(Set& set, const T& t) @@ -159,7 +159,7 @@ private: if (it == end) { // Begin new set - TVector<T> v(1, t); + TVector<T> v(1, t); set.insert(ymake_pair(t, ymake_pair(m_maxidx++, v))); m_inv[t] = t; } diff --git a/contrib/libs/pire/pire/re_lexer.h b/contrib/libs/pire/pire/re_lexer.h index 5591c16d34e..6873f89cdab 100644 --- a/contrib/libs/pire/pire/re_lexer.h +++ b/contrib/libs/pire/pire/re_lexer.h @@ -74,8 +74,8 @@ enum { */ class Term { public: - typedef TVector<wchar32> String; - typedef TSet<String> Strings; + typedef TVector<wchar32> String; + typedef TSet<String> Strings; typedef ypair<int, int> RepetitionCount; typedef ypair<Strings, bool> CharacterRange; @@ -170,7 +170,7 @@ private: void InstallDefaultFeatures(); - TDeque<wchar32> m_input; + TDeque<wchar32> m_input; const Pire::Encoding* m_encoding; TVector<THolder<Feature>> m_features; Any m_retval; diff --git a/contrib/libs/pire/pire/re_parser.y b/contrib/libs/pire/pire/re_parser.y index dbad88e2872..94c8fa7bdcb 100644 --- a/contrib/libs/pire/pire/re_parser.y +++ b/contrib/libs/pire/pire/re_parser.y @@ -178,7 +178,7 @@ void yyerror(Pire::Lexer& rlex, const char* str) void AppendRange(const Encoding& encoding, Fsm& a, const Term::CharacterRange& cr) { - TVector<ystring> strings; + TVector<ystring> strings; for (auto&& i : cr.first) { ystring s; diff --git a/contrib/libs/pire/pire/scanner_io.cpp b/contrib/libs/pire/pire/scanner_io.cpp index 3956e3c6edb..aea6d387c7c 100644 --- a/contrib/libs/pire/pire/scanner_io.cpp +++ b/contrib/libs/pire/pire/scanner_io.cpp @@ -206,7 +206,7 @@ void LoadedScanner::Load(yistream* s, ui32* type) Impl::AlignedLoadArray(s, sc.m_letters, MaxChar); Impl::AlignedLoadArray(s, sc.m_jumps, sc.m.statesCount * sc.m.lettersCount); if (header.Version == Header::RE_VERSION_WITH_MACTIONS) { - TVector<Action> actions(sc.m.statesCount * sc.m.lettersCount); + TVector<Action> actions(sc.m.statesCount * sc.m.lettersCount); Impl::AlignedLoadArray(s, actions.data(), actions.size()); } Impl::AlignedLoadArray(s, sc.m_tags, sc.m.statesCount); diff --git a/contrib/libs/pire/pire/scanners/multi.h b/contrib/libs/pire/pire/scanners/multi.h index 29679e416ed..b3e8a72a670 100644 --- a/contrib/libs/pire/pire/scanners/multi.h +++ b/contrib/libs/pire/pire/scanners/multi.h @@ -402,7 +402,7 @@ protected: Y_ASSERT(m_buffer == nullptr); // Ensure that specializations of Scanner across different Relocations do not touch its Locals - static_assert(sizeof(m) == sizeof(s.m), "sizeof(m) == sizeof(s.m)"); + static_assert(sizeof(m) == sizeof(s.m), "sizeof(m) == sizeof(s.m)"); memcpy(&m, &s.m, sizeof(s.m)); m.relocationSignature = Relocation::Signature; m.shortcuttingSignature = Shortcutting::Signature; @@ -475,7 +475,7 @@ protected: Y_ASSERT(m_buffer); // Build the mapping from letter classes to characters - TVector< TVector<char> > letters(RowSize()); + TVector< TVector<char> > letters(RowSize()); for (unsigned ch = 0; ch != 1 << (sizeof(char)*8); ++ch) letters[m_letters[ch]].push_back(ch); @@ -1012,7 +1012,7 @@ public: { } - void AcceptStates(const TVector<State>& states) + void AcceptStates(const TVector<State>& states) { // Make up a new scanner and fill in the final table diff --git a/contrib/libs/pire/pire/scanners/slow.h b/contrib/libs/pire/pire/scanners/slow.h index 6adfcb8c1d0..068779644d1 100644 --- a/contrib/libs/pire/pire/scanners/slow.h +++ b/contrib/libs/pire/pire/scanners/slow.h @@ -62,7 +62,7 @@ public: }; struct State { - TVector<unsigned> states; + TVector<unsigned> states; BitSet flags; State() {} @@ -352,8 +352,8 @@ private: size_t* m_jumpPos; size_t* m_letters; - TVector<void*> m_pool; - TVector< TVector<unsigned> > m_vec, *m_vecptr; + TVector<void*> m_pool; + TVector< TVector<unsigned> > m_vec, *m_vecptr; bool need_actions; TVector<TVector<Action>> m_actionsvec; diff --git a/contrib/libs/pire/pire/stub/stl.h b/contrib/libs/pire/pire/stub/stl.h index 98ebd9f7c6f..af708d9403c 100644 --- a/contrib/libs/pire/pire/stub/stl.h +++ b/contrib/libs/pire/pire/stub/stl.h @@ -8,7 +8,7 @@ #include <utility> #include <memory> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/deque.h> #include <util/generic/list.h> @@ -26,7 +26,7 @@ #include <util/string/vector.h> namespace Pire { - using ystring = TString; + using ystring = TString; template<size_t N> using ybitset = std::bitset<N>; template<typename T1, typename T2> using ypair = std::pair<T1, T2>; template<typename T> using yauto_ptr = std::auto_ptr<T>; @@ -60,7 +60,7 @@ namespace Pire { typedef IInputStream yistream; template<class Iter> - ystring Join(Iter begin, Iter end, const ystring& separator) { return JoinStrings(begin, end, separator); } + ystring Join(Iter begin, Iter end, const ystring& separator) { return JoinStrings(begin, end, separator); } } #endif diff --git a/contrib/libs/pire/pire/vbitset.h b/contrib/libs/pire/pire/vbitset.h index 69cb5aeba3d..7d16976fa15 100644 --- a/contrib/libs/pire/pire/vbitset.h +++ b/contrib/libs/pire/pire/vbitset.h @@ -97,7 +97,7 @@ public: private: typedef unsigned char ContainerType; static const size_t ItemSize = sizeof(ContainerType) * 8; - TVector<ContainerType> m_data; + TVector<ContainerType> m_data; size_t m_size; static size_t RoundUp(size_t x) { return x / ItemSize + ((x % ItemSize) ? 1 : 0); } diff --git a/contrib/libs/protobuf/python/ya.make b/contrib/libs/protobuf/python/ya.make index 42bc625109c..bb505722acb 100644 --- a/contrib/libs/protobuf/python/ya.make +++ b/contrib/libs/protobuf/python/ya.make @@ -4,10 +4,10 @@ WITHOUT_LICENSE_TEXTS() LICENSE(BSD-3-Clause) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) GENERATE_PY_PROTOS(contrib/libs/protobuf/src/google/protobuf/descriptor.proto) diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc index 3ae4a39fd5a..f8239688231 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc @@ -961,7 +961,7 @@ PerlXSGenerator::GenerateMessageXSFieldAccessors(const FieldDescriptor* field, " STRLEN len;\n"); if ( type == FieldDescriptor::TYPE_STRING ) { printer.Print(vars, - " TString $value$;\n"); + " TString $value$;\n"); } printer.Print("\n" " CODE:\n"); @@ -1160,7 +1160,7 @@ PerlXSGenerator::GenerateMessageXSCommonMethods(const Descriptor* descriptor, "error_string(svTHIS)\n" " SV * svTHIS\n" " PREINIT:\n" - " TString estr;\n" + " TString estr;\n" "\n" " CODE:\n"); GenerateTypemapInput(descriptor, printer, "THIS"); @@ -1203,7 +1203,7 @@ PerlXSGenerator::GenerateMessageXSCommonMethods(const Descriptor* descriptor, "debug_string(svTHIS)\n" " SV * svTHIS\n" " PREINIT:\n" - " TString dstr;\n" + " TString dstr;\n" "\n" " CODE:\n"); GenerateTypemapInput(descriptor, printer, "THIS"); @@ -1225,7 +1225,7 @@ PerlXSGenerator::GenerateMessageXSCommonMethods(const Descriptor* descriptor, "short_debug_string(svTHIS)\n" " SV * svTHIS\n" " PREINIT:\n" - " TString dstr;\n" + " TString dstr;\n" "\n" " CODE:\n"); GenerateTypemapInput(descriptor, printer, "THIS"); @@ -1913,7 +1913,7 @@ PerlXSGenerator::FieldFromHashrefHelper(io::Printer& printer, "char * str;\n"); if ( field->type() == FieldDescriptor::TYPE_STRING ) { - printer.Print("TString sval;\n"); + printer.Print("TString sval;\n"); } printer.Print(vars, diff --git a/contrib/libs/rapidjson/ya.make b/contrib/libs/rapidjson/ya.make index 0b26c5cc64a..88990f37ff4 100644 --- a/contrib/libs/rapidjson/ya.make +++ b/contrib/libs/rapidjson/ya.make @@ -11,10 +11,10 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) VERSION(1.1.0) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) ADDINCL( contrib/libs/rapidjson/include diff --git a/contrib/libs/utf8proc/ya.make b/contrib/libs/utf8proc/ya.make index 5da2c75ea83..fbc5098e4b2 100644 --- a/contrib/libs/utf8proc/ya.make +++ b/contrib/libs/utf8proc/ya.make @@ -7,10 +7,10 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) VERSION(2.1.1) diff --git a/contrib/libs/xz/common/ya.make b/contrib/libs/xz/common/ya.make index ce25e6a2302..a536e76e8c0 100644 --- a/contrib/libs/xz/common/ya.make +++ b/contrib/libs/xz/common/ya.make @@ -1,7 +1,7 @@ OWNER( thegeorg g:contrib - g:cpp-contrib + g:cpp-contrib ) # This is a part of xz utils package. Source can be downloaded from diff --git a/contrib/libs/xz/liblzma/ya.make b/contrib/libs/xz/liblzma/ya.make index d548283a2bd..9d02ac3cb61 100644 --- a/contrib/libs/xz/liblzma/ya.make +++ b/contrib/libs/xz/liblzma/ya.make @@ -1,7 +1,7 @@ OWNER( thegeorg g:contrib - g:cpp-contrib + g:cpp-contrib ) # This is a part of xz utils package. Source can be downloaded from diff --git a/contrib/libs/xz/ya.make b/contrib/libs/xz/ya.make index 3448d44354a..10d35fefbe1 100644 --- a/contrib/libs/xz/ya.make +++ b/contrib/libs/xz/ya.make @@ -1,8 +1,8 @@ -OWNER( - g:contrib - g:cpp-contrib -) - +OWNER( + g:contrib + g:cpp-contrib +) + VERSION(5.2.4) RECURSE( diff --git a/contrib/libs/ya.make b/contrib/libs/ya.make index 9c4640fdcf2..7b4d11f1177 100644 --- a/contrib/libs/ya.make +++ b/contrib/libs/ya.make @@ -1,7 +1,7 @@ -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) RECURSE( afl diff --git a/contrib/libs/yaml-cpp/ya.make b/contrib/libs/yaml-cpp/ya.make index 058caf92fa9..b5d4ea59f93 100644 --- a/contrib/libs/yaml-cpp/ya.make +++ b/contrib/libs/yaml-cpp/ya.make @@ -9,12 +9,12 @@ VERSION(0.5.3) OWNER( g:antiinfra g:contrib - g:cpp-contrib + g:cpp-contrib ) NO_UTIL() -NO_WSHADOW() +NO_WSHADOW() ADDINCL(GLOBAL contrib/libs/yaml-cpp/include) diff --git a/contrib/libs/zlib/dynamic/ya.make b/contrib/libs/zlib/dynamic/ya.make index e112ea99799..77cde174cbe 100644 --- a/contrib/libs/zlib/dynamic/ya.make +++ b/contrib/libs/zlib/dynamic/ya.make @@ -1,5 +1,5 @@ -OWNER( - g:contrib - g:cpp-contrib -) +OWNER( + g:contrib + g:cpp-contrib +) DLL_FOR(contrib/libs/zlib) diff --git a/contrib/libs/zstd06/ya.make b/contrib/libs/zstd06/ya.make index e35f69f443c..92fcb983671 100644 --- a/contrib/libs/zstd06/ya.make +++ b/contrib/libs/zstd06/ya.make @@ -9,11 +9,11 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -OWNER( - pg - g:contrib - g:cpp-contrib -) +OWNER( + pg + g:contrib + g:cpp-contrib +) NO_UTIL() diff --git a/contrib/restricted/boost/boost/coroutine2/detail/pull_control_block_cc.ipp b/contrib/restricted/boost/boost/coroutine2/detail/pull_control_block_cc.ipp index 9240c4619ad..7a41239f3bd 100644 --- a/contrib/restricted/boost/boost/coroutine2/detail/pull_control_block_cc.ipp +++ b/contrib/restricted/boost/boost/coroutine2/detail/pull_control_block_cc.ipp @@ -21,11 +21,11 @@ #include <boost/coroutine2/detail/forced_unwind.hpp> #include <boost/coroutine2/detail/wrap.hpp> -#include <util/system/compiler.h> - -Y_PRAGMA_DIAGNOSTIC_PUSH -Y_PRAGMA_NO_WSHADOW - +#include <util/system/compiler.h> + +Y_PRAGMA_DIAGNOSTIC_PUSH +Y_PRAGMA_NO_WSHADOW + #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif @@ -419,6 +419,6 @@ pull_coroutine< void >::control_block::valid() const noexcept { # include BOOST_ABI_SUFFIX #endif -Y_PRAGMA_DIAGNOSTIC_POP - +Y_PRAGMA_DIAGNOSTIC_POP + #endif // BOOST_COROUTINES2_DETAIL_PULL_CONTROL_BLOCK_IPP diff --git a/contrib/restricted/boost/boost/coroutine2/detail/push_control_block_cc.ipp b/contrib/restricted/boost/boost/coroutine2/detail/push_control_block_cc.ipp index 8297dd17543..b2589e5c029 100644 --- a/contrib/restricted/boost/boost/coroutine2/detail/push_control_block_cc.ipp +++ b/contrib/restricted/boost/boost/coroutine2/detail/push_control_block_cc.ipp @@ -20,11 +20,11 @@ #include <boost/coroutine2/detail/forced_unwind.hpp> #include <boost/coroutine2/detail/wrap.hpp> -#include <util/system/compiler.h> - -Y_PRAGMA_DIAGNOSTIC_PUSH -Y_PRAGMA_NO_WSHADOW - +#include <util/system/compiler.h> + +Y_PRAGMA_DIAGNOSTIC_PUSH +Y_PRAGMA_NO_WSHADOW + #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif @@ -380,6 +380,6 @@ push_coroutine< void >::control_block::valid() const noexcept { # include BOOST_ABI_SUFFIX #endif -Y_PRAGMA_DIAGNOSTIC_POP - +Y_PRAGMA_DIAGNOSTIC_POP + #endif // BOOST_COROUTINES2_DETAIL_PUSH_CONTROL_BLOCK_IPP diff --git a/contrib/restricted/boost/boost/date_time/gregorian/gregorian_io.hpp b/contrib/restricted/boost/boost/date_time/gregorian/gregorian_io.hpp index 7da718f8a02..e45ac54d373 100644 --- a/contrib/restricted/boost/boost/date_time/gregorian/gregorian_io.hpp +++ b/contrib/restricted/boost/boost/date_time/gregorian/gregorian_io.hpp @@ -21,29 +21,29 @@ #include <boost/date_time/gregorian/gregorian_types.hpp> #include <boost/date_time/gregorian/conversion.hpp> // to_tm will be needed in the facets -#include <util/system/compiler.h> -Y_PRAGMA_DIAGNOSTIC_PUSH -Y_PRAGMA_NO_WSHADOW - +#include <util/system/compiler.h> +Y_PRAGMA_DIAGNOSTIC_PUSH +Y_PRAGMA_NO_WSHADOW + namespace boost { namespace gregorian { typedef boost::date_time::period_formatter<wchar_t> wperiod_formatter; typedef boost::date_time::period_formatter<char> period_formatter; - + typedef boost::date_time::date_facet<date,wchar_t> wdate_facet; typedef boost::date_time::date_facet<date,char> date_facet; typedef boost::date_time::period_parser<date,char> period_parser; typedef boost::date_time::period_parser<date,wchar_t> wperiod_parser; - - typedef boost::date_time::special_values_formatter<char> special_values_formatter; - typedef boost::date_time::special_values_formatter<wchar_t> wspecial_values_formatter; - - typedef boost::date_time::special_values_parser<date,char> special_values_parser; - typedef boost::date_time::special_values_parser<date,wchar_t> wspecial_values_parser; - + + typedef boost::date_time::special_values_formatter<char> special_values_formatter; + typedef boost::date_time::special_values_formatter<wchar_t> wspecial_values_formatter; + + typedef boost::date_time::special_values_parser<date,char> special_values_parser; + typedef boost::date_time::special_values_parser<date,wchar_t> wspecial_values_parser; + typedef boost::date_time::date_input_facet<date,char> date_input_facet; typedef boost::date_time::date_input_facet<date,wchar_t> wdate_input_facet; @@ -57,7 +57,7 @@ namespace gregorian { std::use_facet<custom_date_facet>(os.getloc()).put(output_itr, os, os.fill(), d); else { //instantiate a custom facet for dealing with dates since the user - //has not put one in the stream so far. This is for efficiency + //has not put one in the stream so far. This is for efficiency //since we would always need to reconstruct for every date //if the locale did not already exist. Of course this will be overridden //if the user imbues at some later point. With the default settings @@ -94,23 +94,23 @@ namespace gregorian { f->get(sit, str_end, is, d); } } - catch(...) { + catch(...) { // mask tells us what exceptions are turned on std::ios_base::iostate exception_mask = is.exceptions(); - // if the user wants exceptions on failbit, we'll rethrow our + // if the user wants exceptions on failbit, we'll rethrow our // date_time exception & set the failbit if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} // ignore this one throw; // rethrow original exception } else { // if the user want's to fail quietly, we simply set the failbit - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } - } + } return is; } @@ -155,17 +155,17 @@ namespace gregorian { f->get(sit, str_end, is, dd); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -181,7 +181,7 @@ namespace gregorian { std::use_facet<custom_date_facet>(os.getloc()).put(output_itr, os, os.fill(), dp); else { //instantiate a custom facet for dealing with date periods since the user - //has not put one in the stream so far. This is for efficiency + //has not put one in the stream so far. This is for efficiency //since we would always need to reconstruct for every time period //if the local did not already exist. Of course this will be overridden //if the user imbues at some later point. With the default settings @@ -196,14 +196,14 @@ namespace gregorian { return os; } - //! input operator for date_period + //! input operator for date_period template <class CharT, class Traits> inline std::basic_istream<CharT, Traits>& operator>>(std::basic_istream<CharT, Traits>& is, date_period& dp) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -219,24 +219,24 @@ namespace gregorian { f->get(sit, str_end, is, dp); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; } /********** small gregorian types **********/ - + template <class CharT, class TraitsT> inline std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const boost::gregorian::greg_month& gm) { @@ -262,7 +262,7 @@ namespace gregorian { operator>>(std::basic_istream<CharT, Traits>& is, greg_month& m) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -278,17 +278,17 @@ namespace gregorian { f->get(sit, str_end, is, m); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -311,7 +311,7 @@ namespace gregorian { } return os; } - + //! input operator for greg_weekday template <class CharT, class Traits> inline @@ -319,7 +319,7 @@ namespace gregorian { operator>>(std::basic_istream<CharT, Traits>& is, greg_weekday& wd) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -335,17 +335,17 @@ namespace gregorian { f->get(sit, str_end, is, wd); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -360,7 +360,7 @@ namespace gregorian { operator>>(std::basic_istream<CharT, Traits>& is, greg_day& gd) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -376,17 +376,17 @@ namespace gregorian { f->get(sit, str_end, is, gd); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -401,7 +401,7 @@ namespace gregorian { operator>>(std::basic_istream<CharT, Traits>& is, greg_year& gy) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -417,24 +417,24 @@ namespace gregorian { f->get(sit, str_end, is, gy); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; } /********** date generator types **********/ - + template <class CharT, class TraitsT> inline std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const boost::gregorian::partial_date& pd) { @@ -459,7 +459,7 @@ namespace gregorian { operator>>(std::basic_istream<CharT, Traits>& is, partial_date& pd) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -475,17 +475,17 @@ namespace gregorian { f->get(sit, str_end, is, pd); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -512,11 +512,11 @@ namespace gregorian { template <class CharT, class Traits> inline std::basic_istream<CharT, Traits>& - operator>>(std::basic_istream<CharT, Traits>& is, + operator>>(std::basic_istream<CharT, Traits>& is, nth_day_of_the_week_in_month& nday) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -532,17 +532,17 @@ namespace gregorian { f->get(sit, str_end, is, nday); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -570,11 +570,11 @@ namespace gregorian { template <class CharT, class Traits> inline std::basic_istream<CharT, Traits>& - operator>>(std::basic_istream<CharT, Traits>& is, + operator>>(std::basic_istream<CharT, Traits>& is, first_day_of_the_week_in_month& fkd) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -590,17 +590,17 @@ namespace gregorian { f->get(sit, str_end, is, fkd); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -628,11 +628,11 @@ namespace gregorian { template <class CharT, class Traits> inline std::basic_istream<CharT, Traits>& - operator>>(std::basic_istream<CharT, Traits>& is, + operator>>(std::basic_istream<CharT, Traits>& is, last_day_of_the_week_in_month& lkd) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -648,17 +648,17 @@ namespace gregorian { f->get(sit, str_end, is, lkd); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -673,7 +673,7 @@ namespace gregorian { std::ostreambuf_iterator<CharT> output_itr(os); if (std::has_facet<custom_date_facet>(os.getloc())) { std::use_facet<custom_date_facet>(os.getloc()).put(output_itr, os, os.fill(), fda); - } + } else { custom_date_facet* f = new custom_date_facet(); std::locale l = std::locale(os.getloc(), f); @@ -687,11 +687,11 @@ namespace gregorian { template <class CharT, class Traits> inline std::basic_istream<CharT, Traits>& - operator>>(std::basic_istream<CharT, Traits>& is, + operator>>(std::basic_istream<CharT, Traits>& is, first_day_of_the_week_after& fka) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -707,17 +707,17 @@ namespace gregorian { f->get(sit, str_end, is, fka); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; @@ -746,11 +746,11 @@ namespace gregorian { template <class CharT, class Traits> inline std::basic_istream<CharT, Traits>& - operator>>(std::basic_istream<CharT, Traits>& is, + operator>>(std::basic_istream<CharT, Traits>& is, first_day_of_the_week_before& fkb) { boost::io::ios_flags_saver iflags(is); - typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); if (strm_sentry) { try { typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local; @@ -766,25 +766,25 @@ namespace gregorian { f->get(sit, str_end, is, fkb); } } - catch(...) { + catch(...) { std::ios_base::iostate exception_mask = is.exceptions(); if(std::ios_base::failbit & exception_mask) { - try { is.setstate(std::ios_base::failbit); } + try { is.setstate(std::ios_base::failbit); } catch(std::ios_base::failure&) {} throw; // rethrow original exception } else { - is.setstate(std::ios_base::failbit); - } - + is.setstate(std::ios_base::failbit); + } + } } return is; } - + } } // namespaces -Y_PRAGMA_DIAGNOSTIC_POP - +Y_PRAGMA_DIAGNOSTIC_POP + #endif // DATE_TIME_GREGORIAN_IO_HPP__ diff --git a/contrib/restricted/boost/boost/date_time/posix_time/posix_time_io.hpp b/contrib/restricted/boost/boost/date_time/posix_time/posix_time_io.hpp index 659253b825c..e85ec552424 100644 --- a/contrib/restricted/boost/boost/date_time/posix_time/posix_time_io.hpp +++ b/contrib/restricted/boost/boost/date_time/posix_time/posix_time_io.hpp @@ -20,8 +20,8 @@ #include <boost/date_time/posix_time/posix_time_duration.hpp> #include <boost/date_time/posix_time/conversion.hpp> // to_tm will be needed in the facets -#include <util/system/compiler.h> - +#include <util/system/compiler.h> + namespace boost { namespace posix_time { @@ -54,7 +54,7 @@ namespace posix_time { std::use_facet<custom_ptime_facet>(os.getloc()).put(oitr, os, os.fill(), p); else { //instantiate a custom facet for dealing with times since the user - //has not put one in the stream so far. This is for efficiency + //has not put one in the stream so far. This is for efficiency //since we would always need to reconstruct for every time period //if the locale did not already exist. Of course this will be overridden //if the user imbues as some later point. @@ -73,23 +73,23 @@ namespace posix_time { operator>>(std::basic_istream<CharT, Traits>& is, ptime& pt) { boost::io::ios_flags_saver iflags(is); - - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); - - Y_PRAGMA_DIAGNOSTIC_POP - + + Y_PRAGMA_DIAGNOSTIC_POP + if (strm_sentry) { try { - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local; - - Y_PRAGMA_DIAGNOSTIC_POP - + + Y_PRAGMA_DIAGNOSTIC_POP + std::istreambuf_iterator<CharT,Traits> sit(is), str_end; if(std::has_facet<time_input_facet_local>(is.getloc())) { std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, pt); @@ -104,7 +104,7 @@ namespace posix_time { catch(...) { // mask tells us what exceptions are turned on std::ios_base::iostate exception_mask = is.exceptions(); - // if the user wants exceptions on failbit, we'll rethrow our + // if the user wants exceptions on failbit, we'll rethrow our // date_time exception & set the failbit if(std::ios_base::failbit & exception_mask) { try { is.setstate(std::ios_base::failbit); } @@ -122,7 +122,7 @@ namespace posix_time { template <class CharT, class TraitsT> - inline + inline std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const boost::posix_time::time_period& p) { @@ -134,7 +134,7 @@ namespace posix_time { } else { //instantiate a custom facet for dealing with periods since the user - //has not put one in the stream so far. This is for efficiency + //has not put one in the stream so far. This is for efficiency //since we would always need to reconstruct for every time period //if the local did not already exist. Of course this will be overridden //if the user imbues as some later point. @@ -153,23 +153,23 @@ namespace posix_time { operator>>(std::basic_istream<CharT, Traits>& is, time_period& tp) { boost::io::ios_flags_saver iflags(is); - - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); - - Y_PRAGMA_DIAGNOSTIC_POP - + + Y_PRAGMA_DIAGNOSTIC_POP + if (strm_sentry) { try { - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local; - - Y_PRAGMA_DIAGNOSTIC_POP - + + Y_PRAGMA_DIAGNOSTIC_POP + std::istreambuf_iterator<CharT,Traits> sit(is), str_end; if(std::has_facet<time_input_facet_local>(is.getloc())) { std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, tp); @@ -197,7 +197,7 @@ namespace posix_time { } - //! ostream operator for posix_time::time_duration + //! ostream operator for posix_time::time_duration // todo fix to use facet -- place holder for now... template <class CharT, class Traits> inline @@ -211,7 +211,7 @@ namespace posix_time { std::use_facet<custom_ptime_facet>(os.getloc()).put(oitr, os, os.fill(), td); else { //instantiate a custom facet for dealing with times since the user - //has not put one in the stream so far. This is for efficiency + //has not put one in the stream so far. This is for efficiency //since we would always need to reconstruct for every time period //if the locale did not already exist. Of course this will be overridden //if the user imbues as some later point. @@ -230,23 +230,23 @@ namespace posix_time { operator>>(std::basic_istream<CharT, Traits>& is, time_duration& td) { boost::io::ios_flags_saver iflags(is); - - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false); - - Y_PRAGMA_DIAGNOSTIC_POP - + + Y_PRAGMA_DIAGNOSTIC_POP + if (strm_sentry) { try { - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local; - - Y_PRAGMA_DIAGNOSTIC_POP - + + Y_PRAGMA_DIAGNOSTIC_POP + std::istreambuf_iterator<CharT,Traits> sit(is), str_end; if(std::has_facet<time_input_facet_local>(is.getloc())) { std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, td); diff --git a/contrib/restricted/boost/boost/geometry/formulas/vincenty_inverse.hpp b/contrib/restricted/boost/boost/geometry/formulas/vincenty_inverse.hpp index e58ac66dafa..a210759aa75 100644 --- a/contrib/restricted/boost/boost/geometry/formulas/vincenty_inverse.hpp +++ b/contrib/restricted/boost/boost/geometry/formulas/vincenty_inverse.hpp @@ -27,11 +27,11 @@ #include <boost/geometry/formulas/flattening.hpp> #include <boost/geometry/formulas/result_inverse.hpp> -#include <util/system/compiler.h> - -Y_PRAGMA_DIAGNOSTIC_PUSH -Y_PRAGMA_NO_WSHADOW +#include <util/system/compiler.h> +Y_PRAGMA_DIAGNOSTIC_PUSH +Y_PRAGMA_NO_WSHADOW + #ifndef BOOST_GEOMETRY_DETAIL_VINCENTY_MAX_STEPS #define BOOST_GEOMETRY_DETAIL_VINCENTY_MAX_STEPS 1000 #endif @@ -163,7 +163,7 @@ public: } while ( geometry::math::abs(previous_lambda - lambda) > c_e_12 && geometry::math::abs(lambda) < pi && counter < BOOST_GEOMETRY_DETAIL_VINCENTY_MAX_STEPS ); // robustness - + if ( BOOST_GEOMETRY_CONDITION(EnableDistance) ) { // Oops getting hard here @@ -192,7 +192,7 @@ public: result.distance = radius_b * A * (sigma - delta_sigma); // (19) } - + if ( BOOST_GEOMETRY_CONDITION(CalcAzimuths) ) { if (BOOST_GEOMETRY_CONDITION(CalcFwdAzimuth)) @@ -221,6 +221,6 @@ public: }}} // namespace boost::geometry::formula -Y_PRAGMA_DIAGNOSTIC_POP +Y_PRAGMA_DIAGNOSTIC_POP #endif // BOOST_GEOMETRY_FORMULAS_VINCENTY_INVERSE_HPP diff --git a/contrib/restricted/boost/boost/geometry/index/detail/rtree/pack_create.hpp b/contrib/restricted/boost/boost/geometry/index/detail/rtree/pack_create.hpp index eea5cf07072..1437571b3e1 100644 --- a/contrib/restricted/boost/boost/geometry/index/detail/rtree/pack_create.hpp +++ b/contrib/restricted/boost/boost/geometry/index/detail/rtree/pack_create.hpp @@ -17,11 +17,11 @@ #include <boost/geometry/algorithms/detail/expand_by_epsilon.hpp> -#include <util/system/compiler.h> - -Y_PRAGMA_DIAGNOSTIC_PUSH -Y_PRAGMA_NO_WSHADOW - +#include <util/system/compiler.h> + +Y_PRAGMA_DIAGNOSTIC_PUSH +Y_PRAGMA_NO_WSHADOW + namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace pack_utils { @@ -157,7 +157,7 @@ public: parameters_type const& parameters, Translator const& translator, Allocators & allocators) { typedef typename std::iterator_traits<InIt>::difference_type diff_type; - + diff_type diff = std::distance(first, last); if ( diff <= 0 ) return node_pointer(0); @@ -167,7 +167,7 @@ public: values_count = static_cast<size_type>(diff); entries.reserve(values_count); - + expandable_box<Box> hint_box; for ( ; first != last ; ++first ) { @@ -323,7 +323,7 @@ private: rtree::elements(in).reserve(nodes_count); // MAY THROW (A) // calculate values box and copy values expandable_box<Box> elements_box; - + per_level_packets(first, last, hint_box, values_count, subtree_counts, next_subtree_counts, rtree::elements(in), elements_box, parameters, translator, allocators); @@ -364,7 +364,7 @@ private: elements_box.expand(el.first); return; } - + std::size_t median_count = calculate_median_count(values_count, subtree_counts); EIt median = first + median_count; @@ -374,7 +374,7 @@ private: Box left, right; pack_utils::nth_element_and_half_boxes<0, dimension> ::apply(first, median, last, hint_box, left, right, greatest_dim_index); - + per_level_packets(first, median, left, median_count, subtree_counts, next_subtree_counts, elements, elements_box, @@ -467,6 +467,6 @@ private: }}}}} // namespace boost::geometry::index::detail::rtree -Y_PRAGMA_DIAGNOSTIC_POP - +Y_PRAGMA_DIAGNOSTIC_POP + #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_PACK_CREATE_HPP diff --git a/contrib/restricted/boost/boost/graph/detail/adjacency_list.hpp b/contrib/restricted/boost/boost/graph/detail/adjacency_list.hpp index 90ab0ae2c60..6cc588f7ed2 100644 --- a/contrib/restricted/boost/boost/graph/detail/adjacency_list.hpp +++ b/contrib/restricted/boost/boost/graph/detail/adjacency_list.hpp @@ -38,8 +38,8 @@ #include <boost/static_assert.hpp> #include <boost/assert.hpp> -#include <util/system/compiler.h> - +#include <util/system/compiler.h> + #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_GRAPH_MOVE_IF_POSSIBLE(x) (x) #else @@ -269,7 +269,7 @@ namespace boost { : Base(static_cast< Base const& >(x)), m_property(const_cast<self&>(x).m_property) { } self& operator=(const self& x) { // NOTE: avoid 'Base::operator=(x);' broken on SGI MIPSpro (bug 55771 of Mozilla). - static_cast<Base&>(*this) = static_cast< Base const& >(x); + static_cast<Base&>(*this) = static_cast< Base const& >(x); m_property = const_cast<self&>(x).m_property; return *this; } @@ -279,7 +279,7 @@ namespace boost { : Base(static_cast< Base&& >(x)), m_property(std::move(x.m_property)) { } self& operator=(self&& x) { // NOTE: avoid 'Base::operator=(x);' broken on SGI MIPSpro (bug 55771 of Mozilla). - static_cast<Base&>(*this) = static_cast< Base&& >(x); + static_cast<Base&>(*this) = static_cast< Base&& >(x); m_property = std::move(x.m_property); return *this; } @@ -1258,9 +1258,9 @@ namespace boost { typedef typename Config::global_edgelist_selector EdgeListS; BOOST_STATIC_ASSERT((!is_same<EdgeListS, vecS>::value)); - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + typedef typename Config::graph_type graph_type; graph_type& g = static_cast<graph_type&>(*this); typename Config::edge_descriptor e = *iter; @@ -1271,8 +1271,8 @@ namespace boost { detail::remove_directed_edge_dispatch(*iter, iel, p); g.m_edges.erase(iter.base()->get_iter()); oel.erase(iter.base()); - - Y_PRAGMA_DIAGNOSTIC_POP + + Y_PRAGMA_DIAGNOSTIC_POP } }; diff --git a/contrib/restricted/boost/boost/graph/named_graph.hpp b/contrib/restricted/boost/boost/graph/named_graph.hpp index b5bcd7708d6..67cea1dcd43 100644 --- a/contrib/restricted/boost/boost/graph/named_graph.hpp +++ b/contrib/restricted/boost/boost/graph/named_graph.hpp @@ -32,8 +32,8 @@ #include <stdexcept> // for std::runtime_error #include <utility> // for std::pair -#include <util/system/compiler.h> - +#include <util/system/compiler.h> + namespace boost { namespace graph { /******************************************************************* @@ -313,15 +313,15 @@ template<BGL_NAMED_GRAPH_PARAMS> template<typename VertexIterStability> inline void BGL_NAMED_GRAPH::removing_vertex(Vertex vertex, VertexIterStability) { - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + BOOST_STATIC_ASSERT_MSG ((boost::is_base_of<boost::graph_detail::stable_tag, VertexIterStability>::value), "Named graphs cannot use vecS as vertex container and remove vertices; the lack of vertex descriptor stability (which iterator stability is a proxy for) means that the name -> vertex mapping would need to be completely rebuilt after each deletion. See https://svn.boost.org/trac/boost/ticket/7863 for more information and a test case."); typedef typename BGL_NAMED_GRAPH::vertex_name_type vertex_name_type; const vertex_name_type& vertex_name = extract_name(derived()[vertex]); named_vertices.erase(vertex_name); - - Y_PRAGMA_DIAGNOSTIC_POP + + Y_PRAGMA_DIAGNOSTIC_POP } template<BGL_NAMED_GRAPH_PARAMS> diff --git a/contrib/restricted/boost/boost/interprocess/segment_manager.hpp b/contrib/restricted/boost/boost/interprocess/segment_manager.hpp index 7a297f934b3..eabd3713fd9 100644 --- a/contrib/restricted/boost/boost/interprocess/segment_manager.hpp +++ b/contrib/restricted/boost/boost/interprocess/segment_manager.hpp @@ -50,11 +50,11 @@ #include <exception> #endif -#include <util/system/compiler.h> - -Y_PRAGMA_DIAGNOSTIC_PUSH -Y_PRAGMA_NO_WSHADOW - +#include <util/system/compiler.h> + +Y_PRAGMA_DIAGNOSTIC_PUSH +Y_PRAGMA_NO_WSHADOW + //!\file //!Describes the object placed in a memory segment that provides //!named object allocation capabilities for single-segment and @@ -1061,7 +1061,7 @@ class segment_manager template<class CharT> void * priv_generic_named_construct (unsigned char type, const CharT *name, size_type num, bool try2find, - bool dothrow, ipcdetail::in_place_interface &table, + bool dothrow, ipcdetail::in_place_interface &table, IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index, ipcdetail::true_ is_intrusive) { (void)is_intrusive; @@ -1186,7 +1186,7 @@ class segment_manager template<class CharT> void * priv_generic_named_construct (unsigned char type, const CharT *name, size_type num, bool try2find, bool dothrow, - ipcdetail::in_place_interface &table, + ipcdetail::in_place_interface &table, IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index, ipcdetail::false_ is_intrusive) { (void)is_intrusive; @@ -1342,8 +1342,8 @@ class segment_manager }} //namespace boost { namespace interprocess -Y_PRAGMA_DIAGNOSTIC_POP - +Y_PRAGMA_DIAGNOSTIC_POP + #include <boost/interprocess/detail/config_end.hpp> #endif //#ifndef BOOST_INTERPROCESS_SEGMENT_MANAGER_HPP diff --git a/contrib/restricted/boost/boost/spirit/home/classic/core/non_terminal/subrule.hpp b/contrib/restricted/boost/boost/spirit/home/classic/core/non_terminal/subrule.hpp index 1f4bb048f97..4c8897f2332 100644 --- a/contrib/restricted/boost/boost/spirit/home/classic/core/non_terminal/subrule.hpp +++ b/contrib/restricted/boost/boost/spirit/home/classic/core/non_terminal/subrule.hpp @@ -22,8 +22,8 @@ #include <boost/spirit/home/classic/core/non_terminal/subrule_fwd.hpp> #include <boost/spirit/home/classic/core/non_terminal/impl/subrule.ipp> -#include <util/system/compiler.h> - +#include <util/system/compiler.h> + namespace boost { namespace spirit { BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN @@ -209,9 +209,9 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN return start.parse(g_arg); } - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + template <int ID2, typename DefT2, typename ContextT2> inline subrule_list< self_t, @@ -231,8 +231,8 @@ BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN rhs, nil_t())); } - Y_PRAGMA_DIAGNOSTIC_POP - + Y_PRAGMA_DIAGNOSTIC_POP + typename DefT::embed_t rhs; subrule_t const& start; }; diff --git a/contrib/tools/cython/Cython/Compiler/PyrexTypes.py b/contrib/tools/cython/Cython/Compiler/PyrexTypes.py index 3d4931cea63..9465fe270a0 100644 --- a/contrib/tools/cython/Cython/Compiler/PyrexTypes.py +++ b/contrib/tools/cython/Cython/Compiler/PyrexTypes.py @@ -3496,7 +3496,7 @@ builtin_cpp_conversions = { "std::complex": 1, # arcadia_cpp_conversions "TMaybe": 1, - "TVector": 1, + "TVector": 1, "THashMap": 2, "TMap": 2, } diff --git a/contrib/tools/cython/Cython/Utility/CppConvert.pyx b/contrib/tools/cython/Cython/Utility/CppConvert.pyx index 5f7859dd0ef..080a5abae2b 100644 --- a/contrib/tools/cython/Cython/Utility/CppConvert.pyx +++ b/contrib/tools/cython/Cython/Utility/CppConvert.pyx @@ -266,56 +266,56 @@ cdef object {{cname}}(const TMaybe[X]& s): return None -#################### arcadia_TVector.from_py #################### +#################### arcadia_TVector.from_py #################### cdef extern from *: - cdef cppclass TVector [T]: + cdef cppclass TVector [T]: void push_back(T&) @cname("{{cname}}") -cdef TVector[X] {{cname}}(object o) except *: - cdef TVector[X] v +cdef TVector[X] {{cname}}(object o) except *: + cdef TVector[X] v for item in o: v.push_back(<X>item) return v -#################### arcadia_TVector.to_py #################### +#################### arcadia_TVector.to_py #################### cdef extern from *: - cdef cppclass TVector [T]: + cdef cppclass TVector [T]: size_t size() T& operator[](size_t) @cname("{{cname}}") -cdef object {{cname}}(const TVector[X]& v): +cdef object {{cname}}(const TVector[X]& v): return [v[i] for i in range(v.size())] -#################### arcadia_THashMap.from_py #################### +#################### arcadia_THashMap.from_py #################### cdef extern from *: cdef cppclass pair "std::pair" [T, U]: pair(T&, U&) - cdef cppclass THashMap [T, U]: + cdef cppclass THashMap [T, U]: void insert(pair[T, U]&) @cname("{{cname}}") -cdef THashMap[X,Y] {{cname}}(object o) except *: +cdef THashMap[X,Y] {{cname}}(object o) except *: cdef dict d = o - cdef THashMap[X,Y] m + cdef THashMap[X,Y] m for key, value in d.iteritems(): m.insert(pair[X,Y](<X>key, <Y>value)) return m -#################### arcadia_THashMap.to_py #################### +#################### arcadia_THashMap.to_py #################### cimport cython cdef extern from *: - cdef cppclass THashMap [T, U]: + cdef cppclass THashMap [T, U]: cppclass value_type: T first U second @@ -327,10 +327,10 @@ cdef extern from *: const_iterator end() @cname("{{cname}}") -cdef dict {{cname}}(const THashMap[X,Y]& s): +cdef dict {{cname}}(const THashMap[X,Y]& s): cdef dict result = {} - cdef const THashMap[X,Y].value_type *key_value - cdef THashMap[X,Y].const_iterator iter = s.begin() + cdef const THashMap[X,Y].value_type *key_value + cdef THashMap[X,Y].const_iterator iter = s.begin() while iter != s.end(): key_value = &cython.operator.dereference(iter) result[key_value.first] = key_value.second diff --git a/library/cpp/accurate_accumulate/accurate_accumulate.h b/library/cpp/accurate_accumulate/accurate_accumulate.h index dacced17e9e..87f12d632e2 100644 --- a/library/cpp/accurate_accumulate/accurate_accumulate.h +++ b/library/cpp/accurate_accumulate/accurate_accumulate.h @@ -184,7 +184,7 @@ static inline double FastAccumulate(It begin, It end) { } template <typename T> -static inline double FastAccumulate(const TVector<T>& sequence) { +static inline double FastAccumulate(const TVector<T>& sequence) { return FastAccumulate(sequence.begin(), sequence.end()); } @@ -194,7 +194,7 @@ static inline double FastKahanAccumulate(It begin, It end) { } template <typename T> -static inline double FastKahanAccumulate(const TVector<T>& sequence) { +static inline double FastKahanAccumulate(const TVector<T>& sequence) { return FastKahanAccumulate(sequence.begin(), sequence.end()); } @@ -204,7 +204,7 @@ static inline double FastInnerProduct(It1 begin1, It1 end1, It2 begin2) { } template <typename T> -static inline double FastInnerProduct(const TVector<T>& lhs, const TVector<T>& rhs) { +static inline double FastInnerProduct(const TVector<T>& lhs, const TVector<T>& rhs) { Y_ASSERT(lhs.size() == rhs.size()); return FastInnerProduct(lhs.begin(), lhs.end(), rhs.begin()); } @@ -215,7 +215,7 @@ static inline double FastKahanInnerProduct(It1 begin1, It1 end1, It2 begin2) { } template <typename T> -static inline double FastKahanInnerProduct(const TVector<T>& lhs, const TVector<T>& rhs) { +static inline double FastKahanInnerProduct(const TVector<T>& lhs, const TVector<T>& rhs) { Y_ASSERT(lhs.size() == rhs.size()); return FastKahanInnerProduct(lhs.begin(), lhs.end(), rhs.begin()); } diff --git a/library/cpp/accurate_accumulate/benchmark/main.cpp b/library/cpp/accurate_accumulate/benchmark/main.cpp index 3c5e6e775de..11f5d7d8435 100644 --- a/library/cpp/accurate_accumulate/benchmark/main.cpp +++ b/library/cpp/accurate_accumulate/benchmark/main.cpp @@ -10,7 +10,7 @@ namespace { template <typename T, size_t N> struct TNormalizedExamplesHolder { - TVector<T> Examples; + TVector<T> Examples; TNormalizedExamplesHolder() : Examples(N) { @@ -23,7 +23,7 @@ namespace { template <typename T, size_t N> struct TExamplesHolder { - TVector<T> Examples; + TVector<T> Examples; TExamplesHolder() : Examples(N) { diff --git a/library/cpp/actors/core/actorsystem.cpp b/library/cpp/actors/core/actorsystem.cpp index c58698a2061..3914a4a1839 100644 --- a/library/cpp/actors/core/actorsystem.cpp +++ b/library/cpp/actors/core/actorsystem.cpp @@ -160,7 +160,7 @@ namespace NActors { // get high 32 bits as seconds from epoch // it could wrap every century, but we don't expect any actor-reference to live this long so such wrap will do no harm - const ui64 timeFromEpoch = TInstant::MicroSeconds(RelaxedLoad(&CurrentTimestamp)).Seconds(); + const ui64 timeFromEpoch = TInstant::MicroSeconds(RelaxedLoad(&CurrentTimestamp)).Seconds(); // get low 32 bits as counter value ui32 lowPartEnd = (ui32)(AtomicAdd(CurrentIDCounter, count)); @@ -208,7 +208,7 @@ namespace NActors { StartExecuted = true; ScheduleQueue.Reset(new NSchedulerQueue::TQueueType()); - TVector<NSchedulerQueue::TReader*> scheduleReaders; + TVector<NSchedulerQueue::TReader*> scheduleReaders; scheduleReaders.push_back(&ScheduleQueue->Reader); CpuManager->PrepareStart(scheduleReaders, this); Scheduler->Prepare(this, &CurrentTimestamp, &CurrentMonotonic); diff --git a/library/cpp/actors/core/actorsystem.h b/library/cpp/actors/core/actorsystem.h index 40499d7586f..27c242ccc67 100644 --- a/library/cpp/actors/core/actorsystem.h +++ b/library/cpp/actors/core/actorsystem.h @@ -42,7 +42,7 @@ namespace NActors { namespace NSchedulerQueue { class TReader; - struct TQueueType; + struct TQueueType; } class IExecutorPool : TNonCopyable { @@ -110,7 +110,7 @@ namespace NActors { virtual void Shutdown() = 0; virtual bool Cleanup() = 0; - virtual void GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const { + virtual void GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const { // TODO: make pure virtual and override everywhere Y_UNUSED(poolStats); Y_UNUSED(statsCopy); @@ -173,7 +173,7 @@ namespace NActors { using TProxyWrapperFactory = std::function<TActorId(TActorSystem*, ui32)>; struct TInterconnectSetup { - TVector<TActorSetupCmd> ProxyActors; + TVector<TActorSetupCmd> ProxyActors; TProxyWrapperFactory ProxyWrapperFactory; }; @@ -229,7 +229,7 @@ namespace NActors { volatile ui64 CurrentMonotonic; volatile ui64 CurrentIDCounter; - THolder<NSchedulerQueue::TQueueType> ScheduleQueue; + THolder<NSchedulerQueue::TQueueType> ScheduleQueue; mutable TTicketLock ScheduleLock; friend class TExecutorThread; diff --git a/library/cpp/actors/core/event_load.h b/library/cpp/actors/core/event_load.h index 0dab1dd374c..b8872738aa0 100644 --- a/library/cpp/actors/core/event_load.h +++ b/library/cpp/actors/core/event_load.h @@ -2,7 +2,7 @@ #include <util/stream/walk.h> #include <util/system/types.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <library/cpp/actors/util/rope.h> #include <library/cpp/actors/wilson/wilson_trace.h> diff --git a/library/cpp/actors/core/event_pb_ut.cpp b/library/cpp/actors/core/event_pb_ut.cpp index a16c3092b3b..fc8cb2d52cc 100644 --- a/library/cpp/actors/core/event_pb_ut.cpp +++ b/library/cpp/actors/core/event_pb_ut.cpp @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(TEventSerialization) { TMockEvent event; event.msg = &bm; chunker.SetSerializingEvent(&event); - char buf1[87]; + char buf1[87]; TString bmChunkedSerialized; while (!chunker.IsComplete()) { auto range = chunker.FeedBuf(&buf1[0], sizeof(buf1)); diff --git a/library/cpp/actors/core/executor_pool_basic.cpp b/library/cpp/actors/core/executor_pool_basic.cpp index 4dce16939ae..77b4eca1d24 100644 --- a/library/cpp/actors/core/executor_pool_basic.cpp +++ b/library/cpp/actors/core/executor_pool_basic.cpp @@ -17,7 +17,7 @@ namespace NActors { ui32 poolId, ui32 threads, ui64 spinThreshold, - const TString& poolName, + const TString& poolName, TAffinity* affinity, TDuration timePerMailbox, ui32 eventsPerMailbox, @@ -234,7 +234,7 @@ namespace NActors { } } - void TBasicExecutorPool::GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const { + void TBasicExecutorPool::GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const { poolStats.MaxUtilizationTime = RelaxedLoad(&MaxUtilizationAccumulator) / (i64)(NHPTimer::GetCyclesPerSecond() / 1000); statsCopy.resize(PoolThreads + 1); diff --git a/library/cpp/actors/core/executor_pool_basic.h b/library/cpp/actors/core/executor_pool_basic.h index 023190f7fe3..7ccd3cd179f 100644 --- a/library/cpp/actors/core/executor_pool_basic.h +++ b/library/cpp/actors/core/executor_pool_basic.h @@ -95,7 +95,7 @@ namespace NActors { void PrepareStop() override; void Shutdown() override; - void GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const override; + void GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const override; TString GetName() const override { return PoolName; } diff --git a/library/cpp/actors/core/executor_pool_io.cpp b/library/cpp/actors/core/executor_pool_io.cpp index fb557ae6b00..49fe990374c 100644 --- a/library/cpp/actors/core/executor_pool_io.cpp +++ b/library/cpp/actors/core/executor_pool_io.cpp @@ -106,7 +106,7 @@ namespace NActors { ActorSystem = actorSystem; - ScheduleQueue.Reset(new NSchedulerQueue::TQueueType()); + ScheduleQueue.Reset(new NSchedulerQueue::TQueueType()); for (ui32 i = 0; i != PoolThreads; ++i) { Threads[i].Thread.Reset(new TExecutorThread(i, 0, actorSystem, this, MailboxTable.Get(), PoolName)); diff --git a/library/cpp/actors/core/executor_pool_io.h b/library/cpp/actors/core/executor_pool_io.h index e576d642a1d..651217e0c96 100644 --- a/library/cpp/actors/core/executor_pool_io.h +++ b/library/cpp/actors/core/executor_pool_io.h @@ -19,7 +19,7 @@ namespace NActors { TArrayHolder<TThreadCtx> Threads; TUnorderedCache<ui32, 512, 4> ThreadQueue; - THolder<NSchedulerQueue::TQueueType> ScheduleQueue; + THolder<NSchedulerQueue::TQueueType> ScheduleQueue; TTicketLock ScheduleLock; const TString PoolName; diff --git a/library/cpp/actors/core/executor_pool_united.h b/library/cpp/actors/core/executor_pool_united.h index a090ba24665..3d591d7ffbd 100644 --- a/library/cpp/actors/core/executor_pool_united.h +++ b/library/cpp/actors/core/executor_pool_united.h @@ -126,7 +126,7 @@ namespace NActors { void Schedule(TMonotonic deadline, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie, TWorkerId workerId) override; void Schedule(TDuration delta, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie, TWorkerId workerId) override; - void GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const override; + void GetCurrentStats(TExecutorPoolStats& poolStats, TVector<TExecutorThreadStats>& statsCopy) const override; TString GetName() const override { return PoolName; diff --git a/library/cpp/actors/core/interconnect.h b/library/cpp/actors/core/interconnect.h index 679a4b8cc6f..c26fe1b0b5c 100644 --- a/library/cpp/actors/core/interconnect.h +++ b/library/cpp/actors/core/interconnect.h @@ -210,7 +210,7 @@ namespace NActors { }; struct TEvNodesInfo: public TEventLocal<TEvNodesInfo, EvNodesInfo> { - TVector<TNodeInfo> Nodes; + TVector<TNodeInfo> Nodes; const TNodeInfo* GetNodeInfo(ui32 nodeId) const { for (const auto& x : Nodes) { diff --git a/library/cpp/actors/core/log.cpp b/library/cpp/actors/core/log.cpp index 5f63b5af580..6322677c685 100644 --- a/library/cpp/actors/core/log.cpp +++ b/library/cpp/actors/core/log.cpp @@ -214,7 +214,7 @@ namespace NActors { if (Settings && Settings->Satisfies(priority, component, 0ull)) { va_list params; va_start(params, c); - TString formatted; + TString formatted; vsprintf(formatted, c, params); auto ok = OutputRecord(time, NLog::EPrio(priority), component, formatted); @@ -229,7 +229,7 @@ namespace NActors { } void TLoggerActor::LogIgnoredCount(TInstant now) { - TString message = Sprintf("Ignored IgnoredCount# %" PRIu64 " log records due to logger overflow!", IgnoredCount); + TString message = Sprintf("Ignored IgnoredCount# %" PRIu64 " log records due to logger overflow!", IgnoredCount); if (!OutputRecord(now, NActors::NLog::EPrio::Error, Settings->LoggerComponent, message)) { BecomeDefunct(); } @@ -304,7 +304,7 @@ namespace NActors { void TLoggerActor::HandleLogComponentLevelRequest(TLogComponentLevelRequest::TPtr& ev, const NActors::TActorContext& ctx) { Metrics->IncLevelRequests(); - TString explanation; + TString explanation; int code = Settings->SetLevel(ev->Get()->Priority, ev->Get()->Component, explanation); ctx.Send(ev->Sender, new TLogComponentLevelResponse(code, explanation)); } @@ -475,7 +475,7 @@ namespace NActors { } } else { - TString explanation; + TString explanation; if (hasComponent && hasPriority) { Settings->SetLevel(priority, component, explanation); } @@ -675,7 +675,7 @@ namespace NActors { void WriteData(const TLogRecord& rec) override { #ifdef _MSC_VER if (IsDebuggerPresent()) { - TString x; + TString x; x.reserve(rec.Len + 2); x.append(rec.Data, rec.Len); x.append('\n'); @@ -699,7 +699,7 @@ namespace NActors { } private: - const TString Indent; + const TString Indent; }; class TLineFileLogBackend: public TFileLogBackend { @@ -739,7 +739,7 @@ namespace NActors { return new TStderrBackend(); } - TAutoPtr<TLogBackend> CreateFileBackend(const TString& fileName) { + TAutoPtr<TLogBackend> CreateFileBackend(const TString& fileName) { return new TLineFileLogBackend(fileName); } diff --git a/library/cpp/actors/core/log.h b/library/cpp/actors/core/log.h index c11a7cf3c19..073c233202a 100644 --- a/library/cpp/actors/core/log.h +++ b/library/cpp/actors/core/log.h @@ -163,7 +163,7 @@ namespace NActors { protected: int Code; - TString Explanation; + TString Explanation; }; class TLogIgnored: public TEventLocal<TLogIgnored, int(NLog::EEv::Ignored)> { @@ -297,7 +297,7 @@ namespace NActors { TAutoPtr<TLogBackend> CreateSysLogBackend(const TString& ident, bool logPError, bool logCons); TAutoPtr<TLogBackend> CreateStderrBackend(); - TAutoPtr<TLogBackend> CreateFileBackend(const TString& fileName); + TAutoPtr<TLogBackend> CreateFileBackend(const TString& fileName); TAutoPtr<TLogBackend> CreateNullBackend(); TAutoPtr<TLogBackend> CreateCompositeLogBackend(TVector<TAutoPtr<TLogBackend>>&& underlyingBackends); @@ -332,7 +332,7 @@ namespace NActors { NLog::EPriority mPriority, NLog::EComponent mComponent, const char* format, TArgs&&... params) { - TString Formatted; + TString Formatted; if constexpr (sizeof... (params) > 0) { diff --git a/library/cpp/actors/core/log_settings.cpp b/library/cpp/actors/core/log_settings.cpp index f52f2fc5d22..8f4009ae4c9 100644 --- a/library/cpp/actors/core/log_settings.cpp +++ b/library/cpp/actors/core/log_settings.cpp @@ -90,7 +90,7 @@ namespace NActors { int TSettings::SetLevelImpl( const TString& name, bool isSampling, EPriority priority, EComponent component, TString& explanation) { - TString titleName(name); + TString titleName(name); titleName.to_title(); // check priority diff --git a/library/cpp/actors/core/log_settings.h b/library/cpp/actors/core/log_settings.h index 7fe4504edd9..bd8686cefdc 100644 --- a/library/cpp/actors/core/log_settings.h +++ b/library/cpp/actors/core/log_settings.h @@ -75,7 +75,7 @@ namespace NActors { bool AllowDrop; TDuration ThrottleDelay; TArrayHolder<TAtomic> ComponentInfo; - TVector<TString> ComponentNames; + TVector<TString> ComponentNames; EComponent MinVal; EComponent MaxVal; EComponent Mask; @@ -90,8 +90,8 @@ namespace NActors { JSON_FORMAT }; ELogFormat Format; - TString ShortHostName; - TString ClusterName; + TString ShortHostName; + TString ClusterName; TString MessagePrefix; // The best way to provide minVal, maxVal and func is to have @@ -167,7 +167,7 @@ namespace NActors { private: int SetLevelImpl( - const TString& name, bool isSampling, + const TString& name, bool isSampling, EPriority priority, EComponent component, TString& explanation); }; diff --git a/library/cpp/actors/core/mailbox.h b/library/cpp/actors/core/mailbox.h index 0bd9c4d314e..acd6e852a39 100644 --- a/library/cpp/actors/core/mailbox.h +++ b/library/cpp/actors/core/mailbox.h @@ -399,7 +399,7 @@ namespace NActors { struct THTSwapMailbox: public TMailboxHeader { using TQueueType = NThreading::THTSwapQueue<IEventHandle*>; - TQueueType Queue; + TQueueType Queue; NHPTimer::STime ScheduleMoment; char Padding_[16]; @@ -449,7 +449,7 @@ namespace NActors { struct TReadAsFilledMailbox: public TMailboxHeader { using TQueueType = NThreading::TReadAsFilledQueue<IEventHandle>; - TQueueType Queue; + TQueueType Queue; NHPTimer::STime ScheduleMoment; char Padding_[8]; @@ -498,11 +498,11 @@ namespace NActors { "expect sizeof(TReadAsFilledMailbox) == 192"); struct TTinyReadAsFilledMailbox: public TMailboxHeader { - using TQueueType = NThreading::TReadAsFilledQueue< + using TQueueType = NThreading::TReadAsFilledQueue< IEventHandle, NThreading::TRaFQueueBunchSize<4>>; - TQueueType Queue; + TQueueType Queue; NHPTimer::STime ScheduleMoment; char Padding_[8]; diff --git a/library/cpp/actors/core/mon.h b/library/cpp/actors/core/mon.h index c450f2338eb..f108b370d5f 100644 --- a/library/cpp/actors/core/mon.h +++ b/library/cpp/actors/core/mon.h @@ -57,7 +57,7 @@ namespace NActors { virtual EContentType GetContentType() const = 0; }; - // Ready to output HTML in TString + // Ready to output HTML in TString struct TEvHttpInfoRes: public IEvHttpInfoRes { TEvHttpInfoRes(const TString& answer, int subReqId = 0, EContentType contentType = Html) : Answer(answer) @@ -74,7 +74,7 @@ namespace NActors { return ContentType; } - const TString Answer; + const TString Answer; const int SubRequestId; const EContentType ContentType; }; @@ -83,7 +83,7 @@ namespace NActors { TEvRemoteHttpInfo() { } - TEvRemoteHttpInfo(const TString& query) + TEvRemoteHttpInfo(const TString& query) : Query(query) { } @@ -94,20 +94,20 @@ namespace NActors { { } - TString Query; + TString Query; HTTP_METHOD Method; - TString PathInfo() const { + TString PathInfo() const { const size_t pos = Query.find('?'); - return (pos == TString::npos) ? TString() : Query.substr(0, pos); + return (pos == TString::npos) ? TString() : Query.substr(0, pos); } TCgiParameters Cgi() const { const size_t pos = Query.find('?'); - return TCgiParameters((pos == TString::npos) ? TString() : Query.substr(pos + 1)); + return TCgiParameters((pos == TString::npos) ? TString() : Query.substr(pos + 1)); } - TString ToStringHeader() const override { + TString ToStringHeader() const override { return "TEvRemoteHttpInfo"; } @@ -137,14 +137,14 @@ namespace NActors { TEvRemoteHttpInfoRes() { } - TEvRemoteHttpInfoRes(const TString& html) + TEvRemoteHttpInfoRes(const TString& html) : Html(html) { } - TString Html; + TString Html; - TString ToStringHeader() const override { + TString ToStringHeader() const override { return "TEvRemoteHttpInfoRes"; } @@ -169,14 +169,14 @@ namespace NActors { TEvRemoteJsonInfoRes() { } - TEvRemoteJsonInfoRes(const TString& json) + TEvRemoteJsonInfoRes(const TString& json) : Json(json) { } - TString Json; + TString Json; - TString ToStringHeader() const override { + TString ToStringHeader() const override { return "TEvRemoteJsonInfoRes"; } @@ -201,14 +201,14 @@ namespace NActors { TEvRemoteBinaryInfoRes() { } - TEvRemoteBinaryInfoRes(const TString& blob) + TEvRemoteBinaryInfoRes(const TString& blob) : Blob(blob) { } - TString Blob; + TString Blob; - TString ToStringHeader() const override { + TString ToStringHeader() const override { return "TEvRemoteBinaryInfoRes"; } diff --git a/library/cpp/actors/core/mon_stats.h b/library/cpp/actors/core/mon_stats.h index d55552af0cb..dc5c959134e 100644 --- a/library/cpp/actors/core/mon_stats.h +++ b/library/cpp/actors/core/mon_stats.h @@ -76,9 +76,9 @@ namespace NActors { TLogHistogram EventDeliveryTimeHistogram; TLogHistogram EventProcessingCountHistogram; TLogHistogram EventProcessingTimeHistogram; - TVector<NHPTimer::STime> ElapsedTicksByActivity; - TVector<ui64> ReceivedEventsByActivity; - TVector<i64> ActorsAliveByActivity; // the sum should be positive, but per-thread might be negative + TVector<NHPTimer::STime> ElapsedTicksByActivity; + TVector<ui64> ReceivedEventsByActivity; + TVector<i64> ActorsAliveByActivity; // the sum should be positive, but per-thread might be negative TVector<ui64> ScheduledEventsByActivity; ui64 PoolActorRegistrations = 0; ui64 PoolDestroyedActors = 0; @@ -95,7 +95,7 @@ namespace NActors { {} template <typename T> - static void AggregateOne(TVector<T>& self, const TVector<T>& other) { + static void AggregateOne(TVector<T>& self, const TVector<T>& other) { const size_t selfSize = self.size(); const size_t otherSize = other.size(); if (selfSize < otherSize) diff --git a/library/cpp/actors/core/process_stats.cpp b/library/cpp/actors/core/process_stats.cpp index 0e1dbd00314..5c1b1bf08ed 100644 --- a/library/cpp/actors/core/process_stats.cpp +++ b/library/cpp/actors/core/process_stats.cpp @@ -80,7 +80,7 @@ namespace NActors { TFileInput statm("/proc/" + strPid + "/statm"); statm.ReadLine(str); - TVector<TString> fields; + TVector<TString> fields; StringSplitter(str).Split(' ').SkipEmpty().Collect(&fields); if (fields.size() >= 7) { ui64 resident = FromString<ui64>(fields[1]); diff --git a/library/cpp/actors/core/scheduler_basic.cpp b/library/cpp/actors/core/scheduler_basic.cpp index fba200e16bf..985d411db57 100644 --- a/library/cpp/actors/core/scheduler_basic.cpp +++ b/library/cpp/actors/core/scheduler_basic.cpp @@ -94,7 +94,7 @@ namespace NActors { while (!!activeSec && !activeSec->empty()) { TMomentMap::iterator it = activeSec->begin(); if (it->first <= throttledMonotonic) { - if (NSchedulerQueue::TQueueType* q = it->second.Get()) { + if (NSchedulerQueue::TQueueType* q = it->second.Get()) { while (NSchedulerQueue::TEntry* x = q->Reader.Pop()) { somethingDone = true; Y_VERIFY_DEBUG(x->InstantMicroseconds <= activeTick); @@ -151,18 +151,18 @@ namespace NActors { if (instant <= activeTick) { if (!activeSec) activeSec.Reset(new TMomentMap()); - TAutoPtr<NSchedulerQueue::TQueueType>& queue = (*activeSec)[instant]; + TAutoPtr<NSchedulerQueue::TQueueType>& queue = (*activeSec)[instant]; if (!queue) - queue.Reset(new NSchedulerQueue::TQueueType()); + queue.Reset(new NSchedulerQueue::TQueueType()); queue->Writer.Push(instant, ev, cookie); } else { const ui64 intrasecond = AlignUp<ui64>(instant, IntrasecondThreshold); TAutoPtr<TMomentMap>& msec = ScheduleMap[intrasecond]; if (!msec) msec.Reset(new TMomentMap()); - TAutoPtr<NSchedulerQueue::TQueueType>& queue = (*msec)[instant]; + TAutoPtr<NSchedulerQueue::TQueueType>& queue = (*msec)[instant]; if (!queue) - queue.Reset(new NSchedulerQueue::TQueueType()); + queue.Reset(new NSchedulerQueue::TQueueType()); queue->Writer.Push(instant, ev, cookie); } diff --git a/library/cpp/actors/core/scheduler_basic.h b/library/cpp/actors/core/scheduler_basic.h index 2ccde392351..54c193c4a1f 100644 --- a/library/cpp/actors/core/scheduler_basic.h +++ b/library/cpp/actors/core/scheduler_basic.h @@ -26,7 +26,7 @@ namespace NActors { volatile bool StopFlag; - typedef TMap<ui64, TAutoPtr<NSchedulerQueue::TQueueType>> TMomentMap; // intrasecond queues + typedef TMap<ui64, TAutoPtr<NSchedulerQueue::TQueueType>> TMomentMap; // intrasecond queues typedef THashMap<ui64, TAutoPtr<TMomentMap>> TScheduleMap; // over-second schedule TScheduleMap ScheduleMap; diff --git a/library/cpp/actors/core/scheduler_queue.h b/library/cpp/actors/core/scheduler_queue.h index 3b8fac28f0d..a4905e09f1c 100644 --- a/library/cpp/actors/core/scheduler_queue.h +++ b/library/cpp/actors/core/scheduler_queue.h @@ -108,11 +108,11 @@ namespace NActors { } }; - struct TQueueType { + struct TQueueType { TReader Reader; TWriter Writer; - TQueueType() { + TQueueType() { Writer.Init(Reader); } }; diff --git a/library/cpp/actors/core/ya.make b/library/cpp/actors/core/ya.make index 880a9d00dba..76596cdfe61 100644 --- a/library/cpp/actors/core/ya.make +++ b/library/cpp/actors/core/ya.make @@ -5,8 +5,8 @@ OWNER( g:kikimr ) -NO_WSHADOW() - +NO_WSHADOW() + IF (PROFILE_MEMORY_ALLOCATIONS) CFLAGS(-DPROFILE_MEMORY_ALLOCATIONS) ENDIF() diff --git a/library/cpp/actors/dnscachelib/dnscache.h b/library/cpp/actors/dnscachelib/dnscache.h index 3313a251a1c..b7e199c3b51 100644 --- a/library/cpp/actors/dnscachelib/dnscache.h +++ b/library/cpp/actors/dnscachelib/dnscache.h @@ -21,7 +21,7 @@ public: TDnsCache(bool allowIpv4 = true, bool allowIpv6 = true, time_t entry_lifetime = 1800, time_t neg_lifetime = 1, ui32 request_timeout = 500000); ~TDnsCache(); - TString GetHostByAddr(const NAddr::IRemoteAddr&); + TString GetHostByAddr(const NAddr::IRemoteAddr&); // ip in network byte order TIpHost Get(const TString& host); @@ -43,7 +43,7 @@ protected: private: struct TGHBNContext { TDnsCache* Owner; - TString Hostname; + TString Hostname; int Family; }; @@ -56,23 +56,23 @@ private: THost() noexcept { } - TVector<TIpHost> AddrsV4; + TVector<TIpHost> AddrsV4; time_t ResolvedV4 = 0; time_t NotFoundV4 = 0; TAtomic InProgressV4 = 0; - TVector<in6_addr> AddrsV6; + TVector<in6_addr> AddrsV6; time_t ResolvedV6 = 0; time_t NotFoundV6 = 0; TAtomic InProgressV6 = 0; - TString AddrsV4ToString() const; - TString AddrsV6ToString() const; + TString AddrsV4ToString() const; + TString AddrsV6ToString() const; bool IsStale(int family, const TDnsCache* ctx) const noexcept; }; - typedef TMap<TString, THost> THostCache; + typedef TMap<TString, THost> THostCache; struct TAddr { TString Hostname; @@ -96,7 +96,7 @@ private: return false; } }; - typedef TMap<in6_addr, TAddr, TAddrCmp> TAddrCache; + typedef TMap<in6_addr, TAddr, TAddrCmp> TAddrCache; const THost& Resolve(const TString&, int family, bool cacheOnly = false); diff --git a/library/cpp/actors/dnscachelib/timekeeper.h b/library/cpp/actors/dnscachelib/timekeeper.h index 0528d8549c3..73b5c20c353 100644 --- a/library/cpp/actors/dnscachelib/timekeeper.h +++ b/library/cpp/actors/dnscachelib/timekeeper.h @@ -14,7 +14,7 @@ class TTimeKeeper { public: static TInstant GetNow(void) { - return TInstant::MicroSeconds(GetTime()); + return TInstant::MicroSeconds(GetTime()); } static time_t GetTime(void) { diff --git a/library/cpp/actors/interconnect/load.cpp b/library/cpp/actors/interconnect/load.cpp index 2a8443da71f..6ed6776e91c 100644 --- a/library/cpp/actors/interconnect/load.cpp +++ b/library/cpp/actors/interconnect/load.cpp @@ -217,7 +217,7 @@ namespace NInterconnect { // put item into timeout queue PutTimeoutQueueItem(ctx, id); - const TDuration duration = TDuration::MicroSeconds(Params.IntervalMin.GetValue() + + const TDuration duration = TDuration::MicroSeconds(Params.IntervalMin.GetValue() + RandomNumber(Params.IntervalMax.GetValue() - Params.IntervalMin.GetValue() + 1)); if (Params.SoftLoad) { NextMessageTimestamp += duration; diff --git a/library/cpp/actors/interconnect/ya.make b/library/cpp/actors/interconnect/ya.make index 60d29b0fc0c..f75cb720f04 100644 --- a/library/cpp/actors/interconnect/ya.make +++ b/library/cpp/actors/interconnect/ya.make @@ -6,8 +6,8 @@ OWNER( g:kikimr ) -NO_WSHADOW() - +NO_WSHADOW() + IF (PROFILE_MEMORY_ALLOCATIONS) CFLAGS(-DPROFILE_MEMORY_ALLOCATIONS) ENDIF() diff --git a/library/cpp/actors/memory_log/memlog.h b/library/cpp/actors/memory_log/memlog.h index 2aa27272a62..469b7aed5e4 100644 --- a/library/cpp/actors/memory_log/memlog.h +++ b/library/cpp/actors/memory_log/memlog.h @@ -1,7 +1,7 @@ #pragma once #include <library/cpp/threading/queue/mpmc_unordered_ring.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/printf.h> #include <util/system/datetime.h> #include <util/system/thread.h> diff --git a/library/cpp/actors/prof/tag.cpp b/library/cpp/actors/prof/tag.cpp index 9ccf03e1a97..9c4f31f09ea 100644 --- a/library/cpp/actors/prof/tag.cpp +++ b/library/cpp/actors/prof/tag.cpp @@ -64,7 +64,7 @@ namespace NProfiling { return TStringAtoms::Instance().MakeTag(s); } - ui32 MakeTags(const TVector<const char*>& ss) { + ui32 MakeTags(const TVector<const char*>& ss) { return TStringAtoms::Instance().MakeTags(ss); } diff --git a/library/cpp/actors/prof/tag.h b/library/cpp/actors/prof/tag.h index 357e264a229..9ca3dcc3a54 100644 --- a/library/cpp/actors/prof/tag.h +++ b/library/cpp/actors/prof/tag.h @@ -12,7 +12,7 @@ namespace NProfiling { ui32 MakeTag(const char* s); // Make only unique tags. Y_VERIFY inside. - ui32 MakeTags(const TVector<const char*>& ss); + ui32 MakeTags(const TVector<const char*>& ss); const char* GetTag(ui32 tag); size_t GetTagsCount(); diff --git a/library/cpp/actors/prof/ut/tag_ut.cpp b/library/cpp/actors/prof/ut/tag_ut.cpp index accf3921ab1..6687959752c 100644 --- a/library/cpp/actors/prof/ut/tag_ut.cpp +++ b/library/cpp/actors/prof/ut/tag_ut.cpp @@ -54,7 +54,7 @@ void TAtomTagsTest::Test_MakeAndGetTag() { } void TAtomTagsTest::Test_MakeVector() { - TVector<const char*> strs = { + TVector<const char*> strs = { "vector tag 0", "vector tag 1", "vector tag 3", diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp index 6fa25b99656..132b252cda9 100644 --- a/library/cpp/actors/testlib/test_runtime.cpp +++ b/library/cpp/actors/testlib/test_runtime.cpp @@ -38,7 +38,7 @@ namespace NActors { void PrintEvent(TAutoPtr<IEventHandle>& ev, const TTestActorRuntimeBase* runtime) { Cerr << "mailbox: " << ev->GetRecipientRewrite().Hint() << ", type: " << Sprintf("%08x", ev->GetTypeRewrite()) << ", from " << ev->Sender.LocalId(); - TString name = runtime->GetActorName(ev->Sender); + TString name = runtime->GetActorName(ev->Sender); if (!name.empty()) Cerr << " \"" << name << "\""; Cerr << ", to " << ev->GetRecipientRewrite().LocalId(); @@ -473,7 +473,7 @@ namespace NActors { , ShouldContinue() , CurrentTimestamp(0) , DispatchTimeout(DEFAULT_DISPATCH_TIMEOUT) - , ReschedulingDelay(TDuration::MicroSeconds(0)) + , ReschedulingDelay(TDuration::MicroSeconds(0)) , ObserverFunc(&TTestActorRuntimeBase::DefaultObserverFunc) , ScheduledEventsSelectorFunc(&CollapsedTimeScheduledEventsSelector) , EventFilterFunc(&TTestActorRuntimeBase::DefaultFilterFunc) @@ -588,16 +588,16 @@ namespace NActors { class TScheduledTreeItem { public: - TString Name; + TString Name; ui64 Count; - TVector<TScheduledTreeItem> Children; + TVector<TScheduledTreeItem> Children; - TScheduledTreeItem(const TString& name) + TScheduledTreeItem(const TString& name) : Name(name) , Count(0) {} - TScheduledTreeItem* GetItem(const TString& name) { + TScheduledTreeItem* GetItem(const TString& name) { TScheduledTreeItem* item = nullptr; for (TScheduledTreeItem& i : Children) { if (i.Name == name) { @@ -621,8 +621,8 @@ namespace NActors { void Print(IOutputStream& stream, const TString& prefix) { for (auto it = Children.begin(); it != Children.end(); ++it) { bool lastChild = (std::next(it) == Children.end()); - TString connectionPrefix = lastChild ? "└─ " : "├─ "; - TString subChildPrefix = lastChild ? " " : "│ "; + TString connectionPrefix = lastChild ? "└─ " : "├─ "; + TString subChildPrefix = lastChild ? " " : "│ "; stream << prefix << connectionPrefix << it->Name << " (" << it->Count << ")\n"; it->Print(stream, prefix + subChildPrefix); } @@ -630,7 +630,7 @@ namespace NActors { void Print(IOutputStream& stream) { stream << Name << " (" << Count << ")\n"; - Print(stream, TString()); + Print(stream, TString()); } }; @@ -647,7 +647,7 @@ namespace NActors { runtime.ScheduledCount++; if (runtime.ScheduledCount > runtime.ScheduledLimit) { // TScheduledTreeItem root("Root"); -// TVector<TString> path; +// TVector<TString> path; // for (const auto& pr : eventTypes) { // path.clear(); // path.push_back(runtime.GetActorName(pr.first.first)); @@ -658,7 +658,7 @@ namespace NActors { // ui64 count = pr.second; // TScheduledTreeItem* item = &root; // item->Count += count; -// for (TString name : path) { +// for (TString name : path) { // item = item->GetItem(name); // item->Count += count; // } @@ -783,7 +783,7 @@ namespace NActors { TGuard<TMutex> guard(Mutex); for (ui32 nodeIndex = 0; nodeIndex < NodeCount; ++nodeIndex) { TNodeDataBase* node = Nodes[FirstNodeId + nodeIndex].Get(); - TString explanation; + TString explanation; auto status = node->LogSettings->SetLevel(priority, component, explanation); if (status) { Y_FAIL("SetLogPriority failed: %s", explanation.c_str()); @@ -1063,7 +1063,7 @@ namespace NActors { TTestActorRuntimeBase& Runtime; } DispatchContextSetter(*this, localContext); - TInstant dispatchTime = TInstant::MicroSeconds(0); + TInstant dispatchTime = TInstant::MicroSeconds(0); TInstant deadline = dispatchTime + DispatchTimeout; const TDuration scheduledEventsInspectInterval = TDuration::MilliSeconds(10); TInstant inspectScheduledEventsAt = dispatchTime + scheduledEventsInspectInterval; @@ -1152,7 +1152,7 @@ namespace NActors { isEmpty = true; auto mboxIt = startWithMboxIt; - TDeque<TEventMailboxId> suspectedBoxes; + TDeque<TEventMailboxId> suspectedBoxes; while (true) { auto& mbox = *mboxIt; bool isIgnored = true; @@ -1741,12 +1741,12 @@ namespace NActors { struct TStrandingActorDecoratorContext : public TThrRefBase { TStrandingActorDecoratorContext() - : Queue(new TQueueType) + : Queue(new TQueueType) { } - typedef TOneOneQueueInplace<IEventHandle*, 32> TQueueType; - TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> Queue; + typedef TOneOneQueueInplace<IEventHandle*, 32> TQueueType; + TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> Queue; }; class TStrandingActorDecorator : public TActorBootstrapped<TStrandingActorDecorator> { diff --git a/library/cpp/actors/testlib/test_runtime.h b/library/cpp/actors/testlib/test_runtime.h index 26e3b45c984..178837abf99 100644 --- a/library/cpp/actors/testlib/test_runtime.h +++ b/library/cpp/actors/testlib/test_runtime.h @@ -90,9 +90,9 @@ namespace NActors { } }; - TVector<TFinalEventCondition> FinalEvents; - TVector<TEventMailboxId> NonEmptyMailboxes; - TVector<TEventMailboxId> OnlyMailboxes; + TVector<TFinalEventCondition> FinalEvents; + TVector<TEventMailboxId> NonEmptyMailboxes; + TVector<TEventMailboxId> OnlyMailboxes; std::function<bool()> CustomFinalCondition; bool Quiet = false; }; @@ -123,13 +123,13 @@ namespace NActors { static ui64 NextUniqueId; }; - typedef TDeque<TAutoPtr<IEventHandle>> TEventsList; - typedef TSet<TScheduledEventQueueItem> TScheduledEventsList; + typedef TDeque<TAutoPtr<IEventHandle>> TEventsList; + typedef TSet<TScheduledEventQueueItem> TScheduledEventsList; class TEventMailBox : public TThrRefBase { public: TEventMailBox() - : InactiveUntil(TInstant::MicroSeconds(0)) + : InactiveUntil(TInstant::MicroSeconds(0)) #ifdef DEBUG_ORDER_EVENTS , ExpectedReceive(0) , NextToSend(0) @@ -158,7 +158,7 @@ namespace NActors { TInstant InactiveUntil; TEventsList Sent; #ifdef DEBUG_ORDER_EVENTS - TMap<IEventHandle*, ui64> TrackSent; + TMap<IEventHandle*, ui64> TrackSent; ui64 ExpectedReceive; ui64 NextToSend; #endif @@ -238,7 +238,7 @@ namespace NActors { ui32 GetNodeCount() const; ui64 AllocateLocalId(); ui32 InterconnectPoolId() const; - TString GetTempDir(); + TString GetTempDir(); TActorId Register(IActor* actor, ui32 nodeIndex = 0, ui32 poolId = 0, TMailboxType::EType mailboxType = TMailboxType::Simple, ui64 revolvingCounter = 0, const TActorId& parentid = TActorId()); @@ -427,10 +427,10 @@ namespace NActors { } template <typename... TEvents> - static TString TypeNames() { - static TString names[] = { TypeName<TEvents>()... }; - TString result; - for (const TString& s : names) { + static TString TypeNames() { + static TString names[] = { TypeName<TEvents>()... }; + TString result; + for (const TString& s : names) { if (result.empty()) { result += '<'; } else { @@ -464,8 +464,8 @@ namespace NActors { void SetDispatcherRandomSeed(TInstant time, ui64 iteration); TString GetActorName(const TActorId& actorId) const; - const TVector<ui64>& GetTxAllocatorTabletIds() const { return TxAllocatorTabletIds; } - void SetTxAllocatorTabletIds(const TVector<ui64>& ids) { TxAllocatorTabletIds = ids; } + const TVector<ui64>& GetTxAllocatorTabletIds() const { return TxAllocatorTabletIds; } + void SetTxAllocatorTabletIds(const TVector<ui64>& ids) { TxAllocatorTabletIds = ids; } void SetUseRealInterconnect() { UseRealInterconnect = true; @@ -522,7 +522,7 @@ namespace NActors { TMutex Mutex; TCondVar MailboxesHasEvents; TEventMailBoxList Mailboxes; - TMap<ui32, ui64> EvCounters; + TMap<ui32, ui64> EvCounters; ui64 DispatchCyclesCount; ui64 DispatchedEventsCount; ui64 DispatchedEventsLimit = 2'500'000; @@ -566,7 +566,7 @@ namespace NActors { std::shared_ptr<void> AppData0; THolder<TActorSystem> ActorSystem; THolder<IExecutorPool> SchedulerPool; - TVector<IExecutorPool*> ExecutorPools; + TVector<IExecutorPool*> ExecutorPools; THolder<TExecutorThread> ExecutorThread; }; @@ -605,8 +605,8 @@ namespace NActors { const TDispatchOptions* Options; TDispatchContext* PrevContext; - TMap<const TDispatchOptions::TFinalEventCondition*, ui32> FinalEventFrequency; - TSet<TEventMailboxId> FoundNonEmptyMailboxes; + TMap<const TDispatchOptions::TFinalEventCondition*, ui32> FinalEventFrequency; + TSet<TEventMailboxId> FoundNonEmptyMailboxes; bool FinalEventFound = false; }; @@ -627,7 +627,7 @@ namespace NActors { THashMap<TActorId, TActorId> ScheduleWhiteListParent; THashMap<TActorId, TString> ActorNames; TDispatchContext* CurrentDispatchContext; - TVector<ui64> TxAllocatorTabletIds; + TVector<ui64> TxAllocatorTabletIds; static ui32 NextNodeId; }; diff --git a/library/cpp/actors/util/funnel_queue.h b/library/cpp/actors/util/funnel_queue.h index 0e21e2617cd..0ed5d9b9666 100644 --- a/library/cpp/actors/util/funnel_queue.h +++ b/library/cpp/actors/util/funnel_queue.h @@ -224,7 +224,7 @@ public: } private: - typedef TQueueType<ElementType> TBase; + typedef TQueueType<ElementType> TBase; virtual typename TBase::TEntry* NewEntry(ElementType&& element) noexcept override { AtomicAdd(Count, 1); diff --git a/library/cpp/actors/util/recentwnd.h b/library/cpp/actors/util/recentwnd.h index ba1ede6f292..5a784640cdf 100644 --- a/library/cpp/actors/util/recentwnd.h +++ b/library/cpp/actors/util/recentwnd.h @@ -3,7 +3,7 @@ #include <util/generic/deque.h> template <typename TElem, - template <typename, typename...> class TContainer = TDeque> + template <typename, typename...> class TContainer = TDeque> class TRecentWnd { public: TRecentWnd(ui32 wndSize) diff --git a/library/cpp/actors/util/thread.h b/library/cpp/actors/util/thread.h index d742c8c585f..c5b0dcc7364 100644 --- a/library/cpp/actors/util/thread.h +++ b/library/cpp/actors/util/thread.h @@ -7,7 +7,7 @@ #include <util/system/thread.h> #include <time.h> -inline void SetCurrentThreadName(const TString& name, +inline void SetCurrentThreadName(const TString& name, const ui32 maxCharsFromProcessName = 8) { #if defined(_linux_) // linux limits threadname by 15 + \0 diff --git a/library/cpp/actors/wilson/wilson_trace.h b/library/cpp/actors/wilson/wilson_trace.h index 3d1ca505623..d893cb6e411 100644 --- a/library/cpp/actors/wilson/wilson_trace.h +++ b/library/cpp/actors/wilson/wilson_trace.h @@ -143,7 +143,7 @@ namespace NWilson { return x.TraceId == y.TraceId && x.SpanId == y.SpanId; } - TString ToString() const { + TString ToString() const { return Sprintf("%" PRIu64 ":%" PRIu64, TraceId, SpanId); } diff --git a/library/cpp/archive/yarchive.cpp b/library/cpp/archive/yarchive.cpp index 1becc3e5dac..34badecc37c 100644 --- a/library/cpp/archive/yarchive.cpp +++ b/library/cpp/archive/yarchive.cpp @@ -41,7 +41,7 @@ static inline T ESLoad(IInputStream* in) { template <> inline TString ESLoad<TString>(IInputStream* in) { size_t len = ESLoad<ui32>(in); - TString ret; + TString ret; TTempBuf tmp; while (len) { @@ -62,7 +62,7 @@ inline TString ESLoad<TString>(IInputStream* in) { namespace { class TArchiveRecordDescriptor: public TSimpleRefCount<TArchiveRecordDescriptor> { public: - inline TArchiveRecordDescriptor(ui64 off, ui64 len, const TString& name) + inline TArchiveRecordDescriptor(ui64 off, ui64 len, const TString& name) : Off_(off) , Len_(len) , Name_(name) @@ -72,7 +72,7 @@ namespace { inline TArchiveRecordDescriptor(IInputStream* in) : Off_(ESLoad<ui64>(in)) , Len_(ESLoad<ui64>(in)) - , Name_(ESLoad<TString>(in)) + , Name_(ESLoad<TString>(in)) { } @@ -84,29 +84,29 @@ namespace { ESSave(out, Name_); } - inline const TString& Name() const noexcept { + inline const TString& Name() const noexcept { return Name_; } - inline ui64 Length() const noexcept { + inline ui64 Length() const noexcept { return Len_; } - inline ui64 Offset() const noexcept { + inline ui64 Offset() const noexcept { return Off_; } private: ui64 Off_; ui64 Len_; - TString Name_; + TString Name_; }; typedef TIntrusivePtr<TArchiveRecordDescriptor> TArchiveRecordDescriptorRef; } class TArchiveWriter::TImpl { - using TDict = THashMap<TString, TArchiveRecordDescriptorRef>; + using TDict = THashMap<TString, TArchiveRecordDescriptorRef>; public: inline TImpl(IOutputStream& out, bool compress) @@ -194,7 +194,7 @@ TArchiveWriter::TArchiveWriter(IOutputStream* out, bool compress) { } -TArchiveWriter::~TArchiveWriter() { +TArchiveWriter::~TArchiveWriter() { try { Finish(); } catch (...) { @@ -253,7 +253,7 @@ namespace { } class TArchiveReader::TImpl { - typedef THashMap<TString, TArchiveRecordDescriptorRef> TDict; + typedef THashMap<TString, TArchiveRecordDescriptorRef> TDict; public: inline TImpl(const TBlob& blob) @@ -299,11 +299,11 @@ public: } } - inline size_t Count() const noexcept { + inline size_t Count() const noexcept { return Recs_.size(); } - inline TString KeyByIndex(size_t n) const { + inline TString KeyByIndex(size_t n) const { if (n < Count()) { return Recs_[n]->Name(); } @@ -357,7 +357,7 @@ public: private: TBlob Blob_; - TVector<TArchiveRecordDescriptorRef> Recs_; + TVector<TArchiveRecordDescriptorRef> Recs_; TDict Dict_; bool UseDecompression; }; @@ -369,11 +369,11 @@ TArchiveReader::TArchiveReader(const TBlob& data) TArchiveReader::~TArchiveReader() {} -size_t TArchiveReader::Count() const noexcept { +size_t TArchiveReader::Count() const noexcept { return Impl_->Count(); } -TString TArchiveReader::KeyByIndex(size_t n) const { +TString TArchiveReader::KeyByIndex(size_t n) const { return Impl_->KeyByIndex(n); } diff --git a/library/cpp/archive/yarchive.h b/library/cpp/archive/yarchive.h index 8120bcb9402..76a074f8495 100644 --- a/library/cpp/archive/yarchive.h +++ b/library/cpp/archive/yarchive.h @@ -17,7 +17,7 @@ static constexpr size_t ArchiveWriterDefaultDataAlignment = 16; class TArchiveWriter { public: explicit TArchiveWriter(IOutputStream* out, bool compress = true); - ~TArchiveWriter(); + ~TArchiveWriter(); void Flush(); void Finish(); diff --git a/library/cpp/archive/yarchive_ut.cpp b/library/cpp/archive/yarchive_ut.cpp index 602a1cdbbde..bd15cf825ee 100644 --- a/library/cpp/archive/yarchive_ut.cpp +++ b/library/cpp/archive/yarchive_ut.cpp @@ -26,12 +26,12 @@ UNIT_TEST_SUITE_REGISTRATION(TArchiveTest); #define ARCHIVE "./test.ar" void TArchiveTest::CreateArchive() { - TFixedBufferFileOutput out(ARCHIVE); + TFixedBufferFileOutput out(ARCHIVE); TArchiveWriter w(&out); for (size_t i = 0; i < 1000; ++i) { - const TString path = "/" + ToString(i); - const TString data = "data" + ToString(i * 1000) + "dataend"; + const TString path = "/" + ToString(i); + const TString data = "data" + ToString(i * 1000) + "dataend"; TStringInput si(data); w.Add(path, &si); @@ -55,9 +55,9 @@ void TArchiveTest::TestRead() { UNIT_ASSERT_EQUAL(r.Count(), 1000); for (size_t i = 0; i < 1000; ++i) { - const TString key = "/" + ToString(i); + const TString key = "/" + ToString(i); TAutoPtr<IInputStream> is = r.ObjectByKey(key); - const TString data = is->ReadAll(); + const TString data = is->ReadAll(); UNIT_ASSERT_EQUAL(data, "data" + ToString(i * 1000) + "dataend"); } @@ -66,15 +66,15 @@ void TArchiveTest::TestRead() { void TArchiveTest::TestOffsetOrder() { CreateArchive(); TTempFile tmpFile(ARCHIVE); - TBlob blob1 = TBlob::FromFileSingleThreaded(ARCHIVE); - TArchiveReader r(blob1); + TBlob blob1 = TBlob::FromFileSingleThreaded(ARCHIVE); + TArchiveReader r(blob1); const void* prevOffset = nullptr; for (size_t i = 0; i < r.Count(); ++i) { - const TString key = r.KeyByIndex(i); - TBlob blob2 = r.BlobByKey(key); - const void* offset = blob2.Data(); + const TString key = r.KeyByIndex(i); + TBlob blob2 = r.BlobByKey(key); + const void* offset = blob2.Data(); if (i) { UNIT_ASSERT(prevOffset < offset); diff --git a/library/cpp/balloc/balloc.cpp b/library/cpp/balloc/balloc.cpp index fab489db4c5..9b667867284 100644 --- a/library/cpp/balloc/balloc.cpp +++ b/library/cpp/balloc/balloc.cpp @@ -109,7 +109,7 @@ extern "C" void free(void* data) { #define OP_THROWNOTHING #endif -void* operator new(size_t size) { +void* operator new(size_t size) { #if defined(Y_COVER_PTR) return malloc(size); #else @@ -168,7 +168,7 @@ void operator delete(void* p, const std::nothrow_t&)OP_THROWNOTHING { #endif } -void* operator new[](size_t size) { +void* operator new[](size_t size) { #if defined(Y_COVER_PTR) return malloc(size); #else diff --git a/library/cpp/binsaver/bin_saver.h b/library/cpp/binsaver/bin_saver.h index 412424889f3..5e6db69bf7b 100644 --- a/library/cpp/binsaver/bin_saver.h +++ b/library/cpp/binsaver/bin_saver.h @@ -247,7 +247,7 @@ private: DataChunkStr(data, sizeof(char)); } void DataChunkStroka(TString& data) { - DataChunkStr(data, sizeof(TString::char_type)); + DataChunkStr(data, sizeof(TString::char_type)); } void DataChunkWtroka(TUtf16String& data) { DataChunkStr(data, sizeof(wchar16)); @@ -281,7 +281,7 @@ private: typedef THashMap<ui64, TPtr<IObjectBase>> CObjectsHash; TAutoPtr<CObjectsHash> Objects; - TVector<IObjectBase*> ObjectQueue; + TVector<IObjectBase*> ObjectQueue; public: bool IsReading() { @@ -390,7 +390,7 @@ public: Add(2, &nSize); } int i = 1; - for (typename TList<T1>::iterator k = data.begin(); k != data.end(); ++k, ++i) + for (typename TList<T1>::iterator k = data.begin(); k != data.end(); ++k, ++i) Add(i + 2, &(*k)); return 0; } @@ -542,7 +542,7 @@ public: template <class T> static bool HasNonTrivialSerializer(...) { - return sizeof(std::declval<IBinSaver*>()->Add(0, std::declval<T*>())) != 1; + return sizeof(std::declval<IBinSaver*>()->Add(0, std::declval<T*>())) != 1; } public: @@ -625,19 +625,19 @@ struct TRegisterSaveLoadType { return 0; \ } -#define SAVELOAD_OVERRIDE_WITHOUT_BASE(...) \ - int operator&(IBinSaver& f) override { \ - f.AddMulti(__VA_ARGS__); \ - return 0; \ - } - -#define SAVELOAD_OVERRIDE(base, ...) \ - int operator&(IBinSaver& f) override { \ - base::operator&(f); \ - f.AddMulti(__VA_ARGS__); \ - return 0; \ +#define SAVELOAD_OVERRIDE_WITHOUT_BASE(...) \ + int operator&(IBinSaver& f) override { \ + f.AddMulti(__VA_ARGS__); \ + return 0; \ } +#define SAVELOAD_OVERRIDE(base, ...) \ + int operator&(IBinSaver& f) override { \ + base::operator&(f); \ + f.AddMulti(__VA_ARGS__); \ + return 0; \ + } + #define SAVELOAD_BASE(...) \ int operator&(IBinSaver& f) { \ TBase::operator&(f); \ diff --git a/library/cpp/binsaver/class_factory.h b/library/cpp/binsaver/class_factory.h index e83512331ba..5e9958a3d8f 100644 --- a/library/cpp/binsaver/class_factory.h +++ b/library/cpp/binsaver/class_factory.h @@ -2,7 +2,7 @@ #include <typeinfo> #include <util/generic/hash.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/ysafeptr.h> diff --git a/library/cpp/binsaver/ut/binsaver_ut.cpp b/library/cpp/binsaver/ut/binsaver_ut.cpp index 37eba5406f2..b8cffcf5e30 100644 --- a/library/cpp/binsaver/ut/binsaver_ut.cpp +++ b/library/cpp/binsaver/ut/binsaver_ut.cpp @@ -13,30 +13,30 @@ struct TBinarySerializable { struct TNonBinarySerializable { ui32 Data = 0; - TString StrData; + TString StrData; }; struct TCustomSerializer { ui32 Data = 0; - TString StrData; + TString StrData; SAVELOAD(StrData, Data); }; struct TCustomOuterSerializer { ui32 Data = 0; - TString StrData; + TString StrData; }; void operator&(TCustomOuterSerializer& s, IBinSaver& f); struct TCustomOuterSerializerTmpl { ui32 Data = 0; - TString StrData; + TString StrData; }; struct TCustomOuterSerializerTmplDerived: public TCustomOuterSerializerTmpl { ui32 Data = 0; - TString StrData; + TString StrData; }; struct TMoveOnlyType { @@ -52,7 +52,7 @@ struct TMoveOnlyType { struct TTypeWithArray { ui32 Data = 1; - TString Array[2][2]{{"test", "data"}, {"and", "more"}}; + TString Array[2][2]{{"test", "data"}, {"and", "more"}}; SAVELOAD(Data, Array); bool operator==(const TTypeWithArray& obj) const { diff --git a/library/cpp/bit_io/bitinout_ut.cpp b/library/cpp/bit_io/bitinout_ut.cpp index 23a1ddf344f..2a950226056 100644 --- a/library/cpp/bit_io/bitinout_ut.cpp +++ b/library/cpp/bit_io/bitinout_ut.cpp @@ -19,8 +19,8 @@ namespace NBitIO { return bytes << 3ULL; } - inline TString PrintBits(const char* a, const char* b, bool reverse = false) { - TString s; + inline TString PrintBits(const char* a, const char* b, bool reverse = false) { + TString s; TStringOutput out(s); for (const char* it = a; it != b; ++it) { if (it != a) @@ -40,7 +40,7 @@ namespace NBitIO { } template <typename T> - inline TString PrintBits(T t, ui32 bits = Bits(sizeof(T))) { + inline TString PrintBits(T t, ui32 bits = Bits(sizeof(T))) { return PrintBits((char*)&t, ((char*)&t) + BytesUp(bits)); } } @@ -52,9 +52,9 @@ class TBitIOTest: public TTestBase { private: using TBi = NBitIO::TBitInput; - using TVec = TVector<char>; + using TVec = TVector<char>; - void static CheckBits(const TVec& v, const TString& ref, const TString& rem) { + void static CheckBits(const TVec& v, const TString& ref, const TString& rem) { UNIT_ASSERT_VALUES_EQUAL_C(NBitIO::PrintBits(v.begin(), v.end()), ref, rem); } @@ -80,7 +80,7 @@ private: } template <typename TBo> - void DoWrite1(TBo& out, const TString& rem) { + void DoWrite1(TBo& out, const TString& rem) { out.Write(0x0C, 3); UNIT_ASSERT_VALUES_EQUAL_C(out.GetOffset(), 1u, (rem + ", " + ToString(__LINE__))); out.Write(0x18, 4); @@ -94,7 +94,7 @@ private: } template <typename TBo> - void DoWrite2(TBo& out, const TString& rem) { + void DoWrite2(TBo& out, const TString& rem) { out.Write(0x0C, 3); UNIT_ASSERT_VALUES_EQUAL_C(out.GetOffset(), 8u, (rem + ", " + ToString(__LINE__))); @@ -120,7 +120,7 @@ private: UNIT_ASSERT_VALUES_EQUAL_C(out.GetOffset(), 41u, (rem + ", " + ToString(__LINE__))); } - void DoBitOutput(NBitIO::TBitOutputYVector& out, const TString& rem) { + void DoBitOutput(NBitIO::TBitOutputYVector& out, const TString& rem) { DoWrite1(out, rem); out.WriteWords<8>(0xabcdef); @@ -129,7 +129,7 @@ private: DoWrite2(out, rem); } - void DoBitOutput(NBitIO::TBitOutputArray& out, const TString& rem) { + void DoBitOutput(NBitIO::TBitOutputArray& out, const TString& rem) { DoWrite1(out, rem); out.WriteWords<8>(0xabcdef); @@ -138,7 +138,7 @@ private: DoWrite2(out, rem); } - void DoBitInput(TBi& in, const TString& rem) { + void DoBitInput(TBi& in, const TString& rem) { UNIT_ASSERT(!in.Eof()); { diff --git a/library/cpp/bit_io/bitoutput.h b/library/cpp/bit_io/bitoutput.h index 2b886c1f026..e7d205ad94c 100644 --- a/library/cpp/bit_io/bitoutput.h +++ b/library/cpp/bit_io/bitoutput.h @@ -169,7 +169,7 @@ namespace NBitIO { } }; - using TBitOutputYVector = TBitOutputVector<TVector<char>>; + using TBitOutputYVector = TBitOutputVector<TVector<char>>; class TBitOutputStreamImpl { IOutputStream* Out; diff --git a/library/cpp/blockcodecs/codecs/brotli/brotli.cpp b/library/cpp/blockcodecs/codecs/brotli/brotli.cpp index 6e3cd971bdc..a23765b0d48 100644 --- a/library/cpp/blockcodecs/codecs/brotli/brotli.cpp +++ b/library/cpp/blockcodecs/codecs/brotli/brotli.cpp @@ -59,7 +59,7 @@ namespace { struct TBrotliRegistrar { TBrotliRegistrar() { for (int i = 1; i <= TBrotliCodec::BEST_QUALITY; ++i) { - RegisterCodec(MakeHolder<TBrotliCodec>(i)); + RegisterCodec(MakeHolder<TBrotliCodec>(i)); } } }; diff --git a/library/cpp/blockcodecs/codecs/bzip/bzip.cpp b/library/cpp/blockcodecs/codecs/bzip/bzip.cpp index 3a5cfdd0e9a..230165e817a 100644 --- a/library/cpp/blockcodecs/codecs/bzip/bzip.cpp +++ b/library/cpp/blockcodecs/codecs/bzip/bzip.cpp @@ -53,7 +53,7 @@ namespace { struct TBZipRegistrar { TBZipRegistrar() { for (int i = 1; i < 10; ++i) { - RegisterCodec(MakeHolder<TBZipCodec>(i)); + RegisterCodec(MakeHolder<TBZipCodec>(i)); } RegisterAlias("bzip2", "bzip2-6"); } diff --git a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp index da2831fbd24..49c8bb59022 100644 --- a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp +++ b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp @@ -45,7 +45,7 @@ namespace { struct TFastLZRegistrar { TFastLZRegistrar() { for (int i = 0; i < 3; ++i) { - RegisterCodec(MakeHolder<TFastLZCodec>(i)); + RegisterCodec(MakeHolder<TFastLZCodec>(i)); } RegisterAlias("fastlz", "fastlz-0"); } diff --git a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp index 042f031679c..0416ff964fc 100644 --- a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp +++ b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp @@ -23,7 +23,7 @@ namespace { return ret; } - static inline size_t DoMaxCompressedLength(size_t l) noexcept { + static inline size_t DoMaxCompressedLength(size_t l) noexcept { return ZSTD_compressBound(l); } @@ -39,18 +39,18 @@ namespace { } } - TStringBuf Name() const noexcept override { + TStringBuf Name() const noexcept override { return MyName; } const unsigned Level; - const TString MyName; + const TString MyName; }; struct TZStd06Registrar { TZStd06Registrar() { for (unsigned i = 1; i <= ZSTD_maxCLevel(); ++i) { - RegisterCodec(MakeHolder<TZStd06Codec>(i)); + RegisterCodec(MakeHolder<TZStd06Codec>(i)); } } }; diff --git a/library/cpp/blockcodecs/codecs/lz4/lz4.cpp b/library/cpp/blockcodecs/codecs/lz4/lz4.cpp index fbf0fe110f1..f800b503163 100644 --- a/library/cpp/blockcodecs/codecs/lz4/lz4.cpp +++ b/library/cpp/blockcodecs/codecs/lz4/lz4.cpp @@ -101,16 +101,16 @@ namespace { THolder<T2> t2(new T2(i)); if (t1->Methods) { - RegisterCodec(std::move(t1)); + RegisterCodec(std::move(t1)); } if (t2->Methods) { - RegisterCodec(std::move(t2)); + RegisterCodec(std::move(t2)); } } - RegisterCodec(MakeHolder<TLz4Codec<TLz4BestCompress, TLz4FastDecompress>>()); - RegisterCodec(MakeHolder<TLz4Codec<TLz4BestCompress, TLz4SafeDecompress>>()); + RegisterCodec(MakeHolder<TLz4Codec<TLz4BestCompress, TLz4FastDecompress>>()); + RegisterCodec(MakeHolder<TLz4Codec<TLz4BestCompress, TLz4SafeDecompress>>()); RegisterAlias("lz4-fast-safe", "lz4-fast14-safe"); RegisterAlias("lz4-fast-fast", "lz4-fast14-fast"); diff --git a/library/cpp/blockcodecs/codecs/lzma/lzma.cpp b/library/cpp/blockcodecs/codecs/lzma/lzma.cpp index 6c8d5fded42..ab3a2466f58 100644 --- a/library/cpp/blockcodecs/codecs/lzma/lzma.cpp +++ b/library/cpp/blockcodecs/codecs/lzma/lzma.cpp @@ -65,7 +65,7 @@ namespace { struct TLzmaRegistrar { TLzmaRegistrar() { for (int i = 0; i < 10; ++i) { - RegisterCodec(MakeHolder<TLzmaCodec>(i)); + RegisterCodec(MakeHolder<TLzmaCodec>(i)); } RegisterAlias("lzma", "lzma-5"); } diff --git a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp index f6be05a05fc..44d8c140a42 100644 --- a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp +++ b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp @@ -45,7 +45,7 @@ namespace { struct TSnappyRegistrar { TSnappyRegistrar() { - RegisterCodec(MakeHolder<TSnappyCodec>()); + RegisterCodec(MakeHolder<TSnappyCodec>()); } }; const TSnappyRegistrar Registrar{}; diff --git a/library/cpp/blockcodecs/codecs/zlib/zlib.cpp b/library/cpp/blockcodecs/codecs/zlib/zlib.cpp index cdb556c36d4..fc1f602d9fd 100644 --- a/library/cpp/blockcodecs/codecs/zlib/zlib.cpp +++ b/library/cpp/blockcodecs/codecs/zlib/zlib.cpp @@ -55,7 +55,7 @@ namespace { struct TZLibRegistrar { TZLibRegistrar() { for (int i = 0; i < 10; ++i) { - RegisterCodec(MakeHolder<TZLibCodec>(i)); + RegisterCodec(MakeHolder<TZLibCodec>(i)); } RegisterAlias("zlib", "zlib-6"); } diff --git a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp index 95299b3f6d3..3f905c8687a 100644 --- a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp +++ b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp @@ -50,7 +50,7 @@ namespace { struct TZStd08Registrar { TZStd08Registrar() { for (int i = 1; i <= ZSTD_maxCLevel(); ++i) { - RegisterCodec(MakeHolder<TZStd08Codec>(i)); + RegisterCodec(MakeHolder<TZStd08Codec>(i)); RegisterAlias("zstd_" + ToString(i), "zstd08_" + ToString(i)); } } diff --git a/library/cpp/blockcodecs/codecs_ut.cpp b/library/cpp/blockcodecs/codecs_ut.cpp index bfe5a236909..d5e167b85e2 100644 --- a/library/cpp/blockcodecs/codecs_ut.cpp +++ b/library/cpp/blockcodecs/codecs_ut.cpp @@ -17,7 +17,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { } void TestAllAtOnce(size_t n, size_t m) { - TVector<TBuffer> datas; + TVector<TBuffer> datas; datas.emplace_back(); datas.push_back(Buffer("na gorshke sidel korol")); @@ -50,7 +50,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { for (size_t j = 0; j < datas.size(); ++j) { const TBuffer& data = datas[j]; - TString res; + TString res; try { TBuffer e, d; @@ -144,11 +144,11 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { } void TestStreams(size_t n, size_t m) { - TVector<TString> datas; - TString res; + TVector<TString> datas; + TString res; for (size_t i = 0; i < 256; ++i) { - datas.push_back(TString(i, (char)(i % 128))); + datas.push_back(TString(i, (char)(i % 128))); } for (size_t i = 0; i < datas.size(); ++i) { @@ -178,7 +178,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { out.Finish(); } - const TString resNew = TDecodedInput(&ss).ReadAll(); + const TString resNew = TDecodedInput(&ss).ReadAll(); try { UNIT_ASSERT_EQUAL(resNew, res); diff --git a/library/cpp/blockcodecs/core/codecs.cpp b/library/cpp/blockcodecs/core/codecs.cpp index 21506e812b4..072da370878 100644 --- a/library/cpp/blockcodecs/core/codecs.cpp +++ b/library/cpp/blockcodecs/core/codecs.cpp @@ -61,8 +61,8 @@ namespace { TDeque<TString> Tmp; TNullCodec Null; - TVector<TCodecPtr> Codecs; - typedef THashMap<TStringBuf, ICodec*> TRegistry; + TVector<TCodecPtr> Codecs; + typedef THashMap<TStringBuf, ICodec*> TRegistry; TRegistry Registry; // SEARCH-8344: Global decompressed size limiter (to prevent remote DoS) @@ -82,7 +82,7 @@ TCodecList NBlockCodecs::ListAllCodecs() { return ret; } -TString NBlockCodecs::ListAllCodecsAsString() { +TString NBlockCodecs::ListAllCodecsAsString() { return JoinSeq(TStringBuf(","), ListAllCodecs()); } @@ -127,7 +127,7 @@ void ICodec::Decode(const TData& in, TBuffer& out) const { out.Resize(Decompress(in, out.Data())); } -void ICodec::Encode(const TData& in, TString& out) const { +void ICodec::Encode(const TData& in, TString& out) const { const size_t maxLen = MaxCompressedLength(in); out.ReserveAndResize(maxLen); @@ -136,7 +136,7 @@ void ICodec::Encode(const TData& in, TString& out) const { out.resize(actualLen); } -void ICodec::Decode(const TData& in, TString& out) const { +void ICodec::Decode(const TData& in, TString& out) const { const size_t maxLen = GetDecompressedLength(in); out.ReserveAndResize(maxLen); diff --git a/library/cpp/blockcodecs/core/codecs.h b/library/cpp/blockcodecs/core/codecs.h index 9c93c002748..878678d5c7a 100644 --- a/library/cpp/blockcodecs/core/codecs.h +++ b/library/cpp/blockcodecs/core/codecs.h @@ -2,7 +2,7 @@ #include <util/generic/buffer.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/typetraits.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> @@ -45,25 +45,25 @@ namespace NBlockCodecs { virtual size_t Compress(const TData& in, void* out) const = 0; virtual size_t Decompress(const TData& in, void* out) const = 0; - virtual TStringBuf Name() const noexcept = 0; + virtual TStringBuf Name() const noexcept = 0; // some useful helpers void Encode(const TData& in, TBuffer& out) const; void Decode(const TData& in, TBuffer& out) const; - void Encode(const TData& in, TString& out) const; - void Decode(const TData& in, TString& out) const; + void Encode(const TData& in, TString& out) const; + void Decode(const TData& in, TString& out) const; - inline TString Encode(const TData& in) const { - TString out; + inline TString Encode(const TData& in) const { + TString out; Encode(in, out); return out; } - inline TString Decode(const TData& in) const { - TString out; + inline TString Decode(const TData& in) const { + TString out; Decode(in, out); @@ -78,9 +78,9 @@ namespace NBlockCodecs { const ICodec* Codec(const TStringBuf& name); // some aux methods - typedef TVector<TStringBuf> TCodecList; + typedef TVector<TStringBuf> TCodecList; TCodecList ListAllCodecs(); - TString ListAllCodecsAsString(); + TString ListAllCodecsAsString(); // SEARCH-8344: Get the size of max possible decompressed block size_t GetMaxPossibleDecompressedLength(); diff --git a/library/cpp/blockcodecs/core/common.h b/library/cpp/blockcodecs/core/common.h index f05df4d3341..8e1dabb593c 100644 --- a/library/cpp/blockcodecs/core/common.h +++ b/library/cpp/blockcodecs/core/common.h @@ -55,7 +55,7 @@ namespace NBlockCodecs { return in.size(); } - TStringBuf Name() const noexcept override { + TStringBuf Name() const noexcept override { return TStringBuf("null"); } }; @@ -98,7 +98,7 @@ namespace NBlockCodecs { return len; } - inline const T* Base() const noexcept { + inline const T* Base() const noexcept { return static_cast<const T*>(this); } }; diff --git a/library/cpp/blockcodecs/core/stream.cpp b/library/cpp/blockcodecs/core/stream.cpp index 4f7db3c32be..856400b5a1d 100644 --- a/library/cpp/blockcodecs/core/stream.cpp +++ b/library/cpp/blockcodecs/core/stream.cpp @@ -51,7 +51,7 @@ namespace { ythrow yexception() << "can not find codec by id " << id; } - typedef THashMap<TCodecID, const ICodec*> TByID; + typedef THashMap<TCodecID, const ICodec*> TByID; TByID ByID; }; @@ -74,7 +74,7 @@ TCodedOutput::TCodedOutput(IOutputStream* out, const ICodec* c, size_t bufLen) } } -TCodedOutput::~TCodedOutput() { +TCodedOutput::~TCodedOutput() { try { Finish(); } catch (...) { diff --git a/library/cpp/blockcodecs/core/stream.h b/library/cpp/blockcodecs/core/stream.h index fd44ef88f2c..92ccd10333f 100644 --- a/library/cpp/blockcodecs/core/stream.h +++ b/library/cpp/blockcodecs/core/stream.h @@ -12,7 +12,7 @@ namespace NBlockCodecs { class TCodedOutput: public IOutputStream { public: TCodedOutput(IOutputStream* out, const ICodec* c, size_t bufLen); - ~TCodedOutput() override; + ~TCodedOutput() override; private: void DoWrite(const void* buf, size_t len) override; @@ -33,7 +33,7 @@ namespace NBlockCodecs { TDecodedInput(IInputStream* in); TDecodedInput(IInputStream* in, const ICodec* codec); - ~TDecodedInput() override; + ~TDecodedInput() override; private: size_t DoUnboundedNext(const void** ptr) override; diff --git a/library/cpp/cache/cache.h b/library/cpp/cache/cache.h index 6dc997076d9..f79be81fa52 100644 --- a/library/cpp/cache/cache.h +++ b/library/cpp/cache/cache.h @@ -81,7 +81,7 @@ public: } TItem* GetOldest() { - typename TListType::TIterator it = List.Begin(); + typename TListType::TIterator it = List.Begin(); Y_ASSERT(it != List.End()); return &*it; } @@ -116,8 +116,8 @@ public: } private: - typedef TIntrusiveList<TItem> TListType; - TListType List; + typedef TIntrusiveList<TItem> TListType; + TListType List; TSizeProvider SizeProvider; size_t ItemsAmount; size_t TotalSize; @@ -189,7 +189,7 @@ public: } TItem* GetLeastFrequentlyUsed() { - typename TListType::TIterator it = List.Begin(); + typename TListType::TIterator it = List.Begin(); Y_ASSERT(it != List.End()); return &*it; } @@ -201,7 +201,7 @@ public: void Promote(TItem* item) { size_t counter = ++item->Counter; - typename TListType::TIterator it = item; + typename TListType::TIterator it = item; while (it != List.End() && counter >= it->Counter) { ++it; } @@ -223,8 +223,8 @@ public: } private: - typedef TIntrusiveList<TItem> TListType; - TListType List; + typedef TIntrusiveList<TItem> TListType; + TListType List; size_t ListSize; size_t MaxSize; }; @@ -366,18 +366,18 @@ private: } private: - TVector<TItem*> Heap; - THashSet<TItem*> Removed; + TVector<TItem*> Heap; + THashSet<TItem*> Removed; size_t Size; size_t MaxSize; }; -template <typename TKey, typename TValue, typename TListType, typename TDeleter> +template <typename TKey, typename TValue, typename TListType, typename TDeleter> class TCache { - typedef typename TListType::TItem TItem; + typedef typename TListType::TItem TItem; typedef typename TItem::THash THash; - typedef THashMultiSet<TItem, THash> TIndex; + typedef THashMultiSet<TItem, THash> TIndex; typedef typename TIndex::iterator TIndexIterator; typedef typename TIndex::const_iterator TIndexConstIterator; @@ -418,7 +418,7 @@ public: return Iter->Value; } - friend class TCache<TKey, TValue, TListType, TDeleter>; + friend class TCache<TKey, TValue, TListType, TDeleter>; private: TIndexConstIterator Iter; @@ -547,7 +547,7 @@ public: protected: TIndex Index; - TListType List; + TListType List; bool MultiValue; TIterator FindByItem(TItem* item) { @@ -570,7 +570,7 @@ protected: struct TNoopDelete { template <class T> - static inline void Destroy(const T&) noexcept { + static inline void Destroy(const T&) noexcept { } }; diff --git a/library/cpp/cache/ut/cache_ut.cpp b/library/cpp/cache/ut/cache_ut.cpp index 329872cfdee..33dacbc5659 100644 --- a/library/cpp/cache/ut/cache_ut.cpp +++ b/library/cpp/cache/ut/cache_ut.cpp @@ -3,7 +3,7 @@ #include <library/cpp/testing/unittest/registar.h> struct TStrokaWeighter { - static size_t Weight(const TString& s) { + static size_t Weight(const TString& s) { return s.size(); } }; @@ -115,7 +115,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { } Y_UNIT_TEST(SimpleTest) { - typedef TLRUCache<int, TString> TCache; + typedef TLRUCache<int, TString> TCache; TCache s(2); // size 2 s.Insert(1, "abcd"); UNIT_ASSERT(s.Find(1) != s.End()); @@ -312,7 +312,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { } Y_UNIT_TEST(MultiCacheTest) { - typedef TLRUCache<int, TString> TCache; + typedef TLRUCache<int, TString> TCache; TCache s(3, true); UNIT_ASSERT(s.Insert(1, "abcd")); UNIT_ASSERT(s.Insert(1, "bcde")); @@ -358,7 +358,7 @@ Y_UNIT_TEST_SUITE(TCacheTest) { } Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { - typedef TThreadSafeCache<ui32, TString, ui32> TCache; + typedef TThreadSafeCache<ui32, TString, ui32> TCache; const char* VALS[] = {"abcd", "defg", "hjkl"}; @@ -369,7 +369,7 @@ Y_UNIT_TEST_SUITE(TThreadSafeCacheTest) { } TValue* CreateObject(ui32 i) const override { Creations++; - return new TString(VALS[i]); + return new TString(VALS[i]); } mutable i32 Creations = 0; diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp index f3277b8e4b2..c5b735cffbd 100644 --- a/library/cpp/cgiparam/cgiparam.cpp +++ b/library/cpp/cgiparam/cgiparam.cpp @@ -5,7 +5,7 @@ #include <util/generic/singleton.h> -TCgiParameters::TCgiParameters(std::initializer_list<std::pair<TString, TString>> il) { +TCgiParameters::TCgiParameters(std::initializer_list<std::pair<TString, TString>> il) { for (const auto& item : il) { insert(item); } @@ -14,7 +14,7 @@ TCgiParameters::TCgiParameters(std::initializer_list<std::pair<TString, TString> const TString& TCgiParameters::Get(const TStringBuf name, size_t numOfValue) const noexcept { const auto it = Find(name, numOfValue); - return end() == it ? Default<TString>() : it->second; + return end() == it ? Default<TString>() : it->second; } bool TCgiParameters::Erase(const TStringBuf name, size_t pos) { @@ -63,10 +63,10 @@ void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf va if (it == pair.second) { // not found if (val.IsInited()) { - emplace_hint(it, TString(key), TString(val)); + emplace_hint(it, TString(key), TString(val)); } } else { - TString& dst = it->second; + TString& dst = it->second; for (++it; it != pair.second; erase(it++)) { dst += sep; @@ -80,8 +80,8 @@ void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf va } } -static inline TString DoUnescape(const TStringBuf s) { - TString res; +static inline TString DoUnescape(const TStringBuf s) { + TString res; res.reserve(CgiUnescapeBufLen(s.size())); res.ReserveAndResize(CgiUnescape(res.begin(), s).size()); @@ -139,8 +139,8 @@ void TCgiParameters::ScanAddAll(const TStringBuf query) { DoScan<true>(query, f); } -TString TCgiParameters::Print() const { - TString res; +TString TCgiParameters::Print() const { + TString res; res.reserve(PrintSize()); const char* end = Print(res.begin()); @@ -169,7 +169,7 @@ char* TCgiParameters::Print(char* res) const { return res; } -size_t TCgiParameters::PrintSize() const noexcept { +size_t TCgiParameters::PrintSize() const noexcept { size_t res = size(); // for '&' for (const auto& i : *this) { diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h index 87d1ab0ad45..572393082cb 100644 --- a/library/cpp/cgiparam/cgiparam.h +++ b/library/cpp/cgiparam/cgiparam.h @@ -5,18 +5,18 @@ #include <util/generic/iterator_range.h> #include <util/generic/map.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <initializer_list> struct TStringLess { template <class T1, class T2> - inline bool operator()(const T1& t1, const T2& t2) const noexcept { + inline bool operator()(const T1& t1, const T2& t2) const noexcept { return TStringBuf(t1) < TStringBuf(t2); } }; -class TCgiParameters: public TMultiMap<TString, TString> { +class TCgiParameters: public TMultiMap<TString, TString> { public: TCgiParameters() = default; @@ -24,7 +24,7 @@ public: Scan(cgiParamStr); } - TCgiParameters(std::initializer_list<std::pair<TString, TString>> il); + TCgiParameters(std::initializer_list<std::pair<TString, TString>> il); void Flush() { erase(begin(), end()); @@ -36,7 +36,7 @@ public: return count(name); } - TString operator()() const { + TString operator()() const { return Print(); } @@ -51,11 +51,11 @@ public: * @note The returned string has format <name1>=<value1>&<name2>=<value2>&... * @note Names and values in the returned string are CGI-escaped. */ - TString Print() const; + TString Print() const; char* Print(char* res) const; Y_PURE_FUNCTION - size_t PrintSize() const noexcept; + size_t PrintSize() const noexcept; /** The same as Print* except that RFC-3986 reserved characters are escaped. * @param safe - set of characters to be skipped in escaping diff --git a/library/cpp/cgiparam/cgiparam_ut.cpp b/library/cpp/cgiparam/cgiparam_ut.cpp index a5623420840..1c7f783a17c 100644 --- a/library/cpp/cgiparam/cgiparam_ut.cpp +++ b/library/cpp/cgiparam/cgiparam_ut.cpp @@ -39,7 +39,7 @@ Y_UNIT_TEST_SUITE(TCgiParametersTest) { } Y_UNIT_TEST(TestScan2) { - const TString parsee("=000&aaa=bbb&ag0=&ccc=ddd"); + const TString parsee("=000&aaa=bbb&ag0=&ccc=ddd"); TCgiParameters c; c.Scan(parsee); @@ -47,7 +47,7 @@ Y_UNIT_TEST_SUITE(TCgiParametersTest) { } Y_UNIT_TEST(TestScan3) { - const TString parsee("aaa=bbb&ag0=&ccc=ddd"); + const TString parsee("aaa=bbb&ag0=&ccc=ddd"); TCgiParameters c; c.Scan(parsee); diff --git a/library/cpp/cgiparam/fuzz/ya.make b/library/cpp/cgiparam/fuzz/ya.make index 8fb9d50d3bb..4c549c7c1e4 100644 --- a/library/cpp/cgiparam/fuzz/ya.make +++ b/library/cpp/cgiparam/fuzz/ya.make @@ -9,8 +9,8 @@ SRCS( main.cpp ) -PEERDIR( +PEERDIR( library/cpp/cgiparam -) - +) + END() diff --git a/library/cpp/cgiparam/ut/ya.make b/library/cpp/cgiparam/ut/ya.make index 1eee4039515..894d4da1a9e 100644 --- a/library/cpp/cgiparam/ut/ya.make +++ b/library/cpp/cgiparam/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/cgiparam) - -OWNER(g:util) - -SRCS( - cgiparam_ut.cpp -) - -END() + +OWNER(g:util) + +SRCS( + cgiparam_ut.cpp +) + +END() diff --git a/library/cpp/cgiparam/ya.make b/library/cpp/cgiparam/ya.make index fa1a6a13c01..d3fd5b5b503 100644 --- a/library/cpp/cgiparam/ya.make +++ b/library/cpp/cgiparam/ya.make @@ -1,16 +1,16 @@ -LIBRARY() - -OWNER(g:util) - -SRCS( - cgiparam.cpp - cgiparam.h -) - -PEERDIR( +LIBRARY() + +OWNER(g:util) + +SRCS( + cgiparam.cpp + cgiparam.h +) + +PEERDIR( library/cpp/iterator library/cpp/string_utils/quote library/cpp/string_utils/scan -) - -END() +) + +END() diff --git a/library/cpp/charset/ci_string.cpp b/library/cpp/charset/ci_string.cpp index 6097e40131f..9efa3e21cd0 100644 --- a/library/cpp/charset/ci_string.cpp +++ b/library/cpp/charset/ci_string.cpp @@ -1,41 +1,41 @@ -#include "ci_string.h" - -int TCiString::compare(const TCiString& s1, const TCiString& s2, const CodePage& cp) { +#include "ci_string.h" + +int TCiString::compare(const TCiString& s1, const TCiString& s2, const CodePage& cp) { return cp.stricmp(s1.data(), s2.data()); -} - -int TCiString::compare(const char* p, const TCiString& s2, const CodePage& cp) { +} + +int TCiString::compare(const char* p, const TCiString& s2, const CodePage& cp) { return cp.stricmp(p, s2.data()); -} - -int TCiString::compare(const TCiString& s1, const char* p, const CodePage& cp) { +} + +int TCiString::compare(const TCiString& s1, const char* p, const CodePage& cp) { return cp.stricmp(s1.data(), p); -} - +} + int TCiString::compare(const TStringBuf& p1, const TStringBuf& p2, const CodePage& cp) { int rv = cp.strnicmp(p1.data(), p2.data(), Min(p1.size(), p2.size())); return rv ? rv : p1.size() < p2.size() ? -1 : p1.size() == p2.size() ? 0 : 1; -} - +} + bool TCiString::is_prefix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp) { size_t len = what.size(); return len <= of.size() && cp.strnicmp(what.data(), of.data(), len) == 0; -} - +} + bool TCiString::is_suffix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp) { size_t len = what.size(); size_t slen = of.size(); return (len <= slen) && (0 == cp.strnicmp(what.data(), of.data() + slen - len, len)); -} - -size_t TCiString::hashVal(const char* s, size_t len, const CodePage& cp) { - size_t h = len; - for (; /* (*s) && */ len--; ++s) - h = 5 * h + cp.ToLower(*s); - return h; -} - -template <> +} + +size_t TCiString::hashVal(const char* s, size_t len, const CodePage& cp) { + size_t h = len; + for (; /* (*s) && */ len--; ++s) + h = 5 * h + cp.ToLower(*s); + return h; +} + +template <> void Out<TCiString>(IOutputStream& o, const TCiString& p) { o.Write(p.data(), p.size()); -} +} diff --git a/library/cpp/charset/ci_string.h b/library/cpp/charset/ci_string.h index edf24c1b6fe..aaa1e5627c7 100644 --- a/library/cpp/charset/ci_string.h +++ b/library/cpp/charset/ci_string.h @@ -1,280 +1,280 @@ -#pragma once - -#include "codepage.h" - -#include <util/generic/string.h> -#include <util/str_stl.h> - -// Same as TString but uses CASE INSENSITIVE comparator and hash. Use with care. -class TCiString: public TString { -public: - TCiString() { - } - - TCiString(const TString& s) - : TString(s) - { - } - - TCiString(const TString& s, size_t pos, size_t n) - : TString(s, pos, n) - { - } - - TCiString(const char* pc) - : TString(pc) - { - } - - TCiString(const char* pc, size_t n) - : TString(pc, n) - { - } - - TCiString(const char* pc, size_t pos, size_t n) - : TString(pc, pos, n) - { - } - - TCiString(size_t n, char c) - : TString(n, c) - { - } - - TCiString(const TUninitialized& uninitialized) - : TString(uninitialized) - { - } - - TCiString(const char* b, const char* e) - : TString(b, e) - { - } - +#pragma once + +#include "codepage.h" + +#include <util/generic/string.h> +#include <util/str_stl.h> + +// Same as TString but uses CASE INSENSITIVE comparator and hash. Use with care. +class TCiString: public TString { +public: + TCiString() { + } + + TCiString(const TString& s) + : TString(s) + { + } + + TCiString(const TString& s, size_t pos, size_t n) + : TString(s, pos, n) + { + } + + TCiString(const char* pc) + : TString(pc) + { + } + + TCiString(const char* pc, size_t n) + : TString(pc, n) + { + } + + TCiString(const char* pc, size_t pos, size_t n) + : TString(pc, pos, n) + { + } + + TCiString(size_t n, char c) + : TString(n, c) + { + } + + TCiString(const TUninitialized& uninitialized) + : TString(uninitialized) + { + } + + TCiString(const char* b, const char* e) + : TString(b, e) + { + } + explicit TCiString(const TStringBuf& s) - : TString(s) - { - } - - // ~~~ Comparison ~~~ : FAMILY0(int, compare) - static int compare(const TCiString& s1, const TCiString& s2, const CodePage& cp = csYandex); - static int compare(const char* p, const TCiString& s2, const CodePage& cp = csYandex); - static int compare(const TCiString& s1, const char* p, const CodePage& cp = csYandex); + : TString(s) + { + } + + // ~~~ Comparison ~~~ : FAMILY0(int, compare) + static int compare(const TCiString& s1, const TCiString& s2, const CodePage& cp = csYandex); + static int compare(const char* p, const TCiString& s2, const CodePage& cp = csYandex); + static int compare(const TCiString& s1, const char* p, const CodePage& cp = csYandex); static int compare(const TStringBuf& p1, const TStringBuf& p2, const CodePage& cp = csYandex); - + // TODO: implement properly in TString via enum ECaseSensitivity static bool is_prefix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp = csYandex); static bool is_suffix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp = csYandex); - + bool StartsWith(const TStringBuf& s, const CodePage& cp = csYandex) const { - return is_prefix(s, *this, cp); - } - + return is_prefix(s, *this, cp); + } + bool EndsWith(const TStringBuf& s, const CodePage& cp = csYandex) const { - return is_suffix(s, *this, cp); - } - - friend bool operator==(const TCiString& s1, const TCiString& s2) { - return TCiString::compare(s1, s2) == 0; - } - - friend bool operator==(const TCiString& s, const char* pc) { - return TCiString::compare(s, pc) == 0; - } - - friend bool operator==(const char* pc, const TCiString& s) { - return TCiString::compare(pc, s) == 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator==(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { - return TCiString::compare(s, pc) == 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator==(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { - return TCiString::compare(pc, s) == 0; - } - - friend bool operator!=(const TCiString& s1, const TCiString& s2) { - return TCiString::compare(s1, s2) != 0; - } - - friend bool operator!=(const TCiString& s, const char* pc) { - return TCiString::compare(s, pc) != 0; - } - - friend bool operator!=(const char* pc, const TCiString& s) { - return TCiString::compare(pc, s) != 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator!=(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { - return TCiString::compare(s, pc) != 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator!=(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { - return TCiString::compare(pc, s) != 0; - } - - friend bool operator<(const TCiString& s1, const TCiString& s2) { - return TCiString::compare(s1, s2) < 0; - } - - friend bool operator<(const TCiString& s, const char* pc) { - return TCiString::compare(s, pc) < 0; - } - - friend bool operator<(const char* pc, const TCiString& s) { - return TCiString::compare(pc, s) < 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator<(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { - return TCiString::compare(s, pc) < 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator<(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { - return TCiString::compare(pc, s) < 0; - } - - friend bool operator<=(const TCiString& s1, const TCiString& s2) { - return TCiString::compare(s1, s2) <= 0; - } - - friend bool operator<=(const TCiString& s, const char* pc) { - return TCiString::compare(s, pc) <= 0; - } - - friend bool operator<=(const char* pc, const TCiString& s) { - return TCiString::compare(pc, s) <= 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator<=(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { - return TCiString::compare(s, pc) <= 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator<=(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { - return TCiString::compare(pc, s) <= 0; - } - - friend bool operator>(const TCiString& s1, const TCiString& s2) { - return TCiString::compare(s1, s2) > 0; - } - - friend bool operator>(const TCiString& s, const char* pc) { - return TCiString::compare(s, pc) > 0; - } - - friend bool operator>(const char* pc, const TCiString& s) { - return TCiString::compare(pc, s) > 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator>(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) noexcept { - return TCiString::compare(s, pc) > 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator>(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) noexcept { - return TCiString::compare(pc, s) > 0; - } - - friend bool operator>=(const TCiString& s1, const TCiString& s2) { - return TCiString::compare(s1, s2) >= 0; - } - - friend bool operator>=(const TCiString& s, const char* pc) { - return TCiString::compare(s, pc) >= 0; - } - - friend bool operator>=(const char* pc, const TCiString& s) { - return TCiString::compare(pc, s) >= 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator>=(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { - return TCiString::compare(s, pc) >= 0; - } - - template <typename TDerived2, typename TTraits2> - friend bool operator>=(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { - return TCiString::compare(pc, s) >= 0; - } - - static size_t hashVal(const char* pc, size_t len, const CodePage& cp = csYandex); - - size_t hash() const { + return is_suffix(s, *this, cp); + } + + friend bool operator==(const TCiString& s1, const TCiString& s2) { + return TCiString::compare(s1, s2) == 0; + } + + friend bool operator==(const TCiString& s, const char* pc) { + return TCiString::compare(s, pc) == 0; + } + + friend bool operator==(const char* pc, const TCiString& s) { + return TCiString::compare(pc, s) == 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator==(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { + return TCiString::compare(s, pc) == 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator==(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { + return TCiString::compare(pc, s) == 0; + } + + friend bool operator!=(const TCiString& s1, const TCiString& s2) { + return TCiString::compare(s1, s2) != 0; + } + + friend bool operator!=(const TCiString& s, const char* pc) { + return TCiString::compare(s, pc) != 0; + } + + friend bool operator!=(const char* pc, const TCiString& s) { + return TCiString::compare(pc, s) != 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator!=(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { + return TCiString::compare(s, pc) != 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator!=(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { + return TCiString::compare(pc, s) != 0; + } + + friend bool operator<(const TCiString& s1, const TCiString& s2) { + return TCiString::compare(s1, s2) < 0; + } + + friend bool operator<(const TCiString& s, const char* pc) { + return TCiString::compare(s, pc) < 0; + } + + friend bool operator<(const char* pc, const TCiString& s) { + return TCiString::compare(pc, s) < 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator<(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { + return TCiString::compare(s, pc) < 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator<(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { + return TCiString::compare(pc, s) < 0; + } + + friend bool operator<=(const TCiString& s1, const TCiString& s2) { + return TCiString::compare(s1, s2) <= 0; + } + + friend bool operator<=(const TCiString& s, const char* pc) { + return TCiString::compare(s, pc) <= 0; + } + + friend bool operator<=(const char* pc, const TCiString& s) { + return TCiString::compare(pc, s) <= 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator<=(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { + return TCiString::compare(s, pc) <= 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator<=(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { + return TCiString::compare(pc, s) <= 0; + } + + friend bool operator>(const TCiString& s1, const TCiString& s2) { + return TCiString::compare(s1, s2) > 0; + } + + friend bool operator>(const TCiString& s, const char* pc) { + return TCiString::compare(s, pc) > 0; + } + + friend bool operator>(const char* pc, const TCiString& s) { + return TCiString::compare(pc, s) > 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator>(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) noexcept { + return TCiString::compare(s, pc) > 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator>(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) noexcept { + return TCiString::compare(pc, s) > 0; + } + + friend bool operator>=(const TCiString& s1, const TCiString& s2) { + return TCiString::compare(s1, s2) >= 0; + } + + friend bool operator>=(const TCiString& s, const char* pc) { + return TCiString::compare(s, pc) >= 0; + } + + friend bool operator>=(const char* pc, const TCiString& s) { + return TCiString::compare(pc, s) >= 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator>=(const TCiString& s, const TStringBase<TDerived2, TChar, TTraits2>& pc) { + return TCiString::compare(s, pc) >= 0; + } + + template <typename TDerived2, typename TTraits2> + friend bool operator>=(const TStringBase<TDerived2, TChar, TTraits2>& pc, const TCiString& s) { + return TCiString::compare(pc, s) >= 0; + } + + static size_t hashVal(const char* pc, size_t len, const CodePage& cp = csYandex); + + size_t hash() const { return TCiString::hashVal(data(), length()); - } -}; - -struct ci_hash { - inline size_t operator()(const char* s) const { - return TCiString::hashVal(s, strlen(s)); - } + } +}; + +struct ci_hash { + inline size_t operator()(const char* s) const { + return TCiString::hashVal(s, strlen(s)); + } inline size_t operator()(const TStringBuf& s) const { return TCiString::hashVal(s.data(), s.size()); - } -}; - -struct ci_hash32 { // not the same as ci_hash under 64-bit - inline ui32 operator()(const char* s) const { - return (ui32)TCiString::hashVal(s, strlen(s)); - } -}; - -//template <class T> struct hash; - -template <> -struct hash<TCiString>: public ci_hash { -}; - -template <class T> -struct TCIHash { -}; - -template <> -struct TCIHash<const char*> { + } +}; + +struct ci_hash32 { // not the same as ci_hash under 64-bit + inline ui32 operator()(const char* s) const { + return (ui32)TCiString::hashVal(s, strlen(s)); + } +}; + +//template <class T> struct hash; + +template <> +struct hash<TCiString>: public ci_hash { +}; + +template <class T> +struct TCIHash { +}; + +template <> +struct TCIHash<const char*> { inline size_t operator()(const TStringBuf& s) const { return TCiString::hashVal(s.data(), s.size()); - } -}; - -template <> -struct TCIHash<TStringBuf> { - inline size_t operator()(const TStringBuf& s) const { + } +}; + +template <> +struct TCIHash<TStringBuf> { + inline size_t operator()(const TStringBuf& s) const { return TCiString::hashVal(s.data(), s.size()); - } -}; - -template <> -struct TCIHash<TString> { - inline size_t operator()(const TString& s) const { + } +}; + +template <> +struct TCIHash<TString> { + inline size_t operator()(const TString& s) const { return TCiString::hashVal(s.data(), s.size()); - } -}; - -struct ci_less { - inline bool operator()(const char* x, const char* y) const { - return csYandex.stricmp(x, y) < 0; - } -}; - -struct ci_equal_to { - inline bool operator()(const char* x, const char* y) const { - return csYandex.stricmp(x, y) == 0; - } - // this implementation is not suitable for strings with zero characters inside, sorry + } +}; + +struct ci_less { + inline bool operator()(const char* x, const char* y) const { + return csYandex.stricmp(x, y) < 0; + } +}; + +struct ci_equal_to { + inline bool operator()(const char* x, const char* y) const { + return csYandex.stricmp(x, y) == 0; + } + // this implementation is not suitable for strings with zero characters inside, sorry bool operator()(const TStringBuf& x, const TStringBuf& y) const { return x.size() == y.size() && csYandex.strnicmp(x.data(), y.data(), y.size()) == 0; - } -}; - -template <> -struct TEqualTo<TCiString>: public ci_equal_to { -}; + } +}; + +template <> +struct TEqualTo<TCiString>: public ci_equal_to { +}; diff --git a/library/cpp/charset/ci_string_ut.cpp b/library/cpp/charset/ci_string_ut.cpp index 3d2a53d5fe4..693427184d8 100644 --- a/library/cpp/charset/ci_string_ut.cpp +++ b/library/cpp/charset/ci_string_ut.cpp @@ -1,23 +1,23 @@ -#include "ci_string.h" - +#include "ci_string.h" + #include <util/generic/hash.h> -#include <util/generic/string_ut.h> - -class TCaseStringTest: public TTestBase, private TStringTestImpl<TCiString, TTestData<char>> { -public: - void TestSpecial() { - TCiString ss = Data._0123456(); // type 'TCiString' is used as is +#include <util/generic/string_ut.h> + +class TCaseStringTest: public TTestBase, private TStringTestImpl<TCiString, TTestData<char>> { +public: + void TestSpecial() { + TCiString ss = Data._0123456(); // type 'TCiString' is used as is size_t hash_val = ComputeHash(ss); - UNIT_ASSERT(hash_val == 1489244); - } - -public: - UNIT_TEST_SUITE(TCaseStringTest); - UNIT_TEST(TestOperators); - UNIT_TEST(TestOperatorsCI); - - UNIT_TEST(TestSpecial); - UNIT_TEST_SUITE_END(); -}; - -UNIT_TEST_SUITE_REGISTRATION(TCaseStringTest); + UNIT_ASSERT(hash_val == 1489244); + } + +public: + UNIT_TEST_SUITE(TCaseStringTest); + UNIT_TEST(TestOperators); + UNIT_TEST(TestOperatorsCI); + + UNIT_TEST(TestSpecial); + UNIT_TEST_SUITE_END(); +}; + +UNIT_TEST_SUITE_REGISTRATION(TCaseStringTest); diff --git a/library/cpp/charset/codepage.cpp b/library/cpp/charset/codepage.cpp index 0431bef31bc..43c06509700 100644 --- a/library/cpp/charset/codepage.cpp +++ b/library/cpp/charset/codepage.cpp @@ -1,4 +1,4 @@ -#include "ci_string.h" +#include "ci_string.h" #include "wide.h" #include "recyr.hh" #include "codepage.h" @@ -9,7 +9,7 @@ #include <util/system/hi_lo.h> #include <util/system/yassert.h> #include <util/generic/hash.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/hash_set.h> #include <util/generic/singleton.h> @@ -128,13 +128,13 @@ const NCodepagePrivate::TCodepagesMap& NCodepagePrivate::TCodepagesMap::Instance class TCodePageHash { private: - using TData = THashMap<TStringBuf, ECharset, ci_hash, ci_equal_to>; + using TData = THashMap<TStringBuf, ECharset, ci_hash, ci_equal_to>; TData Data; TMemoryPool Pool; private: - inline void AddNameWithCheck(const TString& name, ECharset code) { + inline void AddNameWithCheck(const TString& name, ECharset code) { if (Data.find(name.c_str()) == Data.end()) { Data.insert(TData::value_type(Pool.Append(name.data(), name.size() + 1), code)); } else { @@ -142,10 +142,10 @@ private: } } - inline void AddName(const TString& name, ECharset code) { + inline void AddName(const TString& name, ECharset code) { AddNameWithCheck(name, code); - TString temp = name; + TString temp = name; RemoveAll(temp, '-'); RemoveAll(temp, '_'); AddNameWithCheck(temp, code); @@ -163,7 +163,7 @@ public: inline TCodePageHash() : Pool(20 * 1024) /* Currently used: 17KB. */ { - TString xPrefix = "x-"; + TString xPrefix = "x-"; const char* name; for (size_t i = 0; i != CODES_MAX; ++i) { @@ -285,7 +285,7 @@ void DoDecodeUnknownPlane(TxChar* str, TxChar*& ee, const ECharset enc) { TxChar* s = str; TxChar* d = str; - TVector<char> buf; + TVector<char> buf; size_t read = 0; size_t written = 0; @@ -319,19 +319,19 @@ void DecodeUnknownPlane(wchar32* str, wchar32*& ee, const ECharset enc) { } namespace { - class THashSetType: public THashSet<TString> { + class THashSetType: public THashSet<TString> { public: - inline void Add(const TString& s) { + inline void Add(const TString& s) { insert(s); } - inline bool Has(const TString& s) const noexcept { + inline bool Has(const TString& s) const noexcept { return find(s) != end(); } }; } -class TWindowsPrefixesHashSet: public THashSetType { +class TWindowsPrefixesHashSet: public THashSetType { public: inline TWindowsPrefixesHashSet() { Add("win"); @@ -345,7 +345,7 @@ public: } }; -class TCpPrefixesHashSet: public THashSetType { +class TCpPrefixesHashSet: public THashSetType { public: inline TCpPrefixesHashSet() { Add("microsoft"); @@ -354,7 +354,7 @@ public: } }; -class TIsoPrefixesHashSet: public THashSetType { +class TIsoPrefixesHashSet: public THashSetType { public: inline TIsoPrefixesHashSet() { Add("iso"); @@ -363,7 +363,7 @@ public: } }; -class TLatinToIsoHash: public THashMap<const char*, TString, ci_hash, ci_equal_to> { +class TLatinToIsoHash: public THashMap<const char*, TString, ci_hash, ci_equal_to> { public: inline TLatinToIsoHash() { insert(value_type("latin1", "iso-8859-1")); @@ -379,12 +379,12 @@ public: } }; -static inline void NormalizeEncodingPrefixes(TString& enc) { +static inline void NormalizeEncodingPrefixes(TString& enc) { size_t preflen = enc.find_first_of("0123456789"); - if (preflen == TString::npos) + if (preflen == TString::npos) return; - TString prefix = enc.substr(0, preflen); + TString prefix = enc.substr(0, preflen); for (size_t i = 0; i < prefix.length(); ++i) { if (prefix[i] == '-') { prefix.remove(i--); @@ -410,7 +410,7 @@ static inline void NormalizeEncodingPrefixes(TString& enc) { if (Singleton<TIsoPrefixesHashSet>()->Has(prefix)) { if (enc.length() == preflen + 1 || enc.length() == preflen + 2) { - TString enccopy = enc.substr(preflen); + TString enccopy = enc.substr(preflen); enccopy.prepend("latin"); const TLatinToIsoHash* latinhash = Singleton<TLatinToIsoHash>(); TLatinToIsoHash::const_iterator it = latinhash->find(enccopy.data()); @@ -425,7 +425,7 @@ static inline void NormalizeEncodingPrefixes(TString& enc) { } } -class TEncodingNamesHashSet: public THashSetType { +class TEncodingNamesHashSet: public THashSetType { public: TEncodingNamesHashSet() { Add("iso-8859-1"); @@ -492,7 +492,7 @@ ECharset EncodingHintByName(const char* encname) { --lastpos; // Do some normalization - TString enc(encname, lastpos - encname + 1); + TString enc(encname, lastpos - encname + 1); enc.to_lower(); for (char* p = enc.begin(); p != enc.end(); ++p) { if (*p == ' ' || *p == '=' || *p == '_') diff --git a/library/cpp/charset/codepage.h b/library/cpp/charset/codepage.h index 30a02a46106..8af579bdb56 100644 --- a/library/cpp/charset/codepage.h +++ b/library/cpp/charset/codepage.h @@ -5,7 +5,7 @@ #include <util/charset/recode_result.h> #include <util/charset/unidata.h> // all wchar32 functions #include <util/charset/utf8.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ylimits.h> #include <util/generic/yexception.h> #include <util/system/yassert.h> @@ -303,17 +303,17 @@ inline void ToUpper(char* s, size_t n, const CodePage& cp = csYandex) { *s = cp.ToUpper(*s); } -inline TString ToLower(TString s, const CodePage& cp, size_t pos = 0, size_t n = TString::npos) { +inline TString ToLower(TString s, const CodePage& cp, size_t pos = 0, size_t n = TString::npos) { s.Transform([&cp](size_t, char c) { return cp.ToLower(c); }, pos, n); return s; } -inline TString ToUpper(TString s, const CodePage& cp, size_t pos = 0, size_t n = TString::npos) { +inline TString ToUpper(TString s, const CodePage& cp, size_t pos = 0, size_t n = TString::npos) { s.Transform([&cp](size_t, char c) { return cp.ToUpper(c); }, pos, n); return s; } -inline TString ToTitle(TString s, const CodePage& cp, size_t pos = 0, size_t n = TString::npos) { +inline TString ToTitle(TString s, const CodePage& cp, size_t pos = 0, size_t n = TString::npos) { s.Transform( [pos, &cp](size_t i, char c) { return i == pos ? cp.ToTitle(c) : cp.ToLower(c); diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp index c3ac3ac478e..90155353243 100644 --- a/library/cpp/charset/codepage_ut.cpp +++ b/library/cpp/charset/codepage_ut.cpp @@ -253,7 +253,7 @@ void TCodepageTest::TestUTFFromUnknownPlane() { // test TChar version // bytebuffer of len writtenbytes contains sampletext of len samplelen chars in utf8 - TUtf16String wtr = CharToWide(TStringBuf(bytebuffer, writtenbytes), CODES_UNKNOWNPLANE); + TUtf16String wtr = CharToWide(TStringBuf(bytebuffer, writtenbytes), CODES_UNKNOWNPLANE); TChar* strend = wtr.begin() + wtr.size(); DecodeUnknownPlane(wtr.begin(), strend, CODES_UTF8); wtr.resize(strend - wtr.data(), 'Q'); diff --git a/library/cpp/charset/iconv_ut.cpp b/library/cpp/charset/iconv_ut.cpp index e8c56f6d491..eb6a0f64e03 100644 --- a/library/cpp/charset/iconv_ut.cpp +++ b/library/cpp/charset/iconv_ut.cpp @@ -4,13 +4,13 @@ #include <library/cpp/testing/unittest/registar.h> -static void TestIconv(const TString& utf8, const TString& other, ECharset enc) { - TUtf16String wide0 = CharToWide(utf8, CODES_UTF8); - TUtf16String wide1 = CharToWide(other, enc); +static void TestIconv(const TString& utf8, const TString& other, ECharset enc) { + TUtf16String wide0 = CharToWide(utf8, CODES_UTF8); + TUtf16String wide1 = CharToWide(other, enc); UNIT_ASSERT(wide0 == wide1); - TString temp = WideToUTF8(wide0); + TString temp = WideToUTF8(wide0); UNIT_ASSERT(temp == utf8); temp = WideToChar(wide0, enc); diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh index 5ec8734bcfb..e0af996ae99 100644 --- a/library/cpp/charset/recyr.hh +++ b/library/cpp/charset/recyr.hh @@ -110,7 +110,7 @@ inline RECODE_RESULT Recode(ECharset from, ECharset to, const char* in, char* ou * @return false if conversion was not attempted (charsets were the same), * true if successful */ -inline bool Recode(ECharset from, ECharset to, const TStringBuf& in, TString& out) { +inline bool Recode(ECharset from, ECharset to, const TStringBuf& in, TString& out) { if (to == from) return false; @@ -132,23 +132,23 @@ inline bool Recode(ECharset from, ECharset to, const TStringBuf& in, TString& ou } /////////////////////////////////////////////////////////////////////////////////////// -// TString -> TString // +// TString -> TString // /////////////////////////////////////////////////////////////////////////////////////// -inline TString Recode(ECharset from, ECharset to, const TString& in) { - TString out; +inline TString Recode(ECharset from, ECharset to, const TString& in) { + TString out; return to != from && Recode(from, to, in, out) ? out : in; } -inline TString RecodeToYandex(ECharset from, const TString& in) { +inline TString RecodeToYandex(ECharset from, const TString& in) { return Recode(from, CODES_YANDEX, in); } -inline TString RecodeFromYandex(ECharset to, const TString& in) { +inline TString RecodeFromYandex(ECharset to, const TString& in) { return Recode(CODES_YANDEX, to, in); } -inline TString RecodeToHTMLEntities(ECharset from, const TString& in) { +inline TString RecodeToHTMLEntities(ECharset from, const TString& in) { RECODE_RESULT res; size_t outWritten, inRead; - TString out; + TString out; out.resize(in.length() * (4 + 4)); res = NCodepagePrivate::_recodeToHTMLEntities(from, in.c_str(), out.begin(), in.length(), out.length(), inRead, outWritten); if (res == RECODE_EOOUTPUT) { //input contains many 8-byte characters? diff --git a/library/cpp/charset/recyr_int.hh b/library/cpp/charset/recyr_int.hh index 353af53305e..61239206bc0 100644 --- a/library/cpp/charset/recyr_int.hh +++ b/library/cpp/charset/recyr_int.hh @@ -3,7 +3,7 @@ #include <util/charset/recode_result.h> #include <util/charset/utf8.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/defaults.h> #include "codepage.h" diff --git a/library/cpp/charset/wide.h b/library/cpp/charset/wide.h index 32d30e849e9..46f7b16d761 100644 --- a/library/cpp/charset/wide.h +++ b/library/cpp/charset/wide.h @@ -7,7 +7,7 @@ #include <util/charset/unidata.h> #include <util/charset/utf8.h> #include <util/charset/wide.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/algorithm.h> #include <util/generic/yexception.h> #include <util/memory/tempbuf.h> @@ -123,7 +123,7 @@ namespace NDetail { struct TRecodeTraits<char> { using TCharTo = wchar16; using TStringBufTo = TWtringBuf; - using TStringTo = TUtf16String; + using TStringTo = TUtf16String; enum { ReserveSize = 4 }; // How many TCharFrom characters we should reserve for one TCharTo character in worst case // Here an unicode character can be converted up to 4 bytes of UTF8 }; @@ -132,14 +132,14 @@ namespace NDetail { struct TRecodeTraits<wchar16> { using TCharTo = char; using TStringBufTo = TStringBuf; - using TStringTo = TString; + using TStringTo = TString; enum { ReserveSize = 2 }; // possible surrogate pairs ? }; // Operations with destination buffer where recoded string will be written template <typename TResult> struct TRecodeResultOps { - // default implementation will work with TString and TUtf16String - 99% of usage + // default implementation will work with TString and TUtf16String - 99% of usage using TResultChar = typename TResult::char_type; static inline size_t Size(const TResult& dst) { @@ -223,18 +223,18 @@ inline TStringBuf WideToChar(const TWtringBuf src, TString& dst, ECharset encodi } //! calls either to @c WideToUTF8 or @c WideToChar depending on the encoding type -inline TString WideToChar(const wchar16* text, size_t len, ECharset enc) { +inline TString WideToChar(const wchar16* text, size_t len, ECharset enc) { if (NCodepagePrivate::NativeCodepage(enc)) { if (enc == CODES_UTF8) return WideToUTF8(text, len); - TString s = TString::Uninitialized(len); + TString s = TString::Uninitialized(len); s.remove(WideToChar(text, len, s.begin(), enc)); return s; } - TString s = TString::Uninitialized(len * 3); + TString s = TString::Uninitialized(len * 3); size_t read = 0; size_t written = 0; @@ -244,15 +244,15 @@ inline TString WideToChar(const wchar16* text, size_t len, ECharset enc) { return s; } -inline TUtf16String CharToWide(const char* text, size_t len, const CodePage& cp) { - TUtf16String w = TUtf16String::Uninitialized(len); +inline TUtf16String CharToWide(const char* text, size_t len, const CodePage& cp) { + TUtf16String w = TUtf16String::Uninitialized(len); CharToWide(text, len, w.begin(), cp); return w; } //! calls either to @c UTF8ToWide or @c CharToWide depending on the encoding type template <bool robust> -inline TUtf16String CharToWide(const char* text, size_t len, ECharset enc) { +inline TUtf16String CharToWide(const char* text, size_t len, ECharset enc) { if (NCodepagePrivate::NativeCodepage(enc)) { if (enc == CODES_UTF8) return UTF8ToWide<robust>(text, len); @@ -260,7 +260,7 @@ inline TUtf16String CharToWide(const char* text, size_t len, ECharset enc) { return CharToWide(text, len, *CodePageByCharset(enc)); } - TUtf16String w = TUtf16String::Uninitialized(len * 2); + TUtf16String w = TUtf16String::Uninitialized(len * 2); size_t read = 0; size_t written = 0; @@ -274,8 +274,8 @@ inline TUtf16String CharToWide(const char* text, size_t len, ECharset enc) { //! @param text text to be converted //! @param len length of the text in characters //! @param cp a codepage that is used in case of failed conversion from UTF8 -inline TUtf16String UTF8ToWide(const char* text, size_t len, const CodePage& cp) { - TUtf16String w = TUtf16String::Uninitialized(len); +inline TUtf16String UTF8ToWide(const char* text, size_t len, const CodePage& cp) { + TUtf16String w = TUtf16String::Uninitialized(len); size_t written = 0; if (UTF8ToWide(text, len, w.begin(), written)) w.remove(written); diff --git a/library/cpp/charset/wide_ut.cpp b/library/cpp/charset/wide_ut.cpp index 78947d51bad..518b885b6cf 100644 --- a/library/cpp/charset/wide_ut.cpp +++ b/library/cpp/charset/wide_ut.cpp @@ -32,16 +32,16 @@ namespace { "\xd1\x80\xd1\x81\xd1\x82\xd1\x83\xd1\x84\xd1\x85\xd1\x86\xd1\x87" "\xd1\x88\xd1\x89\xd1\x8a\xd1\x8b\xd1\x8c\xd1\x8d\xd1\x8e\xd1\x8f"; - TString CreateYandexText() { + TString CreateYandexText() { const int len = 256; char text[len] = {0}; for (int i = 0; i < len; ++i) { text[i] = static_cast<char>(i); } - return TString(text, len); + return TString(text, len); } - TUtf16String CreateUnicodeText() { + TUtf16String CreateUnicodeText() { const int len = 256; wchar16 text[len] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x00 - 0x0F @@ -65,10 +65,10 @@ namespace { text[i] = static_cast<wchar16>(i + 0x0350); // 0x0410 - 0x044F } } - return TUtf16String(text, len); + return TUtf16String(text, len); } - TString CreateUTF8Text() { + TString CreateUTF8Text() { char text[] = { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', @@ -95,12 +95,12 @@ namespace { '\xd0', '\xbf', '\xd1', '\x80', '\xd1', '\x81', '\xd1', '\x82', '\xd1', '\x83', '\xd1', '\x84', '\xd1', '\x85', '\xd1', '\x86', '\xd1', '\x87', '\xd1', '\x88', '\xd1', '\x89', '\xd1', '\x8a', '\xd1', '\x8b', '\xd1', '\x8c', '\xd1', '\x8d', '\xd1', '\x8e', '\xd1', '\x8f'}; - return TString(text, Y_ARRAY_SIZE(text)); + return TString(text, Y_ARRAY_SIZE(text)); } //! use this function to dump UTF8 text into a file in case of any changes // void DumpUTF8Text() { - // TString s = WideToUTF8(UnicodeText); + // TString s = WideToUTF8(UnicodeText); // std::ofstream f("utf8.txt"); // f << std::hex; // for (int i = 0; i < (int)s.size(); ++i) { @@ -117,9 +117,9 @@ namespace { class TConversionTest: public TTestBase { private: //! @note every of the text can have zeros in the middle - const TString YandexText; - const TUtf16String UnicodeText; - const TString UTF8Text; + const TString YandexText; + const TUtf16String UnicodeText; + const TString UTF8Text; private: UNIT_TEST_SUITE(TConversionTest); @@ -171,7 +171,7 @@ UNIT_TEST_SUITE_REGISTRATION(TConversionTest); } while (false) void TConversionTest::TestCharToWide() { - TUtf16String w = CharToWide(YandexText, CODES_YANDEX); + TUtf16String w = CharToWide(YandexText, CODES_YANDEX); UNIT_ASSERT(w.size() == 256); UNIT_ASSERT(w.size() == UnicodeText.size()); @@ -182,7 +182,7 @@ void TConversionTest::TestCharToWide() { } void TConversionTest::TestWideToChar() { - TString s = WideToChar(UnicodeText, CODES_YANDEX); + TString s = WideToChar(UnicodeText, CODES_YANDEX); UNIT_ASSERT(s.size() == 256); UNIT_ASSERT(s.size() == YandexText.size()); @@ -193,18 +193,18 @@ void TConversionTest::TestWideToChar() { } static void TestSurrogates(const char* str, const wchar16* wide, size_t wideSize, ECharset enc) { - TUtf16String w = UTF8ToWide(str); + TUtf16String w = UTF8ToWide(str); UNIT_ASSERT(w.size() == wideSize); UNIT_ASSERT(!memcmp(w.c_str(), wide, wideSize)); - TString s = WideToChar(w, enc); + TString s = WideToChar(w, enc); UNIT_ASSERT(s == str); } void TConversionTest::TestYandexEncoding() { - TUtf16String w = UTF8ToWide(utf8CyrillicAlphabet, strlen(utf8CyrillicAlphabet), csYandex); + TUtf16String w = UTF8ToWide(utf8CyrillicAlphabet, strlen(utf8CyrillicAlphabet), csYandex); UNIT_ASSERT(w == wideCyrillicAlphabet); w = UTF8ToWide(yandexCyrillicAlphabet, strlen(yandexCyrillicAlphabet), csYandex); UNIT_ASSERT(w == wideCyrillicAlphabet); @@ -217,7 +217,7 @@ void TConversionTest::TestYandexEncoding() { const char* yandexNonBMP2 = "ab?n"; UNIT_ASSERT(yandexNonBMP2 == WideToChar(wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2), CODES_YANDEX)); - TString temp; + TString temp; temp.resize(Y_ARRAY_SIZE(wNonBMPDummy2)); size_t read = 0; size_t written = 0; @@ -229,7 +229,7 @@ void TConversionTest::TestYandexEncoding() { } void TConversionTest::TestRecodeIntoString() { - TString sYandex(UnicodeText.size() * 4, 'x'); + TString sYandex(UnicodeText.size() * 4, 'x'); const char* sdata = sYandex.data(); TStringBuf sres = NDetail::Recode<wchar16>(UnicodeText, sYandex, CODES_YANDEX); UNIT_ASSERT(sYandex == YandexText); // same content @@ -238,7 +238,7 @@ void TConversionTest::TestRecodeIntoString() { UNIT_ASSERT(sYandex.size() == sres.size()); // same size TEST_WCHAR32(sYandex, UnicodeText, CODES_YANDEX); - TUtf16String sUnicode; + TUtf16String sUnicode; sUnicode.reserve(YandexText.size() * 4); const wchar16* wdata = sUnicode.data(); TWtringBuf wres = NDetail::Recode<char>(YandexText, sUnicode, CODES_YANDEX); @@ -247,7 +247,7 @@ void TConversionTest::TestRecodeIntoString() { UNIT_ASSERT(sUnicode.data() == wres.data()); // same buffer UNIT_ASSERT(sUnicode.size() == wres.size()); // same size - TString sUtf8 = " "; + TString sUtf8 = " "; size_t scap = sUtf8.capacity(); sres = NDetail::Recode<wchar16>(UnicodeText, sUtf8, CODES_UTF8); UNIT_ASSERT(sUtf8 == UTF8Text); // same content @@ -258,7 +258,7 @@ void TConversionTest::TestRecodeIntoString() { sUnicode.clear(); wdata = sUnicode.data(); - TUtf16String copy = sUnicode; // increase ref-counter + TUtf16String copy = sUnicode; // increase ref-counter wres = NDetail::Recode<char>(UTF8Text, sUnicode, CODES_UTF8); UNIT_ASSERT(sUnicode == UnicodeText); // same content #ifndef TSTRING_IS_STD_STRING @@ -268,8 +268,8 @@ void TConversionTest::TestRecodeIntoString() { UNIT_ASSERT(sUnicode.size() == wres.size()); // same content } -static TString GenerateJunk(size_t seed) { - TString res; +static TString GenerateJunk(size_t seed) { + TString res; size_t hash = NumericHash(seed); size_t size = hash % 1024; res.reserve(size); @@ -280,8 +280,8 @@ static TString GenerateJunk(size_t seed) { void TConversionTest::TestRecodeAppend() { { - TString s1, s2; - NDetail::RecodeAppend<wchar16>(TUtf16String(), s1, CODES_YANDEX); + TString s1, s2; + NDetail::RecodeAppend<wchar16>(TUtf16String(), s1, CODES_YANDEX); UNIT_ASSERT(s1.empty()); NDetail::RecodeAppend<wchar16>(UnicodeText, s1, CODES_WIN); @@ -292,7 +292,7 @@ void TConversionTest::TestRecodeAppend() { s2 += WideToChar(UnicodeText, CODES_YANDEX); UNIT_ASSERT_EQUAL(s1, s2); - NDetail::RecodeAppend<wchar16>(TUtf16String(), s1, CODES_YANDEX); + NDetail::RecodeAppend<wchar16>(TUtf16String(), s1, CODES_YANDEX); UNIT_ASSERT_EQUAL(s1, s2); NDetail::RecodeAppend<wchar16>(UnicodeText, s1, CODES_UTF8); @@ -300,7 +300,7 @@ void TConversionTest::TestRecodeAppend() { UNIT_ASSERT_EQUAL(s1, s2); for (size_t i = 0; i < 100; ++i) { - TUtf16String junk = CharToWide(GenerateJunk(i), CODES_YANDEX); + TUtf16String junk = CharToWide(GenerateJunk(i), CODES_YANDEX); NDetail::RecodeAppend<wchar16>(junk, s1, CODES_UTF8); s2 += WideToUTF8(junk); UNIT_ASSERT_EQUAL(s1, s2); @@ -308,8 +308,8 @@ void TConversionTest::TestRecodeAppend() { } { - TUtf16String s1, s2; - NDetail::RecodeAppend<char>(TString(), s1, CODES_YANDEX); + TUtf16String s1, s2; + NDetail::RecodeAppend<char>(TString(), s1, CODES_YANDEX); UNIT_ASSERT(s1.empty()); NDetail::RecodeAppend<char>(YandexText, s1, CODES_WIN); @@ -320,7 +320,7 @@ void TConversionTest::TestRecodeAppend() { s2 += CharToWide(YandexText, CODES_YANDEX); UNIT_ASSERT_EQUAL(s1, s2); - NDetail::RecodeAppend<char>(TString(), s1, CODES_YANDEX); + NDetail::RecodeAppend<char>(TString(), s1, CODES_YANDEX); UNIT_ASSERT_EQUAL(s1, s2); NDetail::RecodeAppend<char>(UTF8Text, s1, CODES_UTF8); @@ -328,7 +328,7 @@ void TConversionTest::TestRecodeAppend() { UNIT_ASSERT_EQUAL(s1, s2); for (size_t i = 0; i < 100; ++i) { - TString junk = GenerateJunk(i); + TString junk = GenerateJunk(i); NDetail::RecodeAppend<char>(junk, s1, CODES_YANDEX); s2 += CharToWide(junk, CODES_YANDEX); UNIT_ASSERT_EQUAL(s1, s2); @@ -347,7 +347,7 @@ void TConversionTest::TestRecode() { if (!SingleByteCodepage(enc)) continue; - using THash = THashSet<char>; + using THash = THashSet<char>; THash hash; for (int i = 0; i != 256; ++i) { diff --git a/library/cpp/charset/ya.make b/library/cpp/charset/ya.make index 7565566bf03..61af7a32433 100644 --- a/library/cpp/charset/ya.make +++ b/library/cpp/charset/ya.make @@ -11,7 +11,7 @@ SRCS( iconv.cpp recyr.hh recyr_int.hh - ci_string.cpp + ci_string.cpp wide.cpp ) diff --git a/library/cpp/codecs/codecs_registry.cpp b/library/cpp/codecs/codecs_registry.cpp index 17d07062ab4..c3a5a9839f8 100644 --- a/library/cpp/codecs/codecs_registry.cpp +++ b/library/cpp/codecs/codecs_registry.cpp @@ -16,13 +16,13 @@ namespace NCodecs { return Singleton<NPrivate::TCodecRegistry>()->GetCodec(name); } - TVector<TString> ICodec::GetCodecsList() { + TVector<TString> ICodec::GetCodecsList() { return Singleton<NPrivate::TCodecRegistry>()->GetCodecsList(); } namespace NPrivate { void TCodecRegistry::RegisterFactory(TFactoryPtr fac) { - TVector<TString> names = fac->ListNames(); + TVector<TString> names = fac->ListNames(); for (const auto& name : names) { Y_VERIFY(!Registry.contains(name), "already has %s", name.data()); Registry[name] = fac; @@ -51,9 +51,9 @@ namespace NCodecs { } } - TVector<TString> TCodecRegistry::GetCodecsList() const { + TVector<TString> TCodecRegistry::GetCodecsList() const { using namespace NPrivate; - TVector<TString> vs; + TVector<TString> vs; vs.push_back("none"); for (const auto& it : Registry) { @@ -99,8 +99,8 @@ namespace NCodecs { ythrow TNoCodecException(name); } - TVector<TString> ListNames() const override { - TVector<TString> vs; + TVector<TString> ListNames() const override { + TVector<TString> vs; vs.push_back(ToString(TSolarCodec::MyName())); vs.push_back(ToString(TSolarCodec::MyName8k())); vs.push_back(ToString(TSolarCodec::MyName16k())); @@ -122,7 +122,7 @@ namespace NCodecs { return new TZStdDictCodec(TZStdDictCodec::ParseCompressionName(name)); } - TVector<TString> ListNames() const override { + TVector<TString> ListNames() const override { return TZStdDictCodec::ListCompressionNames(); } }; @@ -139,8 +139,8 @@ namespace NCodecs { } } - TVector<TString> ListNames() const override { - TVector<TString> vs; + TVector<TString> ListNames() const override { + TVector<TString> vs; vs.push_back(ToString(TCompTableCodec::MyNameHQ())); vs.push_back(ToString(TCompTableCodec::MyNameLQ())); return vs; @@ -155,7 +155,7 @@ namespace NCodecs { { } - TString GetName() const override { + TString GetName() const override { return ToString(Codec->Name()); } @@ -175,7 +175,7 @@ namespace NCodecs { }; struct TBlockCodecsFactory : ICodecFactory { - using TRegistry = THashMap<TString, TCodecPtr>; + using TRegistry = THashMap<TString, TCodecPtr>; TRegistry Registry; TBlockCodecsFactory() { @@ -196,8 +196,8 @@ namespace NCodecs { return Registry.find(name)->second; } - TVector<TString> ListNames() const override { - TVector<TString> res; + TVector<TString> ListNames() const override { + TVector<TString> res; for (const auto& it : Registry) { res.push_back(it.first); } diff --git a/library/cpp/codecs/codecs_registry.h b/library/cpp/codecs/codecs_registry.h index 53710310d56..1c82365d8fa 100644 --- a/library/cpp/codecs/codecs_registry.h +++ b/library/cpp/codecs/codecs_registry.h @@ -13,7 +13,7 @@ namespace NCodecs { struct ICodecFactory : TAtomicRefCount<ICodecFactory> { virtual ~ICodecFactory() = default; virtual TCodecPtr MakeCodec(TStringBuf name) const = 0; - virtual TVector<TString> ListNames() const = 0; + virtual TVector<TString> ListNames() const = 0; }; typedef TIntrusivePtr<ICodecFactory> TCodecFactoryPtr; @@ -25,15 +25,15 @@ namespace NCodecs { return new TCodec; } - TVector<TString> ListNames() const override { - TVector<TString> vs; + TVector<TString> ListNames() const override { + TVector<TString> vs; vs.push_back(ToString(TCodec::MyName())); return vs; } }; class TCodecRegistry { - using TRegistry = THashMap<TString, TIntrusivePtr<ICodecFactory>>; + using TRegistry = THashMap<TString, TIntrusivePtr<ICodecFactory>>; TRegistry Registry; public: @@ -45,7 +45,7 @@ namespace NCodecs { TCodecPtr GetCodec(TStringBuf name) const; - TVector<TString> GetCodecsList() const; + TVector<TString> GetCodecsList() const; }; } diff --git a/library/cpp/codecs/comptable_codec.cpp b/library/cpp/codecs/comptable_codec.cpp index 476b8ada80c..a9ffacf35e3 100644 --- a/library/cpp/codecs/comptable_codec.cpp +++ b/library/cpp/codecs/comptable_codec.cpp @@ -22,7 +22,7 @@ namespace NCodecs { return 0; } - TVector<char> result; + TVector<char> result; Compressor->Compress(in, &result); out.Assign(&result[0], result.size()); return 0; @@ -34,7 +34,7 @@ namespace NCodecs { return; } - TVector<char> result; + TVector<char> result; Decompressor->Decompress(in, &result); out.Assign(&result[0], result.size()); } @@ -81,7 +81,7 @@ namespace NCodecs { TCompTableCodec::~TCompTableCodec() = default; - TString TCompTableCodec::GetName() const { + TString TCompTableCodec::GetName() const { return ToString(Impl->Quality ? MyNameHQ() : MyNameLQ()); } diff --git a/library/cpp/codecs/greedy_dict/ut/greedy_dict_ut.cpp b/library/cpp/codecs/greedy_dict/ut/greedy_dict_ut.cpp index 679089a11be..7adf8d49672 100644 --- a/library/cpp/codecs/greedy_dict/ut/greedy_dict_ut.cpp +++ b/library/cpp/codecs/greedy_dict/ut/greedy_dict_ut.cpp @@ -125,7 +125,7 @@ class TGreedyDictTest: public TTestBase { data.insert(data.begin(), urls, urls + Y_ARRAY_SIZE(urls)); } - typedef THashMap<TStringBuf, NGreedyDict::TEntry> TDict; + typedef THashMap<TStringBuf, NGreedyDict::TEntry> TDict; TAutoPtr<NGreedyDict::TEntrySet> DoTestBuilder(const NGreedyDict::TBuildSettings& s, TDict& res) { @@ -159,7 +159,7 @@ class TGreedyDictTest: public TTestBase { void TestBuilder() { TAutoPtr<NGreedyDict::TEntrySet> set; - THashMap<TStringBuf, NGreedyDict::TEntry> res; + THashMap<TStringBuf, NGreedyDict::TEntry> res; NGreedyDict::TBuildSettings s; set = DoTestBuilder(s, res); diff --git a/library/cpp/codecs/huffman_codec.cpp b/library/cpp/codecs/huffman_codec.cpp index 650fe7cdfdd..ff618fd9558 100644 --- a/library/cpp/codecs/huffman_codec.cpp +++ b/library/cpp/codecs/huffman_codec.cpp @@ -496,10 +496,10 @@ namespace NCodecs { : Original(codec) { CacheEntries.resize(1 << CACHE_BITS_COUNT); - DecodeCache.reserve(CacheEntries.size() * 2); + DecodeCache.reserve(CacheEntries.size() * 2); char buffer[2]; TBuffer decoded; - for (size_t i = 0; i < CacheEntries.size(); i++) { + for (size_t i = 0; i < CacheEntries.size(); i++) { buffer[1] = i >> 8; buffer[0] = i; NBitIO::TBitInput bin(buffer, buffer + sizeof(buffer)); diff --git a/library/cpp/codecs/sample.h b/library/cpp/codecs/sample.h index 15f03afcc5d..8aa62c7abd9 100644 --- a/library/cpp/codecs/sample.h +++ b/library/cpp/codecs/sample.h @@ -30,11 +30,11 @@ namespace NCodecs { template <class TItem> class TSimpleSequenceReader: public ISequenceReader { - const TVector<TItem>& Items; + const TVector<TItem>& Items; size_t Idx = 0; public: - TSimpleSequenceReader(const TVector<TItem>& items) + TSimpleSequenceReader(const TVector<TItem>& items) : Items(items) { } @@ -64,13 +64,13 @@ namespace NCodecs { } template <class TIter, class TGetter> - TVector<TBuffer> GetSample(TIter begin, TIter end, size_t sampleSizeBytes, TGetter getter) { + TVector<TBuffer> GetSample(TIter begin, TIter end, size_t sampleSizeBytes, TGetter getter) { TFastRng64 rng{0x1ce1f2e507541a05, 0x07d45659, 0x7b8771030dd9917e, 0x2d6636ce}; size_t totalBytes = GetInputSize(begin, end, getter); double sampleProb = (double)sampleSizeBytes / Max<size_t>(1, totalBytes); - TVector<TBuffer> result; + TVector<TBuffer> result; for (TIter iter = begin; iter != end; ++iter) { if (sampleProb >= 1 || rng.GenRandReal1() < sampleProb) { TStringBuf reg = getter(iter); @@ -82,7 +82,7 @@ namespace NCodecs { } template <class TIter> - TVector<TBuffer> GetSample(TIter begin, TIter end, size_t sampleSizeBytes) { + TVector<TBuffer> GetSample(TIter begin, TIter end, size_t sampleSizeBytes) { return GetSample(begin, end, sampleSizeBytes, IterToStringBuf<TIter>); } diff --git a/library/cpp/codecs/static/builder.cpp b/library/cpp/codecs/static/builder.cpp index 93e34a3edbb..3df19eeedf3 100644 --- a/library/cpp/codecs/static/builder.cpp +++ b/library/cpp/codecs/static/builder.cpp @@ -9,7 +9,7 @@ #include <util/string/subst.h> namespace NCodecs { - TStaticCodecInfo BuildStaticCodec(const TVector<TString>& trainingData, const TCodecBuildInfo& info) { + TStaticCodecInfo BuildStaticCodec(const TVector<TString>& trainingData, const TCodecBuildInfo& info) { TStaticCodecInfo result; TCodecPtr codec = ICodec::GetInstance(info.CodecName); Y_ENSURE_EX(codec, TCodecException() << "empty codec is not allowed"); @@ -31,8 +31,8 @@ namespace NCodecs { return result; } - TString GetStandardFileName(const TStaticCodecInfo& info) { - TString cName = info.GetDebugInfo().GetCodecName(); + TString GetStandardFileName(const TStaticCodecInfo& info) { + TString cName = info.GetDebugInfo().GetCodecName(); SubstGlobal(cName, ':', '.'); return TStringBuilder() << cName << "." << info.GetDebugInfo().GetTimestamp() << ".codec_info"; } diff --git a/library/cpp/codecs/static/builder.h b/library/cpp/codecs/static/builder.h index d7533be4d58..f179d778615 100644 --- a/library/cpp/codecs/static/builder.h +++ b/library/cpp/codecs/static/builder.h @@ -5,25 +5,25 @@ #include <library/cpp/svnversion/svnversion.h> #include <util/datetime/base.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/string/builder.h> namespace NCodecs { struct TCodecBuildInfo { // optimal values from SEARCH-1655 - TString CodecName = "solar-8k-a:zstd08d-1"; + TString CodecName = "solar-8k-a:zstd08d-1"; float SampleSizeMultiplier = 1; // debug info: time_t Timestamp = TInstant::Now().TimeT(); - TString RevisionInfo = (TStringBuilder() << "r" << ToString(GetProgramSvnRevision())); - TString TrainingSetComment; // a human comment on the training data + TString RevisionInfo = (TStringBuilder() << "r" << ToString(GetProgramSvnRevision())); + TString TrainingSetComment; // a human comment on the training data TString TrainingSetResId; // sandbox resid of the training set }; - TStaticCodecInfo BuildStaticCodec(const TVector<TString>& trainingData, const TCodecBuildInfo&); + TStaticCodecInfo BuildStaticCodec(const TVector<TString>& trainingData, const TCodecBuildInfo&); - TString GetStandardFileName(const TStaticCodecInfo&); + TString GetStandardFileName(const TStaticCodecInfo&); } diff --git a/library/cpp/codecs/static/common.h b/library/cpp/codecs/static/common.h index 211de2a27d2..588975b8de4 100644 --- a/library/cpp/codecs/static/common.h +++ b/library/cpp/codecs/static/common.h @@ -12,10 +12,10 @@ namespace NCodecs { } template <class T> - TString HexWriteScalar(T t) { + TString HexWriteScalar(T t) { static_assert(std::is_scalar<T>::value, "scalars only"); t = LittleToBig(t); - TString res = HexEncode(&t, sizeof(t)); + TString res = HexEncode(&t, sizeof(t)); res.to_lower(); return res; } diff --git a/library/cpp/codecs/static/static.cpp b/library/cpp/codecs/static/static.cpp index 44a07dd73a2..2c84c90d9c5 100644 --- a/library/cpp/codecs/static/static.cpp +++ b/library/cpp/codecs/static/static.cpp @@ -50,7 +50,7 @@ namespace NCodecs { return result; } - TString SaveCodecInfoToString(const TStaticCodecInfo& info) { + TString SaveCodecInfoToString(const TStaticCodecInfo& info) { TStringStream s; SaveCodecInfoToStream(s, info); return s.Str(); @@ -61,7 +61,7 @@ namespace NCodecs { return LoadCodecInfoFromStream(m); } - TString FormatCodecInfo(const TStaticCodecInfo& ci) { + TString FormatCodecInfo(const TStaticCodecInfo& ci) { TStringBuilder s; s << "codec name: " << ci.GetDebugInfo().GetCodecName() << Endl; s << "codec hash: " << HexWriteScalar(ci.GetDebugInfo().GetStoredCodecHash()) << Endl; @@ -77,7 +77,7 @@ namespace NCodecs { return s; } - TString LoadStringFromArchive(const ui8* begin, size_t size) { + TString LoadStringFromArchive(const ui8* begin, size_t size) { TArchiveReader ar(TBlob::NoCopy(begin, size)); Y_VERIFY(ar.Count() == 1, "invalid number of entries"); auto blob = ar.ObjectBlobByKey(ar.KeyByIndex(0)); diff --git a/library/cpp/codecs/static/static.h b/library/cpp/codecs/static/static.h index c1eaed2a742..9a2fa5a1d70 100644 --- a/library/cpp/codecs/static/static.h +++ b/library/cpp/codecs/static/static.h @@ -3,7 +3,7 @@ #include <library/cpp/codecs/codecs.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/output.h> namespace NCodecs { @@ -15,13 +15,13 @@ namespace NCodecs { TStaticCodecInfo LoadCodecInfoFromString(TStringBuf data); - TString LoadStringFromArchive(const ui8* begin, size_t size); + TString LoadStringFromArchive(const ui8* begin, size_t size); TCodecConstPtr RestoreCodecFromArchive(const ui8* begin, size_t size); // save - TString SaveCodecInfoToString(const TStaticCodecInfo&); + TString SaveCodecInfoToString(const TStaticCodecInfo&); void SaveCodecInfoToStream(IOutputStream& out, const TStaticCodecInfo&); @@ -29,6 +29,6 @@ namespace NCodecs { TStaticCodecInfo LoadCodecInfoFromStream(IInputStream& in); - TString FormatCodecInfo(const TStaticCodecInfo&); + TString FormatCodecInfo(const TStaticCodecInfo&); } diff --git a/library/cpp/codecs/static/tools/common/ct_common.cpp b/library/cpp/codecs/static/tools/common/ct_common.cpp index fe776912805..ab4a2fac3f4 100644 --- a/library/cpp/codecs/static/tools/common/ct_common.cpp +++ b/library/cpp/codecs/static/tools/common/ct_common.cpp @@ -9,7 +9,7 @@ #include <util/system/hp_timer.h> namespace NCodecs { - TString TComprStats::Format(const TStaticCodecInfo& info, bool checkMode) const { + TString TComprStats::Format(const TStaticCodecInfo& info, bool checkMode) const { TStringBuilder s; s << "raw size/item: " << RawSizePerRecord() << Endl; s << "enc.size/item: " << EncSizePerRecord() << Endl; @@ -26,7 +26,7 @@ namespace NCodecs { return s; } - TComprStats TestCodec(const ICodec& c, const TVector<TString>& input) { + TComprStats TestCodec(const ICodec& c, const TVector<TString>& input) { TComprStats stats; TBuffer encodeBuffer; @@ -51,10 +51,10 @@ namespace NCodecs { return stats; } - void ParseBlob(TVector<TString>& result, EDataStreamFormat fmt, const TBlob& blob) { + void ParseBlob(TVector<TString>& result, EDataStreamFormat fmt, const TBlob& blob) { TStringBuf bin(blob.AsCharPtr(), blob.Size()); TStringBuf line; - TString buffer; + TString buffer; while (bin.ReadLine(line)) { if (DSF_BASE64_LF == fmt) { Base64Decode(line, buffer); @@ -67,7 +67,7 @@ namespace NCodecs { } } - TBlob GetInputBlob(const TString& dataFile) { + TBlob GetInputBlob(const TString& dataFile) { return dataFile && dataFile != "-" ? TBlob::FromFile(dataFile) : TBlob::FromStream(Cin); } diff --git a/library/cpp/codecs/static/tools/common/ct_common.h b/library/cpp/codecs/static/tools/common/ct_common.h index 9d3dcbda934..a66c476c3d3 100644 --- a/library/cpp/codecs/static/tools/common/ct_common.h +++ b/library/cpp/codecs/static/tools/common/ct_common.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/memory/blob.h> #include <cmath> @@ -57,10 +57,10 @@ namespace NCodecs { return PerRecord((1 - compr) * RawSize); } - TString Format(const TStaticCodecInfo&, bool checkMode) const; + TString Format(const TStaticCodecInfo&, bool checkMode) const; }; - TComprStats TestCodec(const ICodec&, const TVector<TString>& data); + TComprStats TestCodec(const ICodec&, const TVector<TString>& data); enum EDataStreamFormat { DSF_NONE, @@ -68,8 +68,8 @@ namespace NCodecs { DSF_BASE64_LF /* "base64" */, }; - void ParseBlob(TVector<TString>&, EDataStreamFormat, const TBlob&); + void ParseBlob(TVector<TString>&, EDataStreamFormat, const TBlob&); - TBlob GetInputBlob(const TString& dataFile); + TBlob GetInputBlob(const TString& dataFile); } diff --git a/library/cpp/codecs/static/tools/static_codec_checker/static_codec_checker.cpp b/library/cpp/codecs/static/tools/static_codec_checker/static_codec_checker.cpp index 9c8d568d823..1775a07303d 100644 --- a/library/cpp/codecs/static/tools/static_codec_checker/static_codec_checker.cpp +++ b/library/cpp/codecs/static/tools/static_codec_checker/static_codec_checker.cpp @@ -14,7 +14,7 @@ int main(int argc, char** argv) { NCodecs::TCodecPtr codecPtr; NCodecs::EDataStreamFormat fmt = NCodecs::DSF_NONE; - TString codecFile; + TString codecFile; bool testCompression = false; auto opts = NLastGetopt::TOpts::Default(); @@ -50,7 +50,7 @@ int main(int argc, char** argv) { Cout << "Reading testing set data ... " << Flush; - TVector<TString> allData; + TVector<TString> allData; for (const auto& freeArg : res.GetFreeArgs()) { NCodecs::ParseBlob(allData, fmt, NCodecs::GetInputBlob(freeArg)); } diff --git a/library/cpp/codecs/static/tools/static_codec_generator/static_codec_generator.cpp b/library/cpp/codecs/static/tools/static_codec_generator/static_codec_generator.cpp index 45fdb5c5fe8..c5b4f0fcde5 100644 --- a/library/cpp/codecs/static/tools/static_codec_generator/static_codec_generator.cpp +++ b/library/cpp/codecs/static/tools/static_codec_generator/static_codec_generator.cpp @@ -44,7 +44,7 @@ int main(int argc, char** argv) { NLastGetopt::TOptsParseResult res(&opts, argc, argv); Cout << "Reading training set data ... " << Flush; - TVector<TString> allData; + TVector<TString> allData; for (const auto& freeArg : res.GetFreeArgs()) { NCodecs::ParseBlob(allData, fmt, NCodecs::GetInputBlob(freeArg)); } @@ -61,7 +61,7 @@ int main(int argc, char** argv) { auto codec = NCodecs::BuildStaticCodec(allData, info); Cout << "Done" << Endl; - TString codecName = NCodecs::GetStandardFileName(codec); + TString codecName = NCodecs::GetStandardFileName(codec); NCodecs::TCodecPtr codecPtr = NCodecs::ICodec::RestoreFromString(codec.GetStoredCodec()); Cout << "Testing compression ... " << Flush; @@ -74,7 +74,7 @@ int main(int argc, char** argv) { Cout << "Saving as " << codecName << " ... " << Flush; { - TUnbufferedFileOutput fout{codecName}; + TUnbufferedFileOutput fout{codecName}; NCodecs::SaveCodecInfoToStream(fout, codec); fout.Finish(); } diff --git a/library/cpp/codecs/static/ut/builder_ut.cpp b/library/cpp/codecs/static/ut/builder_ut.cpp index b47c279ed14..e4b207d1326 100644 --- a/library/cpp/codecs/static/ut/builder_ut.cpp +++ b/library/cpp/codecs/static/ut/builder_ut.cpp @@ -9,16 +9,16 @@ class TStaticCodecInfoBuilderTest: public NUnitTest::TTestBase { UNIT_TEST_SUITE_END(); private: - TVector<TString> PrepareData() { - TVector<TString> data; + TVector<TString> PrepareData() { + TVector<TString> data; for (ui32 i = 'a'; i <= 'z'; ++i) { - data.push_back(TString(1, (char)i)); + data.push_back(TString(1, (char)i)); } return data; } void TestBuild() { - TVector<TString> data; + TVector<TString> data; NCodecs::TCodecBuildInfo info; info.CodecName = "huffman"; info.SampleSizeMultiplier = 2; diff --git a/library/cpp/codecs/ut/codecs_ut.cpp b/library/cpp/codecs/ut/codecs_ut.cpp index caf6089aef7..581650a65b2 100644 --- a/library/cpp/codecs/ut/codecs_ut.cpp +++ b/library/cpp/codecs/ut/codecs_ut.cpp @@ -872,8 +872,8 @@ class TCodecsTest: public TTestBase { UNIT_TEST_SUITE_END(); private: - TString PrintError(TStringBuf learn, TStringBuf test, TStringBuf codec, ui32 i) { - TString s; + TString PrintError(TStringBuf learn, TStringBuf test, TStringBuf codec, ui32 i) { + TString s; TStringOutput sout(s); sout << codec << ": " << i << ", " << "\n"; @@ -882,7 +882,7 @@ private: sout << HexEncode(test.data(), test.size()); //NEscJ::EscapeJ<true>(test, sout); if (s.Size() > 1536) { - TString res = s.substr(0, 512); + TString res = s.substr(0, 512); res.append("...<skipped ").append(ToString(s.size() - 1024)).append(">..."); res.append(s.substr(s.size() - 512)); } @@ -895,13 +895,13 @@ private: } template <typename TCodec, bool testsaveload> - void TestCodec(const TVector<TBuffer>& inlearn = TVector<TBuffer>(), const TVector<TBuffer>& in = TVector<TBuffer>(), NCodecs::TCodecPtr c = new TCodec) { + void TestCodec(const TVector<TBuffer>& inlearn = TVector<TBuffer>(), const TVector<TBuffer>& in = TVector<TBuffer>(), NCodecs::TCodecPtr c = new TCodec) { using namespace NCodecs; TBuffer buff; { - TVector<TBuffer> out; + TVector<TBuffer> out; c->Learn(inlearn.begin(), inlearn.end()); @@ -973,7 +973,7 @@ private: void TestDelta() { using namespace NCodecs; - TVector<TBuffer> d; + TVector<TBuffer> d; // 1. common case d.emplace_back(); @@ -1016,7 +1016,7 @@ private: void TestPFor() { using namespace NCodecs; { - TVector<TBuffer> d; + TVector<TBuffer> d; d.emplace_back(); AppendTo(d.back(), -1LL); AppendTo(d.back(), -1LL); @@ -1054,7 +1054,7 @@ private: TestCodec<TPForCodec<ui64, true>, true>(d); } { - TVector<TBuffer> d; + TVector<TBuffer> d; d.emplace_back(); AppendTo(d.back(), -1); AppendTo(d.back(), -1); @@ -1084,7 +1084,7 @@ private: TestCodec<TPForCodec<ui32, true>, false>(d); } { - TVector<TBuffer> d; + TVector<TBuffer> d; d.emplace_back(); for (auto& textValue : TextValues) { AppendTo(d.back(), (ui32)strlen(textValue)); @@ -1094,7 +1094,7 @@ private: TestCodec<TPForCodec<ui32, true>, false>(d); } { - TVector<TBuffer> d; + TVector<TBuffer> d; d.emplace_back(); for (auto& textValue : TextValues) { AppendTo(d.back(), (ui64)strlen(textValue)); @@ -1109,7 +1109,7 @@ private: void DoTestSimpleCodec() { using namespace NCodecs; { - TVector<TBuffer> learn; + TVector<TBuffer> learn; for (auto& textValue : TextValues) { learn.emplace_back(textValue, strlen(textValue)); @@ -1122,11 +1122,11 @@ private: } { - TVector<TBuffer> learn; + TVector<TBuffer> learn; learn.emplace_back(); learn.back().Append('a'); - TVector<TBuffer> test; + TVector<TBuffer> test; test.emplace_back(); for (ui32 i = 0; i < 256; ++i) { test.back().Append((ui8)i); @@ -1136,7 +1136,7 @@ private: } { - TVector<TBuffer> learn; + TVector<TBuffer> learn; learn.emplace_back(); for (ui32 i = 0; i < 256; ++i) { for (ui32 j = 0; j < i; ++j) { @@ -1144,7 +1144,7 @@ private: } } - TVector<TBuffer> test; + TVector<TBuffer> test; test.emplace_back(); for (ui32 i = 0; i < 256; ++i) { test.back().Append((ui8)i); @@ -1154,7 +1154,7 @@ private: } { - TVector<TBuffer> learn; + TVector<TBuffer> learn; learn.emplace_back(); for (ui32 i = 0; i < 128; ++i) { for (ui32 j = 0; j < i; ++j) { @@ -1162,7 +1162,7 @@ private: } } - TVector<TBuffer> test; + TVector<TBuffer> test; test.emplace_back(); for (ui32 i = 128; i < 256; ++i) { test.back().Append((ui8)i); @@ -1197,13 +1197,13 @@ private: void TestHuffmanLearnByFreqs() { using namespace NCodecs; - TVector<TBuffer> data; + TVector<TBuffer> data; for (auto& textValue : TextValues) { data.emplace_back(textValue, strlen(textValue)); } - TVector<TBuffer> outLearn; + TVector<TBuffer> outLearn; { THuffmanCodec codec; @@ -1215,7 +1215,7 @@ private: } } - TVector<TBuffer> outLearnByFreqs; + TVector<TBuffer> outLearnByFreqs; { THuffmanCodec codec; @@ -1251,30 +1251,30 @@ private: void TestSolar() { using namespace NCodecs; { - TVector<TBuffer> learn; + TVector<TBuffer> learn; for (auto& textValue : TextValues) { learn.emplace_back(textValue, strlen(textValue)); } - TestCodec<TSolarCodec, true>(learn, TVector<TBuffer>(), new TSolarCodec(512, 8)); - TestCodec<TAdaptiveSolarCodec, false>(learn, TVector<TBuffer>(), new TAdaptiveSolarCodec(512, 8)); - TestCodec<TAdaptiveSolarCodec, true>(learn, TVector<TBuffer>(), new TAdaptiveSolarCodec(512, 8)); - TestCodec<TSolarCodecShortInt, true>(learn, TVector<TBuffer>(), new TSolarCodecShortInt(512, 8)); + TestCodec<TSolarCodec, true>(learn, TVector<TBuffer>(), new TSolarCodec(512, 8)); + TestCodec<TAdaptiveSolarCodec, false>(learn, TVector<TBuffer>(), new TAdaptiveSolarCodec(512, 8)); + TestCodec<TAdaptiveSolarCodec, true>(learn, TVector<TBuffer>(), new TAdaptiveSolarCodec(512, 8)); + TestCodec<TSolarCodecShortInt, true>(learn, TVector<TBuffer>(), new TSolarCodecShortInt(512, 8)); } { - TestCodec<TSolarCodec, true>(TVector<TBuffer>(), TVector<TBuffer>(), new TSolarCodec(512, 8)); - TestCodec<TAdaptiveSolarCodec, false>(TVector<TBuffer>(), TVector<TBuffer>(), new TAdaptiveSolarCodec(512, 8)); - TestCodec<TAdaptiveSolarCodec, true>(TVector<TBuffer>(), TVector<TBuffer>(), new TAdaptiveSolarCodec(512, 8)); - TestCodec<TSolarCodecShortInt, true>(TVector<TBuffer>(), TVector<TBuffer>(), new TSolarCodecShortInt(512, 8)); + TestCodec<TSolarCodec, true>(TVector<TBuffer>(), TVector<TBuffer>(), new TSolarCodec(512, 8)); + TestCodec<TAdaptiveSolarCodec, false>(TVector<TBuffer>(), TVector<TBuffer>(), new TAdaptiveSolarCodec(512, 8)); + TestCodec<TAdaptiveSolarCodec, true>(TVector<TBuffer>(), TVector<TBuffer>(), new TAdaptiveSolarCodec(512, 8)); + TestCodec<TSolarCodecShortInt, true>(TVector<TBuffer>(), TVector<TBuffer>(), new TSolarCodecShortInt(512, 8)); } { - TVector<TBuffer> learn; + TVector<TBuffer> learn; learn.emplace_back(); learn.back().Append('a'); - TVector<TBuffer> test; + TVector<TBuffer> test; test.emplace_back(); for (ui32 i = 0; i < 256; ++i) { test.back().Append((ui8)i); @@ -1287,7 +1287,7 @@ private: } { - TVector<TBuffer> learn; + TVector<TBuffer> learn; learn.emplace_back(); for (ui32 i = 0; i < 256; ++i) { for (ui32 j = 0; j < i; ++j) { @@ -1295,7 +1295,7 @@ private: } } - TVector<TBuffer> test; + TVector<TBuffer> test; test.emplace_back(); for (ui32 i = 0; i < 256; ++i) { test.back().Append((ui8)i); @@ -1311,7 +1311,7 @@ private: void TestPipeline() { using namespace NCodecs; { - TVector<TBuffer> learn; + TVector<TBuffer> learn; learn.emplace_back(); for (ui32 i = 0; i < 256; ++i) { for (i32 j = i; j >= 0; --j) { @@ -1319,7 +1319,7 @@ private: } } - TVector<TBuffer> test; + TVector<TBuffer> test; test.emplace_back(); for (ui32 i = 0; i < 256; ++i) { test.back().Append((ui8)i); @@ -1329,7 +1329,7 @@ private: new TPipelineCodec(new TSolarCodec(512, 8), new TSolarCodec(512, 8), new THuffmanCodec)); } { - TVector<TBuffer> d; + TVector<TBuffer> d; d.emplace_back(); for (ui32 i = 0; i < 256; ++i) { for (i32 j = i; j >= 0; --j) { @@ -1337,14 +1337,14 @@ private: } } - TestCodec<TPipelineCodec, false>(d, TVector<TBuffer>(), + TestCodec<TPipelineCodec, false>(d, TVector<TBuffer>(), new TPipelineCodec(new TDeltaCodec<ui32, false>, new TPForCodec<ui32>)); } } void TestRegistry() { using namespace NCodecs; - TVector<TString> vs = ICodec::GetCodecsList(); + TVector<TString> vs = ICodec::GetCodecsList(); for (const auto& v : vs) { TCodecPtr p = ICodec::GetInstance(v); if (v == "none") { diff --git a/library/cpp/codecs/ut/float_huffman_ut.cpp b/library/cpp/codecs/ut/float_huffman_ut.cpp index 3156fb1f461..d9bda028504 100644 --- a/library/cpp/codecs/ut/float_huffman_ut.cpp +++ b/library/cpp/codecs/ut/float_huffman_ut.cpp @@ -142,7 +142,7 @@ Y_UNIT_TEST_SUITE(FloatHuffmanTest) { } // Helper for dumping compressed values - void PrintCompressed(const TVector<ui8>& codedFactors) { + void PrintCompressed(const TVector<ui8>& codedFactors) { for (size_t i = 0; i < codedFactors.size(); ++i) { if (i % 0x10 == 0) Cerr << Endl; @@ -152,7 +152,7 @@ Y_UNIT_TEST_SUITE(FloatHuffmanTest) { } // Helper for dumping decompressed values - void PrintDecompressed(const TVector<float>& factors) { + void PrintDecompressed(const TVector<float>& factors) { TStringStream result; TStringStream line; @@ -220,7 +220,7 @@ Y_UNIT_TEST_SUITE(FloatHuffmanTest) { Y_UNIT_TEST(TestDecompressForgedData) { // this coredumps without end-of-coded-stream check, see SEARCH-1156 for details - TString brokenBase64Encoded = + TString brokenBase64Encoded = "NLjYltUWs5pqnd3d3f05Li4OAwCAEqrP6mv06jDt7PiAUVu7Y+PiMpuZmdzeM" "ArqOLxS2q4FKCII52dktcVs7y0zL+OKgeO9SOzEkFj7uPfFqqoCAAAAAADAtZ" "mZ2fdmICAgANQXhi1WVRUAAAAAAAAGjvcWq6oKAAAAAAAAA8d7qe4rV3Nxcd3" diff --git a/library/cpp/codecs/zstd_dict_codec.cpp b/library/cpp/codecs/zstd_dict_codec.cpp index c42a2879e6c..d04ea57f3b9 100644 --- a/library/cpp/codecs/zstd_dict_codec.cpp +++ b/library/cpp/codecs/zstd_dict_codec.cpp @@ -147,7 +147,7 @@ namespace NCodecs { bool Learn(ISequenceReader& in, bool throwOnError) { TBuffer data; - TVector<size_t> lens; + TVector<size_t> lens; data.Reserve(2 * SampleSize); TStringBuf r; @@ -233,7 +233,7 @@ namespace NCodecs { TZStdDictCodec::~TZStdDictCodec() { } - TString TZStdDictCodec::GetName() const { + TString TZStdDictCodec::GetName() const { return TStringBuilder() << MyName() << "-" << Impl->GetCompressionLevel(); } @@ -263,8 +263,8 @@ namespace NCodecs { Impl->Load(in); } - TVector<TString> TZStdDictCodec::ListCompressionNames() { - TVector<TString> res; + TVector<TString> TZStdDictCodec::ListCompressionNames() { + TVector<TString> res; for (int i = 1; i <= ZSTD_maxCLevel(); ++i) { res.emplace_back(TStringBuilder() << MyName() << "-" << i); } diff --git a/library/cpp/colorizer/colors.cpp b/library/cpp/colorizer/colors.cpp index decc5c9847d..918cd570856 100644 --- a/library/cpp/colorizer/colors.cpp +++ b/library/cpp/colorizer/colors.cpp @@ -130,9 +130,9 @@ namespace { return "\033[0m\033[2;36m"; case DARK_WHITE: return "\033[0m\033[2;37m"; - - case INVALID: - default: + + case INVALID: + default: return ""; } } diff --git a/library/cpp/colorizer/colors.h b/library/cpp/colorizer/colors.h index 474a918994e..8b64f4d90b0 100644 --- a/library/cpp/colorizer/colors.h +++ b/library/cpp/colorizer/colors.h @@ -2,10 +2,10 @@ #include "fwd.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> -#include <cstdio> +#include <cstdio> namespace NColorizer { /** @@ -192,19 +192,19 @@ namespace NColorizer { TStringBuf YellowColor() const noexcept; TStringBuf WhiteColor() const noexcept; - inline bool IsTTY() const noexcept { + inline bool IsTTY() const noexcept { return IsTTY_; } - inline void SetIsTTY(bool value) noexcept { + inline void SetIsTTY(bool value) noexcept { IsTTY_ = value; } - inline void Enable() noexcept { + inline void Enable() noexcept { SetIsTTY(true); } - inline void Disable() noexcept { + inline void Disable() noexcept { SetIsTTY(false); } diff --git a/library/cpp/colorizer/output.h b/library/cpp/colorizer/output.h index 99afbd34278..0644daed85e 100644 --- a/library/cpp/colorizer/output.h +++ b/library/cpp/colorizer/output.h @@ -12,7 +12,7 @@ namespace NColorizer { const TColors* C; TColorFunc F; - inline TColorHandle(const TColors* c, TColorFunc f) noexcept + inline TColorHandle(const TColors* c, TColorFunc f) noexcept : C(c) , F(f) { diff --git a/library/cpp/compproto/compproto_ut.cpp b/library/cpp/compproto/compproto_ut.cpp index 9393be967a3..2a2a62a3fb3 100644 --- a/library/cpp/compproto/compproto_ut.cpp +++ b/library/cpp/compproto/compproto_ut.cpp @@ -36,7 +36,7 @@ template <typename X> void TestSaveLoadMeta(NCompProto::TMetaInfo<X>& src) { TStringStream ss; src.Save(ss); - TString data = ss.Str(); + TString data = ss.Str(); NCompProto::TMetaInfo<X> loadedMeta(data); ss = TStringStream(); loadedMeta.Save(ss); @@ -44,7 +44,7 @@ void TestSaveLoadMeta(NCompProto::TMetaInfo<X>& src) { } template <typename TDecompressor, template <typename, typename> class TSerialize> -void TestWithParams(const TString& metainfo, const ECompMode mode, const TTestParams& params) { +void TestWithParams(const TString& metainfo, const ECompMode mode, const TTestParams& params) { using namespace NCompProto; FlushPseudoRandom(); @@ -74,7 +74,7 @@ void TestWithParams(const TString& metainfo, const ECompMode mode, const TTestPa const size_t busyPages = (byteSize + (PAGESIZEX - 1)) / PAGESIZEX; const size_t allPages = busyPages + 1; const size_t allocSize = (allPages + 1) * PAGESIZEX; - TVector<ui8> readBuffer(allocSize); + TVector<ui8> readBuffer(allocSize); ui8* start = &readBuffer[0]; ui8* pageStart = reinterpret_cast<ui8*>((size_t(start) + PAGESIZEX) & ~(PAGESIZEX - 1)); // XX DATA DATA DATA DATA PROT @@ -97,7 +97,7 @@ void TestWithParams(const TString& metainfo, const ECompMode mode, const TTestPa } template <typename TDecompressor, template <typename, typename> class TSerialize> -void Test(const TString& metainfo, const ECompMode mode) { +void Test(const TString& metainfo, const ECompMode mode) { for (size_t ds = 3; ds < 42; ds += (3 + PseudoRandom(5))) { for (size_t vas = 5; vas < 42; vas += (4 + PseudoRandom(10))) { TTestParams params; @@ -111,7 +111,7 @@ void Test(const TString& metainfo, const ECompMode mode) { Y_UNIT_TEST_SUITE(CompProtoTestBasic) { using namespace NCompProto; - const TString metainfo = + const TString metainfo = "\n\ repeated data id 0\n\ scalar clicks id 0 default const 0\n\ @@ -132,10 +132,10 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { ui32 Clicks; ui32 Shows; ui32 Extra; - TMap<ui32, TRegInfo> RegClicks; + TMap<ui32, TRegInfo> RegClicks; }; - TVector<TData> data; + TVector<TData> data; template <class TMeta, class TFunctor> struct TSerialize { @@ -187,7 +187,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { void EndSelf() { } void BeginElement(ui32 element) { - TMap<ui32, TRegInfo>::const_iterator it = Data->RegClicks.find(element); + TMap<ui32, TRegInfo>::const_iterator it = Data->RegClicks.find(element); if (it == Data->RegClicks.end()) { UNIT_ASSERT(0); } @@ -251,7 +251,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { EState State; ui32 DataInd; - TMap<ui32, TRegInfo>::iterator RegIter; + TMap<ui32, TRegInfo>::iterator RegIter; TMetaIterator<TVerifyingDecompressor>& GetDecompressor(size_t index) { Y_UNUSED(index); @@ -373,7 +373,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestBasic) { Y_UNIT_TEST_SUITE(CompProtoTestExtended) { using namespace NCompProto; - const TString metainfo = + const TString metainfo = "\n\ repeated data id 0\n\ repeated second id 3\n\ @@ -383,7 +383,7 @@ Y_UNIT_TEST_SUITE(CompProtoTestExtended) { scalar inner id 0 default const 0\n\ end\n\ end\n"; - TVector<std::pair<TVector<ui32>, TVector<ui32>>> data; + TVector<std::pair<TVector<ui32>, TVector<ui32>>> data; template <class TMeta, class TFunctor> struct TSerialize { diff --git a/library/cpp/comptable/comptable.cpp b/library/cpp/comptable/comptable.cpp index 8a92d4d1aa6..d20ab6c7c40 100644 --- a/library/cpp/comptable/comptable.cpp +++ b/library/cpp/comptable/comptable.cpp @@ -1,6 +1,6 @@ #include <util/system/defaults.h> #include <util/system/filemap.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/string/cast.h> #include <util/stream/file.h> diff --git a/library/cpp/comptable/usage/usage.cpp b/library/cpp/comptable/usage/usage.cpp index 9997c83686a..60de3515b49 100644 --- a/library/cpp/comptable/usage/usage.cpp +++ b/library/cpp/comptable/usage/usage.cpp @@ -10,8 +10,8 @@ using namespace NCompTable; template <bool HQ> void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { - TVector<char> compressed; - TVector<char> decompressed; + TVector<char> compressed; + TVector<char> decompressed; TChunkCompressor compressor(HQ, table); TChunkDecompressor deCompressor(HQ, table); @@ -42,18 +42,18 @@ void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { int main(int argc, const char* argv[]) { TReallyFastRng32 rr(17); - TVector<TString> lines; + TVector<TString> lines; /*FILE *fp = fopen("res", "rb"); while (!feof(fp)) { char buff[4096]; fscanf(fp, "%s", buff); - lines.push_back(TString(buff)); + lines.push_back(TString(buff)); }*/ //for (size_t i = 0; i < 10000000; ++i) { //for (size_t i = 0; i < 1000000; ++i) { for (size_t i = 0; i < 1000000; ++i) { size_t size = rr.Uniform(32); - TString res = "www.yandex.ru/yandsearch?text="; + TString res = "www.yandex.ru/yandsearch?text="; for (size_t j = 0; j < size; ++j) { res += "qwer"[rr.Uniform(4)]; } diff --git a/library/cpp/comptable/ut/comptable_ut.cpp b/library/cpp/comptable/ut/comptable_ut.cpp index 5901d0246fb..4314e6baa00 100644 --- a/library/cpp/comptable/ut/comptable_ut.cpp +++ b/library/cpp/comptable/ut/comptable_ut.cpp @@ -8,8 +8,8 @@ using namespace NCompTable; template <bool HQ> void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { - TVector<char> compressed; - TVector<char> decompressed; + TVector<char> compressed; + TVector<char> decompressed; TChunkCompressor compressor(HQ, table); TStringStream tmp; @@ -42,10 +42,10 @@ void DoTest(const TCompressorTable& table, const TVector<TString>& lines) { Y_UNIT_TEST_SUITE(TestComptable) { Y_UNIT_TEST(TestComptableCompressDecompress) { TReallyFastRng32 rr(17); - TVector<TString> lines; + TVector<TString> lines; for (size_t i = 0; i < 1000000; ++i) { size_t size = rr.Uniform(32); - TString res = "www.yandex.ru/yandsearch?text="; + TString res = "www.yandex.ru/yandsearch?text="; for (size_t j = 0; j < size; ++j) { res += "qwer"[rr.Uniform(4)]; } diff --git a/library/cpp/containers/atomizer/atomizer.h b/library/cpp/containers/atomizer/atomizer.h index 5e40f47ab93..bed0167a191 100644 --- a/library/cpp/containers/atomizer/atomizer.h +++ b/library/cpp/containers/atomizer/atomizer.h @@ -17,7 +17,7 @@ class super_atomizer; template <class HashFcn, class EqualTo> class atomizer: public string_hash<ui32, HashFcn, EqualTo> { private: - TVector<const char*> order; + TVector<const char*> order; public: using iterator = typename string_hash<ui32, HashFcn, EqualTo>::iterator; @@ -48,7 +48,7 @@ public: std::pair<iterator, bool> ins = insert_copy(key, ui32(size() + 1)); if (ins.second) { // new? if (pool.Begin() != old_begin) // repoint? - for (TVector<const char*>::iterator ptr = order.begin(); ptr != order.end(); ++ptr) + for (TVector<const char*>::iterator ptr = order.begin(); ptr != order.end(); ++ptr) if (old_begin <= *ptr && *ptr < old_end) // from old pool? *ptr += pool.Begin() - old_begin; order.push_back((*ins.first).first); // copy of 'key' @@ -108,7 +108,7 @@ public: template <class T, class HashFcn, class EqualTo> class super_atomizer: public string_hash<ui32, HashFcn, EqualTo> { private: - using TOrder = TVector<std::pair<const char*, T>>; + using TOrder = TVector<std::pair<const char*, T>>; TOrder order; public: diff --git a/library/cpp/containers/bitseq/bititerator_ut.cpp b/library/cpp/containers/bitseq/bititerator_ut.cpp index ed0925866f6..8669410f5d1 100644 --- a/library/cpp/containers/bitseq/bititerator_ut.cpp +++ b/library/cpp/containers/bitseq/bititerator_ut.cpp @@ -4,8 +4,8 @@ #include <util/generic/vector.h> Y_UNIT_TEST_SUITE(TBitIteratorTest) { - TVector<ui16> GenWords() { - TVector<ui16> words(1, 0); + TVector<ui16> GenWords() { + TVector<ui16> words(1, 0); for (ui16 word = 1; word; ++word) words.push_back(word); return words; @@ -51,7 +51,7 @@ Y_UNIT_TEST_SUITE(TBitIteratorTest) { } Y_UNIT_TEST(TestForward) { - TVector<ui32> words; + TVector<ui32> words; words.push_back((1 << 10) | (1 << 20) | (1 << 25)); words.push_back(1 | (1 << 5) | (1 << 6) | (1 << 30)); for (int i = 0; i < 3; ++i) @@ -90,7 +90,7 @@ Y_UNIT_TEST_SUITE(TBitIteratorTest) { } Y_UNIT_TEST(TestUnalignedReadAndPeek) { - TVector<ui32> words; + TVector<ui32> words; words.push_back((1 << 10) | (1 << 20) | (1 << 25)); words.push_back(1 | (1 << 5) | (1 << 6) | (1 << 30)); for (int i = 0; i < 5; ++i) diff --git a/library/cpp/containers/bitseq/bitvector.h b/library/cpp/containers/bitseq/bitvector.h index 3f8fd81ee57..7485b9a072f 100644 --- a/library/cpp/containers/bitseq/bitvector.h +++ b/library/cpp/containers/bitseq/bitvector.h @@ -19,7 +19,7 @@ public: private: friend class TReadonlyBitVector<T>; ui64 Size_; - TVector<TWord> Data_; + TVector<TWord> Data_; public: TBitVector() diff --git a/library/cpp/containers/compact_vector/compact_vector.h b/library/cpp/containers/compact_vector/compact_vector.h index dbe7473f0cc..94664aeb280 100644 --- a/library/cpp/containers/compact_vector/compact_vector.h +++ b/library/cpp/containers/compact_vector/compact_vector.h @@ -8,7 +8,7 @@ #include <cstdlib> -// vector that is 8 bytes when empty (TVector is 24 bytes) +// vector that is 8 bytes when empty (TVector is 24 bytes) template <typename T> class TCompactVector { diff --git a/library/cpp/containers/comptrie/chunked_helpers_trie.h b/library/cpp/containers/comptrie/chunked_helpers_trie.h index cfa35f5ba2a..e59d5f7263a 100644 --- a/library/cpp/containers/comptrie/chunked_helpers_trie.h +++ b/library/cpp/containers/comptrie/chunked_helpers_trie.h @@ -139,7 +139,7 @@ public: #endif } - void Add(const TString& s, const T& value) { + void Add(const TString& s, const T& value) { ui64 intValue = 0; memcpy(&intValue, &value, sizeof(T)); Builder.Add(s.data(), s.size(), intValue); @@ -180,8 +180,8 @@ public: template <typename T> class TTrieSortedMapWriter { private: - typedef std::pair<TString, T> TValue; - typedef TVector<TValue> TValues; + typedef std::pair<TString, T> TValue; + typedef TVector<TValue> TValues; TValues Values; public: diff --git a/library/cpp/containers/comptrie/comptrie_builder.h b/library/cpp/containers/comptrie/comptrie_builder.h index cf7d2e39a34..815737bd362 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.h +++ b/library/cpp/containers/comptrie/comptrie_builder.h @@ -61,8 +61,8 @@ public: return AddPtr(key.data(), key.size(), data); } - bool AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& filename); - bool AddSubtreeInFile(const TKeyBuf& key, const TString& filename) { + bool AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& filename); + bool AddSubtreeInFile(const TKeyBuf& key, const TString& filename) { return AddSubtreeInFile(key.data(), key.size(), filename); } @@ -83,8 +83,8 @@ public: size_t Save(IOutputStream& os) const; size_t SaveAndDestroy(IOutputStream& os); - size_t SaveToFile(const TString& fileName) const { - TFixedBufferFileOutput out(fileName); + size_t SaveToFile(const TString& fileName) const { + TFixedBufferFileOutput out(fileName); return Save(out); } diff --git a/library/cpp/containers/comptrie/comptrie_builder.inl b/library/cpp/containers/comptrie/comptrie_builder.inl index f273fa65710..8c9f681982f 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.inl +++ b/library/cpp/containers/comptrie/comptrie_builder.inl @@ -78,7 +78,7 @@ public: bool AddEntry(const TSymbol* key, size_t keylen, const TData& value); bool AddEntryPtr(const TSymbol* key, size_t keylen, const char* value); - bool AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& fileName); + bool AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& fileName); bool AddSubtreeInBuffer(const TSymbol* key, size_t keylen, TArrayWithSizeHolder<char>&& buffer); bool FindEntry(const TSymbol* key, size_t keylen, TData* value) const; bool FindLongestPrefix(const TSymbol* key, size_t keylen, size_t* prefixlen, TData* value) const; @@ -269,12 +269,12 @@ public: struct TSubtreeInFile: public ISubtree { struct TData { - TString FileName; + TString FileName; ui64 Size; }; THolder<TData> Data; - TSubtreeInFile(const TString& fileName) { + TSubtreeInFile(const TString& fileName) { // stupid API TFile file(fileName, RdOnly); i64 size = file.GetLength(); @@ -321,7 +321,7 @@ public: } ui64 Save(const TBuilderImpl*, IOutputStream& os) const override { - TUnbufferedFileInput is(Data->FileName); + TUnbufferedFileInput is(Data->FileName); ui64 written = TransferData(&is, &os); if (written != Data->Size) ythrow yexception() << "file " << Data->FileName.Quote() << " size changed"; @@ -400,7 +400,7 @@ public: return pool.Allocate(); } - inline void operator delete(void* ptr, TFixedSizeAllocator& pool) noexcept { + inline void operator delete(void* ptr, TFixedSizeAllocator& pool) noexcept { pool.Release(ptr); } @@ -436,7 +436,7 @@ bool TCompactTrieBuilder<T, D, S>::AddPtr(const TSymbol* key, size_t keylen, con } template <class T, class D, class S> -bool TCompactTrieBuilder<T, D, S>::AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& fileName) { +bool TCompactTrieBuilder<T, D, S>::AddSubtreeInFile(const TSymbol* key, size_t keylen, const TString& fileName) { return Impl->AddSubtreeInFile(key, keylen, fileName); } @@ -566,7 +566,7 @@ bool TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::AddEntryPtr( template <class T, class D, class S> bool TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::AddSubtreeInFile( - const TSymbol* key, size_t keylen, const TString& fileName) { + const TSymbol* key, size_t keylen, const TString& fileName) { typedef typename TNode::ISubtree ISubtree; typedef typename TNode::TSubtreeInFile TSubtreeInFile; diff --git a/library/cpp/containers/comptrie/comptrie_impl.h b/library/cpp/containers/comptrie/comptrie_impl.h index f41c38311a4..6effd9c909a 100644 --- a/library/cpp/containers/comptrie/comptrie_impl.h +++ b/library/cpp/containers/comptrie/comptrie_impl.h @@ -59,12 +59,12 @@ namespace NCompTriePrivate { template <> struct TStringForChar<char> { - typedef TString TResult; + typedef TString TResult; }; template <> struct TStringForChar<wchar16> { - typedef TUtf16String TResult; + typedef TUtf16String TResult; }; template <> diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index 40ec1e52b32..bf47ec8cd0c 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -41,7 +41,7 @@ public: typedef std::pair<TKey, TData> TValueType; typedef std::pair<size_t, TData> TPhraseMatch; - typedef TVector<TPhraseMatch> TPhraseMatchVector; + typedef TVector<TPhraseMatch> TPhraseMatchVector; typedef TCompactTrieBuilder<T, D, S> TBuilder; @@ -202,7 +202,7 @@ protected: bool hasNext; return LookupLongestPrefix(key, keylen, prefixLen, valuepos, hasNext); } - void LookupPhrases(const char* datapos, size_t len, const TSymbol* key, size_t keylen, TVector<TPhraseMatch>& matches, TSymbol separator) const; + void LookupPhrases(const char* datapos, size_t len, const TSymbol* key, size_t keylen, TVector<TPhraseMatch>& matches, TSymbol separator) const; }; template <class T = char, class D = ui64, class S = TCompactTriePacker<D>> diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp index 74bee09b5d6..22e61adf831 100644 --- a/library/cpp/containers/comptrie/comptrie_ut.cpp +++ b/library/cpp/containers/comptrie/comptrie_ut.cpp @@ -138,19 +138,19 @@ private: template <class T, bool minimize> void TestRandom(const size_t n, const size_t maxKeySize); - void TestFindTailsImpl(const TString& prefix); + void TestFindTailsImpl(const TString& prefix); void TestUniqueImpl(bool isPrefixGrouped); - TVector<TUtf16String> GetSampleKeys(size_t nKeys) const; + TVector<TUtf16String> GetSampleKeys(size_t nKeys) const; template <class TContainer> - TVector<TContainer> GetSampleVectorData(size_t nValues); + TVector<TContainer> GetSampleVectorData(size_t nValues); template <class TContainer> - TVector<TContainer> GetSampleTextVectorData(size_t nValues); + TVector<TContainer> GetSampleTextVectorData(size_t nValues); template <class T> void CheckEquality(const T& value1, const T& value2) const; template <class TContainer> - void TestTrieWithContainers(const TVector<TUtf16String>& keys, const TVector<TContainer>& sampleData, TString methodName); + void TestTrieWithContainers(const TVector<TUtf16String>& keys, const TVector<TContainer>& sampleData, TString methodName); template <typename TChar> void TestSearchIterImpl(); @@ -287,7 +287,7 @@ typename TCompactTrie<T>::TKey MakeWideKey(const char* str, size_t len) { } template <class T> -typename TCompactTrie<T>::TKey MakeWideKey(const TString& str) { +typename TCompactTrie<T>::TKey MakeWideKey(const TString& str) { return MakeWideKey<T>(str.c_str(), str.length()); } @@ -321,7 +321,7 @@ void TCompactTrieTest::CreateTrie(IOutputStream& out, bool minimize, bool useFas } // Iterates over all strings of length <= 4 made of letters a-g. -static bool LexicographicStep(TString& s) { +static bool LexicographicStep(TString& s) { if (s.length() < 4) { s += "a"; return true; @@ -343,7 +343,7 @@ void TCompactTrieTest::CheckUpperBound(const char* data, size_t datalen) { typedef typename TCompactTrie<T>::TKey TKey; typedef typename TCompactTrie<T>::TData TData; - TString key; + TString key; do { const TKey wideKey = MakeWideKey<T>(key); typename TCompactTrie<T>::TConstIterator it = trie.UpperBound(wideKey); @@ -375,7 +375,7 @@ void TCompactTrieTest::CheckData(const char* data, size_t datalen) { UNIT_ASSERT_EQUAL(len, prefixLen); UNIT_ASSERT_EQUAL(len * 2, value); - TString badkey("bb"); + TString badkey("bb"); badkey += i; key = MakeWideKey<T>(badkey); UNIT_ASSERT(!trie.Find(key)); @@ -400,7 +400,7 @@ void TCompactTrieTest::CheckData(const char* data, size_t datalen) { UNIT_ASSERT_EQUAL(len, prefixLen); } - TString testkey("fbbaa"); + TString testkey("fbbaa"); typename TCompactTrie<T>::TKey key = MakeWideKey<T>(testkey); ui64 value = 0; size_t prefixLen = 0; @@ -423,7 +423,7 @@ template <class T> void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { typedef typename TCompactTrie<T>::TKey TKey; typedef typename TCompactTrie<T>::TValueType TValue; - TMap<TKey, ui64> stored; + TMap<TKey, ui64> stored; for (auto& i : SampleData) { size_t len = strlen(i); @@ -432,10 +432,10 @@ void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { } TCompactTrie<T> trie(data, datalen); - TVector<TValue> items; + TVector<TValue> items; typename TCompactTrie<T>::TConstIterator it = trie.Begin(); size_t entry_count = 0; - TMap<TKey, ui64> received; + TMap<TKey, ui64> received; while (it != trie.End()) { UNIT_ASSERT_VALUES_EQUAL(it.GetKeySize(), it.GetKey().size()); received.insert(*it); @@ -443,7 +443,7 @@ void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { entry_count++; it++; } - TMap<TKey, ui64> received2; + TMap<TKey, ui64> received2; for (std::pair<TKey, ui64> x : trie) { received2.insert(x); } @@ -573,7 +573,7 @@ void TCompactTrieTest::TestPhraseSearch() { builder.Save(bufout); TCompactTrie<char> trie(bufout.Buffer().Data(), bufout.Buffer().Size()); - TVector<TCompactTrie<char>::TPhraseMatch> matches; + TVector<TCompactTrie<char>::TPhraseMatch> matches; trie.FindPhrases(goodphrase, strlen(goodphrase), matches); UNIT_ASSERT(matches.size() == Y_ARRAY_SIZE(phrases)); @@ -650,9 +650,9 @@ static char RandChar() { return char(RandomNumber<size_t>() % 256); } -static TString RandStr(const size_t max) { +static TString RandStr(const size_t max) { size_t len = RandomNumber<size_t>() % max; - TString key; + TString key; for (size_t j = 0; j < len; ++j) key += RandChar(); return key; @@ -662,12 +662,12 @@ template <class T, bool minimize> void TCompactTrieTest::TestRandom(const size_t n, const size_t maxKeySize) { const TStringBuf EMPTY_KEY = TStringBuf("", 1); TCompactTrieBuilder<char, typename T::TData, T> builder; - typedef TMap<TString, typename T::TData> TKeys; + typedef TMap<TString, typename T::TData> TKeys; TKeys keys; typename T::TData dummy; for (size_t i = 0; i < n; ++i) { - const TString key = RandStr(maxKeySize); + const TString key = RandStr(maxKeySize); if (key != EMPTY_KEY && keys.find(key) == keys.end()) { const typename T::TData val = T::Data(key); keys[key] = val; @@ -729,13 +729,13 @@ void TCompactTrieTest::TestRandom() { TestRandom<TStrokaPacker, true>(100, 100); } -void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) { +void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) { TCompactTrieBuilder<> builder; - TMap<TString, ui64> input; + TMap<TString, ui64> input; for (auto& i : SampleData) { - TString temp = i; + TString temp = i; ui64 val = temp.size() * 2; builder.Add(temp.data(), temp.size(), val); if (temp.StartsWith(prefix)) { @@ -751,7 +751,7 @@ void TCompactTrieTest::TestFindTailsImpl(const TString& prefix) { TTrie subtrie = trie.FindTails(prefix.data(), prefix.size()); - TMap<TString, ui64> output; + TMap<TString, ui64> output; for (TTrie::TConstIterator i = subtrie.Begin(), mi = subtrie.End(); i != mi; ++i) { TTrie::TValueType val = *i; @@ -847,7 +847,7 @@ void TCompactTrieTest::TestMergeFromFile() { b.Add("yandex", 12); b.Add("google", 13); b.Add("mail", 14); - TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-ru"); + TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-ru"); b.Save(out); } @@ -856,7 +856,7 @@ void TCompactTrieTest::TestMergeFromFile() { b.Add("yandex", 112); b.Add("google", 113); b.Add("yahoo", 114); - TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-com"); + TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-com"); b.Save(out); } @@ -865,7 +865,7 @@ void TCompactTrieTest::TestMergeFromFile() { UNIT_ASSERT(b.AddSubtreeInFile("com.", GetSystemTempDir() + "/TCompactTrieTest-TestMerge-com")); UNIT_ASSERT(b.Add("org.kernel", 22)); UNIT_ASSERT(b.AddSubtreeInFile("ru.", GetSystemTempDir() + "/TCompactTrieTest-TestMerge-ru")); - TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-res"); + TUnbufferedFileOutput out(GetSystemTempDir() + "/TCompactTrieTest-TestMerge-res"); b.Save(out); } @@ -1026,7 +1026,7 @@ public: class TCompactTrieTest::TStrokaPacker: public TCompactTriePacker<TString> { public: - typedef TString TData; + typedef TString TData; static TString Data(const TString& str) { return str; @@ -1104,18 +1104,18 @@ void TCompactTrieTest::TestTrieSet() { // Tests for trie with vector (list, set) values -TVector<TUtf16String> TCompactTrieTest::GetSampleKeys(size_t nKeys) const { +TVector<TUtf16String> TCompactTrieTest::GetSampleKeys(size_t nKeys) const { Y_ASSERT(nKeys <= 10); - TString sampleKeys[] = {"a", "b", "ac", "bd", "abe", "bcf", "deg", "ah", "xy", "abc"}; - TVector<TUtf16String> result; + TString sampleKeys[] = {"a", "b", "ac", "bd", "abe", "bcf", "deg", "ah", "xy", "abc"}; + TVector<TUtf16String> result; for (size_t i = 0; i < nKeys; i++) result.push_back(ASCIIToWide(sampleKeys[i])); return result; } template <class TContainer> -TVector<TContainer> TCompactTrieTest::GetSampleVectorData(size_t nValues) { - TVector<TContainer> data; +TVector<TContainer> TCompactTrieTest::GetSampleVectorData(size_t nValues) { + TVector<TContainer> data; for (size_t i = 0; i < nValues; i++) { data.push_back(TContainer()); for (size_t j = 0; j < i; j++) @@ -1125,12 +1125,12 @@ TVector<TContainer> TCompactTrieTest::GetSampleVectorData(size_t nValues) { } template <class TContainer> -TVector<TContainer> TCompactTrieTest::GetSampleTextVectorData(size_t nValues) { - TVector<TContainer> data; +TVector<TContainer> TCompactTrieTest::GetSampleTextVectorData(size_t nValues) { + TVector<TContainer> data; for (size_t i = 0; i < nValues; i++) { data.push_back(TContainer()); for (size_t j = 0; j < i; j++) - data[i].insert(data[i].end(), TString("abc") + ToString<size_t>(j)); + data[i].insert(data[i].end(), TString("abc") + ToString<size_t>(j)); } return data; } @@ -1148,14 +1148,14 @@ void TCompactTrieTest::CheckEquality<TVector<i64>>(const TVector<i64>& value1, c } template <class TContainer> -void TCompactTrieTest::TestTrieWithContainers(const TVector<TUtf16String>& keys, const TVector<TContainer>& sampleData, TString methodName) { - TString fileName = GetSystemTempDir() + "/TCompactTrieTest-TestTrieWithContainers-" + methodName; +void TCompactTrieTest::TestTrieWithContainers(const TVector<TUtf16String>& keys, const TVector<TContainer>& sampleData, TString methodName) { + TString fileName = GetSystemTempDir() + "/TCompactTrieTest-TestTrieWithContainers-" + methodName; TCompactTrieBuilder<wchar16, TContainer> b; for (size_t i = 0; i < keys.size(); i++) { b.Add(keys[i], sampleData[i]); } - TUnbufferedFileOutput out(fileName); + TUnbufferedFileOutput out(fileName); b.Save(out); TCompactTrie<wchar16, TContainer> trie(TBlob::FromFileSingleThreaded(fileName)); @@ -1174,13 +1174,13 @@ void TCompactTrieTest::TestTrieWithContainers(const TVector<TUtf16String>& keys, template <> void TCompactTrieTest::TestTrieWithContainers<std::pair<TUtf16String, TVector<i64>>>(const TVector<TUtf16String>& keys, const TVector<std::pair<TUtf16String, TVector<i64>>>& sampleData, TString methodName) { typedef std::pair<TUtf16String, TVector<i64>> TContainer; - TString fileName = GetSystemTempDir() + "/TCompactTrieTest-TestTrieWithContainers-" + methodName; + TString fileName = GetSystemTempDir() + "/TCompactTrieTest-TestTrieWithContainers-" + methodName; TCompactTrieBuilder<wchar16, TContainer> b; for (size_t i = 0; i < keys.size(); i++) { b.Add(keys[i], sampleData[i]); } - TUnbufferedFileOutput out(fileName); + TUnbufferedFileOutput out(fileName); b.Save(out); TCompactTrie<wchar16, TContainer> trie(TBlob::FromFileSingleThreaded(fileName)); @@ -1221,7 +1221,7 @@ void TCompactTrieTest::TestTrieForVectorWtroka() { TVector<TVector<TString>> data = GetSampleTextVectorData<TVector<TString>>(10); TVector<TVector<TUtf16String>> wData; for (size_t i = 0; i < data.size(); i++) { - wData.push_back(TVector<TUtf16String>()); + wData.push_back(TVector<TUtf16String>()); for (size_t j = 0; j < data[i].size(); j++) wData[i].push_back(UTF8ToWide(data[i][j])); } @@ -1237,7 +1237,7 @@ void TCompactTrieTest::TestTrieForVectorDouble() { } void TCompactTrieTest::TestTrieForListVectorInt64() { - TVector<i64> tmp; + TVector<i64> tmp; tmp.push_back(0); TList<TVector<i64>> dataElement(5, tmp); TVector<TList<TVector<i64>>> data(10, dataElement); @@ -1245,7 +1245,7 @@ void TCompactTrieTest::TestTrieForListVectorInt64() { } void TCompactTrieTest::TestTrieForPairWtrokaVectorInt64() { - TVector<TUtf16String> keys = GetSampleKeys(10); + TVector<TUtf16String> keys = GetSampleKeys(10); TVector<TVector<i64>> values = GetSampleVectorData<TVector<i64>>(10); TVector<std::pair<TUtf16String, TVector<i64>>> data; for (size_t i = 0; i < 10; i++) @@ -1295,14 +1295,14 @@ void TCompactTrieTest::TestFindLongestPrefixWithEmptyValue() { template <typename TChar> struct TConvertKey { - static inline TString Convert(const TStringBuf& key) { + static inline TString Convert(const TStringBuf& key) { return ToString(key); } }; template <> struct TConvertKey<wchar16> { - static inline TUtf16String Convert(const TStringBuf& key) { + static inline TUtf16String Convert(const TStringBuf& key) { return UTF8ToWide(key); } }; @@ -1436,8 +1436,8 @@ void TCompactTrieTest::TestFirstSymbolIteratorChar32() { void TCompactTrieTest::TestArrayPacker() { using TDataInt = std::array<int, 2>; - const std::pair<TString, TDataInt> dataXxx{"xxx", {{15, 16}}}; - const std::pair<TString, TDataInt> dataYyy{"yyy", {{20, 30}}}; + const std::pair<TString, TDataInt> dataXxx{"xxx", {{15, 16}}}; + const std::pair<TString, TDataInt> dataYyy{"yyy", {{20, 30}}}; TCompactTrieBuilder<char, TDataInt> trieBuilderOne; trieBuilderOne.Add(dataXxx.first, dataXxx.second); @@ -1450,9 +1450,9 @@ void TCompactTrieTest::TestArrayPacker() { UNIT_ASSERT_VALUES_EQUAL(dataXxx.second, trieOne.Get(dataXxx.first)); UNIT_ASSERT_VALUES_EQUAL(dataYyy.second, trieOne.Get(dataYyy.first)); - using TDataStroka = std::array<TString, 2>; - const std::pair<TString, TDataStroka> dataZzz{"zzz", {{"hello", "there"}}}; - const std::pair<TString, TDataStroka> dataWww{"www", {{"half", "life"}}}; + using TDataStroka = std::array<TString, 2>; + const std::pair<TString, TDataStroka> dataZzz{"zzz", {{"hello", "there"}}}; + const std::pair<TString, TDataStroka> dataWww{"www", {{"half", "life"}}}; TCompactTrieBuilder<char, TDataStroka> trieBuilderTwo; trieBuilderTwo.Add(dataZzz.first, dataZzz.second); @@ -1480,8 +1480,8 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix() { } void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double branchProbability, bool isPrefixGrouped, bool hasEmptyKey) { - TVector<TString> keys; - TString keyToAdd; + TVector<TString> keys; + TString keyToAdd; for (size_t i = 0; i < keysCount; ++i) { const size_t prevKeyLen = keyToAdd.Size(); // add two random chars to prev key @@ -1500,16 +1500,16 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra else Shuffle(keys.begin(), keys.end()); - TCompactTrieBuilder<char, TString> builder(isPrefixGrouped ? CTBF_PREFIX_GROUPED : CTBF_NONE); - const TString EMPTY_VALUE = "empty"; + TCompactTrieBuilder<char, TString> builder(isPrefixGrouped ? CTBF_PREFIX_GROUPED : CTBF_NONE); + const TString EMPTY_VALUE = "empty"; if (hasEmptyKey) builder.Add(nullptr, 0, EMPTY_VALUE); for (size_t i = 0; i < keysCount; ++i) { - const TString& key = keys[i]; + const TString& key = keys[i]; for (size_t j = 0; j < keysCount; ++j) { - const TString& otherKey = keys[j]; + const TString& otherKey = keys[j]; const bool exists = j < i; size_t expectedSize = 0; if (exists) { @@ -1523,7 +1523,7 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra } size_t prefixSize = 0xfcfcfc; - TString value = "abcd"; + TString value = "abcd"; const bool expectedResult = hasEmptyKey || expectedSize != 0; UNIT_ASSERT_VALUES_EQUAL_C(expectedResult, builder.FindLongestPrefix(otherKey.data(), otherKey.size(), &prefixSize, &value), "otherKey = " << HexEncode(otherKey)); if (expectedResult) { @@ -1539,10 +1539,10 @@ void TCompactTrieTest::TestBuilderFindLongestPrefix(size_t keysCount, double bra } for (int c = 0; c < 10; ++c) { - TString extendedKey = otherKey; + TString extendedKey = otherKey; extendedKey += RandChar(); size_t extendedPrefixSize = 0xdddddd; - TString extendedValue = "dcba"; + TString extendedValue = "dcba"; UNIT_ASSERT_VALUES_EQUAL(expectedResult, builder.FindLongestPrefix(extendedKey.data(), extendedKey.size(), &extendedPrefixSize, &extendedValue)); if (expectedResult) { UNIT_ASSERT_VALUES_EQUAL(value, extendedValue); diff --git a/library/cpp/containers/comptrie/key_selector.h b/library/cpp/containers/comptrie/key_selector.h index 60466cef715..c4339d5a239 100644 --- a/library/cpp/containers/comptrie/key_selector.h +++ b/library/cpp/containers/comptrie/key_selector.h @@ -1,13 +1,13 @@ #pragma once #include <util/generic/vector.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> template <class T> struct TCompactTrieKeySelector { - typedef TVector<T> TKey; - typedef TVector<T> TKeyBuf; + typedef TVector<T> TKey; + typedef TVector<T> TKeyBuf; }; template <class TChar> diff --git a/library/cpp/containers/comptrie/loader/loader.h b/library/cpp/containers/comptrie/loader/loader.h index ee10e9b451e..3c1efb79bb7 100644 --- a/library/cpp/containers/comptrie/loader/loader.h +++ b/library/cpp/containers/comptrie/loader/loader.h @@ -1,13 +1,13 @@ #pragma once #include <library/cpp/archive/yarchive.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ptr.h> #include <util/generic/yexception.h> #include <util/memory/blob.h> template <class TrieType, size_t N> -TrieType LoadTrieFromArchive(const TString& key, +TrieType LoadTrieFromArchive(const TString& key, const unsigned char (&data)[N], bool ignoreErrors = false) { TArchiveReader archive(TBlob::NoCopy(data, sizeof(data))); diff --git a/library/cpp/containers/comptrie/prefix_iterator.h b/library/cpp/containers/comptrie/prefix_iterator.h index b369bb4f425..7157d54dc10 100644 --- a/library/cpp/containers/comptrie/prefix_iterator.h +++ b/library/cpp/containers/comptrie/prefix_iterator.h @@ -26,11 +26,11 @@ private: bool Next(); public: - TPrefixIterator(const TTrie& trie, const TSymbol* aKey, size_t aKeylen) + TPrefixIterator(const TTrie& trie, const TSymbol* aKey, size_t aKeylen) : Trie(trie) - , key(aKey) - , keylen(aKeylen) - , keyend(aKey + aKeylen) + , key(aKey) + , keylen(aKeylen) + , keyend(aKey + aKeylen) , prefixLen(0) , valuepos(nullptr) , datapos(trie.DataHolder.AsCharPtr()) diff --git a/library/cpp/containers/comptrie/write_trie_backwards.h b/library/cpp/containers/comptrie/write_trie_backwards.h index 634e6b811a4..84f69f078f3 100644 --- a/library/cpp/containers/comptrie/write_trie_backwards.h +++ b/library/cpp/containers/comptrie/write_trie_backwards.h @@ -2,7 +2,7 @@ #include "minimize.h" -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/stream/output.h> #include <cstddef> diff --git a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp index cab2365ccec..8aef3cd5b9e 100644 --- a/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp +++ b/library/cpp/containers/intrusive_avl_tree/ut/avltree_ut.cpp @@ -14,7 +14,7 @@ private: class TIt; struct TItCompare { - static inline bool Compare(const TIt& l, const TIt& r) noexcept; + static inline bool Compare(const TIt& l, const TIt& r) noexcept; }; class TIt: public TAvlTreeItem<TIt, TItCompare> { @@ -30,7 +30,7 @@ private: using TIts = TAvlTree<TIt, TItCompare>; }; -inline bool TAvlTreeTest::TItCompare::Compare(const TIt& l, const TIt& r) noexcept { +inline bool TAvlTreeTest::TItCompare::Compare(const TIt& l, const TIt& r) noexcept { return l.Val < r.Val; } @@ -80,12 +80,12 @@ void TAvlTreeTest::TestIterator() { its.Insert(&it6); its.Insert(&it2); - TVector<int> res; + TVector<int> res; for (const TIt& i : its) { res.push_back(i.Val); } - TVector<int> expected{1, 2, 3, 4, 5, 6, 7}; + TVector<int> expected{1, 2, 3, 4, 5, 6, 7}; UNIT_ASSERT_EQUAL(res, expected); res.clear(); diff --git a/library/cpp/containers/intrusive_rb_tree/fuzz/rb_tree_fuzzing.cpp b/library/cpp/containers/intrusive_rb_tree/fuzz/rb_tree_fuzzing.cpp index 92370760b59..9eeac01d2f6 100644 --- a/library/cpp/containers/intrusive_rb_tree/fuzz/rb_tree_fuzzing.cpp +++ b/library/cpp/containers/intrusive_rb_tree/fuzz/rb_tree_fuzzing.cpp @@ -34,7 +34,7 @@ public: using TTree = TRbTree<TNode, TCmp>; extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) { - TDeque<TNode> records; + TDeque<TNode> records; const ui8 half = 128u; TTree tree; for (size_t i = 0; i < size; ++i) { diff --git a/library/cpp/containers/intrusive_rb_tree/rb_tree.h b/library/cpp/containers/intrusive_rb_tree/rb_tree.h index 0259452a145..9ed6edaf1b4 100644 --- a/library/cpp/containers/intrusive_rb_tree/rb_tree.h +++ b/library/cpp/containers/intrusive_rb_tree/rb_tree.h @@ -18,11 +18,11 @@ struct TRbTreeNodeBase { TBasePtr Right_; size_t Children_; - inline TRbTreeNodeBase() noexcept { + inline TRbTreeNodeBase() noexcept { ReInitNode(); } - inline void ReInitNode() noexcept { + inline void ReInitNode() noexcept { Color_ = RBTreeBlack; Parent_ = nullptr; Left_ = nullptr; @@ -82,7 +82,7 @@ struct TRbTreeBaseIterator { using TBasePtr = TRbTreeNodeBase*; TBasePtr Node_; - inline TRbTreeBaseIterator(TBasePtr x = nullptr) noexcept + inline TRbTreeBaseIterator(TBasePtr x = nullptr) noexcept : Node_(x) { } @@ -98,48 +98,48 @@ struct TRbTreeIterator: public TRbTreeBaseIterator { inline TRbTreeIterator() noexcept = default; template <class T1> - inline TRbTreeIterator(const T1& x) noexcept + inline TRbTreeIterator(const T1& x) noexcept : TRbTreeBaseIterator(x) { } - inline TReference operator*() const noexcept { + inline TReference operator*() const noexcept { return *static_cast<TValue*>(Node_); } - inline TPointer operator->() const noexcept { + inline TPointer operator->() const noexcept { return static_cast<TValue*>(Node_); } - inline TSelf& operator++() noexcept { + inline TSelf& operator++() noexcept { Node_ = TRbGlobalInst::IncrementNode(Node_); return *this; } - inline TSelf operator++(int) noexcept { + inline TSelf operator++(int) noexcept { TSelf tmp = *this; ++(*this); return tmp; } - inline TSelf& operator--() noexcept { + inline TSelf& operator--() noexcept { Node_ = TRbGlobalInst::DecrementNode(Node_); return *this; } - inline TSelf operator--(int) noexcept { + inline TSelf operator--(int) noexcept { TSelf tmp = *this; --(*this); return tmp; } template <class T1> - inline bool operator==(const T1& rhs) const noexcept { + inline bool operator==(const T1& rhs) const noexcept { return Node_ == rhs.Node_; } template <class T1> - inline bool operator!=(const T1& rhs) const noexcept { + inline bool operator!=(const T1& rhs) const noexcept { return Node_ != rhs.Node_; } }; @@ -149,7 +149,7 @@ class TRbTree { struct TCmpAdaptor: public TCmp { inline TCmpAdaptor() noexcept = default; - inline TCmpAdaptor(const TCmp& cmp) noexcept + inline TCmpAdaptor(const TCmp& cmp) noexcept : TCmp(cmp) { } @@ -182,11 +182,11 @@ public: { } - inline ~TRealNode() { + inline ~TRealNode() { UnLink(); } - inline void UnLink() noexcept { + inline void UnLink() noexcept { if (Tree_) { Tree_->EraseImpl(this); ReInitNode(); @@ -194,11 +194,11 @@ public: } } - inline void SetRbTreeParent(TRbTree* parent) noexcept { + inline void SetRbTreeParent(TRbTree* parent) noexcept { Tree_ = parent; } - inline TRbTree* ParentTree() const noexcept { + inline TRbTree* ParentTree() const noexcept { return Tree_; } @@ -209,17 +209,17 @@ public: using TIterator = TRbTreeIterator<TValue, TNonConstTraits>; using TConstIterator = TRbTreeIterator<TValue, TConstTraits>; - inline TRbTree() noexcept { + inline TRbTree() noexcept { Init(); } - inline TRbTree(const TCmp& cmp) noexcept + inline TRbTree(const TCmp& cmp) noexcept : KeyCompare_(cmp) { Init(); } - inline void Init() noexcept { + inline void Init() noexcept { Data_.Color_ = RBTreeRed; Data_.Parent_ = nullptr; Data_.Left_ = &Data_; @@ -228,17 +228,17 @@ public: } struct TDestroy { - inline void operator()(TValue& v) const noexcept { + inline void operator()(TValue& v) const noexcept { v.SetRbTreeParent(nullptr); v.ReInitNode(); } }; - inline ~TRbTree() { + inline ~TRbTree() { ForEachNoOrder(TDestroy()); } - inline void Clear() noexcept { + inline void Clear() noexcept { ForEachNoOrder(TDestroy()); Init(); } @@ -257,27 +257,27 @@ public: } } - inline TIterator Begin() noexcept { + inline TIterator Begin() noexcept { return LeftMost(); } - inline TConstIterator Begin() const noexcept { + inline TConstIterator Begin() const noexcept { return LeftMost(); } - inline TIterator End() noexcept { + inline TIterator End() noexcept { return &this->Data_; } - inline TConstIterator End() const noexcept { + inline TConstIterator End() const noexcept { return const_cast<TBasePtr>(&this->Data_); } - inline bool Empty() const noexcept { + inline bool Empty() const noexcept { return this->Begin() == this->End(); } - inline explicit operator bool() const noexcept { + inline explicit operator bool() const noexcept { return !this->Empty(); } @@ -314,19 +314,19 @@ public: } } - inline void Erase(TValue& val) noexcept { + inline void Erase(TValue& val) noexcept { val.UnLink(); } - inline void Erase(TValue* val) noexcept { + inline void Erase(TValue* val) noexcept { Erase(*val); } - inline void Erase(TIterator pos) noexcept { + inline void Erase(TIterator pos) noexcept { Erase(*pos); } - inline void EraseImpl(TNodeBase* val) noexcept { + inline void EraseImpl(TNodeBase* val) noexcept { TRbGlobalInst::RebalanceForErase(val, this->Data_.Parent_, this->Data_.Left_, this->Data_.Right_); } diff --git a/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp b/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp index c34ed1fd9b4..b1fb8d4a598 100644 --- a/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp +++ b/library/cpp/containers/intrusive_rb_tree/rb_tree_ut.cpp @@ -26,7 +26,7 @@ class TRedBlackTreeTest: public TTestBase { class TNode: public TRbTreeItem<TNode, TCmp> { public: - inline TNode(int n) noexcept + inline TNode(int n) noexcept : N(n) { } @@ -51,7 +51,7 @@ class TRedBlackTreeTest: public TTestBase { private: inline void TestStress() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; for (int i = 0; i < 1000; ++i) { nodes.push_back(new TNode(i)); @@ -78,7 +78,7 @@ private: } inline void TestGettingIndexWithDifferentValues() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; size_t N = 1000; for (size_t i = 0; i < N; ++i) { @@ -105,7 +105,7 @@ private: } inline void TestCheckChildrenAfterErase() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; size_t N = 1000; for (size_t i = 0; i < N; ++i) { @@ -138,7 +138,7 @@ private: } inline void TestGettingIndexWithDifferentValuesAfterErase() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; size_t N = 1000; for (size_t i = 0; i < N; ++i) { @@ -176,7 +176,7 @@ private: } inline void TestGettingIndexWithEqualValues() { - TVector<TSimpleSharedPtr<TNode>> nodes; + TVector<TSimpleSharedPtr<TNode>> nodes; size_t N = 1000; for (size_t i = 0; i < N; ++i) { diff --git a/library/cpp/containers/ring_buffer/ring_buffer.h b/library/cpp/containers/ring_buffer/ring_buffer.h index 41220dcf6bf..a7e694b17c7 100644 --- a/library/cpp/containers/ring_buffer/ring_buffer.h +++ b/library/cpp/containers/ring_buffer/ring_buffer.h @@ -68,7 +68,7 @@ private: private: size_t MaxSize; size_t Begin = 0; - TVector<T> Items; + TVector<T> Items; }; template <typename T, size_t maxSize> diff --git a/library/cpp/containers/sorted_vector/sorted_vector.h b/library/cpp/containers/sorted_vector/sorted_vector.h index 123539af9e2..d9a242ab590 100644 --- a/library/cpp/containers/sorted_vector/sorted_vector.h +++ b/library/cpp/containers/sorted_vector/sorted_vector.h @@ -50,9 +50,9 @@ namespace NSorted { // Sorted vector, which is order by the key. The key is extracted from the value by the provided key-extractor template <typename TValueType, typename TKeyType = TValueType, class TKeyExtractor = TIdentity, class TPredicate = TLess<TKeyType>, class A = std::allocator<TValueType>> - class TSortedVector: public TVector<TValueType, A> { + class TSortedVector: public TVector<TValueType, A> { private: - typedef TVector<TValueType, A> TBase; + typedef TVector<TValueType, A> TBase; typedef NPrivate::TKeyCompare<TValueType, TPredicate, TKeyExtractor> TKeyCompare; typedef NPrivate::TEqual<TKeyCompare> TValueEqual; typedef NPrivate::TEqual<TPredicate> TKeyEqual; @@ -364,7 +364,7 @@ namespace NSorted { inline TValueType& Get(const TKeyType& key) { typename TBase::iterator i = TBase::LowerBound(key); if (i == TBase::end() || key != i->first) - return TVector<std::pair<TKeyType, TValueType>, A>::insert(i, std::make_pair(key, TValueType()))->second; + return TVector<std::pair<TKeyType, TValueType>, A>::insert(i, std::make_pair(key, TValueType()))->second; else return i->second; } @@ -437,7 +437,7 @@ namespace NSorted { inline TValueType& Get(const TKeyType& key) { typename TBase::iterator i = TBase::LowerBound(key); if (i == TBase::end() || !TKeyEqual()(TKeyExtractor()(*i), key)) - i = TVector<TValueType, A>::insert(i, TValueType(key)); + i = TVector<TValueType, A>::insert(i, TValueType(key)); return *i; } diff --git a/library/cpp/containers/stack_array/range_ops.h b/library/cpp/containers/stack_array/range_ops.h index 1d40341aa19..7b61b157588 100644 --- a/library/cpp/containers/stack_array/range_ops.h +++ b/library/cpp/containers/stack_array/range_ops.h @@ -7,7 +7,7 @@ namespace NRangeOps { template <class T, bool isTrivial> struct TRangeOpsBase { - static inline void DestroyRange(T* b, T* e) noexcept { + static inline void DestroyRange(T* b, T* e) noexcept { while (e > b) { (--e)->~T(); } @@ -30,10 +30,10 @@ namespace NRangeOps { template <class T> struct TRangeOpsBase<T, true> { - static inline void DestroyRange(T*, T*) noexcept { + static inline void DestroyRange(T*, T*) noexcept { } - static inline void InitializeRange(T*, T*) noexcept { + static inline void InitializeRange(T*, T*) noexcept { } }; @@ -41,7 +41,7 @@ namespace NRangeOps { using TRangeOps = TRangeOpsBase<T, TTypeTraits<T>::IsPod>; template <class T> - static inline void DestroyRange(T* b, T* e) noexcept { + static inline void DestroyRange(T* b, T* e) noexcept { TRangeOps<T>::DestroyRange(b, e); } diff --git a/library/cpp/containers/stack_array/stack_array.h b/library/cpp/containers/stack_array/stack_array.h index 28e49bfc3c2..9f097da72c1 100644 --- a/library/cpp/containers/stack_array/stack_array.h +++ b/library/cpp/containers/stack_array/stack_array.h @@ -2,12 +2,12 @@ #include "range_ops.h" -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/system/defaults.h> /* For alloca. */ namespace NStackArray { /** - * A stack-allocated array. Should be used instead of � variable length + * A stack-allocated array. Should be used instead of � variable length * arrays that are not part of C++ standard. * * Example usage: @@ -31,7 +31,7 @@ namespace NStackArray { NRangeOps::InitializeRange(this->begin(), this->end()); } - inline ~TStackArray() { + inline ~TStackArray() { NRangeOps::DestroyRange(this->begin(), this->end()); } }; diff --git a/library/cpp/containers/stack_vector/stack_vec.h b/library/cpp/containers/stack_vector/stack_vec.h index fcc5d9a2a50..bb90c55381a 100644 --- a/library/cpp/containers/stack_vector/stack_vec.h +++ b/library/cpp/containers/stack_vector/stack_vec.h @@ -7,7 +7,7 @@ // A vector preallocated on the stack. // After exceeding the preconfigured stack space falls back to the heap. -// Publicly inherits TVector, but disallows swap (and hence shrink_to_fit, also operator= is reimplemented via copying). +// Publicly inherits TVector, but disallows swap (and hence shrink_to_fit, also operator= is reimplemented via copying). // // Inspired by: http://qt-project.org/doc/qt-4.8/qvarlengtharray.html#details diff --git a/library/cpp/containers/str_map/str_map.h b/library/cpp/containers/str_map/str_map.h index 31b00d1b997..0be25902e69 100644 --- a/library/cpp/containers/str_map/str_map.h +++ b/library/cpp/containers/str_map/str_map.h @@ -35,12 +35,12 @@ pool_insert(Map* m, const char* key, const typename Map::mapped_type& data, TBuf #define AVERAGEWORD_BUF 10 template <class T, class HashFcn, class EqualTo, class Alloc> -class string_hash: public THashMap<const char*, T, HashFcn, EqualTo, Alloc> { +class string_hash: public THashMap<const char*, T, HashFcn, EqualTo, Alloc> { protected: TBuffer pool; public: - using yh = THashMap<const char*, T, HashFcn, EqualTo, Alloc>; + using yh = THashMap<const char*, T, HashFcn, EqualTo, Alloc>; using iterator = typename yh::iterator; using const_iterator = typename yh::const_iterator; using mapped_type = typename yh::mapped_type; @@ -50,7 +50,7 @@ public: pool.Reserve(HASH_SIZE_DEFAULT * AVERAGEWORD_BUF); // reserve here } string_hash(size_type hash_size, pool_size_type pool_size) - : THashMap<const char*, T, HashFcn, EqualTo, Alloc>(hash_size) + : THashMap<const char*, T, HashFcn, EqualTo, Alloc>(hash_size) { pool.Reserve(pool_size); // reserve here } @@ -68,14 +68,14 @@ public: } string_hash(const string_hash& sh) - : THashMap<const char*, T, HashFcn, EqualTo, Alloc>() + : THashMap<const char*, T, HashFcn, EqualTo, Alloc>() { for (const_iterator i = sh.begin(); i != sh.end(); ++i) insert_copy((*i).first, (*i).second); } /* May be faster? string_hash(const string_hash& sh) - : THashMap<const char *, T, HashFcn, EqualTo>(sh) + : THashMap<const char *, T, HashFcn, EqualTo>(sh) { pool = sh.pool; size_t delta = pool.begin() - sh.pool.begin(); @@ -101,12 +101,12 @@ public: }; template <class C, class T, class HashFcn, class EqualTo> -class THashWithSegmentedPoolForKeys: protected THashMap<const C*, T, HashFcn, EqualTo>, TNonCopyable { +class THashWithSegmentedPoolForKeys: protected THashMap<const C*, T, HashFcn, EqualTo>, TNonCopyable { protected: segmented_pool<C> pool; public: - using yh = THashMap<const C*, T, HashFcn, EqualTo>; + using yh = THashMap<const C*, T, HashFcn, EqualTo>; using iterator = typename yh::iterator; using const_iterator = typename yh::const_iterator; using mapped_type = typename yh::mapped_type; @@ -170,7 +170,7 @@ public: return yh::find(key); } - const yh& get_THashMap() const { + const yh& get_THashMap() const { return static_cast<const yh&>(*this); } }; diff --git a/library/cpp/containers/top_keeper/top_keeper.h b/library/cpp/containers/top_keeper/top_keeper.h index 2f282b5a9e1..d25adb079fb 100644 --- a/library/cpp/containers/top_keeper/top_keeper.h +++ b/library/cpp/containers/top_keeper/top_keeper.h @@ -10,7 +10,7 @@ class TTopKeeper { private: class TVectorWithMin { private: - TVector<T, Alloc> Internal; + TVector<T, Alloc> Internal; size_t HalfMaxSize; TComparator Comparer; size_t MinElementIndex; diff --git a/library/cpp/containers/top_keeper/top_keeper/top_keeper.h b/library/cpp/containers/top_keeper/top_keeper/top_keeper.h index 2f282b5a9e1..d25adb079fb 100644 --- a/library/cpp/containers/top_keeper/top_keeper/top_keeper.h +++ b/library/cpp/containers/top_keeper/top_keeper/top_keeper.h @@ -10,7 +10,7 @@ class TTopKeeper { private: class TVectorWithMin { private: - TVector<T, Alloc> Internal; + TVector<T, Alloc> Internal; size_t HalfMaxSize; TComparator Comparer; size_t MinElementIndex; diff --git a/library/cpp/containers/top_keeper/top_keeper/ut/top_keeper_ut.cpp b/library/cpp/containers/top_keeper/top_keeper/ut/top_keeper_ut.cpp index a938279025d..724132aed98 100644 --- a/library/cpp/containers/top_keeper/top_keeper/ut/top_keeper_ut.cpp +++ b/library/cpp/containers/top_keeper/top_keeper/ut/top_keeper_ut.cpp @@ -163,14 +163,14 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { typedef std::pair<float, unsigned int> TElementType; const size_t randomTriesCount = 128; - for (size_t i1 = 0; i1 < randomTriesCount; ++i1) { + for (size_t i1 = 0; i1 < randomTriesCount; ++i1) { const size_t desiredElementsCount = RandomNumber<size_t>(5) + 1; TLimitedHeap<TElementType> h1(desiredElementsCount); TTopKeeper<TElementType> h2(desiredElementsCount); const size_t elementsToInsert = RandomNumber<size_t>(10) + desiredElementsCount; UNIT_ASSERT_C(desiredElementsCount <= elementsToInsert, "Test internal invariant is broken"); - for (size_t i2 = 0; i2 < elementsToInsert; ++i2) { + for (size_t i2 = 0; i2 < elementsToInsert; ++i2) { const auto f = RandomNumber<float>(); const auto id = RandomNumber<unsigned int>(); @@ -185,7 +185,7 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { UNIT_ASSERT_EQUAL(h2.GetSize(), desiredElementsCount); const auto n = h2.GetSize(); - for (size_t i3 = 0; i3 < n; ++i3) { + for (size_t i3 = 0; i3 < n; ++i3) { UNIT_ASSERT_EQUAL(h1.GetMin(), h2.GetNext()); h1.PopMin(); h2.Pop(); @@ -195,7 +195,7 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { Y_UNIT_TEST(CopyKeeperRegressionCase) { using TKeeper = TTopKeeper<float>; - TVector<TKeeper> v(2, TKeeper(200)); + TVector<TKeeper> v(2, TKeeper(200)); auto& k = v[1]; for (size_t i = 0; i < 100; ++i) { k.Insert(RandomNumber<float>()); diff --git a/library/cpp/containers/top_keeper/ut/top_keeper_ut.cpp b/library/cpp/containers/top_keeper/ut/top_keeper_ut.cpp index a938279025d..724132aed98 100644 --- a/library/cpp/containers/top_keeper/ut/top_keeper_ut.cpp +++ b/library/cpp/containers/top_keeper/ut/top_keeper_ut.cpp @@ -163,14 +163,14 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { typedef std::pair<float, unsigned int> TElementType; const size_t randomTriesCount = 128; - for (size_t i1 = 0; i1 < randomTriesCount; ++i1) { + for (size_t i1 = 0; i1 < randomTriesCount; ++i1) { const size_t desiredElementsCount = RandomNumber<size_t>(5) + 1; TLimitedHeap<TElementType> h1(desiredElementsCount); TTopKeeper<TElementType> h2(desiredElementsCount); const size_t elementsToInsert = RandomNumber<size_t>(10) + desiredElementsCount; UNIT_ASSERT_C(desiredElementsCount <= elementsToInsert, "Test internal invariant is broken"); - for (size_t i2 = 0; i2 < elementsToInsert; ++i2) { + for (size_t i2 = 0; i2 < elementsToInsert; ++i2) { const auto f = RandomNumber<float>(); const auto id = RandomNumber<unsigned int>(); @@ -185,7 +185,7 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { UNIT_ASSERT_EQUAL(h2.GetSize(), desiredElementsCount); const auto n = h2.GetSize(); - for (size_t i3 = 0; i3 < n; ++i3) { + for (size_t i3 = 0; i3 < n; ++i3) { UNIT_ASSERT_EQUAL(h1.GetMin(), h2.GetNext()); h1.PopMin(); h2.Pop(); @@ -195,7 +195,7 @@ Y_UNIT_TEST_SUITE(TTopKeeperTest) { Y_UNIT_TEST(CopyKeeperRegressionCase) { using TKeeper = TTopKeeper<float>; - TVector<TKeeper> v(2, TKeeper(200)); + TVector<TKeeper> v(2, TKeeper(200)); auto& k = v[1]; for (size_t i = 0; i < 100; ++i) { k.Insert(RandomNumber<float>()); diff --git a/library/cpp/coroutine/engine/coroutine_ut.cpp b/library/cpp/coroutine/engine/coroutine_ut.cpp index 8b372496a2e..fcc9a5a641d 100644 --- a/library/cpp/coroutine/engine/coroutine_ut.cpp +++ b/library/cpp/coroutine/engine/coroutine_ut.cpp @@ -125,11 +125,11 @@ void TCoroTest::TestException() { UNIT_ASSERT(!unc); } -static int i0; +static int i0; static void CoRun(TCont* c, void* /*run*/) { - while (i0 < 100000) { - ++i0; + while (i0 < 100000) { + ++i0; UNIT_ASSERT(RunningCont() == c); c->Yield(); UNIT_ASSERT(RunningCont() == c); @@ -137,7 +137,7 @@ static void CoRun(TCont* c, void* /*run*/) { } static void CoMain(TCont* c, void* /*arg*/) { - for (volatile size_t i2 = 0; i2 < 10; ++i2) { + for (volatile size_t i2 = 0; i2 < 10; ++i2) { UNIT_ASSERT(RunningCont() == c); c->Executor()->Create(CoRun, nullptr, "run"); UNIT_ASSERT(RunningCont() == c); @@ -192,7 +192,7 @@ public: }; void TCoroTest::TestMemFun() { - i0 = 0; + i0 = 0; TContExecutor e(32000); TTestObject obj; e.Create<TTestObject, &TTestObject::RunTask1>(&obj, "test1"); @@ -203,25 +203,25 @@ void TCoroTest::TestMemFun() { void TCoroTest::TestSimpleX2() { { - i0 = 0; + i0 = 0; { TContExecutor e(32000); e.Execute(CoMain); } - UNIT_ASSERT_EQUAL(i0, 100000); + UNIT_ASSERT_EQUAL(i0, 100000); } { - i0 = 0; + i0 = 0; { TContExecutor e(32000); e.Execute(CoMain); } - UNIT_ASSERT_EQUAL(i0, 100000); + UNIT_ASSERT_EQUAL(i0, 100000); } } @@ -243,7 +243,7 @@ void TCoroTest::TestSimpleX3() { TContExecutor e(32000); TRunner runner; - for (volatile size_t i3 = 0; i3 < 1000; ++i3) { + for (volatile size_t i3 = 0; i3 < 1000; ++i3) { e.Create(runner, "runner"); } @@ -252,7 +252,7 @@ void TCoroTest::TestSimpleX3() { UNIT_ASSERT_EQUAL(runner.Runs, 1000); } -static TString res; +static TString res; static TContMutex mutex; static void CoMutex(TCont* c, void* /*run*/) { @@ -289,7 +289,7 @@ static TContMutex m1; static TContCondVar c1; static void CoCondVar(TCont* c, void* /*run*/) { - for (size_t i4 = 0; i4 < 3; ++i4) { + for (size_t i4 = 0; i4 < 3; ++i4) { UNIT_ASSERT_EQUAL(m1.LockI(c), 0); UNIT_ASSERT_EQUAL(c1.WaitI(c, &m1), 0); res += c->Name(); @@ -311,8 +311,8 @@ static void CoCondVarTest(TCont* c, void* /*run*/) { c->Executor()->Create(CoCondVar, nullptr, "6"); c->Yield(); - for (size_t i5 = 0; i5 < 3; ++i5) { - res += ToString((size_t)i5) + "^"; + for (size_t i5 = 0; i5 < 3; ++i5) { + res += ToString((size_t)i5) + "^"; c1.BroadCast(); c->Yield(); } diff --git a/library/cpp/coroutine/engine/impl.h b/library/cpp/coroutine/engine/impl.h index 283a96ecf11..0abfa5582ce 100644 --- a/library/cpp/coroutine/engine/impl.h +++ b/library/cpp/coroutine/engine/impl.h @@ -160,7 +160,7 @@ public: NCoro::ITime* time = nullptr ); - ~TContExecutor(); + ~TContExecutor(); // if we already have a coroutine to run void Execute() noexcept; diff --git a/library/cpp/coroutine/engine/poller.cpp b/library/cpp/coroutine/engine/poller.cpp index 61164fa56bf..73398d8e651 100644 --- a/library/cpp/coroutine/engine/poller.cpp +++ b/library/cpp/coroutine/engine/poller.cpp @@ -128,11 +128,11 @@ namespace { } }; - typedef TIntrusiveList<TVal> TListType; + typedef TIntrusiveList<TVal> TListType; public: - typedef typename TListType::TIterator TIterator; - typedef typename TListType::TConstIterator TConstIterator; + typedef typename TListType::TIterator TIterator; + typedef typename TListType::TConstIterator TConstIterator; TIndexedArray() : P_(TMemoryPool::TExpGrow::Instance(), TDefaultAllocator::Instance()) @@ -184,7 +184,7 @@ namespace { using TValRef = THolder<TVal>; typename TVal::TPool P_; TSocketMap<TValRef> V_; - TListType I_; + TListType I_; }; @@ -306,7 +306,7 @@ namespace { private: typedef TIndexedArray<TChange> TFds; TFds S_; - typedef TVector<pollfd> TPollVec; + typedef TVector<pollfd> TPollVec; TPollVec T_; }; diff --git a/library/cpp/coroutine/engine/sockmap.h b/library/cpp/coroutine/engine/sockmap.h index fd189e17746..193ec2261be 100644 --- a/library/cpp/coroutine/engine/sockmap.h +++ b/library/cpp/coroutine/engine/sockmap.h @@ -19,6 +19,6 @@ public: } private: - TVector<T> V_; - THashMap<size_t, T> H_; + TVector<T> V_; + THashMap<size_t, T> H_; }; diff --git a/library/cpp/coroutine/engine/sockpool.h b/library/cpp/coroutine/engine/sockpool.h index 1ebb7e7b382..953f4f600ca 100644 --- a/library/cpp/coroutine/engine/sockpool.h +++ b/library/cpp/coroutine/engine/sockpool.h @@ -77,7 +77,7 @@ class TPooledSocket { } private: - inline void ReturnToPool() noexcept; + inline void ReturnToPool() noexcept; private: TSocketPool* Pool_; @@ -222,7 +222,7 @@ private: TMutex Mutex_; }; -inline void TPooledSocket::TImpl::ReturnToPool() noexcept { +inline void TPooledSocket::TImpl::ReturnToPool() noexcept { Pool_->Release(this); } diff --git a/library/cpp/coroutine/listener/listen.cpp b/library/cpp/coroutine/listener/listen.cpp index 3d4e711d1d5..58795e07e4e 100644 --- a/library/cpp/coroutine/listener/listen.cpp +++ b/library/cpp/coroutine/listener/listen.cpp @@ -16,12 +16,12 @@ namespace { const sockaddr_in* In; const sockaddr_in6* In6; - inline TSa(const sockaddr* sa) noexcept + inline TSa(const sockaddr* sa) noexcept : Sa(sa) { } - inline bool operator==(const TSa& r) const noexcept { + inline bool operator==(const TSa& r) const noexcept { if (Sa->sa_family == r.Sa->sa_family) { switch (Sa->sa_family) { case AF_INET: @@ -34,7 +34,7 @@ namespace { return false; } - inline bool operator!=(const TSa& r) const noexcept { + inline bool operator!=(const TSa& r) const noexcept { return !(*this == r); } }; @@ -43,7 +43,7 @@ namespace { class TContListener::TImpl { private: struct TStoredAddrInfo: public TAddrInfo, private TNetworkAddress { - inline TStoredAddrInfo(const struct addrinfo* ai, const TNetworkAddress& addr) noexcept + inline TStoredAddrInfo(const struct addrinfo* ai, const TNetworkAddress& addr) noexcept : TAddrInfo(ai) , TNetworkAddress(addr) { @@ -84,12 +84,12 @@ private: } } - inline ~TOneSocketListener() { + inline ~TOneSocketListener() { Stop(); } public: - inline void Run(TCont* cont) noexcept { + inline void Run(TCont* cont) noexcept { C_ = cont; DoRun(); C_ = nullptr; @@ -111,11 +111,11 @@ private: } } - inline const IRemoteAddr* Addr() const noexcept { + inline const IRemoteAddr* Addr() const noexcept { return Addr_.Get(); } - inline void Stop() noexcept { + inline void Stop() noexcept { if (C_) { C_->Cancel(); @@ -126,7 +126,7 @@ private: } private: - inline void DoRun() noexcept { + inline void DoRun() noexcept { while (!C_->Cancelled()) { try { TOpaqueAddr remote; @@ -208,7 +208,7 @@ private: }; public: - inline TImpl(ICallBack* cb, TContExecutor* e, const TOptions& opts) noexcept + inline TImpl(ICallBack* cb, TContExecutor* e, const TOptions& opts) noexcept : E_(e) , Cb_(cb) , Opts_(opts) @@ -274,7 +274,7 @@ TContListener::TContListener(ICallBack* cb, TContExecutor* e, const TOptions& op { } -TContListener::~TContListener() { +TContListener::~TContListener() { } namespace { @@ -315,7 +315,7 @@ void TContListener::Bind(const TNetworkAddress& addr) { CheckImpl(Impl_)->Bind(addr); } -void TContListener::Stop() noexcept { +void TContListener::Stop() noexcept { Impl_.Destroy(); } diff --git a/library/cpp/coroutine/listener/listen.h b/library/cpp/coroutine/listener/listen.h index 3a89cd3eccc..22d3da85f39 100644 --- a/library/cpp/coroutine/listener/listen.h +++ b/library/cpp/coroutine/listener/listen.h @@ -15,7 +15,7 @@ namespace NAddr { class TContListener { public: struct TOptions { - inline TOptions() noexcept + inline TOptions() noexcept : ListenQueue(Max<size_t>()) , SendBufSize(0) , RecvBufSize(0) @@ -24,31 +24,31 @@ public: { } - inline TOptions& SetListenQueue(size_t len) noexcept { + inline TOptions& SetListenQueue(size_t len) noexcept { ListenQueue = len; return *this; } - inline TOptions& SetDeferAccept(bool enable) noexcept { + inline TOptions& SetDeferAccept(bool enable) noexcept { EnableDeferAccept = enable; return *this; } - inline TOptions& SetSendBufSize(unsigned size) noexcept { + inline TOptions& SetSendBufSize(unsigned size) noexcept { SendBufSize = size; return *this; } - inline TOptions& SetRecvBufSize(unsigned size) noexcept { + inline TOptions& SetRecvBufSize(unsigned size) noexcept { RecvBufSize = size; return *this; } - inline TOptions& SetReusePort(bool reusePort) noexcept { + inline TOptions& SetReusePort(bool reusePort) noexcept { ReusePort = reusePort; return *this; @@ -93,7 +93,7 @@ public: }; TContListener(ICallBack* cb, TContExecutor* e, const TOptions& opts = TOptions()); - ~TContListener(); + ~TContListener(); /// start listener threads void Listen(); @@ -107,7 +107,7 @@ public: void Bind(const TIpAddress& addr); void Bind(const TNetworkAddress& addr); - void Stop() noexcept; + void Stop() noexcept; void StopListenAddr(const NAddr::IRemoteAddr& addr); void StopListenAddr(const TIpAddress& addr); diff --git a/library/cpp/dbg_output/dump.h b/library/cpp/dbg_output/dump.h index c7efa105ee6..d80209c4d0a 100644 --- a/library/cpp/dbg_output/dump.h +++ b/library/cpp/dbg_output/dump.h @@ -59,7 +59,7 @@ namespace NPrivate { } } - THashSet<size_t> Visited; + THashSet<size_t> Visited; }; }; @@ -77,7 +77,7 @@ namespace NPrivate { d << *T_; } - inline TDbgDump& SetIndent(bool v) noexcept { + inline TDbgDump& SetIndent(bool v) noexcept { Indent = v; return *this; diff --git a/library/cpp/dbg_output/dumpers.h b/library/cpp/dbg_output/dumpers.h index 4868e97da07..d37b1fe652b 100644 --- a/library/cpp/dbg_output/dumpers.h +++ b/library/cpp/dbg_output/dumpers.h @@ -4,7 +4,7 @@ #include <util/generic/fwd.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> //smart pointers template <class T, class D> @@ -91,7 +91,7 @@ struct TDumper<std::pair<A, B>> { //sequences template <class T, class A> -struct TDumper<TVector<T, A>>: public TSeqDumper { +struct TDumper<TVector<T, A>>: public TSeqDumper { }; template <class T, class A> @@ -107,49 +107,49 @@ struct TDumper<std::array<T, N>>: public TSeqDumper { }; template <class T, class A> -struct TDumper<TDeque<T, A>>: public TSeqDumper { +struct TDumper<TDeque<T, A>>: public TSeqDumper { }; template <class T, class A> -struct TDumper<TList<T, A>>: public TSeqDumper { +struct TDumper<TList<T, A>>: public TSeqDumper { }; //associatives template <class K, class V, class P, class A> -struct TDumper<TMap<K, V, P, A>>: public TAssocDumper { +struct TDumper<TMap<K, V, P, A>>: public TAssocDumper { }; template <class K, class V, class P, class A> -struct TDumper<TMultiMap<K, V, P, A>>: public TAssocDumper { +struct TDumper<TMultiMap<K, V, P, A>>: public TAssocDumper { }; template <class T, class P, class A> -struct TDumper<TSet<T, P, A>>: public TAssocDumper { +struct TDumper<TSet<T, P, A>>: public TAssocDumper { }; template <class T, class P, class A> -struct TDumper<TMultiSet<T, P, A>>: public TAssocDumper { +struct TDumper<TMultiSet<T, P, A>>: public TAssocDumper { }; template <class K, class V, class H, class P, class A> -struct TDumper<THashMap<K, V, H, P, A>>: public TAssocDumper { +struct TDumper<THashMap<K, V, H, P, A>>: public TAssocDumper { }; template <class K, class V, class H, class P, class A> -struct TDumper<THashMultiMap<K, V, H, P, A>>: public TAssocDumper { +struct TDumper<THashMultiMap<K, V, H, P, A>>: public TAssocDumper { }; template <class T, class H, class P, class A> -struct TDumper<THashSet<T, H, P, A>>: public TAssocDumper { +struct TDumper<THashSet<T, H, P, A>>: public TAssocDumper { }; template <class T, class H, class P, class A> -struct TDumper<THashMultiSet<T, H, P, A>>: public TAssocDumper { +struct TDumper<THashMultiSet<T, H, P, A>>: public TAssocDumper { }; //strings template <> -struct TDumper<TString>: public TStrDumper { +struct TDumper<TString>: public TStrDumper { }; template <> @@ -157,7 +157,7 @@ struct TDumper<const char*>: public TStrDumper { }; template <> -struct TDumper<TUtf16String>: public TStrDumper { +struct TDumper<TUtf16String>: public TStrDumper { }; template <> diff --git a/library/cpp/dbg_output/engine.cpp b/library/cpp/dbg_output/engine.cpp index dcb9f02522a..2057b414366 100644 --- a/library/cpp/dbg_output/engine.cpp +++ b/library/cpp/dbg_output/engine.cpp @@ -9,7 +9,7 @@ DBGDUMP_INLINE_IF_INCLUDED void TDumpBase::String(const TStringBuf& s) { if (s) { - Raw(TString(s).Quote()); + Raw(TString(s).Quote()); } else { Raw("(empty)"); } diff --git a/library/cpp/dbg_output/engine.h b/library/cpp/dbg_output/engine.h index f13c728c391..a0e9f1c5ade 100644 --- a/library/cpp/dbg_output/engine.h +++ b/library/cpp/dbg_output/engine.h @@ -62,7 +62,7 @@ struct TIndentScope { ++(D->IndentLevel); } - inline ~TIndentScope() { + inline ~TIndentScope() { --(D->IndentLevel); } @@ -80,7 +80,7 @@ static inline TRawLiteral<TChar> DumpRaw(const TBasicStringBuf<TChar>& s) noexce } template <class TChar> -static inline TRawLiteral<TChar> DumpRaw(const TChar* s) noexcept { +static inline TRawLiteral<TChar> DumpRaw(const TChar* s) noexcept { return {s}; } @@ -95,7 +95,7 @@ struct TDumper<TRawLiteral<C>> { struct TIndentNewLine { }; -static inline TIndentNewLine IndentNewLine() noexcept { +static inline TIndentNewLine IndentNewLine() noexcept { return {}; } diff --git a/library/cpp/dbg_output/ut/dbg_output_ut.cpp b/library/cpp/dbg_output/ut/dbg_output_ut.cpp index 7b285c84cb7..45a9512040a 100644 --- a/library/cpp/dbg_output/ut/dbg_output_ut.cpp +++ b/library/cpp/dbg_output/ut/dbg_output_ut.cpp @@ -34,14 +34,14 @@ DEFINE_DUMPER(TMyNS::TMyStruct, A, B) Y_UNIT_TEST_SUITE(TContainerPrintersTest) { Y_UNIT_TEST(TestVectorInt) { TStringStream out; - out << DbgDump(TVector<int>({1, 2, 3, 4, 5})); + out << DbgDump(TVector<int>({1, 2, 3, 4, 5})); UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "[1, 2, 3, 4, 5]"); } Y_UNIT_TEST(TestMapCharToCharArray) { TStringStream out; - TMap<char, const char*> m; + TMap<char, const char*> m; m['a'] = "SMALL LETTER A"; m['b'] = nullptr; @@ -53,7 +53,7 @@ Y_UNIT_TEST_SUITE(TContainerPrintersTest) { Y_UNIT_TEST(TestVectorOfVectors) { TStringStream out; - TVector<TVector<wchar16>> vec(2); + TVector<TVector<wchar16>> vec(2); vec[0].push_back(0); vec[1] = {wchar16('a')}; out << DbgDump(vec); @@ -78,7 +78,7 @@ Y_UNIT_TEST_SUITE(TContainerPrintersTest) { } Y_UNIT_TEST(TestColors) { - using TComplex = TMap<TString, TMap<int, char>>; + using TComplex = TMap<TString, TMap<int, char>>; TComplex test; test["a"][1] = '7'; test["b"][2] = '6'; diff --git a/library/cpp/deprecated/accessors/accessors.h b/library/cpp/deprecated/accessors/accessors.h index 6d4b1da3ad7..744dcb15d50 100644 --- a/library/cpp/deprecated/accessors/accessors.h +++ b/library/cpp/deprecated/accessors/accessors.h @@ -8,7 +8,7 @@ namespace NAccessors { * * i.e. this will work: * - * TString t; + * TString t; * const char* beg = NAccessors::Begin(t); // t.begin() * const char* end = NAccessors::End(t); // t.end() * size_t sz = NAccessors::Size(t); // t.size() diff --git a/library/cpp/deprecated/accessors/accessors_ut.cpp b/library/cpp/deprecated/accessors/accessors_ut.cpp index a9bdc9fcc42..2008c9edb99 100644 --- a/library/cpp/deprecated/accessors/accessors_ut.cpp +++ b/library/cpp/deprecated/accessors/accessors_ut.cpp @@ -58,27 +58,27 @@ private: TestRead(sbuf, "TStringBuf"); - TUtf16String wtr; + TUtf16String wtr; wtr.resize(10, 1024); - TestRead(wtr, "TUtf16String"); + TestRead(wtr, "TUtf16String"); TBuffer buf; buf.Resize(30); TestRead(buf, "TBuffer"); - TVector<ui64> vec(10, 100); + TVector<ui64> vec(10, 100); - TestRead(vec, "TVector<ui64>"); + TestRead(vec, "TVector<ui64>"); - TestWrite<TString>("TString"); - TestWrite<TVector<char>>("TVector<char>"); + TestWrite<TString>("TString"); + TestWrite<TVector<char>>("TVector<char>"); TestWrite<TBuffer>("TBuffer"); - TestWrite<TVector<ui64>>("TVector<ui64>"); - TestWrite<TUtf16String>("TUtf16String"); + TestWrite<TVector<ui64>>("TVector<ui64>"); + TestWrite<TUtf16String>("TUtf16String"); - std::array<TString, 10> sarr; + std::array<TString, 10> sarr; NAccessors::Init(sarr); NAccessors::Clear(sarr); diff --git a/library/cpp/deprecated/accessors/memory_traits.h b/library/cpp/deprecated/accessors/memory_traits.h index aa837705d3d..1d19b9de338 100644 --- a/library/cpp/deprecated/accessors/memory_traits.h +++ b/library/cpp/deprecated/accessors/memory_traits.h @@ -5,7 +5,7 @@ #include <util/memory/tempbuf.h> #include <util/generic/buffer.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/typetraits.h> @@ -108,7 +108,7 @@ struct TMemoryTraits<std::vector<T, TAlloc>>: public TElementDependentMemoryTrai }; template <typename T, typename TAlloc> -struct TMemoryTraits<TVector<T, TAlloc>>: public TMemoryTraits<std::vector<T, TAlloc>> { +struct TMemoryTraits<TVector<T, TAlloc>>: public TMemoryTraits<std::vector<T, TAlloc>> { }; template <typename T> @@ -126,7 +126,7 @@ struct TMemoryTraits<std::basic_string<T, TCharTraits, TAlloc>>: public TElement }; template <> -struct TMemoryTraits<TString>: public TElementDependentMemoryTraits<char> { +struct TMemoryTraits<TString>: public TElementDependentMemoryTraits<char> { enum { OwnsMemory = true }; diff --git a/library/cpp/deprecated/kmp/kmp.cpp b/library/cpp/deprecated/kmp/kmp.cpp index d02074c94ae..cb577b139f9 100644 --- a/library/cpp/deprecated/kmp/kmp.cpp +++ b/library/cpp/deprecated/kmp/kmp.cpp @@ -8,7 +8,7 @@ TKMPMatcher::TKMPMatcher(const char* patternBegin, const char* patternEnd) ComputePrefixFunction(); } -TKMPMatcher::TKMPMatcher(const TString& pattern) +TKMPMatcher::TKMPMatcher(const TString& pattern) : Pattern(pattern) { ComputePrefixFunction(); diff --git a/library/cpp/deprecated/kmp/kmp.h b/library/cpp/deprecated/kmp/kmp.h index a7f72eece6a..287382821d8 100644 --- a/library/cpp/deprecated/kmp/kmp.h +++ b/library/cpp/deprecated/kmp/kmp.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> @@ -32,13 +32,13 @@ void ComputePrefixFunction(const T* begin, const T* end, ssize_t** result) { class TKMPMatcher { private: TArrayHolder<ssize_t> PrefixFunction; - TString Pattern; + TString Pattern; void ComputePrefixFunction(); public: TKMPMatcher(const char* patternBegin, const char* patternEnd); - TKMPMatcher(const TString& pattern); + TKMPMatcher(const TString& pattern); bool SubStr(const char* begin, const char* end, const char*& result) const { Y_ASSERT(begin <= end); @@ -70,7 +70,7 @@ public: private: ICallback* Callback; TArrayHolder<ssize_t> PrefixFunction; - using TTVector = TVector<T>; + using TTVector = TVector<T>; TTVector Pattern; ssize_t State; TTVector Candidate; diff --git a/library/cpp/deprecated/kmp/kmp_ut.cpp b/library/cpp/deprecated/kmp/kmp_ut.cpp index c2eda83c57a..04e7cf27015 100644 --- a/library/cpp/deprecated/kmp/kmp_ut.cpp +++ b/library/cpp/deprecated/kmp/kmp_ut.cpp @@ -4,8 +4,8 @@ #include <util/stream/output.h> -static TVector<int> FindAll(const TString& pattern, const TString& string) { - TVector<int> result; +static TVector<int> FindAll(const TString& pattern, const TString& string) { + TVector<int> result; TKMPMatcher kmp(pattern); const char* pResult; const char* begin = string.begin(); @@ -25,7 +25,7 @@ class TTestKMP: public TTestBase { public: void Test() { - TVector<int> ans = {0, 2}; + TVector<int> ans = {0, 2}; UNIT_ASSERT_EQUAL(FindAll("a", "aba"), ans); ans = {0}; UNIT_ASSERT_EQUAL(FindAll("aba", "aba"), ans); diff --git a/library/cpp/deprecated/kmp/ut/ya.make b/library/cpp/deprecated/kmp/ut/ya.make index 9c54ee27154..e19f716c82f 100644 --- a/library/cpp/deprecated/kmp/ut/ya.make +++ b/library/cpp/deprecated/kmp/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/deprecated/kmp) - -OWNER(g:util) - -SRCS( - kmp_ut.cpp -) - -END() + +OWNER(g:util) + +SRCS( + kmp_ut.cpp +) + +END() diff --git a/library/cpp/deprecated/kmp/ya.make b/library/cpp/deprecated/kmp/ya.make index 7c1c5579344..f8969a33a54 100644 --- a/library/cpp/deprecated/kmp/ya.make +++ b/library/cpp/deprecated/kmp/ya.make @@ -1,10 +1,10 @@ -LIBRARY() - -OWNER(g:util) - -SRCS( - kmp.cpp - kmp.h -) - -END() +LIBRARY() + +OWNER(g:util) + +SRCS( + kmp.cpp + kmp.h +) + +END() diff --git a/library/cpp/deprecated/mapped_file/mapped_file.cpp b/library/cpp/deprecated/mapped_file/mapped_file.cpp index b0e4511299b..e6b9504969d 100644 --- a/library/cpp/deprecated/mapped_file/mapped_file.cpp +++ b/library/cpp/deprecated/mapped_file/mapped_file.cpp @@ -27,7 +27,7 @@ void TMappedFile::precharge(size_t off, size_t size) const { Map_->Precharge(off, size); } -void TMappedFile::init(const TString& name) { +void TMappedFile::init(const TString& name) { THolder<TFileMap> map(new TFileMap(name)); TMappedFile newFile(map.Get(), name.data()); Y_UNUSED(map.Release()); @@ -35,7 +35,7 @@ void TMappedFile::init(const TString& name) { newFile.term(); } -void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode om) { +void TMappedFile::init(const TString& name, size_t length, TFileMap::EOpenMode om) { THolder<TFileMap> map(new TFileMap(name, length, om)); TMappedFile newFile(map.Get(), name.data()); Y_UNUSED(map.Release()); @@ -51,7 +51,7 @@ void TMappedFile::init(const TFile& file, TFileMap::EOpenMode om, const char* db newFile.term(); } -void TMappedFile::init(const TString& name, TFileMap::EOpenMode om) { +void TMappedFile::init(const TString& name, TFileMap::EOpenMode om) { THolder<TFileMap> map(new TFileMap(name, om)); TMappedFile newFile(map.Get(), name.data()); Y_UNUSED(map.Release()); diff --git a/library/cpp/deprecated/mapped_file/mapped_file.h b/library/cpp/deprecated/mapped_file/mapped_file.h index 45859ed65a0..1675ccc3f7c 100644 --- a/library/cpp/deprecated/mapped_file/mapped_file.h +++ b/library/cpp/deprecated/mapped_file/mapped_file.h @@ -30,18 +30,18 @@ public: term(); } - explicit TMappedFile(const TString& name) { + explicit TMappedFile(const TString& name) { Map_ = nullptr; init(name, TFileMap::oRdOnly); } TMappedFile(const TFile& file, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown"); - void init(const TString& name); + void init(const TString& name); - void init(const TString& name, TFileMap::EOpenMode om); + void init(const TString& name, TFileMap::EOpenMode om); - void init(const TString& name, size_t length, TFileMap::EOpenMode om); + void init(const TString& name, size_t length, TFileMap::EOpenMode om); void init(const TFile&, TFileMap::EOpenMode om = TFileMap::oRdOnly, const char* dbgName = "unknown"); @@ -66,7 +66,7 @@ public: void precharge(size_t pos = 0, size_t size = (size_t)-1) const; - void swap(TMappedFile& file) noexcept { + void swap(TMappedFile& file) noexcept { DoSwap(Map_, file.Map_); } }; diff --git a/library/cpp/deprecated/split/delim_string_iter.cpp b/library/cpp/deprecated/split/delim_string_iter.cpp index af418c5bfb9..af4147c18b5 100644 --- a/library/cpp/deprecated/split/delim_string_iter.cpp +++ b/library/cpp/deprecated/split/delim_string_iter.cpp @@ -8,7 +8,7 @@ void TKeyValueDelimStringIter::ReadKeyAndValue() { TStringBuf currentToken(*DelimIter); size_t pos = currentToken.find('='); - if (pos == TString::npos) { + if (pos == TString::npos) { ChunkValue.Clear(); ChunkKey = currentToken; } else { diff --git a/library/cpp/deprecated/split/delim_string_iter_ut.cpp b/library/cpp/deprecated/split/delim_string_iter_ut.cpp index 18a8b2a1604..c3adb539640 100644 --- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp +++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp @@ -3,7 +3,7 @@ #include <library/cpp/testing/unittest/registar.h> /// Test that TDelimStringIter build on top of given string and delimeter will produce expected sequence -static void AssertStringSplit(const TString& str, const TString& delim, const TVector<TString>& expected) { +static void AssertStringSplit(const TString& str, const TString& delim, const TVector<TString>& expected) { TDelimStringIter it(str, delim); // test iterator invariants @@ -40,8 +40,8 @@ Y_UNIT_TEST_SUITE(TDelimStrokaIterTestSuite) { } Y_UNIT_TEST(ForIter) { - TVector<TStringBuf> expected = {"1", "", "3@4", ""}; - TVector<TStringBuf> got; + TVector<TStringBuf> expected = {"1", "", "3@4", ""}; + TVector<TStringBuf> got; for (TStringBuf x : TDelimStroka("1@@@@3@4@@", "@@")) { got.push_back(x); @@ -54,7 +54,7 @@ Y_UNIT_TEST_SUITE(TDelimStrokaIterTestSuite) { static void AssertKeyValueStringSplit( const TStringBuf str, const TStringBuf delim, - const TVector<std::pair<TStringBuf, TStringBuf>>& expected) { + const TVector<std::pair<TStringBuf, TStringBuf>>& expected) { TKeyValueDelimStringIter it(str, delim); for (const auto& expectedKeyValue : expected) { diff --git a/library/cpp/deprecated/split/split_iterator.cpp b/library/cpp/deprecated/split/split_iterator.cpp index 32262d25bd1..c56a80e7220 100644 --- a/library/cpp/deprecated/split/split_iterator.cpp +++ b/library/cpp/deprecated/split/split_iterator.cpp @@ -21,7 +21,7 @@ TSplitBase::TSplitBase(const char* str, size_t length) { } -TSplitBase::TSplitBase(const TString& s) +TSplitBase::TSplitBase(const TString& s) : Str(s.data()) , Len(s.size()) { @@ -35,7 +35,7 @@ TDelimitersSplit::TDelimitersSplit(const char* str, size_t length, const TSplitD { } -TDelimitersSplit::TDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters) +TDelimitersSplit::TDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters) : TSplitBase(s) , Delimiters(delimiters) { @@ -72,7 +72,7 @@ TDelimitersStrictSplit::TDelimitersStrictSplit(const char* str, size_t length, c { } -TDelimitersStrictSplit::TDelimitersStrictSplit(const TString& s, const TSplitDelimiters& delimiters) +TDelimitersStrictSplit::TDelimitersStrictSplit(const TString& s, const TSplitDelimiters& delimiters) : TSplitBase(s) , Delimiters(delimiters) { @@ -100,7 +100,7 @@ size_t TDelimitersStrictSplit::Begin() const { /****************** TScreenedDelimitersSplit ******************/ -TScreenedDelimitersSplit::TScreenedDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters, const TSplitDelimiters& screens) +TScreenedDelimitersSplit::TScreenedDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters, const TSplitDelimiters& screens) : TSplitBase(s) , Delimiters(delimiters) , Screens(screens) @@ -148,7 +148,7 @@ TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const char* str, size_t { } -TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const TString& s, const TSplitDelimiters& delimiters) +TDelimitersSplitWithoutTags::TDelimitersSplitWithoutTags(const TString& s, const TSplitDelimiters& delimiters) : TSplitBase(s) , Delimiters(delimiters) { @@ -204,7 +204,7 @@ TCharSplit::TCharSplit(const char* str, size_t length) { } -TCharSplit::TCharSplit(const TString& s) +TCharSplit::TCharSplit(const TString& s) : TSplitBase(s) { } @@ -230,7 +230,7 @@ TCharSplitWithoutTags::TCharSplitWithoutTags(const char* str, size_t length) { } -TCharSplitWithoutTags::TCharSplitWithoutTags(const TString& s) +TCharSplitWithoutTags::TCharSplitWithoutTags(const TString& s) : TSplitBase(s) { } @@ -274,7 +274,7 @@ TCharSplitWithoutTags::TIterator TCharSplitWithoutTags::Iterator() const { return TIterator(*this); } -TSubstringSplitDelimiter::TSubstringSplitDelimiter(const TString& s) +TSubstringSplitDelimiter::TSubstringSplitDelimiter(const TString& s) : Matcher(s) , Len(s.size()) { @@ -288,7 +288,7 @@ TSubstringSplit::TSubstringSplit(const char* str, size_t length, const TSubstrin { } -TSubstringSplit::TSubstringSplit(const TString& str, const TSubstringSplitDelimiter& delimiter) +TSubstringSplit::TSubstringSplit(const TString& str, const TSubstringSplitDelimiter& delimiter) : TSplitBase(str) , Delimiter(delimiter) { diff --git a/library/cpp/deprecated/split/split_iterator.h b/library/cpp/deprecated/split/split_iterator.h index 0eacc29228e..23ba85bbec4 100644 --- a/library/cpp/deprecated/split/split_iterator.h +++ b/library/cpp/deprecated/split/split_iterator.h @@ -8,7 +8,7 @@ #include <util/system/yassert.h> #include <util/system/defaults.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> @@ -45,12 +45,12 @@ using TSizeTRegion = TNumPair<size_t>; using TUi32Region = TNumPair<ui32>; template <> -inline TString ToString(const TUi32Region& r) { +inline TString ToString(const TUi32Region& r) { return TStringBuilder() << "(" << r.Begin << ", " << r.End << ")"; } template <> -inline TUi32Region FromString(const TString& s) { +inline TUi32Region FromString(const TString& s) { TUi32Region result; sscanf(s.data(), "(%" PRIu32 ", %" PRIu32 ")", &result.Begin, &result.End); return result; @@ -78,7 +78,7 @@ protected: public: TSplitBase(const char* str, size_t length); - TSplitBase(const TString& s); + TSplitBase(const TString& s); Y_FORCE_INLINE const char* GetString() const { return Str; @@ -90,7 +90,7 @@ public: private: // we don't own Str, make sure that no one calls us with temporary object - TSplitBase(TString&&) = delete; + TSplitBase(TString&&) = delete; }; #ifdef _MSC_VER @@ -107,7 +107,7 @@ public: friend class TSplitIterator<TDelimitersSplit>; TDelimitersSplit(const char* str, size_t length, const TSplitDelimiters& delimiters); - TDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters); + TDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters); TIterator Iterator() const; TSizeTRegion Next(size_t& pos) const; size_t Begin() const; @@ -115,8 +115,8 @@ public: private: // we don't own Delimiters, make sure that no one calls us with temporary object TDelimitersSplit(const char*, size_t, TSplitDelimiters&&) = delete; - TDelimitersSplit(const TString&, TSplitDelimiters&&) = delete; - TDelimitersSplit(TString&&, const TSplitDelimiters&) = delete; + TDelimitersSplit(const TString&, TSplitDelimiters&&) = delete; + TDelimitersSplit(TString&&, const TSplitDelimiters&) = delete; }; class TDelimitersStrictSplit: public TSplitBase { @@ -128,7 +128,7 @@ public: friend class TSplitIterator<TDelimitersStrictSplit>; TDelimitersStrictSplit(const char* str, size_t length, const TSplitDelimiters& delimiters); - TDelimitersStrictSplit(const TString& s, const TSplitDelimiters& delimiters); + TDelimitersStrictSplit(const TString& s, const TSplitDelimiters& delimiters); TIterator Iterator() const; TSizeTRegion Next(size_t& pos) const; size_t Begin() const; @@ -136,8 +136,8 @@ public: private: // we don't own Delimiters, make sure that no one calls us with temporary object TDelimitersStrictSplit(const char*, size_t, TSplitDelimiters&&) = delete; - TDelimitersStrictSplit(const TString&, TSplitDelimiters&&) = delete; - TDelimitersStrictSplit(TString&&, const TSplitDelimiters&) = delete; + TDelimitersStrictSplit(const TString&, TSplitDelimiters&&) = delete; + TDelimitersStrictSplit(TString&&, const TSplitDelimiters&) = delete; }; class TScreenedDelimitersSplit: public TSplitBase { @@ -150,16 +150,16 @@ public: friend class TSplitIterator<TScreenedDelimitersSplit>; TScreenedDelimitersSplit(const char*, size_t, const TSplitDelimiters& delimiters, const TSplitDelimiters& screens); - TScreenedDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters, const TSplitDelimiters& screens); + TScreenedDelimitersSplit(const TString& s, const TSplitDelimiters& delimiters, const TSplitDelimiters& screens); TIterator Iterator() const; TSizeTRegion Next(size_t& pos) const; size_t Begin() const; private: // we don't own Delimiters and Screens, make sure that no one calls us with temporary object - TScreenedDelimitersSplit(TString&&, const TSplitDelimiters&, const TSplitDelimiters&) = delete; - TScreenedDelimitersSplit(const TString&, TSplitDelimiters&&, const TSplitDelimiters&) = delete; - TScreenedDelimitersSplit(const TString&, const TSplitDelimiters&, TSplitDelimiters&&) = delete; + TScreenedDelimitersSplit(TString&&, const TSplitDelimiters&, const TSplitDelimiters&) = delete; + TScreenedDelimitersSplit(const TString&, TSplitDelimiters&&, const TSplitDelimiters&) = delete; + TScreenedDelimitersSplit(const TString&, const TSplitDelimiters&, TSplitDelimiters&&) = delete; }; class TDelimitersSplitWithoutTags: public TSplitBase { @@ -173,7 +173,7 @@ public: friend class TSplitIterator<TDelimitersSplitWithoutTags>; TDelimitersSplitWithoutTags(const char* str, size_t length, const TSplitDelimiters& delimiters); - TDelimitersSplitWithoutTags(const TString& s, const TSplitDelimiters& delimiters); + TDelimitersSplitWithoutTags(const TString& s, const TSplitDelimiters& delimiters); TIterator Iterator() const; TSizeTRegion Next(size_t& pos) const; size_t Begin() const; @@ -181,8 +181,8 @@ public: private: // we don't own Delimiters, make sure that no one calls us with temporary object TDelimitersSplitWithoutTags(const char*, size_t, TSplitDelimiters&&) = delete; - TDelimitersSplitWithoutTags(const TString&, TSplitDelimiters&&) = delete; - TDelimitersSplitWithoutTags(TString&&, const TSplitDelimiters&) = delete; + TDelimitersSplitWithoutTags(const TString&, TSplitDelimiters&&) = delete; + TDelimitersSplitWithoutTags(TString&&, const TSplitDelimiters&) = delete; }; class TCharSplit: public TSplitBase { @@ -191,14 +191,14 @@ public: friend class TSplitIterator<TCharSplit>; TCharSplit(const char* str, size_t length); - TCharSplit(const TString& s); + TCharSplit(const TString& s); TIterator Iterator() const; TSizeTRegion Next(size_t& pos) const; size_t Begin() const; private: // we don't own Str, make sure that no one calls us with temporary object - TCharSplit(TString&&) = delete; + TCharSplit(TString&&) = delete; }; #ifdef _MSC_VER @@ -215,14 +215,14 @@ public: friend class TSplitIterator<TCharSplitWithoutTags>; TCharSplitWithoutTags(const char* str, size_t length); - TCharSplitWithoutTags(const TString& s); + TCharSplitWithoutTags(const TString& s); TIterator Iterator() const; TSizeTRegion Next(size_t& pos) const; size_t Begin() const; private: // we don't own Str, make sure that no one calls us with temporary object - TCharSplitWithoutTags(TString&&) = delete; + TCharSplitWithoutTags(TString&&) = delete; }; class TSubstringSplitDelimiter { @@ -230,7 +230,7 @@ public: TKMPMatcher Matcher; size_t Len; - TSubstringSplitDelimiter(const TString& s); + TSubstringSplitDelimiter(const TString& s); }; class TSubstringSplit: public TSplitBase { @@ -242,15 +242,15 @@ public: friend class TSplitIterator<TSubstringSplit>; TSubstringSplit(const char* str, size_t length, const TSubstringSplitDelimiter& delimiter); - TSubstringSplit(const TString& str, const TSubstringSplitDelimiter& delimiter); + TSubstringSplit(const TString& str, const TSubstringSplitDelimiter& delimiter); TIterator Iterator() const; TSizeTRegion Next(size_t& pos) const; size_t Begin() const; private: // we don't own Delimiters, make sure that no one calls us with temporary object - TSubstringSplit(TString&&, const TSubstringSplitDelimiter&) = delete; - TSubstringSplit(const TString&, TSubstringSplitDelimiter&&) = delete; + TSubstringSplit(TString&&, const TSubstringSplitDelimiter&) = delete; + TSubstringSplit(const TString&, TSubstringSplitDelimiter&&) = delete; }; template <class TSplit> @@ -258,7 +258,7 @@ class TSplitIterator { protected: const TSplit& Split; size_t Pos; - TString* CurrentStroka; + TString* CurrentStroka; public: TSplitIterator(const TSplit& split) @@ -286,7 +286,7 @@ public: const TString& NextString() { if (!CurrentStroka) - CurrentStroka = new TString(); + CurrentStroka = new TString(); TSizeTRegion region = Next(); CurrentStroka->assign(Split.Str, region.Begin, region.Length() - 1); return *CurrentStroka; @@ -296,8 +296,8 @@ public: return Pos >= Split.Len; } - TString GetTail() const { - return TString(Split.Str + Pos); + TString GetTail() const { + return TString(Split.Str + Pos); } void Skip(size_t count) { @@ -306,7 +306,7 @@ public: } }; -using TSplitTokens = TVector<TString>; +using TSplitTokens = TVector<TString>; template <typename TSplit> void Split(const TSplit& split, TSplitTokens* words) { diff --git a/library/cpp/deprecated/split/split_iterator_ut.cpp b/library/cpp/deprecated/split/split_iterator_ut.cpp index be5069c4be4..25084793830 100644 --- a/library/cpp/deprecated/split/split_iterator_ut.cpp +++ b/library/cpp/deprecated/split/split_iterator_ut.cpp @@ -33,7 +33,7 @@ void TSplitIteratorTest::TestDelimiters() { void TSplitIteratorTest::TestDelimitersSplit() { { - TString s = "1a3b45cd"; + TString s = "1a3b45cd"; TSplitDelimiters delims("abcd"); TDelimitersSplit split(s, delims); TSplitTokens tokens; @@ -42,7 +42,7 @@ void TSplitIteratorTest::TestDelimitersSplit() { UNIT_ASSERT(tokens == pattern); } { - TString s = "aaaaaa"; + TString s = "aaaaaa"; TSplitDelimiters delims("abcd"); TDelimitersSplit split(s, delims); TSplitTokens tokens; @@ -54,7 +54,7 @@ void TSplitIteratorTest::TestDelimitersSplit() { void TSplitIteratorTest::TestDelimitersStrictSplit() { { - TString s = "grp@2"; + TString s = "grp@2"; TSplitDelimiters delims("@"); TDelimitersStrictSplit split(s, delims); TSplitTokens tokens; @@ -64,7 +64,7 @@ void TSplitIteratorTest::TestDelimitersStrictSplit() { } { - TString s = "@grp@2@@"; + TString s = "@grp@2@@"; TSplitDelimiters delims("@"); TDelimitersStrictSplit split(s, delims); TSplitTokens tokens; @@ -75,7 +75,7 @@ void TSplitIteratorTest::TestDelimitersStrictSplit() { } void TSplitIteratorTest::TestTail() { - TString s = "grp@2@4"; + TString s = "grp@2@4"; TSplitDelimiters delims("@"); TDelimitersSplit split(s, delims); TDelimitersSplit::TIterator it = split.Iterator(); @@ -90,7 +90,7 @@ void TSplitIteratorTest::TestTail() { void TSplitIteratorTest::TestScreenedDelimitersSplit() { { - const TString s = "77.88.58.91 - - [28/Aug/2008:00:08:07 +0400] \"GET /export/mordashka.tgz HTTP/1.1\" 304 - \"-\" \"libwww-perl/5.805\" \"news.yandex.ru,80\" \"-\" \"-\" 1219867687 \"0\" 3283 2"; + const TString s = "77.88.58.91 - - [28/Aug/2008:00:08:07 +0400] \"GET /export/mordashka.tgz HTTP/1.1\" 304 - \"-\" \"libwww-perl/5.805\" \"news.yandex.ru,80\" \"-\" \"-\" 1219867687 \"0\" 3283 2"; const TSplitDelimiters delims(" "); const TSplitDelimiters screens("\"[]"); const TScreenedDelimitersSplit splitter(s, delims, screens); @@ -113,7 +113,7 @@ void TSplitIteratorTest::TestScreenedDelimitersSplit() { UNIT_ASSERT_EQUAL(it.NextString(), "2"); } { - const TString s = "77.88.58.91 - - [28/Aug/2008:00:08:07 +0400] \"GET /export/mordashka.tgz HTTP/1.1\" 304 - \"-\" \"libwww-perl/5.805\" \"news.yandex.ru,80\" \"-\" \"-\" 1219867687 \"0\" 3283 2"; + const TString s = "77.88.58.91 - - [28/Aug/2008:00:08:07 +0400] \"GET /export/mordashka.tgz HTTP/1.1\" 304 - \"-\" \"libwww-perl/5.805\" \"news.yandex.ru,80\" \"-\" \"-\" 1219867687 \"0\" 3283 2"; const TSplitDelimiters delims(" "); const TSplitDelimiters screens("\"[]"); const TScreenedDelimitersSplit splitter(s.Data(), s.Size(), delims, screens); @@ -138,7 +138,7 @@ void TSplitIteratorTest::TestScreenedDelimitersSplit() { } void TSplitIteratorTest::TestSubstringDelimiter() { - const TString s = "a@@bb@@cc@c.d@@r"; + const TString s = "a@@bb@@cc@c.d@@r"; static const TSubstringSplitDelimiter delimiter("@@"); const TSubstringSplit splitter(s, delimiter); TSubstringSplit::TIterator it = splitter.Iterator(); diff --git a/library/cpp/deprecated/split/ya.make b/library/cpp/deprecated/split/ya.make index 946e685ac82..fbe94578b7e 100644 --- a/library/cpp/deprecated/split/ya.make +++ b/library/cpp/deprecated/split/ya.make @@ -7,8 +7,8 @@ SRCS( split_iterator.cpp ) -PEERDIR( +PEERDIR( library/cpp/deprecated/kmp -) - +) + END() diff --git a/library/cpp/deprecated/ya.make b/library/cpp/deprecated/ya.make index 6c753f68a9b..35d16e9cd8d 100644 --- a/library/cpp/deprecated/ya.make +++ b/library/cpp/deprecated/ya.make @@ -18,8 +18,8 @@ RECURSE( ipreg1/ut_full ipreg1/util iter - kmp - kmp/ut + kmp + kmp/ut mapped_file mapped_file/ut mbitmap @@ -37,8 +37,8 @@ RECURSE( datawork/conf calc_module iterators_heap - parse_utils - parse_utils/ut + parse_utils + parse_utils/ut small_array solartrie solartrie/indexed_region/ut diff --git a/library/cpp/diff/diff.cpp b/library/cpp/diff/diff.cpp index be57da7f396..581afc29ac1 100644 --- a/library/cpp/diff/diff.cpp +++ b/library/cpp/diff/diff.cpp @@ -7,8 +7,8 @@ template <typename T> struct TCollectionImpl { - TVector<TConstArrayRef<T>> Words; - TVector<ui64> Keys; + TVector<TConstArrayRef<T>> Words; + TVector<ui64> Keys; inline bool Consume(const T* b, const T* e, const T*) { if (b < e) { @@ -64,7 +64,7 @@ size_t NDiff::InlineDiff(TVector<TChunk<char>>& chunks, const TStringBuf& left, } TCollection<char> c1(left, delims); TCollection<char> c2(right, delims); - TVector<TChunk<ui64>> diff; + TVector<TChunk<ui64>> diff; const size_t dist = InlineDiff<ui64>(diff, c1.GetKeys(), c2.GetKeys()); for (const auto& it : diff) { chunks.push_back(TChunk<char>(c1.Remap(it.Left), c2.Remap(it.Right), c1.Remap(it.Common))); @@ -78,7 +78,7 @@ size_t NDiff::InlineDiff(TVector<TChunk<wchar16>>& chunks, const TWtringBuf& lef } TCollection<wchar16> c1(left, delims); TCollection<wchar16> c2(right, delims); - TVector<TChunk<ui64>> diff; + TVector<TChunk<ui64>> diff; const size_t dist = InlineDiff<ui64>(diff, c1.GetKeys(), c2.GetKeys()); for (const auto& it : diff) { chunks.push_back(TChunk<wchar16>(c1.Remap(it.Left), c2.Remap(it.Right), c1.Remap(it.Common))); diff --git a/library/cpp/diff/diff.h b/library/cpp/diff/diff.h index 94fb00cd0b3..5a4f2e43141 100644 --- a/library/cpp/diff/diff.h +++ b/library/cpp/diff/diff.h @@ -3,7 +3,7 @@ #include <library/cpp/lcs/lcs_via_lis.h> #include <util/generic/algorithm.h> -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/strbuf.h> #include <util/generic/vector.h> #include <util/stream/output.h> @@ -39,7 +39,7 @@ namespace NDiff { swapped = true; } - TVector<T> lcs; + TVector<T> lcs; NLCS::TLCSCtx<T> ctx; NLCS::MakeLCS<T>(s1, s2, &lcs, &ctx); @@ -91,8 +91,8 @@ namespace NDiff { } template <typename TFormatter, typename T> - void PrintChunks(IOutputStream& out, const TFormatter& fmt, const TVector<TChunk<T>>& chunks) { - for (typename TVector<TChunk<T>>::const_iterator chunk = chunks.begin(); chunk != chunks.end(); ++chunk) { + void PrintChunks(IOutputStream& out, const TFormatter& fmt, const TVector<TChunk<T>>& chunks) { + for (typename TVector<TChunk<T>>::const_iterator chunk = chunks.begin(); chunk != chunks.end(); ++chunk) { if (!chunk->Left.empty() || !chunk->Right.empty()) { out << fmt.Special("("); out << fmt.Left(chunk->Left); diff --git a/library/cpp/diff/diff_ut.cpp b/library/cpp/diff/diff_ut.cpp index b82a7b000ee..d409faf4e3e 100644 --- a/library/cpp/diff/diff_ut.cpp +++ b/library/cpp/diff/diff_ut.cpp @@ -6,7 +6,7 @@ using namespace NDiff; struct TDiffTester { TStringStream Res; - TVector<TChunk<char>> Chunks; + TVector<TChunk<char>> Chunks; TStringBuf Special(const TStringBuf& str) const { return str; @@ -24,14 +24,14 @@ struct TDiffTester { return TStringBuf(str.begin(), str.end()); } - void Test(const TStringBuf& a, const TStringBuf& b, const TString& delims = " \t\n") { + void Test(const TStringBuf& a, const TStringBuf& b, const TString& delims = " \t\n") { Chunks.clear(); InlineDiff(Chunks, a, b, delims); Res.clear(); PrintChunks(Res, *this, Chunks); } - const TString& Result() const { + const TString& Result() const { return Res.Str(); } }; diff --git a/library/cpp/digest/argonish/internal/argon2/argon2_base.h b/library/cpp/digest/argonish/internal/argon2/argon2_base.h index 2385cc947c8..9b02d1efbbc 100644 --- a/library/cpp/digest/argonish/internal/argon2/argon2_base.h +++ b/library/cpp/digest/argonish/internal/argon2/argon2_base.h @@ -153,19 +153,19 @@ namespace NArgonish { ui8 in_buffer[BLAKE2B_OUTBYTES]; ui32 toproduce = outlen - BLAKE2B_OUTBYTES / 2; - TBlake2B<instructionSet> hash1(BLAKE2B_OUTBYTES); - hash1.Update(outlen); - hash1.Update(in, inlen); - hash1.Final(out_buffer, BLAKE2B_OUTBYTES); + TBlake2B<instructionSet> hash1(BLAKE2B_OUTBYTES); + hash1.Update(outlen); + hash1.Update(in, inlen); + hash1.Final(out_buffer, BLAKE2B_OUTBYTES); memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2); out += BLAKE2B_OUTBYTES / 2; while (toproduce > BLAKE2B_OUTBYTES) { memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES); - TBlake2B<instructionSet> hash2(BLAKE2B_OUTBYTES); - hash2.Update(in_buffer, BLAKE2B_OUTBYTES); - hash2.Final(out_buffer, BLAKE2B_OUTBYTES); + TBlake2B<instructionSet> hash2(BLAKE2B_OUTBYTES); + hash2.Update(in_buffer, BLAKE2B_OUTBYTES); + hash2.Final(out_buffer, BLAKE2B_OUTBYTES); memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2); out += BLAKE2B_OUTBYTES / 2; toproduce -= BLAKE2B_OUTBYTES / 2; @@ -173,9 +173,9 @@ namespace NArgonish { memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES); { - TBlake2B<instructionSet> hash3(toproduce); - hash3.Update(in_buffer, BLAKE2B_OUTBYTES); - hash3.Final(out_buffer, toproduce); + TBlake2B<instructionSet> hash3(toproduce); + hash3.Update(in_buffer, BLAKE2B_OUTBYTES); + hash3.Final(out_buffer, toproduce); memcpy(out, out_buffer, toproduce); } } diff --git a/library/cpp/digest/lower_case/hash_ops.h b/library/cpp/digest/lower_case/hash_ops.h index 83ebf7aca41..8bc3171390d 100644 --- a/library/cpp/digest/lower_case/hash_ops.h +++ b/library/cpp/digest/lower_case/hash_ops.h @@ -2,7 +2,7 @@ #include <util/generic/strbuf.h> -// can be used for caseless hashes like: THashMap<TStringBuf, T, TCIOps, TCIOps> +// can be used for caseless hashes like: THashMap<TStringBuf, T, TCIOps, TCIOps> struct TCIOps { size_t operator()(const char* s) const noexcept; diff --git a/library/cpp/digest/lower_case/hash_ops_ut.cpp b/library/cpp/digest/lower_case/hash_ops_ut.cpp index a7ab0b86ea6..610f89f2463 100644 --- a/library/cpp/digest/lower_case/hash_ops_ut.cpp +++ b/library/cpp/digest/lower_case/hash_ops_ut.cpp @@ -4,7 +4,7 @@ Y_UNIT_TEST_SUITE(TestCIHash) { Y_UNIT_TEST(TestYHash1) { - THashMap<TStringBuf, int, TCIOps, TCIOps> h; + THashMap<TStringBuf, int, TCIOps, TCIOps> h; h["Ab"] = 1; h["aB"] = 2; @@ -14,7 +14,7 @@ Y_UNIT_TEST_SUITE(TestCIHash) { } Y_UNIT_TEST(TestYHash2) { - THashMap<const char*, int, TCIOps, TCIOps> h; + THashMap<const char*, int, TCIOps, TCIOps> h; h["Ab"] = 1; h["aB"] = 2; diff --git a/library/cpp/digest/lower_case/lchash.h b/library/cpp/digest/lower_case/lchash.h index 6a287d94796..5cc13bc6127 100644 --- a/library/cpp/digest/lower_case/lchash.h +++ b/library/cpp/digest/lower_case/lchash.h @@ -6,13 +6,13 @@ #include <util/generic/strbuf.h> template <class T> -static inline T FnvCaseLess(const char* b, size_t l, T t = 0) noexcept { +static inline T FnvCaseLess(const char* b, size_t l, T t = 0) noexcept { using TIter = TLowerCaseIterator<const char>; return FnvHash(TIter(b), TIter(b + l), t); } template <class T> -static inline T FnvCaseLess(const TStringBuf& s, T t = 0) noexcept { +static inline T FnvCaseLess(const TStringBuf& s, T t = 0) noexcept { return FnvCaseLess(s.data(), s.size(), t); } diff --git a/library/cpp/digest/lower_case/lciter.h b/library/cpp/digest/lower_case/lciter.h index 9538e57932c..72f639605e5 100644 --- a/library/cpp/digest/lower_case/lciter.h +++ b/library/cpp/digest/lower_case/lciter.h @@ -7,24 +7,24 @@ template <class T> struct TLowerCaseIterator: public std::iterator<std::input_iterator_tag, T> { - using TNonConst = std::remove_const_t<T>; + using TNonConst = std::remove_const_t<T>; inline TLowerCaseIterator(T* c) : C(c) { } - inline TLowerCaseIterator& operator++() noexcept { + inline TLowerCaseIterator& operator++() noexcept { ++C; return *this; } - inline TLowerCaseIterator operator++(int) noexcept { + inline TLowerCaseIterator operator++(int) noexcept { return C++; } - inline TNonConst operator*() const noexcept { + inline TNonConst operator*() const noexcept { return AsciiToLower(*C); } @@ -32,11 +32,11 @@ struct TLowerCaseIterator: public std::iterator<std::input_iterator_tag, T> { }; template <class T> -inline bool operator==(const TLowerCaseIterator<T>& l, const TLowerCaseIterator<T>& r) noexcept { +inline bool operator==(const TLowerCaseIterator<T>& l, const TLowerCaseIterator<T>& r) noexcept { return l.C == r.C; } template <class T> -inline bool operator!=(const TLowerCaseIterator<T>& l, const TLowerCaseIterator<T>& r) noexcept { +inline bool operator!=(const TLowerCaseIterator<T>& l, const TLowerCaseIterator<T>& r) noexcept { return !(l == r); } diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp index 24a5b69eefb..181fbcc812b 100644 --- a/library/cpp/digest/md5/md5.cpp +++ b/library/cpp/digest/md5/md5.cpp @@ -38,7 +38,7 @@ namespace { char* MD5::File(const char* filename, char* buf) { try { - TUnbufferedFileInput fi(filename); + TUnbufferedFileInput fi(filename); return Stream(&fi, buf); } catch (...) { @@ -47,7 +47,7 @@ char* MD5::File(const char* filename, char* buf) { return nullptr; } -TString MD5::File(const TString& filename) { +TString MD5::File(const TString& filename) { TString buf; buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); auto result = MD5::File(filename.data(), buf.begin()); @@ -225,7 +225,7 @@ TString MD5::CalcRaw(TStringBuf data) { } TString MD5::CalcRaw(const TArrayRef<const ui8>& data) { - TString result; + TString result; result.ReserveAndResize(16); MD5().Update(data).Final(reinterpret_cast<ui8*>(result.begin())); return result; diff --git a/library/cpp/digest/md5/md5.h b/library/cpp/digest/md5/md5.h index 2c17aa05181..c2aab90e4a1 100644 --- a/library/cpp/digest/md5/md5.h +++ b/library/cpp/digest/md5/md5.h @@ -46,7 +46,7 @@ public: * Return nullptr / empty string if the file does not exist. */ static char* File(const char* filename, char* buf); - static TString File(const TString& filename); + static TString File(const TString& filename); static char* Data(const void* data, size_t len, char* buf); static char* Data(const TArrayRef<const ui8>& data, char* buf); diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp index 1c3e4ad0a9f..70c2946f035 100644 --- a/library/cpp/digest/md5/md5_ut.cpp +++ b/library/cpp/digest/md5/md5_ut.cpp @@ -15,7 +15,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) { r.Update((const unsigned char*)b + 15, strlen(b) - 15); char rs[33]; - TString s(r.End(rs)); + TString s(r.End(rs)); s.to_lower(); UNIT_ASSERT_NO_DIFF(s, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); @@ -26,11 +26,11 @@ Y_UNIT_TEST_SUITE(TMD5Test) { } Y_UNIT_TEST(TestFile) { - TString s = NUnitTest::RandomString(1000000, 1); - const TString tmpFile = "tmp"; + TString s = NUnitTest::RandomString(1000000, 1); + const TString tmpFile = "tmp"; { - TFixedBufferFileOutput fo(tmpFile); + TFixedBufferFileOutput fo(tmpFile); fo.Write(s.data(), s.size()); } diff --git a/library/cpp/digest/old_crc/gencrc/main.cpp b/library/cpp/digest/old_crc/gencrc/main.cpp index d5821304ce3..d7816d9631e 100644 --- a/library/cpp/digest/old_crc/gencrc/main.cpp +++ b/library/cpp/digest/old_crc/gencrc/main.cpp @@ -16,10 +16,10 @@ static void crc16init() { else crc >>= 1; - for (size_t k = 0; k < 256; ++k) { - Cout << " ULL(" << CRCTAB16[k] << ")"; + for (size_t k = 0; k < 256; ++k) { + Cout << " ULL(" << CRCTAB16[k] << ")"; - if (k != 255) { + if (k != 255) { Cout << ",\n"; } } @@ -37,10 +37,10 @@ static void crc32init() { else crc >>= 1; - for (size_t k = 0; k < 256; ++k) { - Cout << " ULL(" << CRCTAB32[k] << ")"; + for (size_t k = 0; k < 256; ++k) { + Cout << " ULL(" << CRCTAB32[k] << ")"; - if (k != 255) { + if (k != 255) { Cout << ",\n"; } } diff --git a/library/cpp/digest/sfh/sfh.h b/library/cpp/digest/sfh/sfh.h index 372938654cb..3e998d88484 100644 --- a/library/cpp/digest/sfh/sfh.h +++ b/library/cpp/digest/sfh/sfh.h @@ -3,7 +3,7 @@ #include <util/system/defaults.h> #include <util/system/unaligned_mem.h> -inline ui32 SuperFastHash(const void* d, size_t l) noexcept { +inline ui32 SuperFastHash(const void* d, size_t l) noexcept { ui32 hash = (ui32)l; ui32 tmp; diff --git a/library/cpp/digest/ya.make b/library/cpp/digest/ya.make index 61d4b50903c..64dcbc7c871 100644 --- a/library/cpp/digest/ya.make +++ b/library/cpp/digest/ya.make @@ -1,8 +1,8 @@ RECURSE( - argonish - argonish/benchmark - argonish/ut_fat - argonish/ut + argonish + argonish/benchmark + argonish/ut_fat + argonish/ut benchmark fast lower_case diff --git a/library/cpp/dns/cache.cpp b/library/cpp/dns/cache.cpp index 05c14e82fce..a1031fed027 100644 --- a/library/cpp/dns/cache.cpp +++ b/library/cpp/dns/cache.cpp @@ -80,7 +80,7 @@ namespace { } } - void AddAlias(const TString& host, const TString& alias) noexcept { + void AddAlias(const TString& host, const TString& alias) noexcept { TWriteGuard guard(LA_); A_[host] = alias; @@ -92,8 +92,8 @@ namespace { private: inline TResolvedHostPtr ResolveA(const TResolveTask& rt) { - TString originalHost(rt.Info.Host); - TString host(originalHost); + TString originalHost(rt.Info.Host); + TString host(originalHost); //3. replace host to alias, if exist if (A_.size()) { @@ -129,10 +129,10 @@ namespace { return new TResolvedHost(originalHost, *na); } - typedef THashMap<TResolveInfo, TResolvedHostPtr, THashResolveInfo, TCompareResolveInfo> TCache; + typedef THashMap<TResolveInfo, TResolvedHostPtr, THashResolveInfo, TCompareResolveInfo> TCache; TCache C_; TRWMutex L_; - typedef THashMap<TString, TString> TAliases; + typedef THashMap<TString, TString> TAliases; TAliases A_; TRWMutex LA_; }; @@ -162,7 +162,7 @@ namespace { } private: - typedef THashMap<TResolveInfo, const TResolvedHost*, THashResolveInfo, TCompareResolveInfo> TCache; + typedef THashMap<TResolveInfo, const TResolvedHost*, THashResolveInfo, TCompareResolveInfo> TCache; TCache C_; IDns* S_; }; @@ -192,7 +192,7 @@ namespace NDns { return ThrDns()->Resolve(rt); } - void AddHostAlias(const TString& host, const TString& alias) { + void AddHostAlias(const TString& host, const TString& alias) { TGlobalCachedDns::Instance()->AddAlias(host, alias); } } diff --git a/library/cpp/dns/cache.h b/library/cpp/dns/cache.h index eda5dc40702..01c5da298f1 100644 --- a/library/cpp/dns/cache.h +++ b/library/cpp/dns/cache.h @@ -2,7 +2,7 @@ #include <util/network/socket.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NDns { struct TResolveInfo { @@ -17,14 +17,14 @@ namespace NDns { }; struct TResolvedHost { - inline TResolvedHost(const TString& host, const TNetworkAddress& addr) noexcept + inline TResolvedHost(const TString& host, const TNetworkAddress& addr) noexcept : Host(host) , Addr(addr) , Id(0) { } - TString Host; //resolved hostname (from TResolveInfo, - before aliasing) + TString Host; //resolved hostname (from TResolveInfo, - before aliasing) TNetworkAddress Addr; size_t Id; //cache record id }; @@ -41,5 +41,5 @@ namespace NDns { const TResolvedHost* CachedThrResolve(const TResolveInfo& ri); //create alias for host, which can be used for static resolving (when alias is ip address) - void AddHostAlias(const TString& host, const TString& alias); + void AddHostAlias(const TString& host, const TString& alias); } diff --git a/library/cpp/dns/thread.cpp b/library/cpp/dns/thread.cpp index 8b27d2d527c..a8441d7c90d 100644 --- a/library/cpp/dns/thread.cpp +++ b/library/cpp/dns/thread.cpp @@ -14,7 +14,7 @@ using namespace NDns; namespace { class TThreadedResolver: public IThreadFactory::IThreadAble, public TNonCopyable { struct TResolveRequest { - inline TResolveRequest(const TString& host, ui16 port) + inline TResolveRequest(const TString& host, ui16 port) : Host(host) , Port(port) { @@ -36,7 +36,7 @@ namespace { ythrow TNetworkResolutionError(EAI_FAIL) << TStringBuf(": shit happen"); } - inline void Resolve() noexcept { + inline void Resolve() noexcept { try { Result = new TNetworkAddress(Host, Port); } catch (...) { @@ -46,11 +46,11 @@ namespace { Wake(); } - inline void Wake() noexcept { + inline void Wake() noexcept { E.Signal(); } - TString Host; + TString Host; ui16 Port; TManualEvent E; TNetworkAddressPtr Result; @@ -64,7 +64,7 @@ namespace { T_.push_back(SystemThreadFactory()->Run(this)); } - inline ~TThreadedResolver() override { + inline ~TThreadedResolver() override { Schedule(nullptr); for (size_t i = 0; i < T_.size(); ++i) { @@ -86,7 +86,7 @@ namespace { return Singleton<TThreadedResolver>(); } - inline TNetworkAddressPtr Resolve(const TString& host, ui16 port) { + inline TNetworkAddressPtr Resolve(const TString& host, ui16 port) { TResolveRequest rr(host, port); Schedule(&rr); @@ -122,12 +122,12 @@ namespace { TLockFreeQueue<TResolveRequest*> Q_; TSystemEvent E_; typedef TAutoPtr<IThreadFactory::IThread> IThreadRef; - TVector<IThreadRef> T_; + TVector<IThreadRef> T_; }; } namespace NDns { - TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port) { + TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port) { return TThreadedResolver::Instance()->Resolve(host, port); } } diff --git a/library/cpp/dns/thread.h b/library/cpp/dns/thread.h index 06b41d78ced..f831b6bd0b3 100644 --- a/library/cpp/dns/thread.h +++ b/library/cpp/dns/thread.h @@ -2,11 +2,11 @@ #include <util/network/socket.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ptr.h> namespace NDns { typedef TAutoPtr<TNetworkAddress> TNetworkAddressPtr; - TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port); + TNetworkAddressPtr ThreadedResolve(const TString& host, ui16 port); } diff --git a/library/cpp/enumbitset/enumbitset.h b/library/cpp/enumbitset/enumbitset.h index 41864c3a04f..bd824746333 100644 --- a/library/cpp/enumbitset/enumbitset.h +++ b/library/cpp/enumbitset/enumbitset.h @@ -285,13 +285,13 @@ public: return t; } - TString ToString() const { + TString ToString() const { static_assert(sizeof(typename TParent::TChunk) <= sizeof(ui64), "expect sizeof(typename TParent::TChunk) <= sizeof(ui64)"); static const size_t chunkSize = sizeof(typename TParent::TChunk) * 8; static const size_t numDig = chunkSize / 4; - static const TString templ = Sprintf("%%0%lulX", numDig); + static const TString templ = Sprintf("%%0%lulX", numDig); static const size_t numOfChunks = (BitsetSize + chunkSize - 1) / chunkSize; - TString ret; + TString ret; for (int pos = numOfChunks * chunkSize; pos >= 0; pos -= chunkSize) { ui64 t = 0; this->Export(pos, t); @@ -473,13 +473,13 @@ public: Init(c1, c2, r...); } - static TSfEnumBitSet GetFromString(const TString& s) { + static TSfEnumBitSet GetFromString(const TString& s) { TSfEnumBitSet ebs; ebs.FromString(s); return ebs; } - static TSfEnumBitSet TryGetFromString(const TString& s) { + static TSfEnumBitSet TryGetFromString(const TString& s) { TSfEnumBitSet ebs; ebs.TryFromString(s); return ebs; diff --git a/library/cpp/execprofile/profile.cpp b/library/cpp/execprofile/profile.cpp index d05de20203f..5af8845f630 100644 --- a/library/cpp/execprofile/profile.cpp +++ b/library/cpp/execprofile/profile.cpp @@ -19,7 +19,7 @@ #include <util/generic/map.h> #include <util/generic/noncopyable.h> #include <util/generic/algorithm.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/stream/file.h> #include <util/string/util.h> #include <util/system/datetime.h> diff --git a/library/cpp/getopt/print.cpp b/library/cpp/getopt/print.cpp index 8cf1c62e4d7..57c244f3339 100644 --- a/library/cpp/getopt/print.cpp +++ b/library/cpp/getopt/print.cpp @@ -10,7 +10,7 @@ #include <library/cpp/build_info/build_info.h> namespace NLastGetoptPrivate { - TString InitVersionString() { + TString InitVersionString() { TString ts = GetProgramSvnVersion(); ts += "\n"; ts += GetBuildInfo(); @@ -27,7 +27,7 @@ namespace NLastGetoptPrivate { return ts; } - TString& VersionString(); + TString& VersionString(); TString& ShortVersionString(); struct TInit { diff --git a/library/cpp/getopt/small/last_getopt_opt.h b/library/cpp/getopt/small/last_getopt_opt.h index a8dd5adca90..fe6c2c064db 100644 --- a/library/cpp/getopt/small/last_getopt_opt.h +++ b/library/cpp/getopt/small/last_getopt_opt.h @@ -5,7 +5,7 @@ #include <util/string/split.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/maybe.h> #include <util/generic/vector.h> #include <util/string/cast.h> diff --git a/library/cpp/getopt/small/last_getopt_opts.cpp b/library/cpp/getopt/small/last_getopt_opts.cpp index 03c432849f1..13c327af12a 100644 --- a/library/cpp/getopt/small/last_getopt_opts.cpp +++ b/library/cpp/getopt/small/last_getopt_opts.cpp @@ -11,8 +11,8 @@ #include <stdlib.h> namespace NLastGetoptPrivate { - TString& VersionString() { - static TString data; + TString& VersionString() { + static TString data; return data; } TString& ShortVersionString() { diff --git a/library/cpp/getopt/small/last_getopt_parser.cpp b/library/cpp/getopt/small/last_getopt_parser.cpp index 7668b12a035..cf04841fd4e 100644 --- a/library/cpp/getopt/small/last_getopt_parser.cpp +++ b/library/cpp/getopt/small/last_getopt_parser.cpp @@ -124,7 +124,7 @@ namespace NLastGetopt { if (opt->GetHasArg() == NO_ARGUMENT) { return Commit(opt, nullptr, pos, p); } - return Commit(opt, arg.SubStr(p), pos + 1, 0); + return Commit(opt, arg.SubStr(p), pos + 1, 0); } bool TOptsParser::ParseShortOptArg(size_t pos) { diff --git a/library/cpp/getopt/small/last_getopt_support.h b/library/cpp/getopt/small/last_getopt_support.h index 17bed3e614e..72474578c52 100644 --- a/library/cpp/getopt/small/last_getopt_support.h +++ b/library/cpp/getopt/small/last_getopt_support.h @@ -1,7 +1,7 @@ #pragma once #include <util/string/cast.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/utility.h> #include <util/generic/yexception.h> diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 2fa5cfd0703..f6e091fb2dc 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -128,11 +128,11 @@ void TModChooser::AddAlias(const TString& alias, const TString& mode) { Modes[alias] = Modes[mode]; } -void TModChooser::SetDescription(const TString& descr) { +void TModChooser::SetDescription(const TString& descr) { Description = descr; } -void TModChooser::SetModesHelpOption(const TString& helpOption) { +void TModChooser::SetModesHelpOption(const TString& helpOption) { ModesHelpOption = helpOption; } @@ -144,7 +144,7 @@ void TModChooser::SetSeparatedMode(bool separated) { ShowSeparated = separated; } -void TModChooser::SetSeparationString(const TString& str) { +void TModChooser::SetSeparationString(const TString& str) { SeparationString = str; } @@ -277,7 +277,7 @@ TString TModChooser::TMode::FormatFullName(size_t pad) const { return name; } -void TModChooser::PrintHelp(const TString& progName) const { +void TModChooser::PrintHelp(const TString& progName) const { Cerr << Description << Endl << Endl; Cerr << NColorizer::StdErr().BoldColor() << "Usage" << NColorizer::StdErr().OldColor() << ": " << progName << " MODE [MODE_OPTIONS]" << Endl; Cerr << Endl; diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h index 0a8de6d50b5..656e0074899 100644 --- a/library/cpp/getopt/small/modchooser.h +++ b/library/cpp/getopt/small/modchooser.h @@ -3,7 +3,7 @@ #include "last_getopt_opts.h" #include <util/generic/map.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <functional> @@ -63,10 +63,10 @@ public: void AddAlias(const TString& alias, const TString& mode); //! Set main program description. - void SetDescription(const TString& descr); + void SetDescription(const TString& descr); //! Set modes help option name (-? is by default) - void SetModesHelpOption(const TString& helpOption); + void SetModesHelpOption(const TString& helpOption); //! Specify handler for '--version' parameter void SetVersionHandler(TVersionHandlerPtr handler); @@ -75,7 +75,7 @@ public: void SetSeparatedMode(bool separated = true); //! Set separation string - void SetSeparationString(const TString& str); + void SetSeparationString(const TString& str); //! Set short command representation in Usage block void SetPrintShortCommandInUsage(bool printShortCommandInUsage); @@ -100,12 +100,12 @@ public: //! Run appropriate mode. Same as Run(const int, const char**) int Run(const TVector<TString>& argv) const; - void PrintHelp(const TString& progName) const; + void PrintHelp(const TString& progName) const; struct TMode { - TString Name; + TString Name; TMainClass* Main; - TString Description; + TString Description; bool Hidden; bool NoCompletion; TVector<TString> Aliases; @@ -136,10 +136,10 @@ public: private: //! Main program description. - TString Description; + TString Description; //! Help option for modes. - TString ModesHelpOption; + TString ModesHelpOption; //! Wrappers around all modes. TVector<THolder<TMainClass>> Wrappers; @@ -162,7 +162,7 @@ private: bool PrintShortCommandInUsage; //! Text string used when displaying each separator - TString SeparationString; + TString SeparationString; //! Unsorted list of options TVector<THolder<TMode>> UnsortedModes; diff --git a/library/cpp/getopt/small/opt.h b/library/cpp/getopt/small/opt.h index ecb57439bcf..b18f06d6e01 100644 --- a/library/cpp/getopt/small/opt.h +++ b/library/cpp/getopt/small/opt.h @@ -93,7 +93,7 @@ public: return Arg; } - TVector<TString> GetFreeArgs() const { + TVector<TString> GetFreeArgs() const { return NLastGetopt::TOptsParseResult(&*Opts_, GetArgC(), GetArgV()).GetFreeArgs(); } diff --git a/library/cpp/getopt/small/opt2.cpp b/library/cpp/getopt/small/opt2.cpp index 0cdc774e788..2816aef7a56 100644 --- a/library/cpp/getopt/small/opt2.cpp +++ b/library/cpp/getopt/small/opt2.cpp @@ -57,7 +57,7 @@ void Opt2::EatArgv(const char* optspec, const char* long_alias) { // long_alias has a form "long-name1=A,long-name2=B", etc. // This implementation is limited to aliasing a single long option // with single short option (extend it if you really need). - THashMap<const char*, char> long2short; + THashMap<const char*, char> long2short; long2short["help"] = '?'; long_alias = long_alias ? long_alias : ""; alias_copy = long_alias; @@ -105,7 +105,7 @@ void Opt2::EatArgv(const char* optspec, const char* long_alias) { } // long option always spans one argv (--switch or --option-name=value) const char* eq = strchr(s, '='); - TString lname(s, eq ? (size_t)(eq - s) : (size_t)strlen(s)); + TString lname(s, eq ? (size_t)(eq - s) : (size_t)strlen(s)); THashMap<const char*, char>::iterator i = long2short.find(lname.data()); if (i == long2short.end()) { UnknownLongOption = strdup(lname.data()); // free'd in AutoUsage() diff --git a/library/cpp/getopt/small/opt2.h b/library/cpp/getopt/small/opt2.h index 4d9d9432372..70b27011229 100644 --- a/library/cpp/getopt/small/opt2.h +++ b/library/cpp/getopt/small/opt2.h @@ -1,7 +1,7 @@ #pragma once #include <util/system/defaults.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> // simplified options parser @@ -31,9 +31,9 @@ struct Opt2Param { bool IsRequired; bool MultipleUse; const char* DefValue; - TString DefValueStr; - TString HelpUsage; - TVector<const char*> ActualValue; + TString DefValueStr; + TString HelpUsage; + TVector<const char*> ActualValue; const char* LongOptName; Opt2Param() : HasArg(false) @@ -112,7 +112,7 @@ public: public: // non-option args - TVector<char*> Pos; + TVector<char*> Pos; bool HasErrors; private: @@ -122,15 +122,15 @@ private: char OptionMissingArg; char OptionWrongArg; char RequiredOptionMissing; - TVector<TString> UserErrorMessages; + TVector<TString> UserErrorMessages; protected: int Argc; char* const* Argv; int MinArgs, MaxArgs; ui8 SpecsMap[256]; - TVector<Opt2Param> Specs; - TString alias_copy; + TVector<Opt2Param> Specs; + TString alias_copy; void EatArgv(const char* optspec, const char* long_alias); void Clear(); Opt2Param& GetInternal(char opt, const char* defValue, const char* helpUsage, bool required); diff --git a/library/cpp/getopt/small/ygetopt.cpp b/library/cpp/getopt/small/ygetopt.cpp index 1f52827f742..f11e39588ec 100644 --- a/library/cpp/getopt/small/ygetopt.cpp +++ b/library/cpp/getopt/small/ygetopt.cpp @@ -1,7 +1,7 @@ #include "opt.h" #include "ygetopt.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> @@ -67,7 +67,7 @@ private: const char* Arg_; }; -TGetOpt::TIterator::TIterator() noexcept +TGetOpt::TIterator::TIterator() noexcept : Impl_(nullptr) { } @@ -82,11 +82,11 @@ void TGetOpt::TIterator::Next() { Impl_->Next(); } -char TGetOpt::TIterator::Key() const noexcept { +char TGetOpt::TIterator::Key() const noexcept { return Impl_->Key(); } -bool TGetOpt::TIterator::AtEnd() const noexcept { +bool TGetOpt::TIterator::AtEnd() const noexcept { if (Impl_.Get()) { return Impl_->AtEnd(); } @@ -94,7 +94,7 @@ bool TGetOpt::TIterator::AtEnd() const noexcept { return true; } -const char* TGetOpt::TIterator::Arg() const noexcept { +const char* TGetOpt::TIterator::Arg() const noexcept { if (Impl_.Get()) { return Impl_->Arg(); } @@ -102,7 +102,7 @@ const char* TGetOpt::TIterator::Arg() const noexcept { return nullptr; } -TGetOpt::TGetOpt(int argc, const char* const* argv, const TString& format) +TGetOpt::TGetOpt(int argc, const char* const* argv, const TString& format) : Impl_(new TImpl(argc, argv, format)) { } diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index c99a1d053d1..d35a4930215 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -19,22 +19,22 @@ namespace { }; class TOptsParseResultTestWrapper: public TOptsParseResultException { - TVector<const char*> Argv_; + TVector<const char*> Argv_; public: - TOptsParseResultTestWrapper(const TOpts* opts, TVector<const char*> argv) + TOptsParseResultTestWrapper(const TOpts* opts, TVector<const char*> argv) : Argv_(argv) { Init(opts, (int)Argv_.size(), Argv_.data()); } }; - using V = TVector<const char*>; + using V = TVector<const char*>; } struct TOptsParserTester { TOptsNoDefault Opts_; - TVector<const char*> Argv_; + TVector<const char*> Argv_; THolder<TOptsParser> Parser_; @@ -58,13 +58,13 @@ struct TOptsParserTester { UNIT_ASSERT(Parser_->CurOpt()->CharIs(c)); } - void AcceptOption(const TString& optName) { + void AcceptOption(const TString& optName) { AcceptOption(); UNIT_ASSERT(Parser_->CurOpt()->NameIs(optName)); } template <typename TOpt> - void AcceptOptionWithValue(TOpt optName, const TString& value) { + void AcceptOptionWithValue(TOpt optName, const TString& value) { AcceptOption(optName); UNIT_ASSERT_VALUES_EQUAL_C(value, Parser_->CurValStr(), "; option " << optName); } @@ -75,7 +75,7 @@ struct TOptsParserTester { UNIT_ASSERT_C(!Parser_->CurVal(), ": opt " << optName << " must have no param"); } - void AcceptFreeArgInOrder(const TString& expected) { + void AcceptFreeArgInOrder(const TString& expected) { Accept(); UNIT_ASSERT(!Parser_->CurOpt()); UNIT_ASSERT_VALUES_EQUAL(expected, Parser_->CurValStr()); @@ -114,7 +114,7 @@ struct TOptsParserTester { UNIT_ASSERT_VALUES_EQUAL(sop, Parser_->Sop_); } - void AcceptFreeArg(const TString& expected) { + void AcceptFreeArg(const TString& expected) { UNIT_ASSERT(Pos_ < Parser_->Argc_); UNIT_ASSERT_VALUES_EQUAL(expected, Parser_->Argv_[Pos_]); ++Pos_; @@ -417,7 +417,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestStoreResult) { TOptsNoDefault opts; - TString data; + TString data; int number; TMaybe<TString> optionalString0, optionalString1; TMaybe<int> optionalNumber0, optionalNumber1; @@ -483,10 +483,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestSplitValue) { TOptsNoDefault opts; - TVector<TString> vals; + TVector<TString> vals; opts.AddLongOption('s', "split").SplitHandler(&vals, ','); TOptsParseResultTestWrapper r(&opts, V({"prog", "--split=a,b,c"})); - UNIT_ASSERT_EQUAL(vals.size(), 3); + UNIT_ASSERT_EQUAL(vals.size(), 3); UNIT_ASSERT_EQUAL(vals[0], "a"); UNIT_ASSERT_EQUAL(vals[1], "b"); UNIT_ASSERT_EQUAL(vals[2], "c"); @@ -494,10 +494,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestRangeSplitValue) { TOptsNoDefault opts; - TVector<ui32> vals; + TVector<ui32> vals; opts.AddLongOption('s', "split").RangeSplitHandler(&vals, ',', '-'); TOptsParseResultTestWrapper r(&opts, V({"prog", "--split=1,8-10", "--split=12-14"})); - UNIT_ASSERT_EQUAL(vals.size(), 7); + UNIT_ASSERT_EQUAL(vals.size(), 7); UNIT_ASSERT_EQUAL(vals[0], 1); UNIT_ASSERT_EQUAL(vals[1], 8); UNIT_ASSERT_EQUAL(vals[2], 9); @@ -577,7 +577,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { Y_UNIT_TEST(TestTitleAndPrintUsage) { TOpts opts; const char* prog = "my_program"; - TString title = TString("Sample ") + TString(prog).Quote() + " application"; + TString title = TString("Sample ") + TString(prog).Quote() + " application"; opts.SetTitle(title); int argc = 2; const char* cmd[] = {prog}; @@ -585,15 +585,15 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { TStringStream out; parser.PrintUsage(out); // find title - UNIT_ASSERT(out.Str().find(title) != TString::npos); + UNIT_ASSERT(out.Str().find(title) != TString::npos); // find usage - UNIT_ASSERT(out.Str().find(" " + TString(prog) + " ") != TString::npos); + UNIT_ASSERT(out.Str().find(" " + TString(prog) + " ") != TString::npos); } Y_UNIT_TEST(TestCustomCmdLineDescr) { TOpts opts; const char* prog = "my_program"; - TString customDescr = "<FILE|TABLE> USER [OPTIONS]"; + TString customDescr = "<FILE|TABLE> USER [OPTIONS]"; int argc = 2; const char* cmd[] = {prog}; opts.SetCmdLineDescr(customDescr); @@ -601,7 +601,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { TStringStream out; parser.PrintUsage(out); // find custom usage - UNIT_ASSERT(out.Str().find(customDescr) != TString::npos); + UNIT_ASSERT(out.Str().find(customDescr) != TString::npos); } Y_UNIT_TEST(TestColorPrint) { @@ -622,28 +622,28 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { parser.PrintUsage(out, colors); // find options and green color - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--long_option" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--other" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-o" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-d" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-s" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--long_option" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "--other" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-o" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-d" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "-s" << colors.OldColor()) != TString::npos); // find default values - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "42" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "\"str_default\"" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "42" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.CyanColor() << "\"str_default\"" << colors.OldColor()) != TString::npos); // find free args - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "123" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "456" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "first_free_arg" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "123" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "456" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "first_free_arg" << colors.OldColor()) != TString::npos); // free args without help not rendered even if they have custom title UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.GreenColor() << "second_free_arg" << colors.OldColor()) == TString::npos); // find signatures - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Usage" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Required parameters" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Optional parameters" << colors.OldColor()) != TString::npos); - UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Free args" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Usage" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Required parameters" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Optional parameters" << colors.OldColor()) != TString::npos); + UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Free args" << colors.OldColor()) != TString::npos); // find sections UNIT_ASSERT(out.Str().find(TStringBuilder() << colors.BoldColor() << "Section" << colors.OldColor() << ":") != TString::npos); @@ -652,10 +652,10 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { // print without colors TStringStream out2; opts.PrintUsage(prog, out2); - UNIT_ASSERT(out2.Str().find(colors.GreenColor()) == TString::npos); - UNIT_ASSERT(out2.Str().find(colors.CyanColor()) == TString::npos); - UNIT_ASSERT(out2.Str().find(colors.BoldColor()) == TString::npos); - UNIT_ASSERT(out2.Str().find(colors.OldColor()) == TString::npos); + UNIT_ASSERT(out2.Str().find(colors.GreenColor()) == TString::npos); + UNIT_ASSERT(out2.Str().find(colors.CyanColor()) == TString::npos); + UNIT_ASSERT(out2.Str().find(colors.BoldColor()) == TString::npos); + UNIT_ASSERT(out2.Str().find(colors.OldColor()) == TString::npos); } Y_UNIT_TEST(TestPadding) { @@ -675,21 +675,21 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { NColorizer::TColors colors(withColors); parser.PrintUsage(out, colors); - TString printed = out.Str(); + TString printed = out.Str(); if (withColors) { // remove not printable characters - SubstGlobal(printed, TString(colors.BoldColor()), ""); - SubstGlobal(printed, TString(colors.GreenColor()), ""); - SubstGlobal(printed, TString(colors.CyanColor()), ""); - SubstGlobal(printed, TString(colors.OldColor()), ""); + SubstGlobal(printed, TString(colors.BoldColor()), ""); + SubstGlobal(printed, TString(colors.GreenColor()), ""); + SubstGlobal(printed, TString(colors.CyanColor()), ""); + SubstGlobal(printed, TString(colors.OldColor()), ""); } - TVector<TString> lines; + TVector<TString> lines; StringSplitter(printed).Split('\n').SkipEmpty().Collect(&lines); UNIT_ASSERT(!lines.empty()); - TVector<size_t> indents; - for (const TString& line : lines) { + TVector<size_t> indents; + for (const TString& line : lines) { const size_t indent = line.find("description "); - if (indent != TString::npos) + if (indent != TString::npos) indents.push_back(indent); } UNIT_ASSERT_VALUES_EQUAL(indents.size(), 7); @@ -701,7 +701,7 @@ Y_UNIT_TEST_SUITE(TLastGetoptTests) { } Y_UNIT_TEST(TestAppendTo) { - TVector<int> ints; + TVector<int> ints; TOptsNoDefault opts; opts.AddLongOption("size").AppendTo(&ints); diff --git a/library/cpp/getopt/ut/opt_ut.cpp b/library/cpp/getopt/ut/opt_ut.cpp index 441aa493a0a..aad842a46e5 100644 --- a/library/cpp/getopt/ut/opt_ut.cpp +++ b/library/cpp/getopt/ut/opt_ut.cpp @@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(OptTest) { int argc = 5; Opt opts(argc, argv, "", options); - UNIT_ASSERT_VALUES_EQUAL(JoinStrings(opts.GetFreeArgs(), ", "), "ARG1, ARG3"); + UNIT_ASSERT_VALUES_EQUAL(JoinStrings(opts.GetFreeArgs(), ", "), "ARG1, ARG3"); } Y_UNIT_TEST(TestLongOption) { @@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(OptTest) { int argc = 5; Opt opts(argc, argv, "", options); - TString optionValue = ""; + TString optionValue = ""; int optlet = 0; while ((optlet = opts.Get()) != EOF) { if (optlet == SOME_OPTION_ID) { diff --git a/library/cpp/getopt/ut/posix_getopt_ut.cpp b/library/cpp/getopt/ut/posix_getopt_ut.cpp index b6d374bf28b..7a9dbf6c5cd 100644 --- a/library/cpp/getopt/ut/posix_getopt_ut.cpp +++ b/library/cpp/getopt/ut/posix_getopt_ut.cpp @@ -13,9 +13,9 @@ Y_UNIT_TEST_SUITE(TPosixGetoptTest) { NLastGetopt::optreset = 1; UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt(argc, argv, "bf:")); UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt(argc, argv, "bf:")); - UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("1")); + UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("1")); UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt(argc, argv, "bf:")); - UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("2")); + UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("2")); UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt(argc, argv, "bf:")); UNIT_ASSERT_VALUES_EQUAL(5, NLastGetopt::optind); diff --git a/library/cpp/getopt/ut/ygetopt_ut.cpp b/library/cpp/getopt/ut/ygetopt_ut.cpp index a76f1172166..29cfb0e8e3f 100644 --- a/library/cpp/getopt/ut/ygetopt_ut.cpp +++ b/library/cpp/getopt/ut/ygetopt_ut.cpp @@ -29,8 +29,8 @@ void TGetOptTest::TestGetOpt() { "-q", nullptr}; - TString res; - const TString format = "qzp:f"; + TString res; + const TString format = "qzp:f"; TGetOpt opt(sizeof(argv) / sizeof(*argv) - 1, argv, format); for (TGetOpt::TIterator it = opt.Begin(); it != opt.End(); ++it) { diff --git a/library/cpp/grpc/server/grpc_server.h b/library/cpp/grpc/server/grpc_server.h index d6814a90a0d..e78eefee5e6 100644 --- a/library/cpp/grpc/server/grpc_server.h +++ b/library/cpp/grpc/server/grpc_server.h @@ -347,9 +347,9 @@ private: const TServerOptions Options_; std::unique_ptr<grpc::Server> Server_; std::vector<std::unique_ptr<grpc::ServerCompletionQueue>> CQS_; - TVector<IThreadRef> Ts; + TVector<IThreadRef> Ts; - TVector<IGRpcServicePtr> Services_; + TVector<IGRpcServicePtr> Services_; TGlobalLimiter Limiter_; }; diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.cpp b/library/cpp/histogram/adaptive/adaptive_histogram.cpp index cbfc494021e..57dec4d6080 100644 --- a/library/cpp/histogram/adaptive/adaptive_histogram.cpp +++ b/library/cpp/histogram/adaptive/adaptive_histogram.cpp @@ -113,15 +113,15 @@ namespace NKiwiAggr { } } - void TAdaptiveHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { + void TAdaptiveHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { for (size_t i = 0; i < histogramsToMerge.size(); ++i) { Merge(histogramsToMerge[i], 1.0); } } - void TAdaptiveHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { - TVector<IHistogramPtr> histogramsToMergeRepacked(0); - TVector<TAdaptiveHistogram*> histograms(0); + void TAdaptiveHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { + TVector<IHistogramPtr> histogramsToMergeRepacked(0); + TVector<TAdaptiveHistogram*> histograms(0); for (size_t i = 0; i < histogramsToMerge.size(); ++i) { if (!histogramsToMerge[i] || histogramsToMerge[i]->Empty()) { continue; diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.h b/library/cpp/histogram/adaptive/adaptive_histogram.h index fa8f48433f9..3bb921e7804 100644 --- a/library/cpp/histogram/adaptive/adaptive_histogram.h +++ b/library/cpp/histogram/adaptive/adaptive_histogram.h @@ -15,7 +15,7 @@ namespace NKiwiAggr { static const size_t DEFAULT_INTERVALS = 100; private: - using TPairSet = TSet<TWeightedValue>; + using TPairSet = TSet<TWeightedValue>; struct TFastBin { // these names are for compatibility with TWeightedValue @@ -47,7 +47,7 @@ namespace NKiwiAggr { TPairSet BinsByQuality; TQualityFunction CalcQuality; - TVector<TFastBin> PrecomputedBins; + TVector<TFastBin> PrecomputedBins; public: TAdaptiveHistogram(size_t intervals, ui64 id = 0, TQualityFunction qualityFunc = CalcWeightQuality); diff --git a/library/cpp/histogram/adaptive/auto_histogram.h b/library/cpp/histogram/adaptive/auto_histogram.h index 9fdf0b9abe4..21efc5cd3a6 100644 --- a/library/cpp/histogram/adaptive/auto_histogram.h +++ b/library/cpp/histogram/adaptive/auto_histogram.h @@ -58,11 +58,11 @@ namespace NKiwiAggr { HistogramImpl->Merge(histo, multiplier); } - virtual void Merge(const TVector<THistogram>& histogramsToMerge) { + virtual void Merge(const TVector<THistogram>& histogramsToMerge) { HistogramImpl->Merge(histogramsToMerge); } - virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) { + virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) { HistogramImpl->Merge(histogramsToMerge); } diff --git a/library/cpp/histogram/adaptive/block_histogram.cpp b/library/cpp/histogram/adaptive/block_histogram.cpp index 6586d13ff62..51e418405b6 100644 --- a/library/cpp/histogram/adaptive/block_histogram.cpp +++ b/library/cpp/histogram/adaptive/block_histogram.cpp @@ -16,12 +16,12 @@ namespace { class TSmartHeap { private: - TVector<ui32> A; - TVector<ui32> Pos; - const TVector<double>& Weights; + TVector<ui32> A; + TVector<ui32> Pos; + const TVector<double>& Weights; public: - TSmartHeap(const TVector<double>& weights) + TSmartHeap(const TVector<double>& weights) : A(weights.size()) , Pos(weights.size()) , Weights(weights) @@ -182,7 +182,7 @@ namespace NKiwiAggr { } } - void TBlockHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { + void TBlockHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { for (size_t i = 0; i < histogramsToMerge.size(); ++i) { Merge(histogramsToMerge[i], 1.0); } @@ -190,7 +190,7 @@ namespace NKiwiAggr { void TBlockHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { Y_UNUSED(histogramsToMerge); - ythrow yexception() << "IHistogram::Merge(TVector<IHistogramPtr>) is not defined for TBlockHistogram"; + ythrow yexception() << "IHistogram::Merge(TVector<IHistogramPtr>) is not defined for TBlockHistogram"; } void TBlockHistogram::Multiply(double factor) { @@ -198,7 +198,7 @@ namespace NKiwiAggr { ythrow yexception() << "Not valid factor in IHistogram::Multiply(): " << factor; } Sum *= factor; - for (TVector<TWeightedValue>::iterator it = Bins.begin(); it != Bins.end(); ++it) { + for (TVector<TWeightedValue>::iterator it = Bins.begin(); it != Bins.end(); ++it) { it->second *= factor; } } @@ -255,7 +255,7 @@ namespace NKiwiAggr { SortAndShrink(Intervals, true); histo.SetMinValue(MinValue); histo.SetMaxValue(MaxValue); - for (TVector<TWeightedValue>::const_iterator it = Bins.begin(); it != Bins.end(); ++it) { + for (TVector<TWeightedValue>::const_iterator it = Bins.begin(); it != Bins.end(); ++it) { histo.AddFreq(it->second); histo.AddPosition(it->first); } @@ -311,7 +311,7 @@ namespace NKiwiAggr { void TBlockHistogram::SortBins() { Sort(Bins.begin() + PrevSize, Bins.end()); if (PrevSize != 0) { - TVector<TWeightedValue> temp(Bins.begin(), Bins.begin() + PrevSize); + TVector<TWeightedValue> temp(Bins.begin(), Bins.begin() + PrevSize); std::merge(temp.begin(), temp.end(), Bins.begin() + PrevSize, Bins.end(), Bins.begin()); } } @@ -367,7 +367,7 @@ namespace NKiwiAggr { bins[i].LinkAfter(&bins[i - 1]); } - TVector<double> pairWeights(n); + TVector<double> pairWeights(n); for (ui32 i = 0; i < n; ++i) { pairWeights[i] = CalcQuality(Bins[i], Bins[i + 1]).first; @@ -548,12 +548,12 @@ namespace NKiwiAggr { cumulatives.push_back(cumulative); } - TVector<TCumulatives::const_iterator> splits; + TVector<TCumulatives::const_iterator> splits; splits.reserve(intervals + 1); splits.push_back(cumulatives.begin()); splits.push_back(cumulatives.end() - 1); - TPriorityQueue<TSplitInfo> candidates; + TPriorityQueue<TSplitInfo> candidates; // explicitly add first split TSplitInfo newSplitInfo; diff --git a/library/cpp/histogram/adaptive/block_histogram.h b/library/cpp/histogram/adaptive/block_histogram.h index 266bb2f2b2f..ba1d26f274a 100644 --- a/library/cpp/histogram/adaptive/block_histogram.h +++ b/library/cpp/histogram/adaptive/block_histogram.h @@ -45,7 +45,7 @@ namespace NKiwiAggr { double MinValue; double MaxValue; - TVector<TWeightedValue> Bins; + TVector<TWeightedValue> Bins; public: TBlockHistogram(EHistogramType type, TQualityFunction calcQuality, @@ -60,7 +60,7 @@ namespace NKiwiAggr { virtual void Add(const THistoRec& histoRec); virtual void Merge(const THistogram& histo, double multiplier); - virtual void Merge(const TVector<THistogram>& histogramsToMerge); + virtual void Merge(const TVector<THistogram>& histogramsToMerge); virtual void Merge(TVector<IHistogramPtr> histogramsToMerge); // not implemented virtual void Multiply(double factor); @@ -123,7 +123,7 @@ namespace NKiwiAggr { private: using TCumulative = std::pair<double, double>; // cumulative sum of (weights, weighted centers) - using TCumulatives = TVector<TCumulative>; + using TCumulatives = TVector<TCumulative>; struct TSplitInfo { double profit; diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp index 558aba9e2d1..903b076a305 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp @@ -102,7 +102,7 @@ namespace NKiwiAggr { if (!IsInitialized) { if (!TrainingSet) { - TrainingSet.Reset(new TVector<TWeightedValue>(0)); + TrainingSet.Reset(new TVector<TWeightedValue>(0)); } TrainingSet->push_back(TWeightedValue(value, weight)); if (TrainingSet->size() >= TrainingSetSize) { @@ -128,17 +128,17 @@ namespace NKiwiAggr { ythrow yexception() << "Method is not implemented for TFixedBinHistogram"; } - void TFixedBinHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { - TVector<IHistogramPtr> parsedHistogramsToMerge; + void TFixedBinHistogram::Merge(const TVector<THistogram>& histogramsToMerge) { + TVector<IHistogramPtr> parsedHistogramsToMerge; for (size_t i = 0; i < histogramsToMerge.size(); ++i) { parsedHistogramsToMerge.push_back(IHistogramPtr(new TAutoHistogram(histogramsToMerge[i], Intervals, Id))); } Merge(parsedHistogramsToMerge); } - void TFixedBinHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { - TVector<IHistogramPtr> histogramsToMergeRepacked(0); - TVector<TFixedBinHistogram*> histograms(0); + void TFixedBinHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { + TVector<IHistogramPtr> histogramsToMergeRepacked(0); + TVector<TFixedBinHistogram*> histograms(0); // put current histogram to the vector of histograms to merge and clear self if (!Empty()) { @@ -485,7 +485,7 @@ namespace NKiwiAggr { } SetFrame(MinElement(TrainingSet->begin(), TrainingSet->end(), CompareWeightedValue)->first, MaxElement(TrainingSet->begin(), TrainingSet->end(), CompareWeightedValue)->first, true); - for (TVector<TWeightedValue>::const_iterator it = TrainingSet->begin(); it != TrainingSet->end(); ++it) { + for (TVector<TWeightedValue>::const_iterator it = TrainingSet->begin(); it != TrainingSet->end(); ++it) { Freqs[CalcBin(it->first)] += it->second; } TrainingSet.Destroy(); diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.h b/library/cpp/histogram/adaptive/fixed_bin_histogram.h index bd380bd94a5..05ae0db4284 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.h +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.h @@ -26,8 +26,8 @@ namespace NKiwiAggr { double MaxValue; double Sum; - TVector<double> Freqs; - TVector<double> ReserveFreqs; + TVector<double> Freqs; + TVector<double> ReserveFreqs; double ReferencePoint; double BinRange; size_t Intervals; @@ -49,8 +49,8 @@ namespace NKiwiAggr { virtual void Add(const THistoRec& histoRec); virtual void Merge(const THistogram& histo, double multiplier); - virtual void Merge(const TVector<THistogram>& histogramsToMerge); - virtual void Merge(TVector<IHistogramPtr> histogramsToMerge); + virtual void Merge(const TVector<THistogram>& histogramsToMerge); + virtual void Merge(TVector<IHistogramPtr> histogramsToMerge); virtual void Multiply(double factor); diff --git a/library/cpp/histogram/adaptive/histogram.h b/library/cpp/histogram/adaptive/histogram.h index 360fd9a6936..e6b11870e1b 100644 --- a/library/cpp/histogram/adaptive/histogram.h +++ b/library/cpp/histogram/adaptive/histogram.h @@ -29,8 +29,8 @@ namespace NKiwiAggr { // Merge some other histos into current virtual void Merge(const THistogram& histo, double multiplier) = 0; - virtual void Merge(const TVector<THistogram>& histogramsToMerge) = 0; - virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) = 0; + virtual void Merge(const TVector<THistogram>& histogramsToMerge) = 0; + virtual void Merge(TVector<IHistogramPtr> histogramsToMerge) = 0; // factor should be greater then zero virtual void Multiply(double factor) = 0; diff --git a/library/cpp/histogram/adaptive/multi_histogram.h b/library/cpp/histogram/adaptive/multi_histogram.h index 41caac5ba68..5a18999edca 100644 --- a/library/cpp/histogram/adaptive/multi_histogram.h +++ b/library/cpp/histogram/adaptive/multi_histogram.h @@ -15,7 +15,7 @@ namespace NKiwiAggr { private: static const size_t DEFAULT_INTERVALS = 100; - typedef THashMap<ui64, IHistogramPtr> THistogramsMap; + typedef THashMap<ui64, IHistogramPtr> THistogramsMap; THistogramsMap Histograms; size_t Intervals; @@ -62,8 +62,8 @@ namespace NKiwiAggr { } } - TVector<ui64> GetIds() const { - TVector<ui64> result(0); + TVector<ui64> GetIds() const { + TVector<ui64> result(0); for (THistogramsMap::const_iterator it = Histograms.begin(); it != Histograms.end(); ++it) { result.push_back(it->first); } diff --git a/library/cpp/html/escape/escape.h b/library/cpp/html/escape/escape.h index 1c45fc51933..6fc9fb4f1bc 100644 --- a/library/cpp/html/escape/escape.h +++ b/library/cpp/html/escape/escape.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NHtml { TString EscapeAttributeValue(const TString& value); diff --git a/library/cpp/html/pcdata/pcdata.cpp b/library/cpp/html/pcdata/pcdata.cpp index 740c240fd23..70fe073bb99 100644 --- a/library/cpp/html/pcdata/pcdata.cpp +++ b/library/cpp/html/pcdata/pcdata.cpp @@ -1,10 +1,10 @@ #include "pcdata.h" -#include <util/string/strspn.h> - +#include <util/string/strspn.h> + static TCompactStrSpn sspn("\"<>&'"); -static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout, bool qAmp) { +static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout, bool qAmp) { const char* s = str.data(); const char* e = s + str.length(); @@ -49,18 +49,18 @@ static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout } } -void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout) { +void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout) { EncodeHtmlPcdataAppendInternal(str, strout, true); } -TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp) { - TString strout; +TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp) { + TString strout; EncodeHtmlPcdataAppendInternal(str, strout, qAmp); return strout; } -TString DecodeHtmlPcdata(const TString& sz) { - TString res; +TString DecodeHtmlPcdata(const TString& sz) { + TString res; const char* codes[] = {""", "<", ">", "'", "'", "&", "'", nullptr}; const char chars[] = {'\"', '<', '>', '\'', '\'', '&', '\''}; for (size_t i = 0; i < sz.length(); ++i) { diff --git a/library/cpp/html/pcdata/pcdata.h b/library/cpp/html/pcdata/pcdata.h index 7dd741f53dc..c1de2d0a31a 100644 --- a/library/cpp/html/pcdata/pcdata.h +++ b/library/cpp/html/pcdata/pcdata.h @@ -3,8 +3,8 @@ #include <util/generic/fwd.h> /// Converts a text into HTML-code. Special characters of HTML («<», «>», ...) replaced with entities. -TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp = true); -void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout); +TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp = true); +void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout); /// Reverse of EncodeHtmlPcdata() -TString DecodeHtmlPcdata(const TString& sz); +TString DecodeHtmlPcdata(const TString& sz); diff --git a/library/cpp/html/pcdata/pcdata_ut.cpp b/library/cpp/html/pcdata/pcdata_ut.cpp index 5833f8bc590..6710d9dfcea 100644 --- a/library/cpp/html/pcdata/pcdata_ut.cpp +++ b/library/cpp/html/pcdata/pcdata_ut.cpp @@ -6,18 +6,18 @@ Y_UNIT_TEST_SUITE(TPcdata) { Y_UNIT_TEST(TestStress) { { ui64 key = 0x000017C0B76C4E87ull; - TString res = EncodeHtmlPcdata(TStringBuf((const char*)&key, sizeof(key))); + TString res = EncodeHtmlPcdata(TStringBuf((const char*)&key, sizeof(key))); } for (size_t i = 0; i < 1000; ++i) { - const TString s = NUnitTest::RandomString(i, i); + const TString s = NUnitTest::RandomString(i, i); UNIT_ASSERT_VALUES_EQUAL(DecodeHtmlPcdata(EncodeHtmlPcdata(s)), s); } } Y_UNIT_TEST(Test1) { - const TString tests[] = { + const TString tests[] = { "qw&qw", "&<", ">&qw", @@ -33,7 +33,7 @@ Y_UNIT_TEST_SUITE(TPcdata) { } Y_UNIT_TEST(TestEncodeHtmlPcdataAppend) { - TString s; + TString s; EncodeHtmlPcdataAppend("m&m", s); EncodeHtmlPcdataAppend("'s", s); UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("m&m's"), s); diff --git a/library/cpp/html/pcdata/ut/ya.make b/library/cpp/html/pcdata/ut/ya.make index bc947baa892..ad9f9abe479 100644 --- a/library/cpp/html/pcdata/ut/ya.make +++ b/library/cpp/html/pcdata/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/html/pcdata) - -OWNER(vladon) - -SRCS( - pcdata_ut.cpp -) - -END() + +OWNER(vladon) + +SRCS( + pcdata_ut.cpp +) + +END() diff --git a/library/cpp/html/pcdata/ya.make b/library/cpp/html/pcdata/ya.make index 637220e7065..957fd964c22 100644 --- a/library/cpp/html/pcdata/ya.make +++ b/library/cpp/html/pcdata/ya.make @@ -1,10 +1,10 @@ -LIBRARY() - -OWNER(vladon) - -SRCS( - pcdata.cpp - pcdata.h -) - -END() +LIBRARY() + +OWNER(vladon) + +SRCS( + pcdata.cpp + pcdata.h +) + +END() diff --git a/library/cpp/http/fetch/exthttpcodes.cpp b/library/cpp/http/fetch/exthttpcodes.cpp index acc05650c89..9c9fbc86b92 100644 --- a/library/cpp/http/fetch/exthttpcodes.cpp +++ b/library/cpp/http/fetch/exthttpcodes.cpp @@ -172,7 +172,7 @@ static ui16* prepare_flags(http_flag* arg) { ui16* http2status = prepare_flags(HTTP_FLAG); -TStringBuf ExtHttpCodeStr(int code) noexcept { +TStringBuf ExtHttpCodeStr(int code) noexcept { if (code < HTTP_CODE_MAX) { return HttpCodeStr(code); } diff --git a/library/cpp/http/fetch/exthttpcodes.h b/library/cpp/http/fetch/exthttpcodes.h index 6b525052cd9..e5f8c42295a 100644 --- a/library/cpp/http/fetch/exthttpcodes.h +++ b/library/cpp/http/fetch/exthttpcodes.h @@ -138,4 +138,4 @@ static inline int Http2Status(int code) { return http2status[code & (EXT_HTTP_CODE_MAX - 1)]; } -TStringBuf ExtHttpCodeStr(int code) noexcept; +TStringBuf ExtHttpCodeStr(int code) noexcept; diff --git a/library/cpp/http/fetch/http_digest.cpp b/library/cpp/http/fetch/http_digest.cpp index 1eaa02b7f24..4955ada67ca 100644 --- a/library/cpp/http/fetch/http_digest.cpp +++ b/library/cpp/http/fetch/http_digest.cpp @@ -196,7 +196,7 @@ bool httpDigestHandler::processHeader(const THttpAuthHeader* header, out << ", opaque=\"" << header->opaque << "\""; out << "\r\n"; - TString s_out = out.Str(); + TString s_out = out.Str(); HeaderInstruction_ = strdup(s_out.c_str()); return true; diff --git a/library/cpp/http/fetch/httpfsm.rl6 b/library/cpp/http/fetch/httpfsm.rl6 index eab0328b187..d0e8aab8fee 100644 --- a/library/cpp/http/fetch/httpfsm.rl6 +++ b/library/cpp/http/fetch/httpfsm.rl6 @@ -312,8 +312,8 @@ rel_canonical = "link"i def '<' url ">;"i lws "rel"i lws '=' lws "\"canonical\"" ################# hreflang ############### action set_hreflang { bool first = (hreflangpos == hd->hreflangs); - size_t len2 = (first ? 0 : 1) + langlen + 1 + buflen; - if (langlen && len2 < hreflangspace) { + size_t len2 = (first ? 0 : 1) + langlen + 1 + buflen; + if (langlen && len2 < hreflangspace) { if (!first) { *(hreflangpos++) = '\t'; } @@ -323,7 +323,7 @@ action set_hreflang { memcpy(hreflangpos, buf, buflen); hreflangpos += buflen; *(hreflangpos) = 0; - hreflangspace -= len2; + hreflangspace -= len2; } } diff --git a/library/cpp/http/fetch/httpfsm_ut.cpp b/library/cpp/http/fetch/httpfsm_ut.cpp index b018e80101b..3545b25cb6b 100644 --- a/library/cpp/http/fetch/httpfsm_ut.cpp +++ b/library/cpp/http/fetch/httpfsm_ut.cpp @@ -107,7 +107,7 @@ void THttpHeaderParserTestSuite::TestSplitRequestHeader() { for (size_t n1 = 0; n1 < rlen; n1++) { for (size_t n2 = n1; n2 < rlen; n2++) { - TString s1{request, 0, n1}; + TString s1{request, 0, n1}; TString s2{request, n1, n2 - n1}; TString s3{request, n2, rlen - n2}; UNIT_ASSERT_EQUAL(s1 + s2 + s3, request); @@ -144,7 +144,7 @@ void THttpHeaderParserTestSuite::TestTrailingData() { UNIT_ASSERT_EQUAL(httpRequestHeader.http_method, HTTP_METHOD_GET); UNIT_ASSERT_EQUAL(strcmp(httpRequestHeader.host, "www.google.ru:8080"), 0); UNIT_ASSERT_EQUAL(httpRequestHeader.request_uri, "/search?q=hi"); - UNIT_ASSERT_EQUAL(TString(httpHeaderParser->lastchar + 1), "high.ru"); + UNIT_ASSERT_EQUAL(TString(httpHeaderParser->lastchar + 1), "high.ru"); UNIT_ASSERT_EQUAL(httpRequestHeader.http_minor, 1); UNIT_ASSERT_EQUAL(httpRequestHeader.transfer_chunked, -1); UNIT_ASSERT_EQUAL(httpRequestHeader.content_length, -1); @@ -495,20 +495,20 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) { return parser; } - static THttpChunkParser parseByteByByte(const TStringBuf& blob, const TVector<int>& states) { + static THttpChunkParser parseByteByByte(const TStringBuf& blob, const TVector<int>& states) { UNIT_ASSERT(states.size() <= blob.size()); THttpChunkParser parser{initParser()}; for (size_t n = 0; n < states.size(); n++) { const TStringBuf d{blob, n, 1}; int code = parser.Execute(d.data(), d.size()); - Cout << TString(d).Quote() << " " << code << Endl; + Cout << TString(d).Quote() << " " << code << Endl; UNIT_ASSERT_EQUAL(code, states[n]); } return parser; } static THttpChunkParser parseBytesWithLastState(const TStringBuf& blob, const int last_state) { - TVector<int> states(blob.size() - 1, 1); + TVector<int> states(blob.size() - 1, 1); states.push_back(last_state); return parseByteByByte(blob, states); } @@ -517,7 +517,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) { const TStringBuf blob{ "4\r\n" "____\r\n"}; - TVector<int> states{ + TVector<int> states{ -1, /* 1, -1, 1, -1, 1, -1, 1, -1 */}; // as soon as error happens parser state should be considered @@ -540,7 +540,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) { const TStringBuf blob{ "\r\n" "-1"}; - TVector<int> states{ + TVector<int> states{ 1, 1, -1, /* 1 */}; @@ -570,7 +570,7 @@ Y_UNIT_TEST_SUITE(TestHttpChunkParser) { "4\r\n" "_" // first byte of the chunk }; - TVector<int> states{ + TVector<int> states{ 1, 1, 1, 1, 2, -1}; diff --git a/library/cpp/http/fetch/httpheader.h b/library/cpp/http/fetch/httpheader.h index b2810bbd413..071ce6fe8d3 100644 --- a/library/cpp/http/fetch/httpheader.h +++ b/library/cpp/http/fetch/httpheader.h @@ -6,7 +6,7 @@ #include <util/system/defaults.h> #include <util/system/compat.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ylimits.h> #include <util/system/maxlen.h> @@ -217,8 +217,8 @@ public: /// It doesn't care about errors in request or headers, where /// request_uri equals to '*'. /// This returns copy of the string, which you have to delete. - TString GetUrl() { - TString url; + TString GetUrl() { + TString url; if (host[0] == 0 || !strcmp(host, "")) { url = request_uri; } else { diff --git a/library/cpp/http/fetch/httpload.cpp b/library/cpp/http/fetch/httpload.cpp index 82ea8900b5c..e96ec13a803 100644 --- a/library/cpp/http/fetch/httpload.cpp +++ b/library/cpp/http/fetch/httpload.cpp @@ -336,7 +336,7 @@ bool httpLoadAgent::doStartRequest() { return false; } - TString urlBaseStr = URL_.PrintS(THttpURL::FlagNoFrag); + TString urlBaseStr = URL_.PrintS(THttpURL::FlagNoFrag); clearReader(); Reader_ = new httpAgentReader(*this, urlBaseStr.c_str(), diff --git a/library/cpp/http/fetch/httpparser_ut.cpp b/library/cpp/http/fetch/httpparser_ut.cpp index 3b3b938e7ab..1ccc667bb40 100644 --- a/library/cpp/http/fetch/httpparser_ut.cpp +++ b/library/cpp/http/fetch/httpparser_ut.cpp @@ -48,7 +48,7 @@ namespace { Y_UNIT_TEST_SUITE(TestHttpParser) { Y_UNIT_TEST(TestTrivialRequest) { - const TString blob{ + const TString blob{ "GET /search?q=hi HTTP/1.1\r\n" "Host: www.google.ru:8080 \r\n" "\r\n"}; @@ -61,7 +61,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { // XXX: `entity_size` is i32 and `content_length` is i64! Y_UNIT_TEST(TestTrivialResponse) { - const TString blob{ + const TString blob{ "HTTP/1.1 200 Ok\r\n" "Content-Length: 2\r\n" "\r\n" @@ -81,7 +81,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { // XXX: `entity_size` is off by one in TE:chunked case. Y_UNIT_TEST(TestChunkedResponse) { - const TString blob{ + const TString blob{ "HTTP/1.1 200 OK\r\n" "Transfer-Encoding: chunked\r\n" "\r\n" @@ -111,7 +111,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { "\r\n")); } - static const TString PipelineClenBlob_{ + static const TString PipelineClenBlob_{ "HTTP/1.1 200 Ok\r\n" "Content-Length: 4\r\n" "\r\n" @@ -131,14 +131,14 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { } Y_UNIT_TEST(TestPipelineClenByteByByte) { - const TString& blob = PipelineClenBlob_; + const TString& blob = PipelineClenBlob_; THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); for (size_t i = 0; i < blob.size(); ++i) { const TStringBuf d{blob, i, 1}; parser.Parse((void*)d.data(), d.size()); - Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl; + Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl; } AssertPipelineClen(parser, hdr); UNIT_ASSERT_EQUAL(parser.Body(), "OK\r\n"); @@ -147,7 +147,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { // XXX: Content-Length is ignored, Body() looks unexpected! Y_UNIT_TEST(TestPipelineClenOneChunk) { - const TString& blob = PipelineClenBlob_; + const TString& blob = PipelineClenBlob_; THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); @@ -167,7 +167,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { "ZZ\r\n")); } - static const TString PipelineChunkedBlob_{ + static const TString PipelineChunkedBlob_{ "HTTP/1.1 200 OK\r\n" "Transfer-Encoding: chunked\r\n" "\r\n" @@ -206,14 +206,14 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { } Y_UNIT_TEST(TestPipelineChunkedByteByByte) { - const TString& blob = PipelineChunkedBlob_; + const TString& blob = PipelineChunkedBlob_; THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); for (size_t i = 0; i < blob.size(); ++i) { const TStringBuf d{blob, i, 1}; parser.Parse((void*)d.data(), d.size()); - Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl; + Cout << TString(d).Quote() << " -> " << parser.GetState() << Endl; if (blob.size() / 2 - 1 <= i) // last \n sets EOF UNIT_ASSERT_EQUAL(parser.GetState(), parser.hp_eof); } @@ -221,7 +221,7 @@ Y_UNIT_TEST_SUITE(TestHttpParser) { } Y_UNIT_TEST(TestPipelineChunkedOneChunk) { - const TString& blob = PipelineChunkedBlob_; + const TString& blob = PipelineChunkedBlob_; THttpHeader hdr; TTestHttpParser parser; parser.Init(&hdr); diff --git a/library/cpp/http/io/chunk.cpp b/library/cpp/http/io/chunk.cpp index 6975d9eac1e..181a6cec114 100644 --- a/library/cpp/http/io/chunk.cpp +++ b/library/cpp/http/io/chunk.cpp @@ -6,14 +6,14 @@ #include <util/generic/utility.h> #include <util/generic/yexception.h> -static inline size_t ParseHex(const TString& s) { +static inline size_t ParseHex(const TString& s) { if (s.empty()) { ythrow yexception() << "can not parse chunk length(empty string)"; } size_t ret = 0; - for (TString::const_iterator c = s.begin(); c != s.end(); ++c) { + for (TString::const_iterator c = s.begin(); c != s.end(); ++c) { const char ch = *c; if (ch >= '0' && ch <= '9') { @@ -61,7 +61,7 @@ public: } } - inline ~TImpl() { + inline ~TImpl() { } inline size_t Read(void* buf, size_t len) { @@ -111,7 +111,7 @@ private: } inline bool ProceedToNextChunk() { - TString len(Slave_->ReadLine()); + TString len(Slave_->ReadLine()); if (len.empty()) { /* @@ -147,7 +147,7 @@ TChunkedInput::TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers { } -TChunkedInput::~TChunkedInput() { +TChunkedInput::~TChunkedInput() { } size_t TChunkedInput::DoRead(void* buf, size_t len) { @@ -167,7 +167,7 @@ public: { } - inline ~TImpl() { + inline ~TImpl() { } inline void Write(const void* buf, size_t len) { @@ -217,7 +217,7 @@ TChunkedOutput::TChunkedOutput(IOutputStream* slave) { } -TChunkedOutput::~TChunkedOutput() { +TChunkedOutput::~TChunkedOutput() { try { Finish(); } catch (...) { diff --git a/library/cpp/http/io/chunk.h b/library/cpp/http/io/chunk.h index 88d89fafda2..d73cbf15237 100644 --- a/library/cpp/http/io/chunk.h +++ b/library/cpp/http/io/chunk.h @@ -16,7 +16,7 @@ public: /// Если передан указатель на trailers, то туда будут записаны HTTP trailer'ы (возможно пустые), /// которые идут после чанков. TChunkedInput(IInputStream* slave, TMaybe<THttpHeaders>* trailers = nullptr); - ~TChunkedInput() override; + ~TChunkedInput() override; private: size_t DoRead(void* buf, size_t len) override; @@ -33,7 +33,7 @@ private: class TChunkedOutput: public IOutputStream { public: TChunkedOutput(IOutputStream* slave); - ~TChunkedOutput() override; + ~TChunkedOutput() override; private: void DoWrite(const void* buf, size_t len) override; diff --git a/library/cpp/http/io/chunk_ut.cpp b/library/cpp/http/io/chunk_ut.cpp index da283f85680..2fb65a92f5d 100644 --- a/library/cpp/http/io/chunk_ut.cpp +++ b/library/cpp/http/io/chunk_ut.cpp @@ -11,8 +11,8 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { static const char test_data[] = "87s6cfbsudg cuisg s igasidftasiy tfrcua6s"; - TString CombString(const TString& s, size_t chunkSize) { - TString result; + TString CombString(const TString& s, size_t chunkSize) { + TString result; for (size_t pos = 0; pos < s.size(); pos += 2 * chunkSize) result += s.substr(pos, chunkSize); return result; @@ -59,18 +59,18 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { Y_UNIT_TEST(TestChunkedIo) { TTempFile tmpFile(CDATA); - TString tmp; + TString tmp; { - TUnbufferedFileOutput fo(CDATA); + TUnbufferedFileOutput fo(CDATA); TChunkedOutput co(&fo); WriteTestData(&co, &tmp); } { - TUnbufferedFileInput fi(CDATA); + TUnbufferedFileInput fi(CDATA); TChunkedInput ci(&fi); - TString r; + TString r; ReadInSmallChunks(&ci, &r); @@ -78,9 +78,9 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { } { - TUnbufferedFileInput fi(CDATA); + TUnbufferedFileInput fi(CDATA); TChunkedInput ci(&fi); - TString r; + TString r; ReadCombed(&ci, &r, 11); @@ -92,7 +92,7 @@ Y_UNIT_TEST_SUITE(TestChunkedIO) { bool hasError = false; try { - TString badChunk = "10\r\nqwerty"; + TString badChunk = "10\r\nqwerty"; TMemoryInput mi(badChunk.data(), badChunk.size()); TChunkedInput ci(&mi); TransferData(&ci, &Cnull); diff --git a/library/cpp/http/io/headers.cpp b/library/cpp/http/io/headers.cpp index 4ec27a29e83..3647828946f 100644 --- a/library/cpp/http/io/headers.cpp +++ b/library/cpp/http/io/headers.cpp @@ -8,14 +8,14 @@ #include <util/string/cast.h> #include <util/string/strip.h> -static inline TStringBuf Trim(const char* b, const char* e) noexcept { +static inline TStringBuf Trim(const char* b, const char* e) noexcept { return StripString(TStringBuf(b, e)); } THttpInputHeader::THttpInputHeader(const TStringBuf header) { size_t pos = header.find(':'); - if (pos == TString::npos) { + if (pos == TString::npos) { ythrow THttpParseException() << "can not parse http header(" << TString{header}.Quote() << ")"; } @@ -43,8 +43,8 @@ void THttpInputHeader::OutTo(IOutputStream* stream) const { } THttpHeaders::THttpHeaders(IInputStream* stream) { - TString header; - TString line; + TString header; + TString line; bool rdOk = stream->ReadLine(header); while (rdOk && !header.empty()) { diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h index a71793d1c68..139aab2f817 100644 --- a/library/cpp/http/io/headers.h +++ b/library/cpp/http/io/headers.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/deque.h> #include <util/generic/vector.h> @@ -21,12 +21,12 @@ public: THttpInputHeader(TString name, TString value); /// Возвращает имя параметра. - inline const TString& Name() const noexcept { + inline const TString& Name() const noexcept { return Name_; } /// Возвращает значение параметра. - inline const TString& Value() const noexcept { + inline const TString& Value() const noexcept { return Value_; } @@ -34,13 +34,13 @@ public: void OutTo(IOutputStream* stream) const; /// Возвращает строку "имя параметра: значение". - inline TString ToString() const { + inline TString ToString() const { return Name_ + TStringBuf(": ") + Value_; } private: - TString Name_; - TString Value_; + TString Name_; + TString Value_; }; /// Контейнер для хранения HTTP-заголовков @@ -56,7 +56,7 @@ public: THttpHeaders(IInputStream* stream); /// Стандартный итератор. - inline TConstIterator Begin() const noexcept { + inline TConstIterator Begin() const noexcept { return Headers_.begin(); } inline TConstIterator begin() const noexcept { @@ -64,7 +64,7 @@ public: } /// Стандартный итератор. - inline TConstIterator End() const noexcept { + inline TConstIterator End() const noexcept { return Headers_.end(); } inline TConstIterator end() const noexcept { @@ -72,12 +72,12 @@ public: } /// Возвращает количество заголовков в контейнере. - inline size_t Count() const noexcept { + inline size_t Count() const noexcept { return Headers_.size(); } /// Проверяет, содержит ли контейнер хотя бы один заголовок. - inline bool Empty() const noexcept { + inline bool Empty() const noexcept { return Headers_.empty(); } @@ -114,7 +114,7 @@ public: void OutTo(IOutputStream* stream) const; /// Обменивает наборы заголовков двух контейнеров. - void Swap(THttpHeaders& headers) noexcept { + void Swap(THttpHeaders& headers) noexcept { Headers_.swap(headers.Headers_); } diff --git a/library/cpp/http/io/headers_ut.cpp b/library/cpp/http/io/headers_ut.cpp index 1d23ef8fdcb..12c45b3b7f3 100644 --- a/library/cpp/http/io/headers_ut.cpp +++ b/library/cpp/http/io/headers_ut.cpp @@ -1,5 +1,5 @@ #include <util/generic/set.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <utility> @@ -21,7 +21,7 @@ namespace { public: void Add(TStringBuf name, TStringBuf value) { - Impl.emplace(TString(name), TString(value)); + Impl.emplace(TString(name), TString(value)); } bool operator==(const THeadersExistence& rhs) const { @@ -29,7 +29,7 @@ namespace { } private: - typedef TMultiSet<std::pair<TString, TString>> TImpl; + typedef TMultiSet<std::pair<TString, TString>> TImpl; TImpl Impl; }; } @@ -66,11 +66,11 @@ public: private: static void AddHeaderImpl1Arg(THttpHeaders& headers, TStringBuf name, TStringBuf value) { - headers.AddHeader(THttpInputHeader(TString(name), TString(value))); + headers.AddHeader(THttpInputHeader(TString(name), TString(value))); } static void AddHeaderImpl2Args(THttpHeaders& headers, TStringBuf name, TStringBuf value) { - headers.AddHeader(TString(name), TString(value)); + headers.AddHeader(TString(name), TString(value)); } static void AddOrReplaceHeaderImpl1Arg(THttpHeaders& headers, TStringBuf name, TStringBuf value) { @@ -154,7 +154,7 @@ void THttpHeadersTest::DoTestAddOrReplaceOperation(TAddHeaderFunction addHeader, void THttpHeadersTest::TestAddHeaderTemplateness() { THttpHeaders h1; h1.AddHeader("h1", "v1"); - h1.AddHeader("h2", TString("v2")); + h1.AddHeader("h2", TString("v2")); h1.AddHeader("h3", TStringBuf("v3")); h1.AddHeader("h4", TStringBuf("v4")); diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp index 6689be684fc..25859087c3e 100644 --- a/library/cpp/http/io/stream.cpp +++ b/library/cpp/http/io/stream.cpp @@ -17,7 +17,7 @@ #include <util/string/cast.h> #include <util/string/strip.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/utility.h> #include <util/generic/hash_set.h> #include <util/generic/yexception.h> @@ -131,7 +131,7 @@ namespace { } class THttpInput::TImpl { - typedef THashSet<TString> TAcceptCodings; + typedef THashSet<TString> TAcceptCodings; public: inline TImpl(IInputStream* slave) @@ -157,7 +157,7 @@ public: return s; } - inline ~TImpl() { + inline ~TImpl() { } inline size_t Read(void* buf, size_t len) { @@ -168,11 +168,11 @@ public: return Perform(len, [this](size_t toSkip) { return Input_->Skip(toSkip); }); } - inline const TString& FirstLine() const noexcept { + inline const TString& FirstLine() const noexcept { return FirstLine_; } - inline const THttpHeaders& Headers() const noexcept { + inline const THttpHeaders& Headers() const noexcept { return Headers_; } @@ -180,15 +180,15 @@ public: return Trailers_; } - inline bool IsKeepAlive() const noexcept { + inline bool IsKeepAlive() const noexcept { return KeepAlive_; } - inline bool AcceptEncoding(const TString& s) const { + inline bool AcceptEncoding(const TString& s) const { return Codings_.find(to_lower(s)) != Codings_.end(); } - inline bool GetContentLength(ui64& value) const noexcept { + inline bool GetContentLength(ui64& value) const noexcept { if (HasContentLength_) { value = ContentLength_; return true; @@ -196,7 +196,7 @@ public: return false; } - inline bool ContentEncoded() const noexcept { + inline bool ContentEncoded() const noexcept { return ContentEncoded_; } @@ -252,7 +252,7 @@ private: }; template <class Functor> - inline void ForEach(TString in, Functor& f) { + inline void ForEach(TString in, Functor& f) { in.to_lower(); const char* b = in.begin(); @@ -287,7 +287,7 @@ private: size_t pos = FirstLine_.rfind(' '); // In HTTP/1.1 Keep-Alive is turned on by default - if (pos != TString::npos && strcmp(FirstLine_.c_str() + pos + 1, "HTTP/1.1") == 0) { + if (pos != TString::npos && strcmp(FirstLine_.c_str() + pos + 1, "HTTP/1.1") == 0) { p.KeepAlive = true; //request } else if (strnicmp(FirstLine_.data(), "HTTP/1.1", 8) == 0) { p.KeepAlive = true; //reply @@ -375,7 +375,7 @@ private: */ IInputStream* Input_; - TString FirstLine_; + TString FirstLine_; THttpHeaders Headers_; TMaybe<THttpHeaders> Trailers_; bool KeepAlive_; @@ -396,7 +396,7 @@ THttpInput::THttpInput(IInputStream* slave) THttpInput::THttpInput(THttpInput&& httpInput) = default; -THttpInput::~THttpInput() { +THttpInput::~THttpInput() { } size_t THttpInput::DoRead(void* buf, size_t len) { @@ -407,7 +407,7 @@ size_t THttpInput::DoSkip(size_t len) { return Impl_->Skip(len); } -const THttpHeaders& THttpInput::Headers() const noexcept { +const THttpHeaders& THttpInput::Headers() const noexcept { return Impl_->Headers(); } @@ -415,15 +415,15 @@ const TMaybe<THttpHeaders>& THttpInput::Trailers() const noexcept { return Impl_->Trailers(); } -const TString& THttpInput::FirstLine() const noexcept { +const TString& THttpInput::FirstLine() const noexcept { return Impl_->FirstLine(); } -bool THttpInput::IsKeepAlive() const noexcept { +bool THttpInput::IsKeepAlive() const noexcept { return Impl_->IsKeepAlive(); } -bool THttpInput::AcceptEncoding(const TString& coding) const { +bool THttpInput::AcceptEncoding(const TString& coding) const { return Impl_->AcceptEncoding(coding); } @@ -440,11 +440,11 @@ TString THttpInput::BestCompressionScheme() const { return BestCompressionScheme(TCompressionCodecFactory::Instance().GetBestCodecs()); } -bool THttpInput::GetContentLength(ui64& value) const noexcept { +bool THttpInput::GetContentLength(ui64& value) const noexcept { return Impl_->GetContentLength(value); } -bool THttpInput::ContentEncoded() const noexcept { +bool THttpInput::ContentEncoded() const noexcept { return Impl_->ContentEncoded(); } @@ -459,17 +459,17 @@ bool THttpInput::HasExpect100Continue() const noexcept { class THttpOutput::TImpl { class TSizeCalculator: public IOutputStream { public: - inline TSizeCalculator() noexcept { + inline TSizeCalculator() noexcept { } - ~TSizeCalculator() override { + ~TSizeCalculator() override { } void DoWrite(const void* /*buf*/, size_t len) override { Length_ += len; } - inline size_t Length() const noexcept { + inline size_t Length() const noexcept { return Length_; } @@ -509,7 +509,7 @@ public: { } - inline ~TImpl() { + inline ~TImpl() { } inline void SendContinue() { @@ -579,7 +579,7 @@ public: Finished_ = true; } - inline const THttpHeaders& SentHeaders() const noexcept { + inline const THttpHeaders& SentHeaders() const noexcept { return Headers_; } @@ -599,11 +599,11 @@ public: CompressionHeaderEnabled_ = enable; } - inline bool IsCompressionEnabled() const noexcept { + inline bool IsCompressionEnabled() const noexcept { return !ComprSchemas_.empty(); } - inline bool IsKeepAliveEnabled() const noexcept { + inline bool IsKeepAliveEnabled() const noexcept { return KeepAliveEnabled_; } @@ -615,7 +615,7 @@ public: return CompressionHeaderEnabled_; } - inline bool CanBeKeepAlive() const noexcept { + inline bool CanBeKeepAlive() const noexcept { return SupportChunkedTransfer() && IsKeepAliveEnabled() && (Request_ ? Request_->IsKeepAlive() : true); } @@ -628,15 +628,15 @@ public: } private: - static inline bool IsResponse(const TString& s) noexcept { + static inline bool IsResponse(const TString& s) noexcept { return strnicmp(s.data(), "HTTP/", 5) == 0; } - static inline bool IsRequest(const TString& s) noexcept { + static inline bool IsRequest(const TString& s) noexcept { return !IsResponse(s); } - inline bool IsHttpRequest() const noexcept { + inline bool IsHttpRequest() const noexcept { return IsRequest(FirstLine_); } @@ -651,16 +651,16 @@ private: return false; } - inline bool IsHttpResponse() const noexcept { + inline bool IsHttpResponse() const noexcept { return IsResponse(FirstLine_); } - inline bool HasRequestBody() const noexcept { + inline bool HasRequestBody() const noexcept { return strnicmp(FirstLine_.data(), "POST", 4) == 0 || strnicmp(FirstLine_.data(), "PATCH", 5) == 0 || strnicmp(FirstLine_.data(), "PUT", 3) == 0; } - static inline size_t ParseHttpVersion(const TString& s) { + static inline size_t ParseHttpVersion(const TString& s) { if (s.empty()) { ythrow THttpParseException() << "malformed http stream"; } @@ -709,7 +709,7 @@ private: Version_ = parsed_version; } - inline void Process(const TString& s) { + inline void Process(const TString& s) { Y_ASSERT(State_ != HeadersSent); if (State_ == Begin) { @@ -760,7 +760,7 @@ private: } } - inline bool SupportChunkedTransfer() const noexcept { + inline bool SupportChunkedTransfer() const noexcept { return Version_ >= 1100; } @@ -791,8 +791,8 @@ private: } } - inline TString BuildAcceptEncoding() const { - TString ret; + inline TString BuildAcceptEncoding() const { + TString ret; for (const auto& coding : ComprSchemas_) { if (ret) { @@ -813,7 +813,7 @@ private: for (THttpHeaders::TConstIterator h = Headers_.Begin(); h != Headers_.End(); ++h) { const THttpInputHeader& header = *h; - const TString hl = to_lower(header.Name()); + const TString hl = to_lower(header.Name()); if (hl == TStringBuf("connection")) { keepAlive = to_lower(header.Value()) == TStringBuf("keep-alive"); @@ -850,7 +850,7 @@ private: Headers_.AddOrReplaceHeader(hdr); } - inline void RemoveHeader(const TString& hdr) { + inline void RemoveHeader(const TString& hdr) { Headers_.RemoveHeader(hdr); } @@ -859,8 +859,8 @@ private: TState State_; IOutputStream* Output_; TStreams<IOutputStream, 8> Streams_; - TString Line_; - TString FirstLine_; + TString Line_; + TString FirstLine_; THttpHeaders Headers_; THttpInput* Request_; size_t Version_; @@ -886,7 +886,7 @@ THttpOutput::THttpOutput(IOutputStream* slave, THttpInput* request) { } -THttpOutput::~THttpOutput() { +THttpOutput::~THttpOutput() { try { Finish(); } catch (...) { @@ -905,7 +905,7 @@ void THttpOutput::DoFinish() { Impl_->Finish(); } -const THttpHeaders& THttpOutput::SentHeaders() const noexcept { +const THttpHeaders& THttpOutput::SentHeaders() const noexcept { return Impl_->SentHeaders(); } @@ -934,7 +934,7 @@ void THttpOutput::EnableCompressionHeader(bool enable) { Impl_->EnableCompressionHeader(enable); } -bool THttpOutput::IsKeepAliveEnabled() const noexcept { +bool THttpOutput::IsKeepAliveEnabled() const noexcept { return Impl_->IsKeepAliveEnabled(); } @@ -942,7 +942,7 @@ bool THttpOutput::IsBodyEncodingEnabled() const noexcept { return Impl_->IsBodyEncodingEnabled(); } -bool THttpOutput::IsCompressionEnabled() const noexcept { +bool THttpOutput::IsCompressionEnabled() const noexcept { return Impl_->IsCompressionEnabled(); } @@ -950,7 +950,7 @@ bool THttpOutput::IsCompressionHeaderEnabled() const noexcept { return Impl_->IsCompressionHeaderEnabled(); } -bool THttpOutput::CanBeKeepAlive() const noexcept { +bool THttpOutput::CanBeKeepAlive() const noexcept { return Impl_->CanBeKeepAlive(); } diff --git a/library/cpp/http/io/stream.h b/library/cpp/http/io/stream.h index 78ca4fc814c..1ad69a0329b 100644 --- a/library/cpp/http/io/stream.h +++ b/library/cpp/http/io/stream.h @@ -5,7 +5,7 @@ #include <util/stream/output.h> #include <util/generic/maybe.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/yexception.h> #include <util/generic/array_ref.h> @@ -26,13 +26,13 @@ class THttpInput: public IInputStream { public: THttpInput(IInputStream* slave); THttpInput(THttpInput&& httpInput); - ~THttpInput() override; + ~THttpInput() override; /* * parsed http headers */ /// Возвращает контейнер с заголовками ответа HTTP-сервера. - const THttpHeaders& Headers() const noexcept; + const THttpHeaders& Headers() const noexcept; /* * parsed http trailers @@ -49,7 +49,7 @@ public: /// Возвращает первую строку ответа HTTP-сервера. /// @details Первая строка HTTP-сервера - строка состояния, /// содержащая три поля: версию HTTP, код состояния и описание. - const TString& FirstLine() const noexcept; + const TString& FirstLine() const noexcept; /* * connection can be keep-alive @@ -57,29 +57,29 @@ public: /// Проверяет, не завершено ли соединение с сервером. /// @details Транзакция считается завершенной, если не передан заголовок /// "Connection: Keep Alive". - bool IsKeepAlive() const noexcept; + bool IsKeepAlive() const noexcept; /* * output data can be encoded */ /// Проверяет, поддерживается ли данный тип кодирования содержимого /// ответа HTTP-сервера. - bool AcceptEncoding(const TString& coding) const; + bool AcceptEncoding(const TString& coding) const; /// Пытается определить наилучший тип кодирования ответа HTTP-сервера. /// @details Если ответ сервера говорит о том, что поддерживаются /// любые типы кодирования, выбирается gzip. В противном случае /// из списка типов кодирования выбирается лучший из поддерживаемых сервером. - TString BestCompressionScheme() const; + TString BestCompressionScheme() const; TString BestCompressionScheme(TArrayRef<const TStringBuf> codings) const; /// Если заголовки содержат Content-Length, возвращает true и /// записывает значение из заголовка в value - bool GetContentLength(ui64& value) const noexcept; + bool GetContentLength(ui64& value) const noexcept; /// Признак запакованности данных, - если выставлен, то Content-Length, при наличии в заголовках, /// показывает объём запакованных данных, а из THttpInput мы будем вычитывать уже распакованные. - bool ContentEncoded() const noexcept; + bool ContentEncoded() const noexcept; /// Returns true if Content-Length or Transfer-Encoding header received bool HasContent() const noexcept; @@ -100,13 +100,13 @@ class THttpOutput: public IOutputStream { public: THttpOutput(IOutputStream* slave); THttpOutput(IOutputStream* slave, THttpInput* request); - ~THttpOutput() override; + ~THttpOutput() override; /* * sent http headers */ /// Возвращает контейнер с заголовками запроса к HTTP-серверу. - const THttpHeaders& SentHeaders() const noexcept; + const THttpHeaders& SentHeaders() const noexcept; /// Устанавливает режим, при котором сервер выдает ответ в упакованном виде. void EnableCompression(bool enable); @@ -125,10 +125,10 @@ public: void EnableCompressionHeader(bool enable); /// Проверяет, производится ли выдача ответов в упакованном виде. - bool IsCompressionEnabled() const noexcept; + bool IsCompressionEnabled() const noexcept; /// Проверяет, не завершается ли соединение с сервером после окончания транзакции. - bool IsKeepAliveEnabled() const noexcept; + bool IsKeepAliveEnabled() const noexcept; /// Проверяет, преобразуется ли тело HTTP-запроса/ответа в соответствии /// с заголовками Content-Encoding и Transfer-Encoding @@ -143,7 +143,7 @@ public: */ /// Проверяет, можно ли установить режим, при котором соединение с сервером /// не завершается после окончания транзакции. - bool CanBeKeepAlive() const noexcept; + bool CanBeKeepAlive() const noexcept; void SendContinue(); diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp index 1ea35df675a..c67d6ce48c6 100644 --- a/library/cpp/http/io/stream_ut.cpp +++ b/library/cpp/http/io/stream_ut.cpp @@ -60,7 +60,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { }; public: - inline TTestHttpServer(const TString& res) + inline TTestHttpServer(const TString& res) : Res_(res) { } @@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } private: - TString Res_; + TString Res_; size_t LastRequestSentSize_ = 0; }; @@ -83,7 +83,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } Y_UNIT_TEST(TestHttpInput) { - TString res = "I'm a teapot"; + TString res = "I'm a teapot"; TPortManager pm; const ui16 port = pm.GetPort(); @@ -106,7 +106,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { output.EnableKeepAlive(true); output.EnableCompression(true); - TString r; + TString r; r += "GET / HTTP/1.1"; r += "\r\n"; r += "Host: yandex.lo"; @@ -180,56 +180,56 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { Y_UNIT_TEST(TestKeepAlive) { { - TString s = "GET / HTTP/1.0\r\n\r\n"; + TString s = "GET / HTTP/1.0\r\n\r\n"; TStringInput si(s); THttpInput in(&si); UNIT_ASSERT(!in.IsKeepAlive()); } { - TString s = "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n"; + TString s = "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n"; TStringInput si(s); THttpInput in(&si); UNIT_ASSERT(in.IsKeepAlive()); } { - TString s = "GET / HTTP/1.1\r\n\r\n"; + TString s = "GET / HTTP/1.1\r\n\r\n"; TStringInput si(s); THttpInput in(&si); UNIT_ASSERT(in.IsKeepAlive()); } { - TString s = "GET / HTTP/1.1\r\nConnection: close\r\n\r\n"; + TString s = "GET / HTTP/1.1\r\nConnection: close\r\n\r\n"; TStringInput si(s); THttpInput in(&si); UNIT_ASSERT(!in.IsKeepAlive()); } { - TString s = "HTTP/1.0 200 Ok\r\n\r\n"; + TString s = "HTTP/1.0 200 Ok\r\n\r\n"; TStringInput si(s); THttpInput in(&si); UNIT_ASSERT(!in.IsKeepAlive()); } { - TString s = "HTTP/1.0 200 Ok\r\nConnection: keep-alive\r\n\r\n"; + TString s = "HTTP/1.0 200 Ok\r\nConnection: keep-alive\r\n\r\n"; TStringInput si(s); THttpInput in(&si); UNIT_ASSERT(in.IsKeepAlive()); } { - TString s = "HTTP/1.1 200 Ok\r\n\r\n"; + TString s = "HTTP/1.1 200 Ok\r\n\r\n"; TStringInput si(s); THttpInput in(&si); UNIT_ASSERT(in.IsKeepAlive()); } { - TString s = "HTTP/1.1 200 Ok\r\nConnection: close\r\n\r\n"; + TString s = "HTTP/1.1 200 Ok\r\nConnection: close\r\n\r\n"; TStringInput si(s); THttpInput in(&si); UNIT_ASSERT(!in.IsKeepAlive()); @@ -237,7 +237,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } Y_UNIT_TEST(TestMinRequest) { - TString res = "qqqqqq"; + TString res = "qqqqqq"; TPortManager pm; const ui16 port = pm.GetPort(); @@ -263,7 +263,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } Y_UNIT_TEST(TestResponseWithBlanks) { - TString res = "qqqqqq\r\n\r\nsdasdsad\r\n"; + TString res = "qqqqqq\r\n\r\nsdasdsad\r\n"; TPortManager pm; const ui16 port = pm.GetPort(); @@ -282,13 +282,13 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { THttpInput input(&si); unsigned httpCode = ParseHttpRetCode(input.FirstLine()); UNIT_ASSERT_VALUES_EQUAL(httpCode, 200u); - TString reply = input.ReadAll(); + TString reply = input.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(reply, res); server.Stop(); } Y_UNIT_TEST(TestOutputFlush) { - TString str; + TString str; TStringOutput strOut(str); TBufferedOutput bufOut(&strOut, 8192); THttpOutput httpOut(&bufOut); @@ -308,8 +308,8 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } Y_UNIT_TEST(TestOutputPostFlush) { - TString str; - TString checkStr; + TString str; + TString checkStr; TStringOutput strOut(str); TStringOutput checkOut(checkStr); TBufferedOutput bufOut(&strOut, 8192); @@ -333,7 +333,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } TString MakeHttpOutputBody(const char* body, bool encodingEnabled) { - TString str; + TString str; TStringOutput strOut(str); { TBufferedOutput bufOut(&strOut, 8192); @@ -353,7 +353,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } const char* bodyDelimiter = "\r\n\r\n"; size_t bodyPos = str.find(bodyDelimiter); - UNIT_ASSERT(bodyPos != TString::npos); + UNIT_ASSERT(bodyPos != TString::npos); return str.substr(bodyPos + strlen(bodyDelimiter)); }; @@ -373,7 +373,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } Y_UNIT_TEST(TestOutputFinish) { - TString str; + TString str; TStringOutput strOut(str); TBufferedOutput bufOut(&strOut, 8192); THttpOutput httpOut(&bufOut); @@ -399,8 +399,8 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { const char* headerLine3 = "\tAccept-Language"; const char* headerLine4 = "Content-Length: 18"; - TString endLine("\r\n"); - TString r; + TString endLine("\r\n"); + TString r; r += headerLine0 + endLine; r += headerLine1 + endLine; r += headerLine2 + endLine; @@ -414,15 +414,15 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL(httpHeaders.Count(), 3u); THttpHeaders::TConstIterator it = httpHeaders.Begin(); - UNIT_ASSERT_VALUES_EQUAL(it->ToString(), TString(headerLine1)); - UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString::Join(headerLine2, headerLine3)); - UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString(headerLine4)); + UNIT_ASSERT_VALUES_EQUAL(it->ToString(), TString(headerLine1)); + UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString::Join(headerLine2, headerLine3)); + UNIT_ASSERT_VALUES_EQUAL((++it)->ToString(), TString(headerLine4)); } Y_UNIT_TEST(ContentLengthRemoval) { TMemoryInput request("GET / HTTP/1.1\r\nAccept-Encoding: gzip\r\n\r\n"); THttpInput i(&request); - TString result; + TString result; TStringOutput out(result); THttpOutput httpOut(&out, &i); @@ -661,7 +661,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { out << "HTTP/1.1 200 OK\r\nConnection: Keep-Alive\r\n\r\n"; out << ""; out.Finish(); - TString result = outBuf.Str(); + TString result = outBuf.Str(); UNIT_ASSERT(!result.Contains(TStringBuf("0\r\n"))); } diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp index ad8c80ac1e5..40208b7d189 100644 --- a/library/cpp/http/misc/httpcodes.cpp +++ b/library/cpp/http/misc/httpcodes.cpp @@ -1,6 +1,6 @@ #include "httpcodes.h" -TStringBuf HttpCodeStrEx(int code) noexcept { +TStringBuf HttpCodeStrEx(int code) noexcept { switch (code) { case HTTP_CONTINUE: return TStringBuf("100 Continue"); diff --git a/library/cpp/http/misc/httpcodes.h b/library/cpp/http/misc/httpcodes.h index cbfbaa1188d..e655dd5bd16 100644 --- a/library/cpp/http/misc/httpcodes.h +++ b/library/cpp/http/misc/httpcodes.h @@ -75,20 +75,20 @@ enum HttpCodes { HTTP_CODE_MAX }; -TStringBuf HttpCodeStrEx(int code) noexcept; +TStringBuf HttpCodeStrEx(int code) noexcept; -inline TStringBuf HttpCodeStr(int code) noexcept { +inline TStringBuf HttpCodeStr(int code) noexcept { return HttpCodeStrEx(code).Skip(4); } -inline bool IsHttpCode(int code) noexcept { +inline bool IsHttpCode(int code) noexcept { return HttpCodeStrEx(code).data() != HttpCodeStrEx(0).data(); } -inline bool IsUserError(int code) noexcept { +inline bool IsUserError(int code) noexcept { return code >= 400 && code < 500; } -inline bool IsServerError(int code) noexcept { +inline bool IsServerError(int code) noexcept { return code >= 500; } diff --git a/library/cpp/http/misc/httpdate.cpp b/library/cpp/http/misc/httpdate.cpp index 4a3031bbf4d..8fcfc002e6a 100644 --- a/library/cpp/http/misc/httpdate.cpp +++ b/library/cpp/http/misc/httpdate.cpp @@ -76,8 +76,8 @@ char* format_http_date(time_t when, char* buf, size_t buflen) { return buf; } -TString FormatHttpDate(time_t when) { +TString FormatHttpDate(time_t when) { char str[64] = {0}; format_http_date(str, Y_ARRAY_SIZE(str), when); - return TString(str); + return TString(str); } diff --git a/library/cpp/http/misc/httpdate.h b/library/cpp/http/misc/httpdate.h index 04876f38feb..2d66154243b 100644 --- a/library/cpp/http/misc/httpdate.h +++ b/library/cpp/http/misc/httpdate.h @@ -1,7 +1,7 @@ #pragma once #include <util/datetime/base.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <ctime> @@ -18,4 +18,4 @@ inline time_t parse_http_date(const TStringBuf& datestring) { int format_http_date(char buf[], size_t size, time_t when); char* format_http_date(time_t when, char* buf, size_t len); -TString FormatHttpDate(time_t when); +TString FormatHttpDate(time_t when); diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp index f6951f68cd9..27fa66f9c69 100644 --- a/library/cpp/http/misc/httpreqdata.cpp +++ b/library/cpp/http/misc/httpreqdata.cpp @@ -74,7 +74,7 @@ const char* TBaseServerRequestData::HeaderIn(TStringBuf key) const { return it->second.data(); } -TString TBaseServerRequestData::HeaderByIndex(size_t n) const noexcept { +TString TBaseServerRequestData::HeaderByIndex(size_t n) const noexcept { if (n >= HeadersCount()) { return nullptr; } @@ -179,7 +179,7 @@ bool TBaseServerRequestData::Parse(const char* origReq) { return true; } -void TBaseServerRequestData::AddHeader(const TString& name, const TString& value) { +void TBaseServerRequestData::AddHeader(const TString& name, const TString& value) { HeadersIn_[name] = value; if (stricmp(name.data(), "Host") == 0) { @@ -190,7 +190,7 @@ void TBaseServerRequestData::AddHeader(const TString& name, const TString& value } } -void TBaseServerRequestData::SetPath(const TString& path) { +void TBaseServerRequestData::SetPath(const TString& path) { PathStorage = TBuffer(path.data(), path.size() + 1); Path = PathStorage.Data(); } diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h index 16e59c4d78c..74448db8d73 100644 --- a/library/cpp/http/misc/httpreqdata.h +++ b/library/cpp/http/misc/httpreqdata.h @@ -11,7 +11,7 @@ #include <util/network/socket.h> #include <util/generic/hash.h> #include <util/system/yassert.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/datetime/base.h> #include <util/generic/buffer.h> @@ -22,12 +22,12 @@ public: TBaseServerRequestData(SOCKET s = INVALID_SOCKET); TBaseServerRequestData(const char* qs, SOCKET s = INVALID_SOCKET); - void SetHost(const TString& host, ui16 port) { + void SetHost(const TString& host, ui16 port) { Host = host; Port = ToString(port); } - const TString& ServerName() const { + const TString& ServerName() const { return Host; } @@ -35,7 +35,7 @@ public: return NAddr::GetSockAddr(Socket); } - const TString& ServerPort() const { + const TString& ServerPort() const { return Port; } @@ -64,33 +64,33 @@ public: return HeadersIn_; } - inline size_t HeadersCount() const noexcept { + inline size_t HeadersCount() const noexcept { return HeadersIn_.size(); } - TString HeaderByIndex(size_t n) const noexcept; + TString HeaderByIndex(size_t n) const noexcept; const char* Environment(const char* key) const; void Clear(); - void SetSocket(SOCKET s) noexcept { + void SetSocket(SOCKET s) noexcept { Socket = s; } - ui64 RequestBeginTime() const noexcept { + ui64 RequestBeginTime() const noexcept { return BeginTime; } - void SetPath(const TString& path); + void SetPath(const TString& path); const char* GetCurPage() const; bool Parse(const char* req); - void AddHeader(const TString& name, const TString& value); + void AddHeader(const TString& name, const TString& value); private: TBuffer PathStorage; mutable char* Addr; - TString Host; - TString Port; + TString Host; + TString Port; char* Path; char* Search; size_t SearchLength; // length of Search @@ -99,7 +99,7 @@ private: mutable char AddrData[INET6_ADDRSTRLEN]; SOCKET Socket; ui64 BeginTime; - mutable TString CurPage; + mutable TString CurPage; TBuffer ParseBuf; TBuffer ModifiedQueryString; }; diff --git a/library/cpp/http/misc/parsed_request.cpp b/library/cpp/http/misc/parsed_request.cpp index e332a24e917..3bc94a4d335 100644 --- a/library/cpp/http/misc/parsed_request.cpp +++ b/library/cpp/http/misc/parsed_request.cpp @@ -4,7 +4,7 @@ #include <util/generic/yexception.h> #include <util/string/cast.h> -static inline TStringBuf StripLeft(const TStringBuf& s) noexcept { +static inline TStringBuf StripLeft(const TStringBuf& s) noexcept { const char* b = s.begin(); const char* e = s.end(); diff --git a/library/cpp/http/server/conn.cpp b/library/cpp/http/server/conn.cpp index 38a76c4c309..4e285874ed8 100644 --- a/library/cpp/http/server/conn.cpp +++ b/library/cpp/http/server/conn.cpp @@ -15,14 +15,14 @@ public: { } - inline ~TImpl() { + inline ~TImpl() { } - inline THttpInput* Input() noexcept { + inline THttpInput* Input() noexcept { return &HI_; } - inline THttpOutput* Output() noexcept { + inline THttpOutput* Output() noexcept { return &HO_; } @@ -53,14 +53,14 @@ THttpServerConn::THttpServerConn(const TSocket& s, size_t outputBufferSize) { } -THttpServerConn::~THttpServerConn() { +THttpServerConn::~THttpServerConn() { } -THttpInput* THttpServerConn::Input() noexcept { +THttpInput* THttpServerConn::Input() noexcept { return Impl_->Input(); } -THttpOutput* THttpServerConn::Output() noexcept { +THttpOutput* THttpServerConn::Output() noexcept { return Impl_->Output(); } diff --git a/library/cpp/http/server/conn.h b/library/cpp/http/server/conn.h index 3aa5329af42..44d6f8be284 100644 --- a/library/cpp/http/server/conn.h +++ b/library/cpp/http/server/conn.h @@ -10,22 +10,22 @@ class THttpServerConn { public: explicit THttpServerConn(const TSocket& s); THttpServerConn(const TSocket& s, size_t outputBufferSize); - ~THttpServerConn(); + ~THttpServerConn(); - THttpInput* Input() noexcept; - THttpOutput* Output() noexcept; + THttpInput* Input() noexcept; + THttpOutput* Output() noexcept; - inline const THttpInput* Input() const noexcept { + inline const THttpInput* Input() const noexcept { return const_cast<THttpServerConn*>(this)->Input(); } - inline const THttpOutput* Output() const noexcept { + inline const THttpOutput* Output() const noexcept { return const_cast<THttpServerConn*>(this)->Output(); } /// Проверяет, можно ли установить режим, при котором соединение с сервером /// не завершается после окончания транзакции. - inline bool CanBeKeepAlive() const noexcept { + inline bool CanBeKeepAlive() const noexcept { return Output()->CanBeKeepAlive(); } diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp index 128583bdd70..4a122d1a0ad 100644 --- a/library/cpp/http/server/http.cpp +++ b/library/cpp/http/server/http.cpp @@ -31,7 +31,7 @@ using namespace NAddr; namespace { class IPollAble { public: - inline IPollAble() noexcept { + inline IPollAble() noexcept { } virtual ~IPollAble() { @@ -53,7 +53,7 @@ namespace { class TClientConnection: public IPollAble, public TIntrusiveListItem<TClientConnection> { public: TClientConnection(const TSocket& s, THttpServer::TImpl* serv, NAddr::IRemoteAddrRef listenerSockAddrRef); - ~TClientConnection() override; + ~TClientConnection() override; void OnPollEvent(TInstant now) override; @@ -81,10 +81,10 @@ public: { } - inline ~TConnections() { + inline ~TConnections() { } - inline void Add(TClientConnection* c) noexcept { + inline void Add(TClientConnection* c) noexcept { TGuard<TMutex> g(Mutex_); Conns_.PushBack(c); @@ -99,7 +99,7 @@ public: } } - inline void Clear() noexcept { + inline void Clear() noexcept { TGuard<TMutex> g(Mutex_); Conns_.Clear(); @@ -297,7 +297,7 @@ public: { } - ~TListenSocket() override { + ~TListenSocket() override { } void OnPollEvent(TInstant) override { @@ -310,7 +310,7 @@ public: Server_->AddRequestFromSocket(s, TInstant::Now(), SockAddrRef_); } - SOCKET GetSocket() const noexcept { + SOCKET GetSocket() const noexcept { return S_; } @@ -345,7 +345,7 @@ public: ListenerRunningOK = true; ListenStartEvent.Signal(); - TVector<void*> events; + TVector<void*> events; events.resize(1); TInstant now = TInstant::Now(); @@ -422,15 +422,15 @@ public: } } - inline const TOptions& Options() const noexcept { + inline const TOptions& Options() const noexcept { return Options_; } - inline void DecreaseConnections() noexcept { + inline void DecreaseConnections() noexcept { AtomicDecrement(ConnectionCount); } - inline void IncreaseConnections() noexcept { + inline void IncreaseConnections() noexcept { AtomicIncrement(ConnectionCount); } @@ -527,7 +527,7 @@ void THttpServer::RestartRequestThreads(ui32 n, ui32 queue) { Impl_->RestartRequestThreads(n, queue); } -const THttpServer::TOptions& THttpServer::Options() const noexcept { +const THttpServer::TOptions& THttpServer::Options() const noexcept { return Impl_->Options(); } @@ -566,7 +566,7 @@ TClientConnection::TClientConnection(const TSocket& s, THttpServer::TImpl* serv, HttpServ_->IncreaseConnections(); } -TClientConnection::~TClientConnection() { +TClientConnection::~TClientConnection() { HttpServ_->DecreaseConnections(); } @@ -730,7 +730,7 @@ void TClientRequest::ProcessFailRequest(int failstate) { "\r\n" "Service Unavailable\r\n"; - TString url; + TString url; if (!strnicmp(RequestString.data(), "GET ", 4)) { // Trying to extract url... @@ -764,11 +764,11 @@ void TClientRequest::ProcessFailRequest(int failstate) { Output().Flush(); } -THttpServer* TClientRequest::HttpServ() const noexcept { +THttpServer* TClientRequest::HttpServ() const noexcept { return Conn_->HttpServ_->Parent_; } -const TSocket& TClientRequest::Socket() const noexcept { +const TSocket& TClientRequest::Socket() const noexcept { return Conn_->Socket_; } diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h index b292d38f270..e36a27ca253 100644 --- a/library/cpp/http/server/http.h +++ b/library/cpp/http/server/http.h @@ -23,7 +23,7 @@ public: public: struct TFailLogData { int failstate; - TString url; + TString url; }; virtual ~ICallBack() { @@ -80,7 +80,7 @@ public: int GetErrorCode(); const char* GetError(); void RestartRequestThreads(ui32 nTh, ui32 maxQS); - const TOptions& Options() const noexcept; + const TOptions& Options() const noexcept; i64 GetClientCount() const; class TImpl; @@ -109,16 +109,16 @@ public: TClientRequest(); ~TClientRequest() override; - inline THttpInput& Input() noexcept { + inline THttpInput& Input() noexcept { return *HttpConn_->Input(); } - inline THttpOutput& Output() noexcept { + inline THttpOutput& Output() noexcept { return *HttpConn_->Output(); } - THttpServer* HttpServ() const noexcept; - const TSocket& Socket() const noexcept; + THttpServer* HttpServ() const noexcept; + const TSocket& Socket() const noexcept; NAddr::IRemoteAddrRef GetListenerSockAddrRef() const noexcept; TInstant AcceptMoment() const noexcept; @@ -140,8 +140,8 @@ private: void Process(void* ThreadSpecificResource) override; public: - TVector<std::pair<TString, TString>> ParsedHeaders; - TString RequestString; + TVector<std::pair<TString, TString>> ParsedHeaders; + TString RequestString; private: THolder<TClientConnection> Conn_; diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp index cc62bb988e7..f72fde0cc27 100644 --- a/library/cpp/http/server/http_ut.cpp +++ b/library/cpp/http/server/http_ut.cpp @@ -40,7 +40,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { }; public: - inline TEchoServer(const TString& res) + inline TEchoServer(const TString& res) : Res_(res) { } @@ -50,7 +50,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { } private: - TString Res_; + TString Res_; }; class TSleepingServer: public THttpServer::ICallBack { @@ -136,7 +136,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { THolder<TAtomicCounter> MaxConns; }; - static const TString CrLf = "\r\n"; + static const TString CrLf = "\r\n"; struct TTestRequest { TTestRequest(ui16 port, TString content = TString()) @@ -148,10 +148,10 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { void CheckContinue(TSocketInput& si) { if (Expect100Continue) { TStringStream ss; - TString firstLine; + TString firstLine; si.ReadLine(firstLine); for (;;) { - TString buf; + TString buf; si.ReadLine(buf); if (buf.size() == 0) { break; @@ -162,7 +162,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { } } - TString Execute() { + TString Execute() { TSocket* s = nullptr; THolder<TSocket> singleReqSocket; if (KeepAliveConnection) { @@ -239,7 +239,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { s->Send(r.Data(), r.Size()); CheckContinue(si); Hdr = r.Str(); - TString tosend = compressedContent.Str(); + TString tosend = compressedContent.Str(); s->Send(tosend.data(), tosend.size()); } else { if (isPost) { @@ -264,7 +264,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { return ss.Str(); } - TString GetDescription() const { + TString GetDescription() const { if (UseHttpOutput) { TStringStream ss; ss << (KeepAliveConnection ? "keep-alive " : "") << Type; @@ -279,13 +279,13 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { ui16 Port = 0; bool UseHttpOutput = true; - TString Type = "GET"; - TString ContentEncoding; - TString Content; + TString Type = "GET"; + TString ContentEncoding; + TString Content; bool KeepAliveConnection = false; THolder<TSocket> KeepAlivedSocket; bool EnableResponseEncoding = false; - TString Hdr; + TString Hdr; bool Expect100Continue = false; }; @@ -311,8 +311,8 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { } }; - TString TestData(size_t size = 5 * 4096) { - TString res; + TString TestData(size_t size = 5 * 4096) { + TString res; for (size_t i = 0; i < size; ++i) { res += (char)i; @@ -321,7 +321,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { } Y_UNIT_TEST(TestEchoServer) { - TString res = TestData(); + TString res = TestData(); TPortManager pm; const ui16 port = pm.GetPort(); const bool trueFalse[] = {true, false}; @@ -345,17 +345,17 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { for (bool enableResponseEncoding : trueFalse) { r.EnableResponseEncoding = enableResponseEncoding; - const TString reqTypes[] = {"GET", "POST"}; - for (const TString& reqType : reqTypes) { + const TString reqTypes[] = {"GET", "POST"}; + for (const TString& reqType : reqTypes) { r.Type = reqType; - const TString encoders[] = {"", "deflate"}; - for (const TString& encoder : encoders) { + const TString encoders[] = {"", "deflate"}; + for (const TString& encoder : encoders) { r.ContentEncoding = encoder; for (bool expect100Continue : trueFalse) { r.Expect100Continue = expect100Continue; - TString resp = r.Execute(); + TString resp = r.Execute(); UNIT_ASSERT_C(resp == res, "diff echo response for request:\n" + r.GetDescription()); } } @@ -377,7 +377,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { const ui16 port = pm.GetPort(); TEchoServer serverImpl(res); - TVector<THolder<THttpServer>> servers; + TVector<THolder<THttpServer>> servers; for (ui32 i = 0; i < 10; i++) { servers.push_back(MakeHolder<THttpServer>(&serverImpl, THttpServer::TOptions(port).EnableReusePort(true))); } @@ -427,7 +427,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { * Emulate request processing failures * Data should be large enough not to fit into socket buffer **/ - TString res = TestData(10 * 1024 * 1024); + TString res = TestData(10 * 1024 * 1024); TPortManager portManager; const ui16 port = portManager.GetPort(); TEchoServer serverImpl(res); @@ -446,7 +446,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) { TTestRequest r(port); r.Content = res; r.Type = "POST"; - TString resp = r.Execute(); + TString resp = r.Execute(); if (i == 1) { UNIT_ASSERT(resp.Contains("Service Unavailable")); } else { diff --git a/library/cpp/http/server/options.cpp b/library/cpp/http/server/options.cpp index 05c954384a2..e1f85d22c39 100644 --- a/library/cpp/http/server/options.cpp +++ b/library/cpp/http/server/options.cpp @@ -9,11 +9,11 @@ using TAddr = THttpServerOptions::TAddr; -static inline TString AddrToString(const TAddr& addr) { +static inline TString AddrToString(const TAddr& addr) { return addr.Addr + ":" + ToString(addr.Port); } -static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) { +static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) { if (address.empty() || address == TStringBuf("*")) { return TNetworkAddress(port); } @@ -22,14 +22,14 @@ static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) { } void THttpServerOptions::BindAddresses(TBindAddresses& ret) const { - THashSet<TString> check; + THashSet<TString> check; for (auto addr : BindSockaddr) { if (!addr.Port) { addr.Port = Port; } - const TString straddr = AddrToString(addr); + const TString straddr = AddrToString(addr); if (check.find(straddr) == check.end()) { check.insert(straddr); diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h index 38eda0e5e78..3354578db2a 100644 --- a/library/cpp/http/server/options.h +++ b/library/cpp/http/server/options.h @@ -4,18 +4,18 @@ #include <util/network/init.h> #include <util/network/address.h> #include <util/generic/size_literals.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/datetime/base.h> class THttpServerOptions { public: - inline THttpServerOptions(ui16 port = 17000) noexcept + inline THttpServerOptions(ui16 port = 17000) noexcept : Port(port) { } - using TBindAddresses = TVector<TNetworkAddress>; + using TBindAddresses = TVector<TNetworkAddress>; void BindAddresses(TBindAddresses& ret) const; inline THttpServerOptions& AddBindAddress(const TString& address, ui16 port) { @@ -32,13 +32,13 @@ public: return AddBindAddress(address, 0); } - inline THttpServerOptions& EnableKeepAlive(bool enable) noexcept { + inline THttpServerOptions& EnableKeepAlive(bool enable) noexcept { KeepAliveEnabled = enable; return *this; } - inline THttpServerOptions& EnableCompression(bool enable) noexcept { + inline THttpServerOptions& EnableCompression(bool enable) noexcept { CompressionEnabled = enable; return *this; @@ -62,51 +62,51 @@ public: return *this; } - inline THttpServerOptions& SetThreads(ui32 threads) noexcept { + inline THttpServerOptions& SetThreads(ui32 threads) noexcept { nThreads = threads; return *this; } /// Default interface name to bind the server. Used when none of BindAddress are provided. - inline THttpServerOptions& SetHost(const TString& host) noexcept { + inline THttpServerOptions& SetHost(const TString& host) noexcept { Host = host; return *this; } /// Default port to bind the server. Used when none of BindAddress are provided. - inline THttpServerOptions& SetPort(ui16 port) noexcept { + inline THttpServerOptions& SetPort(ui16 port) noexcept { Port = port; return *this; } - inline THttpServerOptions& SetMaxConnections(ui32 mc = 0) noexcept { + inline THttpServerOptions& SetMaxConnections(ui32 mc = 0) noexcept { MaxConnections = mc; return *this; } - inline THttpServerOptions& SetMaxQueueSize(ui32 mqs = 0) noexcept { + inline THttpServerOptions& SetMaxQueueSize(ui32 mqs = 0) noexcept { MaxQueueSize = mqs; return *this; } - inline THttpServerOptions& SetClientTimeout(const TDuration& timeout) noexcept { + inline THttpServerOptions& SetClientTimeout(const TDuration& timeout) noexcept { ClientTimeout = timeout; return *this; } - inline THttpServerOptions& SetListenBacklog(int val) noexcept { + inline THttpServerOptions& SetListenBacklog(int val) noexcept { ListenBacklog = val; return *this; } - inline THttpServerOptions& SetOutputBufferSize(size_t val) noexcept { + inline THttpServerOptions& SetOutputBufferSize(size_t val) noexcept { OutputBufferSize = val; return *this; @@ -140,11 +140,11 @@ public: } struct TAddr { - TString Addr; + TString Addr; ui16 Port; }; - typedef TVector<TAddr> TAddrs; + typedef TVector<TAddr> TAddrs; bool KeepAliveEnabled = true; bool CompressionEnabled = false; diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp index 52d64c91cec..64ad7fceb36 100644 --- a/library/cpp/http/server/response.cpp +++ b/library/cpp/http/server/response.cpp @@ -18,7 +18,7 @@ THttpResponse& THttpResponse::SetContentType(const TStringBuf& contentType) { } void THttpResponse::OutTo(IOutputStream& os) const { - TVector<IOutputStream::TPart> parts; + TVector<IOutputStream::TPart> parts; const size_t FIRST_LINE_PARTS = 3; const size_t HEADERS_PARTS = Headers.Count() * 4; const size_t CONTENT_PARTS = 5; diff --git a/library/cpp/http/server/response.h b/library/cpp/http/server/response.h index a75cb85605f..a6a92c89d08 100644 --- a/library/cpp/http/server/response.h +++ b/library/cpp/http/server/response.h @@ -11,18 +11,18 @@ class IOutputStream; class THttpResponse { public: - THttpResponse() noexcept + THttpResponse() noexcept : Code(HTTP_OK) { } - explicit THttpResponse(HttpCodes code) noexcept + explicit THttpResponse(HttpCodes code) noexcept : Code(code) { } template <typename ValueType> - THttpResponse& AddHeader(const TString& name, const ValueType& value) { + THttpResponse& AddHeader(const TString& name, const ValueType& value) { return AddHeader(THttpInputHeader(name, ToString(value))); } @@ -45,7 +45,7 @@ public: * "Content-Length" header during output to IOutputStream. * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&) */ - THttpResponse& SetContent(const TString& content) { + THttpResponse& SetContent(const TString& content) { Content = content; return *this; @@ -60,7 +60,7 @@ public: * "Content-Length" header during output to IOutputStream. * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&) */ - THttpResponse& SetContent(const TString& content, const TStringBuf& contentType) { + THttpResponse& SetContent(const TString& content, const TStringBuf& contentType) { return SetContent(content).SetContentType(contentType); } @@ -78,5 +78,5 @@ public: private: HttpCodes Code; THttpHeaders Headers; - TString Content; + TString Content; }; diff --git a/library/cpp/int128/README.md b/library/cpp/int128/README.md index e1c4dcbb786..0fa0df29c6c 100644 --- a/library/cpp/int128/README.md +++ b/library/cpp/int128/README.md @@ -1,6 +1,6 @@ -https://st.yandex-team.ru/IGNIETFERRO-697 - -(Объединение разрозненных по Аркадии библиотек для поддержки 128-битного целого) - -Идея классов ui128 / i128 в том, чтобы они работали так, как будто это компиляторные интовые типы. -Т.е. у этих классов не должно быть публичных функций типа ui128::GetHigh(), конструкторов из нескольких параметров и так далее. +https://st.yandex-team.ru/IGNIETFERRO-697 + +(Объединение разрозненных по Аркадии библиотек для поддержки 128-битного целого) + +Идея классов ui128 / i128 в том, чтобы они работали так, как будто это компиляторные интовые типы. +Т.е. у этих классов не должно быть публичных функций типа ui128::GetHigh(), конструкторов из нескольких параметров и так далее. diff --git a/library/cpp/int128/bench/main.cpp b/library/cpp/int128/bench/main.cpp index be4f8d15008..54d063cc405 100644 --- a/library/cpp/int128/bench/main.cpp +++ b/library/cpp/int128/bench/main.cpp @@ -1,45 +1,45 @@ #include <library/cpp/int128/int128.h> #include <library/cpp/testing/benchmark/bench.h> - -#include <util/generic/xrange.h> -#include <util/system/compiler.h> - -Y_CPU_BENCHMARK(LibraryDivisionUnsigned128, iface) { - ui128 b = {0, 10'000'000}; - for (const auto i : xrange(iface.Iterations())) { - ui128 a = i * 10'000'000; - ui128 c = a / b; - Y_FAKE_READ(c); - } -} - -#if defined(Y_HAVE_INT128) -Y_CPU_BENCHMARK(IntrinsicDivisionUnsigned128, iface) { - unsigned __int128 b = 10'000'000; - for (const auto i : xrange(iface.Iterations())) { - unsigned __int128 a = i * 10'000'000; - unsigned __int128 c = a / b; - Y_FAKE_READ(c); - } -} -#endif // Y_HAVE_INT128 - -Y_CPU_BENCHMARK(LibraryDivisionSigned128, iface) { - i128 b = {0, 10'000'000}; - for (const auto i : xrange(iface.Iterations())) { - i128 a = i * 10'000'000; - i128 c = a / b; - Y_FAKE_READ(c); - } -} - -#if defined(Y_HAVE_INT128) -Y_CPU_BENCHMARK(IntrinsicDivisionSigned128, iface) { - signed __int128 b = 10'000'000; - for (const auto i : xrange(iface.Iterations())) { - signed __int128 a = i * 10'000'000; - signed __int128 c = a / b; - Y_FAKE_READ(c); - } -} -#endif // Y_HAVE_INT128 + +#include <util/generic/xrange.h> +#include <util/system/compiler.h> + +Y_CPU_BENCHMARK(LibraryDivisionUnsigned128, iface) { + ui128 b = {0, 10'000'000}; + for (const auto i : xrange(iface.Iterations())) { + ui128 a = i * 10'000'000; + ui128 c = a / b; + Y_FAKE_READ(c); + } +} + +#if defined(Y_HAVE_INT128) +Y_CPU_BENCHMARK(IntrinsicDivisionUnsigned128, iface) { + unsigned __int128 b = 10'000'000; + for (const auto i : xrange(iface.Iterations())) { + unsigned __int128 a = i * 10'000'000; + unsigned __int128 c = a / b; + Y_FAKE_READ(c); + } +} +#endif // Y_HAVE_INT128 + +Y_CPU_BENCHMARK(LibraryDivisionSigned128, iface) { + i128 b = {0, 10'000'000}; + for (const auto i : xrange(iface.Iterations())) { + i128 a = i * 10'000'000; + i128 c = a / b; + Y_FAKE_READ(c); + } +} + +#if defined(Y_HAVE_INT128) +Y_CPU_BENCHMARK(IntrinsicDivisionSigned128, iface) { + signed __int128 b = 10'000'000; + for (const auto i : xrange(iface.Iterations())) { + signed __int128 a = i * 10'000'000; + signed __int128 c = a / b; + Y_FAKE_READ(c); + } +} +#endif // Y_HAVE_INT128 diff --git a/library/cpp/int128/bench/ya.make b/library/cpp/int128/bench/ya.make index 4800e7883dd..bcd7c2a263d 100644 --- a/library/cpp/int128/bench/ya.make +++ b/library/cpp/int128/bench/ya.make @@ -1,15 +1,15 @@ -OWNER( - vladon -) - +OWNER( + vladon +) + Y_BENCHMARK() - -SRCS( - main.cpp -) - -PEERDIR( + +SRCS( + main.cpp +) + +PEERDIR( library/cpp/int128 -) - -END() +) + +END() diff --git a/library/cpp/int128/int128.cpp b/library/cpp/int128/int128.cpp index a28a389fe82..dedcd28f916 100644 --- a/library/cpp/int128/int128.cpp +++ b/library/cpp/int128/int128.cpp @@ -1,55 +1,55 @@ -#include "int128.h" - -#include <tuple> - -IOutputStream& operator<<(IOutputStream& out, const ui128& other) { - // see http://stackoverflow.com/questions/4361441/c-print-a-biginteger-in-base-10 - // and http://stackoverflow.com/questions/8023414/how-to-convert-a-128-bit-integer-to-a-decimal-ascii-string-in-c - int d[39] = {0}; - int i; - int j; - for (i = 63; i > -1; i--) { - if ((other.High_ >> i) & 1) - ++d[0]; - for (j = 0; j < 39; j++) - d[j] *= 2; - for (j = 0; j < 38; j++) { - d[j + 1] += d[j] / 10; - d[j] %= 10; - } - } - for (i = 63; i > -1; i--) { - if ((other.Low_ >> i) & 1) - ++d[0]; - if (i > 0) - for (j = 0; j < 39; j++) - d[j] *= 2; - for (j = 0; j < 38; j++) { - d[j + 1] += d[j] / 10; - d[j] %= 10; - } - } - for (i = 38; i > 0; i--) - if (d[i] > 0) - break; - for (; i > -1; i--) - out << static_cast<char>('0' + d[i]); - - return out; -} - -void TSerializer<ui128>::Save(IOutputStream* out, const ui128& Number) { - ::Save(out, GetHigh(Number)); - ::Save(out, GetLow(Number)); -} - -void TSerializer<ui128>::Load(IInputStream* in, ui128& Number) { - ui64 High; - ui64 Low; - ::Load(in, High); - ::Load(in, Low); - Number = ui128(High, Low); -} +#include "int128.h" + +#include <tuple> + +IOutputStream& operator<<(IOutputStream& out, const ui128& other) { + // see http://stackoverflow.com/questions/4361441/c-print-a-biginteger-in-base-10 + // and http://stackoverflow.com/questions/8023414/how-to-convert-a-128-bit-integer-to-a-decimal-ascii-string-in-c + int d[39] = {0}; + int i; + int j; + for (i = 63; i > -1; i--) { + if ((other.High_ >> i) & 1) + ++d[0]; + for (j = 0; j < 39; j++) + d[j] *= 2; + for (j = 0; j < 38; j++) { + d[j + 1] += d[j] / 10; + d[j] %= 10; + } + } + for (i = 63; i > -1; i--) { + if ((other.Low_ >> i) & 1) + ++d[0]; + if (i > 0) + for (j = 0; j < 39; j++) + d[j] *= 2; + for (j = 0; j < 38; j++) { + d[j + 1] += d[j] / 10; + d[j] %= 10; + } + } + for (i = 38; i > 0; i--) + if (d[i] > 0) + break; + for (; i > -1; i--) + out << static_cast<char>('0' + d[i]); + + return out; +} + +void TSerializer<ui128>::Save(IOutputStream* out, const ui128& Number) { + ::Save(out, GetHigh(Number)); + ::Save(out, GetLow(Number)); +} + +void TSerializer<ui128>::Load(IInputStream* in, ui128& Number) { + ui64 High; + ui64 Low; + ::Load(in, High); + ::Load(in, Low); + Number = ui128(High, Low); +} IOutputStream& operator<<(IOutputStream& out, const i128& other) { diff --git a/library/cpp/int128/int128.h b/library/cpp/int128/int128.h index f1121fc0c61..e6345f4f128 100644 --- a/library/cpp/int128/int128.h +++ b/library/cpp/int128/int128.h @@ -1,1278 +1,1278 @@ -#pragma once - -#include "int128_util.h" - -#include <util/generic/bitops.h> -#include <util/system/compiler.h> -#include <util/system/defaults.h> -#include <util/stream/output.h> -#include <util/string/cast.h> -#include <util/string/builder.h> -#include <util/str_stl.h> -#include <util/ysaveload.h> - -#include <cfenv> -#include <climits> -#include <cmath> -#include <limits> -#include <type_traits> - -#if !defined(_little_endian_) && !defined(_big_endian_) - static_assert(false, "Platform endianness is not supported"); -#endif - -template <bool IsSigned> -class TInteger128 { -public: - TInteger128() noexcept = default; - -#if defined(_little_endian_) - constexpr TInteger128(const ui64 high, const ui64 low) noexcept - : Low_(low) - , High_(high) - { - } -#elif defined(_big_endian_) - constexpr TInteger128(const ui64 high, const ui64 low) noexcept - : High_(high) - , Low_(low) - { - } -#endif - - constexpr TInteger128(const TInteger128<!IsSigned> other) noexcept - : TInteger128{GetHigh(other), GetLow(other)} - { - } - -#if defined(_little_endian_) - constexpr TInteger128(const char other) noexcept - : Low_{static_cast<ui64>(other)} - , High_{0} - { - } - - constexpr TInteger128(const ui8 other) noexcept - : Low_{other} - , High_{0} - { - } - - constexpr TInteger128(const ui16 other) noexcept - : Low_{other} - , High_{0} - { - } - - constexpr TInteger128(const ui32 other) noexcept - : Low_{other} - , High_{0} - { - } - - constexpr TInteger128(const ui64 other) noexcept - : Low_{other} - , High_{0} - { - } - -#if defined(Y_HAVE_INT128) - constexpr TInteger128(const unsigned __int128 other) noexcept - : Low_{static_cast<ui64>(other & ~ui64{0})} - , High_{static_cast<ui64>(other >> 64)} - { - } -#endif - - constexpr TInteger128(const i8 other) noexcept - : Low_{static_cast<ui64>(other)} - , High_{other < 0 ? std::numeric_limits<ui64>::max() : 0} - { - } - - constexpr TInteger128(const i16 other) noexcept - : Low_{static_cast<ui64>(other)} - , High_{other < 0 ? std::numeric_limits<ui64>::max() : 0} - { - } - - constexpr TInteger128(const i32 other) noexcept - : Low_(static_cast<ui64>(other)) - , High_{other < 0 ? std::numeric_limits<ui64>::max() : 0} - { - } - - constexpr TInteger128(const i64 other) noexcept - : Low_(static_cast<ui64>(other)) - , High_{other < 0 ? std::numeric_limits<ui64>::max() : 0} - { - } - -#if defined(Y_HAVE_INT128) - template <bool IsSigned2 = IsSigned, std::enable_if_t<!IsSigned2, bool> = false> - constexpr TInteger128(const signed __int128 other) noexcept - : Low_{static_cast<ui64>(other & ~ui64{0})} - , High_{static_cast<ui64>(static_cast<unsigned __int128>(other) >> 64)} - { - } - - template <bool IsSigned2 = IsSigned, typename std::enable_if_t<IsSigned2, bool> = false> - constexpr TInteger128(const signed __int128 other) noexcept - : Low_{static_cast<ui64>(other & ~ui64(0))} - , High_{static_cast<ui64>(other >> 64)} - { - } -#endif - -#elif defined(_big_endian_) - static_assert(false, "Big-endian will be later"); -#endif // _little_endian_ or _big_endian_ - - constexpr TInteger128& operator=(const char other) noexcept { - *this = TInteger128{other}; - return *this; - } - - constexpr TInteger128& operator=(const ui8 other) noexcept { - *this = TInteger128{other}; - return *this; - } - - constexpr TInteger128& operator=(const ui16 other) noexcept { - *this = TInteger128{other}; - return *this; - } - - constexpr TInteger128& operator=(const ui32 other) noexcept { - *this = TInteger128{other}; - return *this; - } - - constexpr TInteger128& operator=(const ui64 other) noexcept { - *this = TInteger128{other}; - return *this; - } - -#if defined(Y_HAVE_INT128) - constexpr TInteger128& operator=(const unsigned __int128 other) noexcept { - *this = TInteger128{other}; - return *this; - } -#endif - - constexpr TInteger128& operator=(const i8 other) noexcept { - *this = TInteger128{other}; - return *this; - } - - constexpr TInteger128& operator=(const i16 other) noexcept { - *this = TInteger128{other}; - return *this; - } - - constexpr TInteger128& operator=(const i32 other) noexcept { - *this = TInteger128{other}; - return *this; - } - - constexpr TInteger128& operator=(const i64 other) noexcept { - *this = TInteger128{other}; - return *this; - } - -#if defined(Y_HAVE_INT128) - constexpr TInteger128& operator=(const signed __int128 other) noexcept { - *this = TInteger128{other}; - return *this; - } -#endif // Y_HAVE_INT128 - - constexpr TInteger128& operator+=(const TInteger128 other) noexcept { - return *this = *this + other; - } - - constexpr TInteger128& operator-=(const TInteger128 other) noexcept { - return *this = *this - other; - } - - constexpr TInteger128& operator*=(const TInteger128 other) noexcept { - return *this = *this * other; - } - - constexpr TInteger128& operator&=(const TInteger128 other) noexcept { - return *this = *this & other; - } - - constexpr TInteger128& operator^=(const TInteger128 other) noexcept { +#pragma once + +#include "int128_util.h" + +#include <util/generic/bitops.h> +#include <util/system/compiler.h> +#include <util/system/defaults.h> +#include <util/stream/output.h> +#include <util/string/cast.h> +#include <util/string/builder.h> +#include <util/str_stl.h> +#include <util/ysaveload.h> + +#include <cfenv> +#include <climits> +#include <cmath> +#include <limits> +#include <type_traits> + +#if !defined(_little_endian_) && !defined(_big_endian_) + static_assert(false, "Platform endianness is not supported"); +#endif + +template <bool IsSigned> +class TInteger128 { +public: + TInteger128() noexcept = default; + +#if defined(_little_endian_) + constexpr TInteger128(const ui64 high, const ui64 low) noexcept + : Low_(low) + , High_(high) + { + } +#elif defined(_big_endian_) + constexpr TInteger128(const ui64 high, const ui64 low) noexcept + : High_(high) + , Low_(low) + { + } +#endif + + constexpr TInteger128(const TInteger128<!IsSigned> other) noexcept + : TInteger128{GetHigh(other), GetLow(other)} + { + } + +#if defined(_little_endian_) + constexpr TInteger128(const char other) noexcept + : Low_{static_cast<ui64>(other)} + , High_{0} + { + } + + constexpr TInteger128(const ui8 other) noexcept + : Low_{other} + , High_{0} + { + } + + constexpr TInteger128(const ui16 other) noexcept + : Low_{other} + , High_{0} + { + } + + constexpr TInteger128(const ui32 other) noexcept + : Low_{other} + , High_{0} + { + } + + constexpr TInteger128(const ui64 other) noexcept + : Low_{other} + , High_{0} + { + } + +#if defined(Y_HAVE_INT128) + constexpr TInteger128(const unsigned __int128 other) noexcept + : Low_{static_cast<ui64>(other & ~ui64{0})} + , High_{static_cast<ui64>(other >> 64)} + { + } +#endif + + constexpr TInteger128(const i8 other) noexcept + : Low_{static_cast<ui64>(other)} + , High_{other < 0 ? std::numeric_limits<ui64>::max() : 0} + { + } + + constexpr TInteger128(const i16 other) noexcept + : Low_{static_cast<ui64>(other)} + , High_{other < 0 ? std::numeric_limits<ui64>::max() : 0} + { + } + + constexpr TInteger128(const i32 other) noexcept + : Low_(static_cast<ui64>(other)) + , High_{other < 0 ? std::numeric_limits<ui64>::max() : 0} + { + } + + constexpr TInteger128(const i64 other) noexcept + : Low_(static_cast<ui64>(other)) + , High_{other < 0 ? std::numeric_limits<ui64>::max() : 0} + { + } + +#if defined(Y_HAVE_INT128) + template <bool IsSigned2 = IsSigned, std::enable_if_t<!IsSigned2, bool> = false> + constexpr TInteger128(const signed __int128 other) noexcept + : Low_{static_cast<ui64>(other & ~ui64{0})} + , High_{static_cast<ui64>(static_cast<unsigned __int128>(other) >> 64)} + { + } + + template <bool IsSigned2 = IsSigned, typename std::enable_if_t<IsSigned2, bool> = false> + constexpr TInteger128(const signed __int128 other) noexcept + : Low_{static_cast<ui64>(other & ~ui64(0))} + , High_{static_cast<ui64>(other >> 64)} + { + } +#endif + +#elif defined(_big_endian_) + static_assert(false, "Big-endian will be later"); +#endif // _little_endian_ or _big_endian_ + + constexpr TInteger128& operator=(const char other) noexcept { + *this = TInteger128{other}; + return *this; + } + + constexpr TInteger128& operator=(const ui8 other) noexcept { + *this = TInteger128{other}; + return *this; + } + + constexpr TInteger128& operator=(const ui16 other) noexcept { + *this = TInteger128{other}; + return *this; + } + + constexpr TInteger128& operator=(const ui32 other) noexcept { + *this = TInteger128{other}; + return *this; + } + + constexpr TInteger128& operator=(const ui64 other) noexcept { + *this = TInteger128{other}; + return *this; + } + +#if defined(Y_HAVE_INT128) + constexpr TInteger128& operator=(const unsigned __int128 other) noexcept { + *this = TInteger128{other}; + return *this; + } +#endif + + constexpr TInteger128& operator=(const i8 other) noexcept { + *this = TInteger128{other}; + return *this; + } + + constexpr TInteger128& operator=(const i16 other) noexcept { + *this = TInteger128{other}; + return *this; + } + + constexpr TInteger128& operator=(const i32 other) noexcept { + *this = TInteger128{other}; + return *this; + } + + constexpr TInteger128& operator=(const i64 other) noexcept { + *this = TInteger128{other}; + return *this; + } + +#if defined(Y_HAVE_INT128) + constexpr TInteger128& operator=(const signed __int128 other) noexcept { + *this = TInteger128{other}; + return *this; + } +#endif // Y_HAVE_INT128 + + constexpr TInteger128& operator+=(const TInteger128 other) noexcept { + return *this = *this + other; + } + + constexpr TInteger128& operator-=(const TInteger128 other) noexcept { + return *this = *this - other; + } + + constexpr TInteger128& operator*=(const TInteger128 other) noexcept { + return *this = *this * other; + } + + constexpr TInteger128& operator&=(const TInteger128 other) noexcept { + return *this = *this & other; + } + + constexpr TInteger128& operator^=(const TInteger128 other) noexcept { return *this = *this ^ other; - } - - constexpr TInteger128& operator|=(const TInteger128 other) noexcept { - return *this = *this | other; - } - - constexpr TInteger128& operator<<=(int n) noexcept { - *this = *this << n; - return *this; - } - - constexpr TInteger128& operator>>=(int n) noexcept { - *this = *this >> n; - return *this; - } - - constexpr TInteger128& operator++() noexcept { - *this += 1; - return *this; - } - - constexpr TInteger128 operator++(int) noexcept { - const TInteger128 ret{*this}; - this->operator++(); - return ret; - } - - constexpr TInteger128& operator--() noexcept { - *this -= 1; - return *this; - } - - constexpr TInteger128 operator--(int) noexcept { - const TInteger128 ret{*this}; - this->operator--(); - return ret; - } - - explicit constexpr operator bool() const noexcept { - return Low_ || High_; - } - - explicit constexpr operator char() const noexcept { - return static_cast<char>(Low_); - } - - explicit constexpr operator ui8() const noexcept { - return static_cast<ui8>(Low_); - } - - explicit constexpr operator i8() const noexcept { - return static_cast<i8>(Low_); - } - - explicit constexpr operator ui16() const noexcept { - return static_cast<ui16>(Low_); - } - - explicit constexpr operator i16() const noexcept { - return static_cast<i16>(Low_); - } - - explicit constexpr operator ui32() const noexcept { - return static_cast<ui32>(Low_); - } - - explicit constexpr operator i32() const noexcept { - return static_cast<i32>(Low_); - } - - explicit constexpr operator ui64() const noexcept { - return static_cast<ui64>(Low_); - } - - explicit constexpr operator i64() const noexcept { - return static_cast<i64>(Low_); - } - -#if defined(Y_HAVE_INT128) - explicit constexpr operator unsigned __int128() const noexcept { - return (static_cast<unsigned __int128>(High_) << 64) + Low_; - } - - explicit constexpr operator signed __int128() const noexcept { - return (static_cast<__int128>(High_) << 64) + Low_; - } -#endif - -private: -#if defined(_little_endian_) - ui64 Low_; - ui64 High_; -#elif defined(_big_endian_) - ui64 High_; - ui64 Low_; -#endif - template <bool IsSigned2> - friend constexpr ui64 GetHigh(TInteger128<IsSigned2> value) noexcept; - - template <bool IsSigned2> - friend constexpr ui64 GetLow(TInteger128<IsSigned2> value) noexcept; - - friend IOutputStream& operator<<(IOutputStream& out, const TInteger128& other); -}; // class TInteger128 - -using ui128 = TInteger128<false>; -using i128 = TInteger128<true>; - -constexpr ui128 operator+(ui128 lhs, ui128 rhs) noexcept; -constexpr i128 operator+( i128 lhs, i128 rhs) noexcept; -constexpr ui128 operator-(ui128 lhs, ui128 rhs) noexcept; -constexpr i128 operator-( i128 lhs, i128 rhs) noexcept; -constexpr ui128 operator-(ui128 num) noexcept; -constexpr i128 operator-( i128 num) noexcept; -constexpr ui128 operator*(ui128 lhs, ui128 rhs) noexcept; -constexpr i128 operator*( i128 lhs, i128 rhs) noexcept; -constexpr ui128 operator/(ui128 lhs, ui128 rhs) noexcept; -constexpr i128 operator/( i128 lhs, i128 rhs) noexcept; -constexpr ui128 operator%(ui128 lhs, ui128 rhs) noexcept; -constexpr i128 operator%( i128 lhs, i128 rhs) noexcept; -constexpr ui128 operator|(ui128 lhs, ui128 rhs) noexcept; -constexpr i128 operator|( i128 lhs, i128 rhs) noexcept; -constexpr ui128 operator&(ui128 lhs, ui128 rhs) noexcept; -constexpr i128 operator&( i128 lhs, i128 rhs) noexcept; -constexpr ui128 operator^(ui128 lhs, ui128 rhs) noexcept; -constexpr i128 operator^( i128 lhs, i128 rhs) noexcept; -constexpr ui128 operator<<(ui128 lhs, int n) noexcept; -constexpr i128 operator<<( i128 lhs, int n) noexcept; -constexpr ui128 operator>>(ui128 lhs, int n) noexcept; -constexpr i128 operator>>( i128 lhs, int n) noexcept; - -template <bool IsSigned> -size_t MostSignificantBit(const TInteger128<IsSigned> v); - -namespace std { - //// type traits - template <bool IsSigned> - struct is_integral<TInteger128<IsSigned>> : public std::true_type{}; - - template <bool IsSigned> - struct is_class<TInteger128<IsSigned>> : public std::false_type{}; - - template <> - struct is_signed<ui128> : public std::false_type{}; - - template <> - struct is_signed<i128> : public std::true_type{}; -} - -template <bool IsSigned> -constexpr ui64 GetHigh(const TInteger128<IsSigned> value) noexcept { - return value.High_; -} - -template <bool IsSigned> -constexpr ui64 GetLow(const TInteger128<IsSigned> value) noexcept { - return value.Low_; -} - -template <class T, std::enable_if_t<std::is_same_v<std::remove_cv_t<T>, i128>>* = nullptr> -constexpr ui128 operator-(const ui128 lhs, const T rhs) noexcept { - return lhs - static_cast<ui128>(rhs); -} - -template <class T, std::enable_if_t<std::is_same_v<std::remove_cv_t<T>, ui128>>* = nullptr> -constexpr ui128 operator-(const i128 lhs, const T rhs) noexcept { - return static_cast<ui128>(lhs) - rhs; -} - -// specialize std templates -namespace std { - // numeric limits - // see full list at https://en.cppreference.com/w/cpp/types/numeric_limits - template <bool IsSigned> - struct numeric_limits<TInteger128<IsSigned>> { - static constexpr bool is_specialized = true; - static constexpr bool is_signed = IsSigned; - static constexpr bool is_integer = true; - static constexpr bool is_exact = true; - static constexpr bool has_infinity = false; - static constexpr bool has_quiet_NAN = false; - static constexpr bool has_signaling_NAN = false; - static constexpr float_denorm_style has_denorm = std::denorm_absent; - static constexpr bool has_denorm_loss = false; - static constexpr float_round_style round_style = std::round_toward_zero; - static constexpr bool is_iec559 = false; - static constexpr bool is_bounded = true; - static constexpr bool is_modulo = true; - static constexpr int digits = CHAR_BIT * sizeof(ui128) - (IsSigned ? 1 : 0); - static constexpr int digits10 = 38; // std::numeric_limits<ui128>::digits * std::log10(2); - static constexpr int max_digits10 = 0; - static constexpr int radix = 2; - static constexpr int min_exponent = 0; - static constexpr int min_exponent10 = 0; - static constexpr int max_exponent = 0; - static constexpr int max_exponent10 = 0; - static constexpr bool traps = std::numeric_limits<ui64>::traps; // same as of any other ui* - static constexpr bool tinyness_before = false; - - static constexpr TInteger128<IsSigned> min() noexcept { - if constexpr (IsSigned) { - return TInteger128<IsSigned>{ - static_cast<ui64>(std::numeric_limits<i64>::min()), - 0 - }; - } - else { - return 0; - } - } - - static constexpr TInteger128<IsSigned> lowest() noexcept { - return min(); - } - - static constexpr TInteger128<IsSigned> max() noexcept { - if constexpr (IsSigned) { - return TInteger128<IsSigned>{ - static_cast<ui64>(std::numeric_limits<i64>::max()), - std::numeric_limits<ui64>::max() - }; - } - else { - return TInteger128<IsSigned>{ - std::numeric_limits<ui64>::max(), - std::numeric_limits<ui64>::max() - }; - } - } - - static constexpr TInteger128<IsSigned> epsilon() noexcept { - return 0; - } - - static constexpr TInteger128<IsSigned> round_error() noexcept { - return 0; - } - - static constexpr TInteger128<IsSigned> infinity() noexcept { - return 0; - } - - static constexpr TInteger128<IsSigned> quiet_NAN() noexcept { - return 0; - } - - static constexpr TInteger128<IsSigned> signaling_NAN() noexcept { - return 0; - } - - static constexpr TInteger128<IsSigned> denorm_min() noexcept { - return 0; - } - }; - - constexpr bool signbit(const ui128 arg) noexcept { - Y_UNUSED(arg); - return false; - } - - constexpr bool signbit(const i128 arg) noexcept { - return GetHigh(arg) & 0x8000000000000000; - } - - constexpr ui128 abs(const ui128 arg) noexcept { - return arg; - } - - constexpr i128 abs(const i128 arg) noexcept { - return signbit(arg) ? (-arg) : arg; - } -} - -constexpr bool operator==(const ui128 lhs, const ui128 rhs) noexcept { - return GetLow(lhs) == GetLow(rhs) && GetHigh(lhs) == GetHigh(rhs); -} - -constexpr bool operator==(const i128 lhs, const i128 rhs) noexcept { - return GetLow(lhs) == GetLow(rhs) && GetHigh(lhs) == GetHigh(rhs); -} - -constexpr bool operator!=(const ui128 lhs, const ui128 rhs) noexcept { - return !(lhs == rhs); -} - -constexpr bool operator!=(const i128 lhs, const i128 rhs) noexcept { - return !(lhs == rhs); -} - -constexpr bool operator<(const ui128 lhs, const ui128 rhs) noexcept { - if (GetHigh(lhs) != GetHigh(rhs)) { - return GetHigh(lhs) < GetHigh(rhs); - } - - return GetLow(lhs) < GetLow(rhs); -} - -constexpr bool operator<(const i128 lhs, const i128 rhs) noexcept { - if (lhs == 0 && rhs == 0) { - return false; - } - - const bool lhsIsNegative = std::signbit(lhs); - const bool rhsIsNegative = std::signbit(rhs); - - if (lhsIsNegative && !rhsIsNegative) { - return true; - } - - if (!lhsIsNegative && rhsIsNegative) { - return false; - } - - // both are negative or both are positive - if (GetHigh(lhs) != GetHigh(rhs)) { - return GetHigh(lhs) < GetHigh(rhs); - } - - return GetLow(lhs) < GetLow(rhs); -} - -constexpr bool operator>(const ui128 lhs, const ui128 rhs) noexcept { - return rhs < lhs; -} - -constexpr bool operator>(const i128 lhs, const i128 rhs) noexcept { - return rhs < lhs; -} - -constexpr bool operator<=(const ui128 lhs, const ui128 rhs) noexcept { - return !(rhs < lhs); -} - -constexpr bool operator<=(const i128 lhs, const i128 rhs) noexcept { - return !(rhs < lhs); -} - -constexpr bool operator>=(const ui128 lhs, const ui128 rhs) noexcept { - return !(lhs < rhs); -} - -constexpr bool operator>=(const i128 lhs, const i128 rhs) noexcept { - return !(lhs < rhs); -} - -constexpr ui128 operator+(const ui128 lhs, const ui128 rhs) noexcept { - const ui128 result{GetHigh(lhs) + GetHigh(rhs), GetLow(lhs) + GetLow(rhs)}; - if (GetLow(result) < GetLow(lhs)) { - return ui128{GetHigh(result) + 1, GetLow(result)}; - } - return result; -} - -constexpr i128 operator+(const i128 lhs, const i128 rhs) noexcept { - const i128 result{GetHigh(lhs) + GetHigh(rhs), GetLow(lhs) + GetLow(rhs)}; - if (GetLow(result) < GetLow(lhs)) { - return i128{GetHigh(result) + 1, GetLow(result)}; - } - return result; -} - -constexpr ui128 operator-(const ui128 lhs, const ui128 rhs) noexcept { - const ui128 result{GetHigh(lhs) - GetHigh(rhs), GetLow(lhs) - GetLow(rhs)}; - if (GetLow(result) > GetLow(lhs)) { // underflow - return ui128{GetHigh(result) - 1, GetLow(result)}; - } - return result; -} - -constexpr i128 operator-(const i128 lhs, const i128 rhs) noexcept { - const i128 result{GetHigh(lhs) - GetHigh(rhs), GetLow(lhs) - GetLow(rhs)}; - if (GetLow(result) > GetLow(lhs)) { // underflow - return i128{GetHigh(result) - 1, GetLow(result)}; - } - return result; -} - -constexpr ui128 operator-(const ui128 num) noexcept { - const ui128 result{~GetHigh(num), ~GetLow(num) + 1}; - if (GetLow(result) == 0) { - return ui128{GetHigh(result) + 1, GetLow(result)}; - } - return result; -} - -constexpr i128 operator-(const i128 num) noexcept { - const i128 result{~GetHigh(num), ~GetLow(num) + 1}; - if (GetLow(result) == 0) { - return i128{GetHigh(result) + 1, GetLow(result)}; - } - return result; -} - -constexpr ui128 operator*(const ui128 lhs, const ui128 rhs) noexcept { - if (rhs == 0) { - return 0; - } - if (rhs == 1) { - return lhs; - } - - ui128 result{}; - ui128 t = rhs; - - for (size_t i = 0; i < 128; ++i) { - if ((t & 1) != 0) { - result += (lhs << i); - } - - t = t >> 1; - } - - return result; -} - -constexpr i128 operator*(const i128 lhs, const i128 rhs) noexcept { - if (rhs == 0) { - return 0; - } - if (rhs == 1) { - return lhs; - } - - i128 result{}; - i128 t = rhs; - - for (size_t i = 0; i < 128; ++i) { - if ((t & 1) != 0) { - result += (lhs << i); - } - - t = t >> 1; - } - - return result; -} - -namespace NPrivateInt128 { - // NOTE: division by zero is UB and can be changed in future - constexpr void DivMod128(const ui128 lhs, const ui128 rhs, ui128* const quo, ui128* const rem) { - if (!quo && !rem) { - return; - } - - constexpr size_t n_udword_bits = sizeof(ui64) * CHAR_BIT; - constexpr size_t n_utword_bits = sizeof(ui128) * CHAR_BIT; - - ui128 q{}; - ui128 r{}; - - unsigned sr{}; - - /* special cases, X is unknown, K != 0 */ - if (GetHigh(lhs) == 0) - { - if (GetHigh(rhs) == 0) - { - /* 0 X - * --- - * 0 X - */ - if (rem) { - *rem = GetLow(lhs) % GetLow(rhs); - } - if (quo) { - *quo = GetLow(lhs) / GetLow(rhs); - } - return; - } - /* 0 X - * --- - * K X - */ - if (rem) { - *rem = GetLow(lhs); - } - if (quo) { - *quo = 0; - } - return; - } - /* n.s.high != 0 */ - if (GetLow(rhs) == 0) - { - if (GetHigh(rhs) == 0) - { - /* K X - * --- - * 0 0 - */ - if (rem) { - *rem = GetHigh(lhs) % GetLow(rhs); - } - if (quo) { - *quo = GetHigh(lhs) / GetLow(rhs); - } - return; - } - /* d.s.high != 0 */ - if (GetLow(lhs) == 0) - { - /* K 0 - * --- - * K 0 - */ - if (rem) { - *rem = ui128{GetHigh(lhs) % GetHigh(rhs), 0}; - } - if (quo) { - *quo = GetHigh(lhs) / GetHigh(rhs); - } - return; - } - /* K K - * --- - * K 0 - */ - if ((GetHigh(rhs) & (GetHigh(rhs) - 1)) == 0) /* if d is a power of 2 */ - { - if (rem) { - *rem = ui128{GetHigh(lhs) & (GetHigh(rhs) - 1), GetLow(lhs)}; - } - if (quo) { - *quo = GetHigh(lhs) >> CountLeadingZeroBits(GetHigh(rhs)); - } - return; - } - /* K K - * --- - * K 0 - */ - sr = CountLeadingZeroBits(GetHigh(rhs)) - CountLeadingZeroBits(GetHigh(lhs)); - /* 0 <= sr <= n_udword_bits - 2 or sr large */ - if (sr > n_udword_bits - 2) - { - if (rem) { - *rem = lhs; - } - if (quo) { - *quo = 0; - } - return; - } - ++sr; - /* 1 <= sr <= n_udword_bits - 1 */ - /* q.all = n.all << (n_utword_bits - sr); */ - q = ui128{ - GetLow(lhs) << (n_udword_bits - sr), - 0 - }; - r = ui128{ - GetHigh(lhs) >> sr, - (GetHigh(lhs) << (n_udword_bits - sr)) | (GetLow(lhs) >> sr) - }; - } - else /* d.s.low != 0 */ - { - if (GetHigh(rhs) == 0) - { - /* K X - * --- - * 0 K - */ - if ((GetLow(rhs) & (GetLow(rhs) - 1)) == 0) /* if d is a power of 2 */ - { - if (rem) { - *rem = ui128{0, GetLow(lhs) & (GetLow(rhs) - 1)}; - } - if (GetLow(rhs) == 1) { - if (quo) { - *quo = lhs; - } - return; - } - sr = CountTrailingZeroBits(GetLow(rhs)); - if (quo) { - *quo = ui128{ - GetHigh(lhs) >> sr, - (GetHigh(lhs) << (n_udword_bits - sr)) | (GetLow(lhs) >> sr) - }; - return; - } - } - /* K X - * --- - * 0 K - */ - sr = 1 + n_udword_bits + CountLeadingZeroBits(GetLow(rhs)) - - CountLeadingZeroBits(GetHigh(lhs)); - /* 2 <= sr <= n_utword_bits - 1 - * q.all = n.all << (n_utword_bits - sr); - * r.all = n.all >> sr; - */ - if (sr == n_udword_bits) - { - q = ui128{GetLow(lhs), 0}; - r = ui128{0, GetHigh(lhs)}; - } - else if (sr < n_udword_bits) // 2 <= sr <= n_udword_bits - 1 - { - q = ui128{ - GetLow(lhs) << (n_udword_bits - sr), - 0 - }; - r = ui128{ - GetHigh(lhs) >> sr, - (GetHigh(lhs) << (n_udword_bits - sr)) | (GetLow(lhs) >> sr) - }; - } - else // n_udword_bits + 1 <= sr <= n_utword_bits - 1 - { - q = ui128{ - (GetHigh(lhs) << (n_utword_bits - sr)) | (GetLow(lhs) >> (sr - n_udword_bits)), - GetLow(lhs) << (n_utword_bits - sr) - }; - r = ui128{ - 0, - GetHigh(lhs) >> (sr - n_udword_bits) - }; - } - } - else - { - /* K X - * --- - * K K - */ - sr = CountLeadingZeroBits(GetHigh(rhs)) - CountLeadingZeroBits(GetHigh(lhs)); - /*0 <= sr <= n_udword_bits - 1 or sr large */ - if (sr > n_udword_bits - 1) - { - if (rem) { - *rem = lhs; - } - if (quo) { - *quo = 0; - } - return; - } - ++sr; - /* 1 <= sr <= n_udword_bits - * q.all = n.all << (n_utword_bits - sr); - * r.all = n.all >> sr; - */ - if (sr == n_udword_bits) - { - q = ui128{ - GetLow(lhs), - 0 - }; - r = ui128{ - 0, - GetHigh(lhs) - }; - } - else - { - r = ui128{ - GetHigh(lhs) >> sr, - (GetHigh(lhs) << (n_udword_bits - sr)) | (GetLow(lhs) >> sr) - }; - q = ui128{ - GetLow(lhs) << (n_udword_bits - sr), - 0 - }; - } - } - } - /* Not a special case - * q and r are initialized with: - * q = n << (128 - sr); - * r = n >> sr; - * 1 <= sr <= 128 - 1 - */ - ui32 carry = 0; - for (; sr > 0; --sr) - { - /* r:q = ((r:q) << 1) | carry */ - r = ui128{ - (GetHigh(r) << 1) | (GetLow(r) >> (n_udword_bits - 1)), - (GetLow(r) << 1) | (GetHigh(q) >> (n_udword_bits - 1)) - }; - q = ui128{ - (GetHigh(q) << 1) | (GetLow(q) >> (n_udword_bits - 1)), - (GetLow(q) << 1) | carry - }; - carry = 0; - if (r >= rhs) { - r -= rhs; - carry = 1; - } - } - q = (q << 1) | carry; - if (rem) { - *rem = r; - } - if (quo) { - *quo = q; - } - } - - struct TSignedDivisionResult { - i128 Quotient; - i128 Remainder; - }; - - constexpr TSignedDivisionResult Divide(i128 lhs, i128 rhs) noexcept; -} - -constexpr ui128 operator/(const ui128 lhs, const ui128 rhs) noexcept { - ui128 quotient{}; - NPrivateInt128::DivMod128(lhs, rhs, "ient, nullptr); - return quotient; -} - -constexpr i128 operator/(const i128 lhs, const i128 rhs) noexcept { - i128 a = std::abs(lhs); - i128 b = std::abs(rhs); - - ui128 quotient{}; - NPrivateInt128::DivMod128(a, b, "ient, nullptr); - if (std::signbit(lhs) ^ std::signbit(rhs)) { - quotient = -quotient; - } - return quotient; -} - -constexpr ui128 operator%(const ui128 lhs, const ui128 rhs) noexcept { - ui128 remainder{}; - NPrivateInt128::DivMod128(lhs, rhs, nullptr, &remainder); - return remainder; -} - -constexpr i128 operator%(const i128 lhs, const i128 rhs) noexcept { - i128 a = std::abs(lhs); - i128 b = std::abs(rhs); - ui128 remainder{}; - NPrivateInt128::DivMod128(a, b, nullptr, &remainder); - if (std::signbit(lhs)) { - remainder = -remainder; - } - return remainder; -} - -constexpr ui128 operator<<(const ui128 lhs, int n) noexcept { - if (n < 64) { - if (n != 0) { - return - ui128{ - (GetHigh(lhs) << n) | (GetLow(lhs) >> (64 - n)), - GetLow(lhs) << n - }; - } - return lhs; - } - return ui128{GetLow(lhs) << (n - 64), 0}; -} - -constexpr ui128 operator>>(const ui128 lhs, int n) noexcept { - if (n < 64) { - if (n != 0) { - return - ui128{ - GetHigh(lhs) >> n, - (GetLow(lhs) >> n) | (GetHigh(lhs) << (64 - n)) - }; - } - return lhs; - } - return ui128{0, GetHigh(lhs) >> (n - 64)}; -} - - -constexpr bool operator!(const ui128 num) noexcept { - return !GetHigh(num) && !GetLow(num); -} - -constexpr ui128 operator~(const ui128 num) noexcept { - return ui128{~GetHigh(num), ~GetLow(num)}; -} - -constexpr ui128 operator|(const ui128 lhs, const ui128 rhs) noexcept { - return ui128{GetHigh(lhs) | GetHigh(rhs), GetLow(lhs) | GetLow(rhs)}; -} - -constexpr ui128 operator&(const ui128 lhs, const ui128 rhs) noexcept { - return ui128{GetHigh(lhs) & GetHigh(rhs), GetLow(lhs) & GetLow(rhs)}; -} - -constexpr ui128 operator^(const ui128 lhs, const ui128 rhs) noexcept { - return ui128{GetHigh(lhs) ^ GetHigh(rhs), GetLow(lhs) ^ GetLow(rhs)}; -} - - -IOutputStream& operator<<(IOutputStream& out, const ui128& other); - -// For THashMap -template <> -struct THash<ui128> { - inline size_t operator()(const ui128& num) const { - return THash<ui64>()(GetHigh(num)) + THash<ui64>()(GetLow(num)); - } -}; - -template <> -class TSerializer<ui128> { -public: - static void Save(IOutputStream* out, const ui128& Number); - static void Load(IInputStream* in, ui128& Number); -}; - -template <> -inline TString ToString<ui128>(const ui128& number) { - return TStringBuilder{} << number; -} - -template <> -inline ui128 FromStringImpl<ui128>(const char* data, size_t length) { - if (length < 20) { - return ui128{ FromString<ui64>(data, length) }; - } else { - ui128 result = 0; - const TStringBuf string(data, length); - for (auto&& c : string) { - if (!std::isdigit(c)) { + } + + constexpr TInteger128& operator|=(const TInteger128 other) noexcept { + return *this = *this | other; + } + + constexpr TInteger128& operator<<=(int n) noexcept { + *this = *this << n; + return *this; + } + + constexpr TInteger128& operator>>=(int n) noexcept { + *this = *this >> n; + return *this; + } + + constexpr TInteger128& operator++() noexcept { + *this += 1; + return *this; + } + + constexpr TInteger128 operator++(int) noexcept { + const TInteger128 ret{*this}; + this->operator++(); + return ret; + } + + constexpr TInteger128& operator--() noexcept { + *this -= 1; + return *this; + } + + constexpr TInteger128 operator--(int) noexcept { + const TInteger128 ret{*this}; + this->operator--(); + return ret; + } + + explicit constexpr operator bool() const noexcept { + return Low_ || High_; + } + + explicit constexpr operator char() const noexcept { + return static_cast<char>(Low_); + } + + explicit constexpr operator ui8() const noexcept { + return static_cast<ui8>(Low_); + } + + explicit constexpr operator i8() const noexcept { + return static_cast<i8>(Low_); + } + + explicit constexpr operator ui16() const noexcept { + return static_cast<ui16>(Low_); + } + + explicit constexpr operator i16() const noexcept { + return static_cast<i16>(Low_); + } + + explicit constexpr operator ui32() const noexcept { + return static_cast<ui32>(Low_); + } + + explicit constexpr operator i32() const noexcept { + return static_cast<i32>(Low_); + } + + explicit constexpr operator ui64() const noexcept { + return static_cast<ui64>(Low_); + } + + explicit constexpr operator i64() const noexcept { + return static_cast<i64>(Low_); + } + +#if defined(Y_HAVE_INT128) + explicit constexpr operator unsigned __int128() const noexcept { + return (static_cast<unsigned __int128>(High_) << 64) + Low_; + } + + explicit constexpr operator signed __int128() const noexcept { + return (static_cast<__int128>(High_) << 64) + Low_; + } +#endif + +private: +#if defined(_little_endian_) + ui64 Low_; + ui64 High_; +#elif defined(_big_endian_) + ui64 High_; + ui64 Low_; +#endif + template <bool IsSigned2> + friend constexpr ui64 GetHigh(TInteger128<IsSigned2> value) noexcept; + + template <bool IsSigned2> + friend constexpr ui64 GetLow(TInteger128<IsSigned2> value) noexcept; + + friend IOutputStream& operator<<(IOutputStream& out, const TInteger128& other); +}; // class TInteger128 + +using ui128 = TInteger128<false>; +using i128 = TInteger128<true>; + +constexpr ui128 operator+(ui128 lhs, ui128 rhs) noexcept; +constexpr i128 operator+( i128 lhs, i128 rhs) noexcept; +constexpr ui128 operator-(ui128 lhs, ui128 rhs) noexcept; +constexpr i128 operator-( i128 lhs, i128 rhs) noexcept; +constexpr ui128 operator-(ui128 num) noexcept; +constexpr i128 operator-( i128 num) noexcept; +constexpr ui128 operator*(ui128 lhs, ui128 rhs) noexcept; +constexpr i128 operator*( i128 lhs, i128 rhs) noexcept; +constexpr ui128 operator/(ui128 lhs, ui128 rhs) noexcept; +constexpr i128 operator/( i128 lhs, i128 rhs) noexcept; +constexpr ui128 operator%(ui128 lhs, ui128 rhs) noexcept; +constexpr i128 operator%( i128 lhs, i128 rhs) noexcept; +constexpr ui128 operator|(ui128 lhs, ui128 rhs) noexcept; +constexpr i128 operator|( i128 lhs, i128 rhs) noexcept; +constexpr ui128 operator&(ui128 lhs, ui128 rhs) noexcept; +constexpr i128 operator&( i128 lhs, i128 rhs) noexcept; +constexpr ui128 operator^(ui128 lhs, ui128 rhs) noexcept; +constexpr i128 operator^( i128 lhs, i128 rhs) noexcept; +constexpr ui128 operator<<(ui128 lhs, int n) noexcept; +constexpr i128 operator<<( i128 lhs, int n) noexcept; +constexpr ui128 operator>>(ui128 lhs, int n) noexcept; +constexpr i128 operator>>( i128 lhs, int n) noexcept; + +template <bool IsSigned> +size_t MostSignificantBit(const TInteger128<IsSigned> v); + +namespace std { + //// type traits + template <bool IsSigned> + struct is_integral<TInteger128<IsSigned>> : public std::true_type{}; + + template <bool IsSigned> + struct is_class<TInteger128<IsSigned>> : public std::false_type{}; + + template <> + struct is_signed<ui128> : public std::false_type{}; + + template <> + struct is_signed<i128> : public std::true_type{}; +} + +template <bool IsSigned> +constexpr ui64 GetHigh(const TInteger128<IsSigned> value) noexcept { + return value.High_; +} + +template <bool IsSigned> +constexpr ui64 GetLow(const TInteger128<IsSigned> value) noexcept { + return value.Low_; +} + +template <class T, std::enable_if_t<std::is_same_v<std::remove_cv_t<T>, i128>>* = nullptr> +constexpr ui128 operator-(const ui128 lhs, const T rhs) noexcept { + return lhs - static_cast<ui128>(rhs); +} + +template <class T, std::enable_if_t<std::is_same_v<std::remove_cv_t<T>, ui128>>* = nullptr> +constexpr ui128 operator-(const i128 lhs, const T rhs) noexcept { + return static_cast<ui128>(lhs) - rhs; +} + +// specialize std templates +namespace std { + // numeric limits + // see full list at https://en.cppreference.com/w/cpp/types/numeric_limits + template <bool IsSigned> + struct numeric_limits<TInteger128<IsSigned>> { + static constexpr bool is_specialized = true; + static constexpr bool is_signed = IsSigned; + static constexpr bool is_integer = true; + static constexpr bool is_exact = true; + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NAN = false; + static constexpr bool has_signaling_NAN = false; + static constexpr float_denorm_style has_denorm = std::denorm_absent; + static constexpr bool has_denorm_loss = false; + static constexpr float_round_style round_style = std::round_toward_zero; + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = true; + static constexpr int digits = CHAR_BIT * sizeof(ui128) - (IsSigned ? 1 : 0); + static constexpr int digits10 = 38; // std::numeric_limits<ui128>::digits * std::log10(2); + static constexpr int max_digits10 = 0; + static constexpr int radix = 2; + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + static constexpr bool traps = std::numeric_limits<ui64>::traps; // same as of any other ui* + static constexpr bool tinyness_before = false; + + static constexpr TInteger128<IsSigned> min() noexcept { + if constexpr (IsSigned) { + return TInteger128<IsSigned>{ + static_cast<ui64>(std::numeric_limits<i64>::min()), + 0 + }; + } + else { + return 0; + } + } + + static constexpr TInteger128<IsSigned> lowest() noexcept { + return min(); + } + + static constexpr TInteger128<IsSigned> max() noexcept { + if constexpr (IsSigned) { + return TInteger128<IsSigned>{ + static_cast<ui64>(std::numeric_limits<i64>::max()), + std::numeric_limits<ui64>::max() + }; + } + else { + return TInteger128<IsSigned>{ + std::numeric_limits<ui64>::max(), + std::numeric_limits<ui64>::max() + }; + } + } + + static constexpr TInteger128<IsSigned> epsilon() noexcept { + return 0; + } + + static constexpr TInteger128<IsSigned> round_error() noexcept { + return 0; + } + + static constexpr TInteger128<IsSigned> infinity() noexcept { + return 0; + } + + static constexpr TInteger128<IsSigned> quiet_NAN() noexcept { + return 0; + } + + static constexpr TInteger128<IsSigned> signaling_NAN() noexcept { + return 0; + } + + static constexpr TInteger128<IsSigned> denorm_min() noexcept { + return 0; + } + }; + + constexpr bool signbit(const ui128 arg) noexcept { + Y_UNUSED(arg); + return false; + } + + constexpr bool signbit(const i128 arg) noexcept { + return GetHigh(arg) & 0x8000000000000000; + } + + constexpr ui128 abs(const ui128 arg) noexcept { + return arg; + } + + constexpr i128 abs(const i128 arg) noexcept { + return signbit(arg) ? (-arg) : arg; + } +} + +constexpr bool operator==(const ui128 lhs, const ui128 rhs) noexcept { + return GetLow(lhs) == GetLow(rhs) && GetHigh(lhs) == GetHigh(rhs); +} + +constexpr bool operator==(const i128 lhs, const i128 rhs) noexcept { + return GetLow(lhs) == GetLow(rhs) && GetHigh(lhs) == GetHigh(rhs); +} + +constexpr bool operator!=(const ui128 lhs, const ui128 rhs) noexcept { + return !(lhs == rhs); +} + +constexpr bool operator!=(const i128 lhs, const i128 rhs) noexcept { + return !(lhs == rhs); +} + +constexpr bool operator<(const ui128 lhs, const ui128 rhs) noexcept { + if (GetHigh(lhs) != GetHigh(rhs)) { + return GetHigh(lhs) < GetHigh(rhs); + } + + return GetLow(lhs) < GetLow(rhs); +} + +constexpr bool operator<(const i128 lhs, const i128 rhs) noexcept { + if (lhs == 0 && rhs == 0) { + return false; + } + + const bool lhsIsNegative = std::signbit(lhs); + const bool rhsIsNegative = std::signbit(rhs); + + if (lhsIsNegative && !rhsIsNegative) { + return true; + } + + if (!lhsIsNegative && rhsIsNegative) { + return false; + } + + // both are negative or both are positive + if (GetHigh(lhs) != GetHigh(rhs)) { + return GetHigh(lhs) < GetHigh(rhs); + } + + return GetLow(lhs) < GetLow(rhs); +} + +constexpr bool operator>(const ui128 lhs, const ui128 rhs) noexcept { + return rhs < lhs; +} + +constexpr bool operator>(const i128 lhs, const i128 rhs) noexcept { + return rhs < lhs; +} + +constexpr bool operator<=(const ui128 lhs, const ui128 rhs) noexcept { + return !(rhs < lhs); +} + +constexpr bool operator<=(const i128 lhs, const i128 rhs) noexcept { + return !(rhs < lhs); +} + +constexpr bool operator>=(const ui128 lhs, const ui128 rhs) noexcept { + return !(lhs < rhs); +} + +constexpr bool operator>=(const i128 lhs, const i128 rhs) noexcept { + return !(lhs < rhs); +} + +constexpr ui128 operator+(const ui128 lhs, const ui128 rhs) noexcept { + const ui128 result{GetHigh(lhs) + GetHigh(rhs), GetLow(lhs) + GetLow(rhs)}; + if (GetLow(result) < GetLow(lhs)) { + return ui128{GetHigh(result) + 1, GetLow(result)}; + } + return result; +} + +constexpr i128 operator+(const i128 lhs, const i128 rhs) noexcept { + const i128 result{GetHigh(lhs) + GetHigh(rhs), GetLow(lhs) + GetLow(rhs)}; + if (GetLow(result) < GetLow(lhs)) { + return i128{GetHigh(result) + 1, GetLow(result)}; + } + return result; +} + +constexpr ui128 operator-(const ui128 lhs, const ui128 rhs) noexcept { + const ui128 result{GetHigh(lhs) - GetHigh(rhs), GetLow(lhs) - GetLow(rhs)}; + if (GetLow(result) > GetLow(lhs)) { // underflow + return ui128{GetHigh(result) - 1, GetLow(result)}; + } + return result; +} + +constexpr i128 operator-(const i128 lhs, const i128 rhs) noexcept { + const i128 result{GetHigh(lhs) - GetHigh(rhs), GetLow(lhs) - GetLow(rhs)}; + if (GetLow(result) > GetLow(lhs)) { // underflow + return i128{GetHigh(result) - 1, GetLow(result)}; + } + return result; +} + +constexpr ui128 operator-(const ui128 num) noexcept { + const ui128 result{~GetHigh(num), ~GetLow(num) + 1}; + if (GetLow(result) == 0) { + return ui128{GetHigh(result) + 1, GetLow(result)}; + } + return result; +} + +constexpr i128 operator-(const i128 num) noexcept { + const i128 result{~GetHigh(num), ~GetLow(num) + 1}; + if (GetLow(result) == 0) { + return i128{GetHigh(result) + 1, GetLow(result)}; + } + return result; +} + +constexpr ui128 operator*(const ui128 lhs, const ui128 rhs) noexcept { + if (rhs == 0) { + return 0; + } + if (rhs == 1) { + return lhs; + } + + ui128 result{}; + ui128 t = rhs; + + for (size_t i = 0; i < 128; ++i) { + if ((t & 1) != 0) { + result += (lhs << i); + } + + t = t >> 1; + } + + return result; +} + +constexpr i128 operator*(const i128 lhs, const i128 rhs) noexcept { + if (rhs == 0) { + return 0; + } + if (rhs == 1) { + return lhs; + } + + i128 result{}; + i128 t = rhs; + + for (size_t i = 0; i < 128; ++i) { + if ((t & 1) != 0) { + result += (lhs << i); + } + + t = t >> 1; + } + + return result; +} + +namespace NPrivateInt128 { + // NOTE: division by zero is UB and can be changed in future + constexpr void DivMod128(const ui128 lhs, const ui128 rhs, ui128* const quo, ui128* const rem) { + if (!quo && !rem) { + return; + } + + constexpr size_t n_udword_bits = sizeof(ui64) * CHAR_BIT; + constexpr size_t n_utword_bits = sizeof(ui128) * CHAR_BIT; + + ui128 q{}; + ui128 r{}; + + unsigned sr{}; + + /* special cases, X is unknown, K != 0 */ + if (GetHigh(lhs) == 0) + { + if (GetHigh(rhs) == 0) + { + /* 0 X + * --- + * 0 X + */ + if (rem) { + *rem = GetLow(lhs) % GetLow(rhs); + } + if (quo) { + *quo = GetLow(lhs) / GetLow(rhs); + } + return; + } + /* 0 X + * --- + * K X + */ + if (rem) { + *rem = GetLow(lhs); + } + if (quo) { + *quo = 0; + } + return; + } + /* n.s.high != 0 */ + if (GetLow(rhs) == 0) + { + if (GetHigh(rhs) == 0) + { + /* K X + * --- + * 0 0 + */ + if (rem) { + *rem = GetHigh(lhs) % GetLow(rhs); + } + if (quo) { + *quo = GetHigh(lhs) / GetLow(rhs); + } + return; + } + /* d.s.high != 0 */ + if (GetLow(lhs) == 0) + { + /* K 0 + * --- + * K 0 + */ + if (rem) { + *rem = ui128{GetHigh(lhs) % GetHigh(rhs), 0}; + } + if (quo) { + *quo = GetHigh(lhs) / GetHigh(rhs); + } + return; + } + /* K K + * --- + * K 0 + */ + if ((GetHigh(rhs) & (GetHigh(rhs) - 1)) == 0) /* if d is a power of 2 */ + { + if (rem) { + *rem = ui128{GetHigh(lhs) & (GetHigh(rhs) - 1), GetLow(lhs)}; + } + if (quo) { + *quo = GetHigh(lhs) >> CountLeadingZeroBits(GetHigh(rhs)); + } + return; + } + /* K K + * --- + * K 0 + */ + sr = CountLeadingZeroBits(GetHigh(rhs)) - CountLeadingZeroBits(GetHigh(lhs)); + /* 0 <= sr <= n_udword_bits - 2 or sr large */ + if (sr > n_udword_bits - 2) + { + if (rem) { + *rem = lhs; + } + if (quo) { + *quo = 0; + } + return; + } + ++sr; + /* 1 <= sr <= n_udword_bits - 1 */ + /* q.all = n.all << (n_utword_bits - sr); */ + q = ui128{ + GetLow(lhs) << (n_udword_bits - sr), + 0 + }; + r = ui128{ + GetHigh(lhs) >> sr, + (GetHigh(lhs) << (n_udword_bits - sr)) | (GetLow(lhs) >> sr) + }; + } + else /* d.s.low != 0 */ + { + if (GetHigh(rhs) == 0) + { + /* K X + * --- + * 0 K + */ + if ((GetLow(rhs) & (GetLow(rhs) - 1)) == 0) /* if d is a power of 2 */ + { + if (rem) { + *rem = ui128{0, GetLow(lhs) & (GetLow(rhs) - 1)}; + } + if (GetLow(rhs) == 1) { + if (quo) { + *quo = lhs; + } + return; + } + sr = CountTrailingZeroBits(GetLow(rhs)); + if (quo) { + *quo = ui128{ + GetHigh(lhs) >> sr, + (GetHigh(lhs) << (n_udword_bits - sr)) | (GetLow(lhs) >> sr) + }; + return; + } + } + /* K X + * --- + * 0 K + */ + sr = 1 + n_udword_bits + CountLeadingZeroBits(GetLow(rhs)) + - CountLeadingZeroBits(GetHigh(lhs)); + /* 2 <= sr <= n_utword_bits - 1 + * q.all = n.all << (n_utword_bits - sr); + * r.all = n.all >> sr; + */ + if (sr == n_udword_bits) + { + q = ui128{GetLow(lhs), 0}; + r = ui128{0, GetHigh(lhs)}; + } + else if (sr < n_udword_bits) // 2 <= sr <= n_udword_bits - 1 + { + q = ui128{ + GetLow(lhs) << (n_udword_bits - sr), + 0 + }; + r = ui128{ + GetHigh(lhs) >> sr, + (GetHigh(lhs) << (n_udword_bits - sr)) | (GetLow(lhs) >> sr) + }; + } + else // n_udword_bits + 1 <= sr <= n_utword_bits - 1 + { + q = ui128{ + (GetHigh(lhs) << (n_utword_bits - sr)) | (GetLow(lhs) >> (sr - n_udword_bits)), + GetLow(lhs) << (n_utword_bits - sr) + }; + r = ui128{ + 0, + GetHigh(lhs) >> (sr - n_udword_bits) + }; + } + } + else + { + /* K X + * --- + * K K + */ + sr = CountLeadingZeroBits(GetHigh(rhs)) - CountLeadingZeroBits(GetHigh(lhs)); + /*0 <= sr <= n_udword_bits - 1 or sr large */ + if (sr > n_udword_bits - 1) + { + if (rem) { + *rem = lhs; + } + if (quo) { + *quo = 0; + } + return; + } + ++sr; + /* 1 <= sr <= n_udword_bits + * q.all = n.all << (n_utword_bits - sr); + * r.all = n.all >> sr; + */ + if (sr == n_udword_bits) + { + q = ui128{ + GetLow(lhs), + 0 + }; + r = ui128{ + 0, + GetHigh(lhs) + }; + } + else + { + r = ui128{ + GetHigh(lhs) >> sr, + (GetHigh(lhs) << (n_udword_bits - sr)) | (GetLow(lhs) >> sr) + }; + q = ui128{ + GetLow(lhs) << (n_udword_bits - sr), + 0 + }; + } + } + } + /* Not a special case + * q and r are initialized with: + * q = n << (128 - sr); + * r = n >> sr; + * 1 <= sr <= 128 - 1 + */ + ui32 carry = 0; + for (; sr > 0; --sr) + { + /* r:q = ((r:q) << 1) | carry */ + r = ui128{ + (GetHigh(r) << 1) | (GetLow(r) >> (n_udword_bits - 1)), + (GetLow(r) << 1) | (GetHigh(q) >> (n_udword_bits - 1)) + }; + q = ui128{ + (GetHigh(q) << 1) | (GetLow(q) >> (n_udword_bits - 1)), + (GetLow(q) << 1) | carry + }; + carry = 0; + if (r >= rhs) { + r -= rhs; + carry = 1; + } + } + q = (q << 1) | carry; + if (rem) { + *rem = r; + } + if (quo) { + *quo = q; + } + } + + struct TSignedDivisionResult { + i128 Quotient; + i128 Remainder; + }; + + constexpr TSignedDivisionResult Divide(i128 lhs, i128 rhs) noexcept; +} + +constexpr ui128 operator/(const ui128 lhs, const ui128 rhs) noexcept { + ui128 quotient{}; + NPrivateInt128::DivMod128(lhs, rhs, "ient, nullptr); + return quotient; +} + +constexpr i128 operator/(const i128 lhs, const i128 rhs) noexcept { + i128 a = std::abs(lhs); + i128 b = std::abs(rhs); + + ui128 quotient{}; + NPrivateInt128::DivMod128(a, b, "ient, nullptr); + if (std::signbit(lhs) ^ std::signbit(rhs)) { + quotient = -quotient; + } + return quotient; +} + +constexpr ui128 operator%(const ui128 lhs, const ui128 rhs) noexcept { + ui128 remainder{}; + NPrivateInt128::DivMod128(lhs, rhs, nullptr, &remainder); + return remainder; +} + +constexpr i128 operator%(const i128 lhs, const i128 rhs) noexcept { + i128 a = std::abs(lhs); + i128 b = std::abs(rhs); + ui128 remainder{}; + NPrivateInt128::DivMod128(a, b, nullptr, &remainder); + if (std::signbit(lhs)) { + remainder = -remainder; + } + return remainder; +} + +constexpr ui128 operator<<(const ui128 lhs, int n) noexcept { + if (n < 64) { + if (n != 0) { + return + ui128{ + (GetHigh(lhs) << n) | (GetLow(lhs) >> (64 - n)), + GetLow(lhs) << n + }; + } + return lhs; + } + return ui128{GetLow(lhs) << (n - 64), 0}; +} + +constexpr ui128 operator>>(const ui128 lhs, int n) noexcept { + if (n < 64) { + if (n != 0) { + return + ui128{ + GetHigh(lhs) >> n, + (GetLow(lhs) >> n) | (GetHigh(lhs) << (64 - n)) + }; + } + return lhs; + } + return ui128{0, GetHigh(lhs) >> (n - 64)}; +} + + +constexpr bool operator!(const ui128 num) noexcept { + return !GetHigh(num) && !GetLow(num); +} + +constexpr ui128 operator~(const ui128 num) noexcept { + return ui128{~GetHigh(num), ~GetLow(num)}; +} + +constexpr ui128 operator|(const ui128 lhs, const ui128 rhs) noexcept { + return ui128{GetHigh(lhs) | GetHigh(rhs), GetLow(lhs) | GetLow(rhs)}; +} + +constexpr ui128 operator&(const ui128 lhs, const ui128 rhs) noexcept { + return ui128{GetHigh(lhs) & GetHigh(rhs), GetLow(lhs) & GetLow(rhs)}; +} + +constexpr ui128 operator^(const ui128 lhs, const ui128 rhs) noexcept { + return ui128{GetHigh(lhs) ^ GetHigh(rhs), GetLow(lhs) ^ GetLow(rhs)}; +} + + +IOutputStream& operator<<(IOutputStream& out, const ui128& other); + +// For THashMap +template <> +struct THash<ui128> { + inline size_t operator()(const ui128& num) const { + return THash<ui64>()(GetHigh(num)) + THash<ui64>()(GetLow(num)); + } +}; + +template <> +class TSerializer<ui128> { +public: + static void Save(IOutputStream* out, const ui128& Number); + static void Load(IInputStream* in, ui128& Number); +}; + +template <> +inline TString ToString<ui128>(const ui128& number) { + return TStringBuilder{} << number; +} + +template <> +inline ui128 FromStringImpl<ui128>(const char* data, size_t length) { + if (length < 20) { + return ui128{ FromString<ui64>(data, length) }; + } else { + ui128 result = 0; + const TStringBuf string(data, length); + for (auto&& c : string) { + if (!std::isdigit(c)) { ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv; - } - - ui128 x1 = result; - ui128 x2 = x1 + x1; - ui128 x4 = x2 + x2; - ui128 x8 = x4 + x4; - ui128 x10 = x8 + x2; - ui128 s = c - '0'; - result = x10 + s; - - if (GetHigh(result) < GetHigh(x1)) { + } + + ui128 x1 = result; + ui128 x2 = x1 + x1; + ui128 x4 = x2 + x2; + ui128 x8 = x4 + x4; + ui128 x10 = x8 + x2; + ui128 s = c - '0'; + result = x10 + s; + + if (GetHigh(result) < GetHigh(x1)) { ythrow TFromStringException() << TStringBuf("Integer overflow"); - } - } - - return result; - } -} - -#if defined(Y_HAVE_INT128) -template <> -inline TString ToString<unsigned __int128>(const unsigned __int128& number) { - return ToString(ui128{number}); -} - -template <> -inline unsigned __int128 FromStringImpl<unsigned __int128>(const char* data, size_t length) { - return static_cast<unsigned __int128>(FromString<ui128>(data, length)); -} -#endif - -// operators - - -namespace NPrivateInt128 { - // very naive algorithm of division - // no contract for divide by zero (i.e. it is UB) (may be changed in future) - constexpr TSignedDivisionResult Divide(i128 lhs, i128 rhs) noexcept { - TSignedDivisionResult result {}; - - // check trivial cases - // X/0 = +/- inf, X%0 = X - if (rhs == 0) { - // UB, let's return: `X / 0 = +inf`, and `X % 0 = X` - result.Quotient = std::signbit(lhs) ? std::numeric_limits<i128>::min() : std::numeric_limits<i128>::max(); - result.Remainder = lhs; - } - - // 0/Y = 0, 0%Y = 0 - else if (lhs == 0) { - result.Quotient = 0; - result.Remainder = 0; - } - - // X/1 = X, X%1 = 0 - else if (rhs == 1) { - result.Quotient = lhs; - result.Remainder = 0; - } - - // X/-1 = -X, X%(-1) = 0 - else if (rhs == -1) { - result.Quotient = -lhs; - result.Remainder = 0; - } - - // abs(X)<abs(Y), X/Y = 0, X%Y = X - else if (std::abs(lhs) < std::abs(rhs)) { - result.Quotient = 0; - result.Remainder = lhs; - } - - else if (lhs == rhs) { - result.Quotient = 1; - result.Remainder = 0; - } - - else if (lhs == -rhs) { - result.Quotient = -1; - result.Remainder = 0; - } - - else if (std::abs(lhs) > std::abs(rhs)) { - const bool quotientMustBeNegative = std::signbit(lhs) ^ std::signbit(rhs); - const bool remainderMustBeNegative = std::signbit(lhs); - - lhs = std::abs(lhs); - rhs = std::abs(rhs); - - // result is division of two ui64 - if (GetHigh(lhs) == 0 && GetHigh(rhs) == 0) { - result.Quotient = GetLow(lhs) / GetLow(rhs); - result.Remainder = GetLow(lhs) % GetLow(rhs); - } - - // naive shift-and-subtract - // https://stackoverflow.com/questions/5386377/division-without-using - i128 denominator = rhs; - result.Quotient = 0; - result.Remainder = lhs; - - const size_t shift = MostSignificantBit(lhs) - MostSignificantBit(denominator); - denominator <<= shift; - - for (size_t i = 0; i <= shift; ++i) { - result.Quotient <<= 1; - if (result.Remainder >= denominator) { - result.Remainder -= denominator; - result.Quotient |= 1; - } - denominator >>= 1; - } - - if (quotientMustBeNegative) { - result.Quotient = -result.Quotient; - } - - if (remainderMustBeNegative) { - result.Remainder = -result.Remainder; - } - } - - return result; - } -} // namespace NPrivateInt128 - -constexpr i128 operator<<(const i128 lhs, int n) noexcept { - if (n < 64) { - if (n != 0) { - return - i128{ - (GetHigh(lhs) << n) | (GetLow(lhs) >> (64 - n)), - GetLow(lhs) << n - }; - } - return lhs; - } - return i128{GetLow(lhs) << (n - 64), 0}; -} - -constexpr i128 operator>>(const i128 lhs, int n) noexcept { - if (n < 64) { - if (n != 0) { - return - i128{ - GetHigh(lhs) >> n, - (GetLow(lhs) >> n) | (GetHigh(lhs) << (64 - n)) - }; - } - return lhs; - } - return i128{0, GetHigh(lhs) >> (n - 64)}; -} - -constexpr bool operator!(const i128 num) noexcept { - return !GetHigh(num) && !GetLow(num); -} - -constexpr i128 operator~(const i128 num) noexcept { - return i128{~GetHigh(num), ~GetLow(num)}; -} - -constexpr i128 operator|(const i128 lhs, const i128 rhs) noexcept { - return i128{GetHigh(lhs) | GetHigh(rhs), GetLow(lhs) | GetLow(rhs)}; -} - -constexpr i128 operator&(const i128 lhs, const i128 rhs) noexcept { - return i128{GetHigh(lhs) & GetHigh(rhs), GetLow(lhs) & GetLow(rhs)}; -} - -constexpr i128 operator^(const i128 lhs, const i128 rhs) noexcept { - return i128{GetHigh(lhs) ^ GetHigh(rhs), GetLow(lhs) ^ GetLow(rhs)}; -} - - -IOutputStream& operator<<(IOutputStream& out, const i128& other); - -// For THashMap -template <> -struct THash<i128> { - inline size_t operator()(const i128& num) const { - return THash<ui64>()(GetHigh(num)) + THash<ui64>()(GetLow(num)); - } -}; - -template <> -class TSerializer<i128> { -public: - static void Save(IOutputStream* out, const i128& Number); - static void Load(IInputStream* in, i128& Number); -}; - -template <> -inline TString ToString<i128>(const i128& number) { - return TStringBuilder{} << number; -} - -template <> -inline i128 FromStringImpl<i128>(const char* data, size_t length) { - if (length < 20) { - return i128{ FromString<ui64>(data, length) }; - } else { - i128 result = 0; - const TStringBuf string(data, length); - for (auto&& c : string) { - if (!std::isdigit(c)) { + } + } + + return result; + } +} + +#if defined(Y_HAVE_INT128) +template <> +inline TString ToString<unsigned __int128>(const unsigned __int128& number) { + return ToString(ui128{number}); +} + +template <> +inline unsigned __int128 FromStringImpl<unsigned __int128>(const char* data, size_t length) { + return static_cast<unsigned __int128>(FromString<ui128>(data, length)); +} +#endif + +// operators + + +namespace NPrivateInt128 { + // very naive algorithm of division + // no contract for divide by zero (i.e. it is UB) (may be changed in future) + constexpr TSignedDivisionResult Divide(i128 lhs, i128 rhs) noexcept { + TSignedDivisionResult result {}; + + // check trivial cases + // X/0 = +/- inf, X%0 = X + if (rhs == 0) { + // UB, let's return: `X / 0 = +inf`, and `X % 0 = X` + result.Quotient = std::signbit(lhs) ? std::numeric_limits<i128>::min() : std::numeric_limits<i128>::max(); + result.Remainder = lhs; + } + + // 0/Y = 0, 0%Y = 0 + else if (lhs == 0) { + result.Quotient = 0; + result.Remainder = 0; + } + + // X/1 = X, X%1 = 0 + else if (rhs == 1) { + result.Quotient = lhs; + result.Remainder = 0; + } + + // X/-1 = -X, X%(-1) = 0 + else if (rhs == -1) { + result.Quotient = -lhs; + result.Remainder = 0; + } + + // abs(X)<abs(Y), X/Y = 0, X%Y = X + else if (std::abs(lhs) < std::abs(rhs)) { + result.Quotient = 0; + result.Remainder = lhs; + } + + else if (lhs == rhs) { + result.Quotient = 1; + result.Remainder = 0; + } + + else if (lhs == -rhs) { + result.Quotient = -1; + result.Remainder = 0; + } + + else if (std::abs(lhs) > std::abs(rhs)) { + const bool quotientMustBeNegative = std::signbit(lhs) ^ std::signbit(rhs); + const bool remainderMustBeNegative = std::signbit(lhs); + + lhs = std::abs(lhs); + rhs = std::abs(rhs); + + // result is division of two ui64 + if (GetHigh(lhs) == 0 && GetHigh(rhs) == 0) { + result.Quotient = GetLow(lhs) / GetLow(rhs); + result.Remainder = GetLow(lhs) % GetLow(rhs); + } + + // naive shift-and-subtract + // https://stackoverflow.com/questions/5386377/division-without-using + i128 denominator = rhs; + result.Quotient = 0; + result.Remainder = lhs; + + const size_t shift = MostSignificantBit(lhs) - MostSignificantBit(denominator); + denominator <<= shift; + + for (size_t i = 0; i <= shift; ++i) { + result.Quotient <<= 1; + if (result.Remainder >= denominator) { + result.Remainder -= denominator; + result.Quotient |= 1; + } + denominator >>= 1; + } + + if (quotientMustBeNegative) { + result.Quotient = -result.Quotient; + } + + if (remainderMustBeNegative) { + result.Remainder = -result.Remainder; + } + } + + return result; + } +} // namespace NPrivateInt128 + +constexpr i128 operator<<(const i128 lhs, int n) noexcept { + if (n < 64) { + if (n != 0) { + return + i128{ + (GetHigh(lhs) << n) | (GetLow(lhs) >> (64 - n)), + GetLow(lhs) << n + }; + } + return lhs; + } + return i128{GetLow(lhs) << (n - 64), 0}; +} + +constexpr i128 operator>>(const i128 lhs, int n) noexcept { + if (n < 64) { + if (n != 0) { + return + i128{ + GetHigh(lhs) >> n, + (GetLow(lhs) >> n) | (GetHigh(lhs) << (64 - n)) + }; + } + return lhs; + } + return i128{0, GetHigh(lhs) >> (n - 64)}; +} + +constexpr bool operator!(const i128 num) noexcept { + return !GetHigh(num) && !GetLow(num); +} + +constexpr i128 operator~(const i128 num) noexcept { + return i128{~GetHigh(num), ~GetLow(num)}; +} + +constexpr i128 operator|(const i128 lhs, const i128 rhs) noexcept { + return i128{GetHigh(lhs) | GetHigh(rhs), GetLow(lhs) | GetLow(rhs)}; +} + +constexpr i128 operator&(const i128 lhs, const i128 rhs) noexcept { + return i128{GetHigh(lhs) & GetHigh(rhs), GetLow(lhs) & GetLow(rhs)}; +} + +constexpr i128 operator^(const i128 lhs, const i128 rhs) noexcept { + return i128{GetHigh(lhs) ^ GetHigh(rhs), GetLow(lhs) ^ GetLow(rhs)}; +} + + +IOutputStream& operator<<(IOutputStream& out, const i128& other); + +// For THashMap +template <> +struct THash<i128> { + inline size_t operator()(const i128& num) const { + return THash<ui64>()(GetHigh(num)) + THash<ui64>()(GetLow(num)); + } +}; + +template <> +class TSerializer<i128> { +public: + static void Save(IOutputStream* out, const i128& Number); + static void Load(IInputStream* in, i128& Number); +}; + +template <> +inline TString ToString<i128>(const i128& number) { + return TStringBuilder{} << number; +} + +template <> +inline i128 FromStringImpl<i128>(const char* data, size_t length) { + if (length < 20) { + return i128{ FromString<ui64>(data, length) }; + } else { + i128 result = 0; + const TStringBuf string(data, length); + for (auto&& c : string) { + if (!std::isdigit(c)) { ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv; - } - - i128 x1 = result; - i128 x2 = x1 + x1; - i128 x4 = x2 + x2; - i128 x8 = x4 + x4; - i128 x10 = x8 + x2; - i128 s = c - '0'; - result = x10 + s; - - if (GetHigh(result) < GetHigh(x1)) { + } + + i128 x1 = result; + i128 x2 = x1 + x1; + i128 x4 = x2 + x2; + i128 x8 = x4 + x4; + i128 x10 = x8 + x2; + i128 s = c - '0'; + result = x10 + s; + + if (GetHigh(result) < GetHigh(x1)) { ythrow TFromStringException() << TStringBuf("Integer overflow"); - } - } - - return result; - } -} - -#if defined(Y_HAVE_INT128) -template <> -inline TString ToString<signed __int128>(const signed __int128& number) { - return ToString(i128{number}); -} - -template <> -inline signed __int128 FromStringImpl<signed __int128>(const char* data, size_t length) { - return static_cast<signed __int128>(FromString<i128>(data, length)); -} -#endif - -template <bool IsSigned> -Y_FORCE_INLINE size_t MostSignificantBit(const TInteger128<IsSigned> v) { - if (ui64 hi = GetHigh(v)) { - return MostSignificantBit(hi) + 64; - } - return MostSignificantBit(GetLow(v)); -} + } + } + + return result; + } +} + +#if defined(Y_HAVE_INT128) +template <> +inline TString ToString<signed __int128>(const signed __int128& number) { + return ToString(i128{number}); +} + +template <> +inline signed __int128 FromStringImpl<signed __int128>(const char* data, size_t length) { + return static_cast<signed __int128>(FromString<i128>(data, length)); +} +#endif + +template <bool IsSigned> +Y_FORCE_INLINE size_t MostSignificantBit(const TInteger128<IsSigned> v) { + if (ui64 hi = GetHigh(v)) { + return MostSignificantBit(hi) + 64; + } + return MostSignificantBit(GetLow(v)); +} diff --git a/library/cpp/int128/int128_common.h b/library/cpp/int128/int128_common.h index 6f70f09beec..7ad6485b338 100644 --- a/library/cpp/int128/int128_common.h +++ b/library/cpp/int128/int128_common.h @@ -1 +1 @@ -#pragma once +#pragma once diff --git a/library/cpp/int128/int128_util.h b/library/cpp/int128/int128_util.h index 7a5ca2c2502..b3208eaed33 100644 --- a/library/cpp/int128/int128_util.h +++ b/library/cpp/int128/int128_util.h @@ -1,15 +1,15 @@ -#pragma once - -#include <util/generic/bitops.h> -#include <limits> - -namespace NPrivateInt128 { - // will be moved to util/ later - template <typename T> - constexpr unsigned CountLeadingZeroBits(const T value) { - if (value == 0) { - return std::numeric_limits<std::make_unsigned_t<T>>::digits; - } - return std::numeric_limits<std::make_unsigned_t<T>>::digits - GetValueBitCount(value); - } -} +#pragma once + +#include <util/generic/bitops.h> +#include <limits> + +namespace NPrivateInt128 { + // will be moved to util/ later + template <typename T> + constexpr unsigned CountLeadingZeroBits(const T value) { + if (value == 0) { + return std::numeric_limits<std::make_unsigned_t<T>>::digits; + } + return std::numeric_limits<std::make_unsigned_t<T>>::digits - GetValueBitCount(value); + } +} diff --git a/library/cpp/int128/ut/.gitignore b/library/cpp/int128/ut/.gitignore index 36abcb2a2c6..46c70565446 100644 --- a/library/cpp/int128/ut/.gitignore +++ b/library/cpp/int128/ut/.gitignore @@ -1,2 +1,2 @@ -library-int128-ut - +library-int128-ut + diff --git a/library/cpp/int128/ut/i128_and_intrinsic_identity_ut.cpp b/library/cpp/int128/ut/i128_and_intrinsic_identity_ut.cpp index dbb7507a738..c7de9b36c75 100644 --- a/library/cpp/int128/ut/i128_and_intrinsic_identity_ut.cpp +++ b/library/cpp/int128/ut/i128_and_intrinsic_identity_ut.cpp @@ -1,598 +1,598 @@ -#include "int128_ut_helpers.h" - +#include "int128_ut_helpers.h" + #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/int128/int128.h> - -#include <util/generic/cast.h> - -#include <array> -#include <type_traits> - -#if defined(Y_HAVE_INT128) -bool IsIdentical(const i128 a, const signed __int128 b) { - const std::array<ui8, 16> arrayA = NInt128Private::GetAsArray(a); - const std::array<ui8, 16> arrayB = NInt128Private::GetAsArray(b); - return arrayA == arrayB; -} - -Y_UNIT_TEST_SUITE(i128_And_i8_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_i8_Zero) { - i8 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i8_Minus1) { - i8 n = -1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i8_Plus1) { - i8 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i8_Minus42) { - i8 n = -42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i8_Plus42) { - i8 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i8_Min) { - i8 n = std::numeric_limits<i8>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i8_Max) { - i8 n = std::numeric_limits<i8>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i8_MinPlus1) { - i8 n = std::numeric_limits<i8>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i8_MaxMinus1) { - i8 n = std::numeric_limits<i8>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_i16_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_i16_Zero) { - i16 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i16_Minus1) { - i16 n = -1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i16_Plus1) { - i16 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i16_Minus42) { - i16 n = -42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i16_Plus42) { - i16 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i16_Min) { - i16 n = std::numeric_limits<i16>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i16_Max) { - i16 n = std::numeric_limits<i16>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i16_MinPlus1) { - i16 n = std::numeric_limits<i16>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i16_MaxMinus1) { - i16 n = std::numeric_limits<i16>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_i32_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_i32_Zero) { - i32 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i32_Minus1) { - i32 n = -1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i32_Plus1) { - i32 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i32_Minus42) { - i32 n = -42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i32_Plus42) { - i32 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i32_Min) { - i32 n = std::numeric_limits<i32>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i32_Max) { - i32 n = std::numeric_limits<i32>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i32_MinPlus1) { - i32 n = std::numeric_limits<i32>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i32_MaxMinus1) { - i32 n = std::numeric_limits<i32>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_i64_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_i64_Zero) { - i64 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i64_Minus1) { - i64 n = -1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i64_Plus1) { - i64 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i64_Minus42) { - i64 n = -42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i64_Plus42) { - i64 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i64_Min) { - i64 n = std::numeric_limits<i64>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i64_Max) { - i64 n = std::numeric_limits<i64>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i64_MinPlus1) { - i64 n = std::numeric_limits<i64>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_i64_MaxMinus1) { - i64 n = std::numeric_limits<i64>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_signed_int128_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_signed_int128_Zero) { - signed __int128 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_signed_int128_Minus1) { - signed __int128 n = -1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_signed_int128_Plus1) { - signed __int128 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_signed_int128_Minus42) { - signed __int128 n = -42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_signed_int128_Plus42) { - signed __int128 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_signed_int128_Min) { - signed __int128 n = std::numeric_limits<signed __int128>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_signed_int128_Max) { - signed __int128 n = std::numeric_limits<signed __int128>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_signed_int128_MinPlus1) { - signed __int128 n = std::numeric_limits<signed __int128>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_signed_int128_MaxMinus1) { - signed __int128 n = std::numeric_limits<signed __int128>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_ui8_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_ui8_Zero) { - ui8 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui8_Plus1) { - ui8 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui8_Plus42) { - ui8 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui8_Min) { - ui8 n = std::numeric_limits<i8>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui8_Max) { - ui8 n = std::numeric_limits<i8>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui8_MinPlus1) { - ui8 n = std::numeric_limits<i8>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui8_MaxMinus1) { - ui8 n = std::numeric_limits<i8>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_ui16_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_ui16_Zero) { - ui16 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui16_Plus1) { - ui16 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui16_Plus42) { - ui16 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui16_Min) { - ui16 n = std::numeric_limits<i8>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui16_Max) { - ui16 n = std::numeric_limits<i8>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui16_MinPlus1) { - ui16 n = std::numeric_limits<i8>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui16_MaxMinus1) { - ui16 n = std::numeric_limits<i8>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_ui32_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_ui32_Zero) { - ui32 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui32_Plus1) { - ui32 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui32_Plus42) { - ui32 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui32_Min) { - ui32 n = std::numeric_limits<i8>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui32_Max) { - ui32 n = std::numeric_limits<i8>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui32_MinPlus1) { - ui32 n = std::numeric_limits<i8>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui32_MaxMinus1) { - ui32 n = std::numeric_limits<i8>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_ui64_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_ui64_Zero) { - ui64 n = 0; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui64_Plus1) { - ui64 n = 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui64_Plus42) { - ui64 n = 42; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui64_Min) { - ui64 n = std::numeric_limits<i8>::min(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui64_Max) { - ui64 n = std::numeric_limits<i8>::max(); - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui64_MinPlus1) { - ui64 n = std::numeric_limits<i8>::min() + 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_ui64_MaxMinus1) { - ui64 n = std::numeric_limits<i8>::max() - 1; - i128 t1{n}; - signed __int128 t2{n}; - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} - -Y_UNIT_TEST_SUITE(i128_And_unsigned_int128_BitwiseIdentity) { - Y_UNIT_TEST(i128_from_unsigned_int128_Zero) { - unsigned __int128 n = 0; - i128 t1{n}; - signed __int128 t2 = static_cast<signed __int128>(n); - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_unsigned_int128_Plus1) { - unsigned __int128 n = 1; - i128 t1{n}; - signed __int128 t2 = static_cast<signed __int128>(n); - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_unsigned_int128_Plus42) { - unsigned __int128 n = 42; - i128 t1{n}; - signed __int128 t2 = static_cast<signed __int128>(n); - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_unsigned_int128_Min) { - unsigned __int128 n = std::numeric_limits<i8>::min(); - i128 t1{n}; - signed __int128 t2 = static_cast<signed __int128>(n); - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_unsigned_int128_Max) { - unsigned __int128 n = std::numeric_limits<i8>::max(); - i128 t1{n}; - signed __int128 t2 = static_cast<signed __int128>(n); - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_unsigned_int128_MinPlus1) { - unsigned __int128 n = std::numeric_limits<i8>::min() + 1; - i128 t1{n}; - signed __int128 t2 = static_cast<signed __int128>(n); - UNIT_ASSERT(IsIdentical(t1, t2)); - } - - Y_UNIT_TEST(i128_from_unsigned_int128_MaxMinus1) { - unsigned __int128 n = std::numeric_limits<i8>::max() - 1; - i128 t1{n}; - signed __int128 t2 = static_cast<signed __int128>(n); - UNIT_ASSERT(IsIdentical(t1, t2)); - } -} -#endif + +#include <util/generic/cast.h> + +#include <array> +#include <type_traits> + +#if defined(Y_HAVE_INT128) +bool IsIdentical(const i128 a, const signed __int128 b) { + const std::array<ui8, 16> arrayA = NInt128Private::GetAsArray(a); + const std::array<ui8, 16> arrayB = NInt128Private::GetAsArray(b); + return arrayA == arrayB; +} + +Y_UNIT_TEST_SUITE(i128_And_i8_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_i8_Zero) { + i8 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i8_Minus1) { + i8 n = -1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i8_Plus1) { + i8 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i8_Minus42) { + i8 n = -42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i8_Plus42) { + i8 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i8_Min) { + i8 n = std::numeric_limits<i8>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i8_Max) { + i8 n = std::numeric_limits<i8>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i8_MinPlus1) { + i8 n = std::numeric_limits<i8>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i8_MaxMinus1) { + i8 n = std::numeric_limits<i8>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_i16_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_i16_Zero) { + i16 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i16_Minus1) { + i16 n = -1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i16_Plus1) { + i16 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i16_Minus42) { + i16 n = -42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i16_Plus42) { + i16 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i16_Min) { + i16 n = std::numeric_limits<i16>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i16_Max) { + i16 n = std::numeric_limits<i16>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i16_MinPlus1) { + i16 n = std::numeric_limits<i16>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i16_MaxMinus1) { + i16 n = std::numeric_limits<i16>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_i32_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_i32_Zero) { + i32 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i32_Minus1) { + i32 n = -1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i32_Plus1) { + i32 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i32_Minus42) { + i32 n = -42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i32_Plus42) { + i32 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i32_Min) { + i32 n = std::numeric_limits<i32>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i32_Max) { + i32 n = std::numeric_limits<i32>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i32_MinPlus1) { + i32 n = std::numeric_limits<i32>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i32_MaxMinus1) { + i32 n = std::numeric_limits<i32>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_i64_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_i64_Zero) { + i64 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i64_Minus1) { + i64 n = -1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i64_Plus1) { + i64 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i64_Minus42) { + i64 n = -42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i64_Plus42) { + i64 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i64_Min) { + i64 n = std::numeric_limits<i64>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i64_Max) { + i64 n = std::numeric_limits<i64>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i64_MinPlus1) { + i64 n = std::numeric_limits<i64>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_i64_MaxMinus1) { + i64 n = std::numeric_limits<i64>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_signed_int128_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_signed_int128_Zero) { + signed __int128 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_signed_int128_Minus1) { + signed __int128 n = -1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_signed_int128_Plus1) { + signed __int128 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_signed_int128_Minus42) { + signed __int128 n = -42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_signed_int128_Plus42) { + signed __int128 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_signed_int128_Min) { + signed __int128 n = std::numeric_limits<signed __int128>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_signed_int128_Max) { + signed __int128 n = std::numeric_limits<signed __int128>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_signed_int128_MinPlus1) { + signed __int128 n = std::numeric_limits<signed __int128>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_signed_int128_MaxMinus1) { + signed __int128 n = std::numeric_limits<signed __int128>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_ui8_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_ui8_Zero) { + ui8 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui8_Plus1) { + ui8 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui8_Plus42) { + ui8 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui8_Min) { + ui8 n = std::numeric_limits<i8>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui8_Max) { + ui8 n = std::numeric_limits<i8>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui8_MinPlus1) { + ui8 n = std::numeric_limits<i8>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui8_MaxMinus1) { + ui8 n = std::numeric_limits<i8>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_ui16_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_ui16_Zero) { + ui16 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui16_Plus1) { + ui16 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui16_Plus42) { + ui16 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui16_Min) { + ui16 n = std::numeric_limits<i8>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui16_Max) { + ui16 n = std::numeric_limits<i8>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui16_MinPlus1) { + ui16 n = std::numeric_limits<i8>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui16_MaxMinus1) { + ui16 n = std::numeric_limits<i8>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_ui32_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_ui32_Zero) { + ui32 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui32_Plus1) { + ui32 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui32_Plus42) { + ui32 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui32_Min) { + ui32 n = std::numeric_limits<i8>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui32_Max) { + ui32 n = std::numeric_limits<i8>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui32_MinPlus1) { + ui32 n = std::numeric_limits<i8>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui32_MaxMinus1) { + ui32 n = std::numeric_limits<i8>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_ui64_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_ui64_Zero) { + ui64 n = 0; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui64_Plus1) { + ui64 n = 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui64_Plus42) { + ui64 n = 42; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui64_Min) { + ui64 n = std::numeric_limits<i8>::min(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui64_Max) { + ui64 n = std::numeric_limits<i8>::max(); + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui64_MinPlus1) { + ui64 n = std::numeric_limits<i8>::min() + 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_ui64_MaxMinus1) { + ui64 n = std::numeric_limits<i8>::max() - 1; + i128 t1{n}; + signed __int128 t2{n}; + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} + +Y_UNIT_TEST_SUITE(i128_And_unsigned_int128_BitwiseIdentity) { + Y_UNIT_TEST(i128_from_unsigned_int128_Zero) { + unsigned __int128 n = 0; + i128 t1{n}; + signed __int128 t2 = static_cast<signed __int128>(n); + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_unsigned_int128_Plus1) { + unsigned __int128 n = 1; + i128 t1{n}; + signed __int128 t2 = static_cast<signed __int128>(n); + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_unsigned_int128_Plus42) { + unsigned __int128 n = 42; + i128 t1{n}; + signed __int128 t2 = static_cast<signed __int128>(n); + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_unsigned_int128_Min) { + unsigned __int128 n = std::numeric_limits<i8>::min(); + i128 t1{n}; + signed __int128 t2 = static_cast<signed __int128>(n); + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_unsigned_int128_Max) { + unsigned __int128 n = std::numeric_limits<i8>::max(); + i128 t1{n}; + signed __int128 t2 = static_cast<signed __int128>(n); + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_unsigned_int128_MinPlus1) { + unsigned __int128 n = std::numeric_limits<i8>::min() + 1; + i128 t1{n}; + signed __int128 t2 = static_cast<signed __int128>(n); + UNIT_ASSERT(IsIdentical(t1, t2)); + } + + Y_UNIT_TEST(i128_from_unsigned_int128_MaxMinus1) { + unsigned __int128 n = std::numeric_limits<i8>::max() - 1; + i128 t1{n}; + signed __int128 t2 = static_cast<signed __int128>(n); + UNIT_ASSERT(IsIdentical(t1, t2)); + } +} +#endif diff --git a/library/cpp/int128/ut/i128_comparison_ut.cpp b/library/cpp/int128/ut/i128_comparison_ut.cpp index 7b8d5088151..8e38ac17e27 100644 --- a/library/cpp/int128/ut/i128_comparison_ut.cpp +++ b/library/cpp/int128/ut/i128_comparison_ut.cpp @@ -1,145 +1,145 @@ #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/int128/int128.h> - -#include <util/generic/cast.h> - -Y_UNIT_TEST_SUITE(I128ComparisonPositiveWithPositiveSuite) { - Y_UNIT_TEST(PositivePositiveGreater) { - UNIT_ASSERT(i128{1} > i128{0}); - UNIT_ASSERT(i128{2} > i128{1}); - UNIT_ASSERT(i128{42} > i128{0}); - UNIT_ASSERT(i128{42} > i128{1}); - i128 big = i128{1, 0}; - UNIT_ASSERT(big > i128{1}); - UNIT_ASSERT(std::numeric_limits<i128>::max() > i128{0}); - } - - Y_UNIT_TEST(PositivePositiveGreaterOrEqual) { - UNIT_ASSERT(i128{1} >= i128{0}); - UNIT_ASSERT(i128{2} >= i128{1}); - UNIT_ASSERT(i128{42} >= i128{0}); - UNIT_ASSERT(i128{42} >= i128{1}); - i128 big = i128{1, 0}; - UNIT_ASSERT(big >= i128{1}); - UNIT_ASSERT(std::numeric_limits<i128>::max() >= i128{0}); - - UNIT_ASSERT(i128{0} >= i128{0}); - UNIT_ASSERT(i128{1} >= i128{1}); - UNIT_ASSERT(i128{2} >= i128{2}); - UNIT_ASSERT(i128{42} >= i128{42}); - UNIT_ASSERT(big >= big); - UNIT_ASSERT(std::numeric_limits<i128>::max() >= std::numeric_limits<i128>::max()); - } - - Y_UNIT_TEST(PositivePositiveLess) { - UNIT_ASSERT(i128{0} < i128{1}); - UNIT_ASSERT(i128{1} < i128{2}); - UNIT_ASSERT(i128{0} < i128{42}); - UNIT_ASSERT(i128{1} < i128{42}); - i128 big = i128{1, 0}; - UNIT_ASSERT(i128{1} < big); - UNIT_ASSERT(i128{0} < std::numeric_limits<i128>::max()); - } - - Y_UNIT_TEST(PositivePositiveLessOrEqual) { - UNIT_ASSERT(i128{0} <= i128{1}); - UNIT_ASSERT(i128{1} <= i128{2}); - UNIT_ASSERT(i128{0} <= i128{42}); - UNIT_ASSERT(i128{1} <= i128{42}); - i128 big = i128{1, 0}; - UNIT_ASSERT(i128{1} <= big); - UNIT_ASSERT(i128{0} <= std::numeric_limits<i128>::max()); - - UNIT_ASSERT(i128{0} <= i128{0}); - UNIT_ASSERT(i128{1} <= i128{1}); - UNIT_ASSERT(i128{2} <= i128{2}); - UNIT_ASSERT(i128{42} <= i128{42}); - UNIT_ASSERT(big <= big); - UNIT_ASSERT(std::numeric_limits<i128>::max() <= std::numeric_limits<i128>::max()); - } -} - -Y_UNIT_TEST_SUITE(I128ComparisonPositiveWithNegativeSuite) { - Y_UNIT_TEST(PositiveNegativeGreater) { - UNIT_ASSERT(i128{0} > i128{-1}); - UNIT_ASSERT(i128{2} > i128{-1}); - UNIT_ASSERT(i128{0} > i128{-42}); - UNIT_ASSERT(i128{42} > i128{-1}); - i128 big = i128{1, 0}; - UNIT_ASSERT(big > i128{-1}); - UNIT_ASSERT(std::numeric_limits<i128>::max() > i128{-1}); - } - - Y_UNIT_TEST(PositiveNegativeGreaterOrEqual) { - UNIT_ASSERT(i128{0} >= i128{-1}); - UNIT_ASSERT(i128{2} >= i128{-1}); - UNIT_ASSERT(i128{0} >= i128{-42}); - UNIT_ASSERT(i128{42} >= i128{-1}); - i128 big = i128{1, 0}; - UNIT_ASSERT(big >= i128{-1}); - UNIT_ASSERT(std::numeric_limits<i128>::max() >= i128{-1}); - } - - Y_UNIT_TEST(NegativePositiveLess) { - UNIT_ASSERT(i128{-1} < i128{0}); - UNIT_ASSERT(i128{-1} < i128{2}); - UNIT_ASSERT(i128{-42} < i128{0}); - UNIT_ASSERT(i128{-1} < i128{42}); - i128 big = i128{1, 0}; - UNIT_ASSERT(i128{-1} < big); - UNIT_ASSERT(i128{-1} < std::numeric_limits<i128>::max()); - } - - Y_UNIT_TEST(NegativePositiveLessOrEqual) { - UNIT_ASSERT(i128{-1} <= i128{0}); - UNIT_ASSERT(i128{-1} <= i128{2}); - UNIT_ASSERT(i128{-42} <= i128{0}); - UNIT_ASSERT(i128{-1} <= i128{42}); - i128 big = i128{1, 0}; - UNIT_ASSERT(i128{-1} <= big); - UNIT_ASSERT(i128{-1} <= std::numeric_limits<i128>::max()); - } -} - -Y_UNIT_TEST_SUITE(I128ComparisonNegativeWithNegativeSuite) { - Y_UNIT_TEST(NegativeNegativeGreater) { - UNIT_ASSERT(i128{-1} > i128{-2}); - UNIT_ASSERT(i128{-2} > i128{-3}); - UNIT_ASSERT(i128{-1} > i128{-42}); - UNIT_ASSERT(i128{-42} > i128{-142}); - i128 big = -i128{1, 0}; - UNIT_ASSERT(i128{-1} > big); - UNIT_ASSERT(i128{-1} > std::numeric_limits<i128>::min()); - } - - Y_UNIT_TEST(NegativeNegativeGreaterOrEqual) { - UNIT_ASSERT(i128{-1} >= i128{-2}); - UNIT_ASSERT(i128{-2} >= i128{-3}); - UNIT_ASSERT(i128{-1} >= i128{-42}); - UNIT_ASSERT(i128{-42} >= i128{-142}); - i128 big = -i128{1, 0}; - UNIT_ASSERT(i128{-1} >= big); - UNIT_ASSERT(i128{-1} >= std::numeric_limits<i128>::min()); - } - - Y_UNIT_TEST(NegativeNegativeLess) { - UNIT_ASSERT(i128{-2} < i128{-1}); - UNIT_ASSERT(i128{-3} < i128{-2}); - UNIT_ASSERT(i128{-42} < i128{-1}); - UNIT_ASSERT(i128{-142} < i128{42}); - i128 big = -i128{1, 0}; - UNIT_ASSERT(big < i128{-1}); - UNIT_ASSERT(std::numeric_limits<i128>::min() < i128{-1}); - } - - Y_UNIT_TEST(NegativeNegativeLessOrEqual) { - UNIT_ASSERT(i128{-2} <= i128{-1}); - UNIT_ASSERT(i128{-3} <= i128{-2}); - UNIT_ASSERT(i128{-42} <= i128{-1}); - UNIT_ASSERT(i128{-142} <= i128{42}); - i128 big = -i128{1, 0}; - UNIT_ASSERT(big <= i128{-1}); - UNIT_ASSERT(std::numeric_limits<i128>::min() <= i128{-1}); - } -} + +#include <util/generic/cast.h> + +Y_UNIT_TEST_SUITE(I128ComparisonPositiveWithPositiveSuite) { + Y_UNIT_TEST(PositivePositiveGreater) { + UNIT_ASSERT(i128{1} > i128{0}); + UNIT_ASSERT(i128{2} > i128{1}); + UNIT_ASSERT(i128{42} > i128{0}); + UNIT_ASSERT(i128{42} > i128{1}); + i128 big = i128{1, 0}; + UNIT_ASSERT(big > i128{1}); + UNIT_ASSERT(std::numeric_limits<i128>::max() > i128{0}); + } + + Y_UNIT_TEST(PositivePositiveGreaterOrEqual) { + UNIT_ASSERT(i128{1} >= i128{0}); + UNIT_ASSERT(i128{2} >= i128{1}); + UNIT_ASSERT(i128{42} >= i128{0}); + UNIT_ASSERT(i128{42} >= i128{1}); + i128 big = i128{1, 0}; + UNIT_ASSERT(big >= i128{1}); + UNIT_ASSERT(std::numeric_limits<i128>::max() >= i128{0}); + + UNIT_ASSERT(i128{0} >= i128{0}); + UNIT_ASSERT(i128{1} >= i128{1}); + UNIT_ASSERT(i128{2} >= i128{2}); + UNIT_ASSERT(i128{42} >= i128{42}); + UNIT_ASSERT(big >= big); + UNIT_ASSERT(std::numeric_limits<i128>::max() >= std::numeric_limits<i128>::max()); + } + + Y_UNIT_TEST(PositivePositiveLess) { + UNIT_ASSERT(i128{0} < i128{1}); + UNIT_ASSERT(i128{1} < i128{2}); + UNIT_ASSERT(i128{0} < i128{42}); + UNIT_ASSERT(i128{1} < i128{42}); + i128 big = i128{1, 0}; + UNIT_ASSERT(i128{1} < big); + UNIT_ASSERT(i128{0} < std::numeric_limits<i128>::max()); + } + + Y_UNIT_TEST(PositivePositiveLessOrEqual) { + UNIT_ASSERT(i128{0} <= i128{1}); + UNIT_ASSERT(i128{1} <= i128{2}); + UNIT_ASSERT(i128{0} <= i128{42}); + UNIT_ASSERT(i128{1} <= i128{42}); + i128 big = i128{1, 0}; + UNIT_ASSERT(i128{1} <= big); + UNIT_ASSERT(i128{0} <= std::numeric_limits<i128>::max()); + + UNIT_ASSERT(i128{0} <= i128{0}); + UNIT_ASSERT(i128{1} <= i128{1}); + UNIT_ASSERT(i128{2} <= i128{2}); + UNIT_ASSERT(i128{42} <= i128{42}); + UNIT_ASSERT(big <= big); + UNIT_ASSERT(std::numeric_limits<i128>::max() <= std::numeric_limits<i128>::max()); + } +} + +Y_UNIT_TEST_SUITE(I128ComparisonPositiveWithNegativeSuite) { + Y_UNIT_TEST(PositiveNegativeGreater) { + UNIT_ASSERT(i128{0} > i128{-1}); + UNIT_ASSERT(i128{2} > i128{-1}); + UNIT_ASSERT(i128{0} > i128{-42}); + UNIT_ASSERT(i128{42} > i128{-1}); + i128 big = i128{1, 0}; + UNIT_ASSERT(big > i128{-1}); + UNIT_ASSERT(std::numeric_limits<i128>::max() > i128{-1}); + } + + Y_UNIT_TEST(PositiveNegativeGreaterOrEqual) { + UNIT_ASSERT(i128{0} >= i128{-1}); + UNIT_ASSERT(i128{2} >= i128{-1}); + UNIT_ASSERT(i128{0} >= i128{-42}); + UNIT_ASSERT(i128{42} >= i128{-1}); + i128 big = i128{1, 0}; + UNIT_ASSERT(big >= i128{-1}); + UNIT_ASSERT(std::numeric_limits<i128>::max() >= i128{-1}); + } + + Y_UNIT_TEST(NegativePositiveLess) { + UNIT_ASSERT(i128{-1} < i128{0}); + UNIT_ASSERT(i128{-1} < i128{2}); + UNIT_ASSERT(i128{-42} < i128{0}); + UNIT_ASSERT(i128{-1} < i128{42}); + i128 big = i128{1, 0}; + UNIT_ASSERT(i128{-1} < big); + UNIT_ASSERT(i128{-1} < std::numeric_limits<i128>::max()); + } + + Y_UNIT_TEST(NegativePositiveLessOrEqual) { + UNIT_ASSERT(i128{-1} <= i128{0}); + UNIT_ASSERT(i128{-1} <= i128{2}); + UNIT_ASSERT(i128{-42} <= i128{0}); + UNIT_ASSERT(i128{-1} <= i128{42}); + i128 big = i128{1, 0}; + UNIT_ASSERT(i128{-1} <= big); + UNIT_ASSERT(i128{-1} <= std::numeric_limits<i128>::max()); + } +} + +Y_UNIT_TEST_SUITE(I128ComparisonNegativeWithNegativeSuite) { + Y_UNIT_TEST(NegativeNegativeGreater) { + UNIT_ASSERT(i128{-1} > i128{-2}); + UNIT_ASSERT(i128{-2} > i128{-3}); + UNIT_ASSERT(i128{-1} > i128{-42}); + UNIT_ASSERT(i128{-42} > i128{-142}); + i128 big = -i128{1, 0}; + UNIT_ASSERT(i128{-1} > big); + UNIT_ASSERT(i128{-1} > std::numeric_limits<i128>::min()); + } + + Y_UNIT_TEST(NegativeNegativeGreaterOrEqual) { + UNIT_ASSERT(i128{-1} >= i128{-2}); + UNIT_ASSERT(i128{-2} >= i128{-3}); + UNIT_ASSERT(i128{-1} >= i128{-42}); + UNIT_ASSERT(i128{-42} >= i128{-142}); + i128 big = -i128{1, 0}; + UNIT_ASSERT(i128{-1} >= big); + UNIT_ASSERT(i128{-1} >= std::numeric_limits<i128>::min()); + } + + Y_UNIT_TEST(NegativeNegativeLess) { + UNIT_ASSERT(i128{-2} < i128{-1}); + UNIT_ASSERT(i128{-3} < i128{-2}); + UNIT_ASSERT(i128{-42} < i128{-1}); + UNIT_ASSERT(i128{-142} < i128{42}); + i128 big = -i128{1, 0}; + UNIT_ASSERT(big < i128{-1}); + UNIT_ASSERT(std::numeric_limits<i128>::min() < i128{-1}); + } + + Y_UNIT_TEST(NegativeNegativeLessOrEqual) { + UNIT_ASSERT(i128{-2} <= i128{-1}); + UNIT_ASSERT(i128{-3} <= i128{-2}); + UNIT_ASSERT(i128{-42} <= i128{-1}); + UNIT_ASSERT(i128{-142} <= i128{42}); + i128 big = -i128{1, 0}; + UNIT_ASSERT(big <= i128{-1}); + UNIT_ASSERT(std::numeric_limits<i128>::min() <= i128{-1}); + } +} diff --git a/library/cpp/int128/ut/i128_division_ut.cpp b/library/cpp/int128/ut/i128_division_ut.cpp index 46b0ca27f5b..b58731dd7e1 100644 --- a/library/cpp/int128/ut/i128_division_ut.cpp +++ b/library/cpp/int128/ut/i128_division_ut.cpp @@ -1,413 +1,413 @@ #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/int128/int128.h> - -#include <util/generic/cast.h> - -Y_UNIT_TEST_SUITE(I128DivisionBy1Suite) { - Y_UNIT_TEST(I128Divide0By1) { - i128 dividend = 0; - i128 divider = 1; - i128 expectedQuotient = 0; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128Divide1By1) { - i128 dividend = 1; - i128 divider = 1; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128Divide2By1) { - i128 dividend = 2; - i128 divider = 1; - i128 expectedQuotient = 2; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128Divide42By1) { - i128 dividend = 42; - i128 divider = 1; - i128 expectedQuotient = 42; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxUi64By1) { - i128 dividend = std::numeric_limits<ui64>::max(); - i128 divider = 1; - i128 expectedQuotient = std::numeric_limits<ui64>::max(); - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxUi64Plus1By1) { - i128 dividend = i128{std::numeric_limits<ui64>::max()} + i128{1}; - i128 divider = 1; - i128 expectedQuotient = i128{std::numeric_limits<ui64>::max()} + i128{1}; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxUi64Plus42By1) { - i128 dividend = i128{std::numeric_limits<ui64>::max()} + i128{42}; - i128 divider = 1; - i128 expectedQuotient = i128{std::numeric_limits<ui64>::max()} + i128{42}; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxI128By1) { - i128 dividend = std::numeric_limits<i128>::max(); - i128 divider = 1; - i128 expectedQuotient = std::numeric_limits<i128>::max(); - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxI128Minus1By1) { - i128 dividend = std::numeric_limits<i128>::max() - 1; - i128 divider = 1; - i128 expectedQuotient = std::numeric_limits<i128>::max() - 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } -} - -Y_UNIT_TEST_SUITE(I128DivisionByEqualSuite) { - Y_UNIT_TEST(I128Divide1ByEqual) { - i128 dividend = 1; - i128 divider = dividend; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128Divide2ByEqual) { - i128 dividend = 2; - i128 divider = dividend; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128Divide42ByEqual) { - i128 dividend = 42; - i128 divider = dividend; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxUi64ByEqual) { - i128 dividend = std::numeric_limits<ui64>::max(); - i128 divider = dividend; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxUi64Plus1ByEqual) { - i128 dividend = i128{std::numeric_limits<ui64>::max()} + i128{1}; - i128 divider = dividend; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxUi64Plus42ByEqual) { - i128 dividend = i128{std::numeric_limits<ui64>::max()} + i128{42}; - i128 divider = dividend; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxI128ByEqual) { - i128 dividend = std::numeric_limits<i128>::max(); - i128 divider = dividend; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxI128Minus1ByEqual) { - i128 dividend = std::numeric_limits<i128>::max() - 1; - i128 divider = dividend; - i128 expectedQuotient = 1; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } -} - -Y_UNIT_TEST_SUITE(I128DivisionLessByHigherSuite) { - Y_UNIT_TEST(I128Divide42By84) { - i128 dividend = 42; - i128 divider = 84; - i128 expectedQuotient = 0; - i128 expectedRemainder = 42; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128Divide42ByMaxUi64) { - i128 dividend = 42; - i128 divider = std::numeric_limits<ui64>::max(); - i128 expectedQuotient = 0; - i128 expectedRemainder = 42; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128Divide42ByMaxUi64Plus1) { - i128 dividend = 42; - i128 divider = i128{std::numeric_limits<ui64>::max()} + i128{1}; - i128 expectedQuotient = 0; - i128 expectedRemainder = 42; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(I128DivideMaxUi64ByMaxUi64Plus1) { - i128 dividend = i128{std::numeric_limits<ui64>::max()}; - i128 divider = i128{std::numeric_limits<ui64>::max()} + i128{1}; - i128 expectedQuotient = 0; - i128 expectedRemainder = i128{std::numeric_limits<ui64>::max()}; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } -} - -Y_UNIT_TEST_SUITE(I128DivisionWithDifferentSigns) { - Y_UNIT_TEST(DivisionPositiveByNegative) { - i128 dividend = i128{100}; - i128 divider = i128{-33}; - i128 expectedQuotient = -3; - i128 expectedRemainder = 1; - i128 quotient = dividend / divider; - i128 remainder = dividend % divider; - - UNIT_ASSERT_EQUAL(quotient, expectedQuotient); - UNIT_ASSERT_EQUAL(remainder, expectedRemainder); - } - - Y_UNIT_TEST(DivisionNegativeByPositive) { - i128 dividend = i128{-100}; - i128 divider = i128{33}; - i128 expectedQuotient = -3; - i128 expectedRemainder = -1; - i128 quotient = dividend / divider; - i128 remainder = dividend % divider; - - UNIT_ASSERT_EQUAL(quotient, expectedQuotient); - UNIT_ASSERT_EQUAL(remainder, expectedRemainder); - } - - Y_UNIT_TEST(DivisionNegativeByNegative) { - i128 dividend = i128{-100}; - i128 divider = i128{-33}; - i128 expectedQuotient = 3; - i128 expectedRemainder = -1; - i128 quotient = dividend / divider; - i128 remainder = dividend % divider; - - UNIT_ASSERT_EQUAL(quotient, expectedQuotient); - UNIT_ASSERT_EQUAL(remainder, expectedRemainder); - } -} - -Y_UNIT_TEST_SUITE(i128DivisionBigByBigSuite) { - Y_UNIT_TEST(i128DivideBigByBig1) { - i128 dividend = {64, 0}; - i128 divider = {1, 0}; - i128 expectedQuotient = 64; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(i128DivideBigByBig1_PosByNeg) { - i128 dividend = i128{64, 0}; - i128 divider = -i128{1, 0}; - i128 expectedQuotient = -i128{64}; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(i128DivideBigByBig1_NegByPos) { - i128 dividend = -i128{64, 0}; - i128 divider = i128{1, 0}; - i128 expectedQuotient = -i128{64}; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(i128DivideBigByBig1_NegByNeg) { - i128 dividend = -i128{64, 0}; - i128 divider = -i128{1, 0}; - i128 expectedQuotient = i128{64}; - i128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(i128DivideBigByBig2) { - i128 dividend = {64, 0}; - i128 divider = {12, 5}; - i128 expectedQuotient = 5; - i128 expectedRemainder = i128{3, 18446744073709551591ull}; // plz don't ask - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(i128DivideBigByBig2_PosByNeg) { - i128 dividend = i128{64, 0}; - i128 divider = -i128{12, 5}; - i128 expectedQuotient = -5; - i128 expectedRemainder = i128{3, 18446744073709551591ull}; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(i128DivideBigByBig2_NegByPos) { - i128 dividend = -i128{64, 0}; - i128 divider = i128{12, 5}; - i128 expectedQuotient = -5; - i128 expectedRemainder = -i128{3, 18446744073709551591ull}; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(i128DivideBigByBig2_NegByNeg) { - i128 dividend = -i128{64, 0}; - i128 divider = -i128{12, 5}; - i128 expectedQuotient = 5; - i128 expectedRemainder = -i128{3, 18446744073709551591ull}; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - -} - -Y_UNIT_TEST_SUITE(i128DivisionAlgo) { - Y_UNIT_TEST(ii128DivideAlgoCheck_PosByPos) { - /* - 49672666804009505000000 / 10000000 == 4967266680400950 - 49672666804009505000000 % 10000000 == 5000000 - */ - i128 dividend = {2692ull, 14031757583392049728ull}; - i64 divider = 10000000; - i128 expectedQuotient = {0, 4967266680400950ull}; - i128 expectedRemainder = {0, 5000000ull}; - - i128 quotient = dividend / divider; - i128 reminder = dividend % divider; - - UNIT_ASSERT_EQUAL(quotient, expectedQuotient); - UNIT_ASSERT_EQUAL(reminder, expectedRemainder); - } - - Y_UNIT_TEST(ii128DivideAlgoCheck_PosByNeg) { - /* - 49672666804009505000000 / -10000000 == -4967266680400950 - 49672666804009505000000 % -10000000 == 5000000 - */ - i128 dividend = {2692ull, 14031757583392049728ull}; - i64 divider = -10000000; - i128 expectedQuotient = -i128{0, 4967266680400950ull}; - i128 expectedRemainder = {0, 5000000ull}; - - i128 quotient = dividend / divider; - i128 reminder = dividend % divider; - - UNIT_ASSERT_EQUAL(quotient, expectedQuotient); - UNIT_ASSERT_EQUAL(reminder, expectedRemainder); - } - - Y_UNIT_TEST(ii128DivideAlgoCheck_NegByPos) { - /* - -49672666804009505000000 / 10000000 == -4967266680400950 - -49672666804009505000000 % 10000000 == -5000000 - */ - i128 dividend = -i128{2692ull, 14031757583392049728ull}; - i64 divider = 10000000; - i128 expectedQuotient = -i128{0, 4967266680400950ull}; - i128 expectedRemainder = -i128{0, 5000000ull}; - - i128 quotient = dividend / divider; - i128 reminder = dividend % divider; - - UNIT_ASSERT_EQUAL(quotient, expectedQuotient); - UNIT_ASSERT_EQUAL(reminder, expectedRemainder); - } - - Y_UNIT_TEST(ii128DivideAlgoCheck_NegByNeg) { - /* - -49672666804009505000000 / -10000000 == 4967266680400950 - -49672666804009505000000 % -10000000 == -5000000 - */ - i128 dividend = -i128{2692ull, 14031757583392049728ull}; - i64 divider = -10000000; - i128 expectedQuotient = {0, 4967266680400950ull}; - i128 expectedRemainder = -i128{0, 5000000ull}; - - i128 quotient = dividend / divider; - i128 reminder = dividend % divider; - - UNIT_ASSERT_EQUAL(quotient, expectedQuotient); - UNIT_ASSERT_EQUAL(reminder, expectedRemainder); - } - -} + +#include <util/generic/cast.h> + +Y_UNIT_TEST_SUITE(I128DivisionBy1Suite) { + Y_UNIT_TEST(I128Divide0By1) { + i128 dividend = 0; + i128 divider = 1; + i128 expectedQuotient = 0; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128Divide1By1) { + i128 dividend = 1; + i128 divider = 1; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128Divide2By1) { + i128 dividend = 2; + i128 divider = 1; + i128 expectedQuotient = 2; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128Divide42By1) { + i128 dividend = 42; + i128 divider = 1; + i128 expectedQuotient = 42; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxUi64By1) { + i128 dividend = std::numeric_limits<ui64>::max(); + i128 divider = 1; + i128 expectedQuotient = std::numeric_limits<ui64>::max(); + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxUi64Plus1By1) { + i128 dividend = i128{std::numeric_limits<ui64>::max()} + i128{1}; + i128 divider = 1; + i128 expectedQuotient = i128{std::numeric_limits<ui64>::max()} + i128{1}; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxUi64Plus42By1) { + i128 dividend = i128{std::numeric_limits<ui64>::max()} + i128{42}; + i128 divider = 1; + i128 expectedQuotient = i128{std::numeric_limits<ui64>::max()} + i128{42}; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxI128By1) { + i128 dividend = std::numeric_limits<i128>::max(); + i128 divider = 1; + i128 expectedQuotient = std::numeric_limits<i128>::max(); + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxI128Minus1By1) { + i128 dividend = std::numeric_limits<i128>::max() - 1; + i128 divider = 1; + i128 expectedQuotient = std::numeric_limits<i128>::max() - 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } +} + +Y_UNIT_TEST_SUITE(I128DivisionByEqualSuite) { + Y_UNIT_TEST(I128Divide1ByEqual) { + i128 dividend = 1; + i128 divider = dividend; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128Divide2ByEqual) { + i128 dividend = 2; + i128 divider = dividend; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128Divide42ByEqual) { + i128 dividend = 42; + i128 divider = dividend; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxUi64ByEqual) { + i128 dividend = std::numeric_limits<ui64>::max(); + i128 divider = dividend; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxUi64Plus1ByEqual) { + i128 dividend = i128{std::numeric_limits<ui64>::max()} + i128{1}; + i128 divider = dividend; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxUi64Plus42ByEqual) { + i128 dividend = i128{std::numeric_limits<ui64>::max()} + i128{42}; + i128 divider = dividend; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxI128ByEqual) { + i128 dividend = std::numeric_limits<i128>::max(); + i128 divider = dividend; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxI128Minus1ByEqual) { + i128 dividend = std::numeric_limits<i128>::max() - 1; + i128 divider = dividend; + i128 expectedQuotient = 1; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } +} + +Y_UNIT_TEST_SUITE(I128DivisionLessByHigherSuite) { + Y_UNIT_TEST(I128Divide42By84) { + i128 dividend = 42; + i128 divider = 84; + i128 expectedQuotient = 0; + i128 expectedRemainder = 42; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128Divide42ByMaxUi64) { + i128 dividend = 42; + i128 divider = std::numeric_limits<ui64>::max(); + i128 expectedQuotient = 0; + i128 expectedRemainder = 42; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128Divide42ByMaxUi64Plus1) { + i128 dividend = 42; + i128 divider = i128{std::numeric_limits<ui64>::max()} + i128{1}; + i128 expectedQuotient = 0; + i128 expectedRemainder = 42; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(I128DivideMaxUi64ByMaxUi64Plus1) { + i128 dividend = i128{std::numeric_limits<ui64>::max()}; + i128 divider = i128{std::numeric_limits<ui64>::max()} + i128{1}; + i128 expectedQuotient = 0; + i128 expectedRemainder = i128{std::numeric_limits<ui64>::max()}; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } +} + +Y_UNIT_TEST_SUITE(I128DivisionWithDifferentSigns) { + Y_UNIT_TEST(DivisionPositiveByNegative) { + i128 dividend = i128{100}; + i128 divider = i128{-33}; + i128 expectedQuotient = -3; + i128 expectedRemainder = 1; + i128 quotient = dividend / divider; + i128 remainder = dividend % divider; + + UNIT_ASSERT_EQUAL(quotient, expectedQuotient); + UNIT_ASSERT_EQUAL(remainder, expectedRemainder); + } + + Y_UNIT_TEST(DivisionNegativeByPositive) { + i128 dividend = i128{-100}; + i128 divider = i128{33}; + i128 expectedQuotient = -3; + i128 expectedRemainder = -1; + i128 quotient = dividend / divider; + i128 remainder = dividend % divider; + + UNIT_ASSERT_EQUAL(quotient, expectedQuotient); + UNIT_ASSERT_EQUAL(remainder, expectedRemainder); + } + + Y_UNIT_TEST(DivisionNegativeByNegative) { + i128 dividend = i128{-100}; + i128 divider = i128{-33}; + i128 expectedQuotient = 3; + i128 expectedRemainder = -1; + i128 quotient = dividend / divider; + i128 remainder = dividend % divider; + + UNIT_ASSERT_EQUAL(quotient, expectedQuotient); + UNIT_ASSERT_EQUAL(remainder, expectedRemainder); + } +} + +Y_UNIT_TEST_SUITE(i128DivisionBigByBigSuite) { + Y_UNIT_TEST(i128DivideBigByBig1) { + i128 dividend = {64, 0}; + i128 divider = {1, 0}; + i128 expectedQuotient = 64; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(i128DivideBigByBig1_PosByNeg) { + i128 dividend = i128{64, 0}; + i128 divider = -i128{1, 0}; + i128 expectedQuotient = -i128{64}; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(i128DivideBigByBig1_NegByPos) { + i128 dividend = -i128{64, 0}; + i128 divider = i128{1, 0}; + i128 expectedQuotient = -i128{64}; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(i128DivideBigByBig1_NegByNeg) { + i128 dividend = -i128{64, 0}; + i128 divider = -i128{1, 0}; + i128 expectedQuotient = i128{64}; + i128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(i128DivideBigByBig2) { + i128 dividend = {64, 0}; + i128 divider = {12, 5}; + i128 expectedQuotient = 5; + i128 expectedRemainder = i128{3, 18446744073709551591ull}; // plz don't ask + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(i128DivideBigByBig2_PosByNeg) { + i128 dividend = i128{64, 0}; + i128 divider = -i128{12, 5}; + i128 expectedQuotient = -5; + i128 expectedRemainder = i128{3, 18446744073709551591ull}; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(i128DivideBigByBig2_NegByPos) { + i128 dividend = -i128{64, 0}; + i128 divider = i128{12, 5}; + i128 expectedQuotient = -5; + i128 expectedRemainder = -i128{3, 18446744073709551591ull}; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(i128DivideBigByBig2_NegByNeg) { + i128 dividend = -i128{64, 0}; + i128 divider = -i128{12, 5}; + i128 expectedQuotient = 5; + i128 expectedRemainder = -i128{3, 18446744073709551591ull}; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + +} + +Y_UNIT_TEST_SUITE(i128DivisionAlgo) { + Y_UNIT_TEST(ii128DivideAlgoCheck_PosByPos) { + /* + 49672666804009505000000 / 10000000 == 4967266680400950 + 49672666804009505000000 % 10000000 == 5000000 + */ + i128 dividend = {2692ull, 14031757583392049728ull}; + i64 divider = 10000000; + i128 expectedQuotient = {0, 4967266680400950ull}; + i128 expectedRemainder = {0, 5000000ull}; + + i128 quotient = dividend / divider; + i128 reminder = dividend % divider; + + UNIT_ASSERT_EQUAL(quotient, expectedQuotient); + UNIT_ASSERT_EQUAL(reminder, expectedRemainder); + } + + Y_UNIT_TEST(ii128DivideAlgoCheck_PosByNeg) { + /* + 49672666804009505000000 / -10000000 == -4967266680400950 + 49672666804009505000000 % -10000000 == 5000000 + */ + i128 dividend = {2692ull, 14031757583392049728ull}; + i64 divider = -10000000; + i128 expectedQuotient = -i128{0, 4967266680400950ull}; + i128 expectedRemainder = {0, 5000000ull}; + + i128 quotient = dividend / divider; + i128 reminder = dividend % divider; + + UNIT_ASSERT_EQUAL(quotient, expectedQuotient); + UNIT_ASSERT_EQUAL(reminder, expectedRemainder); + } + + Y_UNIT_TEST(ii128DivideAlgoCheck_NegByPos) { + /* + -49672666804009505000000 / 10000000 == -4967266680400950 + -49672666804009505000000 % 10000000 == -5000000 + */ + i128 dividend = -i128{2692ull, 14031757583392049728ull}; + i64 divider = 10000000; + i128 expectedQuotient = -i128{0, 4967266680400950ull}; + i128 expectedRemainder = -i128{0, 5000000ull}; + + i128 quotient = dividend / divider; + i128 reminder = dividend % divider; + + UNIT_ASSERT_EQUAL(quotient, expectedQuotient); + UNIT_ASSERT_EQUAL(reminder, expectedRemainder); + } + + Y_UNIT_TEST(ii128DivideAlgoCheck_NegByNeg) { + /* + -49672666804009505000000 / -10000000 == 4967266680400950 + -49672666804009505000000 % -10000000 == -5000000 + */ + i128 dividend = -i128{2692ull, 14031757583392049728ull}; + i64 divider = -10000000; + i128 expectedQuotient = {0, 4967266680400950ull}; + i128 expectedRemainder = -i128{0, 5000000ull}; + + i128 quotient = dividend / divider; + i128 reminder = dividend % divider; + + UNIT_ASSERT_EQUAL(quotient, expectedQuotient); + UNIT_ASSERT_EQUAL(reminder, expectedRemainder); + } + +} diff --git a/library/cpp/int128/ut/i128_type_traits_ut.cpp b/library/cpp/int128/ut/i128_type_traits_ut.cpp index 4ed87bf229e..87a49ad9850 100644 --- a/library/cpp/int128/ut/i128_type_traits_ut.cpp +++ b/library/cpp/int128/ut/i128_type_traits_ut.cpp @@ -1,68 +1,68 @@ #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/int128/int128.h> - -#include <util/generic/cast.h> - -Y_UNIT_TEST_SUITE(I128TypeTraitsSuite) { - Y_UNIT_TEST(OperatorNegate0) { - const i128 n = 0; - const i128 m = -n; - UNIT_ASSERT(n == m); - } - - Y_UNIT_TEST(OperatorNegate1) { - const i128 n = 1; - const i128 m = -n; - const i128 expected = -1; - UNIT_ASSERT(m == expected); - } - - Y_UNIT_TEST(OperatorNegate2Pow64) { - const i128 n = i128{1, 0}; - const i128 m = -n; - const i128 expected = {static_cast<ui64>(-1), 0}; - UNIT_ASSERT(m == expected); - } - - Y_UNIT_TEST(OperatorNegateNegate) { - const i128 x = 1; - const i128 y = -x; - const i128 z = -y; - UNIT_ASSERT(z == x); - } - - Y_UNIT_TEST(AbsFromPositive) { - const i128 n = 1; - const i128 m = std::abs(n); - UNIT_ASSERT(m == n); - } - - Y_UNIT_TEST(AbsFromNegative) { - const i128 n = -1; - const i128 m = std::abs(n); - const i128 expected = 1; - UNIT_ASSERT(m == expected); - } - - Y_UNIT_TEST(AbsFromZero) { - const i128 n = 0; - const i128 m = std::abs(n); - UNIT_ASSERT(m == n); - } - - Y_UNIT_TEST(SignbitOfPositive) { - const i128 n = 1; - UNIT_ASSERT(!std::signbit(n)); - } - - Y_UNIT_TEST(SignbitOfNegative) { - const i128 n = -1; - UNIT_ASSERT(std::signbit(n)); - } - - Y_UNIT_TEST(SignbitOfZero) { - const i128 n = 0; - UNIT_ASSERT(!std::signbit(n)); - } -} + +#include <util/generic/cast.h> + +Y_UNIT_TEST_SUITE(I128TypeTraitsSuite) { + Y_UNIT_TEST(OperatorNegate0) { + const i128 n = 0; + const i128 m = -n; + UNIT_ASSERT(n == m); + } + + Y_UNIT_TEST(OperatorNegate1) { + const i128 n = 1; + const i128 m = -n; + const i128 expected = -1; + UNIT_ASSERT(m == expected); + } + + Y_UNIT_TEST(OperatorNegate2Pow64) { + const i128 n = i128{1, 0}; + const i128 m = -n; + const i128 expected = {static_cast<ui64>(-1), 0}; + UNIT_ASSERT(m == expected); + } + + Y_UNIT_TEST(OperatorNegateNegate) { + const i128 x = 1; + const i128 y = -x; + const i128 z = -y; + UNIT_ASSERT(z == x); + } + + Y_UNIT_TEST(AbsFromPositive) { + const i128 n = 1; + const i128 m = std::abs(n); + UNIT_ASSERT(m == n); + } + + Y_UNIT_TEST(AbsFromNegative) { + const i128 n = -1; + const i128 m = std::abs(n); + const i128 expected = 1; + UNIT_ASSERT(m == expected); + } + + Y_UNIT_TEST(AbsFromZero) { + const i128 n = 0; + const i128 m = std::abs(n); + UNIT_ASSERT(m == n); + } + + Y_UNIT_TEST(SignbitOfPositive) { + const i128 n = 1; + UNIT_ASSERT(!std::signbit(n)); + } + + Y_UNIT_TEST(SignbitOfNegative) { + const i128 n = -1; + UNIT_ASSERT(std::signbit(n)); + } + + Y_UNIT_TEST(SignbitOfZero) { + const i128 n = 0; + UNIT_ASSERT(!std::signbit(n)); + } +} diff --git a/library/cpp/int128/ut/i128_ut.cpp b/library/cpp/int128/ut/i128_ut.cpp index c196d132a23..39408d4d375 100644 --- a/library/cpp/int128/ut/i128_ut.cpp +++ b/library/cpp/int128/ut/i128_ut.cpp @@ -1,12 +1,12 @@ #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/int128/int128.h> - -#include <util/generic/cast.h> - -Y_UNIT_TEST_SUITE(I128Suite) { - Y_UNIT_TEST(CreateI128FromUnsigned) { - i128 v{ui64(1)}; - Y_UNUSED(v); - } -} + +#include <util/generic/cast.h> + +Y_UNIT_TEST_SUITE(I128Suite) { + Y_UNIT_TEST(CreateI128FromUnsigned) { + i128 v{ui64(1)}; + Y_UNUSED(v); + } +} diff --git a/library/cpp/int128/ut/int128_old_ut.cpp b/library/cpp/int128/ut/int128_old_ut.cpp index 2c5b9e96108..e8dfbff5c2c 100644 --- a/library/cpp/int128/ut/int128_old_ut.cpp +++ b/library/cpp/int128/ut/int128_old_ut.cpp @@ -1,8 +1,8 @@ #include <library/cpp/testing/unittest/registar.h> #include <library/cpp/int128/int128.h> -#include "int128_ut_helpers.h" - +#include "int128_ut_helpers.h" + class TUInt128Test: public TTestBase { UNIT_TEST_SUITE(TUInt128Test); UNIT_TEST(Create); @@ -13,9 +13,9 @@ class TUInt128Test: public TTestBase { UNIT_TEST(Underflow); UNIT_TEST(ToStringTest); UNIT_TEST(FromStringTest); -#if defined(Y_HAVE_INT128) +#if defined(Y_HAVE_INT128) UNIT_TEST(FromSystemUint128); -#endif +#endif UNIT_TEST_SUITE_END(); private: @@ -25,30 +25,30 @@ private: void Shift(); void Overflow(); void Underflow(); - void ToStringTest(); - void FromStringTest(); -#if defined(Y_HAVE_INT128) - void FromSystemUint128(); -#endif + void ToStringTest(); + void FromStringTest(); +#if defined(Y_HAVE_INT128) + void FromSystemUint128(); +#endif }; UNIT_TEST_SUITE_REGISTRATION(TUInt128Test); void TUInt128Test::Create() { - const ui128 n1 = 10; + const ui128 n1 = 10; UNIT_ASSERT_EQUAL(n1, 10); - const ui128 n2 = n1; + const ui128 n2 = n1; UNIT_ASSERT_EQUAL(n2, 10); - const ui128 n3(10); + const ui128 n3(10); UNIT_ASSERT_EQUAL(n3, 10); } void TUInt128Test::Minus() { - const ui128 n2 = 20; - const ui128 n3 = 30; + const ui128 n2 = 20; + const ui128 n3 = 30; - ui128 n4 = n3 - n2; + ui128 n4 = n3 - n2; UNIT_ASSERT_EQUAL(n4, 10); n4 = n4 - 2; @@ -61,10 +61,10 @@ void TUInt128Test::Minus() { UNIT_ASSERT_EQUAL(n4, 4); } void TUInt128Test::Plus() { - const ui128 n2 = 20; - const ui128 n3 = 30; + const ui128 n2 = 20; + const ui128 n3 = 30; - ui128 n4 = n3 + n2; + ui128 n4 = n3 + n2; UNIT_ASSERT_EQUAL(n4, 50); n4 = n4 + 2; @@ -77,103 +77,103 @@ void TUInt128Test::Plus() { UNIT_ASSERT_EQUAL(n4, 64); } void TUInt128Test::Shift() { - ui128 n = 1; + ui128 n = 1; - const ui128 n4 = n << 4; - UNIT_ASSERT_EQUAL(n4, ui128(0x0, 0x0000000000000010)); + const ui128 n4 = n << 4; + UNIT_ASSERT_EQUAL(n4, ui128(0x0, 0x0000000000000010)); UNIT_ASSERT_EQUAL(n4 >> 4, 1); - const ui128 n8 = n << 8; - UNIT_ASSERT_EQUAL(n8, ui128(0x0, 0x0000000000000100)); + const ui128 n8 = n << 8; + UNIT_ASSERT_EQUAL(n8, ui128(0x0, 0x0000000000000100)); UNIT_ASSERT_EQUAL(n8 >> 8, 1); - const ui128 n60 = n << 60; - UNIT_ASSERT_EQUAL(n60, ui128(0x0, 0x1000000000000000)); + const ui128 n60 = n << 60; + UNIT_ASSERT_EQUAL(n60, ui128(0x0, 0x1000000000000000)); UNIT_ASSERT_EQUAL(n60 >> 60, 1); - const ui128 n64 = n << 64; - UNIT_ASSERT_EQUAL(n64, ui128(0x1, 0x0000000000000000)); + const ui128 n64 = n << 64; + UNIT_ASSERT_EQUAL(n64, ui128(0x1, 0x0000000000000000)); UNIT_ASSERT_EQUAL(n64 >> 64, 1); - const ui128 n124 = n << 124; - UNIT_ASSERT_EQUAL(n124, ui128(0x1000000000000000, 0x0000000000000000)); + const ui128 n124 = n << 124; + UNIT_ASSERT_EQUAL(n124, ui128(0x1000000000000000, 0x0000000000000000)); UNIT_ASSERT_EQUAL(n124 >> 124, 1); } void TUInt128Test::Overflow() { - ui128 n = ui128(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF); - const ui128 n2 = n + 2; + ui128 n = ui128(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF); + const ui128 n2 = n + 2; UNIT_ASSERT_EQUAL(n2, 1); } void TUInt128Test::Underflow() { - ui128 n = 1; - const ui128 n128 = n - 2; - UNIT_ASSERT_EQUAL(n128, ui128(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF)); -} - -void TUInt128Test::ToStringTest() { - ui128 n(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF); - TString correct = "340282366920938463463374607431768211455"; - UNIT_ASSERT_EQUAL(correct, ::ToString(n)); -} - -void TUInt128Test::FromStringTest() { - { - const TString originalString = "37778931862957161709568"; - const ui128 number = FromString<ui128>(originalString); - UNIT_ASSERT_EQUAL(ToString(number), originalString); - } - - { - const TString originalString = "1024"; - const ui128 number = FromString<ui128>(originalString); - UNIT_ASSERT_EQUAL(ToString(number), originalString); - UNIT_ASSERT_EQUAL(GetHigh(number), 0); - UNIT_ASSERT_EQUAL(GetLow(number), 1024); - } - - { - const TString originalString = "18446744073709551616"; // 2^64, i.e. UINT64_MAX + 1 - const ui128 number = FromString<ui128>(originalString); - UNIT_ASSERT_EQUAL(ToString(number), originalString); - UNIT_ASSERT_EQUAL(GetHigh(number), 1); - UNIT_ASSERT_EQUAL(GetLow(number), 0); - } - - { - const TString originalString = "340282366920938463463374607431768211455"; // 2^128-1, i.e. UINT128_MAX - const ui128 number = FromString<ui128>(originalString); - UNIT_ASSERT_EQUAL(ToString(number), originalString); - UNIT_ASSERT_EQUAL(GetHigh(number), 0xFFFFFFFFFFFFFFFF); - UNIT_ASSERT_EQUAL(GetLow(number), 0xFFFFFFFFFFFFFFFF); - } -} - -#if defined(Y_HAVE_INT128) -void TUInt128Test::FromSystemUint128() { - unsigned __int128 n = 1; - ui128 number{n}; - - UNIT_ASSERT_EQUAL(GetLow(number), 1); - UNIT_ASSERT_EQUAL(GetHigh(number), 0); - - auto byteArray = NInt128Private::GetAsArray(number); -#ifdef _little_endian_ - UNIT_ASSERT_EQUAL(byteArray[0], 1); - for (size_t i = 1; i < 16; i++) { - UNIT_ASSERT_EQUAL(byteArray[i], 0); - } -#elif defined(_big_endian_) - UNIT_ASSERT_EQUAL(byteArray[15], 1); - for (size_t i = 0; i < 15; i++) { - UNIT_ASSERT_EQUAL(byteArray[i], 0); - } -#endif - - UNIT_ASSERT_EQUAL(std::memcmp((void*)&n, (void*)&number, 16), 0); - - UNIT_ASSERT_EQUAL(ToString(n), "1"); - - UNIT_ASSERT_EQUAL(FromString<unsigned __int128>(ToString(n)), n); + ui128 n = 1; + const ui128 n128 = n - 2; + UNIT_ASSERT_EQUAL(n128, ui128(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF)); } -#endif + +void TUInt128Test::ToStringTest() { + ui128 n(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF); + TString correct = "340282366920938463463374607431768211455"; + UNIT_ASSERT_EQUAL(correct, ::ToString(n)); +} + +void TUInt128Test::FromStringTest() { + { + const TString originalString = "37778931862957161709568"; + const ui128 number = FromString<ui128>(originalString); + UNIT_ASSERT_EQUAL(ToString(number), originalString); + } + + { + const TString originalString = "1024"; + const ui128 number = FromString<ui128>(originalString); + UNIT_ASSERT_EQUAL(ToString(number), originalString); + UNIT_ASSERT_EQUAL(GetHigh(number), 0); + UNIT_ASSERT_EQUAL(GetLow(number), 1024); + } + + { + const TString originalString = "18446744073709551616"; // 2^64, i.e. UINT64_MAX + 1 + const ui128 number = FromString<ui128>(originalString); + UNIT_ASSERT_EQUAL(ToString(number), originalString); + UNIT_ASSERT_EQUAL(GetHigh(number), 1); + UNIT_ASSERT_EQUAL(GetLow(number), 0); + } + + { + const TString originalString = "340282366920938463463374607431768211455"; // 2^128-1, i.e. UINT128_MAX + const ui128 number = FromString<ui128>(originalString); + UNIT_ASSERT_EQUAL(ToString(number), originalString); + UNIT_ASSERT_EQUAL(GetHigh(number), 0xFFFFFFFFFFFFFFFF); + UNIT_ASSERT_EQUAL(GetLow(number), 0xFFFFFFFFFFFFFFFF); + } +} + +#if defined(Y_HAVE_INT128) +void TUInt128Test::FromSystemUint128() { + unsigned __int128 n = 1; + ui128 number{n}; + + UNIT_ASSERT_EQUAL(GetLow(number), 1); + UNIT_ASSERT_EQUAL(GetHigh(number), 0); + + auto byteArray = NInt128Private::GetAsArray(number); +#ifdef _little_endian_ + UNIT_ASSERT_EQUAL(byteArray[0], 1); + for (size_t i = 1; i < 16; i++) { + UNIT_ASSERT_EQUAL(byteArray[i], 0); + } +#elif defined(_big_endian_) + UNIT_ASSERT_EQUAL(byteArray[15], 1); + for (size_t i = 0; i < 15; i++) { + UNIT_ASSERT_EQUAL(byteArray[i], 0); + } +#endif + + UNIT_ASSERT_EQUAL(std::memcmp((void*)&n, (void*)&number, 16), 0); + + UNIT_ASSERT_EQUAL(ToString(n), "1"); + + UNIT_ASSERT_EQUAL(FromString<unsigned __int128>(ToString(n)), n); +} +#endif diff --git a/library/cpp/int128/ut/int128_typetraits_ut.cpp b/library/cpp/int128/ut/int128_typetraits_ut.cpp index fd5f19d7b85..32be581dd03 100644 --- a/library/cpp/int128/ut/int128_typetraits_ut.cpp +++ b/library/cpp/int128/ut/int128_typetraits_ut.cpp @@ -1,306 +1,306 @@ #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/int128/int128.h> - -#include <type_traits> - -Y_UNIT_TEST_SUITE(TypeTraitsSuite) { - Y_UNIT_TEST(Uint128TypeTraits) { - // checks that all type traits of ui128 are the same as of ui64 - // https://en.cppreference.com/w/cpp/header/type_traits - UNIT_ASSERT_EQUAL( - std::is_void<ui128>::value, - std::is_void<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_null_pointer<ui128>::value, - std::is_null_pointer<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_integral<ui128>::value, - std::is_integral<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_floating_point<ui128>::value, - std::is_floating_point<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_array<ui128>::value, - std::is_array<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_enum<ui128>::value, - std::is_enum<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_union<ui128>::value, - std::is_union<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_class<ui128>::value, - std::is_class<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_function<ui128>::value, - std::is_function<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_pointer<ui128>::value, - std::is_pointer<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_lvalue_reference<ui128>::value, - std::is_lvalue_reference<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_rvalue_reference<ui128>::value, - std::is_rvalue_reference<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_member_object_pointer<ui128>::value, - std::is_member_object_pointer<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_member_function_pointer<ui128>::value, - std::is_member_function_pointer<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_fundamental<ui128>::value, - std::is_fundamental<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_arithmetic<ui128>::value, - std::is_arithmetic<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_scalar<ui128>::value, - std::is_scalar<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_object<ui128>::value, - std::is_object<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_compound<ui128>::value, - std::is_compound<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_reference<ui128>::value, - std::is_reference<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_member_pointer<ui128>::value, - std::is_member_pointer<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_const<ui128>::value, - std::is_const<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_volatile<ui128>::value, - std::is_volatile<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_trivial<ui128>::value, - std::is_trivial<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_standard_layout<ui128>::value, - std::is_standard_layout<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_pod<ui128>::value, - std::is_pod<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_literal_type<ui128>::value, - std::is_literal_type<ui64>::value - ); -#ifndef _MSC_VER - UNIT_ASSERT_EQUAL( - std::has_unique_object_representations<ui128>::value, - std::has_unique_object_representations<ui64>::value - ); -#endif - UNIT_ASSERT_EQUAL( - std::is_empty<ui128>::value, - std::is_empty<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_polymorphic<ui128>::value, - std::is_polymorphic<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_abstract<ui128>::value, - std::is_abstract<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_final<ui128>::value, - std::is_final<ui64>::value - ); -#ifndef _MSC_VER - UNIT_ASSERT_EQUAL( - std::is_aggregate<ui128>::value, - std::is_aggregate<ui64>::value - ); -#endif - UNIT_ASSERT_EQUAL( - std::is_signed<ui128>::value, - std::is_signed<ui64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_unsigned<ui128>::value, - std::is_unsigned<ui64>::value - ); - } - - Y_UNIT_TEST(Int128TypeTraits) { - // checks that all type traits of i128 are the same as of i64 - // https://en.cppreference.com/w/cpp/header/type_traits - UNIT_ASSERT_EQUAL( - std::is_void<i128>::value, - std::is_void<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_null_pointer<i128>::value, - std::is_null_pointer<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_integral<i128>::value, - std::is_integral<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_floating_point<i128>::value, - std::is_floating_point<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_array<i128>::value, - std::is_array<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_enum<i128>::value, - std::is_enum<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_union<i128>::value, - std::is_union<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_class<i128>::value, - std::is_class<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_function<i128>::value, - std::is_function<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_pointer<i128>::value, - std::is_pointer<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_lvalue_reference<i128>::value, - std::is_lvalue_reference<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_rvalue_reference<i128>::value, - std::is_rvalue_reference<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_member_object_pointer<i128>::value, - std::is_member_object_pointer<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_member_function_pointer<i128>::value, - std::is_member_function_pointer<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_fundamental<i128>::value, - std::is_fundamental<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_arithmetic<i128>::value, - std::is_arithmetic<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_scalar<i128>::value, - std::is_scalar<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_object<i128>::value, - std::is_object<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_compound<i128>::value, - std::is_compound<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_reference<i128>::value, - std::is_reference<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_member_pointer<i128>::value, - std::is_member_pointer<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_const<i128>::value, - std::is_const<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_volatile<i128>::value, - std::is_volatile<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_trivial<i128>::value, - std::is_trivial<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_standard_layout<i128>::value, - std::is_standard_layout<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_pod<i128>::value, - std::is_pod<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_literal_type<i128>::value, - std::is_literal_type<i64>::value - ); -#ifndef _MSC_VER - UNIT_ASSERT_EQUAL( - std::has_unique_object_representations<i128>::value, - std::has_unique_object_representations<i64>::value - ); -#endif - UNIT_ASSERT_EQUAL( - std::is_empty<i128>::value, - std::is_empty<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_polymorphic<i128>::value, - std::is_polymorphic<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_abstract<i128>::value, - std::is_abstract<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_final<i128>::value, - std::is_final<i64>::value - ); -#ifndef _MSC_VER - UNIT_ASSERT_EQUAL( - std::is_aggregate<i128>::value, - std::is_aggregate<i64>::value - ); -#endif - UNIT_ASSERT_EQUAL( - std::is_signed<i128>::value, - std::is_signed<i64>::value - ); - UNIT_ASSERT_EQUAL( - std::is_unsigned<i128>::value, - std::is_unsigned<i64>::value - ); - } -} - + +#include <type_traits> + +Y_UNIT_TEST_SUITE(TypeTraitsSuite) { + Y_UNIT_TEST(Uint128TypeTraits) { + // checks that all type traits of ui128 are the same as of ui64 + // https://en.cppreference.com/w/cpp/header/type_traits + UNIT_ASSERT_EQUAL( + std::is_void<ui128>::value, + std::is_void<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_null_pointer<ui128>::value, + std::is_null_pointer<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_integral<ui128>::value, + std::is_integral<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_floating_point<ui128>::value, + std::is_floating_point<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_array<ui128>::value, + std::is_array<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_enum<ui128>::value, + std::is_enum<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_union<ui128>::value, + std::is_union<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_class<ui128>::value, + std::is_class<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_function<ui128>::value, + std::is_function<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_pointer<ui128>::value, + std::is_pointer<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_lvalue_reference<ui128>::value, + std::is_lvalue_reference<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_rvalue_reference<ui128>::value, + std::is_rvalue_reference<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_member_object_pointer<ui128>::value, + std::is_member_object_pointer<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_member_function_pointer<ui128>::value, + std::is_member_function_pointer<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_fundamental<ui128>::value, + std::is_fundamental<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_arithmetic<ui128>::value, + std::is_arithmetic<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_scalar<ui128>::value, + std::is_scalar<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_object<ui128>::value, + std::is_object<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_compound<ui128>::value, + std::is_compound<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_reference<ui128>::value, + std::is_reference<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_member_pointer<ui128>::value, + std::is_member_pointer<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_const<ui128>::value, + std::is_const<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_volatile<ui128>::value, + std::is_volatile<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_trivial<ui128>::value, + std::is_trivial<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_standard_layout<ui128>::value, + std::is_standard_layout<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_pod<ui128>::value, + std::is_pod<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_literal_type<ui128>::value, + std::is_literal_type<ui64>::value + ); +#ifndef _MSC_VER + UNIT_ASSERT_EQUAL( + std::has_unique_object_representations<ui128>::value, + std::has_unique_object_representations<ui64>::value + ); +#endif + UNIT_ASSERT_EQUAL( + std::is_empty<ui128>::value, + std::is_empty<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_polymorphic<ui128>::value, + std::is_polymorphic<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_abstract<ui128>::value, + std::is_abstract<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_final<ui128>::value, + std::is_final<ui64>::value + ); +#ifndef _MSC_VER + UNIT_ASSERT_EQUAL( + std::is_aggregate<ui128>::value, + std::is_aggregate<ui64>::value + ); +#endif + UNIT_ASSERT_EQUAL( + std::is_signed<ui128>::value, + std::is_signed<ui64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_unsigned<ui128>::value, + std::is_unsigned<ui64>::value + ); + } + + Y_UNIT_TEST(Int128TypeTraits) { + // checks that all type traits of i128 are the same as of i64 + // https://en.cppreference.com/w/cpp/header/type_traits + UNIT_ASSERT_EQUAL( + std::is_void<i128>::value, + std::is_void<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_null_pointer<i128>::value, + std::is_null_pointer<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_integral<i128>::value, + std::is_integral<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_floating_point<i128>::value, + std::is_floating_point<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_array<i128>::value, + std::is_array<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_enum<i128>::value, + std::is_enum<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_union<i128>::value, + std::is_union<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_class<i128>::value, + std::is_class<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_function<i128>::value, + std::is_function<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_pointer<i128>::value, + std::is_pointer<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_lvalue_reference<i128>::value, + std::is_lvalue_reference<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_rvalue_reference<i128>::value, + std::is_rvalue_reference<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_member_object_pointer<i128>::value, + std::is_member_object_pointer<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_member_function_pointer<i128>::value, + std::is_member_function_pointer<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_fundamental<i128>::value, + std::is_fundamental<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_arithmetic<i128>::value, + std::is_arithmetic<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_scalar<i128>::value, + std::is_scalar<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_object<i128>::value, + std::is_object<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_compound<i128>::value, + std::is_compound<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_reference<i128>::value, + std::is_reference<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_member_pointer<i128>::value, + std::is_member_pointer<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_const<i128>::value, + std::is_const<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_volatile<i128>::value, + std::is_volatile<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_trivial<i128>::value, + std::is_trivial<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_standard_layout<i128>::value, + std::is_standard_layout<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_pod<i128>::value, + std::is_pod<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_literal_type<i128>::value, + std::is_literal_type<i64>::value + ); +#ifndef _MSC_VER + UNIT_ASSERT_EQUAL( + std::has_unique_object_representations<i128>::value, + std::has_unique_object_representations<i64>::value + ); +#endif + UNIT_ASSERT_EQUAL( + std::is_empty<i128>::value, + std::is_empty<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_polymorphic<i128>::value, + std::is_polymorphic<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_abstract<i128>::value, + std::is_abstract<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_final<i128>::value, + std::is_final<i64>::value + ); +#ifndef _MSC_VER + UNIT_ASSERT_EQUAL( + std::is_aggregate<i128>::value, + std::is_aggregate<i64>::value + ); +#endif + UNIT_ASSERT_EQUAL( + std::is_signed<i128>::value, + std::is_signed<i64>::value + ); + UNIT_ASSERT_EQUAL( + std::is_unsigned<i128>::value, + std::is_unsigned<i64>::value + ); + } +} + diff --git a/library/cpp/int128/ut/int128_ut.cpp b/library/cpp/int128/ut/int128_ut.cpp index 73392640175..0d68e421002 100644 --- a/library/cpp/int128/ut/int128_ut.cpp +++ b/library/cpp/int128/ut/int128_ut.cpp @@ -1,56 +1,56 @@ #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/int128/int128.h> - -#include <util/generic/cast.h> - -#include <type_traits> - -Y_UNIT_TEST_SUITE(Uint128Suite) { - Y_UNIT_TEST(Uint128DefaultCtor) { - const ui128 value{}; - UNIT_ASSERT_EQUAL(GetLow(value), 0); - UNIT_ASSERT_EQUAL(GetHigh(value), 0); - } - - Y_UNIT_TEST(Uint128NumericLimits) { - UNIT_ASSERT_EQUAL(std::numeric_limits<ui128>::digits, 128); - UNIT_ASSERT_EQUAL(std::numeric_limits<ui128>::max() + 1, ui128{0}); - } - - Y_UNIT_TEST(Uint128Sizeof) { - UNIT_ASSERT_EQUAL(sizeof(ui128), sizeof(ui64) * 2); - } - - Y_UNIT_TEST(Uint128Cast) { - // see util/generic/cast.h - const auto underlyingTypeIsSelf = std::is_same<::NPrivate::TUnderlyingTypeOrSelf<ui128>, ui128>::value; - UNIT_ASSERT_EQUAL(underlyingTypeIsSelf, true); - - const auto convertibleUi128Ui128 = ::NPrivate::TSafelyConvertible<ui128, ui128>::Result; - const auto convertibleUi64Ui128 = ::NPrivate::TSafelyConvertible<ui64, ui128>::Result; - const auto convertibleUi128Ui64 = ::NPrivate::TSafelyConvertible<ui128, ui64>::Result; - UNIT_ASSERT_EQUAL(convertibleUi128Ui128, true); // from ui128 to ui128 => safe - UNIT_ASSERT_EQUAL(convertibleUi64Ui128, false); // from ui128 to ui64 => not safe - UNIT_ASSERT_EQUAL(convertibleUi128Ui64, true); // from ui64 to ui128 => safe - } - - Y_UNIT_TEST(SafeIntegerCastTest) { - ui128 narrowNumber = 1; - - UNIT_ASSERT_NO_EXCEPTION(SafeIntegerCast<ui64>(narrowNumber)); - - ui128 wideNumber{0}; - wideNumber -= 1; - UNIT_ASSERT_EXCEPTION(SafeIntegerCast<ui64>(wideNumber), yexception); - } - - Y_UNIT_TEST(SignbitTest) { - UNIT_ASSERT(!std::signbit(ui128{0})); - UNIT_ASSERT(!std::signbit(ui128{-1})); - UNIT_ASSERT(!std::signbit(i128{0})); - UNIT_ASSERT(std::signbit(i128{-1})); - } + +#include <util/generic/cast.h> + +#include <type_traits> + +Y_UNIT_TEST_SUITE(Uint128Suite) { + Y_UNIT_TEST(Uint128DefaultCtor) { + const ui128 value{}; + UNIT_ASSERT_EQUAL(GetLow(value), 0); + UNIT_ASSERT_EQUAL(GetHigh(value), 0); + } + + Y_UNIT_TEST(Uint128NumericLimits) { + UNIT_ASSERT_EQUAL(std::numeric_limits<ui128>::digits, 128); + UNIT_ASSERT_EQUAL(std::numeric_limits<ui128>::max() + 1, ui128{0}); + } + + Y_UNIT_TEST(Uint128Sizeof) { + UNIT_ASSERT_EQUAL(sizeof(ui128), sizeof(ui64) * 2); + } + + Y_UNIT_TEST(Uint128Cast) { + // see util/generic/cast.h + const auto underlyingTypeIsSelf = std::is_same<::NPrivate::TUnderlyingTypeOrSelf<ui128>, ui128>::value; + UNIT_ASSERT_EQUAL(underlyingTypeIsSelf, true); + + const auto convertibleUi128Ui128 = ::NPrivate::TSafelyConvertible<ui128, ui128>::Result; + const auto convertibleUi64Ui128 = ::NPrivate::TSafelyConvertible<ui64, ui128>::Result; + const auto convertibleUi128Ui64 = ::NPrivate::TSafelyConvertible<ui128, ui64>::Result; + UNIT_ASSERT_EQUAL(convertibleUi128Ui128, true); // from ui128 to ui128 => safe + UNIT_ASSERT_EQUAL(convertibleUi64Ui128, false); // from ui128 to ui64 => not safe + UNIT_ASSERT_EQUAL(convertibleUi128Ui64, true); // from ui64 to ui128 => safe + } + + Y_UNIT_TEST(SafeIntegerCastTest) { + ui128 narrowNumber = 1; + + UNIT_ASSERT_NO_EXCEPTION(SafeIntegerCast<ui64>(narrowNumber)); + + ui128 wideNumber{0}; + wideNumber -= 1; + UNIT_ASSERT_EXCEPTION(SafeIntegerCast<ui64>(wideNumber), yexception); + } + + Y_UNIT_TEST(SignbitTest) { + UNIT_ASSERT(!std::signbit(ui128{0})); + UNIT_ASSERT(!std::signbit(ui128{-1})); + UNIT_ASSERT(!std::signbit(i128{0})); + UNIT_ASSERT(std::signbit(i128{-1})); + } Y_UNIT_TEST(ToStringTest) { // int128 @@ -80,4 +80,4 @@ Y_UNIT_TEST_SUITE(Uint128Suite) { ), "235108557486403940296800289353599800327"); } -} +} diff --git a/library/cpp/int128/ut/int128_ut_helpers.cpp b/library/cpp/int128/ut/int128_ut_helpers.cpp index e6c3e24d106..cb712f869ac 100644 --- a/library/cpp/int128/ut/int128_ut_helpers.cpp +++ b/library/cpp/int128/ut/int128_ut_helpers.cpp @@ -1,56 +1,56 @@ -#include "int128_ut_helpers.h" - -namespace NInt128Private { -#if defined(_little_endian_) - std::array<ui8, 16> GetAsArray(const ui128 value) { - std::array<ui8, 16> result; - const ui64 low = GetLow(value); - const ui64 high = GetHigh(value); - MemCopy(result.data(), reinterpret_cast<const ui8*>(&low), sizeof(low)); - MemCopy(result.data() + sizeof(low), reinterpret_cast<const ui8*>(&high), sizeof(high)); - return result; - } - - std::array<ui8, 16> GetAsArray(const i128 value) { - std::array<ui8, 16> result; - const ui64 low = GetLow(value); - const ui64 high = GetHigh(value); - MemCopy(result.data(), reinterpret_cast<const ui8*>(&low), sizeof(low)); - MemCopy(result.data() + sizeof(low), reinterpret_cast<const ui8*>(&high), sizeof(high)); - return result; - } -#elif defined(_big_endian_) - std::array<ui8, 16> GetAsArray(const i128 value) { - std::array<ui8, 16> result; - const ui64 low = GetLow(value); - const ui64 high = GetHigh(value); - MemCopy(result.data(), reinterpret_cast<const ui8*>(&high), sizeof(high)); - MemCopy(result.data() + sizeof(high), reinterpret_cast<const ui8*>(&low), sizeof(low)); - return result; - } - - std::array<ui8, 16> GetAsArray(const ui128 value) { - std::array<ui8, 16> result; - const ui64 low = GetLow(value); - const ui64 high = GetHigh(value); - MemCopy(result.data(), reinterpret_cast<const ui8*>(&high), sizeof(high)); - MemCopy(result.data() + sizeof(high), reinterpret_cast<const ui8*>(&low), sizeof(low)); - return result; - } -#endif - -#if defined(Y_HAVE_INT128) - std::array<ui8, 16> GetAsArray(const unsigned __int128 value) { - std::array<ui8, 16> result; - MemCopy(result.data(), reinterpret_cast<const ui8*>(&value), sizeof(value)); - return result; - } - - std::array<ui8, 16> GetAsArray(const signed __int128 value) { - std::array<ui8, 16> result; - MemCopy(result.data(), reinterpret_cast<const ui8*>(&value), sizeof(value)); - return result; - } -#endif - -} +#include "int128_ut_helpers.h" + +namespace NInt128Private { +#if defined(_little_endian_) + std::array<ui8, 16> GetAsArray(const ui128 value) { + std::array<ui8, 16> result; + const ui64 low = GetLow(value); + const ui64 high = GetHigh(value); + MemCopy(result.data(), reinterpret_cast<const ui8*>(&low), sizeof(low)); + MemCopy(result.data() + sizeof(low), reinterpret_cast<const ui8*>(&high), sizeof(high)); + return result; + } + + std::array<ui8, 16> GetAsArray(const i128 value) { + std::array<ui8, 16> result; + const ui64 low = GetLow(value); + const ui64 high = GetHigh(value); + MemCopy(result.data(), reinterpret_cast<const ui8*>(&low), sizeof(low)); + MemCopy(result.data() + sizeof(low), reinterpret_cast<const ui8*>(&high), sizeof(high)); + return result; + } +#elif defined(_big_endian_) + std::array<ui8, 16> GetAsArray(const i128 value) { + std::array<ui8, 16> result; + const ui64 low = GetLow(value); + const ui64 high = GetHigh(value); + MemCopy(result.data(), reinterpret_cast<const ui8*>(&high), sizeof(high)); + MemCopy(result.data() + sizeof(high), reinterpret_cast<const ui8*>(&low), sizeof(low)); + return result; + } + + std::array<ui8, 16> GetAsArray(const ui128 value) { + std::array<ui8, 16> result; + const ui64 low = GetLow(value); + const ui64 high = GetHigh(value); + MemCopy(result.data(), reinterpret_cast<const ui8*>(&high), sizeof(high)); + MemCopy(result.data() + sizeof(high), reinterpret_cast<const ui8*>(&low), sizeof(low)); + return result; + } +#endif + +#if defined(Y_HAVE_INT128) + std::array<ui8, 16> GetAsArray(const unsigned __int128 value) { + std::array<ui8, 16> result; + MemCopy(result.data(), reinterpret_cast<const ui8*>(&value), sizeof(value)); + return result; + } + + std::array<ui8, 16> GetAsArray(const signed __int128 value) { + std::array<ui8, 16> result; + MemCopy(result.data(), reinterpret_cast<const ui8*>(&value), sizeof(value)); + return result; + } +#endif + +} diff --git a/library/cpp/int128/ut/int128_ut_helpers.h b/library/cpp/int128/ut/int128_ut_helpers.h index b7778c3f328..99a8fa74362 100644 --- a/library/cpp/int128/ut/int128_ut_helpers.h +++ b/library/cpp/int128/ut/int128_ut_helpers.h @@ -1,15 +1,15 @@ -#pragma once - +#pragma once + #include <library/cpp/int128/int128.h> - -#include <array> - -namespace NInt128Private { - std::array<ui8, 16> GetAsArray(const ui128 value); - std::array<ui8, 16> GetAsArray(const i128 value); - -#if defined(Y_HAVE_INT128) - std::array<ui8, 16> GetAsArray(const unsigned __int128 value); - std::array<ui8, 16> GetAsArray(const signed __int128 value); -#endif -} + +#include <array> + +namespace NInt128Private { + std::array<ui8, 16> GetAsArray(const ui128 value); + std::array<ui8, 16> GetAsArray(const i128 value); + +#if defined(Y_HAVE_INT128) + std::array<ui8, 16> GetAsArray(const unsigned __int128 value); + std::array<ui8, 16> GetAsArray(const signed __int128 value); +#endif +} diff --git a/library/cpp/int128/ut/int128_via_intrinsic_ut.cpp b/library/cpp/int128/ut/int128_via_intrinsic_ut.cpp index 9decc2fd482..e1eff5fcb3c 100644 --- a/library/cpp/int128/ut/int128_via_intrinsic_ut.cpp +++ b/library/cpp/int128/ut/int128_via_intrinsic_ut.cpp @@ -2,33 +2,33 @@ #include <library/cpp/testing/unittest/registar.h> -// from https://a.yandex-team.ru/arc/trunk/arcadia/library/ticket_parser/c/src/ut/utils_ut.cpp?rev=4221861 +// from https://a.yandex-team.ru/arc/trunk/arcadia/library/ticket_parser/c/src/ut/utils_ut.cpp?rev=4221861 -#if defined(Y_HAVE_INT128) -Y_UNIT_TEST_SUITE(Int128ViaIntrinsicSuite) { +#if defined(Y_HAVE_INT128) +Y_UNIT_TEST_SUITE(Int128ViaIntrinsicSuite) { using guint128_t = unsigned __int128; - guint128_t toGcc(ui128 num) { + guint128_t toGcc(ui128 num) { guint128_t res = 0; - res |= GetLow(num); - res |= guint128_t(GetHigh(num)) << 64; + res |= GetLow(num); + res |= guint128_t(GetHigh(num)) << 64; return res; } Y_UNIT_TEST(bigintTest) { - UNIT_ASSERT(guint128_t(127) == toGcc(ui128(127))); - UNIT_ASSERT(guint128_t(127) * guint128_t(127) == toGcc(ui128(127) * ui128(127))); - UNIT_ASSERT(guint128_t(127) + guint128_t(127) == toGcc(ui128(127) + ui128(127))); - UNIT_ASSERT(guint128_t(127) << 3 == toGcc(ui128(127) << 3)); - UNIT_ASSERT(guint128_t(127) >> 1 == toGcc(ui128(127) >> 1)); + UNIT_ASSERT(guint128_t(127) == toGcc(ui128(127))); + UNIT_ASSERT(guint128_t(127) * guint128_t(127) == toGcc(ui128(127) * ui128(127))); + UNIT_ASSERT(guint128_t(127) + guint128_t(127) == toGcc(ui128(127) + ui128(127))); + UNIT_ASSERT(guint128_t(127) << 3 == toGcc(ui128(127) << 3)); + UNIT_ASSERT(guint128_t(127) >> 1 == toGcc(ui128(127) >> 1)); - UNIT_ASSERT(guint128_t(1000000000027UL) * guint128_t(1000000000027UL) == toGcc(ui128(1000000000027UL) * ui128(1000000000027UL))); - UNIT_ASSERT(guint128_t(1000000000027UL) + guint128_t(1000000000027UL) == toGcc(ui128(1000000000027UL) + ui128(1000000000027UL))); - UNIT_ASSERT(guint128_t(1000000000027UL) << 3 == toGcc(ui128(1000000000027UL) << 3)); - UNIT_ASSERT(guint128_t(1000000000027UL) >> 1 == toGcc(ui128(1000000000027UL) >> 1)); - UNIT_ASSERT((guint128_t(1000000000027UL) * guint128_t(1000000000027UL)) << 3 == toGcc((ui128(1000000000027UL) * ui128(1000000000027UL)) << 3)); - UNIT_ASSERT((guint128_t(1000000000027UL) + guint128_t(1000000000027UL)) >> 1 == toGcc((ui128(1000000000027UL) + ui128(1000000000027UL)) >> 1)); + UNIT_ASSERT(guint128_t(1000000000027UL) * guint128_t(1000000000027UL) == toGcc(ui128(1000000000027UL) * ui128(1000000000027UL))); + UNIT_ASSERT(guint128_t(1000000000027UL) + guint128_t(1000000000027UL) == toGcc(ui128(1000000000027UL) + ui128(1000000000027UL))); + UNIT_ASSERT(guint128_t(1000000000027UL) << 3 == toGcc(ui128(1000000000027UL) << 3)); + UNIT_ASSERT(guint128_t(1000000000027UL) >> 1 == toGcc(ui128(1000000000027UL) >> 1)); + UNIT_ASSERT((guint128_t(1000000000027UL) * guint128_t(1000000000027UL)) << 3 == toGcc((ui128(1000000000027UL) * ui128(1000000000027UL)) << 3)); + UNIT_ASSERT((guint128_t(1000000000027UL) + guint128_t(1000000000027UL)) >> 1 == toGcc((ui128(1000000000027UL) + ui128(1000000000027UL)) >> 1)); - UNIT_ASSERT((ui64)(guint128_t(1000000000027UL) * guint128_t(1000000000027UL)) == GetLow(ui128(1000000000027UL) * ui128(1000000000027UL))); + UNIT_ASSERT((ui64)(guint128_t(1000000000027UL) * guint128_t(1000000000027UL)) == GetLow(ui128(1000000000027UL) * ui128(1000000000027UL))); } } -#endif +#endif diff --git a/library/cpp/int128/ut/ui128_division_ut.cpp b/library/cpp/int128/ut/ui128_division_ut.cpp index 4826a531e0c..488738d4291 100644 --- a/library/cpp/int128/ut/ui128_division_ut.cpp +++ b/library/cpp/int128/ut/ui128_division_ut.cpp @@ -1,262 +1,262 @@ #include <library/cpp/testing/unittest/registar.h> - + #include <library/cpp/int128/int128.h> - -#include <util/generic/cast.h> - -Y_UNIT_TEST_SUITE(Ui128DivisionBy1Suite) { - Y_UNIT_TEST(Ui128Divide0By1) { - ui128 dividend = 0; - ui128 divider = 1; - ui128 expectedQuotient = 0; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128Divide1By1) { - ui128 dividend = 1; - ui128 divider = 1; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128Divide2By1) { - ui128 dividend = 2; - ui128 divider = 1; - ui128 expectedQuotient = 2; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128Divide42By1) { - ui128 dividend = 42; - ui128 divider = 1; - ui128 expectedQuotient = 42; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi64By1) { - ui128 dividend = std::numeric_limits<ui64>::max(); - ui128 divider = 1; - ui128 expectedQuotient = std::numeric_limits<ui64>::max(); - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi64Plus1By1) { - ui128 dividend = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; - ui128 divider = 1; - ui128 expectedQuotient = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi64Plus42By1) { - ui128 dividend = ui128{std::numeric_limits<ui64>::max()} + ui128{42}; - ui128 divider = 1; - ui128 expectedQuotient = ui128{std::numeric_limits<ui64>::max()} + ui128{42}; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi128By1) { - ui128 dividend = std::numeric_limits<ui128>::max(); - ui128 divider = 1; - ui128 expectedQuotient = std::numeric_limits<ui128>::max(); - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi128Minus1By1) { - ui128 dividend = std::numeric_limits<ui128>::max() - 1; - ui128 divider = 1; - ui128 expectedQuotient = std::numeric_limits<ui128>::max() - 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } -} - -Y_UNIT_TEST_SUITE(Ui128DivisionByEqualSuite) { - Y_UNIT_TEST(Ui128Divide1ByEqual) { - ui128 dividend = 1; - ui128 divider = dividend; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128Divide2ByEqual) { - ui128 dividend = 2; - ui128 divider = dividend; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128Divide42ByEqual) { - ui128 dividend = 42; - ui128 divider = dividend; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi64ByEqual) { - ui128 dividend = std::numeric_limits<ui64>::max(); - ui128 divider = dividend; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi64Plus1ByEqual) { - ui128 dividend = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; - ui128 divider = dividend; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi64Plus42ByEqual) { - ui128 dividend = ui128{std::numeric_limits<ui64>::max()} + ui128{42}; - ui128 divider = dividend; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi128ByEqual) { - ui128 dividend = std::numeric_limits<ui128>::max(); - ui128 divider = dividend; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi128Minus1ByEqual) { - ui128 dividend = std::numeric_limits<ui128>::max() - 1; - ui128 divider = dividend; - ui128 expectedQuotient = 1; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } -} - -Y_UNIT_TEST_SUITE(Ui128DivisionLessByHigherSuite) { - Y_UNIT_TEST(Ui128Divide42By84) { - ui128 dividend = 42; - ui128 divider = 84; - ui128 expectedQuotient = 0; - ui128 expectedRemainder = 42; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128Divide42ByMaxUi64) { - ui128 dividend = 42; - ui128 divider = std::numeric_limits<ui64>::max(); - ui128 expectedQuotient = 0; - ui128 expectedRemainder = 42; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128Divide42ByMaxUi64Plus1) { - ui128 dividend = 42; - ui128 divider = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; - ui128 expectedQuotient = 0; - ui128 expectedRemainder = 42; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideMaxUi64ByMaxUi64Plus1) { - ui128 dividend = ui128{std::numeric_limits<ui64>::max()}; - ui128 divider = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; - ui128 expectedQuotient = 0; - ui128 expectedRemainder = ui128{std::numeric_limits<ui64>::max()}; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } -} - -Y_UNIT_TEST_SUITE(Ui128DivisionBigByBigSuite) { - Y_UNIT_TEST(Ui128DivideBigByBig1) { - ui128 dividend = {64, 0}; - ui128 divider = {1, 0}; - ui128 expectedQuotient = 64; - ui128 expectedRemainder = 0; - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } - - Y_UNIT_TEST(Ui128DivideBigByBig2) { - ui128 dividend = {64, 0}; - ui128 divider = {12, 5}; - ui128 expectedQuotient = 5; - ui128 expectedRemainder = ui128{3, 18446744073709551591ull}; // plz don't ask - - UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); - UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); - } -} - -Y_UNIT_TEST_SUITE(Ui128DivisionAlgo) { - Y_UNIT_TEST(Ui128DivideAlgoCheck) { - /* - 49672666804009505000000 / 10000000 == 4967266680400950 - 49672666804009505000000 % 10000000 == 5000000 - */ - ui128 dividend = {2692ull, 14031757583392049728ull}; - ui64 divider = 10000000; - ui128 expectedQuotient = {0, 4967266680400950ull}; - ui128 expectedRemainder = {0, 5000000ull}; - - ui128 quotient = dividend / divider; - ui128 reminder = dividend % divider; - - UNIT_ASSERT_EQUAL(quotient, expectedQuotient); - UNIT_ASSERT_EQUAL(reminder, expectedRemainder); - } -} + +#include <util/generic/cast.h> + +Y_UNIT_TEST_SUITE(Ui128DivisionBy1Suite) { + Y_UNIT_TEST(Ui128Divide0By1) { + ui128 dividend = 0; + ui128 divider = 1; + ui128 expectedQuotient = 0; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128Divide1By1) { + ui128 dividend = 1; + ui128 divider = 1; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128Divide2By1) { + ui128 dividend = 2; + ui128 divider = 1; + ui128 expectedQuotient = 2; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128Divide42By1) { + ui128 dividend = 42; + ui128 divider = 1; + ui128 expectedQuotient = 42; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi64By1) { + ui128 dividend = std::numeric_limits<ui64>::max(); + ui128 divider = 1; + ui128 expectedQuotient = std::numeric_limits<ui64>::max(); + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi64Plus1By1) { + ui128 dividend = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; + ui128 divider = 1; + ui128 expectedQuotient = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi64Plus42By1) { + ui128 dividend = ui128{std::numeric_limits<ui64>::max()} + ui128{42}; + ui128 divider = 1; + ui128 expectedQuotient = ui128{std::numeric_limits<ui64>::max()} + ui128{42}; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi128By1) { + ui128 dividend = std::numeric_limits<ui128>::max(); + ui128 divider = 1; + ui128 expectedQuotient = std::numeric_limits<ui128>::max(); + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi128Minus1By1) { + ui128 dividend = std::numeric_limits<ui128>::max() - 1; + ui128 divider = 1; + ui128 expectedQuotient = std::numeric_limits<ui128>::max() - 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } +} + +Y_UNIT_TEST_SUITE(Ui128DivisionByEqualSuite) { + Y_UNIT_TEST(Ui128Divide1ByEqual) { + ui128 dividend = 1; + ui128 divider = dividend; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128Divide2ByEqual) { + ui128 dividend = 2; + ui128 divider = dividend; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128Divide42ByEqual) { + ui128 dividend = 42; + ui128 divider = dividend; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi64ByEqual) { + ui128 dividend = std::numeric_limits<ui64>::max(); + ui128 divider = dividend; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi64Plus1ByEqual) { + ui128 dividend = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; + ui128 divider = dividend; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi64Plus42ByEqual) { + ui128 dividend = ui128{std::numeric_limits<ui64>::max()} + ui128{42}; + ui128 divider = dividend; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi128ByEqual) { + ui128 dividend = std::numeric_limits<ui128>::max(); + ui128 divider = dividend; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi128Minus1ByEqual) { + ui128 dividend = std::numeric_limits<ui128>::max() - 1; + ui128 divider = dividend; + ui128 expectedQuotient = 1; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } +} + +Y_UNIT_TEST_SUITE(Ui128DivisionLessByHigherSuite) { + Y_UNIT_TEST(Ui128Divide42By84) { + ui128 dividend = 42; + ui128 divider = 84; + ui128 expectedQuotient = 0; + ui128 expectedRemainder = 42; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128Divide42ByMaxUi64) { + ui128 dividend = 42; + ui128 divider = std::numeric_limits<ui64>::max(); + ui128 expectedQuotient = 0; + ui128 expectedRemainder = 42; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128Divide42ByMaxUi64Plus1) { + ui128 dividend = 42; + ui128 divider = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; + ui128 expectedQuotient = 0; + ui128 expectedRemainder = 42; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideMaxUi64ByMaxUi64Plus1) { + ui128 dividend = ui128{std::numeric_limits<ui64>::max()}; + ui128 divider = ui128{std::numeric_limits<ui64>::max()} + ui128{1}; + ui128 expectedQuotient = 0; + ui128 expectedRemainder = ui128{std::numeric_limits<ui64>::max()}; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } +} + +Y_UNIT_TEST_SUITE(Ui128DivisionBigByBigSuite) { + Y_UNIT_TEST(Ui128DivideBigByBig1) { + ui128 dividend = {64, 0}; + ui128 divider = {1, 0}; + ui128 expectedQuotient = 64; + ui128 expectedRemainder = 0; + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } + + Y_UNIT_TEST(Ui128DivideBigByBig2) { + ui128 dividend = {64, 0}; + ui128 divider = {12, 5}; + ui128 expectedQuotient = 5; + ui128 expectedRemainder = ui128{3, 18446744073709551591ull}; // plz don't ask + + UNIT_ASSERT_EQUAL(dividend / divider, expectedQuotient); + UNIT_ASSERT_EQUAL(dividend % divider, expectedRemainder); + } +} + +Y_UNIT_TEST_SUITE(Ui128DivisionAlgo) { + Y_UNIT_TEST(Ui128DivideAlgoCheck) { + /* + 49672666804009505000000 / 10000000 == 4967266680400950 + 49672666804009505000000 % 10000000 == 5000000 + */ + ui128 dividend = {2692ull, 14031757583392049728ull}; + ui64 divider = 10000000; + ui128 expectedQuotient = {0, 4967266680400950ull}; + ui128 expectedRemainder = {0, 5000000ull}; + + ui128 quotient = dividend / divider; + ui128 reminder = dividend % divider; + + UNIT_ASSERT_EQUAL(quotient, expectedQuotient); + UNIT_ASSERT_EQUAL(reminder, expectedRemainder); + } +} diff --git a/library/cpp/int128/ut/ya.make b/library/cpp/int128/ut/ya.make index fd43531c5fd..63211431bc0 100644 --- a/library/cpp/int128/ut/ya.make +++ b/library/cpp/int128/ut/ya.make @@ -1,20 +1,20 @@ UNITTEST_FOR(library/cpp/int128) - -OWNER(vladon) + +OWNER(vladon) SRCS( - int128_ut_helpers.cpp - int128_ut_helpers.h - int128_ut.cpp - int128_typetraits_ut.cpp - int128_old_ut.cpp - int128_via_intrinsic_ut.cpp - i128_ut.cpp - i128_and_intrinsic_identity_ut.cpp - i128_comparison_ut.cpp - i128_division_ut.cpp - i128_type_traits_ut.cpp - ui128_division_ut.cpp + int128_ut_helpers.cpp + int128_ut_helpers.h + int128_ut.cpp + int128_typetraits_ut.cpp + int128_old_ut.cpp + int128_via_intrinsic_ut.cpp + i128_ut.cpp + i128_and_intrinsic_identity_ut.cpp + i128_comparison_ut.cpp + i128_division_ut.cpp + i128_type_traits_ut.cpp + ui128_division_ut.cpp ) END() diff --git a/library/cpp/int128/ya.make b/library/cpp/int128/ya.make index 95e453e6f1a..ae581746c73 100644 --- a/library/cpp/int128/ya.make +++ b/library/cpp/int128/ya.make @@ -1,13 +1,13 @@ LIBRARY() -OWNER( - vladon +OWNER( + vladon # g:zora -) +) SRCS( - int128.cpp - int128.h + int128.cpp + int128.h ) END() diff --git a/library/cpp/ipv6_address/ipv6_address.cpp b/library/cpp/ipv6_address/ipv6_address.cpp index be8fcbae13b..7cfb17f06ae 100644 --- a/library/cpp/ipv6_address/ipv6_address.cpp +++ b/library/cpp/ipv6_address/ipv6_address.cpp @@ -12,17 +12,17 @@ #include <util/system/byteorder.h> #include <util/ysaveload.h> -#include <array> - -namespace { - // reinterpret_cast from memory, where most significant bit is first - inline ui128 FromMemMSF(const char* memPtr) { - Y_VERIFY(memPtr, " "); - return ui128{ - *reinterpret_cast<const ui64*>(memPtr), - *(reinterpret_cast<const ui64*>(memPtr) + 1) - }; - } +#include <array> + +namespace { + // reinterpret_cast from memory, where most significant bit is first + inline ui128 FromMemMSF(const char* memPtr) { + Y_VERIFY(memPtr, " "); + return ui128{ + *reinterpret_cast<const ui64*>(memPtr), + *(reinterpret_cast<const ui64*>(memPtr) + 1) + }; + } // zero-terminated copy of address string template <size_t N> @@ -33,17 +33,17 @@ namespace { res[len] = '\0'; return res; } -} - +} + void TIpv6Address::InitFrom(const in6_addr& addr) { const ui64* const ui64Ptr = reinterpret_cast<const ui64*>(&addr); const ui64 raw[2] = {SwapBytes(*ui64Ptr), SwapBytes(*(ui64Ptr + 1))}; - Ip = FromMemMSF(reinterpret_cast<const char*>(raw)); + Ip = FromMemMSF(reinterpret_cast<const char*>(raw)); Type_ = Ipv6; } void TIpv6Address::InitFrom(const in_addr& addr) { - unsigned long swapped = SwapBytes(addr.s_addr); - Ip = ui128{0, swapped}; + unsigned long swapped = SwapBytes(addr.s_addr); + Ip = ui128{0, swapped}; Type_ = Ipv4; } @@ -114,7 +114,7 @@ TString TIpv6Address::ToString(bool* ok) const noexcept { return ToString(true, ok); } TString TIpv6Address::ToString(bool PrintScopeId, bool* ok) const noexcept { - TString result; + TString result; bool isOk = true; if (Type_ == TIpv6Address::Ipv4) { @@ -176,16 +176,16 @@ void TIpv6Address::ToInAddr(in_addr& Addr4) const { Y_VERIFY(Type_ == TIpv6Address::Ipv4); Zero(Addr4); - ui32 Value = GetLow(Ip); - Y_VERIFY(Value == GetLow(Ip), " "); - Y_VERIFY(GetHigh(Ip) == 0, " "); + ui32 Value = GetLow(Ip); + Y_VERIFY(Value == GetLow(Ip), " "); + Y_VERIFY(GetHigh(Ip) == 0, " "); Addr4.s_addr = SwapBytes(Value); } void TIpv6Address::ToIn6Addr(in6_addr& Addr6) const { Y_VERIFY(Type_ == TIpv6Address::Ipv6); Zero(Addr6); - ui64 Raw[2] = {GetHigh(Ip), GetLow(Ip)}; + ui64 Raw[2] = {GetHigh(Ip), GetLow(Ip)}; *Raw = SwapBytes(*Raw); Raw[1] = SwapBytes(1 [Raw]); memcpy(&Addr6, Raw, sizeof(Raw)); @@ -213,10 +213,10 @@ bool TIpv6Address::Isv4MappedTov6() const noexcept { if (Type_ != Ipv6) return false; - if (GetHigh(Ip) != 0) + if (GetHigh(Ip) != 0) return false; // First 64 bit are not zero -> it is not ipv4-mapped-ipv6 address - const ui64 Low = GetLow(Ip) >> 32; + const ui64 Low = GetLow(Ip) >> 32; if (Low != 0x0000ffff) return false; @@ -227,8 +227,8 @@ TIpv6Address TIpv6Address::TryToExtractIpv4From6() const noexcept { if (Isv4MappedTov6() == false) return TIpv6Address(); - const ui64 NewLow = GetLow(Ip) & 0x00000000ffffffff; - TIpv6Address Result(ui128(0, NewLow), Ipv4); + const ui64 NewLow = GetLow(Ip) & 0x00000000ffffffff; + TIpv6Address Result(ui128(0, NewLow), Ipv4); return Result; } @@ -310,7 +310,7 @@ std::tuple<THostAddressAndPort, TString, TIpPort> ParseHostAndMayBePortFromStrin bool& Ok) noexcept { // Cout << "ParseHostAndMayBePortFromString: " << RawStr << ", Port: " << DefaultPort << Endl; - using TRes = std::tuple<THostAddressAndPort, TString, TIpPort>; + using TRes = std::tuple<THostAddressAndPort, TString, TIpPort>; // --------------------------------------------------------------------- diff --git a/library/cpp/ipv6_address/ipv6_address.h b/library/cpp/ipv6_address/ipv6_address.h index 1d7eb0b65fd..e497d6a2cb1 100644 --- a/library/cpp/ipv6_address/ipv6_address.h +++ b/library/cpp/ipv6_address/ipv6_address.h @@ -147,7 +147,7 @@ private: void InitFrom(const sockaddr_in6& Addr); void InitFrom(const sockaddr_in& Addr); - ui128 Ip{}; + ui128 Ip{}; TIpType Type_ = LAST; ui32 ScopeId_ = 0; }; @@ -189,7 +189,7 @@ IOutputStream& operator<<(IOutputStream& Out, const THostAddressAndPort& HostAdd /// /// Returns /// 1. either valid THostAddressAndPort -/// 2. or TString with hostname (which you should resolve) and TIpPort with port +/// 2. or TString with hostname (which you should resolve) and TIpPort with port /// 3. or error, if Ok == false /// /// Supported RawStrs are @@ -203,13 +203,13 @@ std::tuple<THostAddressAndPort, TString, TIpPort> ParseHostAndMayBePortFromStrin TIpPort DefaultPort, bool& Ok) noexcept; -using TIpv6AddressesSet = THashSet<TIpv6Address>; +using TIpv6AddressesSet = THashSet<TIpv6Address>; template <> struct THash<TIpv6Address> { inline size_t operator()(const TIpv6Address& ip) const { - const ui128& Tmp = static_cast<ui128>(ip); - return CombineHashes(THash<ui128>()(Tmp), THash<ui8>()(static_cast<ui8>(ip.Type()))); + const ui128& Tmp = static_cast<ui128>(ip); + return CombineHashes(THash<ui128>()(Tmp), THash<ui8>()(static_cast<ui8>(ip.Type()))); } }; template <> diff --git a/library/cpp/json/domscheme_traits.h b/library/cpp/json/domscheme_traits.h index a5a99cd8cfe..91c3351b22b 100644 --- a/library/cpp/json/domscheme_traits.h +++ b/library/cpp/json/domscheme_traits.h @@ -9,7 +9,7 @@ struct TJsonTraits { using TValue = NJson::TJsonValue; using TValueRef = TValue*; using TConstValueRef = const TValue*; - using TStringType = TStringBuf; + using TStringType = TStringBuf; // anyvalue defaults template <class T> @@ -104,7 +104,7 @@ struct TJsonTraits { return v->GetMap().size(); } - using TDictIterator = NJson::TJsonValue::TMapType::const_iterator; + using TDictIterator = NJson::TJsonValue::TMapType::const_iterator; static inline TDictIterator DictBegin(TConstValueRef v) { return v->GetMap().begin(); @@ -200,8 +200,8 @@ struct TJsonTraits { } // validation ops - static inline TVector<TString> GetKeys(TConstValueRef v) { - TVector<TString> res; + static inline TVector<TString> GetKeys(TConstValueRef v) { + TVector<TString> res; for (const auto& it : v->GetMap()) { res.push_back(it.first); } diff --git a/library/cpp/json/easy_parse/json_easy_parser.h b/library/cpp/json/easy_parse/json_easy_parser.h index 59d7791ab14..6a74f6c3d42 100644 --- a/library/cpp/json/easy_parse/json_easy_parser.h +++ b/library/cpp/json/easy_parse/json_easy_parser.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/stream/input.h> #include <util/stream/output.h> @@ -23,13 +23,13 @@ namespace NJson { */ class TJsonParser { - TString Prefix; + TString Prefix; struct TField { - TVector<TPathElem> Path; + TVector<TPathElem> Path; bool NonEmpty; }; - TVector<TField> Fields; + TVector<TField> Fields; friend class TRewriteJsonImpl; diff --git a/library/cpp/json/easy_parse/json_easy_parser_impl.h b/library/cpp/json/easy_parse/json_easy_parser_impl.h index ec55d838b32..491b684df7f 100644 --- a/library/cpp/json/easy_parse/json_easy_parser_impl.h +++ b/library/cpp/json/easy_parse/json_easy_parser_impl.h @@ -10,10 +10,10 @@ namespace NJson { MAP_KEY }; } - template <class TStringType> + template <class TStringType> struct TPathElemImpl { NImpl::EType Type; - TStringType Key; + TStringType Key; int ArrayCounter; TPathElemImpl(NImpl::EType type) @@ -36,5 +36,5 @@ namespace NJson { } }; - typedef TPathElemImpl<TString> TPathElem; + typedef TPathElemImpl<TString> TPathElem; } diff --git a/library/cpp/json/fast_sax/parser.rl6 b/library/cpp/json/fast_sax/parser.rl6 index edb4e9ee1b3..885f141c3df 100644 --- a/library/cpp/json/fast_sax/parser.rl6 +++ b/library/cpp/json/fast_sax/parser.rl6 @@ -58,7 +58,7 @@ struct TParserCtx { if (!token) { Hndl.OnError(off, reason); } else { - Hndl.OnError(off, TString::Join(reason, " at token: '", token, "'")); + Hndl.OnError(off, TString::Join(reason, " at token: '", token, "'")); } return false; diff --git a/library/cpp/json/fuzzy_test/main.cpp b/library/cpp/json/fuzzy_test/main.cpp index 29a53aac142..3f6dbc31179 100644 --- a/library/cpp/json/fuzzy_test/main.cpp +++ b/library/cpp/json/fuzzy_test/main.cpp @@ -4,7 +4,7 @@ #include <util/stream/str.h> extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) { - const auto json = TString((const char*)data, size); + const auto json = TString((const char*)data, size); try { NJson::TJsonValue value; diff --git a/library/cpp/json/json_writer.h b/library/cpp/json/json_writer.h index c7f5c9499a4..ecd4dcc671e 100644 --- a/library/cpp/json/json_writer.h +++ b/library/cpp/json/json_writer.h @@ -8,7 +8,7 @@ #include <util/stream/output.h> #include <util/generic/hash.h> -#include <util/generic/maybe.h> +#include <util/generic/maybe.h> #include <util/generic/strbuf.h> namespace NJson { @@ -154,8 +154,8 @@ namespace NJson { void WriteOptional(const TStringBuf&, const TNothing&) { // nothing to do - } - + } + void WriteKey(const TStringBuf key) { Buf.WriteKey(key); } @@ -179,7 +179,7 @@ namespace NJson { NJsonWriter::TBufState State() const { return Buf.State(); } - + void Reset(const NJsonWriter::TBufState& from) { return Buf.Reset(from); } diff --git a/library/cpp/json/ut/json_reader_fast_ut.cpp b/library/cpp/json/ut/json_reader_fast_ut.cpp index 60dffc91c73..4ecd698d568 100644 --- a/library/cpp/json/ut/json_reader_fast_ut.cpp +++ b/library/cpp/json/ut/json_reader_fast_ut.cpp @@ -280,7 +280,7 @@ public: } void TestReadJsonFastTree() { - const TString json = R"( + const TString json = R"( { "a": { "b": {} diff --git a/library/cpp/json/ut/json_reader_ut.cpp b/library/cpp/json/ut/json_reader_ut.cpp index cd31afa0b8b..dd753329717 100644 --- a/library/cpp/json/ut/json_reader_ut.cpp +++ b/library/cpp/json/ut/json_reader_ut.cpp @@ -68,9 +68,9 @@ public: Y_UNIT_TEST_SUITE(TJsonReaderTest) { Y_UNIT_TEST(JsonReformatTest) { - TString data = "{\"null value\": null, \"intkey\": 10, \"double key\": 11.11, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}"; + TString data = "{\"null value\": null, \"intkey\": 10, \"double key\": 11.11, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}"; - TString result1, result2; + TString result1, result2; { TStringStream in; in << data; @@ -120,7 +120,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { } Y_UNIT_TEST(TJsonTreeTest) { - TString data = "{\"intkey\": 10, \"double key\": 11.11, \"null value\":null, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}"; + TString data = "{\"intkey\": 10, \"double key\": 11.11, \"null value\":null, \"string key\": \"string\", \"array\": [1,2,3,\"TString\"], \"bool key\": true}"; TStringStream in; in << data; TJsonValue value; @@ -130,7 +130,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { UNIT_ASSERT_DOUBLES_EQUAL(value["double key"].GetDouble(), 11.11, 0.001); UNIT_ASSERT_VALUES_EQUAL(value["bool key"].GetBoolean(), true); UNIT_ASSERT_VALUES_EQUAL(value["absent string key"].GetString(), TString("")); - UNIT_ASSERT_VALUES_EQUAL(value["string key"].GetString(), TString("string")); + UNIT_ASSERT_VALUES_EQUAL(value["string key"].GetString(), TString("string")); UNIT_ASSERT_VALUES_EQUAL(value["array"][0].GetInteger(), 1); UNIT_ASSERT_VALUES_EQUAL(value["array"][1].GetInteger(), 2); UNIT_ASSERT_VALUES_EQUAL(value["array"][2].GetInteger(), 3); @@ -155,19 +155,19 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { } Y_UNIT_TEST(TJsonRomaTest) { - TString data = "{\"test\": [ {\"name\": \"A\"} ]}"; + TString data = "{\"test\": [ {\"name\": \"A\"} ]}"; TStringStream in; in << data; TJsonValue value; ReadJsonTree(&in, &value); - UNIT_ASSERT_VALUES_EQUAL(value["test"][0]["name"].GetString(), TString("A")); + UNIT_ASSERT_VALUES_EQUAL(value["test"][0]["name"].GetString(), TString("A")); } Y_UNIT_TEST(TJsonReadTreeWithComments) { { - TString leadingCommentData = "{ // \"test\" : 1 \n}"; + TString leadingCommentData = "{ // \"test\" : 1 \n}"; { // No comments allowed TStringStream in; @@ -187,7 +187,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { } { - TString trailingCommentData = "{ \"test1\" : 1 // \"test2\" : 2 \n }"; + TString trailingCommentData = "{ \"test1\" : 1 // \"test2\" : 2 \n }"; { // No comments allowed TStringStream in; @@ -375,7 +375,7 @@ Y_UNIT_TEST_SUITE(TJsonReaderTest) { Y_UNIT_TEST(TJsonMemoryLeakTest) { // after https://clubs.at.yandex-team.ru/stackoverflow/3691 - TString s = "."; + TString s = "."; NJson::TJsonValue json; try { TStringInput in(s); diff --git a/library/cpp/json/ut/json_writer_ut.cpp b/library/cpp/json/ut/json_writer_ut.cpp index ca11d34dad9..ae60f208d4f 100644 --- a/library/cpp/json/ut/json_writer_ut.cpp +++ b/library/cpp/json/ut/json_writer_ut.cpp @@ -7,9 +7,9 @@ using namespace NJson; Y_UNIT_TEST_SUITE(TJsonWriterTest) { Y_UNIT_TEST(SimpleWriteTest) { - TString expected1 = "{\"key1\":1,\"key2\":2,\"key3\":3"; + TString expected1 = "{\"key1\":1,\"key2\":2,\"key3\":3"; TString expected2 = expected1 + ",\"array\":[\"stroka\",false]"; - TString expected3 = expected2 + "}"; + TString expected3 = expected2 + "}"; TStringStream out; @@ -42,7 +42,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { } Y_UNIT_TEST(SimpleWriteValueTest) { - TString expected = "{\"key1\":null,\"key2\":{\"subkey1\":[1,{\"subsubkey\":\"test2\"},null,true],\"subkey2\":\"test\"}}"; + TString expected = "{\"key1\":null,\"key2\":{\"subkey1\":[1,{\"subsubkey\":\"test2\"},null,true],\"subkey2\":\"test\"}}"; TJsonValue v; v["key1"] = JSON_NULL; v["key2"]["subkey1"].AppendValue(1); @@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { } Y_UNIT_TEST(FormatOutput) { - TString expected = "{\n \"key1\":null,\n \"key2\":\n {\n \"subkey1\":\n [\n 1,\n {\n \"subsubkey\":\"test2\"\n },\n null,\n true\n ],\n \"subkey2\":\"test\"\n }\n}"; + TString expected = "{\n \"key1\":null,\n \"key2\":\n {\n \"subkey1\":\n [\n 1,\n {\n \"subsubkey\":\"test2\"\n },\n null,\n true\n ],\n \"subkey2\":\"test\"\n }\n}"; TJsonValue v; v["key1"] = JSON_NULL; v["key2"]["subkey1"].AppendValue(1); @@ -70,7 +70,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { } Y_UNIT_TEST(SortKeys) { - TString expected = "{\"a\":null,\"j\":null,\"n\":null,\"y\":null,\"z\":null}"; + TString expected = "{\"a\":null,\"j\":null,\"n\":null,\"y\":null,\"z\":null}"; TJsonValue v; v["z"] = JSON_NULL; v["n"] = JSON_NULL; @@ -84,7 +84,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { Y_UNIT_TEST(SimpleUnsignedIntegerWriteTest) { { - TString expected = "{\"test\":1}"; + TString expected = "{\"test\":1}"; TJsonValue v; v.InsertValue("test", 1ull); TStringStream out; @@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { } // 1 { - TString expected = "{\"test\":-1}"; + TString expected = "{\"test\":-1}"; TJsonValue v; v.InsertValue("test", -1); TStringStream out; @@ -102,7 +102,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { } // -1 { - TString expected = "{\"test\":18446744073709551615}"; + TString expected = "{\"test\":18446744073709551615}"; TJsonValue v; v.InsertValue("test", 18446744073709551615ull); TStringStream out; @@ -111,7 +111,7 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { } // 18446744073709551615 { - TString expected = "{\"test\":[1,18446744073709551615]}"; + TString expected = "{\"test\":[1,18446744073709551615]}"; TJsonValue v; v.InsertValue("test", TJsonValue()); v["test"].AppendValue(1); @@ -123,62 +123,62 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { } // SimpleUnsignedIntegerWriteTest Y_UNIT_TEST(WriteOptionalTest) { - { - TString expected = "{\"test\":1}"; - - TStringStream out; - - TJsonWriter json(&out, false); - json.OpenMap(); - json.WriteOptional("test", MakeMaybe<int>(1)); - json.CloseMap(); - json.Flush(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); - } - - { - TString expected = "{}"; - - TStringStream out; - - TMaybe<int> nothing = Nothing(); - - TJsonWriter json(&out, false); - json.OpenMap(); - json.WriteOptional("test", nothing); - json.CloseMap(); - json.Flush(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); - } - - { - TString expected = "{}"; - - TStringStream out; - - TMaybe<int> empty; - - TJsonWriter json(&out, false); - json.OpenMap(); - json.WriteOptional("test", empty); - json.CloseMap(); - json.Flush(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); - } - - { - TString expected = "{}"; - - TStringStream out; - - TJsonWriter json(&out, false); - json.OpenMap(); - json.WriteOptional("test", Nothing()); - json.CloseMap(); - json.Flush(); - UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); - } - } + { + TString expected = "{\"test\":1}"; + + TStringStream out; + + TJsonWriter json(&out, false); + json.OpenMap(); + json.WriteOptional("test", MakeMaybe<int>(1)); + json.CloseMap(); + json.Flush(); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); + } + + { + TString expected = "{}"; + + TStringStream out; + + TMaybe<int> nothing = Nothing(); + + TJsonWriter json(&out, false); + json.OpenMap(); + json.WriteOptional("test", nothing); + json.CloseMap(); + json.Flush(); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); + } + + { + TString expected = "{}"; + + TStringStream out; + + TMaybe<int> empty; + + TJsonWriter json(&out, false); + json.OpenMap(); + json.WriteOptional("test", empty); + json.CloseMap(); + json.Flush(); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); + } + + { + TString expected = "{}"; + + TStringStream out; + + TJsonWriter json(&out, false); + json.OpenMap(); + json.WriteOptional("test", Nothing()); + json.CloseMap(); + json.Flush(); + UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); + } + } Y_UNIT_TEST(Callback) { NJsonWriter::TBuf json; diff --git a/library/cpp/json/writer/json.h b/library/cpp/json/writer/json.h index 0aae2531b94..d7c77f9c636 100644 --- a/library/cpp/json/writer/json.h +++ b/library/cpp/json/writer/json.h @@ -2,7 +2,7 @@ #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> #include <util/stream/str.h> @@ -36,7 +36,7 @@ namespace NJsonWriter { struct TBufState { bool NeedComma; bool NeedNewline; - TVector<EJsonEntity> Stack; + TVector<EJsonEntity> Stack; }; class TBuf : TNonCopyable { @@ -88,7 +88,7 @@ namespace NJsonWriter { /*** Return the string formed in the internal TStringStream. * You may only call it if the `stream' parameter was NULL * at construction time. */ - const TString& Str() const; + const TString& Str() const; /*** Dump and forget the string constructed so far. * You may only call it if the `stream' parameter was NULL @@ -147,10 +147,10 @@ namespace NJsonWriter { private: IOutputStream* Stream; THolder<TStringStream> StringStream; - typedef TVector<const TString*> TKeys; + typedef TVector<const TString*> TKeys; TKeys Keys; - TVector<EJsonEntity> Stack; + TVector<EJsonEntity> Stack; bool NeedComma; bool NeedNewline; const EHtmlEscapeMode EscapeMode; diff --git a/library/cpp/json/writer/json_ut.cpp b/library/cpp/json/writer/json_ut.cpp index 9980555683f..a05d39f0a9a 100644 --- a/library/cpp/json/writer/json_ut.cpp +++ b/library/cpp/json/writer/json_ut.cpp @@ -32,14 +32,14 @@ Y_UNIT_TEST_SUITE(JsonWriter) { Y_UNIT_TEST(EscapedString) { NJsonWriter::TBuf w(NJsonWriter::HEM_ESCAPE_HTML); w.WriteString(" \n \r \t \007 \b \f ' <tag> &ent; \"txt\" "); - TString ws = w.Str(); + TString ws = w.Str(); const char* exp = "\" \\n \\r \\t \\u0007 \\b \\f ' <tag> &ent; "txt" \""; UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp); } Y_UNIT_TEST(UnescapedString) { NJsonWriter::TBuf w; w.WriteString(" \n \r \t \b \f '; -- <tag> &ent; \"txt\"", NJsonWriter::HEM_DONT_ESCAPE_HTML); - TString ws = w.Str(); + TString ws = w.Str(); const char* exp = "\" \\n \\r \\t \\b \\f \\u0027; -- \\u003Ctag\\u003E &ent; \\\"txt\\\"\""; UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp); } @@ -48,12 +48,12 @@ Y_UNIT_TEST_SUITE(JsonWriter) { w.UnsafeWriteRawBytes("(", 1); w.BeginList().WriteString("<>&'\\").BeginList(); w.EndList().EndList(); - TString ws = w.Str(); + TString ws = w.Str(); const char* exp = "([\"\\u003C\\u003E&\\u0027\\\\\",[]]"; UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp); } Y_UNIT_TEST(Utf8) { - TString ws = NJsonWriter::TBuf().WriteString("яЯ σΣ ש א").Str(); + TString ws = NJsonWriter::TBuf().WriteString("яЯ σΣ ש א").Str(); const char* exp = "\"яЯ σΣ ש א\""; UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp); } @@ -80,14 +80,14 @@ Y_UNIT_TEST_SUITE(JsonWriter) { .CompatWriteKeyWithoutQuotes("n") .WriteInt(0) .EndObject(); - TString ws = w.Str(); + TString ws = w.Str(); const char* exp = "{p:1,n:0}"; UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp); } Y_UNIT_TEST(UnescapedStringInObject) { NJsonWriter::TBuf w(NJsonWriter::HEM_DONT_ESCAPE_HTML); w.BeginObject().WriteKey("key").WriteString("</&>'").EndObject(); - TString ws = w.Str(); + TString ws = w.Str(); const char* exp = "{\"key\":\"\\u003C\\/&\\u003E\\u0027\"}"; UNIT_ASSERT_STRINGS_EQUAL(ws.c_str(), exp); } diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index c61e8d1dc43..79623a732ae 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -23,15 +23,15 @@ AreJsonMapsEqual(const NJson::TJsonValue& lhs, const NJson::TJsonValue& rhs) { if (rhs.GetType() != JSON_MAP) return false; - typedef TJsonValue::TMapType TMapType; - const TMapType& lhsMap = lhs.GetMap(); - const TMapType& rhsMap = rhs.GetMap(); + typedef TJsonValue::TMapType TMapType; + const TMapType& lhsMap = lhs.GetMap(); + const TMapType& rhsMap = rhs.GetMap(); if (lhsMap.size() != rhsMap.size()) return false; for (const auto& lhsIt : lhsMap) { - TMapType::const_iterator rhsIt = rhsMap.find(lhsIt.first); + TMapType::const_iterator rhsIt = rhsMap.find(lhsIt.first); if (rhsIt == rhsMap.end()) return false; diff --git a/library/cpp/json/writer/json_value.h b/library/cpp/json/writer/json_value.h index 3f0f50bc4c8..97bf582550e 100644 --- a/library/cpp/json/writer/json_value.h +++ b/library/cpp/json/writer/json_value.h @@ -2,7 +2,7 @@ #include <library/cpp/json/common/defs.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/hash.h> #include <util/generic/vector.h> #include <util/generic/deque.h> diff --git a/library/cpp/json/writer/json_value_ut.cpp b/library/cpp/json/writer/json_value_ut.cpp index dc7f6affdff..30b8dda6f80 100644 --- a/library/cpp/json/writer/json_value_ut.cpp +++ b/library/cpp/json/writer/json_value_ut.cpp @@ -500,8 +500,8 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) { expectedJson.InsertValue("foo", "bar"); UNIT_ASSERT(json == expectedJson); - TJsonValue::TMapType jsonMap = std::move(json.GetMapSafe()); - TJsonValue::TMapType expectedMap = {{"foo", TJsonValue{"bar"}}}; + TJsonValue::TMapType jsonMap = std::move(json.GetMapSafe()); + TJsonValue::TMapType expectedMap = {{"foo", TJsonValue{"bar"}}}; UNIT_ASSERT(jsonMap == expectedMap); } } @@ -601,7 +601,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) { } Y_UNIT_TEST(GetIntegerRobustBignumStringTest) { - TString value = "1626862681464633683"; + TString value = "1626862681464633683"; TJsonValue json(value); UNIT_ASSERT_VALUES_EQUAL(json.GetUIntegerRobust(), FromString<ui64>(value)); UNIT_ASSERT_VALUES_EQUAL(json.GetIntegerRobust(), FromString<i64>(value)); @@ -619,7 +619,7 @@ Y_UNIT_TEST_SUITE(TJsonValueTest) { "Testing TJsonValue& operator=(TJsonValue&&) subpart self moving " "after TJsonValue was constrcuted from TString&&."; - json["hello"] = TString{longTestString}; + json["hello"] = TString{longTestString}; json = std::move(json["hello"]); UNIT_ASSERT_VALUES_EQUAL(json.GetString(), longTestString); } diff --git a/library/cpp/json/yson/json2yson.cpp b/library/cpp/json/yson/json2yson.cpp index f72cb7a9ef9..97e81d15b5b 100644 --- a/library/cpp/json/yson/json2yson.cpp +++ b/library/cpp/json/yson/json2yson.cpp @@ -36,7 +36,7 @@ namespace NJson2Yson { } case NJson::JSON_MAP: { adapter->OnOpenMap(); - const NJson::TJsonValue::TMapType& map = jsonValue.GetMap(); + const NJson::TJsonValue::TMapType& map = jsonValue.GetMap(); for (const auto& it : map) { adapter->OnMapKey(it.first); WriteJsonValue(it.second, adapter); diff --git a/library/cpp/json/yson/json2yson_ut.cpp b/library/cpp/json/yson/json2yson_ut.cpp index 9eb23354cf0..e17ef14e359 100644 --- a/library/cpp/json/yson/json2yson_ut.cpp +++ b/library/cpp/json/yson/json2yson_ut.cpp @@ -26,7 +26,7 @@ static TString GetRequestsWithDecoding(const TString& inputPath, const NBlockCod Y_UNIT_TEST_SUITE(Json2Yson) { Y_UNIT_TEST(NOAPACHE_REQUESTS) { const ui32 warmUpRetries = 5; - const TVector<double> percentiles = {0.25, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.97, 0.99, 1.0}; + const TVector<double> percentiles = {0.25, 0.5, 0.6, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.97, 0.99, 1.0}; NSimpleHistogram::TMultiHistogramCalcer<ui64> calcer; diff --git a/library/cpp/lcs/lcs_via_lis.h b/library/cpp/lcs/lcs_via_lis.h index d26733d94e9..c652c31c81a 100644 --- a/library/cpp/lcs/lcs_via_lis.h +++ b/library/cpp/lcs/lcs_via_lis.h @@ -11,9 +11,9 @@ namespace NLCS { template <typename TVal> struct TLCSCtx { - typedef TVector<ui32> TSubsequence; - typedef THashMap<TVal, TSubsequence, THash<TVal>, TEqualTo<TVal>, ::TPoolAllocator> TEncounterIndex; - typedef TVector<std::pair<ui32, ui32>> TLastIndex; + typedef TVector<ui32> TSubsequence; + typedef THashMap<TVal, TSubsequence, THash<TVal>, TEqualTo<TVal>, ::TPoolAllocator> TEncounterIndex; + typedef TVector<std::pair<ui32, ui32>> TLastIndex; typedef NPagedVector::TPagedVector<TSubsequence, 4096> TCover; TMemoryPool Pool; @@ -183,7 +183,7 @@ namespace NLCS { template <typename TVal, typename TIter> size_t MeasureLCS(TIter beg1, TIter end1, TIter beg2, TIter end2, TLCSCtx<TVal>* ctx = nullptr) { - return MakeLCS<TVal>(beg1, end1, beg2, end2, (TVector<TVal>*)nullptr, ctx); + return MakeLCS<TVal>(beg1, end1, beg2, end2, (TVector<TVal>*)nullptr, ctx); } template <typename TVal, typename TColl> diff --git a/library/cpp/lcs/lcs_via_lis_ut.cpp b/library/cpp/lcs/lcs_via_lis_ut.cpp index f6ad5152b6f..88c6bb4d941 100644 --- a/library/cpp/lcs/lcs_via_lis_ut.cpp +++ b/library/cpp/lcs/lcs_via_lis_ut.cpp @@ -10,7 +10,7 @@ class TLCSTest: public TTestBase { private: size_t Length(TStringBuf s1, TStringBuf s2) { - TVector<TVector<size_t>> c; + TVector<TVector<size_t>> c; c.resize(s1.size() + 1); for (size_t i = 0; i < c.size(); ++i) { @@ -37,7 +37,7 @@ private: } void CheckLCSString(TStringBuf s1, TStringBuf s2, TStringBuf reflcs) { - TString lcs; + TString lcs; size_t len = NLCS::MakeLCS<char>(s1, s2, &lcs); const char* comment = Sprintf("%s & %s = %s", s1.data(), s2.data(), reflcs.data()).c_str(); diff --git a/library/cpp/lfalloc/alloc_profiler/profiler.cpp b/library/cpp/lfalloc/alloc_profiler/profiler.cpp index 0e30927a5a2..593521d6573 100644 --- a/library/cpp/lfalloc/alloc_profiler/profiler.cpp +++ b/library/cpp/lfalloc/alloc_profiler/profiler.cpp @@ -4,7 +4,7 @@ #include <util/generic/algorithm.h> #include <util/generic/singleton.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/stream/str.h> diff --git a/library/cpp/lfalloc/alloc_profiler/stackcollect.cpp b/library/cpp/lfalloc/alloc_profiler/stackcollect.cpp index fded4e2fd1a..55ecc8213fb 100644 --- a/library/cpp/lfalloc/alloc_profiler/stackcollect.cpp +++ b/library/cpp/lfalloc/alloc_profiler/stackcollect.cpp @@ -208,7 +208,7 @@ public: const TFrameInfo* frames = TBase::GetFrames(); size_t framesCount = TBase::GetFramesCount(); - TVector<const TFrameInfo*> stacks; + TVector<const TFrameInfo*> stacks; for (size_t i = 0; i < framesCount; ++i) { if (frames[i].Stats.Allocs) { stacks.push_back(&frames[i]); diff --git a/library/cpp/lfalloc/lf_allocX64.cpp b/library/cpp/lfalloc/lf_allocX64.cpp index 2eb90761fed..b15bfc10264 100644 --- a/library/cpp/lfalloc/lf_allocX64.cpp +++ b/library/cpp/lfalloc/lf_allocX64.cpp @@ -3,14 +3,14 @@ ////////////////////////////////////////////////////////////////////////// // hooks #if defined(USE_INTELCC) || defined(_darwin_) || defined(_freebsd_) || defined(_STLPORT_VERSION) -#define OP_THROWNOTHING noexcept +#define OP_THROWNOTHING noexcept #else #define OP_THROWNOTHING #endif #ifndef _darwin_ #if !defined(YMAKE) -void* operator new(size_t size) { +void* operator new(size_t size) { return LFAlloc(size); } @@ -26,7 +26,7 @@ void operator delete(void* p, const std::nothrow_t&)OP_THROWNOTHING { LFFree(p); } -void* operator new[](size_t size) { +void* operator new[](size_t size) { return LFAlloc(size); } diff --git a/library/cpp/linear_regression/benchmark/pool.cpp b/library/cpp/linear_regression/benchmark/pool.cpp index 7f2c6a70048..5e014e575c4 100644 --- a/library/cpp/linear_regression/benchmark/pool.cpp +++ b/library/cpp/linear_regression/benchmark/pool.cpp @@ -3,7 +3,7 @@ #include <util/string/cast.h> #include <util/stream/file.h> -TInstance TInstance::FromFeaturesString(const TString& featuresString) { +TInstance TInstance::FromFeaturesString(const TString& featuresString) { TInstance instance; TStringBuf featuresStringBuf(featuresString); @@ -29,7 +29,7 @@ TPool::TCVIterator::TCVIterator(const TPool& parentPool, const size_t foldsCount } void TPool::TCVIterator::ResetShuffle() { - TVector<size_t> instanceNumbers(ParentPool.size()); + TVector<size_t> instanceNumbers(ParentPool.size()); for (size_t instanceNumber = 0; instanceNumber < ParentPool.size(); ++instanceNumber) { instanceNumbers[instanceNumber] = instanceNumber; } @@ -83,9 +83,9 @@ bool TPool::TCVIterator::TakeCurrent() const { return false; } -void TPool::ReadFromFeatures(const TString& featuresPath) { - TFileInput featuresIn(featuresPath); - TString featuresString; +void TPool::ReadFromFeatures(const TString& featuresPath) { + TFileInput featuresIn(featuresPath); + TString featuresString; while (featuresIn.ReadLine(featuresString)) { this->push_back(TInstance::FromFeaturesString(featuresString)); } diff --git a/library/cpp/linear_regression/benchmark/pool.h b/library/cpp/linear_regression/benchmark/pool.h index 43288319c8b..88140b7dd1b 100644 --- a/library/cpp/linear_regression/benchmark/pool.h +++ b/library/cpp/linear_regression/benchmark/pool.h @@ -1,17 +1,17 @@ #pragma once #include <util/generic/vector.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/random/mersenne.h> #include <util/random/shuffle.h> struct TInstance { - TVector<double> Features; + TVector<double> Features; double Goal; double Weight; - static TInstance FromFeaturesString(const TString& featuresString); + static TInstance FromFeaturesString(const TString& featuresString); }; struct TPool: public TVector<TInstance> { @@ -29,7 +29,7 @@ struct TPool: public TVector<TInstance> { EIteratorType IteratorType; size_t TestFoldNumber; - TVector<size_t> InstanceFoldNumbers; + TVector<size_t> InstanceFoldNumbers; const size_t* Current; TMersenne<ui64> RandomGenerator; @@ -54,7 +54,7 @@ struct TPool: public TVector<TInstance> { bool TakeCurrent() const; }; - void ReadFromFeatures(const TString& featuresPath); + void ReadFromFeatures(const TString& featuresPath); TCVIterator CrossValidationIterator(const size_t foldsCount, const EIteratorType iteratorType) const; TPool InjurePool(const double injureFactir, const double injureOffset) const; diff --git a/library/cpp/linear_regression/linear_regression.cpp b/library/cpp/linear_regression/linear_regression.cpp index 150f9d214e9..6fc5a401783 100644 --- a/library/cpp/linear_regression/linear_regression.cpp +++ b/library/cpp/linear_regression/linear_regression.cpp @@ -12,17 +12,17 @@ #include <functional> namespace { - inline void AddFeaturesProduct(const double weight, const TVector<double>& features, TVector<double>& linearizedOLSTriangleMatrix); + inline void AddFeaturesProduct(const double weight, const TVector<double>& features, TVector<double>& linearizedOLSTriangleMatrix); - TVector<double> Solve(const TVector<double>& olsMatrix, const TVector<double>& olsVector); + TVector<double> Solve(const TVector<double>& olsMatrix, const TVector<double>& olsVector); - double SumSquaredErrors(const TVector<double>& olsMatrix, - const TVector<double>& olsVector, - const TVector<double>& solution, + double SumSquaredErrors(const TVector<double>& olsMatrix, + const TVector<double>& olsVector, + const TVector<double>& solution, const double goalsDeviation); } -bool TFastLinearRegressionSolver::Add(const TVector<double>& features, const double goal, const double weight) { +bool TFastLinearRegressionSolver::Add(const TVector<double>& features, const double goal, const double weight) { const size_t featuresCount = features.size(); if (LinearizedOLSMatrix.empty()) { @@ -45,7 +45,7 @@ bool TFastLinearRegressionSolver::Add(const TVector<double>& features, const dou return true; } -bool TLinearRegressionSolver::Add(const TVector<double>& features, const double goal, const double weight) { +bool TLinearRegressionSolver::Add(const TVector<double>& features, const double goal, const double weight) { const size_t featuresCount = features.size(); if (FeatureMeans.empty()) { @@ -114,7 +114,7 @@ bool TLinearRegressionSolver::Add(const TVector<double>& features, const double } TLinearModel TFastLinearRegressionSolver::Solve() const { - TVector<double> coefficients = ::Solve(LinearizedOLSMatrix, OLSVector); + TVector<double> coefficients = ::Solve(LinearizedOLSMatrix, OLSVector); double intercept = 0.; if (!coefficients.empty()) { @@ -126,7 +126,7 @@ TLinearModel TFastLinearRegressionSolver::Solve() const { } TLinearModel TLinearRegressionSolver::Solve() const { - TVector<double> coefficients = ::Solve(LinearizedOLSMatrix, OLSVector); + TVector<double> coefficients = ::Solve(LinearizedOLSMatrix, OLSVector); double intercept = GoalsMean; const size_t featuresCount = OLSVector.size(); @@ -138,12 +138,12 @@ TLinearModel TLinearRegressionSolver::Solve() const { } double TFastLinearRegressionSolver::SumSquaredErrors() const { - const TVector<double> coefficients = ::Solve(LinearizedOLSMatrix, OLSVector); + const TVector<double> coefficients = ::Solve(LinearizedOLSMatrix, OLSVector); return ::SumSquaredErrors(LinearizedOLSMatrix, OLSVector, coefficients, SumSquaredGoals.Get()); } double TLinearRegressionSolver::SumSquaredErrors() const { - const TVector<double> coefficients = ::Solve(LinearizedOLSMatrix, OLSVector); + const TVector<double> coefficients = ::Solve(LinearizedOLSMatrix, OLSVector); return ::SumSquaredErrors(LinearizedOLSMatrix, OLSVector, coefficients, GoalsDeviation); } @@ -194,10 +194,10 @@ double TSLRSolver::SumSquaredErrors(const double regularizationParameter) const namespace { // LDL matrix decomposition, see http://en.wikipedia.org/wiki/Cholesky_decomposition#LDL_decomposition_2 - bool LDLDecomposition(const TVector<double>& linearizedOLSMatrix, + bool LDLDecomposition(const TVector<double>& linearizedOLSMatrix, const double regularizationThreshold, const double regularizationParameter, - TVector<double>& decompositionTrace, + TVector<double>& decompositionTrace, TVector<TVector<double>>& decompositionMatrix) { const size_t featuresCount = decompositionTrace.size(); @@ -206,7 +206,7 @@ namespace { double& decompositionTraceElement = decompositionTrace[rowNumber]; decompositionTraceElement = linearizedOLSMatrix[olsMatrixElementIdx] + regularizationParameter; - TVector<double>& decompositionRow = decompositionMatrix[rowNumber]; + TVector<double>& decompositionRow = decompositionMatrix[rowNumber]; for (size_t i = 0; i < rowNumber; ++i) { decompositionTraceElement -= decompositionRow[i] * decompositionRow[i] * decompositionTrace[i]; } @@ -218,7 +218,7 @@ namespace { ++olsMatrixElementIdx; decompositionRow[rowNumber] = 1.; for (size_t columnNumber = rowNumber + 1; columnNumber < featuresCount; ++columnNumber) { - TVector<double>& secondDecompositionRow = decompositionMatrix[columnNumber]; + TVector<double>& secondDecompositionRow = decompositionMatrix[columnNumber]; double& decompositionMatrixElement = secondDecompositionRow[rowNumber]; decompositionMatrixElement = linearizedOLSMatrix[olsMatrixElementIdx]; @@ -237,8 +237,8 @@ namespace { return true; } - void LDLDecomposition(const TVector<double>& linearizedOLSMatrix, - TVector<double>& decompositionTrace, + void LDLDecomposition(const TVector<double>& linearizedOLSMatrix, + TVector<double>& decompositionTrace, TVector<TVector<double>>& decompositionMatrix) { const double regularizationThreshold = 1e-5; double regularizationParameter = 0.; @@ -253,16 +253,16 @@ namespace { } TVector<double> SolveLower(const TVector<TVector<double>>& decompositionMatrix, - const TVector<double>& decompositionTrace, + const TVector<double>& decompositionTrace, const TVector<double>& olsVector) { const size_t featuresCount = olsVector.size(); - TVector<double> solution(featuresCount); + TVector<double> solution(featuresCount); for (size_t featureNumber = 0; featureNumber < featuresCount; ++featureNumber) { double& solutionElement = solution[featureNumber]; solutionElement = olsVector[featureNumber]; - const TVector<double>& decompositionRow = decompositionMatrix[featureNumber]; + const TVector<double>& decompositionRow = decompositionMatrix[featureNumber]; for (size_t i = 0; i < featureNumber; ++i) { solutionElement -= solution[i] * decompositionRow[i]; } @@ -279,12 +279,12 @@ namespace { const TVector<double>& lowerSolution) { const size_t featuresCount = lowerSolution.size(); - TVector<double> solution(featuresCount); + TVector<double> solution(featuresCount); for (size_t featureNumber = featuresCount; featureNumber > 0; --featureNumber) { double& solutionElement = solution[featureNumber - 1]; solutionElement = lowerSolution[featureNumber - 1]; - const TVector<double>& decompositionRow = decompositionMatrix[featureNumber - 1]; + const TVector<double>& decompositionRow = decompositionMatrix[featureNumber - 1]; for (size_t i = featureNumber; i < featuresCount; ++i) { solutionElement -= solution[i] * decompositionRow[i]; } @@ -293,10 +293,10 @@ namespace { return solution; } - TVector<double> Solve(const TVector<double>& olsMatrix, const TVector<double>& olsVector) { + TVector<double> Solve(const TVector<double>& olsMatrix, const TVector<double>& olsVector) { const size_t featuresCount = olsVector.size(); - TVector<double> decompositionTrace(featuresCount); + TVector<double> decompositionTrace(featuresCount); TVector<TVector<double>> decompositionMatrix(featuresCount, TVector<double>(featuresCount)); LDLDecomposition(olsMatrix, decompositionTrace, decompositionMatrix); @@ -304,9 +304,9 @@ namespace { return SolveUpper(decompositionMatrix, SolveLower(decompositionMatrix, decompositionTrace, olsVector)); } - double SumSquaredErrors(const TVector<double>& olsMatrix, - const TVector<double>& olsVector, - const TVector<double>& solution, + double SumSquaredErrors(const TVector<double>& olsMatrix, + const TVector<double>& olsVector, + const TVector<double>& solution, const double goalsDeviation) { const size_t featuresCount = olsVector.size(); @@ -325,7 +325,7 @@ namespace { } #ifdef _sse2_ - inline void AddFeaturesProduct(const double weight, const TVector<double>& features, TVector<double>& linearizedOLSTriangleMatrix) { + inline void AddFeaturesProduct(const double weight, const TVector<double>& features, TVector<double>& linearizedOLSTriangleMatrix) { const double* leftFeature = features.data(); const double* featuresEnd = features.data() + features.size(); double* matrixElement = linearizedOLSTriangleMatrix.data(); @@ -351,7 +351,7 @@ namespace { linearizedOLSTriangleMatrix.back() += weight; } #else - inline void AddFeaturesProduct(const double weight, const TVector<double>& features, TVector<double>& linearizedTriangleMatrix) { + inline void AddFeaturesProduct(const double weight, const TVector<double>& features, TVector<double>& linearizedTriangleMatrix) { const double* leftFeature = features.data(); const double* featuresEnd = features.data() + features.size(); double* matrixElement = linearizedTriangleMatrix.data(); diff --git a/library/cpp/linear_regression/linear_regression.h b/library/cpp/linear_regression/linear_regression.h index e57de5ff6cc..f1596fb0241 100644 --- a/library/cpp/linear_regression/linear_regression.h +++ b/library/cpp/linear_regression/linear_regression.h @@ -13,11 +13,11 @@ class TFastLinearRegressionSolver { private: TKahanAccumulator<double> SumSquaredGoals; - TVector<double> LinearizedOLSMatrix; - TVector<double> OLSVector; + TVector<double> LinearizedOLSMatrix; + TVector<double> OLSVector; public: - bool Add(const TVector<double>& features, const double goal, const double weight = 1.); + bool Add(const TVector<double>& features, const double goal, const double weight = 1.); TLinearModel Solve() const; double SumSquaredErrors() const; }; @@ -27,17 +27,17 @@ private: double GoalsMean = 0.; double GoalsDeviation = 0.; - TVector<double> FeatureMeans; - TVector<double> LastMeans; - TVector<double> NewMeans; - TVector<double> LinearizedOLSMatrix; + TVector<double> FeatureMeans; + TVector<double> LastMeans; + TVector<double> NewMeans; + TVector<double> LinearizedOLSMatrix; - TVector<double> OLSVector; + TVector<double> OLSVector; TKahanAccumulator<double> SumWeights; public: - bool Add(const TVector<double>& features, const double goal, const double weight = 1.); + bool Add(const TVector<double>& features, const double goal, const double weight = 1.); TLinearModel Solve() const; double SumSquaredErrors() const; }; @@ -145,12 +145,12 @@ public: bool Add(const double* featuresBegin, const double* featuresEnd, const double* goalsBegin); bool Add(const double* featuresBegin, const double* featuresEnd, const double* goalsBegin, const double* weightsBegin); - bool Add(const TVector<double>& features, const TVector<double>& goals) { + bool Add(const TVector<double>& features, const TVector<double>& goals) { Y_ASSERT(features.size() == goals.size()); return Add(features.data(), features.data() + features.size(), goals.data()); } - bool Add(const TVector<double>& features, const TVector<double>& goals, const TVector<double>& weights) { + bool Add(const TVector<double>& features, const TVector<double>& goals, const TVector<double>& weights) { Y_ASSERT(features.size() == goals.size() && features.size() == weights.size()); return Add(features.data(), features.data() + features.size(), goals.data(), weights.data()); } @@ -177,10 +177,10 @@ public: template <typename TSLRSolverType> class TTypedBestSLRSolver { private: - TVector<TSLRSolverType> SLRSolvers; + TVector<TSLRSolverType> SLRSolvers; public: - bool Add(const TVector<double>& features, const double goal, const double weight = 1.) { + bool Add(const TVector<double>& features, const double goal, const double weight = 1.) { if (SLRSolvers.empty()) { SLRSolvers.resize(features.size()); } @@ -200,7 +200,7 @@ public: } } - TVector<double> coefficients(SLRSolvers.size()); + TVector<double> coefficients(SLRSolvers.size()); double intercept = 0.0; if (bestSolver) { bestSolver->Solve(coefficients[bestSolver - SLRSolvers.begin()], intercept, regularizationParameter); @@ -289,7 +289,7 @@ private: float MaximalArgument = Min<float>(); ETransformationType TransformationType; - TVector<TPoint> Points; + TVector<TPoint> Points; public: TFeaturesTransformerLearner(const ETransformationType transformationType) @@ -315,7 +315,7 @@ private: TMeanCalculator TargetsMean; }; - THashMap<double, TBucket> Buckets; + THashMap<double, TBucket> Buckets; double Step; public: diff --git a/library/cpp/linear_regression/linear_regression_ut.cpp b/library/cpp/linear_regression/linear_regression_ut.cpp index e71a16b67a1..6915c3821d1 100644 --- a/library/cpp/linear_regression/linear_regression_ut.cpp +++ b/library/cpp/linear_regression/linear_regression_ut.cpp @@ -15,8 +15,8 @@ namespace { Y_UNIT_TEST_SUITE(TLinearRegressionTest) { Y_UNIT_TEST(MeanAndDeviationTest) { - TVector<double> arguments; - TVector<double> weights; + TVector<double> arguments; + TVector<double> weights; const size_t argumentsCount = 100; for (size_t i = 0; i < argumentsCount; ++i) { @@ -78,9 +78,9 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { } Y_UNIT_TEST(CovariationTest) { - TVector<double> firstValues; - TVector<double> secondValues; - TVector<double> weights; + TVector<double> firstValues; + TVector<double> secondValues; + TVector<double> weights; const size_t argumentsCount = 100; for (size_t i = 0; i < argumentsCount; ++i) { @@ -130,9 +130,9 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { template <typename TSLRSolverType> void SLRTest() { - TVector<double> arguments; - TVector<double> weights; - TVector<double> goals; + TVector<double> arguments; + TVector<double> weights; + TVector<double> goals; const double factor = 2.; const double intercept = 105.; @@ -194,18 +194,18 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { const size_t instancesCount = 10000; const double randomError = 0.01; - TVector<double> coefficients; + TVector<double> coefficients; for (size_t featureNumber = 0; featureNumber < featuresCount; ++featureNumber) { coefficients.push_back(featureNumber); } const double intercept = 10; TVector<TVector<double>> featuresMatrix; - TVector<double> goals; - TVector<double> weights; + TVector<double> goals; + TVector<double> weights; for (size_t instanceNumber = 0; instanceNumber < instancesCount; ++instanceNumber) { - TVector<double> features; + TVector<double> features; for (size_t featureNumber = 0; featureNumber < featuresCount; ++featureNumber) { features.push_back(RandomNumber<double>()); } @@ -240,8 +240,8 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { } void TransformationTest(const ETransformationType transformationType, const size_t pointsCount) { - TVector<float> arguments; - TVector<float> goals; + TVector<float> arguments; + TVector<float> goals; const double regressionFactor = 10.; const double regressionIntercept = 100; @@ -300,8 +300,8 @@ Y_UNIT_TEST_SUITE(TLinearRegressionTest) { } Y_UNIT_TEST(ResetCalculatorTest) { - TVector<double> arguments; - TVector<double> weights; + TVector<double> arguments; + TVector<double> weights; const double eps = 1e-10; const size_t argumentsCount = 100; diff --git a/library/cpp/linear_regression/unimodal.cpp b/library/cpp/linear_regression/unimodal.cpp index 729011012a0..bbca9e9463a 100644 --- a/library/cpp/linear_regression/unimodal.cpp +++ b/library/cpp/linear_regression/unimodal.cpp @@ -22,7 +22,7 @@ namespace { double SSE = 0.; - TOptimizationState(const TVector<double>& values) { + TOptimizationState(const TVector<double>& values) { SSE = InnerProduct(values, values); } @@ -44,7 +44,7 @@ double TGreedyParams::Point(const size_t step) const { return LowerBound * (1 - alpha) + UpperBound * alpha; } -double MakeUnimodal(TVector<double>& values, const TOptimizationParams& optimizationParams) { +double MakeUnimodal(TVector<double>& values, const TOptimizationParams& optimizationParams) { TOptimizationState state(values); TOptimizationState bestState = state; @@ -80,19 +80,19 @@ double MakeUnimodal(TVector<double>& values, const TOptimizationParams& optimiza return determination; } -double MakeUnimodal(TVector<double>& values) { +double MakeUnimodal(TVector<double>& values) { return MakeUnimodal(values, TOptimizationParams::Default(values)); } -double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments, const TOptimizationParams& optimizationParams) { +double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments, const TOptimizationParams& optimizationParams) { Y_ASSERT(values.size() == arguments.size()); - TMap<double, double> mapping; + TMap<double, double> mapping; for (size_t i = 0; i < values.size(); ++i) { mapping[arguments[i]] = values[i]; } - TVector<double> preparedValues; + TVector<double> preparedValues; preparedValues.reserve(mapping.size()); for (auto&& argWithValue : mapping) { @@ -113,6 +113,6 @@ double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments, c return result; } -double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments) { +double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments) { return MakeUnimodal(values, arguments, TOptimizationParams::Default(values, arguments)); } diff --git a/library/cpp/linear_regression/unimodal.h b/library/cpp/linear_regression/unimodal.h index e11b1118f6c..21d6ae8782e 100644 --- a/library/cpp/linear_regression/unimodal.h +++ b/library/cpp/linear_regression/unimodal.h @@ -21,7 +21,7 @@ struct TOptimizationParams { TOptimizationParams() = default; - static TOptimizationParams Default(const TVector<double>& values) { + static TOptimizationParams Default(const TVector<double>& values) { TOptimizationParams optimizationParams; optimizationParams.ModeParams.LowerBound = 0; @@ -35,7 +35,7 @@ struct TOptimizationParams { return optimizationParams; } - static TOptimizationParams Default(const TVector<double>& values, const TVector<double>& arguments) { + static TOptimizationParams Default(const TVector<double>& values, const TVector<double>& arguments) { Y_ASSERT(values.size() == arguments.size()); TOptimizationParams optimizationParams; @@ -52,8 +52,8 @@ struct TOptimizationParams { } }; -double MakeUnimodal(TVector<double>& values, const TOptimizationParams& optimizationParams); -double MakeUnimodal(TVector<double>& values); +double MakeUnimodal(TVector<double>& values, const TOptimizationParams& optimizationParams); +double MakeUnimodal(TVector<double>& values); -double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments, const TOptimizationParams& optimizationParams); -double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments); +double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments, const TOptimizationParams& optimizationParams); +double MakeUnimodal(TVector<double>& values, const TVector<double>& arguments); diff --git a/library/cpp/logger/backend.cpp b/library/cpp/logger/backend.cpp index b26bf5e88ce..405884960c3 100644 --- a/library/cpp/logger/backend.cpp +++ b/library/cpp/logger/backend.cpp @@ -7,7 +7,7 @@ namespace { class TGlobalLogsStorage { private: - TVector<TLogBackend*> Backends; + TVector<TLogBackend*> Backends; TMutex Mutex; public: @@ -50,11 +50,11 @@ ELogPriority TLogBackend::FiltrationLevel() const { return LOG_MAX_PRIORITY; } -TLogBackend::TLogBackend() noexcept { +TLogBackend::TLogBackend() noexcept { Singleton<TGlobalLogsStorage>()->Register(this); } -TLogBackend::~TLogBackend() { +TLogBackend::~TLogBackend() { Singleton<TGlobalLogsStorage>()->UnRegister(this); } diff --git a/library/cpp/logger/element.cpp b/library/cpp/logger/element.cpp index b510fe16e11..7a3ea3228f3 100644 --- a/library/cpp/logger/element.cpp +++ b/library/cpp/logger/element.cpp @@ -17,7 +17,7 @@ TLogElement::TLogElement(const TLog* parent, ELogPriority priority) Reset(); } -TLogElement::~TLogElement() { +TLogElement::~TLogElement() { try { Finish(); } catch (...) { diff --git a/library/cpp/logger/element.h b/library/cpp/logger/element.h index fc9bff851ff..f5d240d1eee 100644 --- a/library/cpp/logger/element.h +++ b/library/cpp/logger/element.h @@ -13,10 +13,10 @@ class TLogElement: public TTempBufOutput { public: TLogElement(const TLog* parent); TLogElement(const TLog* parent, ELogPriority priority); - + TLogElement(TLogElement&&) noexcept = default; TLogElement& operator=(TLogElement&&) noexcept = default; - + ~TLogElement() override; template <class T> diff --git a/library/cpp/logger/element_ut.cpp b/library/cpp/logger/element_ut.cpp index 32edc52dfb0..bc6f1b4f0f4 100644 --- a/library/cpp/logger/element_ut.cpp +++ b/library/cpp/logger/element_ut.cpp @@ -2,7 +2,7 @@ #include "element.h" #include "stream.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/str.h> #include <util/generic/ptr.h> #include <utility> @@ -26,7 +26,7 @@ void TLogElementTest::TestMoveCtor() { THolder<TLogElement> src = MakeHolder<TLogElement>(&log); - TString message = "Hello, World!"; + TString message = "Hello, World!"; (*src) << message; THolder<TLogElement> dst = MakeHolder<TLogElement>(std::move(*src)); diff --git a/library/cpp/logger/file.cpp b/library/cpp/logger/file.cpp index 15a4946edac..650be581ecc 100644 --- a/library/cpp/logger/file.cpp +++ b/library/cpp/logger/file.cpp @@ -3,14 +3,14 @@ #include <util/system/file.h> #include <util/system/rwlock.h> -#include <util/generic/string.h> +#include <util/generic/string.h> /* * file log */ class TFileLogBackend::TImpl { public: - inline TImpl(const TString& path) + inline TImpl(const TString& path) : File_(OpenFile(path)) { } @@ -30,7 +30,7 @@ public: } private: - static inline TFile OpenFile(const TString& path) { + static inline TFile OpenFile(const TString& path) { return TFile(path, OpenAlways | WrOnly | ForAppend | Seq | NoReuse); } @@ -39,12 +39,12 @@ private: TFile File_; }; -TFileLogBackend::TFileLogBackend(const TString& path) +TFileLogBackend::TFileLogBackend(const TString& path) : Impl_(new TImpl(path)) { } -TFileLogBackend::~TFileLogBackend() { +TFileLogBackend::~TFileLogBackend() { } void TFileLogBackend::WriteData(const TLogRecord& rec) { diff --git a/library/cpp/logger/file.h b/library/cpp/logger/file.h index 10b4cd0c20e..ce6561898fb 100644 --- a/library/cpp/logger/file.h +++ b/library/cpp/logger/file.h @@ -7,7 +7,7 @@ class TFileLogBackend: public TLogBackend { public: - TFileLogBackend(const TString& path); + TFileLogBackend(const TString& path); ~TFileLogBackend() override; void WriteData(const TLogRecord& rec) override; diff --git a/library/cpp/logger/global/common.cpp b/library/cpp/logger/global/common.cpp index 4fb05c19b4b..1b64867546a 100644 --- a/library/cpp/logger/global/common.cpp +++ b/library/cpp/logger/global/common.cpp @@ -3,7 +3,7 @@ #include <util/generic/yexception.h> namespace NLoggingImpl { - TString GetLocalTimeSSimple() { + TString GetLocalTimeSSimple() { struct tm tm; return Strftime("%b%d_%H%M%S", Now().LocalTime(&tm)); } diff --git a/library/cpp/logger/global/common.h b/library/cpp/logger/global/common.h index 7dcf650decb..364097d1bc4 100644 --- a/library/cpp/logger/global/common.h +++ b/library/cpp/logger/global/common.h @@ -4,7 +4,7 @@ #include <util/folder/path.h> #include <util/generic/singleton.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ptr.h> #include <util/generic/yexception.h> #include <util/string/printf.h> @@ -66,7 +66,7 @@ public: namespace NLoggingImpl { - TString GetLocalTimeSSimple(); + TString GetLocalTimeSSimple(); // Returns correct log type to use TString PrepareToOpenLog(TString logType, int logLevel, bool rotation, bool startAsDaemon); diff --git a/library/cpp/logger/global/rty_formater.cpp b/library/cpp/logger/global/rty_formater.cpp index 305f8470c55..57217338604 100644 --- a/library/cpp/logger/global/rty_formater.cpp +++ b/library/cpp/logger/global/rty_formater.cpp @@ -52,12 +52,12 @@ namespace NLoggingImpl { return string.RNextTok(LOCSLASH_C); } - TString GetSystemResources() { + TString GetSystemResources() { NMemInfo::TMemInfo mi = NMemInfo::GetMemInfo(); return PrintSystemResources(mi); } - TString PrintSystemResources(const NMemInfo::TMemInfo& mi) { + TString PrintSystemResources(const NMemInfo::TMemInfo& mi) { return Sprintf(" rss=%0.3fMb, vms=%0.3fMb", mi.RSS * 1.0 / (1024 * 1024), mi.VMS * 1.0 / (1024 * 1024)); } } diff --git a/library/cpp/logger/global/rty_formater.h b/library/cpp/logger/global/rty_formater.h index 6532e1d7695..471a0505988 100644 --- a/library/cpp/logger/global/rty_formater.h +++ b/library/cpp/logger/global/rty_formater.h @@ -40,8 +40,8 @@ namespace NLoggingImpl { return TLocalTimeS(); } - TString GetSystemResources(); - TString PrintSystemResources(const NMemInfo::TMemInfo& info); + TString GetSystemResources(); + TString PrintSystemResources(const NMemInfo::TMemInfo& info); struct TLoggerFormatterTraits { static ILoggerFormatter* CreateDefault() { diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp index e1d70cc3d28..2f5fc333569 100644 --- a/library/cpp/logger/log.cpp +++ b/library/cpp/logger/log.cpp @@ -8,7 +8,7 @@ #include <util/string/cast.h> #include <util/stream/printf.h> #include <util/system/yassert.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/scope.h> #include <util/generic/yexception.h> @@ -146,7 +146,7 @@ TLog::~TLog() = default; TLog& TLog::operator=(const TLog&) = default; TLog& TLog::operator=(TLog&&) = default; -bool TLog::IsOpen() const noexcept { +bool TLog::IsOpen() const noexcept { return Impl_->IsOpen(); } @@ -218,7 +218,7 @@ void TLog::ResetBackend(THolder<TLogBackend> backend) noexcept { Impl_->ResetBackend(std::move(backend)); } -bool TLog::IsNullLog() const noexcept { +bool TLog::IsNullLog() const noexcept { return Impl_->IsNullLog(); } diff --git a/library/cpp/logger/log_ut.cpp b/library/cpp/logger/log_ut.cpp index 8de46f17f57..a46bf5c7b3d 100644 --- a/library/cpp/logger/log_ut.cpp +++ b/library/cpp/logger/log_ut.cpp @@ -7,7 +7,7 @@ #include <util/system/yield.h> #include <util/memory/blob.h> #include <util/stream/file.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> class TLogTest: public TTestBase { @@ -56,7 +56,7 @@ void TLogTest::TestFile() { TBlob data = TBlob::FromFileSingleThreaded(LOGFILE); - UNIT_ASSERT_EQUAL(TString((const char*)data.Begin(), data.Size()), "some useful data 12, 34, 3.000000, qwqwqw\n"); + UNIT_ASSERT_EQUAL(TString((const char*)data.Begin(), data.Size()), "some useful data 12, 34, 3.000000, qwqwqw\n"); } void TLogTest::TestThreaded() { @@ -75,7 +75,7 @@ void TLogTest::TestThreaded() { TBlob data = TBlob::FromFileSingleThreaded(LOGFILE); - UNIT_ASSERT_EQUAL(TString((const char*)data.Begin(), data.Size()), "some useful data 12, 34, 3.000000, qwqwqw\n"); + UNIT_ASSERT_EQUAL(TString((const char*)data.Begin(), data.Size()), "some useful data 12, 34, 3.000000, qwqwqw\n"); } void TLogTest::TestThreadedWithOverflow() { @@ -166,13 +166,13 @@ void TLogTest::TestFormat() { void TLogTest::TestWrite() { TStringStream data; - TString test; + TString test; { TLog log(THolder(new TStreamLogBackend(&data))); for (size_t i = 0; i < 1000; ++i) { - TVector<char> buf(i, (char)i); + TVector<char> buf(i, (char)i); test.append(buf.data(), buf.size()); log.Write(buf.data(), buf.size()); diff --git a/library/cpp/logger/null.cpp b/library/cpp/logger/null.cpp index debb22f7942..2ec47aed535 100644 --- a/library/cpp/logger/null.cpp +++ b/library/cpp/logger/null.cpp @@ -3,7 +3,7 @@ TNullLogBackend::TNullLogBackend() { } -TNullLogBackend::~TNullLogBackend() { +TNullLogBackend::~TNullLogBackend() { } void TNullLogBackend::WriteData(const TLogRecord&) { diff --git a/library/cpp/logger/stream.cpp b/library/cpp/logger/stream.cpp index 96787ad94ba..c1bb222ff7d 100644 --- a/library/cpp/logger/stream.cpp +++ b/library/cpp/logger/stream.cpp @@ -8,7 +8,7 @@ TStreamLogBackend::TStreamLogBackend(IOutputStream* slave) { } -TStreamLogBackend::~TStreamLogBackend() { +TStreamLogBackend::~TStreamLogBackend() { } void TStreamLogBackend::WriteData(const TLogRecord& rec) { diff --git a/library/cpp/logger/system.cpp b/library/cpp/logger/system.cpp index 42233f63d25..0e9a647d281 100644 --- a/library/cpp/logger/system.cpp +++ b/library/cpp/logger/system.cpp @@ -46,7 +46,7 @@ TSysLogBackend::TSysLogBackend(const char* ident, EFacility facility, int flags) #endif } -TSysLogBackend::~TSysLogBackend() { +TSysLogBackend::~TSysLogBackend() { #if defined(_unix_) closelog(); #endif diff --git a/library/cpp/logger/system.h b/library/cpp/logger/system.h index b8c60b30235..471dee3ac1a 100644 --- a/library/cpp/logger/system.h +++ b/library/cpp/logger/system.h @@ -39,7 +39,7 @@ public: void WriteData(const TLogRecord& rec) override; void ReopenLog() override; - virtual TString GetIdent() const { + virtual TString GetIdent() const { return Ident; } @@ -54,7 +54,7 @@ public: protected: int ELogPriority2SyslogPriority(ELogPriority priority); - TString Ident; + TString Ident; EFacility Facility; int Flags; }; diff --git a/library/cpp/logger/thread.cpp b/library/cpp/logger/thread.cpp index 0ccf9e374be..7ff8f86463c 100644 --- a/library/cpp/logger/thread.cpp +++ b/library/cpp/logger/thread.cpp @@ -126,7 +126,7 @@ TThreadedLogBackend::TThreadedLogBackend(TLogBackend* slave, size_t queuelen, st { } -TThreadedLogBackend::~TThreadedLogBackend() { +TThreadedLogBackend::~TThreadedLogBackend() { } void TThreadedLogBackend::WriteData(const TLogRecord& rec) { diff --git a/library/cpp/lwtrace/all.h b/library/cpp/lwtrace/all.h index d7aa57c49d7..df00bdb42c8 100644 --- a/library/cpp/lwtrace/all.h +++ b/library/cpp/lwtrace/all.h @@ -15,7 +15,7 @@ // #include <yweb/robot/kiwi/lwtrace/all.h> // #define MY_PROVIDER(PROBE, EVENT, GROUPS, TYPES, NAMES) \ // name of your provider // PROBE(MyProbe, GROUPS("MyGroup1", "MyGroup2"), TYPES(), NAMES()) \ // probe specification w/o argiments -// PROBE(MyAnotherProbe, GROUPS("MyGroup2"), TYPES(int, TString), NAMES("arg1", "arg2")) \ // another probe with arguments +// PROBE(MyAnotherProbe, GROUPS("MyGroup2"), TYPES(int, TString), NAMES("arg1", "arg2")) \ // another probe with arguments // PROBE(MyScopedProbe, GROUPS(), TYPES(ui64, int), NAMES("duration", "stage")) \ // scoped probe with argument // /**/ // LWTRACE_DECLARE_PROVIDER(MY_PROVIDER) diff --git a/library/cpp/lwtrace/example1/lwtrace_example1.cpp b/library/cpp/lwtrace/example1/lwtrace_example1.cpp index 6b32c405ee2..c1e15572f92 100644 --- a/library/cpp/lwtrace/example1/lwtrace_example1.cpp +++ b/library/cpp/lwtrace/example1/lwtrace_example1.cpp @@ -26,7 +26,7 @@ long double Fact(int n) { void FactorialCalculator() { i32 n; Cout << "Enter a number: "; - TString str; + TString str; Cin >> n; double factN = Fact(n); Cout << n << "! = " << factN << Endl << Endl; diff --git a/library/cpp/lwtrace/example2/lwtrace_example2.cpp b/library/cpp/lwtrace/example2/lwtrace_example2.cpp index 7a4f7a1dafc..9a2fc7193da 100644 --- a/library/cpp/lwtrace/example2/lwtrace_example2.cpp +++ b/library/cpp/lwtrace/example2/lwtrace_example2.cpp @@ -20,7 +20,7 @@ THolder<NLWTrace::TManager> traceManager; struct TConfig { bool UnsafeLWTrace; - TString TraceRequestPath; + TString TraceRequestPath; }; void InitLWTrace(TConfig& cfg) { @@ -28,7 +28,7 @@ void InitLWTrace(TConfig& cfg) { } void AddLWTraceRequest(TConfig& cfg) { - TString queryStr = TUnbufferedFileInput(cfg.TraceRequestPath).ReadAll(); + TString queryStr = TUnbufferedFileInput(cfg.TraceRequestPath).ReadAll(); NLWTrace::TQuery query; google::protobuf::TextFormat::ParseFromString(queryStr, &query); traceManager->New("TraceRequest1", query); @@ -42,7 +42,7 @@ public: Cout << " time=" << item.Timestamp; } if (item.SavedParamsCount > 0) { - TString paramValues[LWTRACE_MAX_PARAMS]; + TString paramValues[LWTRACE_MAX_PARAMS]; item.Probe->Event.Signature.SerializeParams(item.Params, paramValues); Cout << " params: "; for (size_t i = 0; i < item.SavedParamsCount; ++i) { @@ -78,7 +78,7 @@ void FactorialCalculator() { i32 n; Cout << "Enter a number: "; - TString str; + TString str; Cin >> n; GLOBAL_LWPROBE(LWTRACE_EXAMPLE_PROVIDER, AfterInputProbe, n); diff --git a/library/cpp/lwtrace/example3/lwtrace_example3.cpp b/library/cpp/lwtrace/example3/lwtrace_example3.cpp index 4493dc0077b..8556cc484f6 100644 --- a/library/cpp/lwtrace/example3/lwtrace_example3.cpp +++ b/library/cpp/lwtrace/example3/lwtrace_example3.cpp @@ -30,7 +30,7 @@ long double Fact(int n) { void FactorialCalculator() { i32 n; Cout << "Enter a number: "; - TString str; + TString str; Cin >> n; double factN = Fact(n); Cout << n << "! = " << factN << Endl << Endl; diff --git a/library/cpp/lwtrace/example3/my_action.h b/library/cpp/lwtrace/example3/my_action.h index 9a04293ba27..0068774484a 100644 --- a/library/cpp/lwtrace/example3/my_action.h +++ b/library/cpp/lwtrace/example3/my_action.h @@ -8,7 +8,7 @@ class TMyFile: public NLWTrace::IResource { private: TMutex Mutex; - THolder<TUnbufferedFileOutput> File; + THolder<TUnbufferedFileOutput> File; public: // Note that this class must have default ctor (it's declared here just for clearness) @@ -27,7 +27,7 @@ public: // if the same file was specified in Opts return; } - File.Reset(new TUnbufferedFileOutput(path)); + File.Reset(new TUnbufferedFileOutput(path)); } // Outputs a line to opened file @@ -63,7 +63,7 @@ public: private: virtual bool DoExecute(NLWTrace::TOrbit&, const NLWTrace::TParams& params) { // Serialize param values to strings - TString paramValues[LWTRACE_MAX_PARAMS]; + TString paramValues[LWTRACE_MAX_PARAMS]; Probe->Event.Signature.SerializeParams(params, paramValues); // Generate output line diff --git a/library/cpp/lwtrace/example4/lwtrace_example4.cpp b/library/cpp/lwtrace/example4/lwtrace_example4.cpp index 7b55a07c75d..4c1088d26b4 100644 --- a/library/cpp/lwtrace/example4/lwtrace_example4.cpp +++ b/library/cpp/lwtrace/example4/lwtrace_example4.cpp @@ -34,7 +34,7 @@ void FactorialCalculator() { MY_BACKTRACK(); i32 n; Cout << "Enter a number: "; - TString str; + TString str; Cin >> n; double factN = Fact(n); Cout << n << "! = " << factN << Endl << Endl; diff --git a/library/cpp/lwtrace/mon/analytics/csv_output.h b/library/cpp/lwtrace/mon/analytics/csv_output.h index 90ded32f5dd..47e0805e1e1 100644 --- a/library/cpp/lwtrace/mon/analytics/csv_output.h +++ b/library/cpp/lwtrace/mon/analytics/csv_output.h @@ -7,9 +7,9 @@ namespace NAnalytics { -inline TString ToCsv(const TTable& in, TString sep = TString("\t"), bool head = true) +inline TString ToCsv(const TTable& in, TString sep = TString("\t"), bool head = true) { - TSet<TString> cols; + TSet<TString> cols; bool hasName = false; for (const TRow& row : in) { hasName = hasName || !row.Name.empty(); @@ -22,11 +22,11 @@ inline TString ToCsv(const TTable& in, TString sep = TString("\t"), bool head = if (head) { bool first = true; if (hasName) { - ss << (first? TString(): sep) << "Name"; + ss << (first? TString(): sep) << "Name"; first = false; } - for (const TString& c : cols) { - ss << (first? TString(): sep) << c; + for (const TString& c : cols) { + ss << (first? TString(): sep) << c; first = false; } ss << Endl; @@ -35,11 +35,11 @@ inline TString ToCsv(const TTable& in, TString sep = TString("\t"), bool head = for (const TRow& row : in) { bool first = true; if (hasName) { - ss << (first? TString(): sep) << row.Name; + ss << (first? TString(): sep) << row.Name; first = false; } - for (const TString& c : cols) { - ss << (first? TString(): sep); + for (const TString& c : cols) { + ss << (first? TString(): sep); first = false; TString value; ss << (row.GetAsString(c, value) ? value : TString("-")); diff --git a/library/cpp/lwtrace/mon/analytics/data.h b/library/cpp/lwtrace/mon/analytics/data.h index 4b643fe20b5..fe635d42095 100644 --- a/library/cpp/lwtrace/mon/analytics/data.h +++ b/library/cpp/lwtrace/mon/analytics/data.h @@ -1,8 +1,8 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/hash.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/string/builder.h> #include <util/string/cast.h> @@ -21,7 +21,7 @@ TString ToString(const TRowValue& val) { } struct TRow : public THashMap<TString, TRowValue> { - TString Name; + TString Name; template<typename T> bool Get(const TString& name, T& value) const { @@ -57,18 +57,18 @@ struct TRow : public THashMap<TString, TRowValue> { } }; -using TAttributes = THashMap<TString, TString>; +using TAttributes = THashMap<TString, TString>; -struct TTable : public TVector<TRow> { +struct TTable : public TVector<TRow> { TAttributes Attributes; }; -struct TMatrix : public TVector<double> { +struct TMatrix : public TVector<double> { size_t Rows; size_t Cols; explicit TMatrix(size_t rows = 0, size_t cols = 0) - : TVector<double>(rows * cols) + : TVector<double>(rows * cols) , Rows(rows) , Cols(cols) {} diff --git a/library/cpp/lwtrace/mon/analytics/html_output.h b/library/cpp/lwtrace/mon/analytics/html_output.h index f775f216b9c..3b63a1ce5f1 100644 --- a/library/cpp/lwtrace/mon/analytics/html_output.h +++ b/library/cpp/lwtrace/mon/analytics/html_output.h @@ -7,9 +7,9 @@ namespace NAnalytics { -inline TString ToHtml(const TTable& in) +inline TString ToHtml(const TTable& in) { - TSet<TString> cols; + TSet<TString> cols; bool hasName = false; for (const TRow& row : in) { hasName = hasName || !row.Name.empty(); @@ -24,7 +24,7 @@ inline TString ToHtml(const TTable& in) if (hasName) { ss << "<th>Name</th>"; } - for (const TString& c : cols) { + for (const TString& c : cols) { ss << "<th>" << c << "</th>"; } ss << "</tr></thead><tbody>"; @@ -34,7 +34,7 @@ inline TString ToHtml(const TTable& in) if (hasName) { ss << "<th>" << row.Name << "</th>"; } - for (const TString& c : cols) { + for (const TString& c : cols) { TString value; ss << "<td>" << (row.GetAsString(c, value) ? value : TString("-")) << "</td>"; } @@ -45,9 +45,9 @@ inline TString ToHtml(const TTable& in) return ss.Str(); } -inline TString ToTransposedHtml(const TTable& in) +inline TString ToTransposedHtml(const TTable& in) { - TSet<TString> cols; + TSet<TString> cols; bool hasName = false; for (const TRow& row : in) { hasName = hasName || !row.Name.empty(); @@ -69,7 +69,7 @@ inline TString ToTransposedHtml(const TTable& in) ss << "</thead><tbody>"; - for (const TString& c : cols) { + for (const TString& c : cols) { ss << "<tr>"; ss << "<th>" << c << "</th>"; for (const TRow& row : in) { diff --git a/library/cpp/lwtrace/mon/analytics/json_output.h b/library/cpp/lwtrace/mon/analytics/json_output.h index 189f9802d3c..b03392e162a 100644 --- a/library/cpp/lwtrace/mon/analytics/json_output.h +++ b/library/cpp/lwtrace/mon/analytics/json_output.h @@ -10,26 +10,26 @@ namespace NAnalytics { -inline TString ToJsonFlot(const TTable& in, const TString& xno, const TVector<TString>& ynos, const TString& opts = TString()) +inline TString ToJsonFlot(const TTable& in, const TString& xno, const TVector<TString>& ynos, const TString& opts = TString()) { TStringStream ss; ss << "[ "; bool first = true; - TString xn; - THashSet<TString> xopts; + TString xn; + THashSet<TString> xopts; ParseNameAndOpts(xno, xn, xopts); bool xstack = xopts.contains("stack"); - for (const TString& yno : ynos) { - TString yn; - THashSet<TString> yopts; + for (const TString& yno : ynos) { + TString yn; + THashSet<TString> yopts; ParseNameAndOpts(yno, yn, yopts); bool ystackOpt = yopts.contains("stack"); ss << (first? "": ",\n ") << "{ " << opts << (opts? ", ": "") << "\"label\": \"" << yn << "\", \"data\": [ "; bool first2 = true; - using TPt = std::tuple<double, double, TString>; + using TPt = std::tuple<double, double, TString>; std::vector<TPt> pts; for (const TRow& row : in) { double x, y; diff --git a/library/cpp/lwtrace/mon/analytics/transform.h b/library/cpp/lwtrace/mon/analytics/transform.h index f7dc9adb5b9..60f7aac3793 100644 --- a/library/cpp/lwtrace/mon/analytics/transform.h +++ b/library/cpp/lwtrace/mon/analytics/transform.h @@ -6,14 +6,14 @@ namespace NAnalytics { template <class TSkip, class TX, class TY> inline TTable Histogram(const TTable& in, TSkip skip, - const TString& xn_out, TX x_in, - const TString& yn_out, TY y_in, + const TString& xn_out, TX x_in, + const TString& yn_out, TY y_in, double x1, double x2, double dx) { long buckets = (x2 - x1) / dx; TTable out; - TString yn_sum = yn_out + "_sum"; - TString yn_share = yn_out + "_share"; + TString yn_sum = yn_out + "_sum"; + TString yn_share = yn_out + "_share"; double ysum = 0.0; out.resize(buckets); for (size_t i = 0; i < out.size(); i++) { @@ -46,14 +46,14 @@ inline TTable Histogram(const TTable& in, TSkip skip, return out; } -inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, double x2, double dx) +inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, double x2, double dx) { long buckets = (dx == 0.0? 1: (x2 - x1) / dx); TTable out; - THashMap<TString, double> colSum; + THashMap<TString, double> colSum; out.resize(buckets); - TSet<TString> cols; + TSet<TString> cols; for (auto& row : in) { for (auto& kv : row) { cols.insert(kv.first); @@ -62,7 +62,7 @@ inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, doubl cols.insert("_count"); cols.erase(xn); - for (const TString& col : cols) { + for (const TString& col : cols) { colSum[col] = 0.0; } @@ -72,7 +72,7 @@ inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, doubl TRow& row = out[i]; row.Name = "[" + ToString(lb) + ";" + ToString(ub) + (ub==x2? "]": ")"); row[xn] = (lb + ub) / 2; - for (const TString& col : cols) { + for (const TString& col : cols) { row[col + "_sum"] = 0.0; } } @@ -86,7 +86,7 @@ inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, doubl i--; } for (const auto& kv : row_in) { - const TString& yn = kv.first; + const TString& yn = kv.first; if (yn == xn) { continue; } @@ -116,7 +116,7 @@ inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, doubl } } for (TRow& row : out) { - for (const TString& col : cols) { + for (const TString& col : cols) { double ysum = colSum[col]; if (col != "_count") { if (row.GetOrDefault(col + "_cnt") != 0.0) { @@ -133,7 +133,7 @@ inline TTable HistogramAll(const TTable& in, const TString& xn, double x1, doubl inline TMatrix CovarianceMatrix(const TTable& in) { - TSet<TString> cols; + TSet<TString> cols; for (auto& row : in) { for (auto& kv : row) { cols.insert(kv.first); @@ -147,7 +147,7 @@ inline TMatrix CovarianceMatrix(const TTable& in) double Mean = 0; }; - THashMap<TString, TAggregate> colAggr; + THashMap<TString, TAggregate> colAggr; size_t colCount = 0; for (const TString& col : cols) { diff --git a/library/cpp/lwtrace/mon/analytics/util.h b/library/cpp/lwtrace/mon/analytics/util.h index e07d06cc43f..e4b067f8a9e 100644 --- a/library/cpp/lwtrace/mon/analytics/util.h +++ b/library/cpp/lwtrace/mon/analytics/util.h @@ -13,7 +13,7 @@ inline double Finitize(double x, double notFiniteValue = 0.0) return isfinite(x)? x: notFiniteValue; } -inline void ParseNameAndOpts(const TString& nameAndOpts, TString& name, THashSet<TString>& opts) +inline void ParseNameAndOpts(const TString& nameAndOpts, TString& name, THashSet<TString>& opts) { name.clear(); opts.clear(); @@ -29,18 +29,18 @@ inline void ParseNameAndOpts(const TString& nameAndOpts, TString& name, THashSet } } -inline TString ParseName(const TString& nameAndOpts) +inline TString ParseName(const TString& nameAndOpts) { auto vs = SplitString(nameAndOpts, "-"); if (vs.empty()) { - return TString(); + return TString(); } else { return vs[0]; } } template <class R, class T> -inline R AccumulateIfExist(const TString& name, const TTable& table, R r, T t) +inline R AccumulateIfExist(const TString& name, const TTable& table, R r, T t) { ForEach(table.begin(), table.end(), [=,&r] (const TRow& row) { double value; @@ -51,10 +51,10 @@ inline R AccumulateIfExist(const TString& name, const TTable& table, R r, T t) return r; } -inline double MinValue(const TString& nameAndOpts, const TTable& table) +inline double MinValue(const TString& nameAndOpts, const TTable& table) { - TString name; - THashSet<TString> opts; + TString name; + THashSet<TString> opts; ParseNameAndOpts(nameAndOpts, name, opts); bool stack = opts.contains("stack"); if (stack) { @@ -68,10 +68,10 @@ inline double MinValue(const TString& nameAndOpts, const TTable& table) } } -inline double MaxValue(const TString& nameAndOpts, const TTable& table) +inline double MaxValue(const TString& nameAndOpts, const TTable& table) { - TString name; - THashSet<TString> opts; + TString name; + THashSet<TString> opts; ParseNameAndOpts(nameAndOpts, name, opts); bool stack = opts.contains("stack"); if (stack) { @@ -88,14 +88,14 @@ inline double MaxValue(const TString& nameAndOpts, const TTable& table) } template <class T> -inline void Map(TTable& table, const TString& rname, T t) +inline void Map(TTable& table, const TString& rname, T t) { ForEach(table.begin(), table.end(), [=] (TRow& row) { row[rname] = t(row); }); } -inline std::function<bool(const TRow&)> HasNoValueFor(TString name) +inline std::function<bool(const TRow&)> HasNoValueFor(TString name) { return [=] (const TRow& row) -> bool { double value; @@ -104,7 +104,7 @@ inline std::function<bool(const TRow&)> HasNoValueFor(TString name) } -inline std::function<double(const TRow&)> GetValueFor(TString name, double defVal = 0.0) +inline std::function<double(const TRow&)> GetValueFor(TString name, double defVal = 0.0) { return [=] (const TRow& row) -> double { double value; diff --git a/library/cpp/lwtrace/mon/mon_lwtrace.cpp b/library/cpp/lwtrace/mon/mon_lwtrace.cpp index a61ee9ce22d..4a61498b769 100644 --- a/library/cpp/lwtrace/mon/mon_lwtrace.cpp +++ b/library/cpp/lwtrace/mon/mon_lwtrace.cpp @@ -55,7 +55,7 @@ struct TTrackLogRefs { operator const NLWTrace::TLogItem&() const { return *Ptr; } }; - using TItems = TVector<TItem>; + using TItems = TVector<TItem>; TItems Items; TTrackLogRefs() {} @@ -278,10 +278,10 @@ private: } }; - TString Text; - TString Provider; - TString Probe; - TString ParamName; + TString Text; + TString Provider; + TString Probe; + TString ParamName; ESpecialParam SpecialParam = NotSpecial; i64 Index = 0; double TimeUnitSec = 1.0; @@ -292,7 +292,7 @@ private: public: TLogQuery() {} - explicit TLogQuery(const TString& text) + explicit TLogQuery(const TString& text) : Text(text) { try { @@ -350,7 +350,7 @@ private: return NLWTrace::TTypedParam(sec / TimeUnitSec); } - void ParseQuery(const TString& s) + void ParseQuery(const TString& s) { auto parts = SplitString(s, "."); WWW_CHECK(parts.size() <= 3, "too many name specifiers"); @@ -363,26 +363,26 @@ private: } } - void ParseParamSelector(const TString& s) + void ParseParamSelector(const TString& s) { size_t bracket = s.find('['); - if (bracket == TString::npos) { + if (bracket == TString::npos) { ParseParamName(s); Index = 0; } else { ParseParamName(s.substr(0, bracket)); size_t bracket2 = s.find(']', bracket); - WWW_CHECK(bracket2 != TString::npos, "closing braket ']' is missing"); + WWW_CHECK(bracket2 != TString::npos, "closing braket ']' is missing"); Index = FromString<i64>(s.substr(bracket + 1, bracket2 - bracket - 1)); } } - void ParseParamName(const TString& s) + void ParseParamName(const TString& s) { ParamName = s; - TString paramName = s; + TString paramName = s; - const static TVector<std::pair<TString, ESpecialParam>> specials = { + const static TVector<std::pair<TString, ESpecialParam>> specials = { { "_track", TrackDuration }, { "_begin", TrackBeginTime }, { "_end", TrackEndTime }, @@ -405,7 +405,7 @@ private: return; } - const static TVector<std::pair<TString, double>> timeUnits = { + const static TVector<std::pair<TString, double>> timeUnits = { { "Ms", 1e-3 }, { "Us", 1e-6 }, { "Ns", 1e-9 }, @@ -428,7 +428,7 @@ private: SpecialParam == TrackEndTime) { // Parse time zero for special instant params - const TVector<std::pair<TString, i64>> timeZeros = { + const TVector<std::pair<TString, i64>> timeZeros = { { "RTime", RTimeZeroTs }, { "NTime", NTimeZeroTs }, { "Time", 0ll } @@ -447,23 +447,23 @@ private: WWW_CHECK(paramName.empty(), "wrong special param name: %s", s.data()); } - void ParseProbeSelector(const TString& s) + void ParseProbeSelector(const TString& s) { Probe = s; } - void ParseProviderSelector(const TString& s) + void ParseProviderSelector(const TString& s) { Provider = s; } }; -using TVariants = TVector<std::pair<TString, TString>>; -using TTags = TSet<TString>; +using TVariants = TVector<std::pair<TString, TString>>; +using TTags = TSet<TString>; -TString GetProbeName(const NLWTrace::TProbe* probe, const char* sep = ".") +TString GetProbeName(const NLWTrace::TProbe* probe, const char* sep = ".") { - return TString(probe->Event.GetProvider()) + sep + probe->Event.Name; + return TString(probe->Event.GetProvider()) + sep + probe->Event.Name; } struct TAdHocTraceConfig { @@ -485,7 +485,7 @@ struct TAdHocTraceConfig { } } - TAdHocTraceConfig(const TString& provider, const TString& probe, ui16 logSize = 0, ui64 logDurationUs = 0, bool logShuttle = false) + TAdHocTraceConfig(const TString& provider, const TString& probe, ui16 logSize = 0, ui64 logDurationUs = 0, bool logShuttle = false) : TAdHocTraceConfig(logSize, logDurationUs, logShuttle) { auto block = Cfg.MutableBlocks(0); @@ -494,7 +494,7 @@ struct TAdHocTraceConfig { pdesc->SetName(probe); } - explicit TAdHocTraceConfig(const TString& group, ui16 logSize = 0, ui64 logDurationUs = 0, bool logShuttle = false) + explicit TAdHocTraceConfig(const TString& group, ui16 logSize = 0, ui64 logDurationUs = 0, bool logShuttle = false) : TAdHocTraceConfig(logSize, logDurationUs, logShuttle) { auto block = Cfg.MutableBlocks(0); @@ -502,7 +502,7 @@ struct TAdHocTraceConfig { pdesc->SetGroup(group); } - TString Id() const + TString Id() const { TStringStream ss; for (size_t blockIdx = 0; blockIdx < Cfg.BlocksSize(); blockIdx++) { @@ -572,7 +572,7 @@ struct TAdHocTraceConfig { return Cfg; } - bool ParseId(const TString& id) + bool ParseId(const TString& id) { if (IsAdHocId(id)) { for (const TString& block : SplitString(id, "/")) { @@ -592,7 +592,7 @@ struct TAdHocTraceConfig { } bool defaultAction = true; for (auto i = parts.begin() + 2, e = parts.end(); i != e; ++i) { - const TString& part = *i; + const TString& part = *i; if (part.empty()) { continue; } @@ -614,12 +614,12 @@ struct TAdHocTraceConfig { return false; } private: - static bool IsAdHocId(const TString& id) + static bool IsAdHocId(const TString& id) { return !id.empty() && id[0] == '.'; } - void ParsePredicate(NLWTrace::TOperator* op, const TString& p) + void ParsePredicate(NLWTrace::TOperator* op, const TString& p) { size_t sign = p.find_first_of("=!><"); WWW_CHECK(sign != TString::npos, "wrong predicate format in adhoc trace: %s", p.data()); @@ -661,7 +661,7 @@ private: op->AddArgument()->SetValue(p.substr(value)); } - void ParseAction(NLWTrace::TAction* action, const TString& a) + void ParseAction(NLWTrace::TAction* action, const TString& a) { // NOTE: checks for longer action names should go first, your captain. if (a.substr(0, 3) == "lsr") { @@ -704,7 +704,7 @@ private: } } - static ui64 ParseDuration(const TString& s) + static ui64 ParseDuration(const TString& s) { if (s.substr(s.length() - 2) == "us") return FromString<ui64>(s.substr(0, s.length() - 2)); @@ -727,7 +727,7 @@ private: TMutex Mtx; TCondVar WakeCondVar; - THashMap<TString, TInstant> Deadlines; + THashMap<TString, TInstant> Deadlines; volatile bool ThreadIsRunning = false; THolder<TThread> Thread; public: @@ -743,7 +743,7 @@ public: } // Returns deadline for specified trace id or zero - TInstant GetDeadline(const TString& id) const + TInstant GetDeadline(const TString& id) const { TGuard<TMutex> g(Mtx); auto iter = Deadlines.find(id); @@ -751,7 +751,7 @@ public: } // Postpone deletion of specified trace for specified timeout - void Postpone(const TString& id, TDuration timeout, bool allowLowering) + void Postpone(const TString& id, TDuration timeout, bool allowLowering) { TGuard<TMutex> g(Mtx); TInstant newDeadline = TInstant::Now() + timeout; @@ -770,7 +770,7 @@ public: } // Forget about specified trace deletion - void Forget(const TString& id) + void Forget(const TString& id) { TGuard<TMutex> g(Mtx); Deadlines.erase(id); @@ -786,7 +786,7 @@ private: TInstant now = TInstant::Now(); TInstant nextDeadline = TInstant::Max(); for (auto i = Deadlines.begin(), e = Deadlines.end(); i != e;) { - const TString& id = i->first; + const TString& id = i->first; TInstant deadline = i->second; if (deadline < now) { try { @@ -814,7 +814,7 @@ private: static void* ThreadProc(void* _this) { - TString name = "LWTraceCleaner"; + TString name = "LWTraceCleaner"; // Copy-pasted from kikimr/core/util/thread.h #if defined(_linux_) TStringStream linuxName; @@ -830,18 +830,18 @@ private: class TChromeTrace { private: - TMultiMap<double, TString> TraceEvents; - THashMap<TThread::TId, TString> Tids; + TMultiMap<double, TString> TraceEvents; + THashMap<TThread::TId, TString> Tids; public: - void Add(TThread::TId tid, ui64 tsCycles, const TString& ph, const TString& cat, + void Add(TThread::TId tid, ui64 tsCycles, const TString& ph, const TString& cat, const NLWTrace::TLogItem* argsItem = nullptr, - const TString& name = TString(), const TString& id = TString()) + const TString& name = TString(), const TString& id = TString()) { auto tidIter = Tids.find(tid); if (tidIter == Tids.end()) { tidIter = Tids.emplace(tid, ToString(Tids.size() + 1)).first; } - const TString& shortId = tidIter->second; + const TString& shortId = tidIter->second; double ts = Timestamp(tsCycles); TraceEvents.emplace(ts, Event(shortId, ts, ph, cat, argsItem, name, id)); } @@ -861,9 +861,9 @@ public: } private: - static TString Event(const TString& tid, double ts, const TString& ph, const TString& cat, + static TString Event(const TString& tid, double ts, const TString& ph, const TString& cat, const NLWTrace::TLogItem* argsItem, - const TString& name, const TString& id) + const TString& name, const TString& id) { TStringStream ss; pid_t pid = 1; @@ -880,14 +880,14 @@ private: } if (argsItem && argsItem->SavedParamsCount > 0) { ss << ",\"args\":{"; - TString paramValues[LWTRACE_MAX_PARAMS]; + TString paramValues[LWTRACE_MAX_PARAMS]; argsItem->Probe->Event.Signature.SerializeParams(argsItem->Params, paramValues); bool first = true; for (size_t pi = 0; pi < argsItem->SavedParamsCount; pi++, first = false) { if (!first) { ss << ","; } - ss << "\"" << TString(argsItem->Probe->Event.Signature.ParamNames[pi]) << "\":" + ss << "\"" << TString(argsItem->Probe->Event.Signature.ParamNames[pi]) << "\":" "\"" << paramValues[pi] << "\""; } ss << "}"; @@ -919,7 +919,7 @@ TString MakeUrl(const TCgiParameters& e, const THashMap<TString, TString>& value return ss.Str(); } -TString MakeUrl(const TCgiParameters& e, const TString& key, const TString& value, bool keep = false) +TString MakeUrl(const TCgiParameters& e, const TString& key, const TString& value, bool keep = false) { TStringStream ss; bool first = true; @@ -933,7 +933,7 @@ TString MakeUrl(const TCgiParameters& e, const TString& key, const TString& valu return ss.Str(); } -TString MakeUrlAdd(const TCgiParameters& e, const TString& key, const TString& value) +TString MakeUrlAdd(const TCgiParameters& e, const TString& key, const TString& value) { TStringStream ss; bool first = true; @@ -945,7 +945,7 @@ TString MakeUrlAdd(const TCgiParameters& e, const TString& key, const TString& v return ss.Str(); } -TString MakeUrlReplace(const TCgiParameters& e, const TString& key, const TString& oldValue, const TString& newValue) +TString MakeUrlReplace(const TCgiParameters& e, const TString& key, const TString& oldValue, const TString& newValue) { TStringStream ss; bool first = true; @@ -968,7 +968,7 @@ TString MakeUrlReplace(const TCgiParameters& e, const TString& key, const TStrin return ss.Str(); } -TString MakeUrlErase(const TCgiParameters& e, const TString& key, const TString& value) +TString MakeUrlErase(const TCgiParameters& e, const TString& key, const TString& value) { TStringStream ss; bool first = true; @@ -981,9 +981,9 @@ TString MakeUrlErase(const TCgiParameters& e, const TString& key, const TString& return ss.Str(); } -TString EscapeSubvalue(const TString& s) +TString EscapeSubvalue(const TString& s) { - TString ret; + TString ret; ret.reserve(s.size()); for (size_t i = 0; i < s.size(); i++) { char c = s[i]; @@ -998,9 +998,9 @@ TString EscapeSubvalue(const TString& s) return ret; } -TString UnescapeSubvalue(const TString& s) +TString UnescapeSubvalue(const TString& s) { - TString ret; + TString ret; ret.reserve(s.size()); for (size_t i = 0; i < s.size(); i++) { char c = s[i]; @@ -1021,12 +1021,12 @@ TString UnescapeSubvalue(const TString& s) return ret; } -TVector<TString> Subvalues(const TCgiParameters& e, const TString& key) +TVector<TString> Subvalues(const TCgiParameters& e, const TString& key) { if (!e.Has(key)) { - return TVector<TString>(); + return TVector<TString>(); } else { - TVector<TString> ret; + TVector<TString> ret; for (const TString& s : SplitString(e.Get(key), ":", 0, KEEP_EMPTY_TOKENS)) { ret.push_back(UnescapeSubvalue(s)); } @@ -1037,44 +1037,44 @@ TVector<TString> Subvalues(const TCgiParameters& e, const TString& key) } } -TString ParseTagsOut(const TString& taggedStr, TTags& tags) +TString ParseTagsOut(const TString& taggedStr, TTags& tags) { auto vec = SplitString(taggedStr, "-"); if (vec.empty()) { return ""; } auto iter = vec.begin(); - TString value = *iter++; + TString value = *iter++; for (;iter != vec.end(); ++iter) { tags.insert(*iter); } return value; } -TString JoinTags(TTags tags) { - return JoinStrings(TVector<TString>(tags.begin(), tags.end()), "-"); +TString JoinTags(TTags tags) { + return JoinStrings(TVector<TString>(tags.begin(), tags.end()), "-"); } -TString MakeValue(const TVector<TString>& subvalues) +TString MakeValue(const TVector<TString>& subvalues) { - TVector<TString> subvaluesEsc; - for (const TString& s : subvalues) { + TVector<TString> subvaluesEsc; + for (const TString& s : subvalues) { subvaluesEsc.push_back(EscapeSubvalue(s)); } - return JoinStrings(subvaluesEsc, ":"); + return JoinStrings(subvaluesEsc, ":"); } -TString MakeUrlAddSub(const TCgiParameters& e, const TString& key, const TString& subvalue) +TString MakeUrlAddSub(const TCgiParameters& e, const TString& key, const TString& subvalue) { - const TString& value = e.Get(key); + const TString& value = e.Get(key); auto subvalues = Subvalues(e, key); subvalues.push_back(subvalue); return MakeUrlReplace(e, key, value, MakeValue(subvalues)); } -TString MakeUrlReplaceSub(const TCgiParameters& e, const TString& key, const TString& oldSubvalue, const TString& newSubvalue) +TString MakeUrlReplaceSub(const TCgiParameters& e, const TString& key, const TString& oldSubvalue, const TString& newSubvalue) { - const TString& value = e.Get(key); + const TString& value = e.Get(key); auto subvalues = Subvalues(e, key); auto iter = std::find(subvalues.begin(), subvalues.end(), oldSubvalue); if (iter != subvalues.end()) { @@ -1085,9 +1085,9 @@ TString MakeUrlReplaceSub(const TCgiParameters& e, const TString& key, const TSt return MakeUrlReplace(e, key, value, MakeValue(subvalues)); } -TString MakeUrlEraseSub(const TCgiParameters& e, const TString& key, const TString& subvalue) +TString MakeUrlEraseSub(const TCgiParameters& e, const TString& key, const TString& subvalue) { - const TString& value = e.Get(key); + const TString& value = e.Get(key); auto subvalues = Subvalues(e, key); auto iter = std::find(subvalues.begin(), subvalues.end(), subvalue); if (iter != subvalues.end()) { @@ -1100,27 +1100,27 @@ TString MakeUrlEraseSub(const TCgiParameters& e, const TString& key, const TStri } } -template <bool sub> TString UrlAdd(const TCgiParameters& e, const TString& key, const TString& value); -template <> TString UrlAdd<false>(const TCgiParameters& e, const TString& key, const TString& value) { +template <bool sub> TString UrlAdd(const TCgiParameters& e, const TString& key, const TString& value); +template <> TString UrlAdd<false>(const TCgiParameters& e, const TString& key, const TString& value) { return MakeUrlAdd(e, key, value); } -template <> TString UrlAdd<true>(const TCgiParameters& e, const TString& key, const TString& value) { +template <> TString UrlAdd<true>(const TCgiParameters& e, const TString& key, const TString& value) { return MakeUrlAddSub(e, key, value); } -template <bool sub> TString UrlReplace(const TCgiParameters& e, const TString& key, const TString& oldValue, const TString& newValue); -template <> TString UrlReplace<false>(const TCgiParameters& e, const TString& key, const TString& oldValue, const TString& newValue) { +template <bool sub> TString UrlReplace(const TCgiParameters& e, const TString& key, const TString& oldValue, const TString& newValue); +template <> TString UrlReplace<false>(const TCgiParameters& e, const TString& key, const TString& oldValue, const TString& newValue) { return MakeUrlReplace(e, key, oldValue, newValue); } -template <> TString UrlReplace<true>(const TCgiParameters& e, const TString& key, const TString& oldValue, const TString& newValue) { +template <> TString UrlReplace<true>(const TCgiParameters& e, const TString& key, const TString& oldValue, const TString& newValue) { return MakeUrlReplaceSub(e, key, oldValue, newValue); } -template <bool sub> TString UrlErase(const TCgiParameters& e, const TString& key, const TString& value); -template <> TString UrlErase<false>(const TCgiParameters& e, const TString& key, const TString& value) { +template <bool sub> TString UrlErase(const TCgiParameters& e, const TString& key, const TString& value); +template <> TString UrlErase<false>(const TCgiParameters& e, const TString& key, const TString& value) { return MakeUrlErase(e, key, value); } -template <> TString UrlErase<true>(const TCgiParameters& e, const TString& key, const TString& value) { +template <> TString UrlErase<true>(const TCgiParameters& e, const TString& key, const TString& value) { return MakeUrlEraseSub(e, key, value); } @@ -1157,7 +1157,7 @@ struct TScopedHtmlInner { IOutputStream &Str; }; -TString NavbarHeader() +TString NavbarHeader() { return "<div class=\"navbar-header\">" "<a class=\"navbar-brand\" href=\"?mode=\">LWTrace</a>" @@ -1203,8 +1203,8 @@ class TPageGenBase: public std::exception {}; template <class TContainer = TNullContainer> class TPageGen: public TPageGenBase { private: - TString Content; - TString HttpResponse; + TString Content; + TString HttpResponse; public: void BuildResponse() { @@ -1216,19 +1216,19 @@ public: HttpResponse = ss.Str(); } - explicit TPageGen(const TString& content = TString()) + explicit TPageGen(const TString& content = TString()) : Content(content) { BuildResponse(); } - void Append(const TString& moreContent) + void Append(const TString& moreContent) { Content.append(moreContent); BuildResponse(); } - void Prepend(const TString& moreContent) + void Prepend(const TString& moreContent) { Content.prepend(moreContent); BuildResponse(); @@ -1264,7 +1264,7 @@ enum EStyleFlags { }; template <ui64 flags> -TString BtnClass() { +TString BtnClass() { if ((flags & SizeMask) == Large) { return "btn btn-lg"; } else if ((flags & SizeMask) == Small) { @@ -1317,17 +1317,17 @@ void DropdownItem(IOutputStream& os, const TString& text, const TString& href, b os << "<li><a href=\"" << href << "\">" << text << "</a></li>"; } -TString SuggestSelection() +TString SuggestSelection() { return "--- "; } -TString RemoveSelection() +TString RemoveSelection() { return "Remove"; } -TString GetDescription(const TString& value, const TVariants& variants) +TString GetDescription(const TString& value, const TVariants& variants) { for (const auto& var : variants) { if (value == var.first) { @@ -1342,7 +1342,7 @@ TString GetDescription(const TString& value, const TVariants& variants) template <ui64 flags, bool sub = false> void DropdownSelector(IOutputStream& os, const TCgiParameters& e, const TString& param, const TString& value, - const TString& text, const TVariants& variants, const TString& realValue = TString()) + const TString& text, const TVariants& variants, const TString& realValue = TString()) { HTML(os) { SelectorTitle(os, text); @@ -1373,25 +1373,25 @@ void DropdownSelector(IOutputStream& os, const TCgiParameters& e, const TString& } } -void RequireSelection(TStringStream& ss, const TCgiParameters& e, const TString& param, - const TString& text, const TVariants& variants) +void RequireSelection(TStringStream& ss, const TCgiParameters& e, const TString& param, + const TString& text, const TVariants& variants) { - const TString& value = e.Get(param); + const TString& value = e.Get(param); DropdownSelector<Link>(ss, e, param, value, text, variants); if (!value) { throw TPageGen<TSelectorsContainer>(ss.Str()); } } -void RequireMultipleSelection(TStringStream& ss, const TCgiParameters& e, const TString& param, - const TString& text, const TVariants& variants) +void RequireMultipleSelection(TStringStream& ss, const TCgiParameters& e, const TString& param, + const TString& text, const TVariants& variants) { SelectorTitle(ss, text); - TSet<TString> selectedValues; - for (const TString& subvalue : Subvalues(e, param)) { + TSet<TString> selectedValues; + for (const TString& subvalue : Subvalues(e, param)) { selectedValues.insert(subvalue); } - for (const TString& subvalue : Subvalues(e, param)) { + for (const TString& subvalue : Subvalues(e, param)) { DropdownSelector<Erasable, true>(ss, e, param, subvalue, "", variants); } if (selectedValues.contains("")) { @@ -1422,17 +1422,17 @@ void OptionalSelection(TStringStream& ss, const TCgiParameters& e, const TString } } -void OptionalMultipleSelection(TStringStream& ss, const TCgiParameters& e, const TString& param, - const TString& text, const TVariants& variants) +void OptionalMultipleSelection(TStringStream& ss, const TCgiParameters& e, const TString& param, + const TString& text, const TVariants& variants) { - TSet<TString> selectedValues; - for (const TString& subvalue : Subvalues(e, param)) { + TSet<TString> selectedValues; + for (const TString& subvalue : Subvalues(e, param)) { selectedValues.insert(subvalue); } if (!selectedValues.empty()) { SelectorTitle(ss, text); } - for (const TString& subvalue : Subvalues(e, param)) { + for (const TString& subvalue : Subvalues(e, param)) { DropdownSelector<Erasable, true>(ss, e, param, subvalue, "", variants); } if (selectedValues.contains("")) { @@ -1444,7 +1444,7 @@ void OptionalMultipleSelection(TStringStream& ss, const TCgiParameters& e, const TVariants ListColumns(const NAnalytics::TTable& table) { - TSet<TString> cols; + TSet<TString> cols; // bool addSpecialCols = false; // if (addSpecialCols) { // cols.insert("_count"); @@ -1461,7 +1461,7 @@ TVariants ListColumns(const NAnalytics::TTable& table) return result; } -TString TaggedValue(const TString& value, const TString& tag) +TString TaggedValue(const TString& value, const TString& tag) { if (!tag) { return value; @@ -1469,7 +1469,7 @@ TString TaggedValue(const TString& value, const TString& tag) return value + "-" + tag; } -TVariants ValueVars(const TVariants& values, const TString& tag) +TVariants ValueVars(const TVariants& values, const TString& tag) { TVariants ret; for (auto& p : values) { @@ -1478,7 +1478,7 @@ TVariants ValueVars(const TVariants& values, const TString& tag) return ret; } -TVariants TagVars(const TString& value, const TVariants& tags) +TVariants TagVars(const TString& value, const TVariants& tags) { TVariants ret; for (auto& p : tags) { @@ -1496,10 +1496,10 @@ TVariants SeriesTags() } void SeriesSelectors(TStringStream& ss, const TCgiParameters& e, - const TString& xparam, const TString& yparam, const NAnalytics::TTable& data) + const TString& xparam, const TString& yparam, const NAnalytics::TTable& data) { TTags xtags; - TString xn = ParseTagsOut(e.Get(xparam), xtags); + TString xn = ParseTagsOut(e.Get(xparam), xtags); DropdownSelector<Erasable, true>(ss, e, xparam, e.Get(xparam), "with Ox:", ValueVars(ListColumns(data), JoinTags(xtags))); if (xn) { @@ -1507,13 +1507,13 @@ void SeriesSelectors(TStringStream& ss, const TCgiParameters& e, TagVars(xn, SeriesTags())); } - TString yns = e.Get(yparam); + TString yns = e.Get(yparam); SelectorTitle(ss, "and Oy:"); bool first = true; bool hasEmpty = false; for (auto& subvalue : Subvalues(e, yparam)) { TTags ytags; - TString yn = ParseTagsOut(subvalue, ytags); + TString yn = ParseTagsOut(subvalue, ytags); DropdownSelector<Erasable, true>(ss, e, yparam, subvalue, first? "": ", ", ValueVars(ListColumns(data), JoinTags(ytags))); if (yn) { @@ -1539,7 +1539,7 @@ void SeriesSelectors(TStringStream& ss, const TCgiParameters& e, class TProbesHtmlPrinter { private: - TVector<TVector<TString>> TableData; + TVector<TVector<TString>> TableData; static constexpr int TimeoutSec = 15 * 60; // default timeout public: void Push(const NLWTrace::TProbe* probe) @@ -1548,19 +1548,19 @@ public: auto& row = TableData.back(); row.emplace_back(); - TString& groups = row.back(); + TString& groups = row.back(); bool first = true; for (const char* const* i = probe->Event.Groups; *i != nullptr; ++i, first = false) { - groups.append(TString(first? "": ", ") + GroupHtml(*i)); + groups.append(TString(first? "": ", ") + GroupHtml(*i)); } row.push_back(ProbeHtml(probe->Event.GetProvider(), probe->Event.Name)); row.emplace_back(); - TString& params = row.back(); + TString& params = row.back(); first = true; for (size_t i = 0; i < probe->Event.Signature.ParamCount; i++, first = false) { - params.append(TString(first? "": ", ") + probe->Event.Signature.ParamTypes[i] + params.append(TString(first? "": ", ") + probe->Event.Signature.ParamTypes[i] + " " + probe->Event.Signature.ParamNames[i]); } @@ -1580,7 +1580,7 @@ public: TABLEBODY() { for (auto& row : TableData) { TABLER() { - for (TString& cell : row) { + for (TString& cell : row) { TABLED() { os << cell; } } } @@ -1590,7 +1590,7 @@ public: } } private: - TString GroupHtml(const TString& group) + TString GroupHtml(const TString& group) { TStringStream ss; ss << "<div class=\"dropdown\" style=\"display:inline-block\">" @@ -1619,7 +1619,7 @@ private: return ss.Str(); } - TString ProbeHtml(const TString& provider, const TString& probe) + TString ProbeHtml(const TString& provider, const TString& probe) { TStringStream ss; ss << "<div class=\"dropdown\">" @@ -1701,7 +1701,7 @@ void TDashboardRegistry::Output(TStringStream& ss) { class ILogSource { public: virtual ~ILogSource() {} - virtual TString GetId() = 0; + virtual TString GetId() = 0; virtual TInstant GetStartTime() = 0; virtual TDuration GetTimeout(TInstant now) = 0; virtual ui64 GetEventsCount() = 0; @@ -1710,7 +1710,7 @@ public: class TTraceLogSource : public ILogSource { private: - TString Id; + TString Id; const TTraceCleaner& Cleaner; const NLWTrace::TSession* Trace; public: @@ -1720,7 +1720,7 @@ public: , Trace(trace) {} - TString GetId() override + TString GetId() override { return Id; } @@ -1755,19 +1755,19 @@ public: class TSnapshotLogSource : public ILogSource { private: - TString Sid; + TString Sid; // Log should be used for read-only purpose, because it can be accessed from multiple threads // Atomic pointer is used to avoid thread-safety issues with snapshot deletion // (I hope protobuf const-implementation doesn't use any mutable non-thread-safe stuff inside) TAtomicSharedPtr<NLWTrace::TLogPb> Log; public: // Constructor should be called under SnapshotsMtx lock - TSnapshotLogSource(const TString& sid, const TAtomicSharedPtr<NLWTrace::TLogPb>& log) + TSnapshotLogSource(const TString& sid, const TAtomicSharedPtr<NLWTrace::TLogPb>& log) : Sid(sid) , Log(log) {} - TString GetId() override + TString GetId() override { return Sid + "~"; } @@ -1799,14 +1799,14 @@ private: TTraceCleaner& Cleaner; TInstant Now; using TLogSourcePtr = std::unique_ptr<ILogSource>; - TMap<TString, TLogSourcePtr> LogSources; + TMap<TString, TLogSourcePtr> LogSources; public: explicit TLogSources(TTraceCleaner& cleaner, TInstant now = TInstant::Now()) : Cleaner(cleaner) , Now(now) {} - void Push(const TString& sid, const TAtomicSharedPtr<NLWTrace::TLogPb>& log) + void Push(const TString& sid, const TAtomicSharedPtr<NLWTrace::TLogPb>& log) { TLogSourcePtr ls(new TSnapshotLogSource(sid, log)); LogSources.emplace(ls->GetId(), std::move(ls)); @@ -1847,7 +1847,7 @@ public: void Push(ILogSource* src) { - TString id = src->GetId(); + TString id = src->GetId(); Os << "<tr>"; Os << "<td>"; try { @@ -1884,7 +1884,7 @@ public: << "</tr>\n"; } private: - static TString TimeoutToString(TDuration d) + static TString TimeoutToString(TDuration d) { TStringStream ss; if (d == TDuration::Zero()) { @@ -1941,7 +1941,7 @@ TVariants ListTraces(const TLogSources& srcs) class TTimestampCutter { private: - THashMap<TThread::TId, std::pair<ui64, TInstant>> CutTsForThread; // tid -> time of first item + THashMap<TThread::TId, std::pair<ui64, TInstant>> CutTsForThread; // tid -> time of first item mutable ui64 CutTsMax = 0; mutable TInstant CutInstantMax; bool Enabled; @@ -2007,14 +2007,14 @@ private: class TLogFilter { private: struct TFilter { - TString ParamName; - TString ParamValue; + TString ParamName; + TString ParamValue; bool Parsed; TLogQuery Query; NLWTrace::TLiteral Value; - explicit TFilter(const TString& text) + explicit TFilter(const TString& text) { if (!text) { // Neither ParamName nor ParamValue is selected ParamName.clear(); @@ -2023,7 +2023,7 @@ private: return; } size_t pos = text.find('='); - if (pos == TString::npos) { // Only ParamName has been selected + if (pos == TString::npos) { // Only ParamName has been selected ParamName = text; ParamValue.clear(); Parsed = false; @@ -2038,14 +2038,14 @@ private: Value = NLWTrace::TLiteral(ParamValue); } }; - TVector<TFilter> Filters; - THashSet<const NLWTrace::TSignature*> Signatures; // Just to list param names + TVector<TFilter> Filters; + THashSet<const NLWTrace::TSignature*> Signatures; // Just to list param names TVariants ParamNames; - THashMap<TString, THashSet<TString>> FilteredParamValues; // paramName -> { paramValue } + THashMap<TString, THashSet<TString>> FilteredParamValues; // paramName -> { paramValue } public: - explicit TLogFilter(const TVector<TString>& filters) + explicit TLogFilter(const TVector<TString>& filters) { - for (const TString& subvalue : filters) { + for (const TString& subvalue : filters) { TFilter filter(subvalue); FilteredParamValues[filter.ParamName]; // just create empty set to gather values later if (filter.Parsed) { @@ -2068,11 +2068,11 @@ public: return true; } - void FilterSelectors(TStringStream& ss, const TCgiParameters& e, const TString& fparam) + void FilterSelectors(TStringStream& ss, const TCgiParameters& e, const TString& fparam) { bool first = true; bool allParsed = true; - for (const TString& subvalue : Subvalues(e, fparam)) { + for (const TString& subvalue : Subvalues(e, fparam)) { TFilter filter(subvalue); allParsed = allParsed && filter.Parsed; if (first) { @@ -2101,7 +2101,7 @@ public: const TVariants& ListParamNames() { if (ParamNames.empty()) { - THashSet<TString> paramNames; + THashSet<TString> paramNames; for (const NLWTrace::TSignature* sgn: Signatures) { for (size_t pi = 0; pi < sgn->ParamCount; pi++) { paramNames.insert(sgn->ParamNames[pi]); @@ -2114,7 +2114,7 @@ public: return ParamNames; } - bool IsFiltered(const TString& paramName) const + bool IsFiltered(const TString& paramName) const { return FilteredParamValues.contains(paramName); } @@ -2125,7 +2125,7 @@ private: { Signatures.insert(&item.Probe->Event.Signature); if (!FilteredParamValues.empty() && item.SavedParamsCount > 0) { - TString paramValues[LWTRACE_MAX_PARAMS]; + TString paramValues[LWTRACE_MAX_PARAMS]; item.Probe->Event.Signature.SerializeParams(item.Params, paramValues); for (size_t pi = 0; pi < item.SavedParamsCount; pi++) { auto iter = FilteredParamValues.find(item.Probe->Event.Signature.ParamNames[pi]); @@ -2143,12 +2143,12 @@ private: } } - TVariants ListParamValues(const TString& paramName) const + TVariants ListParamValues(const TString& paramName) const { TVariants result; auto iter = FilteredParamValues.find(paramName); if (iter != FilteredParamValues.end()) { - for (const TString& paramValue : iter->second) { + for (const TString& paramValue : iter->second) { result.emplace_back(paramName + "=" + paramValue, paramValue); } } @@ -2231,7 +2231,7 @@ public: ", {" ; if (item.SavedParamsCount > 0) { - TString ParamValues[LWTRACE_MAX_PARAMS]; + TString ParamValues[LWTRACE_MAX_PARAMS]; item.Probe->Event.Signature.SerializeParams(item.Params, ParamValues); bool first = true; for (size_t i = 0; i < item.SavedParamsCount; i++, first = false) { @@ -2490,19 +2490,19 @@ private: class TLogAnalyzer: public TLogFilter { private: - TMultiMap<ui64, std::pair<TThread::TId, NLWTrace::TLogItem>> Items; - TVector<NLWTrace::TTrackLog> Depot; - THashMap<TString, TTrackLogRefs> Groups; + TMultiMap<ui64, std::pair<TThread::TId, NLWTrace::TLogItem>> Items; + TVector<NLWTrace::TTrackLog> Depot; + THashMap<TString, TTrackLogRefs> Groups; NAnalytics::TTable Table; bool TableCreated = false; - TVector<TString> GroupBy; + TVector<TString> GroupBy; TTimestampCutter CutTs; public: - TLogAnalyzer(const TVector<TString>& filters, const TVector<TString>& groupBy, bool cutTs) + TLogAnalyzer(const TVector<TString>& filters, const TVector<TString>& groupBy, bool cutTs) : TLogFilter(filters) , CutTs(cutTs) { - for (const TString& groupParam : groupBy) { + for (const TString& groupParam : groupBy) { GroupBy.push_back(groupParam); } } @@ -2544,7 +2544,7 @@ private: void FillRow(NAnalytics::TRow& row, const NLWTrace::TLogItem& item) { if (item.SavedParamsCount > 0) { - TString paramValues[LWTRACE_MAX_PARAMS]; + TString paramValues[LWTRACE_MAX_PARAMS]; item.Probe->Event.Signature.SerializeParams(item.Params, paramValues); for (size_t i = 0; i < item.SavedParamsCount; i++) { double value = FromString<double>(paramValues[i].data(), paramValues[i].size(), NAN); @@ -2558,21 +2558,21 @@ private: } } - TString GetParam(const NLWTrace::TLogItem& item, TString* paramValues, const TString& paramName) + TString GetParam(const NLWTrace::TLogItem& item, TString* paramValues, const TString& paramName) { for (size_t pi = 0; pi < item.SavedParamsCount; pi++) { if (paramName == item.Probe->Event.Signature.ParamNames[pi]) { return paramValues[pi]; } } - return TString(); + return TString(); } - TString GetGroup(const NLWTrace::TLogItem& item, TString* paramValues) + TString GetGroup(const NLWTrace::TLogItem& item, TString* paramValues) { TStringStream ss; bool first = true; - for (const TString& groupParam : GroupBy) { + for (const TString& groupParam : GroupBy) { ss << (first? "": "|") << GetParam(item, paramValues, groupParam); first = false; } @@ -2602,7 +2602,7 @@ private: void Map(TThread::TId tid, const NLWTrace::TLogItem& item) { if (item.SavedParamsCount > 0 && !CutTs.Skip(item)) { - TString paramValues[LWTRACE_MAX_PARAMS]; + TString paramValues[LWTRACE_MAX_PARAMS]; item.Probe->Event.Signature.SerializeParams(item.Params, paramValues); TTrackLogRefs& tl = Groups[GetGroup(item, paramValues)]; tl.Items.emplace_back(tid, item); @@ -2612,7 +2612,7 @@ private: void Reduce() { for (auto& v : Groups) { - const TString& group = v.first; + const TString& group = v.first; const TTrackLogRefs& tl = v.second; Table.emplace_back(); NAnalytics::TRow& row = Table.back(); @@ -2650,7 +2650,7 @@ class TPatternTree; struct TPatternNode; struct TTrack : public TTrackLogRefs { - TString TrackId; + TString TrackId; TPatternNode* LastNode = nullptr; }; @@ -2685,7 +2685,7 @@ public: // Track classification tree node struct TPatternNode { - TString Name; + TString Name; TPatternNode* Parent = nullptr; THolder<TClassifier> Classifier; struct TDesc { @@ -2694,8 +2694,8 @@ struct TPatternNode { const NLWTrace::TProbe* Probe = nullptr; // NT_PARAM size_t Rollbacks = 0; - TString ParamName; - TString ParamValue; + TString ParamName; + TString ParamValue; } Desc; ui64 TrackCount = 0; @@ -2711,20 +2711,20 @@ struct TPatternNode { {} }; - TVector<TTrackEntry> Tracks; + TVector<TTrackEntry> Tracks; ui64 ResTotalSum = 0; ui64 ResTotalMax = 0; - TVector<ui64> ResTotalAll; + TVector<ui64> ResTotalAll; ui64 ResLastSum = 0; ui64 ResLastMax = 0; - TVector<ui64> ResLastAll; + TVector<ui64> ResLastAll; - TVector<ui64> TimelineSum; + TVector<ui64> TimelineSum; NAnalytics::TTable Slices; - TString GetPath() const + TString GetPath() const { if (Parent) { return Parent->GetPath() + Name; @@ -2798,9 +2798,9 @@ public: // Per-node classifier by probe name class TClassifyByProbe : public TClassifier { private: - using TChildren = THashMap<NLWTrace::TProbe*, TPatternNode>; + using TChildren = THashMap<NLWTrace::TProbe*, TPatternNode>; TChildren Children; - TVector<TChildren::value_type*> SortedChildren; + TVector<TChildren::value_type*> SortedChildren; public: explicit TClassifyByProbe(TPatternNode* node) : TClassifier(node, NT_PROBE) @@ -2846,12 +2846,12 @@ public: class TClassifyByParam : public TClassifier { private: size_t Rollbacks; // How many items should we look back in track to locate probe - TString ParamName; - using TChildren = THashMap<TString, TPatternNode>; + TString ParamName; + using TChildren = THashMap<TString, TPatternNode>; TChildren Children; - TVector<TChildren::value_type*> SortedChildren; + TVector<TChildren::value_type*> SortedChildren; public: - TClassifyByParam(TPatternNode* node, size_t rollbacks, const TString& paramName) + TClassifyByParam(TPatternNode* node, size_t rollbacks, const TString& paramName) : TClassifier(node, NT_PARAM, true) , Rollbacks(rollbacks) , ParamName(paramName) @@ -2864,8 +2864,8 @@ public: const NLWTrace::TLogItem& item = *(cur - Rollbacks); WWW_CHECK(item.SavedParamsCount > 0, "classify by params on probe w/o param loggging in node '%s'", Node->GetPath().data()); - TString paramValues[LWTRACE_MAX_PARAMS]; - TString* paramValue = nullptr; + TString paramValues[LWTRACE_MAX_PARAMS]; + TString* paramValue = nullptr; item.Probe->Event.Signature.SerializeParams(item.Params, paramValues); for (size_t pi = 0; pi < item.SavedParamsCount; pi++) { if (item.Probe->Event.Signature.ParamNames[pi] == ParamName) { @@ -2906,18 +2906,18 @@ public: }; private: TPatternNode Root; - THashMap<TString, std::pair<size_t, TString>> ParamClassifiers; // path -> (rollbacks, param) - TString SelectedPattern; + THashMap<TString, std::pair<size_t, TString>> ParamClassifiers; // path -> (rollbacks, param) + TString SelectedPattern; TPatternNode* SelectedNode = nullptr; - TVector<ui64> Timeline; // Just to avoid reallocations + TVector<ui64> Timeline; // Just to avoid reallocations public: TPatternTree(const TCgiParameters& e) { - for (const TString& cl : Subvalues(e, "classify")) { + for (const TString& cl : Subvalues(e, "classify")) { size_t at = cl.find_last_of('@'); - if (at != TString::npos) { + if (at != TString::npos) { size_t dot = cl.find('.', at + 1); - if (dot != TString::npos) { + if (dot != TString::npos) { size_t rollbacks = FromString<size_t>(cl.substr(at + 1, dot - at - 1)); ParamClassifiers[cl.substr(0, at)] = std::make_pair(rollbacks, cl.substr(dot + 1)); } @@ -2950,7 +2950,7 @@ public: } // Register track in given node - void AddTrackToNode(TPatternNode* node, TTrack& track, ui64 resTotal, TVector<ui64>& timeline) + void AddTrackToNode(TPatternNode* node, TTrack& track, ui64 resTotal, TVector<ui64>& timeline) { if (!SelectedNode) { if (node->GetPath() == SelectedPattern) { @@ -3012,7 +3012,7 @@ public: #define WWW_CHECK_PATTERN(str) if (!CheckPattern(pi, pe, (str))) { return false; } - bool MatchTrack(const TTrack& track, const TString& patternStr) + bool MatchTrack(const TTrack& track, const TString& patternStr) { const char* pi = patternStr.data(); const char* pe = pi + patternStr.size(); @@ -3065,8 +3065,8 @@ public: if (mitem.SavedParamsCount == 0) { return false; } - TString paramValues[LWTRACE_MAX_PARAMS]; - TString* paramValue = nullptr; + TString paramValues[LWTRACE_MAX_PARAMS]; + TString* paramValue = nullptr; mitem.Probe->Event.Signature.SerializeParams(mitem.Params, paramValues); for (size_t pi = 0; pi < mitem.SavedParamsCount; pi++) { if (mitem.Probe->Event.Signature.ParamNames[pi] == paramName) { @@ -3175,25 +3175,25 @@ private: class TLogTrackExtractor: public TLogFilter { private: // Data storage - TMultiMap<ui64, std::pair<TThread::TId, NLWTrace::TLogItem>> Items; - TVector<NLWTrace::TTrackLog> Depot; + TMultiMap<ui64, std::pair<TThread::TId, NLWTrace::TLogItem>> Items; + TVector<NLWTrace::TTrackLog> Depot; // Data refs organized in tracks - THashMap<TString, TTrack> Tracks; - TVector<TTrack> TracksFromDepot; + THashMap<TString, TTrack> Tracks; + TVector<TTrack> TracksFromDepot; // Analysis - TVector<TString> GroupBy; - THashSet<TString> TrackIds; // The same content as in GroupBy + TVector<TString> GroupBy; + THashSet<TString> TrackIds; // The same content as in GroupBy TTimestampCutter CutTs; TPatternTree Tree; public: - TLogTrackExtractor(const TCgiParameters& e, const TVector<TString>& filters, const TVector<TString>& groupBy) + TLogTrackExtractor(const TCgiParameters& e, const TVector<TString>& filters, const TVector<TString>& groupBy) : TLogFilter(filters) , CutTs(true) // Always cut input data for tracks , Tree(e) { - for (const TString& groupParam : groupBy) { + for (const TString& groupParam : groupBy) { GroupBy.push_back(groupParam); TrackIds.insert(groupParam); } @@ -3305,7 +3305,7 @@ public: WWW_CHECK(percentile >= 0.0 && percentile <= 100.0, "wrong percentile: %lf", percentile); ui64 row = 0; - TVector<ui64> chain; + TVector<ui64> chain; HTML(os) { TABLE_CLASS("tracks-tree") { TABLEHEAD() { @@ -3333,11 +3333,11 @@ public: return; } Tree.Traverse([&] (TPatternNode* node) { - TString parentClass; + TString parentClass; if (!chain.empty()) { parentClass = " treegrid-parent-" + ToString(chain.back()); } - TString selectedClass; + TString selectedClass; if (e.Get("pattern") == node->GetPath()) { selectedClass = " danger"; } @@ -3399,7 +3399,7 @@ public: auto first = TTrackTr::begin(*track); auto last = TTrackTr::rbegin(*track); - TString name = track->LastNode->GetPath(); + TString name = track->LastNode->GetPath(); const NLWTrace::TLogItem& firstItem = *first; TThread::TId firstTid = first->ThreadId; @@ -3410,7 +3410,7 @@ public: tr.Add(cur->ThreadId, item.TimestampCycles, "i", "event", &item, GetProbeName(item.Probe)); - TString sliceName = GetProbeName(item.Probe); + TString sliceName = GetProbeName(item.Probe); auto next = cur + 1; if (next != end) { @@ -3498,8 +3498,8 @@ private: void OutputPattern(IOutputStream& os, const TCgiParameters& e, TPatternNode* node) { // Fill pattern name - TString patternName; - TString patternTitle; + TString patternName; + TString patternTitle; switch (node->Desc.Type) { case NT_ROOT: patternName = "All Tracks"; @@ -3549,7 +3549,7 @@ private: os << "<li class=\"dropdown-header\">" << GetProbeName(probe) << "</li>"; const NLWTrace::TSignature* sgn = &probe->Event.Signature; for (size_t pi = 0; pi < sgn->ParamCount; pi++) { - TString param = sgn->ParamNames[pi]; + TString param = sgn->ParamNames[pi]; if (TrackIds.contains(param) || IsFiltered(param)) { continue; } @@ -3589,7 +3589,7 @@ private: "</div>"; } - using TTimeline = TVector<std::pair<TPatternNode*, double>>; + using TTimeline = TVector<std::pair<TPatternNode*, double>>; TTimeline MakeTimeline(TPatternNode* node) { @@ -3648,14 +3648,14 @@ private: os << "</div>"; } - TString FormatTimelineTooltip(double time, double prevTime, TPatternNode* node) + TString FormatTimelineTooltip(double time, double prevTime, TPatternNode* node) { return FormatCycles(time - prevTime) + ": " + FormatCycles(prevTime) + " -> " + FormatCycles(time) + "(" + node->Name + ")"; } - TString FormatFloat(double value) + TString FormatFloat(double value) { if (value == 0.0) { return "0"; @@ -3695,7 +3695,7 @@ private: } } - TString FormatCycles(double timeCycles) + TString FormatCycles(double timeCycles) { double timeSec = timeCycles / NHPTimer::GetClockRate(); if (timeSec > 1.0) { @@ -3733,21 +3733,21 @@ private: } } - TString GetParam(const NLWTrace::TLogItem& item, TString* paramValues, const TString& paramName) + TString GetParam(const NLWTrace::TLogItem& item, TString* paramValues, const TString& paramName) { for (size_t pi = 0; pi < item.SavedParamsCount; pi++) { if (paramName == item.Probe->Event.Signature.ParamNames[pi]) { return paramValues[pi]; } } - return TString(); + return TString(); } - TString GetGroup(const NLWTrace::TLogItem& item, TString* paramValues) + TString GetGroup(const NLWTrace::TLogItem& item, TString* paramValues) { TStringStream ss; bool first = true; - for (const TString& groupParam : GroupBy) { + for (const TString& groupParam : GroupBy) { ss << (first? "": "|") << GetParam(item, paramValues, groupParam); first = false; } @@ -3759,7 +3759,7 @@ private: // Ensure cyclic per thread lwtrace logs wont drop *inner* items of a track // (note that some *starting* items can be dropped) if (item.SavedParamsCount > 0 && !CutTs.Skip(item)) { - TString paramValues[LWTRACE_MAX_PARAMS]; + TString paramValues[LWTRACE_MAX_PARAMS]; item.Probe->Event.Signature.SerializeParams(item.Params, paramValues); Tracks[GetGroup(item, paramValues)].Items.emplace_back(tid, item); } @@ -3767,7 +3767,7 @@ private: }; NLWTrace::TProbeRegistry g_Probes; -TString g_sanitizerTest("TString g_sanitizerTest"); +TString g_sanitizerTest("TString g_sanitizerTest"); NLWTrace::TManager g_SafeManager(g_Probes, false); NLWTrace::TManager g_UnsafeManager(g_Probes, true); TDashboardRegistry g_DashboardRegistry; @@ -3775,10 +3775,10 @@ TDashboardRegistry g_DashboardRegistry; class TLWTraceMonPage : public NMonitoring::IMonPage { private: NLWTrace::TManager* TraceMngr; - TString StartTime; + TString StartTime; TTraceCleaner Cleaner; TMutex SnapshotsMtx; - THashMap<TString, TAtomicSharedPtr<NLWTrace::TLogPb>> Snapshots; + THashMap<TString, TAtomicSharedPtr<NLWTrace::TLogPb>> Snapshots; public: explicit TLWTraceMonPage(bool allowUnsafe = false) : NMonitoring::IMonPage("trace", "Tracing") @@ -3842,7 +3842,7 @@ public: private: void OutputNavbar(const NMonitoring::IMonHttpRequest& request, IOutputStream& out) { - TString active = " class=\"active\""; + TString active = " class=\"active\""; out << "<nav class=\"navbar navbar-default\"><div class=\"container-fluid\">" << NavbarHeader() << @@ -4057,9 +4057,9 @@ private: if (request.GetParams().NumOfValues("id") == 0) { ythrow yexception() << "Cgi-parameter 'id' is not specified"; } else { - TString id = request.GetParams().Get("id"); + TString id = request.GetParams().Get("id"); const NLWTrace::TQuery& query = TraceMngr->GetTrace(id)->GetQuery(); - TString queryStr = query.DebugString(); + TString queryStr = query.DebugString(); WWW_HTML(out) { out << "<h2>Trace Query: " << id << "</h2><pre>" << queryStr; } @@ -4112,7 +4112,7 @@ private: Subvalues(request.GetParams(), "f"), Subvalues(request.GetParams(), "g") )); - for (const TString& id : Subvalues(request.GetParams(), "id")) { + for (const TString& id : Subvalues(request.GetParams(), "id")) { CheckAdHocTrace(id, TDuration::Minutes(1)); TraceMngr->ReadLog(id, *logTracks); TraceMngr->ReadDepot(id, *logTracks); @@ -4123,7 +4123,7 @@ private: Subvalues(request.GetParams(), "g"), request.GetParams().Get("cutts") == "y" )); - for (const TString& id : Subvalues(request.GetParams(), "id")) { + for (const TString& id : Subvalues(request.GetParams(), "id")) { CheckAdHocTrace(id, TDuration::Minutes(1)); TraceMngr->ReadLog(id, *logAnalyzer); TraceMngr->ReadDepot(id, *logAnalyzer); @@ -4148,7 +4148,7 @@ private: DropdownSelector<Link>(out, e, "reverse", e.Get("reverse"), "", variants); } - TString aggr = e.Get("aggr"); + TString aggr = e.Get("aggr"); TVariants variants1; // MSVS2013 doesn't understand complex initializer lists variants1.emplace_back("", "without aggregation"); variants1.emplace_back("hist", "as histogram"); @@ -4173,8 +4173,8 @@ private: DropdownSelector<Link>(out, e, "ile", e.Get("ile"), "and show", ileVars); out << "%-ile. "; TString patternAnalyzer; - TString distBy; - TString distType; + TString distBy; + TString distType; if (e.Get("pattern")) { TVariants analyzePatternVars; analyzePatternVars.emplace_back("resTotal", "distribution by total"); @@ -4229,7 +4229,7 @@ private: } } - TString selectors = out.Str(); + TString selectors = out.Str(); out.Clear(); out << NMonitoring::HTTPOKHTML; out << "<!DOCTYPE html>" << Endl; @@ -4320,7 +4320,7 @@ private: } else if (aggr == "hist") { RequireSelection(out, e, "bn", "by", logFilter->ListParamNames()); const NAnalytics::TTable& inputTable = logAnalyzer->GetTable(); - TString bn = e.Get("bn"); + TString bn = e.Get("bn"); double b1 = e.Get("b1")? FromString<double>(e.Get("b1")): MinValue(bn, inputTable); double b2 = e.Get("b2")? FromString<double>(e.Get("b2")): MaxValue(bn, inputTable); if (isfinite(b1) && isfinite(b2)) { @@ -4332,9 +4332,9 @@ private: } } - TString xn = e.Get("xn"); + TString xn = e.Get("xn"); - TString outFormat = e.Get("out"); + TString outFormat = e.Get("out"); TVariants variants2; variants2.emplace_back("html", "table"); variants2.emplace_back("flot", "chart"); @@ -4345,12 +4345,12 @@ private: RequireSelection(out, e, "out", "and show", variants2); if (outFormat == "csv") { - TString sep = e.Get("sep")? e.Get("sep"): TString("\t"); + TString sep = e.Get("sep")? e.Get("sep"): TString("\t"); out.Clear(); out << NMonitoring::HTTPOKTEXT; out << ToCsv(data, sep, e.Get("head") != "n"); } else if (outFormat == "html") { - TString selectors = out.Str(); + TString selectors = out.Str(); out.Clear(); WWW_HTML(out) { // Wrap selectors with navbar @@ -4366,7 +4366,7 @@ private: out << ToJsonFlot(data, xn, SplitString(e.Get("yns"), ":")); } else if (outFormat == "flot") { SeriesSelectors(out, e, "xn", "yns", data); - TString selectors = out.Str(); + TString selectors = out.Str(); TVector<TString> ynos = SplitString(e.Get("yns"), ":"); out.Clear(); @@ -4525,12 +4525,12 @@ private: void PostNew(const NMonitoring::IMonHttpRequest& request, IOutputStream& out) { WWW_CHECK(request.GetPostParams().Has("id"), "POST parameter 'id' is not specified"); - const TString& id = request.GetPostParams().Get("id"); + const TString& id = request.GetPostParams().Get("id"); bool ui = (request.GetParams().Get("ui") == "y"); TDuration timeout = GetGetTimeout(request); if (!CheckAdHocTrace(id, timeout)) { NLWTrace::TQuery query; - TString queryStr = request.GetPostParams().Get("query"); + TString queryStr = request.GetPostParams().Get("query"); if (!ui) { queryStr = Base64Decode(queryStr); // Needed for trace.sh (historically) } @@ -4565,7 +4565,7 @@ private: void PostDelete(const NMonitoring::IMonHttpRequest& request, IOutputStream& out) { WWW_CHECK(request.GetPostParams().Has("id"), "POST parameter 'id' is not specified"); - const TString& id = request.GetPostParams().Get("id"); + const TString& id = request.GetPostParams().Get("id"); bool ui = (request.GetParams().Get("ui") == "y"); TraceMngr->Delete(id); Cleaner.Forget(id); @@ -4592,14 +4592,14 @@ private: void PostSnapshot(const NMonitoring::IMonHttpRequest& request, IOutputStream& out) { WWW_CHECK(request.GetPostParams().Has("id"), "POST parameter 'id' is not specified"); - const TString& id = request.GetPostParams().Get("id"); + const TString& id = request.GetPostParams().Get("id"); bool ui = (request.GetParams().Get("ui") == "y"); TInstant now = TInstant::Now(); TGuard<TMutex> g(SnapshotsMtx); const NLWTrace::TSession* trace = TraceMngr->GetTrace(id); struct tm tm0; - TString sid = id + Strftime("_%Y%m%d-%H%M%S", now.GmTime(&tm0)); + TString sid = id + Strftime("_%Y%m%d-%H%M%S", now.GmTime(&tm0)); TAtomicSharedPtr<NLWTrace::TLogPb>& pbPtr = Snapshots[sid]; pbPtr.Reset(new NLWTrace::TLogPb()); trace->ToProtobuf(*pbPtr); @@ -4627,7 +4627,7 @@ private: void PostSetTimeout(const NMonitoring::IMonHttpRequest& request, IOutputStream& out) { WWW_CHECK(request.GetPostParams().Has("id"), "POST parameter 'id' is not specified"); - const TString& id = request.GetPostParams().Get("id"); + const TString& id = request.GetPostParams().Get("id"); TDuration timeout = GetGetTimeout(request); bool ui = (request.GetParams().Get("ui") == "y"); Cleaner.Postpone(id, timeout, true); @@ -4657,7 +4657,7 @@ private: private: // Returns true iff trace is ad-hoc and ensures trace is created - bool CheckAdHocTrace(const TString& id, TDuration timeout) + bool CheckAdHocTrace(const TString& id, TDuration timeout) { TAdHocTraceConfig cfg; if (cfg.ParseId(id)) { diff --git a/library/cpp/lwtrace/signature.h b/library/cpp/lwtrace/signature.h index 868bd9bcf26..cc11a935362 100644 --- a/library/cpp/lwtrace/signature.h +++ b/library/cpp/lwtrace/signature.h @@ -5,7 +5,7 @@ #include <library/cpp/lwtrace/protos/lwtrace.pb.h> #include <util/generic/cast.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/typetraits.h> #include <util/string/builder.h> #include <util/string/cast.h> diff --git a/library/cpp/lwtrace/stderr_writer.cpp b/library/cpp/lwtrace/stderr_writer.cpp index 6e5654c3384..92f05dfdbfa 100644 --- a/library/cpp/lwtrace/stderr_writer.cpp +++ b/library/cpp/lwtrace/stderr_writer.cpp @@ -5,7 +5,7 @@ using namespace NLWTrace; bool TStderrActionExecutor::DoExecute(TOrbit&, const TParams& params) { - TString ParamValues[LWTRACE_MAX_PARAMS]; + TString ParamValues[LWTRACE_MAX_PARAMS]; Probe->Event.Signature.SerializeParams(params, ParamValues); TStringStream ss; diff --git a/library/cpp/lwtrace/symbol.cpp b/library/cpp/lwtrace/symbol.cpp index 456652bcd07..b1840d57747 100644 --- a/library/cpp/lwtrace/symbol.cpp +++ b/library/cpp/lwtrace/symbol.cpp @@ -5,11 +5,11 @@ template <> NLWTrace::TSymbol FromStringImpl(const char*, size_t) { - static TString err("ERROR_dynamic_symbol"); + static TString err("ERROR_dynamic_symbol"); return NLWTrace::TSymbol(&err); } template <> void Out<NLWTrace::TSymbol>(IOutputStream& o, TTypeTraits<NLWTrace::TSymbol>::TFuncParam t) { - Out<TString>(o, *t.Str); + Out<TString>(o, *t.Str); } diff --git a/library/cpp/lwtrace/symbol.h b/library/cpp/lwtrace/symbol.h index ef9e6cdf940..76cbee7c019 100644 --- a/library/cpp/lwtrace/symbol.h +++ b/library/cpp/lwtrace/symbol.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/builder.h> #include <util/system/src_location.h> @@ -17,7 +17,7 @@ #define LWTRACE_LOCATION_SYMBOL \ [](const char* func) { \ - static TString _holder(TStringBuilder() << func << " (" << __LOCATION__ << ")"); \ + static TString _holder(TStringBuilder() << func << " (" << __LOCATION__ << ")"); \ return ::NLWTrace::TSymbol(&_holder); \ }(Y_FUNC_SIGNATURE) /**/ diff --git a/library/cpp/lwtrace/tests/trace_tests.cpp b/library/cpp/lwtrace/tests/trace_tests.cpp index 6762e344a75..8d3c65f48ca 100644 --- a/library/cpp/lwtrace/tests/trace_tests.cpp +++ b/library/cpp/lwtrace/tests/trace_tests.cpp @@ -16,7 +16,7 @@ PROBE(SymbolParam, GROUPS("Group"), TYPES(NLWTrace::TSymbol), NAMES("symbol")) \ PROBE(CheckParam, GROUPS("Group"), TYPES(NLWTrace::TCheck), NAMES("value")) \ EVENT(TwoParamsEvent, GROUPS("Group"), TYPES(int, TString), NAMES("param1", "param2")) \ - EVENT(TwoParamsCheckEvent, GROUPS("Group"), TYPES(NLWTrace::TCheck, TString), NAMES("param1", "param2")) \ + EVENT(TwoParamsCheckEvent, GROUPS("Group"), TYPES(NLWTrace::TCheck, TString), NAMES("param1", "param2")) \ /**/ LWTRACE_DECLARE_PROVIDER(LWTRACE_TESTS_PROVIDER) diff --git a/library/cpp/messagebus/acceptor_status.cpp b/library/cpp/messagebus/acceptor_status.cpp index 5006ff68aee..e9818e03d3b 100644 --- a/library/cpp/messagebus/acceptor_status.cpp +++ b/library/cpp/messagebus/acceptor_status.cpp @@ -40,7 +40,7 @@ TAcceptorStatus& TAcceptorStatus::operator+=(const TAcceptorStatus& that) { return *this; } -TString TAcceptorStatus::PrintToString() const { +TString TAcceptorStatus::PrintToString() const { TStringStream ss; if (!Summary) { diff --git a/library/cpp/messagebus/actor/executor.cpp b/library/cpp/messagebus/actor/executor.cpp index 7a2227a4589..eaf07517094 100644 --- a/library/cpp/messagebus/actor/executor.cpp +++ b/library/cpp/messagebus/actor/executor.cpp @@ -249,11 +249,11 @@ ui32 TExecutor::GetMaxQueueSizeAndClear() const { return max; } -TString TExecutor::GetStatus() const { +TString TExecutor::GetStatus() const { return GetStatusRecordInternal().Status; } -TString TExecutor::GetStatusSingleLine() const { +TString TExecutor::GetStatusSingleLine() const { TStringStream ss; ss << "work items: " << GetWorkQueueSize(); return ss.Str(); diff --git a/library/cpp/messagebus/actor/ring_buffer.h b/library/cpp/messagebus/actor/ring_buffer.h index ec5706f7c76..937d8d5a3db 100644 --- a/library/cpp/messagebus/actor/ring_buffer.h +++ b/library/cpp/messagebus/actor/ring_buffer.h @@ -14,7 +14,7 @@ private: ui32 Capacity; ui32 WritePos; ui32 ReadPos; - TVector<T> Data; + TVector<T> Data; void StateCheck() const { Y_ASSERT(Capacity == Data.size()); @@ -39,7 +39,7 @@ private: } ui32 newCapacity = 1u << newCapacityPow; ui32 newCapacityMask = newCapacity - 1u; - TVector<T> newData(newCapacity); + TVector<T> newData(newCapacity); ui32 oldSize = Size(); // Copy old elements for (size_t i = 0; i < oldSize; ++i) { diff --git a/library/cpp/messagebus/actor/temp_tls_vector.h b/library/cpp/messagebus/actor/temp_tls_vector.h index 675d92f5b0b..7d9fbce0887 100644 --- a/library/cpp/messagebus/actor/temp_tls_vector.h +++ b/library/cpp/messagebus/actor/temp_tls_vector.h @@ -10,15 +10,15 @@ class TTempTlsVector { private: struct TTagForTls {}; - TVectorType<T, std::allocator<T>>* Vector; + TVectorType<T, std::allocator<T>>* Vector; public: - TVectorType<T, std::allocator<T>>* GetVector() { + TVectorType<T, std::allocator<T>>* GetVector() { return Vector; } TTempTlsVector() { - Vector = FastTlsSingletonWithTag<TVectorType<T, std::allocator<T>>, TTagForTls>(); + Vector = FastTlsSingletonWithTag<TVectorType<T, std::allocator<T>>, TTagForTls>(); Y_ASSERT(Vector->empty()); } @@ -30,7 +30,7 @@ public: Vector->clear(); } - size_t Capacity() const noexcept { + size_t Capacity() const noexcept { return Vector->capacity(); } diff --git a/library/cpp/messagebus/actor/thread_extra.cpp b/library/cpp/messagebus/actor/thread_extra.cpp index 048480f2553..826ae45670d 100644 --- a/library/cpp/messagebus/actor/thread_extra.cpp +++ b/library/cpp/messagebus/actor/thread_extra.cpp @@ -7,10 +7,10 @@ namespace { #ifdef _linux_ - TString GetExecName() { - TString execPath = GetExecPath(); + TString GetExecName() { + TString execPath = GetExecPath(); size_t lastSlash = execPath.find_last_of('/'); - if (lastSlash == TString::npos) { + if (lastSlash == TString::npos) { return execPath; } else { return execPath.substr(lastSlash + 1); diff --git a/library/cpp/messagebus/config/session_config.cpp b/library/cpp/messagebus/config/session_config.cpp index fbbbb106c9d..9b430033f3d 100644 --- a/library/cpp/messagebus/config/session_config.cpp +++ b/library/cpp/messagebus/config/session_config.cpp @@ -16,7 +16,7 @@ TBusSessionConfig::TBusSessionConfig() { } -TString TBusSessionConfig::PrintToString() const { +TString TBusSessionConfig::PrintToString() const { TStringStream ss; BUS_SESSION_CONFIG_MAP(STRUCT_FIELD_PRINT, ) return ss.Str(); @@ -66,7 +66,7 @@ static i64 ParseWithKmgSuffixS(const char* option) { } void TBusSessionConfig::ConfigureLastGetopt(NLastGetopt::TOpts& opts, - const TString& prefix) { + const TString& prefix) { opts.AddLongOption(prefix + "total-timeout") .RequiredArgument("MILLISECONDS") .DefaultValue(ToString(TotalTimeout)) diff --git a/library/cpp/messagebus/config/session_config.h b/library/cpp/messagebus/config/session_config.h index 84753350a90..2763a125f2e 100644 --- a/library/cpp/messagebus/config/session_config.h +++ b/library/cpp/messagebus/config/session_config.h @@ -5,7 +5,7 @@ #include <library/cpp/getopt/last_getopt.h> -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NBus { #define BUS_SESSION_CONFIG_MAP(XX, comma) \ diff --git a/library/cpp/messagebus/coreconn.h b/library/cpp/messagebus/coreconn.h index fca228d82e8..26e1dab6755 100644 --- a/library/cpp/messagebus/coreconn.h +++ b/library/cpp/messagebus/coreconn.h @@ -13,7 +13,7 @@ #include <util/generic/list.h> #include <util/generic/map.h> #include <util/generic/set.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/network/address.h> #include <util/network/ip.h> diff --git a/library/cpp/messagebus/duration_histogram.h b/library/cpp/messagebus/duration_histogram.h index ed060b0101a..6b2f6a9bda5 100644 --- a/library/cpp/messagebus/duration_histogram.h +++ b/library/cpp/messagebus/duration_histogram.h @@ -2,7 +2,7 @@ #include <util/datetime/base.h> #include <util/generic/bitops.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <array> @@ -39,7 +39,7 @@ struct TDurationHistogram { return *this; } - static TString LabelBefore(unsigned i); + static TString LabelBefore(unsigned i); - TString PrintToString() const; + TString PrintToString() const; }; diff --git a/library/cpp/messagebus/event_loop.cpp b/library/cpp/messagebus/event_loop.cpp index f685135bedd..009b5813a64 100644 --- a/library/cpp/messagebus/event_loop.cpp +++ b/library/cpp/messagebus/event_loop.cpp @@ -70,7 +70,7 @@ public: TChannelPtr Register(TSocket socket, TEventHandlerPtr eventHandler, void* cookie); void Unregister(SOCKET socket); - typedef THashMap<SOCKET, TChannelPtr> TData; + typedef THashMap<SOCKET, TChannelPtr> TData; void AddToPoller(SOCKET socket, void* cookie, int flags); diff --git a/library/cpp/messagebus/key_value_printer.cpp b/library/cpp/messagebus/key_value_printer.cpp index c8592145c73..41c2a19f57f 100644 --- a/library/cpp/messagebus/key_value_printer.cpp +++ b/library/cpp/messagebus/key_value_printer.cpp @@ -2,7 +2,7 @@ #include <util/stream/format.h> -TKeyValuePrinter::TKeyValuePrinter(const TString& sep) +TKeyValuePrinter::TKeyValuePrinter(const TString& sep) : Sep(sep) { } @@ -10,15 +10,15 @@ TKeyValuePrinter::TKeyValuePrinter(const TString& sep) TKeyValuePrinter::~TKeyValuePrinter() { } -void TKeyValuePrinter::AddRowImpl(const TString& key, const TString& value, bool alignLeft) { +void TKeyValuePrinter::AddRowImpl(const TString& key, const TString& value, bool alignLeft) { Keys.push_back(key); Values.push_back(value); AlignLefts.push_back(alignLeft); } -TString TKeyValuePrinter::PrintToString() const { +TString TKeyValuePrinter::PrintToString() const { if (Keys.empty()) { - return TString(); + return TString(); } size_t keyWidth = 0; diff --git a/library/cpp/messagebus/key_value_printer.h b/library/cpp/messagebus/key_value_printer.h index bca1fde50e8..82b63898ce9 100644 --- a/library/cpp/messagebus/key_value_printer.h +++ b/library/cpp/messagebus/key_value_printer.h @@ -1,19 +1,19 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/typetraits.h> #include <util/generic/vector.h> #include <util/string/cast.h> class TKeyValuePrinter { private: - TString Sep; - TVector<TString> Keys; - TVector<TString> Values; - TVector<bool> AlignLefts; + TString Sep; + TVector<TString> Keys; + TVector<TString> Values; + TVector<bool> AlignLefts; public: - TKeyValuePrinter(const TString& sep = TString(": ")); + TKeyValuePrinter(const TString& sep = TString(": ")); ~TKeyValuePrinter(); template <typename TKey, typename TValue> @@ -21,8 +21,8 @@ public: return AddRowImpl(ToString(key), ToString(value), leftAlign); } - TString PrintToString() const; + TString PrintToString() const; private: - void AddRowImpl(const TString& key, const TString& value, bool leftAlign); + void AddRowImpl(const TString& key, const TString& value, bool leftAlign); }; diff --git a/library/cpp/messagebus/lfqueue_batch.h b/library/cpp/messagebus/lfqueue_batch.h index 8128d3154d0..eeb921dc7c3 100644 --- a/library/cpp/messagebus/lfqueue_batch.h +++ b/library/cpp/messagebus/lfqueue_batch.h @@ -8,7 +8,7 @@ template <typename T, template <typename, class> class TVectorType = TVector> class TLockFreeQueueBatch { private: - TLockFreeStack<TVectorType<T, std::allocator<T>>*> Stack; + TLockFreeStack<TVectorType<T, std::allocator<T>>*> Stack; public: bool IsEmpty() { @@ -19,11 +19,11 @@ public: Stack.Enqueue(vec.Release()); } - void DequeueAllSingleConsumer(TVectorType<T, std::allocator<T>>* r) { - TTempTlsVector<TVectorType<T, std::allocator<T>>*> vs; + void DequeueAllSingleConsumer(TVectorType<T, std::allocator<T>>* r) { + TTempTlsVector<TVectorType<T, std::allocator<T>>*> vs; Stack.DequeueAllSingleConsumer(vs.GetVector()); - for (typename TVector<TVectorType<T, std::allocator<T>>*>::reverse_iterator i = vs.GetVector()->rbegin(); + for (typename TVector<TVectorType<T, std::allocator<T>>*>::reverse_iterator i = vs.GetVector()->rbegin(); i != vs.GetVector()->rend(); ++i) { if (i == vs.GetVector()->rend()) { r->swap(**i); diff --git a/library/cpp/messagebus/lfqueue_batch_ut.cpp b/library/cpp/messagebus/lfqueue_batch_ut.cpp index f80434c0d46..dac70133431 100644 --- a/library/cpp/messagebus/lfqueue_batch_ut.cpp +++ b/library/cpp/messagebus/lfqueue_batch_ut.cpp @@ -12,7 +12,7 @@ Y_UNIT_TEST_SUITE(TLockFreeQueueBatch) { q.EnqueueAll(v); } - TVector<unsigned> r; + TVector<unsigned> r; q.DequeueAllSingleConsumer(&r); UNIT_ASSERT_VALUES_EQUAL(2u, r.size()); @@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TLockFreeQueueBatch) { q.EnqueueAll(v); } - TVector<unsigned> r; + TVector<unsigned> r; q.DequeueAllSingleConsumer(&r); UNIT_ASSERT_VALUES_EQUAL(5u, r.size()); diff --git a/library/cpp/messagebus/local_flags.cpp b/library/cpp/messagebus/local_flags.cpp index 877e533f763..6725d9b0c0e 100644 --- a/library/cpp/messagebus/local_flags.cpp +++ b/library/cpp/messagebus/local_flags.cpp @@ -6,7 +6,7 @@ using namespace NBus; using namespace NBus::NPrivate; -TString NBus::NPrivate::LocalFlagSetToString(ui32 flags0) { +TString NBus::NPrivate::LocalFlagSetToString(ui32 flags0) { if (flags0 == 0) { return "0"; } diff --git a/library/cpp/messagebus/local_flags.h b/library/cpp/messagebus/local_flags.h index f589283188f..65c113a63f1 100644 --- a/library/cpp/messagebus/local_flags.h +++ b/library/cpp/messagebus/local_flags.h @@ -2,7 +2,7 @@ #include <library/cpp/deprecated/enum_codegen/enum_codegen.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/output.h> namespace NBus { diff --git a/library/cpp/messagebus/mb_lwtrace.h b/library/cpp/messagebus/mb_lwtrace.h index e62728b265c..597a02e7a69 100644 --- a/library/cpp/messagebus/mb_lwtrace.h +++ b/library/cpp/messagebus/mb_lwtrace.h @@ -5,7 +5,7 @@ #include <util/generic/string.h> #define LWTRACE_MESSAGEBUS_PROVIDER(PROBE, EVENT, GROUPS, TYPES, NAMES) \ - PROBE(Error, GROUPS("MessagebusRare"), TYPES(TString, TString, TString), NAMES("status", "address", "misc")) \ + PROBE(Error, GROUPS("MessagebusRare"), TYPES(TString, TString, TString), NAMES("status", "address", "misc")) \ PROBE(ServerUnknownVersion, GROUPS("MessagebusRare"), TYPES(TString, ui32), NAMES("address", "version")) \ PROBE(Accepted, GROUPS("MessagebusRare"), TYPES(TString), NAMES("address")) \ PROBE(Disconnected, GROUPS("MessagebusRare"), TYPES(TString), NAMES("address")) \ diff --git a/library/cpp/messagebus/message.h b/library/cpp/messagebus/message.h index 005ca10c652..dee829a6177 100644 --- a/library/cpp/messagebus/message.h +++ b/library/cpp/messagebus/message.h @@ -9,7 +9,7 @@ #include <util/generic/array_ref.h> #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/defaults.h> #include <util/system/type_name.h> #include <util/system/yassert.h> diff --git a/library/cpp/messagebus/message_counter.cpp b/library/cpp/messagebus/message_counter.cpp index 04d9343f6a2..c2e31b77cac 100644 --- a/library/cpp/messagebus/message_counter.cpp +++ b/library/cpp/messagebus/message_counter.cpp @@ -23,7 +23,7 @@ TMessageCounter& TMessageCounter::operator+=(const TMessageCounter& that) { return *this; } -TString TMessageCounter::ToString(bool reader) const { +TString TMessageCounter::ToString(bool reader) const { if (reader) { Y_ASSERT(CountCompressionRequests == 0); } diff --git a/library/cpp/messagebus/message_status_counter.cpp b/library/cpp/messagebus/message_status_counter.cpp index 891c8f5bb2b..d76732efca4 100644 --- a/library/cpp/messagebus/message_status_counter.cpp +++ b/library/cpp/messagebus/message_status_counter.cpp @@ -21,7 +21,7 @@ TMessageStatusCounter& TMessageStatusCounter::operator+=(const TMessageStatusCou return *this; } -TString TMessageStatusCounter::PrintToString() const { +TString TMessageStatusCounter::PrintToString() const { TStringStream ss; TKeyValuePrinter p; bool hasNonZeros = false; diff --git a/library/cpp/messagebus/message_status_counter.h b/library/cpp/messagebus/message_status_counter.h index e8ba2fdd31d..7288d624558 100644 --- a/library/cpp/messagebus/message_status_counter.h +++ b/library/cpp/messagebus/message_status_counter.h @@ -4,7 +4,7 @@ #include <library/cpp/messagebus/monitoring/mon_proto.pb.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <array> diff --git a/library/cpp/messagebus/messqueue.cpp b/library/cpp/messagebus/messqueue.cpp index 3474d62705f..cc9b53391be 100644 --- a/library/cpp/messagebus/messqueue.cpp +++ b/library/cpp/messagebus/messqueue.cpp @@ -36,7 +36,7 @@ TBusMessageQueuePtr NBus::CreateMessageQueue(const char* name) { } namespace { - TBusQueueConfig QueueConfigFillDefaults(const TBusQueueConfig& orig, const TString& name) { + TBusQueueConfig QueueConfigFillDefaults(const TBusQueueConfig& orig, const TString& name) { TBusQueueConfig patched = orig; if (!patched.Name) { patched.Name = name; @@ -85,15 +85,15 @@ TBusMessageQueueStatus TBusMessageQueue::GetStatusRecordInternal() const { return r; } -TString TBusMessageQueue::GetStatusSelf() const { +TString TBusMessageQueue::GetStatusSelf() const { return GetStatusRecordInternal().PrintToString(); } -TString TBusMessageQueue::GetStatusSingleLine() const { +TString TBusMessageQueue::GetStatusSingleLine() const { return WorkQueue->GetStatusSingleLine(); } -TString TBusMessageQueue::GetStatus(ui16 flags) const { +TString TBusMessageQueue::GetStatus(ui16 flags) const { TStringStream ss; ss << GetStatusSelf(); @@ -193,6 +193,6 @@ void TBusMessageQueue::Schedule(IScheduleItemAutoPtr i) { Scheduler.Schedule(i); } -TString TBusMessageQueue::GetNameInternal() const { +TString TBusMessageQueue::GetNameInternal() const { return Config.Name; } diff --git a/library/cpp/messagebus/misc/granup.h b/library/cpp/messagebus/misc/granup.h index 36ecfebc93a..d0bc6212768 100644 --- a/library/cpp/messagebus/misc/granup.h +++ b/library/cpp/messagebus/misc/granup.h @@ -11,7 +11,7 @@ namespace NBus { public: TGranUp(TDuration gran) : Gran(gran) - , Next(TInstant::MicroSeconds(0)) + , Next(TInstant::MicroSeconds(0)) { } diff --git a/library/cpp/messagebus/network.cpp b/library/cpp/messagebus/network.cpp index 304bedae5ac..eb034fc149d 100644 --- a/library/cpp/messagebus/network.cpp +++ b/library/cpp/messagebus/network.cpp @@ -94,7 +94,7 @@ namespace { } std::pair<unsigned, TVector<TBindResult>> NBus::BindOnPort(int port, bool reusePort) { - std::pair<unsigned, TVector<TBindResult>> r; + std::pair<unsigned, TVector<TBindResult>> r; r.second.reserve(2); if (port != 0) { diff --git a/library/cpp/messagebus/network_ut.cpp b/library/cpp/messagebus/network_ut.cpp index f1798419db2..d7dc830ee04 100644 --- a/library/cpp/messagebus/network_ut.cpp +++ b/library/cpp/messagebus/network_ut.cpp @@ -40,7 +40,7 @@ Y_UNIT_TEST_SUITE(Network) { TVector<TBindResult> r = BindOnPort(FixedPort, false).second; UNIT_ASSERT_VALUES_EQUAL(size_t(2), r.size()); - for (TVector<TBindResult>::iterator i = r.begin(); i != r.end(); ++i) { + for (TVector<TBindResult>::iterator i = r.begin(); i != r.end(); ++i) { UNIT_ASSERT_VALUES_EQUAL(i->Addr.GetPort(), GetSockPort(i->Socket->operator SOCKET())); } } @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(Network) { TVector<TBindResult> r = BindOnPort(0, false).second; UNIT_ASSERT_VALUES_EQUAL(size_t(2), r.size()); - for (TVector<TBindResult>::iterator i = r.begin(); i != r.end(); ++i) { + for (TVector<TBindResult>::iterator i = r.begin(); i != r.end(); ++i) { UNIT_ASSERT_VALUES_EQUAL(i->Addr.GetPort(), GetSockPort(i->Socket->operator SOCKET())); UNIT_ASSERT(i->Addr.GetPort() > 0); } diff --git a/library/cpp/messagebus/nondestroying_holder.h b/library/cpp/messagebus/nondestroying_holder.h index f4725d696f7..af8d2ac6a39 100644 --- a/library/cpp/messagebus/nondestroying_holder.h +++ b/library/cpp/messagebus/nondestroying_holder.h @@ -5,12 +5,12 @@ template <typename T> class TNonDestroyingHolder: public THolder<T> { public: - TNonDestroyingHolder(T* t = nullptr) noexcept + TNonDestroyingHolder(T* t = nullptr) noexcept : THolder<T>(t) { } - TNonDestroyingHolder(TAutoPtr<T> t) noexcept + TNonDestroyingHolder(TAutoPtr<T> t) noexcept : THolder<T>(t) { } @@ -23,17 +23,17 @@ public: template <class T> class TNonDestroyingAutoPtr: public TAutoPtr<T> { public: - inline TNonDestroyingAutoPtr(T* t = 0) noexcept + inline TNonDestroyingAutoPtr(T* t = 0) noexcept : TAutoPtr<T>(t) { } - inline TNonDestroyingAutoPtr(const TAutoPtr<T>& t) noexcept + inline TNonDestroyingAutoPtr(const TAutoPtr<T>& t) noexcept : TAutoPtr<T>(t.Release()) { } - inline ~TNonDestroyingAutoPtr() { + inline ~TNonDestroyingAutoPtr() { Y_VERIFY(!*this, "stored object must be explicitly released"); } }; diff --git a/library/cpp/messagebus/oldmodule/module.cpp b/library/cpp/messagebus/oldmodule/module.cpp index 24bd778799f..d29fe9d4a03 100644 --- a/library/cpp/messagebus/oldmodule/module.cpp +++ b/library/cpp/messagebus/oldmodule/module.cpp @@ -769,7 +769,7 @@ void TBusModuleImpl::AddJob(TJobRunner* jobRunner) { } void TBusModuleImpl::DestroyJob(TJobRunner* job) { - Y_ASSERT(job->JobStorageIterator != TList<TJobRunner*>::iterator()); + Y_ASSERT(job->JobStorageIterator != TList<TJobRunner*>::iterator()); { TWhatThreadDoesAcquireGuard<TMutex> G(Lock, "modules: acquiring lock for DestroyJob"); @@ -784,7 +784,7 @@ void TBusModuleImpl::DestroyJob(TJobRunner* job) { } } - job->JobStorageIterator = TList<TJobRunner*>::iterator(); + job->JobStorageIterator = TList<TJobRunner*>::iterator(); } void TBusModuleImpl::OnMessageReceived(TAutoPtr<TBusMessage> msg0, TOnMessageContext& context) { diff --git a/library/cpp/messagebus/queue_config.cpp b/library/cpp/messagebus/queue_config.cpp index 78fb52ee49b..d8f7b4eb22c 100644 --- a/library/cpp/messagebus/queue_config.cpp +++ b/library/cpp/messagebus/queue_config.cpp @@ -15,7 +15,7 @@ void TBusQueueConfig::ConfigureLastGetopt( .StoreResult(&NumWorkers); } -TString TBusQueueConfig::PrintToString() const { +TString TBusQueueConfig::PrintToString() const { TStringStream ss; ss << "NumWorkers=" << NumWorkers << "\n"; return ss.Str(); diff --git a/library/cpp/messagebus/rain_check/core/task.cpp b/library/cpp/messagebus/rain_check/core/task.cpp index a098437d534..eeed343dc90 100644 --- a/library/cpp/messagebus/rain_check/core/task.cpp +++ b/library/cpp/messagebus/rain_check/core/task.cpp @@ -207,7 +207,7 @@ ITaskBase* TTaskRunnerBase::CurrentTaskImpl() { return CurrentTask()->GetImplBase(); } -TString TTaskRunnerBase::GetStatusSingleLine() { +TString TTaskRunnerBase::GetStatusSingleLine() { return TypeName(*Impl); } diff --git a/library/cpp/messagebus/rain_check/core/task.h b/library/cpp/messagebus/rain_check/core/task.h index 7d8778bcda5..4e8925966c3 100644 --- a/library/cpp/messagebus/rain_check/core/task.h +++ b/library/cpp/messagebus/rain_check/core/task.h @@ -144,7 +144,7 @@ namespace NRainCheck { bool SetDoneCalled; // Subtasks currently executed. - TVector<TSubtaskCompletion*> Pending; + TVector<TSubtaskCompletion*> Pending; void Act(NActor::TDefaultTag); @@ -158,7 +158,7 @@ namespace NRainCheck { static TTaskRunnerBase* CurrentTask(); static ITaskBase* CurrentTaskImpl(); - TString GetStatusSingleLine(); + TString GetStatusSingleLine(); protected: //void RetainRef(); diff --git a/library/cpp/messagebus/rain_check/core/track.cpp b/library/cpp/messagebus/rain_check/core/track.cpp index 092a51a2143..b2efe796b07 100644 --- a/library/cpp/messagebus/rain_check/core/track.cpp +++ b/library/cpp/messagebus/rain_check/core/track.cpp @@ -7,7 +7,7 @@ void TTaskTrackerReceipt::SetDone() { TaskTracker->GetQueue<TTaskTrackerReceipt*>()->EnqueueAndSchedule(this); } -TString TTaskTrackerReceipt::GetStatusSingleLine() { +TString TTaskTrackerReceipt::GetStatusSingleLine() { return Task->GetStatusSingleLine(); } diff --git a/library/cpp/messagebus/rain_check/core/track.h b/library/cpp/messagebus/rain_check/core/track.h index d387de75742..77ca8826790 100644 --- a/library/cpp/messagebus/rain_check/core/track.h +++ b/library/cpp/messagebus/rain_check/core/track.h @@ -31,7 +31,7 @@ namespace NRainCheck { void SetDone() override; - TString GetStatusSingleLine(); + TString GetStatusSingleLine(); }; struct TTaskTrackerStatus { diff --git a/library/cpp/messagebus/rain_check/http/client.h b/library/cpp/messagebus/rain_check/http/client.h index d4199c4c98d..5daa4aec639 100644 --- a/library/cpp/messagebus/rain_check/http/client.h +++ b/library/cpp/messagebus/rain_check/http/client.h @@ -6,7 +6,7 @@ #include <util/generic/maybe.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/defaults.h> #include <util/system/yassert.h> diff --git a/library/cpp/messagebus/rain_check/http/client_ut.cpp b/library/cpp/messagebus/rain_check/http/client_ut.cpp index 16281143911..0dc01ef18ac 100644 --- a/library/cpp/messagebus/rain_check/http/client_ut.cpp +++ b/library/cpp/messagebus/rain_check/http/client_ut.cpp @@ -13,7 +13,7 @@ #include <util/generic/cast.h> #include <util/generic/ptr.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/network/ip.h> #include <util/stream/str.h> diff --git a/library/cpp/messagebus/remote_client_session.cpp b/library/cpp/messagebus/remote_client_session.cpp index 3bc421944f9..da6a2b3b096 100644 --- a/library/cpp/messagebus/remote_client_session.cpp +++ b/library/cpp/messagebus/remote_client_session.cpp @@ -60,7 +60,7 @@ EMessageStatus TRemoteClientSession::SendMessageOneWay(TBusMessage* pMes, const return SendMessageImpl(pMes, addr, wait, true); } -int TRemoteClientSession::GetInFlight() const noexcept { +int TRemoteClientSession::GetInFlight() const noexcept { return ClientRemoteInFlight.GetCurrent(); } diff --git a/library/cpp/messagebus/remote_connection_status.cpp b/library/cpp/messagebus/remote_connection_status.cpp index 2c48b2a287c..7fc42915734 100644 --- a/library/cpp/messagebus/remote_connection_status.cpp +++ b/library/cpp/messagebus/remote_connection_status.cpp @@ -47,7 +47,7 @@ TDurationCounter& TDurationCounter::operator+=(const TDurationCounter& that) { return *this; } -TString TDurationCounter::ToString() const { +TString TDurationCounter::ToString() const { if (Count == 0) { return "0"; } else { @@ -154,7 +154,7 @@ TConnectionStatusMonRecord TRemoteConnectionStatus::GetStatusProtobuf() const { return status; } -TString TRemoteConnectionStatus::PrintToString() const { +TString TRemoteConnectionStatus::PrintToString() const { TStringStream ss; TKeyValuePrinter p; @@ -231,7 +231,7 @@ TRemoteConnectionStatus::TRemoteConnectionStatus() { } -TString TSessionDumpStatus::PrintToString() const { +TString TSessionDumpStatus::PrintToString() const { if (Shutdown) { return "shutdown"; } diff --git a/library/cpp/messagebus/remote_server_session.cpp b/library/cpp/messagebus/remote_server_session.cpp index 6abbf88a606..66deb7de313 100644 --- a/library/cpp/messagebus/remote_server_session.cpp +++ b/library/cpp/messagebus/remote_server_session.cpp @@ -130,7 +130,7 @@ EMessageStatus TRemoteServerSession::SendReply(const TBusIdentity& ident, TBusMe return MESSAGE_OK; } -int TRemoteServerSession::GetInFlight() const noexcept { +int TRemoteServerSession::GetInFlight() const noexcept { return ServerOwnedMessages.GetCurrentCount(); } diff --git a/library/cpp/messagebus/session.h b/library/cpp/messagebus/session.h index fb12ab7c229..f9340a380b3 100644 --- a/library/cpp/messagebus/session.h +++ b/library/cpp/messagebus/session.h @@ -126,7 +126,7 @@ namespace NBus { IBusServerHandler* handler, const TBusServerSessionConfig& config, TBusMessageQueuePtr queue, - const TVector<TBindResult>& bindTo); + const TVector<TBindResult>& bindTo); // TODO: make parameter non-const virtual EMessageStatus SendReply(const TBusIdentity& ident, TBusMessage* pRep) = 0; diff --git a/library/cpp/messagebus/session_impl.cpp b/library/cpp/messagebus/session_impl.cpp index ddf9f360c43..809e1c170fd 100644 --- a/library/cpp/messagebus/session_impl.cpp +++ b/library/cpp/messagebus/session_impl.cpp @@ -52,7 +52,7 @@ struct TBusSessionImpl::TImpl { }; namespace { - TBusSessionConfig SessionConfigFillDefaults(const TBusSessionConfig& config, const TString& name) { + TBusSessionConfig SessionConfigFillDefaults(const TBusSessionConfig& config, const TString& name) { TBusSessionConfig copy = config; if (copy.TotalTimeout == 0 && copy.SendTimeout == 0) { copy.TotalTimeout = TDuration::Seconds(60).MilliSeconds(); @@ -154,7 +154,7 @@ void TBusSessionImpl::Shutdown() { // shutdown acceptors before connections // so they won't create more connections - TVector<TAcceptorPtr> acceptors; + TVector<TAcceptorPtr> acceptors; GetAcceptors(&acceptors); { TGuard<TMutex> guard(ConnectionsLock); @@ -166,7 +166,7 @@ void TBusSessionImpl::Shutdown() { } // shutdown connections - TVector<TRemoteConnectionPtr> cs; + TVector<TRemoteConnectionPtr> cs; GetConnections(&cs); for (auto& c : cs) { @@ -241,7 +241,7 @@ TSessionDumpStatus TBusSessionImpl::GetStatusRecordInternal() { return StatusData.StatusDumpCached; } -TString TBusSessionImpl::GetStatus(ui16 flags) { +TString TBusSessionImpl::GetStatus(ui16 flags) { Y_UNUSED(flags); return GetStatusRecordInternal().PrintToString(); @@ -256,7 +256,7 @@ TConnectionStatusMonRecord TBusSessionImpl::GetStatusProtobuf() { return StatusData.StatusDumpCached.ConnectionStatusSummary.GetStatusProtobuf(); } -TString TBusSessionImpl::GetStatusSingleLine() { +TString TBusSessionImpl::GetStatusSingleLine() { TSessionDumpStatus status = GetStatusRecordInternal(); TStringStream ss; @@ -308,7 +308,7 @@ void TBusSessionImpl::ProcessItem(TConnectionTag, TRemoveTag, TRemoteConnectionP } } - THashMap<ui64, TRemoteConnectionPtr>::iterator it2 = ConnectionsById.find(c->ConnectionId); + THashMap<ui64, TRemoteConnectionPtr>::iterator it2 = ConnectionsById.find(c->ConnectionId); if (it2 != ConnectionsById.end()) { ConnectionsById.erase(it2); } @@ -317,12 +317,12 @@ void TBusSessionImpl::ProcessItem(TConnectionTag, TRemoveTag, TRemoteConnectionP } void TBusSessionImpl::ProcessConnectionsAcceptorsShapshotQueueItem(TAtomicSharedPtr<TConnectionsAcceptorsSnapshot> snapshot) { - for (TVector<TRemoteConnectionPtr>::const_iterator connection = snapshot->Connections.begin(); + for (TVector<TRemoteConnectionPtr>::const_iterator connection = snapshot->Connections.begin(); connection != snapshot->Connections.end(); ++connection) { Y_ASSERT((*connection)->ConnectionId <= snapshot->LastConnectionId); } - for (TVector<TAcceptorPtr>::const_iterator acceptor = snapshot->Acceptors.begin(); + for (TVector<TAcceptorPtr>::const_iterator acceptor = snapshot->Acceptors.begin(); acceptor != snapshot->Acceptors.end(); ++acceptor) { Y_ASSERT((*acceptor)->AcceptorId <= snapshot->LastAcceptorId); } @@ -355,7 +355,7 @@ void TBusSessionImpl::StatusUpdateCachedDump() { { TStringStream ss; - TString name = Config.Name; + TString name = Config.Name; if (!name) { name = "unnamed"; } @@ -373,8 +373,8 @@ void TBusSessionImpl::StatusUpdateCachedDump() { r.Head = ss.Str(); } - TVector<TRemoteConnectionPtr>& connections = StatusData.ConnectionsAcceptorsSnapshot->Connections; - TVector<TAcceptorPtr>& acceptors = StatusData.ConnectionsAcceptorsSnapshot->Acceptors; + TVector<TRemoteConnectionPtr>& connections = StatusData.ConnectionsAcceptorsSnapshot->Connections; + TVector<TAcceptorPtr>& acceptors = StatusData.ConnectionsAcceptorsSnapshot->Acceptors; r.ConnectionStatusSummary = TRemoteConnectionStatus(); r.ConnectionStatusSummary.Summary = true; @@ -387,7 +387,7 @@ void TBusSessionImpl::StatusUpdateCachedDump() { { TStringStream ss; - for (TVector<TAcceptorPtr>::const_iterator acceptor = acceptors.begin(); + for (TVector<TAcceptorPtr>::const_iterator acceptor = acceptors.begin(); acceptor != acceptors.end(); ++acceptor) { const TAcceptorStatus status = (*acceptor)->GranStatus.Listen.Get(); @@ -405,7 +405,7 @@ void TBusSessionImpl::StatusUpdateCachedDump() { { TStringStream ss; - for (TVector<TRemoteConnectionPtr>::const_iterator connection = connections.begin(); + for (TVector<TRemoteConnectionPtr>::const_iterator connection = connections.begin(); connection != connections.end(); ++connection) { if (connection != connections.begin()) { ss << "\n"; @@ -544,17 +544,17 @@ void TBusSessionImpl::InsertAcceptorLockAcquired(TAcceptor* acceptor) { SendSnapshotToStatusActor(); } -void TBusSessionImpl::GetConnections(TVector<TRemoteConnectionPtr>* r) { +void TBusSessionImpl::GetConnections(TVector<TRemoteConnectionPtr>* r) { TConnectionsGuard guard(ConnectionsLock); GetConnectionsLockAquired(r); } -void TBusSessionImpl::GetAcceptors(TVector<TAcceptorPtr>* r) { +void TBusSessionImpl::GetAcceptors(TVector<TAcceptorPtr>* r) { TConnectionsGuard guard(ConnectionsLock); GetAcceptorsLockAquired(r); } -void TBusSessionImpl::GetConnectionsLockAquired(TVector<TRemoteConnectionPtr>* r) { +void TBusSessionImpl::GetConnectionsLockAquired(TVector<TRemoteConnectionPtr>* r) { //Y_ASSERT(ConnectionsLock.IsLocked()); r->reserve(Connections.size()); @@ -564,7 +564,7 @@ void TBusSessionImpl::GetConnectionsLockAquired(TVector<TRemoteConnectionPtr>* r } } -void TBusSessionImpl::GetAcceptorsLockAquired(TVector<TAcceptorPtr>* r) { +void TBusSessionImpl::GetAcceptorsLockAquired(TVector<TAcceptorPtr>* r) { //Y_ASSERT(ConnectionsLock.IsLocked()); r->reserve(Acceptors.size()); @@ -577,7 +577,7 @@ void TBusSessionImpl::GetAcceptorsLockAquired(TVector<TAcceptorPtr>* r) { TRemoteConnectionPtr TBusSessionImpl::GetConnectionById(ui64 id) { TConnectionsGuard guard(ConnectionsLock); - THashMap<ui64, TRemoteConnectionPtr>::const_iterator it = ConnectionsById.find(id); + THashMap<ui64, TRemoteConnectionPtr>::const_iterator it = ConnectionsById.find(id); if (it == ConnectionsById.end()) { return nullptr; } else { @@ -623,7 +623,7 @@ TRemoteConnectionPtr TBusSessionImpl::GetConnection(const TBusSocketAddr& addr, } void TBusSessionImpl::Cron() { - TVector<TRemoteConnectionPtr> connections; + TVector<TRemoteConnectionPtr> connections; GetConnections(&connections); for (const auto& it : connections) { @@ -642,7 +642,7 @@ void TBusSessionImpl::Cron() { Queue->Schedule(IScheduleItemAutoPtr(new TScheduleSession(this, TInstant::Now() + Config.Secret.TimeoutPeriod))); } -TString TBusSessionImpl::GetNameInternal() { +TString TBusSessionImpl::GetNameInternal() { if (!!Config.Name) { return Config.Name; } diff --git a/library/cpp/messagebus/socket_addr_ut.cpp b/library/cpp/messagebus/socket_addr_ut.cpp index 783bb62a861..0b6a19efa19 100644 --- a/library/cpp/messagebus/socket_addr_ut.cpp +++ b/library/cpp/messagebus/socket_addr_ut.cpp @@ -10,6 +10,6 @@ using namespace NBus::NPrivate; Y_UNIT_TEST_SUITE(TBusSocketAddr) { Y_UNIT_TEST(Simple) { - UNIT_ASSERT_VALUES_EQUAL(TString("127.0.0.1:80"), ToString(TBusSocketAddr("127.0.0.1", 80))); + UNIT_ASSERT_VALUES_EQUAL(TString("127.0.0.1:80"), ToString(TBusSocketAddr("127.0.0.1", 80))); } } diff --git a/library/cpp/messagebus/synchandler.cpp b/library/cpp/messagebus/synchandler.cpp index 8e891d66b30..ae69523ed9d 100644 --- a/library/cpp/messagebus/synchandler.cpp +++ b/library/cpp/messagebus/synchandler.cpp @@ -186,7 +186,7 @@ const TBusClientSession* TBusSyncSourceSession::GetBusClientSessionWorkaroundDoN return Session.Get(); } -TBusSyncClientSessionPtr TBusMessageQueue::CreateSyncSource(TBusProtocol* proto, const TBusClientSessionConfig& config, bool needReply, const TString& name) { +TBusSyncClientSessionPtr TBusMessageQueue::CreateSyncSource(TBusProtocol* proto, const TBusClientSessionConfig& config, bool needReply, const TString& name) { TIntrusivePtr<TBusSyncSourceSessionImpl> session = new TBusSyncSourceSessionImpl(this, proto, config, needReply, name); Add(session.Get()); return new TBusSyncSourceSession(session); diff --git a/library/cpp/messagebus/test/helper/example.cpp b/library/cpp/messagebus/test/helper/example.cpp index 7c6d704042c..f5b21be799b 100644 --- a/library/cpp/messagebus/test/helper/example.cpp +++ b/library/cpp/messagebus/test/helper/example.cpp @@ -19,12 +19,12 @@ static void FillWithJunk(TArrayRef<char> data) { } } -static TString JunkString(size_t len) { +static TString JunkString(size_t len) { TTempBuf temp(len); TArrayRef<char> tempArrayRef(temp.Data(), len); FillWithJunk(tempArrayRef); - return TString(tempArrayRef.data(), tempArrayRef.size()); + return TString(tempArrayRef.data(), tempArrayRef.size()); } TExampleRequest::TExampleRequest(TAtomic* counterPtr, size_t payloadSize) diff --git a/library/cpp/messagebus/test/helper/hanging_server.h b/library/cpp/messagebus/test/helper/hanging_server.h index cc9fb274d8a..f6b9af24e21 100644 --- a/library/cpp/messagebus/test/helper/hanging_server.h +++ b/library/cpp/messagebus/test/helper/hanging_server.h @@ -6,7 +6,7 @@ class THangingServer { private: - std::pair<unsigned, TVector<NBus::TBindResult>> BindResult; + std::pair<unsigned, TVector<NBus::TBindResult>> BindResult; public: // listen on given port, and nothing else diff --git a/library/cpp/messagebus/test/perftest/perftest.cpp b/library/cpp/messagebus/test/perftest/perftest.cpp index 84893192789..dd2dd69e4da 100644 --- a/library/cpp/messagebus/test/perftest/perftest.cpp +++ b/library/cpp/messagebus/test/perftest/perftest.cpp @@ -17,7 +17,7 @@ #include <library/cpp/threading/future/legacy_future.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> #include <util/random/random.h> @@ -76,7 +76,7 @@ struct TPerftestConfig { extern TPerftestConfig* TheConfig; extern bool TheExit; -TVector<TNetAddr> ServerAddresses; +TVector<TNetAddr> ServerAddresses; struct TConfig { TBusQueueConfig ServerQueueConfig; @@ -142,13 +142,13 @@ TAutoPtr<TBusMessage> NewRequest() { TAutoPtr<TPerftestRequest> r(new TPerftestRequest); r->SetCompressed(TheConfig->UseCompression); // TODO: use random content for better compression test - r->Record.SetData(TString(RequestSize(), '?')); + r->Record.SetData(TString(RequestSize(), '?')); return r.Release(); } } void CheckRequest(TPerftestRequest* request) { - const TString& data = request->Record.GetData(); + const TString& data = request->Record.GetData(); for (size_t i = 0; i != data.size(); ++i) { Y_VERIFY(data.at(i) == '?', "must be question mark"); } @@ -162,7 +162,7 @@ TAutoPtr<TPerftestResponse> NewResponse(TPerftestRequest* request) { } void CheckResponse(TPerftestResponse* response) { - const TString& data = response->Record.GetData(); + const TString& data = response->Record.GetData(); for (size_t i = 0; i != data.size(); ++i) { Y_VERIFY(data.at(i) == '.', "must be dot"); } @@ -237,7 +237,7 @@ public: TBusClientSessionPtr Session; THolder<TBusProtocol> Proto; TBusMessageQueuePtr Bus; - TVector<TBusClientConnectionPtr> Connections; + TVector<TBusClientConnectionPtr> Connections; public: /// constructor creates instances of protocol and session @@ -470,10 +470,10 @@ static TNetworkAddress ParseNetworkAddress(const char* string) { return TNetworkAddress(Name, Port); } -TVector<TNetAddr> ParseNodes(const TString nodes) { - TVector<TNetAddr> r; +TVector<TNetAddr> ParseNodes(const TString nodes) { + TVector<TNetAddr> r; - TVector<TString> hosts; + TVector<TString> hosts; size_t numh = Split(nodes.data(), ",", hosts); @@ -583,7 +583,7 @@ void TTestStats::PeriodicallyPrint() { stats << IndentText(client->Bus->GetStatus()); } - TUnbufferedFileOutput("stats").Write(stats.Str()); + TUnbufferedFileOutput("stats").Write(stats.Str()); } } diff --git a/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp b/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp index 3fdd175d736..a930e26dcdc 100644 --- a/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp +++ b/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp @@ -31,7 +31,7 @@ void TLocatorRegisterUniqTest::TestRegister() { /// YBUS_KEYMIN YBUS_KEYMAX range UNIT_ASSERT(keys.size() == 1); - TVector<NBus::TNetAddr> hosts; + TVector<NBus::TNetAddr> hosts; UNIT_ASSERT(locator.LocateAll(serviceName, NBus::YBUS_KEYMIN, hosts) == 1); locator.Register(serviceName, hostName, port); diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp index 040f9b77022..5bae0e7bb9d 100644 --- a/library/cpp/messagebus/test/ut/messagebus_ut.cpp +++ b/library/cpp/messagebus/test/ut/messagebus_ut.cpp @@ -311,7 +311,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { TSystemEvent MessageReceivedEvent; // 1 wait for 1 message TBusServerSessionPtr Session; TMutex Lock_; - TDeque<TAutoPtr<TOnMessageContext>> DelayedMessages; + TDeque<TAutoPtr<TOnMessageContext>> DelayedMessages; TDelayReplyServer() : MessageReceivedEvent(TEventResetType::rAuto) diff --git a/library/cpp/messagebus/www/concat_strings.h b/library/cpp/messagebus/www/concat_strings.h index 7b730564ebb..86f6609c1d2 100644 --- a/library/cpp/messagebus/www/concat_strings.h +++ b/library/cpp/messagebus/www/concat_strings.h @@ -1,9 +1,9 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/str.h> -// ATTN: not equivalent to TString::Join - cat concat anything "outputable" to stream, not only TString convertable types. +// ATTN: not equivalent to TString::Join - cat concat anything "outputable" to stream, not only TString convertable types. inline void DoConcatStrings(TStringStream&) { } @@ -15,7 +15,7 @@ inline void DoConcatStrings(TStringStream& ss, const T& t, const R&... r) { } template <class... R> -inline TString ConcatStrings(const R&... r) { +inline TString ConcatStrings(const R&... r) { TStringStream ss; DoConcatStrings(ss, r...); return ss.Str(); diff --git a/library/cpp/messagebus/www/html_output.h b/library/cpp/messagebus/www/html_output.h index 27e77adefa7..551f0ba6930 100644 --- a/library/cpp/messagebus/www/html_output.h +++ b/library/cpp/messagebus/www/html_output.h @@ -29,7 +29,7 @@ struct THtmlOutputStreamPushPop { }; struct TChars { - TString Text; + TString Text; bool NeedEscape; TChars(TStringBuf text) @@ -53,7 +53,7 @@ struct TChars { { } - TString Escape() { + TString Escape() { if (NeedEscape) { return EncodeHtmlPcdata(Text); } else { @@ -63,8 +63,8 @@ struct TChars { }; struct TAttr { - TString Name; - TString Value; + TString Name; + TString Value; TAttr(TStringBuf name, TStringBuf value) : Name(name) @@ -157,7 +157,7 @@ static inline void Small(TStringBuf text) { } static inline void HnWithSmall(unsigned n, TStringBuf title, TStringBuf small) { - TString tagName = ConcatStrings("h", n); + TString tagName = ConcatStrings("h", n); Open(tagName); HtmlOutputStream() << title; Sp(); @@ -268,7 +268,7 @@ static inline void Code(TStringBuf content) { } struct TTagGuard { - const TString TagName; + const TString TagName; TTagGuard(TStringBuf tagName, TStringBuf cssClass, TStringBuf id = "") : TagName(tagName) diff --git a/library/cpp/messagebus/www/www.cpp b/library/cpp/messagebus/www/www.cpp index 62ec241d852..a285a6367ab 100644 --- a/library/cpp/messagebus/www/www.cpp +++ b/library/cpp/messagebus/www/www.cpp @@ -48,7 +48,7 @@ namespace { return TValuePtr(); } - TString FindNameByPtr(TValuePtr value) { + TString FindNameByPtr(TValuePtr value) { Y_VERIFY(!!value); for (unsigned i = 0; i < Entries.size(); ++i) { @@ -80,11 +80,11 @@ namespace { } for (unsigned i = 1;; ++i) { - TString prefix = p->GetNameInternal(); + TString prefix = p->GetNameInternal(); if (!prefix) { prefix = "unnamed"; } - TString name = ConcatStrings(prefix, "-", i); + TString name = ConcatStrings(prefix, "-", i); TValuePtr current = FindByName(name); @@ -108,8 +108,8 @@ namespace { struct TSessionValues: public TNamedValues<TSessionPtr> { typedef TNamedValues<TSessionPtr> TBase; - TVector<TString> GetNamesForQueue(TBusMessageQueue* queue) { - TVector<TString> r; + TVector<TString> GetNamesForQueue(TBusMessageQueue* queue) { + TVector<TString> r; for (unsigned i = 0; i < TBase::size(); ++i) { if (TBase::Entries[i].second->GetQueue() == queue) { r.push_back(TBase::Entries[i].first); @@ -211,14 +211,14 @@ struct TBusWww::TImpl { TGuard<TMutex> g(Mutex); { - TVector<TBusClientSessionPtr> clientSessions = module->GetInternal()->GetClientSessionsInternal(); + TVector<TBusClientSessionPtr> clientSessions = module->GetInternal()->GetClientSessionsInternal(); for (unsigned i = 0; i < clientSessions.size(); ++i) { RegisterClientSession(clientSessions[i]); } } { - TVector<TBusServerSessionPtr> serverSessions = module->GetInternal()->GetServerSessionsInternal(); + TVector<TBusServerSessionPtr> serverSessions = module->GetInternal()->GetServerSessionsInternal(); for (unsigned i = 0; i < serverSessions.size(); ++i) { RegisterServerSession(serverSessions[i]); } @@ -228,7 +228,7 @@ struct TBusWww::TImpl { Modules.Add(module->GetInternal()); } - TString FindQueueNameBySessionName(TStringBuf sessionName, bool client) { + TString FindQueueNameBySessionName(TStringBuf sessionName, bool client) { TIntrusivePtr<TBusClientSession> clientSession; TIntrusivePtr<TBusServerSession> serverSession; TBusSession* session; @@ -288,7 +288,7 @@ struct TBusWww::TImpl { } void BreadcrumbSession(TStringBuf sessionName, bool client) { - TString queueName = Outer->FindQueueNameBySessionName(sessionName, client); + TString queueName = Outer->FindQueueNameBySessionName(sessionName, client); TStringBuf whatSession = client ? "client session" : "server session"; TTagGuard ol("ol", "breadcrumb"); @@ -299,9 +299,9 @@ struct TBusWww::TImpl { } void ServeSessionsOfQueue(TBusMessageQueuePtr queue, bool includeQueue) { - TVector<TString> clientNames = Outer->ClientSessions.GetNamesForQueue(queue.Get()); - TVector<TString> serverNames = Outer->ServerSessions.GetNamesForQueue(queue.Get()); - TVector<TString> moduleNames = Outer->Modules.GetNamesForQueue(queue.Get()); + TVector<TString> clientNames = Outer->ClientSessions.GetNamesForQueue(queue.Get()); + TVector<TString> serverNames = Outer->ServerSessions.GetNamesForQueue(queue.Get()); + TVector<TString> moduleNames = Outer->Modules.GetNamesForQueue(queue.Get()); TTagGuard table("table", "table table-condensed table-bordered"); @@ -320,7 +320,7 @@ struct TBusWww::TImpl { } if (includeQueue) { - TTagGuard tr1("tr"); + TTagGuard tr1("tr"); Td("queue"); { @@ -329,7 +329,7 @@ struct TBusWww::TImpl { } { - TTagGuard tr2("td"); + TTagGuard tr2("td"); Pre(queue->GetStatusSingleLine()); } } @@ -385,7 +385,7 @@ struct TBusWww::TImpl { } } - void ServeQueue(const TString& name) { + void ServeQueue(const TString& name) { TBusMessageQueuePtr queue = Outer->Queues.FindByName(name); if (!queue) { @@ -518,7 +518,7 @@ struct TBusWww::TImpl { TSessionDumpStatus dumpStatus = session->GetStatusRecordInternal(); TBusMessageQueuePtr queue = session->GetQueue(); - TString queueName = Outer->Queues.FindNameByPtr(session->GetQueue()); + TString queueName = Outer->Queues.FindNameByPtr(session->GetQueue()); BreadcrumbSession(name, client); @@ -585,7 +585,7 @@ struct TBusWww::TImpl { NJsonWriter::TBuf buf(NJsonWriter::HEM_ESCAPE_HTML); buf.BeginList(); for (unsigned i = 0; i < h.Times.size(); ++i) { - TString label = TDurationHistogram::LabelBefore(i); + TString label = TDurationHistogram::LabelBefore(i); buf.BeginList(); buf.WriteString(label); buf.WriteLongLong(h.Times[i]); @@ -612,7 +612,7 @@ struct TBusWww::TImpl { H1("MessageBus queues"); for (unsigned i = 0; i < Outer->Queues.size(); ++i) { - TString queueName = Outer->Queues.Entries[i].first; + TString queueName = Outer->Queues.Entries[i].first; TBusMessageQueuePtr queue = Outer->Queues.Entries[i].second; HnWithSmall(3, queueName, "(queue)"); @@ -680,7 +680,7 @@ struct TBusWww::TImpl { status.ConnectionStatusSummary.ReaderStatus.Incremental.MessageCounter); } - void ServeSolomonJson(const TString& q, const TString& cs, const TString& ss) { + void ServeSolomonJson(const TString& q, const TString& cs, const TString& ss) { Y_UNUSED(q); Y_UNUSED(cs); Y_UNUSED(ss); @@ -692,15 +692,15 @@ struct TBusWww::TImpl { sj.OpenMetrics(); for (unsigned i = 0; i < Outer->Queues.size(); ++i) { - TString queueName = Outer->Queues.Entries[i].first; + TString queueName = Outer->Queues.Entries[i].first; TBusMessageQueuePtr queue = Outer->Queues.Entries[i].second; if (all || q == queueName) { WriteQueueSensors(sj, queueName, &*queue); } - TVector<TString> clientNames = Outer->ClientSessions.GetNamesForQueue(queue.Get()); - TVector<TString> serverNames = Outer->ServerSessions.GetNamesForQueue(queue.Get()); - TVector<TString> moduleNames = Outer->Modules.GetNamesForQueue(queue.Get()); + TVector<TString> clientNames = Outer->ClientSessions.GetNamesForQueue(queue.Get()); + TVector<TString> serverNames = Outer->ServerSessions.GetNamesForQueue(queue.Get()); + TVector<TString> moduleNames = Outer->Modules.GetNamesForQueue(queue.Get()); for (auto& sessionName : clientNames) { if (all || cs == sessionName) { auto session = Outer->ClientSessions.FindByName(sessionName); @@ -728,7 +728,7 @@ struct TBusWww::TImpl { } else { os << HTTP_OK_BIN; } - TBlob blob = Singleton<TWwwStaticLoader>()->ObjectBlobByKey(TString("/") + TString(path)); + TBlob blob = Singleton<TWwwStaticLoader>()->ObjectBlobByKey(TString("/") + TString(path)); os.Write(blob.Data(), blob.Size()); } @@ -766,9 +766,9 @@ struct TBusWww::TImpl { if (solomonJson) { Os << HTTP_OK_JSON; - TString qp = q != CgiParams.end() ? q->first : ""; - TString csp = cs != CgiParams.end() ? cs->first : ""; - TString ssp = ss != CgiParams.end() ? ss->first : ""; + TString qp = q != CgiParams.end() ? q->first : ""; + TString csp = cs != CgiParams.end() ? cs->first : ""; + TString ssp = ss != CgiParams.end() ? ss->first : ""; ServeSolomonJson(qp, csp, ssp); } else { Os << HTTP_OK_HTML; @@ -870,7 +870,7 @@ struct TBusWwwHttpServer::TImpl: public THttpServer::ICallBack { } }; - TString MakeSimpleResponse(unsigned code, TString text, TString content = "") { + TString MakeSimpleResponse(unsigned code, TString text, TString content = "") { if (!content) { TStringStream contentSs; contentSs << code << " " << text; diff --git a/library/cpp/messagebus/www/www.h b/library/cpp/messagebus/www/www.h index 6cd652b4774..7180b5b6920 100644 --- a/library/cpp/messagebus/www/www.h +++ b/library/cpp/messagebus/www/www.h @@ -4,7 +4,7 @@ #include <library/cpp/messagebus/oldmodule/module.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <library/cpp/cgiparam/cgiparam.h> namespace NBus { diff --git a/library/cpp/mime/types/mime.cpp b/library/cpp/mime/types/mime.cpp index 706d776b24d..8986cbc604d 100644 --- a/library/cpp/mime/types/mime.cpp +++ b/library/cpp/mime/types/mime.cpp @@ -42,7 +42,7 @@ private: const char* Ext; }; - typedef THashMap<const char*, int> TRecordHash; + typedef THashMap<const char*, int> TRecordHash; // Fields private: diff --git a/library/cpp/mime/types/mime.h b/library/cpp/mime/types/mime.h index 05da389ea9d..c2c97b58b21 100644 --- a/library/cpp/mime/types/mime.h +++ b/library/cpp/mime/types/mime.h @@ -69,4 +69,4 @@ MimeTypes mimeByStr(const TStringBuf& mimeStr); const char* strByMime(MimeTypes mime); // autogenerated with GENERATE_ENUM_SERIALIZATION -const TString& ToString(MimeTypes x); +const TString& ToString(MimeTypes x); diff --git a/library/cpp/monlib/counters/counters_ut.cpp b/library/cpp/monlib/counters/counters_ut.cpp index 2845efb97ba..7c029e2e095 100644 --- a/library/cpp/monlib/counters/counters_ut.cpp +++ b/library/cpp/monlib/counters/counters_ut.cpp @@ -42,7 +42,7 @@ Y_UNIT_TEST_SUITE(TDeprecatedCountersTest) { } // no duplication in group names - TSet<ui32> uniqueIds(ids->begin(), ids->end()); + TSet<ui32> uniqueIds(ids->begin(), ids->end()); UNIT_ASSERT_EQUAL(ids->size(), uniqueIds.size()); UNIT_ASSERT_EQUAL(ids->size(), GROUPS_COUNT); } diff --git a/library/cpp/monlib/dynamic_counters/counters.h b/library/cpp/monlib/dynamic_counters/counters.h index dc178cfbe01..52692f8149f 100644 --- a/library/cpp/monlib/dynamic_counters/counters.h +++ b/library/cpp/monlib/dynamic_counters/counters.h @@ -201,11 +201,11 @@ namespace NMonitoring { typedef TIntrusivePtr<TCountableBase> TCountablePtr; struct TChildId { - TString LabelName; - TString LabelValue; + TString LabelName; + TString LabelValue; TChildId() { } - TChildId(const TString& labelName, const TString& labelValue) + TChildId(const TString& labelName, const TString& labelValue) : LabelName(labelName) , LabelValue(labelValue) { @@ -329,8 +329,8 @@ namespace NMonitoring { void RemoveCounter(const TString &value); void RemoveNamedCounter(const TString& name, const TString &value); - TIntrusivePtr<TDynamicCounters> GetSubgroup(const TString& name, const TString& value); - TIntrusivePtr<TDynamicCounters> FindSubgroup(const TString& name, const TString& value) const; + TIntrusivePtr<TDynamicCounters> GetSubgroup(const TString& name, const TString& value); + TIntrusivePtr<TDynamicCounters> FindSubgroup(const TString& name, const TString& value) const; void RemoveSubgroup(const TString& name, const TString& value); void ReplaceSubgroup(const TString& name, const TString& value, TIntrusivePtr<TDynamicCounters> subgroup); diff --git a/library/cpp/monlib/dynamic_counters/golovan_page.cpp b/library/cpp/monlib/dynamic_counters/golovan_page.cpp index 49cf2d39bb6..cda0fdfcf27 100644 --- a/library/cpp/monlib/dynamic_counters/golovan_page.cpp +++ b/library/cpp/monlib/dynamic_counters/golovan_page.cpp @@ -61,7 +61,7 @@ public: private: IOutputStream& out; bool FirstCounter; - TString prefix; + TString prefix; }; TGolovanCountersPage::TGolovanCountersPage(const TString& path, TIntrusivePtr<NMonitoring::TDynamicCounters> counters, diff --git a/library/cpp/monlib/dynamic_counters/page.cpp b/library/cpp/monlib/dynamic_counters/page.cpp index 5124a47bb33..649a232ca8f 100644 --- a/library/cpp/monlib/dynamic_counters/page.cpp +++ b/library/cpp/monlib/dynamic_counters/page.cpp @@ -56,7 +56,7 @@ void TDynamicCountersPage::Output(NMonitoring::IMonHttpRequest& request) { for (const auto& escaped : parts) { const auto part = CGIUnescapeRet(escaped); - TVector<TString> labels; + TVector<TString> labels; StringSplitter(part).Split('=').SkipEmpty().Collect(&labels); if (labels.size() != 2U) diff --git a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp index 9fc3421d0bb..8dc61d01133 100644 --- a/library/cpp/monlib/encode/buffered/string_pool_ut.cpp +++ b/library/cpp/monlib/encode/buffered/string_pool_ut.cpp @@ -63,22 +63,22 @@ Y_UNIT_TEST_SUITE(TStringPoolTest) { strPool.Build(); - TVector<TString> strings; - TVector<ui32> indexes; - TVector<ui32> frequences; + TVector<TString> strings; + TVector<ui32> indexes; + TVector<ui32> frequences; strPool.ForEach([&](TStringBuf str, ui32 index, ui32 freq) { strings.emplace_back(str); indexes.push_back(index); frequences.push_back(freq); }); - TVector<TString> expectedStrings = {"three", "two", "one"}; + TVector<TString> expectedStrings = {"three", "two", "one"}; UNIT_ASSERT_EQUAL(strings, expectedStrings); - TVector<ui32> expectedIndexes = {0, 1, 2}; + TVector<ui32> expectedIndexes = {0, 1, 2}; UNIT_ASSERT_EQUAL(indexes, expectedIndexes); - TVector<ui32> expectedFrequences = {3, 2, 1}; + TVector<ui32> expectedFrequences = {3, 2, 1}; UNIT_ASSERT_EQUAL(frequences, expectedFrequences); } } diff --git a/library/cpp/monlib/messagebus/mon_service_messagebus.cpp b/library/cpp/monlib/messagebus/mon_service_messagebus.cpp index 4dd144ebe83..8fe79b9b3a1 100644 --- a/library/cpp/monlib/messagebus/mon_service_messagebus.cpp +++ b/library/cpp/monlib/messagebus/mon_service_messagebus.cpp @@ -2,7 +2,7 @@ using namespace NMonitoring; -TMonServiceMessageBus::TMonServiceMessageBus(ui16 port, const TString& title) +TMonServiceMessageBus::TMonServiceMessageBus(ui16 port, const TString& title) : TMonService2(port, title) { } diff --git a/library/cpp/monlib/metrics/labels_ut.cpp b/library/cpp/monlib/metrics/labels_ut.cpp index f0e4f532aba..614ad8ffafd 100644 --- a/library/cpp/monlib/metrics/labels_ut.cpp +++ b/library/cpp/monlib/metrics/labels_ut.cpp @@ -124,12 +124,12 @@ Y_UNIT_TEST_SUITE(TLabelsTest) { UNIT_ASSERT_EQUAL(labels[0], TLabel("name1", "value1")); UNIT_ASSERT_EQUAL(labels[1], TLabel("name2", "value2")); - TVector<TLabel> labelsCopy; + TVector<TLabel> labelsCopy; for (auto&& label : labels) { labelsCopy.emplace_back(label.Name(), label.Value()); } - UNIT_ASSERT_EQUAL(labelsCopy, TVector<TLabel>({ + UNIT_ASSERT_EQUAL(labelsCopy, TVector<TLabel>({ {"name1", "value1"}, {"name2", "value2"}, })); diff --git a/library/cpp/monlib/service/mon_service_http_request.cpp b/library/cpp/monlib/service/mon_service_http_request.cpp index 5d805631d9d..8abe33f0fb6 100644 --- a/library/cpp/monlib/service/mon_service_http_request.cpp +++ b/library/cpp/monlib/service/mon_service_http_request.cpp @@ -9,7 +9,7 @@ IMonHttpRequest::~IMonHttpRequest() { TMonService2HttpRequest::~TMonService2HttpRequest() { } -TString TMonService2HttpRequest::GetServiceTitle() const { +TString TMonService2HttpRequest::GetServiceTitle() const { return MonService->GetTitle(); } diff --git a/library/cpp/monlib/service/mon_service_http_request.h b/library/cpp/monlib/service/mon_service_http_request.h index b4f2f8f0c59..14974f1a203 100644 --- a/library/cpp/monlib/service/mon_service_http_request.h +++ b/library/cpp/monlib/service/mon_service_http_request.h @@ -44,7 +44,7 @@ namespace NMonitoring { TMonService2HttpRequest( IOutputStream* out, const IHttpRequest* httpRequest, TMonService2* monService, IMonPage* monPage, - const TString& pathInfo, + const TString& pathInfo, TMonService2HttpRequest* parent) : Out(out) , HttpRequest(httpRequest) diff --git a/library/cpp/monlib/service/monservice.cpp b/library/cpp/monlib/service/monservice.cpp index d1b9cda1d21..fdb7f77c1a0 100644 --- a/library/cpp/monlib/service/monservice.cpp +++ b/library/cpp/monlib/service/monservice.cpp @@ -78,7 +78,7 @@ void TMonService2::OutputIndexBody(IOutputStream& out) { } void TMonService2::ServeRequest(IOutputStream& out, const NMonitoring::IHttpRequest& request) { - TString path = request.GetPath(); + TString path = request.GetPath(); Y_VERIFY(path.StartsWith('/')); if (AuthProvider_) { @@ -112,15 +112,15 @@ void TMonService2::Register(TMonPagePtr page) { IndexMonPage->Register(std::move(page)); } -TIndexMonPage* TMonService2::RegisterIndexPage(const TString& path, const TString& title) { +TIndexMonPage* TMonService2::RegisterIndexPage(const TString& path, const TString& title) { return IndexMonPage->RegisterIndexPage(path, title); } -IMonPage* TMonService2::FindPage(const TString& relativePath) { +IMonPage* TMonService2::FindPage(const TString& relativePath) { return IndexMonPage->FindPage(relativePath); } -TIndexMonPage* TMonService2::FindIndexPage(const TString& relativePath) { +TIndexMonPage* TMonService2::FindIndexPage(const TString& relativePath) { return IndexMonPage->FindIndexPage(relativePath); } diff --git a/library/cpp/monlib/service/pages/index_mon_page.cpp b/library/cpp/monlib/service/pages/index_mon_page.cpp index 83ff8b529ae..87cb7e7f993 100644 --- a/library/cpp/monlib/service/pages/index_mon_page.cpp +++ b/library/cpp/monlib/service/pages/index_mon_page.cpp @@ -36,7 +36,7 @@ void TIndexMonPage::Output(IMonHttpRequest& request) { break; } size_t slash = pathTmp.find_last_of('/'); - Y_VERIFY(slash != TString::npos); + Y_VERIFY(slash != TString::npos); pathTmp = pathTmp.substr(0, slash); if (!pathTmp) { break; @@ -56,7 +56,7 @@ void TIndexMonPage::OutputIndex(IOutputStream& out, bool pathEndsWithSlash) { for (auto& Page : Pages) { IMonPage* page = Page.Get(); if (page->IsInIndex()) { - TString pathToDir = ""; + TString pathToDir = ""; if (!pathEndsWithSlash) { pathToDir = this->GetPath() + "/"; } @@ -94,7 +94,7 @@ TIndexMonPage* TIndexMonPage::RegisterIndexPage(const TString& path, const TStri return VerifyDynamicCast<TIndexMonPage*>(page); } -IMonPage* TIndexMonPage::FindPage(const TString& relativePath) { +IMonPage* TIndexMonPage::FindPage(const TString& relativePath) { TGuard<TMutex> g(Mtx); Y_VERIFY(!relativePath.StartsWith('/')); @@ -106,7 +106,7 @@ IMonPage* TIndexMonPage::FindPage(const TString& relativePath) { } } -TIndexMonPage* TIndexMonPage::FindIndexPage(const TString& relativePath) { +TIndexMonPage* TIndexMonPage::FindIndexPage(const TString& relativePath) { return VerifyDynamicCast<TIndexMonPage*>(FindPage(relativePath)); } diff --git a/library/cpp/monlib/service/pages/mon_page.cpp b/library/cpp/monlib/service/pages/mon_page.cpp index 72033b1699a..7bf9cce18e3 100644 --- a/library/cpp/monlib/service/pages/mon_page.cpp +++ b/library/cpp/monlib/service/pages/mon_page.cpp @@ -2,7 +2,7 @@ using namespace NMonitoring; -IMonPage::IMonPage(const TString& path, const TString& title) +IMonPage::IMonPage(const TString& path, const TString& title) : Path(path) , Title(title) { diff --git a/library/cpp/monlib/service/pages/mon_page.h b/library/cpp/monlib/service/pages/mon_page.h index e396612bb0d..1a51dbfa60e 100644 --- a/library/cpp/monlib/service/pages/mon_page.h +++ b/library/cpp/monlib/service/pages/mon_page.h @@ -3,7 +3,7 @@ #include <library/cpp/monlib/service/service.h> #include <library/cpp/monlib/service/mon_service_http_request.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ptr.h> namespace NMonitoring { diff --git a/library/cpp/monlib/service/pages/version_mon_page.cpp b/library/cpp/monlib/service/pages/version_mon_page.cpp index 41e29417da7..01ec97d48ff 100644 --- a/library/cpp/monlib/service/pages/version_mon_page.cpp +++ b/library/cpp/monlib/service/pages/version_mon_page.cpp @@ -9,7 +9,7 @@ using namespace NMonitoring; void TVersionMonPage::OutputText(IOutputStream& out, NMonitoring::IMonHttpRequest&) { const char* version = GetProgramSvnVersion(); out << version; - if (!TString(version).EndsWith("\n")) + if (!TString(version).EndsWith("\n")) out << "\n"; out << GetBuildInfo() << "\n\n"; out << "linked with malloc: " << NMalloc::MallocInfo().Name << "\n"; diff --git a/library/cpp/monlib/service/pages/ya.make b/library/cpp/monlib/service/pages/ya.make index 48d44a0838b..3631168eceb 100644 --- a/library/cpp/monlib/service/pages/ya.make +++ b/library/cpp/monlib/service/pages/ya.make @@ -2,8 +2,8 @@ LIBRARY() OWNER(g:solomon) -NO_WSHADOW() - +NO_WSHADOW() + SRCS( diag_mon_page.cpp html_mon_page.cpp diff --git a/library/cpp/monlib/service/service.cpp b/library/cpp/monlib/service/service.cpp index 929efbf8162..b4b522939c0 100644 --- a/library/cpp/monlib/service/service.cpp +++ b/library/cpp/monlib/service/service.cpp @@ -29,7 +29,7 @@ namespace NMonitoring { out << "HTTP/1.1 400 Invalid url\r\nConnection: Close\r\n\r\n"; return; } - TString path = GetPath(); + TString path = GetPath(); if (!path.StartsWith('/')) { out << "HTTP/1.1 400 Bad request\r\nConnection: Close\r\n\r\n"; return; @@ -133,7 +133,7 @@ namespace NMonitoring { const TCoHttpServer& Parent; }; - TCoHttpServer::TCoHttpServer(TContExecutor& executor, const TString& bindAddr, TIpPort port, THandler handler) + TCoHttpServer::TCoHttpServer(TContExecutor& executor, const TString& bindAddr, TIpPort port, THandler handler) : Executor(executor) , Listener(this, &executor) , Handler(std::move(handler)) diff --git a/library/cpp/monlib/service/service.h b/library/cpp/monlib/service/service.h index 2f66dddaf87..9272266e503 100644 --- a/library/cpp/monlib/service/service.h +++ b/library/cpp/monlib/service/service.h @@ -33,7 +33,7 @@ namespace NMonitoring { class TCoHttpServer: private TContListener::ICallBack { public: // initialize and schedule coroutines for execution - TCoHttpServer(TContExecutor& executor, const TString& bindAddr, TIpPort port, THandler handler); + TCoHttpServer(TContExecutor& executor, const TString& bindAddr, TIpPort port, THandler handler); void Start(); void Stop(); @@ -54,7 +54,7 @@ namespace NMonitoring { TContExecutor& Executor; TContListener Listener; THandler Handler; - TString BindAddr; + TString BindAddr; TIpPort Port; }; diff --git a/library/cpp/object_factory/object_factory_ut.cpp b/library/cpp/object_factory/object_factory_ut.cpp index 06fb0739ff0..841ffcc64d0 100644 --- a/library/cpp/object_factory/object_factory_ut.cpp +++ b/library/cpp/object_factory/object_factory_ut.cpp @@ -2,13 +2,13 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/generic/noncopyable.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ptr.h> using namespace NObjectFactory; struct TArgument { - TString Name; + TString Name; void* Discarded; }; @@ -17,43 +17,43 @@ public: virtual ~ICommonInterface() { } - virtual TString GetValue() const = 0; + virtual TString GetValue() const = 0; }; class TDirectOrder: public ICommonInterface { public: - TDirectOrder(const TString& provider, float factor, TArgument& argument) + TDirectOrder(const TString& provider, float factor, TArgument& argument) : Provider(provider) , Factor(factor) , Argument(argument) { } - TString GetValue() const override { + TString GetValue() const override { return Provider + ToString(Factor) + Argument.Name; } private: - const TString Provider; + const TString Provider; const float Factor; const TArgument Argument; }; class TInverseOrder: public ICommonInterface { public: - TInverseOrder(const TString& provider, float factor, TArgument& argument) + TInverseOrder(const TString& provider, float factor, TArgument& argument) : Provider(provider) , Factor(factor) , Argument(argument) { } - TString GetValue() const override { + TString GetValue() const override { return Argument.Name + ToString(Factor) + Provider; } private: - const TString Provider; + const TString Provider; const float Factor; const TArgument Argument; }; diff --git a/library/cpp/on_disk/chunks/chunked_helpers.cpp b/library/cpp/on_disk/chunks/chunked_helpers.cpp index b7adba27535..faf9164c80f 100644 --- a/library/cpp/on_disk/chunks/chunked_helpers.cpp +++ b/library/cpp/on_disk/chunks/chunked_helpers.cpp @@ -29,7 +29,7 @@ TNamedChunkedDataReader::TNamedChunkedDataReader(const TBlob& blob) Load(&input, Names); size_t index = 0; - for (TVector<TString>::const_iterator it = Names.begin(); it != Names.end(); ++it, ++index) { + for (TVector<TString>::const_iterator it = Names.begin(); it != Names.end(); ++it, ++index) { if (!it->empty()) NameToIndex[*it] = index; } @@ -42,14 +42,14 @@ TNamedChunkedDataWriter::TNamedChunkedDataWriter(IOutputStream& slave) { } -TNamedChunkedDataWriter::~TNamedChunkedDataWriter() { +TNamedChunkedDataWriter::~TNamedChunkedDataWriter() { } void TNamedChunkedDataWriter::NewBlock() { NewBlock(""); } -void TNamedChunkedDataWriter::NewBlock(const TString& name) { +void TNamedChunkedDataWriter::NewBlock(const TString& name) { if (!name.empty()) { if (NameToIndex.count(name) != 0) throw yexception() << "Block name is not unique"; diff --git a/library/cpp/on_disk/chunks/chunked_helpers.h b/library/cpp/on_disk/chunks/chunked_helpers.h index 5fa96afdca0..207afe7ee18 100644 --- a/library/cpp/on_disk/chunks/chunked_helpers.h +++ b/library/cpp/on_disk/chunks/chunked_helpers.h @@ -54,7 +54,7 @@ public: template <typename T> class TYVectorWriter { private: - TVector<T> Vector; + TVector<T> Vector; public: TYVectorWriter() = default; @@ -233,12 +233,12 @@ template <typename TKey, typename TValue> class TPlainHashWriter : TPlainHashCommon { private: typedef TPackedPair<TKey, TValue> TKeyValuePair; - typedef TVector<TKeyValuePair> TData; + typedef TVector<TKeyValuePair> TData; TData Data; - typedef TVector<TData> TData2; + typedef TVector<TData> TData2; bool IsPlainEnought(ui16 bits) const { - TVector<size_t> counts(1LL << bits, 0); + TVector<size_t> counts(1LL << bits, 0); for (size_t i = 0; i < Data.size(); ++i) { size_t& count = counts[KeyHash<TKey>(TKeyValuePair::GetFirst(&Data[i]), bits)]; ++count; @@ -276,7 +276,7 @@ public: for (size_t i = 0; i < Data.size(); ++i) data2[KeyHash<TKey>(TKeyValuePair::GetFirst(&Data[i]), bits)].push_back(Data[i]); - typedef TVector<TInterval> TIntervals; + typedef TVector<TInterval> TIntervals; TIntervals intervals(nBuckets); ui32 offset = 0; for (ui32 i = 0; i < nBuckets; ++i) { @@ -583,7 +583,7 @@ public: template <class T, bool isPod> class TVectorTakingIntoAccountThePodTypeWriter : TNonCopyable { private: - typedef TVector<ui64> TOffsets; + typedef TVector<ui64> TOffsets; TOffsets Offsets; TBuffer Data; TBufferOutput DataStream; @@ -655,12 +655,12 @@ struct TGeneralVectorG<TItem, true> { }; template <> -struct TSaveLoadVectorNonPodElement<TString> { +struct TSaveLoadVectorNonPodElement<TString> { static inline void Save(IOutputStream* out, const TString& s) { out->Write(s.data(), s.size() + 1); } - static inline void Load(TMemoryInput* in, TString& s, size_t elementSize) { + static inline void Load(TMemoryInput* in, TString& s, size_t elementSize) { Y_ASSERT(elementSize > 0 && in->Avail() >= elementSize); s.assign(in->Buf(), elementSize - 1); /// excluding 0 at the end } @@ -670,5 +670,5 @@ template <bool G> struct TStringsVectorG: public TGeneralVectorG<TString, G> { }; -using TStringsVector = TGeneralVector<TString>; -using TStringsVectorWriter = TGeneralVectorWriter<TString>; +using TStringsVector = TGeneralVector<TString>; +using TStringsVectorWriter = TGeneralVectorWriter<TString>; diff --git a/library/cpp/on_disk/chunks/chunks_ut.cpp b/library/cpp/on_disk/chunks/chunks_ut.cpp index f727647f7f2..cba0ecd3abf 100644 --- a/library/cpp/on_disk/chunks/chunks_ut.cpp +++ b/library/cpp/on_disk/chunks/chunks_ut.cpp @@ -102,21 +102,21 @@ public: UNIT_ASSERT_EQUAL(reader.RealSize(), sizeof(ui64) + N * sizeof(ui32)); } } - { /// TString + { /// TString const size_t N = 4; TBufferStream stream; { - TGeneralVectorWriter<TString> writer; + TGeneralVectorWriter<TString> writer; for (size_t i = 0; i < N; ++i) writer.PushBack(ToString(i)); writer.Save(stream); } { TBlob temp = TBlob::FromStreamSingleThreaded(stream); - TGeneralVector<TString> reader(temp); + TGeneralVector<TString> reader(temp); UNIT_ASSERT_EQUAL(reader.GetSize(), N); for (size_t i = 0; i < N; ++i) { - TString value; + TString value; reader.Get(i, value); UNIT_ASSERT_EQUAL(value, ToString(i)); UNIT_ASSERT_EQUAL(reader.Get(i), ToString(i)); @@ -151,7 +151,7 @@ public: } { /// pointer const size_t N = 3; - TVector<int> data_holder(N); + TVector<int> data_holder(N); int* a = &(data_holder[0]); TBufferStream stream; { @@ -200,11 +200,11 @@ public: } void TestStrings() { - const TString FILENAME = "chunked_helpers_test.bin"; + const TString FILENAME = "chunked_helpers_test.bin"; TTempFileHandle file(FILENAME.c_str()); { - TFixedBufferFileOutput fOut(FILENAME); + TFixedBufferFileOutput fOut(FILENAME); TStringsVectorWriter stringsWriter; stringsWriter.PushBack(""); stringsWriter.PushBack("test"); @@ -230,11 +230,11 @@ public: } void TestNamedChunkedData() { - const TString filename = MakeTempName(nullptr, "named_chunked_data_test"); + const TString filename = MakeTempName(nullptr, "named_chunked_data_test"); TTempFile file(filename); { - TFixedBufferFileOutput fOut(filename); + TFixedBufferFileOutput fOut(filename); TNamedChunkedDataWriter writer(fOut); writer.NewBlock("alpha"); diff --git a/library/cpp/on_disk/chunks/reader.cpp b/library/cpp/on_disk/chunks/reader.cpp index 6e28cbf367d..80235e80846 100644 --- a/library/cpp/on_disk/chunks/reader.cpp +++ b/library/cpp/on_disk/chunks/reader.cpp @@ -5,7 +5,7 @@ #include "reader.h" template <typename T> -static inline void ReadAux(const char* data, T* aux, T count, TVector<const char*>* result) { +static inline void ReadAux(const char* data, T* aux, T count, TVector<const char*>* result) { result->resize(count); for (size_t i = 0; i < count; ++i) { (*result)[i] = data + ReadUnaligned<T>(aux + i); diff --git a/library/cpp/on_disk/chunks/writer.cpp b/library/cpp/on_disk/chunks/writer.cpp index 6dc7397f09a..8344045e14d 100644 --- a/library/cpp/on_disk/chunks/writer.cpp +++ b/library/cpp/on_disk/chunks/writer.cpp @@ -2,7 +2,7 @@ #include "writer.h" -static inline void WriteAux(IOutputStream* out, const TVector<ui64>& data) { +static inline void WriteAux(IOutputStream* out, const TVector<ui64>& data) { ::SavePodArray(out, data.data(), data.size()); } @@ -14,7 +14,7 @@ TChunkedDataWriter::TChunkedDataWriter(IOutputStream& slave) { } -TChunkedDataWriter::~TChunkedDataWriter() { +TChunkedDataWriter::~TChunkedDataWriter() { } void TChunkedDataWriter::NewBlock() { diff --git a/library/cpp/openssl/init/init.cpp b/library/cpp/openssl/init/init.cpp index ae68ef08eaa..b2af74c5521 100644 --- a/library/cpp/openssl/init/init.cpp +++ b/library/cpp/openssl/init/init.cpp @@ -40,7 +40,7 @@ namespace { } } - TVector<TAutoPtr<TMutex>> Mutexes; + TVector<TAutoPtr<TMutex>> Mutexes; }; inline TInitSsl() { diff --git a/library/cpp/openssl/io/stream.cpp b/library/cpp/openssl/io/stream.cpp index 0b4be38c0e3..64912c9cf4e 100644 --- a/library/cpp/openssl/io/stream.cpp +++ b/library/cpp/openssl/io/stream.cpp @@ -44,15 +44,15 @@ namespace { }; struct TSslDestroy { - static inline void Destroy(ssl_ctx_st* ctx) noexcept { + static inline void Destroy(ssl_ctx_st* ctx) noexcept { SSL_CTX_free(ctx); } - static inline void Destroy(ssl_st* ssl) noexcept { + static inline void Destroy(ssl_st* ssl) noexcept { SSL_free(ssl); } - static inline void Destroy(bio_st* bio) noexcept { + static inline void Destroy(bio_st* bio) noexcept { BIO_free(bio); } diff --git a/library/cpp/packedtypes/longs_ut.cpp b/library/cpp/packedtypes/longs_ut.cpp index 8b06c934d2f..1cc1415f476 100644 --- a/library/cpp/packedtypes/longs_ut.cpp +++ b/library/cpp/packedtypes/longs_ut.cpp @@ -12,7 +12,7 @@ Y_UNIT_TEST_SUITE(TLongsTest) { i16 x16 = 40; i64 x64 = 40; i64 y64; - TString s; + TString s; s += Sprintf("x16=0x%x\n", (int)x16); s += Sprintf("LO_8(x16)=0x%x HI_8(x16)=0x%x\n\n", (int)Lo8(x16), (int)Hi8(x16)); diff --git a/library/cpp/packedtypes/packed_ut.cpp b/library/cpp/packedtypes/packed_ut.cpp index 70a22cf9c31..baefec85ce8 100644 --- a/library/cpp/packedtypes/packed_ut.cpp +++ b/library/cpp/packedtypes/packed_ut.cpp @@ -25,7 +25,7 @@ static T PseudoRandom(T max = Max<T>()) { } Y_UNIT_TEST_SUITE(TPackedTest) { - void TestPackUi32Sub(ui32 v, const TVector<char>& p) { + void TestPackUi32Sub(ui32 v, const TVector<char>& p) { TBufferOutput out; PackUI32(out, v); const TBuffer& buf = out.Buffer(); @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(TPackedTest) { Y_UNIT_TEST(TestPackUi32) { ui32 v; - TVector<char> pv; + TVector<char> pv; v = 0; pv.resize(1); @@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(TPackedTest) { TBuffer buffer(65536); char* writePtr = buffer.Data(); - TVector<ui32> correctNumbers; + TVector<ui32> correctNumbers; for (size_t i = 0; i < 1000; ++i) { ui32 randNum = NPrivate::PseudoRandom<ui32>(); correctNumbers.push_back(randNum); @@ -112,7 +112,7 @@ Y_UNIT_TEST_SUITE(TPackedTest) { TBuffer buffer(65536); char* writePtr = buffer.Data(); - TVector<ui64> correctNumbers; + TVector<ui64> correctNumbers; for (size_t i = 0; i < 1000; ++i) { ui64 randNum = NPrivate::PseudoRandom<ui64>(); correctNumbers.push_back(randNum); diff --git a/library/cpp/packers/packers.h b/library/cpp/packers/packers.h index 1bde1b59aaf..80ecfab3b2e 100644 --- a/library/cpp/packers/packers.h +++ b/library/cpp/packers/packers.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/set.h> #include <util/generic/list.h> @@ -249,47 +249,47 @@ namespace NPackers { }; //------------------------------------------- - // TStringPacker --- for TString/TUtf16String and TStringBuf. + // TStringPacker --- for TString/TUtf16String and TStringBuf. - template <class TStringType> + template <class TStringType> class TStringPacker { public: - void UnpackLeaf(const char* p, TStringType& t) const; - void PackLeaf(char* buffer, const TStringType& data, size_t size) const; - size_t MeasureLeaf(const TStringType& data) const; + void UnpackLeaf(const char* p, TStringType& t) const; + void PackLeaf(char* buffer, const TStringType& data, size_t size) const; + size_t MeasureLeaf(const TStringType& data) const; size_t SkipLeaf(const char* p) const; }; template <class TStringType> - inline void TStringPacker<TStringType>::UnpackLeaf(const char* buf, TStringType& t) const { + inline void TStringPacker<TStringType>::UnpackLeaf(const char* buf, TStringType& t) const { size_t len; TIntegralPacker<size_t>().UnpackLeaf(buf, len); size_t start = TIntegralPacker<size_t>().SkipLeaf(buf); - t = TStringType((const typename TStringType::char_type*)(buf + start), len); + t = TStringType((const typename TStringType::char_type*)(buf + start), len); } template <class TStringType> - inline void TStringPacker<TStringType>::PackLeaf(char* buf, const TStringType& str, size_t size) const { + inline void TStringPacker<TStringType>::PackLeaf(char* buf, const TStringType& str, size_t size) const { size_t len = str.size(); - size_t lenChar = len * sizeof(typename TStringType::char_type); + size_t lenChar = len * sizeof(typename TStringType::char_type); size_t start = size - lenChar; TIntegralPacker<size_t>().PackLeaf(buf, len, TIntegralPacker<size_t>().MeasureLeaf(len)); memcpy(buf + start, str.data(), lenChar); } template <class TStringType> - inline size_t TStringPacker<TStringType>::MeasureLeaf(const TStringType& str) const { + inline size_t TStringPacker<TStringType>::MeasureLeaf(const TStringType& str) const { size_t len = str.size(); - return TIntegralPacker<size_t>().MeasureLeaf(len) + len * sizeof(typename TStringType::char_type); + return TIntegralPacker<size_t>().MeasureLeaf(len) + len * sizeof(typename TStringType::char_type); } template <class TStringType> - inline size_t TStringPacker<TStringType>::SkipLeaf(const char* buf) const { + inline size_t TStringPacker<TStringType>::SkipLeaf(const char* buf) const { size_t result = TIntegralPacker<size_t>().SkipLeaf(buf); { size_t len; TIntegralPacker<size_t>().UnpackLeaf(buf, len); - result += len * sizeof(typename TStringType::char_type); + result += len * sizeof(typename TStringType::char_type); } return result; } @@ -304,7 +304,7 @@ namespace NPackers { // - has subclass C::const_iterator // - has methods begin() and end() (return C::const_iterator) // - has method insert(C::const_iterator, const C::value_type&) - // Examples: TVector, TList, TSet + // Examples: TVector, TList, TSet // Requirements to class EP: has methods as in any packer (UnpackLeaf, PackLeaf, MeasureLeaf, SkipLeaf) that // are applicable to C::value_type diff --git a/library/cpp/packers/ut/region_packer_ut.cpp b/library/cpp/packers/ut/region_packer_ut.cpp index 0cb08ccf652..b083320f61c 100644 --- a/library/cpp/packers/ut/region_packer_ut.cpp +++ b/library/cpp/packers/ut/region_packer_ut.cpp @@ -4,7 +4,7 @@ template <typename TValue> void TestPacker() { TValue values[] = {1, 2, 3, 42}; - TString buffer; + TString buffer; TRegionPacker<TValue> p; diff --git a/library/cpp/pop_count/benchmark/main.cpp b/library/cpp/pop_count/benchmark/main.cpp index 41ea3c91cc5..cc20c6f6c49 100644 --- a/library/cpp/pop_count/benchmark/main.cpp +++ b/library/cpp/pop_count/benchmark/main.cpp @@ -9,8 +9,8 @@ template <class F, class I> inline void DoRun(F&& f, I&& i) { const ui64 n = i.Iterations(); - for (ui64 j = 0; j < n; ++j) { - Y_DO_NOT_OPTIMIZE_AWAY(f(j * (ui64)123456 + (ui64)1)); + for (ui64 j = 0; j < n; ++j) { + Y_DO_NOT_OPTIMIZE_AWAY(f(j * (ui64)123456 + (ui64)1)); } } diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index 640c10f5a51..9cd9007f15c 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -34,7 +34,7 @@ break; \ } -static TString GetFieldName(const google::protobuf::FieldDescriptor& field, +static TString GetFieldName(const google::protobuf::FieldDescriptor& field, const NProtobufJson::TJson2ProtoConfig& config) { if (config.NameGenerator) { return config.NameGenerator(field); @@ -50,7 +50,7 @@ static TString GetFieldName(const google::protobuf::FieldDescriptor& field, return name; } - TString name = field.name(); + TString name = field.name(); switch (config.FieldNameMode) { case NProtobufJson::TJson2ProtoConfig::FieldNameOriginalCase: break; @@ -318,7 +318,7 @@ Json2RepeatedField(const NJson::TJsonValue& json, const NProtobufJson::TJson2ProtoConfig& config) { using namespace google::protobuf; - TString name = GetFieldName(field, config); + TString name = GetFieldName(field, config); if (!json.Has(name)) return; diff --git a/library/cpp/protobuf/json/proto2json_printer.h b/library/cpp/protobuf/json/proto2json_printer.h index 9dc5aa86c62..9057ac574c8 100644 --- a/library/cpp/protobuf/json/proto2json_printer.h +++ b/library/cpp/protobuf/json/proto2json_printer.h @@ -7,7 +7,7 @@ #include <google/protobuf/message.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NProtobufJson { struct TProto2JsonConfig; diff --git a/library/cpp/protobuf/json/ut/inline_ut.cpp b/library/cpp/protobuf/json/ut/inline_ut.cpp index c29ad32e7d6..2f2efacf453 100644 --- a/library/cpp/protobuf/json/ut/inline_ut.cpp +++ b/library/cpp/protobuf/json/ut/inline_ut.cpp @@ -5,7 +5,7 @@ #include <library/cpp/protobuf/json/proto2json.h> #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> using namespace NProtobufJson; diff --git a/library/cpp/protobuf/json/ut/json.h b/library/cpp/protobuf/json/ut/json.h index c1f108e6e48..b36d848b587 100644 --- a/library/cpp/protobuf/json/ut/json.h +++ b/library/cpp/protobuf/json/ut/json.h @@ -7,7 +7,7 @@ #include <cstdarg> #include <util/generic/hash_set.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/defaults.h> diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index 0dfe57bc7a2..ce9d28222a4 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -13,7 +13,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/generic/hash_set.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ylimits.h> #include <util/stream/str.h> #include <util/string/cast.h> diff --git a/library/cpp/protobuf/json/ut/proto.h b/library/cpp/protobuf/json/ut/proto.h index 8183bfc8e18..53454cd950e 100644 --- a/library/cpp/protobuf/json/ut/proto.h +++ b/library/cpp/protobuf/json/ut/proto.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/hash_set.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/defaults.h> diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp index 07e52d7f2f5..ed5a414b206 100644 --- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp +++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp @@ -12,7 +12,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/generic/hash_set.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ylimits.h> #include <util/stream/str.h> diff --git a/library/cpp/protobuf/json/ut/repeated_fields.incl b/library/cpp/protobuf/json/ut/repeated_fields.incl index e9548917d86..332482450ff 100644 --- a/library/cpp/protobuf/json/ut/repeated_fields.incl +++ b/library/cpp/protobuf/json/ut/repeated_fields.incl @@ -12,10 +12,10 @@ DEFINE_REPEATED_FIELD(FI64, ui64, 0ull, 1ull, Max<ui64>()) DEFINE_REPEATED_FIELD(SFI32, i32, Min<i32>(), -1, 0, 1, Max<i32>()) DEFINE_REPEATED_FIELD(SFI64, i64, Min<i64>(), -1ll, 0ll, 1ll, Max<i64>()) DEFINE_REPEATED_FIELD(Bool, bool, false, true) -DEFINE_REPEATED_FIELD(String, TString, "", "Lorem ipsum", "123123") -DEFINE_REPEATED_FIELD(Bytes, TString, "", "מחשב", "\x1") +DEFINE_REPEATED_FIELD(String, TString, "", "Lorem ipsum", "123123") +DEFINE_REPEATED_FIELD(Bytes, TString, "", "מחשב", "\x1") DEFINE_REPEATED_FIELD(Enum, EEnum, E_1, E_2, E_3) DEFINE_REPEATED_FIELD(Float, float, 0.0f, 1.0f, 1.123f) DEFINE_REPEATED_FIELD(Double, double, 0.0, 1.0, 1.123456789012) -DEFINE_REPEATED_FIELD(OneString, TString, "", "Lorem ipsum dolor", "1231231") -DEFINE_REPEATED_FIELD(OneTwoString, TString, "", "Lorem ipsum dolor sit", "12312312") +DEFINE_REPEATED_FIELD(OneString, TString, "", "Lorem ipsum dolor", "1231231") +DEFINE_REPEATED_FIELD(OneTwoString, TString, "", "Lorem ipsum dolor sit", "12312312") diff --git a/library/cpp/protobuf/json/ut/string_transform_ut.cpp b/library/cpp/protobuf/json/ut/string_transform_ut.cpp index a31dabcb0f0..f5a0011b77d 100644 --- a/library/cpp/protobuf/json/ut/string_transform_ut.cpp +++ b/library/cpp/protobuf/json/ut/string_transform_ut.cpp @@ -6,7 +6,7 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { Y_UNIT_TEST(TestEmptyString) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleEscapeTransform(); - TString s; + TString s; s = ""; transform.Transform(s); UNIT_ASSERT_EQUAL(s, ""); @@ -14,7 +14,7 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { Y_UNIT_TEST(TestAlphabeticString) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleEscapeTransform(); - TString s; + TString s; s = "abacaba"; transform.Transform(s); UNIT_ASSERT_EQUAL(s, "abacaba"); @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { Y_UNIT_TEST(TestRussianSymbols) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleEscapeTransform(); - TString s; + TString s; s = "тест"; transform.Transform(s); UNIT_ASSERT_EQUAL(s, "\\\\321\\\\202\\\\320\\\\265\\\\321\\\\201\\\\321\\\\202"); @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { Y_UNIT_TEST(TestEscapeSpecialSymbols) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleEscapeTransform(); - TString s; + TString s; s = "aba\\ca\"ba"; transform.Transform(s); Cerr << "###" << s << Endl; @@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TDoubleEscapeTransform) { Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { Y_UNIT_TEST(TestEmptyString) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); - TString s; + TString s; s = ""; transform.Transform(s); UNIT_ASSERT_EQUAL("", s); @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { Y_UNIT_TEST(TestAlphabeticString) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); - TString s; + TString s; s = "abacaba"; transform.Transform(s); Cerr << "###" << s << Endl; @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { Y_UNIT_TEST(TestRussianSymbols) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); - TString s; + TString s; s = "\\\\321\\\\202\\\\320\\\\265\\\\321\\\\201\\\\321\\\\202"; transform.Transform(s); UNIT_ASSERT_EQUAL("тест", s); @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { Y_UNIT_TEST(TestEscapeSpecialSymbols) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); - TString s; + TString s; s = "aba\\\\\\\\ca\\\\\\\"ba"; transform.Transform(s); UNIT_ASSERT_EQUAL("aba\\ca\"ba", s); @@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(TDoubleUnescapeTransform) { Y_UNIT_TEST(TestEscapeSpecialSymbolsDifficultCases) { const NProtobufJson::IStringTransform& transform = NProtobufJson::TDoubleUnescapeTransform(); - TString s; + TString s; s = "\\\\\\\\\\\\\\\\"; transform.Transform(s); UNIT_ASSERT_EQUAL("\\\\", s); diff --git a/library/cpp/protobuf/json/ut/test.proto b/library/cpp/protobuf/json/ut/test.proto index 0fa996fd413..32ff53cd0bb 100644 --- a/library/cpp/protobuf/json/ut/test.proto +++ b/library/cpp/protobuf/json/ut/test.proto @@ -131,7 +131,7 @@ message TCompositeRepeated { repeated TFlatOptional Part = 1; }; -message TMapType { +message TMapType { map<string, string> Items = 1; }; diff --git a/library/cpp/protobuf/util/is_equal_ut.cpp b/library/cpp/protobuf/util/is_equal_ut.cpp index 3ca4c90dd5e..b3388783c45 100644 --- a/library/cpp/protobuf/util/is_equal_ut.cpp +++ b/library/cpp/protobuf/util/is_equal_ut.cpp @@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(ProtobufIsEqual) { a.SetName("aaa"); b.SetName("bbb"); - TString path; + TString path; bool equal = NProtoBuf::IsEqual(a, b, &path); UNIT_ASSERT(!equal); @@ -40,7 +40,7 @@ Y_UNIT_TEST_SUITE(ProtobufIsEqual) { a.MutableInner()->SetBrbrbr("aaa"); b.MutableInner()->SetBrbrbr("bbb"); - TString path; + TString path; bool equal = NProtoBuf::IsEqual(a, b, &path); UNIT_ASSERT(!equal); diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp index 6270ee06243..0a01549d794 100644 --- a/library/cpp/protobuf/util/pb_io.cpp +++ b/library/cpp/protobuf/util/pb_io.cpp @@ -7,7 +7,7 @@ #include <google/protobuf/messagext.h> #include <google/protobuf/text_format.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/file.h> #include <util/stream/str.h> #include <util/string/cast.h> @@ -101,10 +101,10 @@ void SerializeToTextFormat(const NProtoBuf::Message& m, IOutputStream& out) { } } -void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName) { - /* TUnbufferedFileOutput is unbuffered, but TCopyingOutputStreamAdaptor adds +void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName) { + /* TUnbufferedFileOutput is unbuffered, but TCopyingOutputStreamAdaptor adds * a buffer on top of it. */ - TUnbufferedFileOutput stream(fileName); + TUnbufferedFileOutput stream(fileName); SerializeToTextFormat(m, stream); } @@ -150,15 +150,15 @@ void ParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m, } } -void ParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m, +void ParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m, const EParseFromTextFormatOptions options) { - /* TUnbufferedFileInput is unbuffered, but TCopyingInputStreamAdaptor adds + /* TUnbufferedFileInput is unbuffered, but TCopyingInputStreamAdaptor adds * a buffer on top of it. */ - TUnbufferedFileInput stream(fileName); + TUnbufferedFileInput stream(fileName); ParseFromTextFormat(stream, m, options); } -bool TryParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m, +bool TryParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m, const EParseFromTextFormatOptions options) { try { ParseFromTextFormat(fileName, m, options); @@ -192,9 +192,9 @@ void MergeFromTextFormat(IInputStream& in, NProtoBuf::Message& m, void MergeFromTextFormat(const TString& fileName, NProtoBuf::Message& m, const EParseFromTextFormatOptions options) { - /* TUnbufferedFileInput is unbuffered, but TCopyingInputStreamAdaptor adds + /* TUnbufferedFileInput is unbuffered, but TCopyingInputStreamAdaptor adds * a buffer on top of it. */ - TUnbufferedFileInput stream(fileName); + TUnbufferedFileInput stream(fileName); MergeFromTextFormat(stream, m, options); } diff --git a/library/cpp/protobuf/util/pb_io.h b/library/cpp/protobuf/util/pb_io.h index 493c84cb5f3..3a5e16ad673 100644 --- a/library/cpp/protobuf/util/pb_io.h +++ b/library/cpp/protobuf/util/pb_io.h @@ -32,11 +32,11 @@ namespace NProtoBuf { /* Serialize message into string and apply base64 URL encoding. */ - TString SerializeToBase64String(const Message& m); - void SerializeToBase64String(const Message& m, TString& dataBase64); - bool TrySerializeToBase64String(const Message& m, TString& dataBase64); + TString SerializeToBase64String(const Message& m); + void SerializeToBase64String(const Message& m, TString& dataBase64); + bool TrySerializeToBase64String(const Message& m, TString& dataBase64); - const TString ShortUtf8DebugString(const Message& message); + const TString ShortUtf8DebugString(const Message& message); bool MergePartialFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage); bool MergeFromString(NProtoBuf::Message& m, const TStringBuf serializedProtoMessage); @@ -45,7 +45,7 @@ namespace NProtoBuf { int operator&(NProtoBuf::Message& m, IBinSaver& f); // Write a textual representation of the given message to the given file. -void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName); +void SerializeToTextFormat(const NProtoBuf::Message& m, const TString& fileName); void SerializeToTextFormat(const NProtoBuf::Message& m, IOutputStream& out); // Write a textual representation of the given message to the given output stream @@ -64,7 +64,7 @@ enum class EParseFromTextFormatOption : ui64 { Y_DECLARE_FLAGS(EParseFromTextFormatOptions, EParseFromTextFormatOption); // Parse a text-format protocol message from the given file into message object. -void ParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m, +void ParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m, const EParseFromTextFormatOptions options = {}); // NOTE: will read `in` till the end. void ParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m, @@ -74,7 +74,7 @@ void ParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m, * * @see `ParseFromTextFormat` */ -bool TryParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m, +bool TryParseFromTextFormat(const TString& fileName, NProtoBuf::Message& m, const EParseFromTextFormatOptions options = {}); // NOTE: will read `in` till the end. bool TryParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m, @@ -82,7 +82,7 @@ bool TryParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m, // @see `ParseFromTextFormat` template <typename T> -static T ParseFromTextFormat(const TString& fileName, +static T ParseFromTextFormat(const TString& fileName, const EParseFromTextFormatOptions options = {}) { T message; ParseFromTextFormat(fileName, message, options); diff --git a/library/cpp/protobuf/util/pb_io_ut.cpp b/library/cpp/protobuf/util/pb_io_ut.cpp index 875d6dc6026..de62b0b0a1b 100644 --- a/library/cpp/protobuf/util/pb_io_ut.cpp +++ b/library/cpp/protobuf/util/pb_io_ut.cpp @@ -23,7 +23,7 @@ static NProtobufUtilUt::TTextEnumTest GetCorrectEnumMessage() { return m; } -static const TString CORRECT_MESSAGE = +static const TString CORRECT_MESSAGE = R"(Foo: 42 )"; static const TString CORRECT_ENUM_NAME_MESSAGE = @@ -33,7 +33,7 @@ static const TString CORRECT_ENUM_ID_MESSAGE = R"(Slot: 1 )"; -static const TString INCORRECT_MESSAGE = +static const TString INCORRECT_MESSAGE = R"(Bar: 1 )"; static const TString INCORRECT_ENUM_NAME_MESSAGE = @@ -43,11 +43,11 @@ static const TString INCORRECT_ENUM_ID_MESSAGE = R"(Slot: 3 )"; -static const TString CORRECT_BASE64_MESSAGE = "CCo,"; +static const TString CORRECT_BASE64_MESSAGE = "CCo,"; static const TString CORRECT_UNEVEN_BASE64_MESSAGE = "CCo"; -static const TString INCORRECT_BASE64_MESSAGE = "CC"; +static const TString INCORRECT_BASE64_MESSAGE = "CC"; Y_UNIT_TEST_SUITE(TTestProtoBufIO) { Y_UNIT_TEST(TestBase64) { @@ -81,8 +81,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { const TFsPath correctFileName = TFsPath{tempDir()} / "correct.pb.txt"; const TFsPath incorrectFileName = TFsPath{tempDir()} / "incorrect.pb.txt"; - TFileOutput{correctFileName}.Write(CORRECT_MESSAGE); - TFileOutput{incorrectFileName}.Write(INCORRECT_MESSAGE); + TFileOutput{correctFileName}.Write(CORRECT_MESSAGE); + TFileOutput{incorrectFileName}.Write(INCORRECT_MESSAGE); { NProtobufUtilUt::TTextTest message; @@ -138,8 +138,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { } { NProtobufUtilUt::TTextTest m; - const auto f = [&correctFileName](NProtobufUtilUt::TTextTest& mm) { - mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(correctFileName); + const auto f = [&correctFileName](NProtobufUtilUt::TTextTest& mm) { + mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(correctFileName); }; UNIT_ASSERT_NO_EXCEPTION(f(m)); UNIT_ASSERT(NProtoBuf::IsEqual(GetCorrectMessage(), m)); @@ -150,8 +150,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { { NProtobufUtilUt::TTextTest m; TStringInput in{CORRECT_MESSAGE}; - const auto f = [&in](NProtobufUtilUt::TTextTest& mm) { - mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(in); + const auto f = [&in](NProtobufUtilUt::TTextTest& mm) { + mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>(in); }; UNIT_ASSERT_NO_EXCEPTION(f(m)); UNIT_ASSERT(NProtoBuf::IsEqual(GetCorrectMessage(), m)); @@ -161,10 +161,10 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { UNIT_ASSERT_EXCEPTION(ParseFromTextFormat<NProtobufUtilUt::TTextTest>(in), yexception); } { - const TFsPath correctFileName2 = TFsPath{tempDir()} / "serialized.pb.txt"; + const TFsPath correctFileName2 = TFsPath{tempDir()} / "serialized.pb.txt"; const auto original = GetCorrectMessage(); - UNIT_ASSERT_NO_EXCEPTION(SerializeToTextFormat(original, correctFileName2)); - const auto serializedStr = TUnbufferedFileInput{correctFileName2}.ReadAll(); + UNIT_ASSERT_NO_EXCEPTION(SerializeToTextFormat(original, correctFileName2)); + const auto serializedStr = TUnbufferedFileInput{correctFileName2}.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(serializedStr, CORRECT_MESSAGE); } { @@ -175,8 +175,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { } { NProtobufUtilUt::TTextTest m; - const auto f = [&correctFileName](NProtobufUtilUt::TTextTest& mm) { - mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>( + const auto f = [&correctFileName](NProtobufUtilUt::TTextTest& mm) { + mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>( correctFileName, EParseFromTextFormatOption::AllowUnknownField); }; @@ -186,8 +186,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { { const NProtobufUtilUt::TTextTest empty; NProtobufUtilUt::TTextTest m; - const auto f = [&incorrectFileName](NProtobufUtilUt::TTextTest& mm) { - mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>( + const auto f = [&incorrectFileName](NProtobufUtilUt::TTextTest& mm) { + mm = ParseFromTextFormat<NProtobufUtilUt::TTextTest>( incorrectFileName, EParseFromTextFormatOption::AllowUnknownField); }; @@ -258,8 +258,8 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { const TFsPath correctFileName = TFsPath{tempDir()} / "correct.pb.txt"; const TFsPath incorrectFileName = TFsPath{tempDir()} / "incorrect.pb.txt"; - TFileOutput{correctFileName}.Write(CORRECT_MESSAGE); - TFileOutput{incorrectFileName}.Write(INCORRECT_MESSAGE); + TFileOutput{correctFileName}.Write(CORRECT_MESSAGE); + TFileOutput{incorrectFileName}.Write(INCORRECT_MESSAGE); { NProtobufUtilUt::TTextTest message; @@ -341,7 +341,7 @@ Y_UNIT_TEST_SUITE(TTestProtoBufIO) { const TFsPath correctFileName2 = TFsPath{tempDir()} / "serialized.pb.txt"; const auto original = GetCorrectMessage(); UNIT_ASSERT_NO_EXCEPTION(SerializeToTextFormat(original, correctFileName2)); - const auto serializedStr = TUnbufferedFileInput{correctFileName2}.ReadAll(); + const auto serializedStr = TUnbufferedFileInput{correctFileName2}.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(serializedStr, CORRECT_MESSAGE); } { diff --git a/library/cpp/protobuf/util/simple_reflection_ut.cpp b/library/cpp/protobuf/util/simple_reflection_ut.cpp index 169d4703c9c..28a1d3d3603 100644 --- a/library/cpp/protobuf/util/simple_reflection_ut.cpp +++ b/library/cpp/protobuf/util/simple_reflection_ut.cpp @@ -157,7 +157,7 @@ Y_UNIT_TEST_SUITE(ProtobufSimpleReflection) { TMaybe<TConstField> field = TConstField::ByPath(msg, "OneStr"); UNIT_ASSERT(field); UNIT_ASSERT(field->HasValue()); - UNIT_ASSERT_VALUES_EQUAL("1", (field->Get<TString>())); + UNIT_ASSERT_VALUES_EQUAL("1", (field->Get<TString>())); } { @@ -218,7 +218,7 @@ Y_UNIT_TEST_SUITE(ProtobufSimpleReflection) { TMaybe<TMutableField> field = TMutableField::ByPath(msg, "OneStr"); UNIT_ASSERT(field); UNIT_ASSERT(!field->HasValue()); - field->Set(TString("zz")); + field->Set(TString("zz")); UNIT_ASSERT(field->HasValue()); UNIT_ASSERT_VALUES_EQUAL("zz", msg.GetOneStr()); } @@ -227,7 +227,7 @@ Y_UNIT_TEST_SUITE(ProtobufSimpleReflection) { TMaybe<TMutableField> field = TMutableField::ByPath(msg, "OneStr"); UNIT_ASSERT(field); UNIT_ASSERT(field->HasValue()); - field->Set(TString("dd")); + field->Set(TString("dd")); UNIT_ASSERT(field->HasValue()); UNIT_ASSERT_VALUES_EQUAL("dd", msg.GetOneStr()); } @@ -268,7 +268,7 @@ Y_UNIT_TEST_SUITE(ProtobufSimpleReflection) { { TMaybe<TMutableField> field = TMutableField::ByPath(msg, "RepMsg/RepInt", true); TMaybe<TMutableField> fieldCopy = TMutableField::ByPath(msg, "RepMsg/RepInt", true); - Y_UNUSED(fieldCopy); + Y_UNUSED(fieldCopy); UNIT_ASSERT(field); UNIT_ASSERT(!field->HasValue()); UNIT_ASSERT_VALUES_EQUAL(1, msg.RepMsgSize()); diff --git a/library/cpp/protobuf/util/walk_ut.cpp b/library/cpp/protobuf/util/walk_ut.cpp index 2ea6071b172..134c0a49f7b 100644 --- a/library/cpp/protobuf/util/walk_ut.cpp +++ b/library/cpp/protobuf/util/walk_ut.cpp @@ -37,8 +37,8 @@ Y_UNIT_TEST_SUITE(ProtobufWalk) { TMutableField f(msg, fd); if (f.IsString()) { for (size_t i = 0; i < f.Size(); ++i) - if (f.Get<TString>(i).StartsWith('1')) - f.Set(f.Get<TString>(i) + f.Get<TString>(i), i); + if (f.Get<TString>(i).StartsWith('1')) + f.Set(f.Get<TString>(i) + f.Get<TString>(i), i); } return true; } diff --git a/library/cpp/regex/hyperscan/hyperscan.cpp b/library/cpp/regex/hyperscan/hyperscan.cpp index ba321f9c29c..98e402962da 100644 --- a/library/cpp/regex/hyperscan/hyperscan.cpp +++ b/library/cpp/regex/hyperscan/hyperscan.cpp @@ -249,7 +249,7 @@ namespace NHyperscan { return NPrivate::Matches(db, scratch, text, *Singleton<NPrivate::TImpl>()); } - TString Serialize(const TDatabase& db) { + TString Serialize(const TDatabase& db) { char* databaseBytes = nullptr; size_t databaseLength; hs_error_t status = Singleton<NPrivate::TImpl>()->SerializeDatabase( @@ -260,7 +260,7 @@ namespace NHyperscan { if (status != HS_SUCCESS) { ythrow yexception() << "Failed to serialize hyperscan database"; } - return TString(serialization.Get(), databaseLength); + return TString(serialization.Get(), databaseLength); } TDatabase Deserialize(const TStringBuf& serialization) { diff --git a/library/cpp/regex/hyperscan/hyperscan.h b/library/cpp/regex/hyperscan/hyperscan.h index 1c8f4043892..b615abea1d5 100644 --- a/library/cpp/regex/hyperscan/hyperscan.h +++ b/library/cpp/regex/hyperscan/hyperscan.h @@ -121,8 +121,8 @@ namespace NHyperscan { TDatabase Compile(const TStringBuf& regex, unsigned int flags, TCPUFeatures cpuFeatures); TDatabase CompileMulti( - const TVector<const char*>& regexs, - const TVector<unsigned int>& flags, + const TVector<const char*>& regexs, + const TVector<unsigned int>& flags, const TVector<unsigned int>& ids, const TVector<const hs_expr_ext_t*>* extendedParameters = nullptr); @@ -154,7 +154,7 @@ namespace NHyperscan { const TScratch& scratch, const TStringBuf& text); - TString Serialize(const TDatabase& db); + TString Serialize(const TDatabase& db); TDatabase Deserialize(const TStringBuf& serialization); } diff --git a/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp b/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp index 9caa53f2e7f..30b4024b33d 100644 --- a/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp +++ b/library/cpp/regex/hyperscan/ut/hyperscan_ut.cpp @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) { UNIT_ASSERT(NHyperscan::Matches(db, scratch, "BAR")); UNIT_ASSERT(!NHyperscan::Matches(db, scratch, "FOO")); - TSet<unsigned int> foundIds; + TSet<unsigned int> foundIds; auto callback = [&](unsigned int id, unsigned long long /* from */, unsigned long long /* to */) { foundIds.insert(id); }; @@ -89,7 +89,7 @@ Y_UNIT_TEST_SUITE(HyperscanWrappers) { NHyperscan::TDatabase db = NHyperscan::Compile( "foo", HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH); - TString serialization = Serialize(db); + TString serialization = Serialize(db); db.Reset(); TDatabase db2 = Deserialize(serialization); NHyperscan::TScratch scratch = NHyperscan::MakeScratch(db2); diff --git a/library/cpp/regex/pcre/regexp.cpp b/library/cpp/regex/pcre/regexp.cpp index 575c09cee40..335c27f2eb2 100644 --- a/library/cpp/regex/pcre/regexp.cpp +++ b/library/cpp/regex/pcre/regexp.cpp @@ -1,6 +1,6 @@ #include "regexp.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/ascii.h> #include <util/system/defaults.h> @@ -135,7 +135,7 @@ class TRegExBaseImpl: public TAtomicRefCount<TRegExBaseImpl> { protected: int CompileOptions; - TString RegExpr; + TString RegExpr; regex_t Preg; public: @@ -145,7 +145,7 @@ public: memset(&Preg, 0, sizeof(Preg)); } - TRegExBaseImpl(const TString& re, int cflags) + TRegExBaseImpl(const TString& re, int cflags) : CompileOptions(cflags) , RegExpr(re) { @@ -188,7 +188,7 @@ public: } private: - TString Error; + TString Error; }; bool TRegExBase::IsCompiled() const { @@ -201,14 +201,14 @@ TRegExBase::TRegExBase(const char* re, int cflags) { } } -TRegExBase::TRegExBase(const TString& re, int cflags) { +TRegExBase::TRegExBase(const TString& re, int cflags) { Compile(re, cflags); } TRegExBase::~TRegExBase() { } -void TRegExBase::Compile(const TString& re, int cflags) { +void TRegExBase::Compile(const TString& re, int cflags) { Impl = new TRegExBaseImpl(re, cflags); } @@ -224,7 +224,7 @@ int TRegExBase::GetCompileOptions() const { return Impl->CompileOptions; } -TString TRegExBase::GetRegExpr() const { +TString TRegExBase::GetRegExpr() const { if (!Impl) ythrow yexception() << "!Regular expression is not compiled"; return Impl->RegExpr; @@ -235,7 +235,7 @@ TRegExMatch::TRegExMatch(const char* re, int cflags) { } -TRegExMatch::TRegExMatch(const TString& re, int cflags) +TRegExMatch::TRegExMatch(const TString& re, int cflags) : TRegExBase(re, cflags) { } @@ -251,17 +251,17 @@ TRegExSubst::TRegExSubst(const char* re, int cflags) memset(Brfs, 0, sizeof(TBackReferences) * NMATCHES); } -TString TRegExSubst::Replace(const char* str, int eflags) { - TString s; +TString TRegExSubst::Replace(const char* str, int eflags) { + TString s; if (BrfsCount) { if (Exec(str, PMatch, eflags) == 0) { int i; for (i = 0; i < BrfsCount; i++) { - s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg); + s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg); if (Brfs[i].Refer >= 0 && Brfs[i].Refer < NMATCHES) - s += TString(str, PMatch[Brfs[i].Refer].rm_so, int(PMatch[Brfs[i].Refer].rm_eo - PMatch[Brfs[i].Refer].rm_so)); + s += TString(str, PMatch[Brfs[i].Refer].rm_so, int(PMatch[Brfs[i].Refer].rm_eo - PMatch[Brfs[i].Refer].rm_so)); } - s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg); + s += TString(Replacement, Brfs[i].Beg, Brfs[i].End - Brfs[i].Beg); } } else { s = Replacement; diff --git a/library/cpp/regex/pcre/regexp.h b/library/cpp/regex/pcre/regexp.h index bc610bd2f34..742fa20dace 100644 --- a/library/cpp/regex/pcre/regexp.h +++ b/library/cpp/regex/pcre/regexp.h @@ -3,7 +3,7 @@ #include <sys/types.h> #include <util/system/defaults.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <contrib/libs/pcre/pcre.h> @@ -22,21 +22,21 @@ protected: public: TRegExBase(const char* regExpr = nullptr, int cflags = REG_EXTENDED); - TRegExBase(const TString& regExpr, int cflags = REG_EXTENDED); + TRegExBase(const TString& regExpr, int cflags = REG_EXTENDED); virtual ~TRegExBase(); int Exec(const char* str, regmatch_t pmatch[], int eflags, int nmatches = NMATCHES) const; - void Compile(const TString& regExpr, int cflags = REG_EXTENDED); + void Compile(const TString& regExpr, int cflags = REG_EXTENDED); bool IsCompiled() const; int GetCompileOptions() const; - TString GetRegExpr() const; + TString GetRegExpr() const; }; class TRegExMatch: public TRegExBase { public: TRegExMatch(const char* regExpr = nullptr, int cflags = REG_NOSUB | REG_EXTENDED); - TRegExMatch(const TString& regExpr, int cflags = REG_NOSUB | REG_EXTENDED); + TRegExMatch(const TString& regExpr, int cflags = REG_NOSUB | REG_EXTENDED); bool Match(const char* str) const; }; @@ -58,6 +58,6 @@ private: public: TRegExSubst(const char* regExpr = nullptr, int cflags = REG_EXTENDED); - TString Replace(const char* str, int eflags = 0); + TString Replace(const char* str, int eflags = 0); int ParseReplacement(const char* replacement); }; diff --git a/library/cpp/regex/pcre/regexp_ut.cpp b/library/cpp/regex/pcre/regexp_ut.cpp index 5184e801cc6..4047ebffbdb 100644 --- a/library/cpp/regex/pcre/regexp_ut.cpp +++ b/library/cpp/regex/pcre/regexp_ut.cpp @@ -56,7 +56,7 @@ private: inline void TestRe() { for (const auto& regTest : REGTEST_DATA) { memset(Matches, 0, sizeof(Matches)); - TString result; + TString result; TRegExBase re(regTest.Regexp, regTest.CompileOptions); if (re.Exec(regTest.Data, Matches, regTest.RunOptions) == 0) { @@ -78,13 +78,13 @@ private: for (const auto& substTest : SUBSTTEST_DATA) { TRegExSubst subst(substTest.Regexp, substTest.CompileOptions); subst.ParseReplacement(substTest.Replacement); - TString result = subst.Replace(substTest.Data, substTest.RunOptions); + TString result = subst.Replace(substTest.Data, substTest.RunOptions); UNIT_ASSERT_VALUES_EQUAL(result, substTest.Result); TRegExSubst substCopy = subst; subst.ParseReplacement(substTest.Replacement2); - TString newResult = subst.Replace(substTest.Data, substTest.RunOptions); + TString newResult = subst.Replace(substTest.Data, substTest.RunOptions); UNIT_ASSERT_VALUES_UNEQUAL(newResult.c_str(), result.c_str()); - TString copyResult = substCopy.Replace(substTest.Data, substTest.RunOptions); + TString copyResult = substCopy.Replace(substTest.Data, substTest.RunOptions); UNIT_ASSERT_VALUES_EQUAL(copyResult, result); substCopy = subst; copyResult = substCopy.Replace(substTest.Data, substTest.RunOptions); diff --git a/library/cpp/regex/pire/pcre2pire.cpp b/library/cpp/regex/pire/pcre2pire.cpp index f788beb85f4..d989656e1ce 100644 --- a/library/cpp/regex/pire/pcre2pire.cpp +++ b/library/cpp/regex/pire/pcre2pire.cpp @@ -3,7 +3,7 @@ #include <util/generic/yexception.h> TString Pcre2Pire(const TString& src) { - TVector<char> result; + TVector<char> result; result.reserve(src.size() + 1); enum EState { diff --git a/library/cpp/regex/pire/pcre2pire.h b/library/cpp/regex/pire/pcre2pire.h index 46e45b91930..054fea6f01e 100644 --- a/library/cpp/regex/pire/pcre2pire.h +++ b/library/cpp/regex/pire/pcre2pire.h @@ -2,7 +2,7 @@ // Author: smikler@yandex-team.ru -#include <util/generic/string.h> +#include <util/generic/string.h> /* Converts pcre regular expression to pire compatible format: * - replaces "\\#" with "#" @@ -16,4 +16,4 @@ * NOTE: * - Not fully tested! */ -TString Pcre2Pire(const TString& src); +TString Pcre2Pire(const TString& src); diff --git a/library/cpp/regex/pire/regexp.h b/library/cpp/regex/pire/regexp.h index 94bba4064b7..f3b98bc91c3 100644 --- a/library/cpp/regex/pire/regexp.h +++ b/library/cpp/regex/pire/regexp.h @@ -6,7 +6,7 @@ #include <library/cpp/charset/recyr.hh> #include <util/generic/maybe.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> @@ -15,22 +15,22 @@ namespace NRegExp { struct TFsmBase { struct TOptions { - inline TOptions& SetCaseInsensitive(bool v) noexcept { + inline TOptions& SetCaseInsensitive(bool v) noexcept { CaseInsensitive = v; return *this; } - inline TOptions& SetSurround(bool v) noexcept { + inline TOptions& SetSurround(bool v) noexcept { Surround = v; return *this; } - inline TOptions& SetCapture(size_t pos) noexcept { + inline TOptions& SetCapture(size_t pos) noexcept { CapturePos = pos; return *this; } - inline TOptions& SetCharset(ECharset charset) noexcept { + inline TOptions& SetCharset(ECharset charset) noexcept { Charset = charset; return *this; } @@ -118,7 +118,7 @@ namespace NRegExp { { } - inline const TScanner& GetScanner() const noexcept { + inline const TScanner& GetScanner() const noexcept { return Scanner; } @@ -202,7 +202,7 @@ namespace NRegExp { Fsm.GetScanner().Initialize(State); } - inline bool Final() const noexcept { + inline bool Final() const noexcept { return GetScanner().Final(GetState()); } @@ -217,11 +217,11 @@ namespace NRegExp { } } - inline const typename TFsm::TScanner& GetScanner() const noexcept { + inline const typename TFsm::TScanner& GetScanner() const noexcept { return Fsm.GetScanner(); } - inline const TState& GetState() const noexcept { + inline const TState& GetState() const noexcept { return State; } @@ -245,13 +245,13 @@ namespace NRegExp { return Match(s.data(), s.size(), addBegin, addEnd); } - inline const char* Find(const char* b, const char* e) noexcept { + inline const char* Find(const char* b, const char* e) noexcept { return NPire::ShortestPrefix(GetScanner(), b, e); } typedef std::pair<const size_t*, const size_t*> TMatchedRegexps; - inline TMatchedRegexps MatchedRegexps() const noexcept { + inline TMatchedRegexps MatchedRegexps() const noexcept { return GetScanner().AcceptedRegexps(GetState()); } }; @@ -263,7 +263,7 @@ namespace NRegExp { { } - inline bool Captured() const noexcept { + inline bool Captured() const noexcept { return GetState().Captured(); } @@ -277,7 +277,7 @@ namespace NRegExp { return Search(s.data(), s.size()); } - inline TStringBuf GetCaptured() const noexcept { + inline TStringBuf GetCaptured() const noexcept { return TStringBuf(Data.data() + GetState().Begin() - 1, Data.data() + GetState().End() - 1); } diff --git a/library/cpp/regex/pire/ut/ya.make b/library/cpp/regex/pire/ut/ya.make index 8776695f405..117ef9694f6 100644 --- a/library/cpp/regex/pire/ut/ya.make +++ b/library/cpp/regex/pire/ut/ya.make @@ -1,4 +1,4 @@ -# this test in not linked into build tree with ReCURSE and is built by unittest/library +# this test in not linked into build tree with ReCURSE and is built by unittest/library UNITTEST() diff --git a/library/cpp/resource/registry.cpp b/library/cpp/resource/registry.cpp index 66001c47693..cf9dbb1be71 100644 --- a/library/cpp/resource/registry.cpp +++ b/library/cpp/resource/registry.cpp @@ -20,7 +20,7 @@ namespace { typedef std::pair<TStringBuf, TStringBuf> TDescriptor; - struct TStore: public IStore, public THashMap<TStringBuf, TDescriptor*> { + struct TStore: public IStore, public THashMap<TStringBuf, TDescriptor*> { void Store(const TStringBuf key, const TStringBuf data) override { if (contains(key)) { const TStringBuf value = (*this)[key]->second; @@ -87,7 +87,7 @@ namespace { } } - size_t Count() const noexcept override { + size_t Count() const noexcept override { return D_.size(); } @@ -95,7 +95,7 @@ namespace { return D_.at(idx).first; } - typedef TDeque<TDescriptor> TDescriptors; + typedef TDeque<TDescriptor> TDescriptors; TDescriptors D_; }; } diff --git a/library/cpp/resource/registry.h b/library/cpp/resource/registry.h index fe67702cbc2..3e7987be908 100644 --- a/library/cpp/resource/registry.h +++ b/library/cpp/resource/registry.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include "resource.h" @@ -19,7 +19,7 @@ namespace NResource { virtual void Store(const TStringBuf key, const TStringBuf data) = 0; virtual bool FindExact(const TStringBuf key, TString* out) const = 0; virtual void FindMatch(const TStringBuf subkey, IMatch& cb) const = 0; - virtual size_t Count() const noexcept = 0; + virtual size_t Count() const noexcept = 0; virtual TStringBuf KeyByIndex(size_t idx) const = 0; virtual ~IStore() { } diff --git a/library/cpp/resource/resource.cpp b/library/cpp/resource/resource.cpp index cc20f847a5f..291b9d12158 100644 --- a/library/cpp/resource/resource.cpp +++ b/library/cpp/resource/resource.cpp @@ -31,7 +31,7 @@ void NResource::FindMatch(const TStringBuf subkey, TResources* out) { } TString NResource::Find(const TStringBuf key) { - TString ret; + TString ret; if (FindExact(key, &ret)) { return ret; @@ -40,7 +40,7 @@ TString NResource::Find(const TStringBuf key) { ythrow yexception() << "can not find resource with path " << key; } -size_t NResource::Count() noexcept { +size_t NResource::Count() noexcept { return CommonStore()->Count(); } @@ -48,8 +48,8 @@ TStringBuf NResource::KeyByIndex(size_t idx) { return CommonStore()->KeyByIndex(idx); } -TVector<TStringBuf> NResource::ListAllKeys() { - TVector<TStringBuf> res(Reserve(NResource::Count())); +TVector<TStringBuf> NResource::ListAllKeys() { + TVector<TStringBuf> res(Reserve(NResource::Count())); for (auto i : xrange(NResource::Count())) { res.push_back(NResource::KeyByIndex(i)); } diff --git a/library/cpp/resource/resource.h b/library/cpp/resource/resource.h index 42dd0f1891d..201b319363a 100644 --- a/library/cpp/resource/resource.h +++ b/library/cpp/resource/resource.h @@ -1,22 +1,22 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/vector.h> namespace NResource { struct TResource { TStringBuf Key; - TString Data; + TString Data; }; - typedef TVector<TResource> TResources; + typedef TVector<TResource> TResources; TString Find(const TStringBuf key); bool FindExact(const TStringBuf key, TString* out); //perform full scan for now void FindMatch(const TStringBuf subkey, TResources* out); - size_t Count() noexcept; + size_t Count() noexcept; TStringBuf KeyByIndex(size_t idx); - TVector<TStringBuf> ListAllKeys(); + TVector<TStringBuf> ListAllKeys(); } diff --git a/library/cpp/scheme/domscheme_traits.h b/library/cpp/scheme/domscheme_traits.h index a11c4dd4446..3d6e92e8034 100644 --- a/library/cpp/scheme/domscheme_traits.h +++ b/library/cpp/scheme/domscheme_traits.h @@ -7,7 +7,7 @@ struct TSchemeTraits { using TValue = NSc::TValue; using TValueRef = TValue*; using TConstValueRef = const TValue*; - using TStringType = TStringBuf; + using TStringType = TStringBuf; // anyvalue defaults template <class T> @@ -213,8 +213,8 @@ struct TSchemeTraits { } // validation ops - static inline TVector<TString> GetKeys(TConstValueRef v) { - TVector<TString> res; + static inline TVector<TString> GetKeys(TConstValueRef v) { + TVector<TString> res; for (const auto& key : v->DictKeys(true)) { res.push_back(ToString(key)); } diff --git a/library/cpp/scheme/scheme.cpp b/library/cpp/scheme/scheme.cpp index 3efd116d4f1..cade561ed49 100644 --- a/library/cpp/scheme/scheme.cpp +++ b/library/cpp/scheme/scheme.cpp @@ -128,7 +128,7 @@ namespace NSc { return deflt; } - TString TValue::ForceString(const TString& deflt) const { + TString TValue::ForceString(const TString& deflt) const { const TScCore& core = Core(); if (core.IsString()) { return ToString(core.GetString(TStringBuf())); @@ -584,7 +584,7 @@ namespace NSc { LIBRARY_SCHEME_DECLARE_TVALUE_OPS_IMPL(double, CompareFloat) LIBRARY_SCHEME_DECLARE_TVALUE_OPS_IMPL(TStringBuf, CompareStr) - LIBRARY_SCHEME_DECLARE_TVALUE_OPS_IMPL(const TString&, CompareStr) + LIBRARY_SCHEME_DECLARE_TVALUE_OPS_IMPL(const TString&, CompareStr) LIBRARY_SCHEME_DECLARE_TVALUE_OPS_IMPL(const char* const, CompareStr) #undef LIBRARY_SCHEME_DECLARE_TVALUE_OPS_IMPL diff --git a/library/cpp/scheme/scheme.h b/library/cpp/scheme/scheme.h index 3d7c59f3c97..8d32fd88d58 100644 --- a/library/cpp/scheme/scheme.h +++ b/library/cpp/scheme/scheme.h @@ -176,7 +176,7 @@ namespace NSc { inline TValue& SetString(TStringBuf val = TStringBuf()); // returns self - TString ForceString(const TString& deflt = TString()) const; // Best-effort cast to TString (will do ToString for numeric types) + TString ForceString(const TString& deflt = TString()) const; // Best-effort cast to TString (will do ToString for numeric types) // todo: remove inline bool StringEmpty() const; @@ -301,11 +301,11 @@ namespace NSc { static bool FromJson(TValue&, TStringBuf, const TJsonOpts& = TJsonOpts()); // TODO: Переименовать ToJson в ToJsonUnsafe, а ToJsonSafe в ToJson - TString ToJson(const TJsonOpts& = TJsonOpts()) const; + TString ToJson(const TJsonOpts& = TJsonOpts()) const; const TValue& ToJson(IOutputStream&, const TJsonOpts& = TJsonOpts()) const; // returns self // ToJson(JO_SORT_KEYS | JO_SKIP_UNSAFE) - TString ToJsonSafe(const TJsonOpts& = TJsonOpts()) const; + TString ToJsonSafe(const TJsonOpts& = TJsonOpts()) const; const TValue& ToJsonSafe(IOutputStream&, const TJsonOpts& = TJsonOpts()) const; // ToJson(JO_SORT_KEYS | JO_PRETTY | JO_SKIP_UNSAFE) @@ -354,7 +354,7 @@ namespace NSc { // TODO: add throwing variants // make sure to properly escape the tokens - static TString EscapeForPath(TStringBuf rawKey); // converts a raw dict key into a valid token for a selector path + static TString EscapeForPath(TStringBuf rawKey); // converts a raw dict key into a valid token for a selector path static bool PathValid(TStringBuf path); // returns true if the path is syntactically valid @@ -514,7 +514,7 @@ namespace NSc { // todo: allow insertions // todo: make TDict methods safe class TDict: public THashMap<TStringBuf, TValue, THash<TStringBuf>, TEqualTo<TStringBuf>, TPoolAllocator>, TNonCopyable { - using TParent = THashMap<TStringBuf, TValue, THash<TStringBuf>, TEqualTo<TStringBuf>, TPoolAllocator>; + using TParent = THashMap<TStringBuf, TValue, THash<TStringBuf>, TEqualTo<TStringBuf>, TPoolAllocator>; public: TDict(TMemoryPool* p) diff --git a/library/cpp/scheme/scheme_cast.h b/library/cpp/scheme/scheme_cast.h index 00839e8017c..4ab215a0bec 100644 --- a/library/cpp/scheme/scheme_cast.h +++ b/library/cpp/scheme/scheme_cast.h @@ -31,35 +31,35 @@ namespace NJsonConverters { // fwd declarations ////////////////////////////////////////////////////////////////////// - //TVector + //TVector template <typename T, typename A> - NSc::TValue ToTValue(const TVector<T, A>& x); + NSc::TValue ToTValue(const TVector<T, A>& x); template <typename T, typename A> - void FromTValue(const NSc::TValue& x, TVector<T, A>& out, const bool validate); + void FromTValue(const NSc::TValue& x, TVector<T, A>& out, const bool validate); - //THashMap + //THashMap template <class Key, class T, class HashFcn, class EqualKey, class Alloc> - NSc::TValue ToTValue(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& x); + NSc::TValue ToTValue(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& x); template <class Key, class T, class HashFcn, class EqualKey, class Alloc> - void FromTValue(const NSc::TValue& x, THashMap<Key, T, HashFcn, EqualKey, Alloc>& out, const bool validate); + void FromTValue(const NSc::TValue& x, THashMap<Key, T, HashFcn, EqualKey, Alloc>& out, const bool validate); - //TMap + //TMap template <class K, class V, class Less, class A> - NSc::TValue ToTValue(const TMap<K, V, Less, A>& x); + NSc::TValue ToTValue(const TMap<K, V, Less, A>& x); template <class K, class V, class Less, class A> - void FromTValue(const NSc::TValue& x, TMap<K, V, Less, A>& out, const bool validate); + void FromTValue(const NSc::TValue& x, TMap<K, V, Less, A>& out, const bool validate); - //THashSet + //THashSet template <class V, class H, class E, class A> - NSc::TValue ToTValue(const THashSet<V, H, E, A>& x); + NSc::TValue ToTValue(const THashSet<V, H, E, A>& x); template <class V, class H, class E, class A> - void FromTValue(const NSc::TValue& x, THashSet<V, H, E, A>& out, const bool validate); + void FromTValue(const NSc::TValue& x, THashSet<V, H, E, A>& out, const bool validate); - //TSet + //TSet template <class K, class L, class A> - NSc::TValue ToTValue(const TSet<K, L, A>& x); + NSc::TValue ToTValue(const TSet<K, L, A>& x); template <class K, class L, class A> - void FromTValue(const NSc::TValue& x, TSet<K, L, A>& out, const bool validate); + void FromTValue(const NSc::TValue& x, TSet<K, L, A>& out, const bool validate); //std::pair template <class T1, class T2> @@ -83,7 +83,7 @@ namespace NJsonConverters { out = x; } - static TString ToString(const T& x) { + static TString ToString(const T& x) { return ::ToString(x); } @@ -102,7 +102,7 @@ namespace NJsonConverters { out.FromTValue(x, validate); } - static TString ToString(const T& x) { + static TString ToString(const T& x) { return x.ToJson(); } @@ -129,7 +129,7 @@ namespace NJsonConverters { } template <typename T> - TString ToString(const T& x) { + TString ToString(const T& x) { return TValueAndStrokaConv<T, std::is_base_of<IJsonSerializable, T>::value>::ToString(x); } @@ -204,16 +204,16 @@ namespace NJsonConverters { // TVector ////////////////////////////////////////////////////////////////////// template <typename T, typename A> - NSc::TValue ToTValue(const TVector<T, A>& x) { + NSc::TValue ToTValue(const TVector<T, A>& x) { NSc::TValue out; out.SetArray(); - for (typename TVector<T, A>::const_iterator it = x.begin(); it != x.end(); ++it) + for (typename TVector<T, A>::const_iterator it = x.begin(); it != x.end(); ++it) out.Push(NJsonConverters::ToTValue(*it)); return out; } template <typename T, typename A> - void FromTValue(const NSc::TValue& x, TVector<T, A>& out, const bool validate) { + void FromTValue(const NSc::TValue& x, TVector<T, A>& out, const bool validate) { if (validate) Y_ENSURE(x.IsArray() || x.IsNull(), "not valid input scheme"); out.clear(); @@ -232,22 +232,22 @@ namespace NJsonConverters { // THashMap & TMap ////////////////////////////////////////////////////////////////////// template <class Key, class T, class HashFcn, class EqualKey, class Alloc> - NSc::TValue ToTValue(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& x) { + NSc::TValue ToTValue(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& x) { return NPrivate::ToTValueDict(x); } template <class Key, class T, class HashFcn, class EqualKey, class Alloc> - void FromTValue(const NSc::TValue& x, THashMap<Key, T, HashFcn, EqualKey, Alloc>& out, const bool validate) { + void FromTValue(const NSc::TValue& x, THashMap<Key, T, HashFcn, EqualKey, Alloc>& out, const bool validate) { NPrivate::FromTValueDict(x, out, validate); } template <class K, class V, class Less, class A> - NSc::TValue ToTValue(const TMap<K, V, Less, A>& x) { + NSc::TValue ToTValue(const TMap<K, V, Less, A>& x) { return NPrivate::ToTValueDict(x); } template <class K, class V, class Less, class A> - void FromTValue(const NSc::TValue& x, TMap<K, V, Less, A>& out, const bool validate) { + void FromTValue(const NSc::TValue& x, TMap<K, V, Less, A>& out, const bool validate) { NPrivate::FromTValueDict(x, out, validate); } @@ -255,22 +255,22 @@ namespace NJsonConverters { // THashSet & TSet ////////////////////////////////////////////////////////////////////// template <class V, class H, class E, class A> - NSc::TValue ToTValue(const THashSet<V, H, E, A>& x) { + NSc::TValue ToTValue(const THashSet<V, H, E, A>& x) { return NPrivate::ToTValueSet(x); } template <class V, class H, class E, class A> - void FromTValue(const NSc::TValue& x, THashSet<V, H, E, A>& out, const bool validate) { + void FromTValue(const NSc::TValue& x, THashSet<V, H, E, A>& out, const bool validate) { NPrivate::FromTValueSet(x, out, validate); } template <class K, class L, class A> - NSc::TValue ToTValue(const TSet<K, L, A>& x) { + NSc::TValue ToTValue(const TSet<K, L, A>& x) { return NPrivate::ToTValueSet(x); } template <class K, class L, class A> - void FromTValue(const NSc::TValue& x, TSet<K, L, A>& out, const bool validate) { + void FromTValue(const NSc::TValue& x, TSet<K, L, A>& out, const bool validate) { NPrivate::FromTValueSet(x, out, validate); } @@ -307,7 +307,7 @@ namespace NJsonConverters { // global user functions ////////////////////////////////////////////////////////////////////// template <typename T> - TString ToJson(const T& val, const bool sort = false) { + TString ToJson(const T& val, const bool sort = false) { return NJsonConverters::ToTValue(val).ToJson(sort); } diff --git a/library/cpp/scheme/scimpl.h b/library/cpp/scheme/scimpl.h index 4f68f16290f..984f4076e5c 100644 --- a/library/cpp/scheme/scimpl.h +++ b/library/cpp/scheme/scimpl.h @@ -849,7 +849,7 @@ namespace NSc { LIBRARY_SCHEME_DECLARE_TVALUE_OPS(double, CompareFloat) LIBRARY_SCHEME_DECLARE_TVALUE_OPS(TStringBuf, CompareStr) - LIBRARY_SCHEME_DECLARE_TVALUE_OPS(const TString&, CompareStr) + LIBRARY_SCHEME_DECLARE_TVALUE_OPS(const TString&, CompareStr) LIBRARY_SCHEME_DECLARE_TVALUE_OPS(const char* const, CompareStr) #undef LIBRARY_SCHEME_DECLARE_TVALUE_OPS diff --git a/library/cpp/scheme/scimpl_defs.h b/library/cpp/scheme/scimpl_defs.h index f3dd66b4379..638488c6b65 100644 --- a/library/cpp/scheme/scimpl_defs.h +++ b/library/cpp/scheme/scimpl_defs.h @@ -10,7 +10,7 @@ #include <util/generic/hash.h> #include <util/generic/ptr.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <functional> #include <util/string/vector.h> @@ -43,7 +43,7 @@ namespace NSc { }; } - using TStringBufs = TVector<TStringBuf>; + using TStringBufs = TVector<TStringBuf>; class TSchemeException : public yexception { }; @@ -51,12 +51,12 @@ namespace NSc { class TSchemeParseException : public TSchemeException { public: size_t Offset = 0; - TString Reason; + TString Reason; public: TSchemeParseException() = default; - TSchemeParseException(size_t off, const TString& reason) + TSchemeParseException(size_t off, const TString& reason) : Offset(off) , Reason(reason) { diff --git a/library/cpp/scheme/scimpl_json_read.cpp b/library/cpp/scheme/scimpl_json_read.cpp index 8a29cc77391..12b76252007 100644 --- a/library/cpp/scheme/scimpl_json_read.cpp +++ b/library/cpp/scheme/scimpl_json_read.cpp @@ -7,7 +7,7 @@ namespace NSc { struct TJsonError { size_t Offset = 0; - TMaybe<TString> Reason; + TMaybe<TString> Reason; }; struct TJsonDeserializer : NJson::TJsonCallbacks { @@ -57,14 +57,14 @@ namespace NSc { } }; - typedef TVector<TContainer> TStackType; + typedef TVector<TContainer> TStackType; public: TValue& Root; TJsonError& Error; const TJsonOpts& Cfg; - TStackType Stack; + TStackType Stack; bool Virgin = true; public: @@ -213,7 +213,7 @@ namespace NSc { return res; } - TString reason = err.Reason.Empty() ? "NULL" : *err.Reason; + TString reason = err.Reason.Empty() ? "NULL" : *err.Reason; ythrow TSchemeParseException(err.Offset, reason) << "JSON error at offset " << err.Offset << " (" << reason << ")"; } diff --git a/library/cpp/scheme/scimpl_json_write.cpp b/library/cpp/scheme/scimpl_json_write.cpp index aadd7e6cd5f..60026e8d09f 100644 --- a/library/cpp/scheme/scimpl_json_write.cpp +++ b/library/cpp/scheme/scimpl_json_write.cpp @@ -154,8 +154,8 @@ namespace NSc { return *this; } - TString TValue::ToJson(const TJsonOpts& jopts) const { - TString s; + TString TValue::ToJson(const TJsonOpts& jopts) const { + TString s; { TStringOutput out(s); ToJson(out, jopts); @@ -175,7 +175,7 @@ namespace NSc { return MakeOptsSafeForSerializer(opts); } - TString TValue::ToJsonSafe(const TJsonOpts& jopts) const { + TString TValue::ToJsonSafe(const TJsonOpts& jopts) const { return ToJson(MakeOptsSafeForSerializer(jopts)); } diff --git a/library/cpp/scheme/scimpl_private.cpp b/library/cpp/scheme/scimpl_private.cpp index 024bf8cc3b2..51323d3e3c9 100644 --- a/library/cpp/scheme/scimpl_private.cpp +++ b/library/cpp/scheme/scimpl_private.cpp @@ -22,7 +22,7 @@ namespace NSc { }; template <typename TAction, typename TElement, typename TColl> - static inline void PutToVector(TVector<TElement>& vector, TColl& coll) { + static inline void PutToVector(TVector<TElement>& vector, TColl& coll) { size_t i = vector.size(); vector.resize(vector.size() + coll.size()); @@ -61,7 +61,7 @@ namespace NSc { Y_FAIL("REFERENCE LOOP DETECTED"); break; case EMode::Stderr: - Cerr << "REFERENCE LOOP DETECTED: " << JoinStrings(Vector.begin(), Vector.end(), ", ") + Cerr << "REFERENCE LOOP DETECTED: " << JoinStrings(Vector.begin(), Vector.end(), ", ") << " AND " << ToString((const void*)&self) << Endl; break; } diff --git a/library/cpp/scheme/scimpl_private.h b/library/cpp/scheme/scimpl_private.h index b92badabde1..aadc56a58c2 100644 --- a/library/cpp/scheme/scimpl_private.h +++ b/library/cpp/scheme/scimpl_private.h @@ -15,7 +15,7 @@ namespace NSc { class TContextGuard : TNonCopyable { using TElement = typename TContext::TElement; using TTarget = typename TContext::TTarget; - using TVectorType = TVector<TElement>; + using TVectorType = TVector<TElement>; public: TContextGuard(TContext& ctx, TTarget& target) @@ -35,7 +35,7 @@ namespace NSc { } } - const TVectorType& GetVector() const { + const TVectorType& GetVector() const { return Ctx.Vector; } @@ -68,7 +68,7 @@ namespace NSc { Vector.reserve(64); } - TVector<TElement> Vector; + TVector<TElement> Vector; }; class TKeySortContext: public TBasicContext<TStringBuf, const TDict> { diff --git a/library/cpp/scheme/scimpl_protobuf.cpp b/library/cpp/scheme/scimpl_protobuf.cpp index 0c99122c69a..f640118a5a7 100644 --- a/library/cpp/scheme/scimpl_protobuf.cpp +++ b/library/cpp/scheme/scimpl_protobuf.cpp @@ -13,12 +13,12 @@ namespace NSc { TValue TValue::From(const Message& msg, bool mapAsDict) { TValue v; const Reflection* r = msg.GetReflection(); - TVector<const FieldDescriptor*> fields; - TVector<const FieldDescriptor*>::iterator it; - int i1; + TVector<const FieldDescriptor*> fields; + TVector<const FieldDescriptor*>::iterator it; + int i1; r->ListFields(msg, &fields); - for (it = fields.begin(), i1 = 0; it != fields.end(); ++it, ++i1) { + for (it = fields.begin(), i1 = 0; it != fields.end(); ++it, ++i1) { const FieldDescriptor* field = *it; try { if (field->is_repeated()) { @@ -154,7 +154,7 @@ namespace NSc { } void TValue::ValueToField(const TValue& value, Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const { - const TString& name = field->name(); + const TString& name = field->name(); if (value.IsNull()) { if (field->is_required() && !field->has_default_value()) { ythrow TSchemeException() << "has no value for required field " << name; @@ -233,7 +233,7 @@ namespace NSc { } void TValue::ToRepeatedField(Message& msg, const FieldDescriptor* field, const TProtoOpts& opts) const { - const TString& name = field->name(); + const TString& name = field->name(); const TValue& fieldValue = Get(name); if (fieldValue.IsNull()) { diff --git a/library/cpp/scheme/scimpl_select.rl6 b/library/cpp/scheme/scimpl_select.rl6 index 11aa549b78b..a7dbbfdf810 100644 --- a/library/cpp/scheme/scimpl_select.rl6 +++ b/library/cpp/scheme/scimpl_select.rl6 @@ -54,7 +54,7 @@ namespace NSc { template <typename TSelector> struct TSelectorCtx { TSelector Selector; - TString Buffer; + TString Buffer; const char* p0 = nullptr; const char* p = nullptr; @@ -252,7 +252,7 @@ namespace NSc { return ctx.SelectPath() || !ctx.Selector.HasError; } - TString TValue::EscapeForPath(TStringBuf rawKey) { + TString TValue::EscapeForPath(TStringBuf rawKey) { static const str_spn danger{"/[]"}; if (!rawKey || danger.brk(rawKey.begin(), rawKey.end()) != rawKey.end()) { return NEscJ::EscapeJ<true>(rawKey); diff --git a/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp b/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp index 4f907157e92..7f9101eff4b 100644 --- a/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp @@ -9,11 +9,11 @@ using namespace NJsonConverters; -using TVI = TVector<int>; -using THI = THashMap<int, int>; -using TMI = TMap<int, int>; -using THSI = THashSet<int>; -using TSI = TSet<int>; +using TVI = TVector<int>; +using THI = THashMap<int, int>; +using TMI = TMap<int, int>; +using THSI = THashSet<int>; +using TSI = TSet<int>; using TPI = std::pair<int, int>; Y_UNIT_TEST_SUITE(TSchemeCastTest) { @@ -34,7 +34,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { for (int i = 0; i < 3; ++i) h[i] = i * i; - const TString etalon = "{\"0\":0,\"1\":1,\"2\":4}"; + const TString etalon = "{\"0\":0,\"1\":1,\"2\":4}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(h, true)); THI h2(FromJson<THI>(ToJson(h))); @@ -46,7 +46,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { for (int i = 0; i < 3; ++i) h[i] = i * i; - const TString etalon = "{\"0\":0,\"1\":1,\"2\":4}"; + const TString etalon = "{\"0\":0,\"1\":1,\"2\":4}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(h, true)); TMI h2(FromJson<TMI>(ToJson(h))); @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { for (int i = 0; i < 3; ++i) h.insert(i * i); - const TString etalon = "{\"0\":null,\"1\":null,\"4\":null}"; + const TString etalon = "{\"0\":null,\"1\":null,\"4\":null}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(h, true)); THSI h2(FromJson<THSI>(ToJson(h))); @@ -70,7 +70,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { for (int i = 0; i < 3; ++i) h.insert(i * i); - const TString etalon = "{\"0\":null,\"1\":null,\"4\":null}"; + const TString etalon = "{\"0\":null,\"1\":null,\"4\":null}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(h, true)); TSI h2(FromJson<TSI>(ToJson(h))); @@ -80,7 +80,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { Y_UNIT_TEST(TestTPair) { TPI p(1, 1); - const TString etalon = "[1,1]"; + const TString etalon = "[1,1]"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(p, true)); TPI p2(FromJson<TPI>(ToJson(p))); @@ -116,7 +116,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { Y_UNIT_TEST(TestTCustom) { TCustom x(2, 3); - const TString etalon = "{\"a\":2,\"b\":3}"; + const TString etalon = "{\"a\":2,\"b\":3}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(x, true)); TCustom x2(FromJson<TCustom>(ToJson(x))); @@ -124,13 +124,13 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { } Y_UNIT_TEST(TestVectorOfPairs) { - typedef TVector<TPI> TVPI; + typedef TVector<TPI> TVPI; TVPI v; for (int i = 0; i < 3; ++i) v.push_back(TPI(i, i * i)); - const TString etalon = "[[0,0],[1,1],[2,4]]"; + const TString etalon = "[[0,0],[1,1],[2,4]]"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(v, true)); TVPI v2(FromJson<TVPI>(ToJson(v))); @@ -138,11 +138,11 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { } Y_UNIT_TEST(TestSetOfCustom) { - typedef TSet<TCustom> TSC; + typedef TSet<TCustom> TSC; TSC s; s.insert(TCustom(2, 3)); - const TString etalon = "{\"{\\\"a\\\":2,\\\"b\\\":3}\":null}"; + const TString etalon = "{\"{\\\"a\\\":2,\\\"b\\\":3}\":null}"; UNIT_ASSERT_VALUES_EQUAL(etalon, ToJson(s, true)); TSC s2(FromJson<TSC>(ToJson(s))); @@ -151,7 +151,7 @@ Y_UNIT_TEST_SUITE(TSchemeCastTest) { Y_UNIT_TEST(TestExceptions) { NSc::TValue v = 1; - const TString json = v.ToJson(); + const TString json = v.ToJson(); UNIT_ASSERT_EXCEPTION(FromJson<TVI>(json, true), yexception); UNIT_ASSERT_EXCEPTION(FromJson<THI>(json, true), yexception); UNIT_ASSERT_EXCEPTION(FromJson<TMI>(json, true), yexception); diff --git a/library/cpp/scheme/tests/ut/scheme_json_ut.cpp b/library/cpp/scheme/tests/ut/scheme_json_ut.cpp index daeb2654f9a..7b248299d69 100644 --- a/library/cpp/scheme/tests/ut/scheme_json_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_json_ut.cpp @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(TSchemeJsonTest) { } Y_UNIT_TEST(TestSafeJson) { - TString ss; + TString ss; ss.reserve(256); for (int i = 0; i < 256; ++i) { @@ -114,7 +114,7 @@ Y_UNIT_TEST_SUITE(TSchemeJsonTest) { { NSc::TValue value; - TString articleName{"\xC2\xC2\xCF"}; + TString articleName{"\xC2\xC2\xCF"}; value["text"] = articleName; UNIT_ASSERT_VALUES_EQUAL(value.ToJson(), "{\"text\":\"\xC2\xC2\xCF\"}"); UNIT_ASSERT_VALUES_EQUAL(value.ToJsonSafe(), "{\"text\":null}"); diff --git a/library/cpp/scheme/tests/ut/scheme_path_ut.cpp b/library/cpp/scheme/tests/ut/scheme_path_ut.cpp index 0d4d79d4833..7b95f02d131 100644 --- a/library/cpp/scheme/tests/ut/scheme_path_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_path_ut.cpp @@ -98,61 +98,61 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) { { NSc::TValue val; *val.TrySelectOrAdd("") = 100; - const TString res = R"=(100)="; + const TString res = R"=(100)="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd("a") = 100; - const TString res = R"=({"a":100})="; + const TString res = R"=({"a":100})="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd(R"=(////)=") = 100; - const TString res = R"=(100)="; + const TString res = R"=(100)="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd(R"=()=") = 100; - const TString res = R"=(100)="; + const TString res = R"=(100)="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd(R"=("")=") = 100; - const TString res = R"=({"":100})="; + const TString res = R"=({"":100})="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd(R"=("[1]")=") = 100; - const TString res = R"=({"[1]":100})="; + const TString res = R"=({"[1]":100})="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd(R"=("\"\"")=") = 100; - const TString res = R"=({"\"\"":100})="; + const TString res = R"=({"\"\"":100})="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd(R"=("/10/")=") = 100; - const TString res = R"=({"/10/":100})="; + const TString res = R"=({"/10/":100})="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd(R"=(/"[10]"//""/"\"/10/\""///)=") = 100; - const TString res = R"=({"[10]":{"":{"\"/10/\"":100}}})="; + const TString res = R"=({"[10]":{"":{"\"/10/\"":100}}})="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } { NSc::TValue val; *val.TrySelectOrAdd(R"=(/"[10]"//""/"\"/10/\""///)=") = 100; - const TString res = R"=({"[10]":{"":{"\"/10/\"":100}}})="; + const TString res = R"=({"[10]":{"":{"\"/10/\"":100}}})="; UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res); } } diff --git a/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp b/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp index e711a0d0925..db8d13b978c 100644 --- a/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp @@ -213,7 +213,7 @@ Y_UNIT_TEST_SUITE(TSchemeProtoTest) { NSc::TMessage proto; v.To(proto); - TString differentPath; + TString differentPath; UNIT_ASSERT_C(NProtoBuf::IsEqual(m, proto, &differentPath), differentPath); } } diff --git a/library/cpp/scheme/tests/ut/scheme_ut.cpp b/library/cpp/scheme/tests/ut/scheme_ut.cpp index 1a5d07c31bc..290ebd6c045 100644 --- a/library/cpp/scheme/tests/ut/scheme_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_ut.cpp @@ -241,7 +241,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { Y_UNIT_TEST(TestAssignments) { for (int i = -2; i < 3; ++i) { - TString ii = ToString(i); + TString ii = ToString(i); int iless = i - 1; int imore = i + 1; DoCheckAssignmentNum<signed char>(i, iless, imore, ii, "schar"); @@ -262,7 +262,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { // DoCheckAssignment<bool>(false, false, false, "false", "bool"); for (int i = 1; i < 3; ++i) { - TString ii = ToString(i); + TString ii = ToString(i); int iless = i - 1; int imore = i + 1; @@ -292,9 +292,9 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { DoCheckAssignmentNum<double>(i, iless, imore, ii, "double"); } - TString uuu = "uuu"; - TString uua = "uua"; - TString uuz = "uuz"; + TString uuu = "uuu"; + TString uua = "uua"; + TString uuz = "uuz"; DoCheckAssignment<char*>(uuu.begin(), uua.begin(), uuz.begin(), "\"uuu\"", "char*"); DoCheckAssignment<const char*>("www", "wwa", "wwz", "\"www\"", "const char*"); DoCheckAssignmentArr("xxx", "xxa", "xxz", "\"xxx\"", "const char[]"); @@ -303,7 +303,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { #if defined(_MSC_VER) //TODO #else - DoCheckAssignment<TString>("ttt", "tta", "ttz", "\"ttt\"", "TString"); + DoCheckAssignment<TString>("ttt", "tta", "ttz", "\"ttt\"", "TString"); #endif NSc::TValue v; @@ -358,12 +358,12 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { v.AppendAll(d); UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), R"(["a","b","c","d",1,2,3,4,5,6])"); UNIT_ASSERT_VALUES_EQUAL(d.size(), 3u); - TVector<TStringBuf> s{"x", "y", "z"}; + TVector<TStringBuf> s{"x", "y", "z"}; v.AppendAll(s.begin(), s.end()); UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), R"(["a","b","c","d",1,2,3,4,5,6,"x","y","z"])"); UNIT_ASSERT_VALUES_EQUAL(v.Clone().Clear().AppendAll(s).ToJson(), R"(["x","y","z"])"); - UNIT_ASSERT_VALUES_EQUAL(v.Clone().Clear().AppendAll(TVector<TStringBuf>()).ToJson(), R"([])"); + UNIT_ASSERT_VALUES_EQUAL(v.Clone().Clear().AppendAll(TVector<TStringBuf>()).ToJson(), R"([])"); v.AddAll({{"a", "b"}, {"c", "d"}}); UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), R"({"a":"b","c":"d"})"); @@ -421,10 +421,10 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { NSc::TValue va = NSc::TValue::FromJson("[ x, y]"); NSc::TValue vs = NSc::TValue::FromJson("foo"); NSc::TValue vn = NSc::TValue::FromJson("1"); - TString sd = "{\"a\":1,\"b\":\"c\"}"; - TString sa = "[\"x\",\"y\"]"; - TString ss = "\"foo\""; - TString sn = "1"; + TString sd = "{\"a\":1,\"b\":\"c\"}"; + TString sa = "[\"x\",\"y\"]"; + TString ss = "\"foo\""; + TString sn = "1"; UNIT_ASSERT_VALUES_EQUAL(sd, vd.ToJson(true)); UNIT_ASSERT_VALUES_EQUAL(sa, va.ToJson(true)); UNIT_ASSERT_VALUES_EQUAL(ss, vs.ToJson(true)); @@ -781,7 +781,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { Y_UNIT_TEST(TestCopyFrom) { { - TString sa = "[1,2]"; + TString sa = "[1,2]"; const NSc::TValue& va = NSc::TValue::FromJson(sa); NSc::TValue vb = va; vb.CopyFrom(va); @@ -789,7 +789,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { UNIT_ASSERT_VALUES_EQUAL(vb.ToJson(), sa); } { - TString sa = "[1,2]"; + TString sa = "[1,2]"; NSc::TValue va = NSc::TValue::FromJson(sa); NSc::TValue vb = va; vb.CopyFrom(va); @@ -797,7 +797,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { UNIT_ASSERT_VALUES_EQUAL(vb.ToJson(), sa); } { - TString sa = "[1,2]"; + TString sa = "[1,2]"; NSc::TValue va = NSc::TValue::FromJson(sa); const NSc::TValue& vb = va; va.CopyFrom(vb); @@ -805,7 +805,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { UNIT_ASSERT_VALUES_EQUAL(vb.ToJson(), sa); } { - TString sa = "[1,2]"; + TString sa = "[1,2]"; NSc::TValue va = NSc::TValue::FromJson(sa); NSc::TValue vb = va; va.CopyFrom(vb); @@ -816,7 +816,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { NSc::TValue va = NSc::TValue::FromJson("{\"x\":\"ab\",\"y\":{\"p\":\"cd\",\"q\":\"ef\"}}"); NSc::TValue vb = va.Get("y"); va.CopyFrom(vb); - TString sa = "{\"p\":\"cd\",\"q\":\"ef\"}"; + TString sa = "{\"p\":\"cd\",\"q\":\"ef\"}"; UNIT_ASSERT_VALUES_EQUAL(va.ToJson(), sa); UNIT_ASSERT_VALUES_EQUAL(vb.ToJson(), sa); } @@ -824,14 +824,14 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { NSc::TValue va = NSc::TValue::FromJson("{\"x\":\"ab\",\"y\":{\"p\":\"cd\",\"q\":\"ef\"}}"); const NSc::TValue& vb = va.Get("y"); va.CopyFrom(vb); - TString sa = "{\"p\":\"cd\",\"q\":\"ef\"}"; + TString sa = "{\"p\":\"cd\",\"q\":\"ef\"}"; UNIT_ASSERT_VALUES_EQUAL(va.ToJson(), sa); } { NSc::TValue va = NSc::TValue::FromJson("{\"x\":\"ab\",\"y\":{\"p\":\"cd\",\"q\":\"ef\"}}"); NSc::TValue vb = va.Get("y"); va = vb; - TString sa = "{\"p\":\"cd\",\"q\":\"ef\"}"; + TString sa = "{\"p\":\"cd\",\"q\":\"ef\"}"; UNIT_ASSERT_VALUES_EQUAL(va.ToJson(), sa); UNIT_ASSERT_VALUES_EQUAL(vb.ToJson(), sa); } @@ -839,7 +839,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) { NSc::TValue va = NSc::TValue::FromJson("{\"x\":\"ab\",\"y\":{\"p\":\"cd\",\"q\":\"ef\"}}"); const NSc::TValue& vb = va.Get("y"); va = vb; - TString sa = "{\"p\":\"cd\",\"q\":\"ef\"}"; + TString sa = "{\"p\":\"cd\",\"q\":\"ef\"}"; UNIT_ASSERT_VALUES_EQUAL(va.ToJson(), sa); UNIT_ASSERT_VALUES_EQUAL(vb.ToJson(), sa); } diff --git a/library/cpp/scheme/ut_utils/scheme_ut_utils.h b/library/cpp/scheme/ut_utils/scheme_ut_utils.h index eb3ea15b2ab..a22583432b8 100644 --- a/library/cpp/scheme/ut_utils/scheme_ut_utils.h +++ b/library/cpp/scheme/ut_utils/scheme_ut_utils.h @@ -11,16 +11,16 @@ namespace NSc { namespace NUt { TValue AssertFromJson(TStringBuf json); - inline TString NormalizeJson(const NSc::TValue& sc) { + inline TString NormalizeJson(const NSc::TValue& sc) { return sc.ToJson(true); } - inline TString NormalizeJson(const NJson::TJsonValue& sc) { + inline TString NormalizeJson(const NJson::TJsonValue& sc) { return NJson::WriteJson(sc, false, true, false); } template <class TStr> - inline TString NormalizeJson(const TStr& val) { + inline TString NormalizeJson(const TStr& val) { return AssertFromJson(val).ToJson(true); } @@ -38,12 +38,12 @@ namespace NSc { #define UNIT_ASSERT_JSON_EQ_JSON(A, B) UNIT_ASSERT_JSON_EQ_JSON_C(A, B, "") - inline TString DumpJson(const TValue& json) { + inline TString DumpJson(const TValue& json) { return NJson::CompactifyJson(json.ToJson(true), true, true); } // deprecated - inline TString DumpJsonVS(const TValue& expected, const TValue& fact) { + inline TString DumpJsonVS(const TValue& expected, const TValue& fact) { return DumpJson(expected) + "(expected) != (fact)" + DumpJson(fact); } diff --git a/library/cpp/sliding_window/sliding_window_ut.cpp b/library/cpp/sliding_window/sliding_window_ut.cpp index 1e7343a8d3d..bcba7d71de7 100644 --- a/library/cpp/sliding_window/sliding_window_ut.cpp +++ b/library/cpp/sliding_window/sliding_window_ut.cpp @@ -7,7 +7,7 @@ using namespace NSlidingWindow; Y_UNIT_TEST_SUITE(TSlidingWindowTest) { Y_UNIT_TEST(TestSlidingWindowMax) { TSlidingWindow<TMaxOperation<unsigned>> w(TDuration::Minutes(5), 5); - TInstant start = TInstant::MicroSeconds(TDuration::Hours(1).MicroSeconds()); + TInstant start = TInstant::MicroSeconds(TDuration::Hours(1).MicroSeconds()); TInstant now = start; w.Update(5, start); // ~ ~ ~ ~ 5 UNIT_ASSERT_VALUES_EQUAL(w.GetValue(), 5); // ^ @@ -48,7 +48,7 @@ Y_UNIT_TEST_SUITE(TSlidingWindowTest) { Y_UNIT_TEST(TestSlidingWindowMin) { TSlidingWindow<TMinOperation<unsigned>> w(TDuration::Minutes(5), 5); - TInstant start = TInstant::MicroSeconds(TDuration::Hours(1).MicroSeconds()); + TInstant start = TInstant::MicroSeconds(TDuration::Hours(1).MicroSeconds()); TInstant now = start; w.Update(5, start); // ~ ~ ~ ~ 5 UNIT_ASSERT_VALUES_EQUAL(w.GetValue(), 5); // ^ @@ -91,7 +91,7 @@ Y_UNIT_TEST_SUITE(TSlidingWindowTest) { TSlidingWindow<TSumOperation<unsigned>> w(TDuration::Minutes(5), 5); UNIT_ASSERT_VALUES_EQUAL(w.GetValue(), 0); // current sum - TInstant start = TInstant::MicroSeconds(TDuration::Hours(1).MicroSeconds()); + TInstant start = TInstant::MicroSeconds(TDuration::Hours(1).MicroSeconds()); TInstant now = start; w.Update(5, start); // 0 0 0 0 5 UNIT_ASSERT_VALUES_EQUAL(w.GetValue(), 5); // ^ diff --git a/library/cpp/sse/ut/test.cpp b/library/cpp/sse/ut/test.cpp index 33c999d284b..1aef06fa7a4 100644 --- a/library/cpp/sse/ut/test.cpp +++ b/library/cpp/sse/ut/test.cpp @@ -71,29 +71,29 @@ using uint64x2_t = std::array<ui64, 2>; using float32x4_t = std::array<float, 4>; using float64x2_t = std::array<double, 2>; -template <typename TVectorType> +template <typename TVectorType> struct TQType { - static TVectorType As(__m128i param) { - TVectorType value; + static TVectorType As(__m128i param) { + TVectorType value; _mm_storeu_si128((__m128i*)&value, param); return value; } - static TVectorType As(__m128 param) { - TVectorType value; + static TVectorType As(__m128 param) { + TVectorType value; _mm_storeu_ps((float*)&value, param); return value; } - static TVectorType As(__m128d param) { - TVectorType value; + static TVectorType As(__m128d param) { + TVectorType value; _mm_storeu_pd((double*)&value, param); return value; } }; #endif -template <typename TVectorType> +template <typename TVectorType> struct TFuncLoad; -template <typename TVectorType> +template <typename TVectorType> struct TFuncStore; template <> @@ -394,12 +394,12 @@ public: template <typename TElem, unsigned elemCount, typename TFunc, typename TElemFunc, - typename TOp, typename TVectorType = __m128i> + typename TOp, typename TVectorType = __m128i> void Test_mm_dualop(); template <typename TElem, unsigned elemCount, typename TFunc, typename TElemFunc, - typename TOp, typename TVectorType = __m128i> + typename TOp, typename TVectorType = __m128i> void Test_mm_dualcmp(); void Test_mm_or_si128(); @@ -421,7 +421,7 @@ public: void Test_mm_cmplt_epi32(); template <typename TElem, int elemCount, - typename TFunc, typename TOp, typename TVectorType> + typename TFunc, typename TOp, typename TVectorType> void Test_mm_setter_epiXX(); void Test_mm_set1_epi8(); void Test_mm_set1_epi16(); @@ -1068,7 +1068,7 @@ void TSSEEmulTest::Test_mm_unpackhi_epi64() { template <typename TElem, unsigned elemCount, typename TFunc, typename TElemFunc, - typename TOp, typename TVectorType> + typename TOp, typename TVectorType> void TSSEEmulTest::Test_mm_dualop() { char data1[16] = { '\xAA', '\x00', '\xFF', '\xCC', '\x11', '\x22', '\xBB', '\xAA', @@ -1079,14 +1079,14 @@ void TSSEEmulTest::Test_mm_dualop() { TElem* dataw1 = reinterpret_cast<TElem*>(&data1); TElem* dataw2 = reinterpret_cast<TElem*>(&data2); - TVectorType value1 = TFuncLoad<TVectorType>(&data1); - TVectorType value2 = TFuncLoad<TVectorType>(&data2); + TVectorType value1 = TFuncLoad<TVectorType>(&data1); + TVectorType value2 = TFuncLoad<TVectorType>(&data2); TElem procData[elemCount]; for (unsigned i = 0; i < elemCount; ++i) { procData[i] = TElemFunc::Call(dataw1[i], dataw2[i]); } - TVectorType result = TFunc(value1, value2); + TVectorType result = TFunc(value1, value2); for (unsigned i = 0; i < elemCount; ++i) { UNIT_ASSERT_EQUAL(procData[i], TQType<TOp>::As(result)[i]); @@ -1097,7 +1097,7 @@ void TSSEEmulTest::Test_mm_dualop() { but different data1 and data2 */ template <typename TElem, unsigned elemCount, typename TFunc, typename TElemFunc, - typename TOp, typename TVectorType> + typename TOp, typename TVectorType> void TSSEEmulTest::Test_mm_dualcmp() { char data1[16] = { '\xAA', '\x00', '\xFF', '\xCC', '\x11', '\x66', '\x77', '\xAA', @@ -1108,14 +1108,14 @@ void TSSEEmulTest::Test_mm_dualcmp() { TElem* dataw1 = reinterpret_cast<TElem*>(&data1); TElem* dataw2 = reinterpret_cast<TElem*>(&data2); - TVectorType value1 = TFuncLoad<TVectorType>(&data1); - TVectorType value2 = TFuncLoad<TVectorType>(&data2); + TVectorType value1 = TFuncLoad<TVectorType>(&data1); + TVectorType value2 = TFuncLoad<TVectorType>(&data2); TElem procData[elemCount]; for (unsigned i = 0; i < elemCount; ++i) { procData[i] = TElemFunc::Call(dataw1[i], dataw2[i]); } - TVectorType result = TFunc(value1, value2); + TVectorType result = TFunc(value1, value2); for (unsigned i = 0; i < elemCount; ++i) { /* memcmp is for compare to invalid floats in results */ @@ -1255,7 +1255,7 @@ void TSSEEmulTest::Test_mm_cmplt_epi32() { } template <typename TElem, int elemCount, - typename TFunc, typename TOp, typename TVectorType> + typename TFunc, typename TOp, typename TVectorType> void TSSEEmulTest::Test_mm_setter_epiXX() { char data[64] = { '\xAA', '\x00', '\xFF', '\xCC', '\x11', '\x22', '\xBB', '\xAA', @@ -1269,7 +1269,7 @@ void TSSEEmulTest::Test_mm_setter_epiXX() { TElem* dataw = reinterpret_cast<TElem*>(&data); for (unsigned dataItem = 0; dataItem < elemCount * 4; ++dataItem) { - TVectorType value = TFunc(dataw[dataItem]); + TVectorType value = TFunc(dataw[dataItem]); for (unsigned i = 0; i < elemCount; ++i) UNIT_ASSERT_EQUAL(dataw[dataItem], TQType<TOp>::As(value)[i]); diff --git a/library/cpp/streams/bzip2/bzip2.cpp b/library/cpp/streams/bzip2/bzip2.cpp index bccc5c68078..9121244e83f 100644 --- a/library/cpp/streams/bzip2/bzip2.cpp +++ b/library/cpp/streams/bzip2/bzip2.cpp @@ -14,7 +14,7 @@ public: Init(); } - inline ~TImpl() { + inline ~TImpl() { Clear(); } @@ -24,7 +24,7 @@ public: } } - inline void Clear() noexcept { + inline void Clear() noexcept { BZ2_bzDecompressEnd(&BzStream_); } @@ -79,7 +79,7 @@ TBZipDecompress::TBZipDecompress(IInputStream* input, size_t bufLen) { } -TBZipDecompress::~TBZipDecompress() { +TBZipDecompress::~TBZipDecompress() { } size_t TBZipDecompress::DoRead(void* buf, size_t size) { @@ -101,7 +101,7 @@ public: BzStream_.avail_out = TmpBufLen(); } - inline ~TImpl() { + inline ~TImpl() { BZ2_bzCompressEnd(&BzStream_); } @@ -156,11 +156,11 @@ public: } private: - inline char* TmpBuf() noexcept { + inline char* TmpBuf() noexcept { return (char*)AdditionalData(); } - inline size_t TmpBufLen() const noexcept { + inline size_t TmpBufLen() const noexcept { return AdditionalDataLength(); } @@ -174,7 +174,7 @@ TBZipCompress::TBZipCompress(IOutputStream* out, size_t compressionLevel, size_t { } -TBZipCompress::~TBZipCompress() { +TBZipCompress::~TBZipCompress() { try { Finish(); } catch (...) { diff --git a/library/cpp/streams/bzip2/bzip2.h b/library/cpp/streams/bzip2/bzip2.h index 2322277ef6f..07c88379974 100644 --- a/library/cpp/streams/bzip2/bzip2.h +++ b/library/cpp/streams/bzip2/bzip2.h @@ -25,7 +25,7 @@ class TBZipCompressError: public TBZipException { class TBZipDecompress: public IInputStream { public: TBZipDecompress(IInputStream* input, size_t bufLen = BZIP_BUF_LEN); - ~TBZipDecompress() override; + ~TBZipDecompress() override; private: size_t DoRead(void* buf, size_t size) override; @@ -38,7 +38,7 @@ private: class TBZipCompress: public IOutputStream { public: TBZipCompress(IOutputStream* out, size_t compressionLevel = BZIP_COMPRESSION_LEVEL, size_t bufLen = BZIP_BUF_LEN); - ~TBZipCompress() override; + ~TBZipCompress() override; private: void DoWrite(const void* buf, size_t size) override; diff --git a/library/cpp/streams/bzip2/bzip2_ut.cpp b/library/cpp/streams/bzip2/bzip2_ut.cpp index 69a98f296cd..4de72e8ad58 100644 --- a/library/cpp/streams/bzip2/bzip2_ut.cpp +++ b/library/cpp/streams/bzip2/bzip2_ut.cpp @@ -8,10 +8,10 @@ #define ZDATA "./zdata" Y_UNIT_TEST_SUITE(TBZipTest) { - static const TString data = "8s7d5vc6s5vc67sa4c65ascx6asd4xcv76adsfxv76s"; + static const TString data = "8s7d5vc6s5vc67sa4c65ascx6asd4xcv76adsfxv76s"; Y_UNIT_TEST(TestCompress) { - TUnbufferedFileOutput o(ZDATA); + TUnbufferedFileOutput o(ZDATA); TBZipCompress c(&o); c.Write(data.data(), data.size()); @@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(TBZipTest) { TTempFile tmp(ZDATA); { - TUnbufferedFileInput i(ZDATA); + TUnbufferedFileInput i(ZDATA); TBZipDecompress d(&i); UNIT_ASSERT_EQUAL(d.ReadLine(), data); diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp index b65bb3ed965..0ddeb2a6c26 100644 --- a/library/cpp/streams/lz/lz.cpp +++ b/library/cpp/streams/lz/lz.cpp @@ -15,11 +15,11 @@ #include <contrib/libs/quicklz/quicklz.h> #include <contrib/libs/minilzo/minilzo.h> -static inline ui8 HostToLittle(ui8 t) noexcept { +static inline ui8 HostToLittle(ui8 t) noexcept { return t; } -static inline ui8 LittleToHost(ui8 t) noexcept { +static inline ui8 LittleToHost(ui8 t) noexcept { return t; } @@ -53,7 +53,7 @@ public: this->Save(BlockSize()); } - inline ~TCompressorBase() { + inline ~TCompressorBase() { } inline void Write(const char* buf, size_t len) { @@ -88,11 +88,11 @@ public: } private: - inline void* Block() const noexcept { + inline void* Block() const noexcept { return this->AdditionalData(); } - inline ui16 BlockSize() const noexcept { + inline ui16 BlockSize() const noexcept { return BlockSize_; } @@ -200,7 +200,7 @@ public: this->InitFromStream(Slave_); } - inline ~TDecompressorBaseImpl() { + inline ~TDecompressorBaseImpl() { } inline size_t Read(void* buf, size_t len) { @@ -284,7 +284,7 @@ public: { } - inline ~TDecompressorBase() { + inline ~TDecompressorBase() { } }; @@ -373,16 +373,16 @@ public: Singleton<TInit>(); } - inline ~TMiniLzo() { + inline ~TMiniLzo() { } - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { // see SEARCH-2043 and, e.g. examples at // http://stackoverflow.com/questions/4235019/how-to-get-lzo-to-work-with-a-file-stream return len + (len / 16) + 64 + 3; } - static inline bool SaveIncompressibleChunks() noexcept { + static inline bool SaveIncompressibleChunks() noexcept { return false; } }; @@ -392,7 +392,7 @@ const char TMiniLzo::signature[] = "YLZO"; template <size_t N> class TFixedArray { public: - inline TFixedArray() noexcept { + inline TFixedArray() noexcept { memset(WorkMem_, 0, sizeof(WorkMem_)); } @@ -434,7 +434,7 @@ class TFastLZ { public: static const char signature[]; - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { return Max<size_t>((size_t)(len * 1.06), 100); } @@ -449,7 +449,7 @@ public: inline void InitFromStream(IInputStream*) const noexcept { } - static inline bool SaveIncompressibleChunks() noexcept { + static inline bool SaveIncompressibleChunks() noexcept { return false; } }; @@ -466,7 +466,7 @@ class TLZ4 { public: static const char signature[]; - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { return Max<size_t>((size_t)(len * 1.06), 100); } @@ -484,7 +484,7 @@ public: inline void InitFromStream(IInputStream*) const noexcept { } - static inline bool SaveIncompressibleChunks() noexcept { + static inline bool SaveIncompressibleChunks() noexcept { return false; } }; @@ -501,7 +501,7 @@ class TSnappy { public: static const char signature[]; - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { return Max<size_t>(snappy::MaxCompressedLength(len), 100); } @@ -521,7 +521,7 @@ public: inline void InitFromStream(IInputStream*) const noexcept { } - static inline bool SaveIncompressibleChunks() noexcept { + static inline bool SaveIncompressibleChunks() noexcept { return false; } }; @@ -538,7 +538,7 @@ class TQuickLZBase { public: static const char signature[]; - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { return len + 500; } @@ -560,7 +560,7 @@ public: memset(Mem_.Get(), 0, size); } - inline bool SaveIncompressibleChunks() const noexcept { + inline bool SaveIncompressibleChunks() const noexcept { // we must save incompressible chunks "as is" // after compressor run in streaming mode return Table_->Setting(3); @@ -621,14 +621,14 @@ DEF_DECOMPRESSOR(TLzqDecompress, TQuickLZDecompress) namespace { template <class T> struct TInputHolder { - static inline T Set(T t) noexcept { + static inline T Set(T t) noexcept { return t; } }; template <class T> struct TInputHolder<TAutoPtr<T>> { - inline T* Set(TAutoPtr<T> v) noexcept { + inline T* Set(TAutoPtr<T> v) noexcept { V_ = v; return V_.Get(); diff --git a/library/cpp/streams/lz/lz.h b/library/cpp/streams/lz/lz.h index 3a2eaad88b0..b2850cc2900 100644 --- a/library/cpp/streams/lz/lz.h +++ b/library/cpp/streams/lz/lz.h @@ -33,7 +33,7 @@ struct TDecompressorError: public yexception { class TLz4Compress: public IOutputStream { public: TLz4Compress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); - ~TLz4Compress() override; + ~TLz4Compress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -53,7 +53,7 @@ private: class TLz4Decompress: public IInputStream { public: TLz4Decompress(IInputStream* slave); - ~TLz4Decompress() override; + ~TLz4Decompress() override; private: size_t DoRead(void* buf, size_t len) override; @@ -71,7 +71,7 @@ private: class TSnappyCompress: public IOutputStream { public: TSnappyCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); - ~TSnappyCompress() override; + ~TSnappyCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -91,7 +91,7 @@ private: class TSnappyDecompress: public IInputStream { public: TSnappyDecompress(IInputStream* slave); - ~TSnappyDecompress() override; + ~TSnappyDecompress() override; private: size_t DoRead(void* buf, size_t len) override; @@ -107,7 +107,7 @@ private: class TLzoCompress: public IOutputStream { public: TLzoCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); - ~TLzoCompress() override; + ~TLzoCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -125,7 +125,7 @@ private: class TLzoDecompress: public IInputStream { public: TLzoDecompress(IInputStream* slave); - ~TLzoDecompress() override; + ~TLzoDecompress() override; private: size_t DoRead(void* buf, size_t len) override; @@ -141,7 +141,7 @@ private: class TLzfCompress: public IOutputStream { public: TLzfCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); - ~TLzfCompress() override; + ~TLzfCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -159,7 +159,7 @@ private: class TLzfDecompress: public IInputStream { public: TLzfDecompress(IInputStream* slave); - ~TLzfDecompress() override; + ~TLzfDecompress() override; private: size_t DoRead(void* buf, size_t len) override; @@ -193,7 +193,7 @@ public: EVersion ver = V_1_31, unsigned level = 0, EMode mode = M_0); - ~TLzqCompress() override; + ~TLzqCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -211,7 +211,7 @@ private: class TLzqDecompress: public IInputStream { public: TLzqDecompress(IInputStream* slave); - ~TLzqDecompress() override; + ~TLzqDecompress() override; private: size_t DoRead(void* buf, size_t len) override; diff --git a/library/cpp/streams/lz/lz_ut.cpp b/library/cpp/streams/lz/lz_ut.cpp index 6876f070fc0..04c53f5cb59 100644 --- a/library/cpp/streams/lz/lz_ut.cpp +++ b/library/cpp/streams/lz/lz_ut.cpp @@ -11,15 +11,15 @@ #define LDATA "./ldata" #define LDATA_RANDOM "./ldata.random" -static const TString data = "aa aaa aa aaa aa aaa bb bbb bb bbb bb bbb"; +static const TString data = "aa aaa aa aaa aa aaa bb bbb bb bbb bb bbb"; namespace { /** * Produces well-formed random crap **/ - TString RandomString(size_t size) { - TString entropy(NResource::Find("/random.data")); - TString result; + TString RandomString(size_t size) { + TString entropy(NResource::Find("/random.data")); + TString result; size_t seed = 1; size_t j = 0; for (size_t i = 0; i < size; ++i) { @@ -38,8 +38,8 @@ namespace { return result; } - TVector<TString> InitRandomData() { - static const TVector<size_t> sizes = { + TVector<TString> InitRandomData() { + static const TVector<size_t> sizes = { 0, 1, 127, @@ -47,7 +47,7 @@ namespace { 32767, }; - TVector<TString> result; + TVector<TString> result; for (auto size : sizes) { result.push_back(RandomString(size)); } @@ -55,18 +55,18 @@ namespace { return result; } - TString TestFileName(const TString& d, size_t bufferSize) { + TString TestFileName(const TString& d, size_t bufferSize) { return LDATA_RANDOM + TString(".") + ToString(d.size()) + TString(".") + ToString(bufferSize); } - struct TRandomData: public TVector<TString> { + struct TRandomData: public TVector<TString> { inline TRandomData() { InitRandomData().swap(*this); } }; } -static const TVector<size_t> bufferSizes = { +static const TVector<size_t> bufferSizes = { 127, 1024, 32768, @@ -84,10 +84,10 @@ namespace { template <class C> static inline void TestGoodDataCompress() { - TFixedBufferFileOutput o(LDATA); + TFixedBufferFileOutput o(LDATA); C c(&o, 1024); - TString d = data; + TString d = data; for (size_t i = 0; i < 10; ++i) { c.Write(d.data(), d.size()); @@ -100,9 +100,9 @@ static inline void TestGoodDataCompress() { } template <class C> -static inline void TestIncompressibleDataCompress(const TString& d, size_t bufferSize) { - TString testFileName = TestFileName(d, bufferSize); - TFixedBufferFileOutput o(testFileName); +static inline void TestIncompressibleDataCompress(const TString& d, size_t bufferSize) { + TString testFileName = TestFileName(d, bufferSize); + TFixedBufferFileOutput o(testFileName); C c(&o, bufferSize); c.Write(d.data(), d.size()); c.Finish(); @@ -124,12 +124,12 @@ static inline void TestGoodDataDecompress() { TTempFile tmpFile(LDATA); { - TFileInput i1(LDATA); - D ld(&i1); + TFileInput i1(LDATA); + D ld(&i1); - TString d = data; + TString d = data; - for (size_t i2 = 0; i2 < 10; ++i2) { + for (size_t i2 = 0; i2 < 10; ++i2) { UNIT_ASSERT_EQUAL(ld.ReadLine(), d); d = d + d; @@ -138,12 +138,12 @@ static inline void TestGoodDataDecompress() { } template <class D> -static inline void TestIncompressibleDataDecompress(const TString& d, size_t bufferSize) { - TString testFileName = TestFileName(d, bufferSize); +static inline void TestIncompressibleDataDecompress(const TString& d, size_t bufferSize) { + TString testFileName = TestFileName(d, bufferSize); TTempFile tmpFile(testFileName); { - TFileInput i(testFileName); + TFileInput i(testFileName); D ld(&i); UNIT_ASSERT_EQUAL(ld.ReadAll(), d); diff --git a/library/cpp/streams/lzma/lzma.cpp b/library/cpp/streams/lzma/lzma.cpp index f1942fa546e..34c4e50c843 100644 --- a/library/cpp/streams/lzma/lzma.cpp +++ b/library/cpp/streams/lzma/lzma.cpp @@ -31,7 +31,7 @@ namespace { return ret->AdditionalData(); } - inline void Deallocate(void* ptr) noexcept { + inline void Deallocate(void* ptr) noexcept { if (ptr) { delete TAllocation::ObjectFromData(ptr); } @@ -65,7 +65,7 @@ namespace { { } - ~TInput() override { + ~TInput() override { } size_t DoRead(void* ptr, size_t len) override { @@ -83,7 +83,7 @@ namespace { { } - ~TOutput() override { + ~TOutput() override { } void DoWrite(const void* ptr, size_t len) override { @@ -105,7 +105,7 @@ namespace { { } - virtual ~TInverseFilter() { + virtual ~TInverseFilter() { if (!UncaughtException()) { try { Finish(); @@ -277,7 +277,7 @@ namespace { TMemoryGc Gc_; }; - inline ISzAlloc* Alloc() noexcept { + inline ISzAlloc* Alloc() noexcept { return &Alloc_; } @@ -317,7 +317,7 @@ namespace { Check(LzmaEnc_WriteProperties(H_, PropsBuf_, &bufLen)); } - inline ~TLzmaCompressBase() { + inline ~TLzmaCompressBase() { LzmaEnc_Destroy(H_, Alloc(), Alloc()); } @@ -354,7 +354,7 @@ public: { LzmaDec_Construct(&H_); } - inline virtual ~TImpl() { + inline virtual ~TImpl() { LzmaDec_Free(&H_, Alloc()); } @@ -483,7 +483,7 @@ TLzmaCompress::TLzmaCompress(IOutputStream* slave, size_t level) { } -TLzmaCompress::~TLzmaCompress() { +TLzmaCompress::~TLzmaCompress() { } void TLzmaCompress::DoWrite(const void* buf, size_t len) { @@ -512,7 +512,7 @@ TLzmaDecompress::TLzmaDecompress(IZeroCopyInput* input) { } -TLzmaDecompress::~TLzmaDecompress() { +TLzmaDecompress::~TLzmaDecompress() { } size_t TLzmaDecompress::DoRead(void* buf, size_t len) { diff --git a/library/cpp/streams/lzma/lzma.h b/library/cpp/streams/lzma/lzma.h index ca1e06e9ef4..daf9dd66b9b 100644 --- a/library/cpp/streams/lzma/lzma.h +++ b/library/cpp/streams/lzma/lzma.h @@ -9,7 +9,7 @@ class TLzmaCompress: public IOutputStream { public: TLzmaCompress(IOutputStream* slave, size_t level = 7); - ~TLzmaCompress() override; + ~TLzmaCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -24,7 +24,7 @@ class TLzmaDecompress: public IInputStream { public: TLzmaDecompress(IInputStream* slave); TLzmaDecompress(IZeroCopyInput* input); - ~TLzmaDecompress() override; + ~TLzmaDecompress() override; private: size_t DoRead(void* buf, size_t len) override; diff --git a/library/cpp/streams/lzma/lzma_ut.cpp b/library/cpp/streams/lzma/lzma_ut.cpp index 847e98d1caa..907de209b56 100644 --- a/library/cpp/streams/lzma/lzma_ut.cpp +++ b/library/cpp/streams/lzma/lzma_ut.cpp @@ -8,7 +8,7 @@ class TStrokaByOneByte: public IZeroCopyInput { public: - TStrokaByOneByte(const TString& s) + TStrokaByOneByte(const TString& s) : Data(s) , Pos(s.data()) { @@ -26,7 +26,7 @@ private: } } - TString Data; + TString Data; const char* Pos; }; @@ -37,15 +37,15 @@ class TLzmaTest: public TTestBase { UNIT_TEST_SUITE_END(); private: - inline TString GenData() { - TString data; + inline TString GenData() { + TString data; TReallyFastRng32 rnd(RandomNumber<ui64>()); for (size_t i = 0; i < 50000; ++i) { const char ch = rnd.Uniform(256); const size_t len = 1 + rnd.Uniform(10); - data += TString(len, ch); + data += TString(len, ch); } return data; @@ -54,7 +54,7 @@ private: inline void Test2() { class TExcOutput: public IOutputStream { public: - ~TExcOutput() override { + ~TExcOutput() override { } void DoWrite(const void*, size_t) override { @@ -62,7 +62,7 @@ private: } }; - TString data(GenData()); + TString data(GenData()); TMemoryInput mi(data.data(), data.size()); TExcOutput out; @@ -76,9 +76,9 @@ private: } inline void Test1() { - TString data(GenData()); - TString data1; - TString res; + TString data(GenData()); + TString data1; + TString res; { TMemoryInput mi(data.data(), data.size()); diff --git a/library/cpp/string_utils/base64/base64.cpp b/library/cpp/string_utils/base64/base64.cpp index 05c201f0de7..d240f1c1128 100644 --- a/library/cpp/string_utils/base64/base64.cpp +++ b/library/cpp/string_utils/base64/base64.cpp @@ -245,13 +245,13 @@ size_t Base64Decode(void* dst, const char* b, const char* e) { return outLen; } -TString Base64DecodeUneven(const TStringBuf s) { +TString Base64DecodeUneven(const TStringBuf s) { if (s.length() % 4 == 0) { return Base64Decode(s); } // padding to 4 - return Base64Decode(TString(s) + TString(4 - (s.length() % 4), '=')); + return Base64Decode(TString(s) + TString(4 - (s.length() % 4), '=')); } char* Base64Encode(char* outstr, const unsigned char* instr, size_t len) { diff --git a/library/cpp/string_utils/base64/base64.h b/library/cpp/string_utils/base64/base64.h index f778a6425aa..6c6d2d9f084 100644 --- a/library/cpp/string_utils/base64/base64.h +++ b/library/cpp/string_utils/base64/base64.h @@ -27,14 +27,14 @@ inline TStringBuf Base64Decode(const TStringBuf src, void* dst) { return TStringBuf((const char*)dst, Base64Decode(dst, src.begin(), src.end())); } -inline void Base64Decode(const TStringBuf src, TString& dst) { +inline void Base64Decode(const TStringBuf src, TString& dst) { dst.ReserveAndResize(Base64DecodeBufSize(src.size())); dst.resize(Base64Decode(src, dst.begin()).size()); } //WARNING: can process not whole input silently, use Base64StrictDecode instead of this function -inline TString Base64Decode(const TStringBuf s) { - TString ret; +inline TString Base64Decode(const TStringBuf s) { + TString ret; Base64Decode(s, ret); return ret; } @@ -71,7 +71,7 @@ inline TStringBuf Base64StrictDecode(const TStringBuf src, void* dst) { /// @param src a base64 encoded string. /// @param dst a decoded string. /// -inline void Base64StrictDecode(const TStringBuf src, TString& dst) { +inline void Base64StrictDecode(const TStringBuf src, TString& dst) { dst.ReserveAndResize(Base64DecodeBufSize(src.size())); dst.resize(Base64StrictDecode(src, dst.begin()).size()); } @@ -81,15 +81,15 @@ inline void Base64StrictDecode(const TStringBuf src, TString& dst) { /// /// @returns a decoded string. /// -inline TString Base64StrictDecode(const TStringBuf src) { - TString ret; +inline TString Base64StrictDecode(const TStringBuf src) { + TString ret; Base64StrictDecode(src, ret); return ret; } /// @} /// Works with strings which length is not divisible by 4. -TString Base64DecodeUneven(const TStringBuf s); +TString Base64DecodeUneven(const TStringBuf s); //encode constexpr size_t Base64EncodeBufSize(const size_t len) noexcept { @@ -107,24 +107,24 @@ inline TStringBuf Base64EncodeUrl(const TStringBuf src, void* tmp) { return TStringBuf((const char*)tmp, Base64EncodeUrl((char*)tmp, (const unsigned char*)src.data(), src.size())); } -inline void Base64Encode(const TStringBuf src, TString& dst) { +inline void Base64Encode(const TStringBuf src, TString& dst) { dst.ReserveAndResize(Base64EncodeBufSize(src.size())); dst.resize(Base64Encode(src, dst.begin()).size()); } -inline void Base64EncodeUrl(const TStringBuf src, TString& dst) { +inline void Base64EncodeUrl(const TStringBuf src, TString& dst) { dst.ReserveAndResize(Base64EncodeBufSize(src.size())); dst.resize(Base64EncodeUrl(src, dst.begin()).size()); } -inline TString Base64Encode(const TStringBuf s) { - TString ret; +inline TString Base64Encode(const TStringBuf s) { + TString ret; Base64Encode(s, ret); return ret; } -inline TString Base64EncodeUrl(const TStringBuf s) { - TString ret; +inline TString Base64EncodeUrl(const TStringBuf s) { + TString ret; Base64EncodeUrl(s, ret); return ret; } diff --git a/library/cpp/string_utils/base64/base64_decode_uneven_ut.cpp b/library/cpp/string_utils/base64/base64_decode_uneven_ut.cpp index c3ed068a37e..ae665091e75 100644 --- a/library/cpp/string_utils/base64/base64_decode_uneven_ut.cpp +++ b/library/cpp/string_utils/base64/base64_decode_uneven_ut.cpp @@ -2,45 +2,45 @@ #include <library/cpp/string_utils/base64/base64.h> -Y_UNIT_TEST_SUITE(TBase64DecodeUneven) { - Y_UNIT_TEST(Base64DecodeUneven) { - const TString wikipedia_slogan = - "Man is distinguished, not only by his reason, " - "but by this singular passion from other animals, which is a lust of the " - "mind, that by a perseverance of delight in the continued and " - "indefatigable generation of knowledge, exceeds the short " - "vehemence of any carnal pleasure."; - const TString encoded = - "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0" - "aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1" - "c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0" - "aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdl" - "LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4="; +Y_UNIT_TEST_SUITE(TBase64DecodeUneven) { + Y_UNIT_TEST(Base64DecodeUneven) { + const TString wikipedia_slogan = + "Man is distinguished, not only by his reason, " + "but by this singular passion from other animals, which is a lust of the " + "mind, that by a perseverance of delight in the continued and " + "indefatigable generation of knowledge, exceeds the short " + "vehemence of any carnal pleasure."; + const TString encoded = + "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0" + "aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1" + "c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0" + "aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdl" + "LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4="; - UNIT_ASSERT_VALUES_EQUAL(encoded, Base64Encode(wikipedia_slogan)); - UNIT_ASSERT_VALUES_EQUAL(wikipedia_slogan, Base64DecodeUneven(encoded)); + UNIT_ASSERT_VALUES_EQUAL(encoded, Base64Encode(wikipedia_slogan)); + UNIT_ASSERT_VALUES_EQUAL(wikipedia_slogan, Base64DecodeUneven(encoded)); - const TString encoded_url1 = - "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0" - "aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1" - "c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0" - "aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdl" - "LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4,"; - const TString encoded_url2 = - "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0" - "aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1" - "c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0" - "aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdl" - "LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4"; - UNIT_ASSERT_VALUES_EQUAL(wikipedia_slogan, Base64DecodeUneven(encoded_url1)); - UNIT_ASSERT_VALUES_EQUAL(wikipedia_slogan, Base64DecodeUneven(encoded_url2)); + const TString encoded_url1 = + "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0" + "aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1" + "c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0" + "aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdl" + "LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4,"; + const TString encoded_url2 = + "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0" + "aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1" + "c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0" + "aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdl" + "LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4"; + UNIT_ASSERT_VALUES_EQUAL(wikipedia_slogan, Base64DecodeUneven(encoded_url1)); + UNIT_ASSERT_VALUES_EQUAL(wikipedia_slogan, Base64DecodeUneven(encoded_url2)); - const TString lp = "Linkin Park"; - UNIT_ASSERT_VALUES_EQUAL(lp, Base64DecodeUneven(Base64Encode(lp))); - UNIT_ASSERT_VALUES_EQUAL(lp, Base64DecodeUneven(Base64EncodeUrl(lp))); + const TString lp = "Linkin Park"; + UNIT_ASSERT_VALUES_EQUAL(lp, Base64DecodeUneven(Base64Encode(lp))); + UNIT_ASSERT_VALUES_EQUAL(lp, Base64DecodeUneven(Base64EncodeUrl(lp))); - const TString dp = "ADP GmbH\nAnalyse Design & Programmierung\nGesellschaft mit beschränkter Haftung"; - UNIT_ASSERT_VALUES_EQUAL(dp, Base64DecodeUneven(Base64Encode(dp))); - UNIT_ASSERT_VALUES_EQUAL(dp, Base64DecodeUneven(Base64EncodeUrl(dp))); + const TString dp = "ADP GmbH\nAnalyse Design & Programmierung\nGesellschaft mit beschränkter Haftung"; + UNIT_ASSERT_VALUES_EQUAL(dp, Base64DecodeUneven(Base64Encode(dp))); + UNIT_ASSERT_VALUES_EQUAL(dp, Base64DecodeUneven(Base64EncodeUrl(dp))); } } diff --git a/library/cpp/string_utils/base64/base64_ut.cpp b/library/cpp/string_utils/base64/base64_ut.cpp index bcc1e658791..4ba3cc6eb6b 100644 --- a/library/cpp/string_utils/base64/base64_ut.cpp +++ b/library/cpp/string_utils/base64/base64_ut.cpp @@ -94,8 +94,8 @@ namespace NB64Etalon { MAX_IMPL }; - using TEncodeF = void (*)(const TStringBuf&, TString&); - using TDecodeF = void (*)(const TStringBuf&, TString&); + using TEncodeF = void (*)(const TStringBuf&, TString&); + using TDecodeF = void (*)(const TStringBuf&, TString&); struct TImpl { TEncodeF Encode = nullptr; @@ -163,8 +163,8 @@ void Out<NB64Etalon::TImpls::EImpl>(IOutputStream& o, typename TTypeTraits<NB64E } } -static void TestEncodeDecodeIntoString(const TString& plain, const TString& encoded, const TString& encodedUrl) { - TString a, b; +static void TestEncodeDecodeIntoString(const TString& plain, const TString& encoded, const TString& encodedUrl) { + TString a, b; Base64Encode(plain, a); UNIT_ASSERT_VALUES_EQUAL(a, encoded); @@ -179,8 +179,8 @@ static void TestEncodeDecodeIntoString(const TString& plain, const TString& enco UNIT_ASSERT_VALUES_EQUAL(b, plain); } -static void TestEncodeStrictDecodeIntoString(const TString& plain, const TString& encoded, const TString& encodedUrl) { - TString a, b; +static void TestEncodeStrictDecodeIntoString(const TString& plain, const TString& encoded, const TString& encodedUrl) { + TString a, b; Base64Encode(plain, a); UNIT_ASSERT_VALUES_EQUAL(a, encoded); @@ -205,11 +205,11 @@ Y_UNIT_TEST_SUITE(TBase64) { Y_UNIT_TEST(TestIntoString) { { - TString str; + TString str; for (size_t i = 0; i < 256; ++i) str += char(i); - const TString base64 = + const TString base64 = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJy" "gpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9Q" "UVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eH" @@ -217,7 +217,7 @@ Y_UNIT_TEST_SUITE(TBase64) { "oqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIyc" "rLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy" "8/T19vf4+fr7/P3+/w=="; - const TString base64Url = + const TString base64Url = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJy" "gpKissLS4vMDEyMzQ1Njc4OTo7PD0-P0BBQkNERUZHSElKS0xNTk9Q" "UVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eH" @@ -231,10 +231,10 @@ Y_UNIT_TEST_SUITE(TBase64) { } { - const TString str = "http://yandex.ru:1234/request?param=value&lll=fff#fragment"; + const TString str = "http://yandex.ru:1234/request?param=value&lll=fff#fragment"; - const TString base64 = "aHR0cDovL3lhbmRleC5ydToxMjM0L3JlcXVlc3Q/cGFyYW09dmFsdWUmbGxsPWZmZiNmcmFnbWVudA=="; - const TString base64Url = "aHR0cDovL3lhbmRleC5ydToxMjM0L3JlcXVlc3Q_cGFyYW09dmFsdWUmbGxsPWZmZiNmcmFnbWVudA,,"; + const TString base64 = "aHR0cDovL3lhbmRleC5ydToxMjM0L3JlcXVlc3Q/cGFyYW09dmFsdWUmbGxsPWZmZiNmcmFnbWVudA=="; + const TString base64Url = "aHR0cDovL3lhbmRleC5ydToxMjM0L3JlcXVlc3Q_cGFyYW09dmFsdWUmbGxsPWZmZiNmcmFnbWVudA,,"; TestEncodeDecodeIntoString(str, base64, base64Url); TestEncodeStrictDecodeIntoString(str, base64, base64Url); @@ -286,94 +286,94 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestDecodeRandom) { - TString input; + TString input; constexpr size_t testSize = 240000; for (size_t i = 0; i < testSize; ++i) { input.push_back(rand() % 256); } - TString output; - TString encoded = Base64Encode(input); + TString output; + TString encoded = Base64Encode(input); UNIT_ASSERT_VALUES_EQUAL(Base64Decode(encoded), input); UNIT_ASSERT_VALUES_EQUAL(Base64StrictDecode(encoded), input); } Y_UNIT_TEST(TestAllPossibleOctets) { const TString x("\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F"sv); - const TString xEnc = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn8="; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn8="; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } Y_UNIT_TEST(TestTwoPaddingCharacters) { const TString x("a"); - const TString xEnc = "YQ=="; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = "YQ=="; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } Y_UNIT_TEST(TestOnePaddingCharacter) { const TString x("aa"); - const TString xEnc = "YWE="; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = "YWE="; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } Y_UNIT_TEST(TestNoPaddingCharacters) { const TString x("aaa"); - const TString xEnc = "YWFh"; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = "YWFh"; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } Y_UNIT_TEST(TestTrailingZero) { const TString x("foo\0"sv); - const TString xEnc = "Zm9vAA=="; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = "Zm9vAA=="; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } Y_UNIT_TEST(TestTwoTrailingZeroes) { const TString x("foo\0\0"sv); - const TString xEnc = "Zm9vAAA="; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = "Zm9vAAA="; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } Y_UNIT_TEST(TestZero) { const TString x("\0"sv); - const TString xEnc = "AA=="; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = "AA=="; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } Y_UNIT_TEST(TestSymbolsAfterZero) { const TString x("\0a"sv); - const TString xEnc = "AGE="; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = "AGE="; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } Y_UNIT_TEST(TestEmptyString) { const TString x = ""; - const TString xEnc = ""; - const TString y = Base64Decode(xEnc); - const TString yEnc = Base64Encode(x); + const TString xEnc = ""; + const TString y = Base64Decode(xEnc); + const TString yEnc = Base64Encode(x); UNIT_ASSERT_VALUES_EQUAL(x, y); UNIT_ASSERT_VALUES_EQUAL(xEnc, yEnc); } @@ -382,11 +382,11 @@ Y_UNIT_TEST_SUITE(TBase64) { constexpr size_t TEST_CASES_COUNT = 1000; constexpr size_t MAX_DATA_SIZE = 1000; TFastRng<ui32> prng{42}; - TVector<TString> xs{TEST_CASES_COUNT}; - TString xEnc; - TString xDec; - TString yEnc; - TString yDec; + TVector<TString> xs{TEST_CASES_COUNT}; + TString xEnc; + TString xDec; + TString yEnc; + TString yDec; for (auto& x : xs) { const size_t size = prng() % MAX_DATA_SIZE; @@ -426,8 +426,8 @@ Y_UNIT_TEST_SUITE(TBase64) { constexpr size_t TEST_CASES_COUNT = 1000; constexpr size_t MAX_DATA_SIZE = 1000; TFastRng<ui32> prng{42}; - TString x; - TVector<char> buf; + TString x; + TVector<char> buf; for (size_t i = 0; i < TEST_CASES_COUNT; ++i) { const size_t size = prng() % MAX_DATA_SIZE; x.clear(); diff --git a/library/cpp/string_utils/base64/bench/main.cpp b/library/cpp/string_utils/base64/bench/main.cpp index 10e09bc1c75..2b371cd3f10 100644 --- a/library/cpp/string_utils/base64/bench/main.cpp +++ b/library/cpp/string_utils/base64/bench/main.cpp @@ -4,7 +4,7 @@ #include <util/generic/buffer.h> #include <util/generic/singleton.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/xrange.h> #include <util/generic/yexception.h> @@ -12,9 +12,9 @@ #include <array> -static TString GenerateRandomData(const size_t minSize, const size_t maxSize) { +static TString GenerateRandomData(const size_t minSize, const size_t maxSize) { Y_ENSURE(minSize <= maxSize, "wow"); - TString r; + TString r; for (size_t i = 0; i < minSize; ++i) { r.push_back(RandomNumber<char>()); } @@ -32,8 +32,8 @@ static TString GenerateRandomData(const size_t minSize, const size_t maxSize) { } template <size_t N> -static std::array<TString, N> GenerateRandomDataVector(const size_t minSize, const size_t maxSize) { - std::array<TString, N> r; +static std::array<TString, N> GenerateRandomDataVector(const size_t minSize, const size_t maxSize) { + std::array<TString, N> r; for (size_t i = 0; i < N; ++i) { r[i] = GenerateRandomData(minSize, maxSize); } @@ -42,8 +42,8 @@ static std::array<TString, N> GenerateRandomDataVector(const size_t minSize, con } template <size_t N> -static std::array<TString, N> Encode(const std::array<TString, N>& d) { - std::array<TString, N> r; +static std::array<TString, N> Encode(const std::array<TString, N>& d) { + std::array<TString, N> r; for (size_t i = 0, iEnd = d.size(); i < iEnd; ++i) { r[i] = Base64Encode(d[i]); } @@ -67,8 +67,8 @@ namespace { } static constexpr size_t Size = N; - const std::array<TString, N> Data; - const std::array<TString, N> DataEncoded; + const std::array<TString, N> Data; + const std::array<TString, N> DataEncoded; std::array<TBuffer, N> PlaceToEncode; std::array<TBuffer, N> PlaceToDecode; }; diff --git a/library/cpp/string_utils/base64/ut/ya.make b/library/cpp/string_utils/base64/ut/ya.make index 9b61241f0e5..ec02357f0ab 100644 --- a/library/cpp/string_utils/base64/ut/ya.make +++ b/library/cpp/string_utils/base64/ut/ya.make @@ -7,7 +7,7 @@ UNITTEST_FOR(library/cpp/string_utils/base64) SRCS( base64_ut.cpp - base64_decode_uneven_ut.cpp + base64_decode_uneven_ut.cpp ) PEERDIR( diff --git a/library/cpp/string_utils/indent_text/indent_text.cpp b/library/cpp/string_utils/indent_text/indent_text.cpp index 09a4f6bca84..8b878aef65b 100644 --- a/library/cpp/string_utils/indent_text/indent_text.cpp +++ b/library/cpp/string_utils/indent_text/indent_text.cpp @@ -2,9 +2,9 @@ #include <util/stream/str.h> -TString IndentText(TStringBuf text, TStringBuf indent) { +TString IndentText(TStringBuf text, TStringBuf indent) { if (text.empty()) - return TString(); + return TString(); TStringStream ss; ss.Reserve(text.size() + 20); diff --git a/library/cpp/string_utils/indent_text/indent_text.h b/library/cpp/string_utils/indent_text/indent_text.h index 7117d6c0ee6..f5ececcf803 100644 --- a/library/cpp/string_utils/indent_text/indent_text.h +++ b/library/cpp/string_utils/indent_text/indent_text.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> TString IndentText(TStringBuf text, TStringBuf indent = TStringBuf(" ")); diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h index 8a240bfed8f..9208276b70f 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h +++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h @@ -39,7 +39,7 @@ namespace NLevenshtein { } } - using TEditChain = TVector<EEditMoveType>; + using TEditChain = TVector<EEditMoveType>; template <typename TArgType> struct TWeightOneUnaryGetter { @@ -139,7 +139,7 @@ namespace NLevenshtein { } } - template <class TStringType> + template <class TStringType> size_t Distance(const TStringType& str1, const TStringType& str2) { TEditChain editChain; GetEditChain(str1, str2, editChain); @@ -170,8 +170,8 @@ namespace NLevenshtein { } }; - template <class TStringType> - void GetStringReplacements(const TStringType& str1, const TStringType& str2, TVector<TReplacement>& res) { + template <class TStringType> + void GetStringReplacements(const TStringType& str1, const TStringType& str2, TVector<TReplacement>& res) { TEditChain editChain; GetEditChain(str1, str2, editChain); editChain.push_back(EMT_SPECIAL); diff --git a/library/cpp/string_utils/parse_size/parse_size_ut.cpp b/library/cpp/string_utils/parse_size/parse_size_ut.cpp index 8fff4f56b28..ebf0b55e4ff 100644 --- a/library/cpp/string_utils/parse_size/parse_size_ut.cpp +++ b/library/cpp/string_utils/parse_size/parse_size_ut.cpp @@ -56,7 +56,7 @@ private: } void TestToString() { - UNIT_ASSERT_VALUES_EQUAL(ToString(FromKiloBytes(1)), TString("1024")); + UNIT_ASSERT_VALUES_EQUAL(ToString(FromKiloBytes(1)), TString("1024")); } }; diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp index e523350b80a..9350765b010 100644 --- a/library/cpp/string_utils/quote/quote.cpp +++ b/library/cpp/string_utils/quote/quote.cpp @@ -1,8 +1,8 @@ #include "quote.h" #include <util/memory/tempbuf.h> -#include <util/string/ascii.h> -#include <util/string/cstriter.h> +#include <util/string/ascii.h> +#include <util/string/cstriter.h> #include <cctype> @@ -14,14 +14,14 @@ ++x; \ } while (0) -#define GETSBXC \ - do { \ - c *= 16; \ - c += (x[0] >= 'A' ? ((x[0] & 0xdf) - 'A') + 10 : (x[0] - '0')); \ - x.Skip(1); \ - } while (0) - - +#define GETSBXC \ + do { \ + c *= 16; \ + c += (x[0] >= 'A' ? ((x[0] & 0xdf) - 'A') + 10 : (x[0] - '0')); \ + x.Skip(1); \ + } while (0) + + namespace { class TFromHexZeroTerm { public: @@ -40,8 +40,8 @@ namespace { return '%'; ui8 c = 0; - GETSBXC; - GETSBXC; + GETSBXC; + GETSBXC; return c; } }; @@ -68,7 +68,7 @@ static inline char d2x(unsigned x) { return (char)((x < 10) ? ('0' + x) : ('A' + x - 10)); } -static inline const char* FixZero(const char* s) noexcept { +static inline const char* FixZero(const char* s) noexcept { return s ? s : ""; } @@ -155,15 +155,15 @@ char* CGIEscape(char* to, const char* from, size_t len) { return Escape(to, from, from + len); } -void CGIEscape(TString& url) { +void CGIEscape(TString& url) { TTempBuf tempBuf(CgiEscapeBufLen(url.size())); char* to = tempBuf.Data(); url.AssignNoAlias(to, CGIEscape(to, url.data(), url.size())); } -TString CGIEscapeRet(const TStringBuf url) { - TString to; +TString CGIEscapeRet(const TStringBuf url) { + TString to; to.ReserveAndResize(CgiEscapeBufLen(url.size())); to.resize(CGIEscape(to.begin(), url.data(), url.size()) - to.data()); return to; @@ -207,7 +207,7 @@ char* Quote(char* to, const TStringBuf s, const char* safe) { return Quote(to, s.data(), s.data() + s.size(), safe); } -void Quote(TString& url, const char* safe) { +void Quote(TString& url, const char* safe) { TTempBuf tempBuf(CgiEscapeBufLen(url.size())); char* to = tempBuf.Data(); @@ -222,7 +222,7 @@ char* CGIUnescape(char* to, const char* from, size_t len) { return Unescape(to, from, from + len, TFromHexLenLimited(from + len)); } -void CGIUnescape(TString& url) { +void CGIUnescape(TString& url) { if (url.empty()) { return; } @@ -235,8 +235,8 @@ void CGIUnescape(TString& url) { } } -TString CGIUnescapeRet(const TStringBuf from) { - TString to; +TString CGIUnescapeRet(const TStringBuf from) { + TString to; to.ReserveAndResize(CgiUnescapeBufLen(from.size())); to.resize(CGIUnescape(to.begin(), from.data(), from.size()) - to.data()); return to; @@ -245,7 +245,7 @@ TString CGIUnescapeRet(const TStringBuf from) { char* UrlUnescape(char* to, TStringBuf from) { while (!from.empty()) { char ch = from[0]; - from.Skip(1); + from.Skip(1); if ('%' == ch && 2 <= from.length()) ch = TFromHexZeroTerm::x2c(from); *to++ = ch; @@ -256,7 +256,7 @@ char* UrlUnescape(char* to, TStringBuf from) { return to; } -void UrlUnescape(TString& url) { +void UrlUnescape(TString& url) { if (url.empty()) { return; } @@ -269,8 +269,8 @@ void UrlUnescape(TString& url) { } } -TString UrlUnescapeRet(const TStringBuf from) { - TString to; +TString UrlUnescapeRet(const TStringBuf from) { + TString to; to.ReserveAndResize(CgiUnescapeBufLen(from.size())); to.resize(UrlUnescape(to.begin(), from) - to.data()); return to; diff --git a/library/cpp/string_utils/quote/quote.h b/library/cpp/string_utils/quote/quote.h index 3b7221154eb..605a5cd858f 100644 --- a/library/cpp/string_utils/quote/quote.h +++ b/library/cpp/string_utils/quote/quote.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> //CGIEscape*: // ' ' converted to '+', @@ -13,8 +13,8 @@ char* CGIEscape(char* to, const char* from, size_t len); inline char* CGIEscape(char* to, const TStringBuf from) { return CGIEscape(to, from.data(), from.size()); } -void CGIEscape(TString& url); -TString CGIEscapeRet(const TStringBuf url); +void CGIEscape(TString& url); +TString CGIEscapeRet(const TStringBuf url); TString& AppendCgiEscaped(const TStringBuf value, TString& to); inline TStringBuf CgiEscapeBuf(char* to, const TStringBuf from) { @@ -30,8 +30,8 @@ inline TStringBuf CgiEscape(void* tmp, const TStringBuf s) { // If pointer returned, then this is pointer to the end of the result string. char* CGIUnescape(char* to, const char* from); char* CGIUnescape(char* to, const char* from, size_t len); -void CGIUnescape(TString& url); -TString CGIUnescapeRet(const TStringBuf from); +void CGIUnescape(TString& url); +TString CGIUnescapeRet(const TStringBuf from); inline TStringBuf CgiUnescapeBuf(char* to, const TStringBuf from) { return TStringBuf(to, CGIUnescape(to, from.data(), from.size())); @@ -44,13 +44,13 @@ inline TStringBuf CgiUnescape(void* tmp, const TStringBuf s) { // Is like CGIEscape, also skips encoding of user-supplied 'safe' characters. char* Quote(char* to, const char* from, const char* safe = "/"); char* Quote(char* to, const TStringBuf s, const char* safe = "/"); -void Quote(TString& url, const char* safe = "/"); +void Quote(TString& url, const char* safe = "/"); //UrlEscape: // Can't be used for cgi parameters ('&' character is not escaped)! // escapes only '%' not followed by two hex-digits or if forceEscape set to ture, // and chars outside [32, 126] range. -// Can't handle '\0'-chars in TString. +// Can't handle '\0'-chars in TString. char* UrlEscape(char* to, const char* from, bool forceEscape = false); void UrlEscape(TString& url, bool forceEscape = false); TString UrlEscapeRet(const TStringBuf from, bool forceEscape = false); @@ -59,8 +59,8 @@ TString UrlEscapeRet(const TStringBuf from, bool forceEscape = false); // '+' is NOT converted to space! // %xx converted to bytes, other characters are copied unchanged. char* UrlUnescape(char* to, TStringBuf from); -void UrlUnescape(TString& url); -TString UrlUnescapeRet(const TStringBuf from); +void UrlUnescape(TString& url); +TString UrlUnescapeRet(const TStringBuf from); //*BufLen: how much characters you should allocate for 'char* to' buffers. constexpr size_t CgiEscapeBufLen(const size_t len) noexcept { diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp index 6c552b279e1..46015c80468 100644 --- a/library/cpp/string_utils/quote/quote_ut.cpp +++ b/library/cpp/string_utils/quote/quote_ut.cpp @@ -14,7 +14,7 @@ Y_UNIT_TEST_SUITE(TCGIEscapeTest) { char r[] = {'1', '2', '3', '4'}; char buf[sizeof(r) * 3 + 2]; - TString ret(buf, CGIEscape(buf, r, sizeof(r))); + TString ret(buf, CGIEscape(buf, r, sizeof(r))); UNIT_ASSERT_EQUAL(ret, "1234"); } @@ -125,7 +125,7 @@ Y_UNIT_TEST_SUITE(TCGIUnescapeTest) { } Y_UNIT_TEST(StrokaOutParameterInplace) { - TString s; + TString s; s = "hello%3dworld"; CGIUnescape(s); @@ -149,7 +149,7 @@ Y_UNIT_TEST_SUITE(TCGIUnescapeTest) { } Y_UNIT_TEST(StrokaOutParameterNotInplace) { - TString s, sCopy; + TString s, sCopy; s = "hello%3dworld"; sCopy = s; @@ -232,7 +232,7 @@ Y_UNIT_TEST_SUITE(TUrlEscapeTest) { Y_UNIT_TEST_SUITE(TUrlUnescapeTest) { Y_UNIT_TEST(StrokaOutParameterInplace) { - TString s; + TString s; s = "hello%3dworld"; UrlUnescape(s); @@ -256,7 +256,7 @@ Y_UNIT_TEST_SUITE(TUrlUnescapeTest) { } Y_UNIT_TEST(StrokaOutParameterNotInplace) { - TString s, sCopy; + TString s, sCopy; s = "hello%3dworld"; sCopy = s; @@ -297,7 +297,7 @@ Y_UNIT_TEST_SUITE(TQuoteTest) { char r[100]; Quote(r, "/path;tail/path,tail/"); UNIT_ASSERT_VALUES_EQUAL("/path%3Btail/path%2Ctail/", r); - TString s("/path;tail/path,tail/"); + TString s("/path;tail/path,tail/"); Quote(s); UNIT_ASSERT_VALUES_EQUAL("/path%3Btail/path%2Ctail/", s.c_str()); } @@ -306,7 +306,7 @@ Y_UNIT_TEST_SUITE(TQuoteTest) { char r[100]; Quote(r, "/path;tail/path,tail/", ";,"); UNIT_ASSERT_VALUES_EQUAL("%2Fpath;tail%2Fpath,tail%2F", r); - TString s("/path;tail/path,tail/"); + TString s("/path;tail/path,tail/"); Quote(s, ";,"); UNIT_ASSERT_VALUES_EQUAL("%2Fpath;tail%2Fpath,tail%2F", s.c_str()); } diff --git a/library/cpp/string_utils/quote/ut/ya.make b/library/cpp/string_utils/quote/ut/ya.make index eca955144ff..50a6c0d85bd 100644 --- a/library/cpp/string_utils/quote/ut/ya.make +++ b/library/cpp/string_utils/quote/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/string_utils/quote) - -OWNER(vladon) - -SRCS( - quote_ut.cpp -) - -END() + +OWNER(vladon) + +SRCS( + quote_ut.cpp +) + +END() diff --git a/library/cpp/string_utils/quote/ya.make b/library/cpp/string_utils/quote/ya.make index 55bb3cf939b..d48130fe240 100644 --- a/library/cpp/string_utils/quote/ya.make +++ b/library/cpp/string_utils/quote/ya.make @@ -1,10 +1,10 @@ -LIBRARY() - -OWNER(g:util) - -SRCS( - quote.cpp - quote.h -) - -END() +LIBRARY() + +OWNER(g:util) + +SRCS( + quote.cpp + quote.h +) + +END() diff --git a/library/cpp/string_utils/relaxed_escaper/relaxed_escaper.h b/library/cpp/string_utils/relaxed_escaper/relaxed_escaper.h index d7ea7c12596..7c45f50c9bf 100644 --- a/library/cpp/string_utils/relaxed_escaper/relaxed_escaper.h +++ b/library/cpp/string_utils/relaxed_escaper/relaxed_escaper.h @@ -165,7 +165,7 @@ namespace NEscJ { } template <bool quote, bool tounicode> - inline void EscapeJ(TStringBuf in, TString& out, TStringBuf safe = TStringBuf(), TStringBuf unsafe = TStringBuf()) { + inline void EscapeJ(TStringBuf in, TString& out, TStringBuf safe = TStringBuf(), TStringBuf unsafe = TStringBuf()) { TTempBuf b(SuggestBuffer(in.size()) + 2); if (quote) @@ -180,8 +180,8 @@ namespace NEscJ { } template <bool quote, bool tounicode> - inline TString EscapeJ(TStringBuf in, TStringBuf safe = TStringBuf(), TStringBuf unsafe = TStringBuf()) { - TString s; + inline TString EscapeJ(TStringBuf in, TStringBuf safe = TStringBuf(), TStringBuf unsafe = TStringBuf()) { + TString s; EscapeJ<quote, tounicode>(in, s, safe, unsafe); return s; } @@ -197,12 +197,12 @@ namespace NEscJ { } template <bool quote> - inline void EscapeJ(TStringBuf in, TString& out, TStringBuf safe = TStringBuf(), TStringBuf unsafe = TStringBuf()) { + inline void EscapeJ(TStringBuf in, TString& out, TStringBuf safe = TStringBuf(), TStringBuf unsafe = TStringBuf()) { EscapeJ<quote, false>(in, out, safe, unsafe); } template <bool quote> - inline TString EscapeJ(TStringBuf in, TStringBuf safe = TStringBuf(), TStringBuf unsafe = TStringBuf()) { + inline TString EscapeJ(TStringBuf in, TStringBuf safe = TStringBuf(), TStringBuf unsafe = TStringBuf()) { return EscapeJ<quote, false>(in, safe, unsafe); } } diff --git a/library/cpp/string_utils/relaxed_escaper/relaxed_escaper_ut.cpp b/library/cpp/string_utils/relaxed_escaper/relaxed_escaper_ut.cpp index 768555ea3ae..a54c5a01086 100644 --- a/library/cpp/string_utils/relaxed_escaper/relaxed_escaper_ut.cpp +++ b/library/cpp/string_utils/relaxed_escaper/relaxed_escaper_ut.cpp @@ -31,15 +31,15 @@ Y_UNIT_TEST_SUITE(TRelaxedEscaperTest) { for (size_t i = 0; i < Y_ARRAY_SIZE(CommonTestData); i += 2) { TString expected(CommonTestData[i].data(), CommonTestData[i].size()); TString source(CommonTestData[i + 1].data(), CommonTestData[i + 1].size()); - TString actual(EscapeJ<false>(source)); - TString actual2(UnescapeC(expected)); + TString actual(EscapeJ<false>(source)); + TString actual2(UnescapeC(expected)); UNIT_ASSERT_VALUES_EQUAL(expected, actual); UNIT_ASSERT_VALUES_EQUAL(source, actual2); } UNIT_ASSERT_VALUES_EQUAL("http://ya.ru/\\x17\\n\xAB", EscapeJ<false>("http://ya.ru/\x17\n\xab")); - TString s = EscapeJ<false, true>("http://ya.ru/\x17\n\xab\xff"); + TString s = EscapeJ<false, true>("http://ya.ru/\x17\n\xab\xff"); UNIT_ASSERT_VALUES_EQUAL("http://ya.ru/\\u0017\\n\xAB\\xFF", s); UNIT_ASSERT_VALUES_EQUAL("http://ya.ru/\\x17\n\xAB", EscapeJ<false>("http://ya.ru/\x17\n\xab", "\n")); UNIT_ASSERT_VALUES_EQUAL("http:\\x2F\\x2Fya.ru\\x2F\\x17\n\xAB'", EscapeJ<false>("http://ya.ru/\x17\n\xab'", "\n'", "/")); diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d693..3bdf137598c 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -1,11 +1,11 @@ #include "url.h" -#include <util/string/cast.h> -#include <util/string/util.h> -#include <util/string/cstriter.h> -#include <util/string/ascii.h> -#include <util/string/strip.h> - +#include <util/string/cast.h> +#include <util/string/util.h> +#include <util/string/cstriter.h> +#include <util/string/ascii.h> +#include <util/string/strip.h> + #include <util/charset/unidata.h> // for ToLower #include <util/system/defaults.h> #include <util/generic/algorithm.h> @@ -267,7 +267,7 @@ TStringBuf GetParentDomain(const TStringBuf host, size_t level) noexcept { size_t pos = host.size(); for (size_t i = 0; i < level; ++i) { pos = host.rfind('.', pos); - if (pos == TString::npos) + if (pos == TString::npos) return host; } return host.SubStr(pos + 1); @@ -310,7 +310,7 @@ TStringBuf CutMPrefix(const TStringBuf url) noexcept { return url; } -static inline bool IsSchemeChar(char c) noexcept { +static inline bool IsSchemeChar(char c) noexcept { return IsAsciiAlnum(c); //what about '+' ?.. } @@ -322,7 +322,7 @@ static bool HasPrefix(const TStringBuf url) noexcept { return AllOf(scheme, IsSchemeChar); } -TString AddSchemePrefix(const TString& url) { +TString AddSchemePrefix(const TString& url) { return AddSchemePrefix(url, TStringBuf("http")); } diff --git a/library/cpp/string_utils/url/url.h b/library/cpp/string_utils/url/url.h index 84137ccc57d..f3ff2491f47 100644 --- a/library/cpp/string_utils/url/url.h +++ b/library/cpp/string_utils/url/url.h @@ -34,7 +34,7 @@ size_t GetHttpPrefixSize(const TStringBuf url, bool ignorehttps = false) noexcep Y_PURE_FUNCTION size_t GetHttpPrefixSize(const TWtringBuf url, bool ignorehttps = false) noexcept; -/** BEWARE of TStringBuf! You can not use operator ~ or c_str() like in TString +/** BEWARE of TStringBuf! You can not use operator ~ or c_str() like in TString !!!!!!!!!!!! */ Y_PURE_FUNCTION size_t GetSchemePrefixSize(const TStringBuf url) noexcept; @@ -61,7 +61,7 @@ TStringBuf CutSchemePrefix(const TStringBuf url) noexcept; TString AddSchemePrefix(const TString& url, const TStringBuf scheme); //! Same as `AddSchemePrefix(url, "http")`. -TString AddSchemePrefix(const TString& url); +TString AddSchemePrefix(const TString& url); Y_PURE_FUNCTION TStringBuf GetHost(const TStringBuf url) noexcept; diff --git a/library/cpp/string_utils/url/url_ut.cpp b/library/cpp/string_utils/url/url_ut.cpp index 15880138939..5c7c4ae6e38 100644 --- a/library/cpp/string_utils/url/url_ut.cpp +++ b/library/cpp/string_utils/url/url_ut.cpp @@ -1,7 +1,7 @@ #include "url.h" -#include <util/string/cast.h> - +#include <util/string/cast.h> + #include <library/cpp/testing/unittest/registar.h> Y_UNIT_TEST_SUITE(TUtilUrlTest) { diff --git a/library/cpp/string_utils/url/ut/ya.make b/library/cpp/string_utils/url/ut/ya.make index 0efa30e4d2c..6e60701aaa8 100644 --- a/library/cpp/string_utils/url/ut/ya.make +++ b/library/cpp/string_utils/url/ut/ya.make @@ -1,9 +1,9 @@ UNITTEST_FOR(library/cpp/string_utils/url) - -OWNER(g:util) - -SRCS( - url_ut.cpp -) - -END() + +OWNER(g:util) + +SRCS( + url_ut.cpp +) + +END() diff --git a/library/cpp/string_utils/url/ya.make b/library/cpp/string_utils/url/ya.make index b08d69ec83d..179dbc062b0 100644 --- a/library/cpp/string_utils/url/ya.make +++ b/library/cpp/string_utils/url/ya.make @@ -1,10 +1,10 @@ -LIBRARY() - -OWNER(g:util) - -SRCS( - url.cpp - url.h -) - -END() +LIBRARY() + +OWNER(g:util) + +SRCS( + url.cpp + url.h +) + +END() diff --git a/library/cpp/testing/benchmark/bench.cpp b/library/cpp/testing/benchmark/bench.cpp index 08d8708005a..70b9bcaf36c 100644 --- a/library/cpp/testing/benchmark/bench.cpp +++ b/library/cpp/testing/benchmark/bench.cpp @@ -100,7 +100,7 @@ namespace { } struct THiPerfTimer: public THPTimer { - static inline TString FmtTime(double t) { + static inline TString FmtTime(double t) { return DoFmtTime(t); } }; @@ -110,7 +110,7 @@ namespace { return (TInstant::Now() - N).MicroSeconds() / 1000000.0; } - static inline TString FmtTime(double t) { + static inline TString FmtTime(double t) { return DoFmtTime(t); } @@ -122,12 +122,12 @@ namespace { return GetCycleCount() - N; } - static inline TString FmtTime(double t) { + static inline TString FmtTime(double t) { if (t < 0.5) { t = 0.0; } - TString hr; + TString hr; if (t > 10 * 1000) { hr = " (" + ToString(HumanReadableSize(t, ESizeFormat::SF_QUANTITY)) + ")"; } @@ -162,7 +162,7 @@ namespace { }; using TSample = std::pair<size_t, double>; - using TSamples = TVector<TSample>; + using TSamples = TVector<TSample>; struct TLinFunc { double A; @@ -203,7 +203,7 @@ namespace { }; using TSampleWithError = std::pair<const TSample*, double>; - TVector<TSampleWithError> v; + TVector<TSampleWithError> v; v.reserve(s.size()); @@ -384,7 +384,7 @@ namespace { private: TAdaptiveLock ResultsLock_; - TVector<TResult> Results_; + TVector<TResult> Results_; }; class TOrderedReporter: public IReporter { @@ -544,7 +544,7 @@ namespace { bool ListTests = false; double TimeBudget = -1.0; - TVector<THolder<RE2>> Filters; + TVector<THolder<RE2>> Filters; size_t Threads = 0; EOutFormat OutFormat; }; @@ -553,7 +553,7 @@ namespace { int NBench::Main(int argc, char** argv) { const TProgOpts opts(argc, argv); - TVector<ITestRunner*> tests; + TVector<ITestRunner*> tests; for (auto&& it : Tests()) { if (opts.MatchFilters(it.Name())) { diff --git a/library/cpp/testing/benchmark/examples/main.cpp b/library/cpp/testing/benchmark/examples/main.cpp index ddd8b05ffc7..16c467894f2 100644 --- a/library/cpp/testing/benchmark/examples/main.cpp +++ b/library/cpp/testing/benchmark/examples/main.cpp @@ -7,7 +7,7 @@ #include <util/generic/bt_exception.h> Y_CPU_BENCHMARK(F, iface) { - TVector<size_t> x; + TVector<size_t> x; x.reserve(iface.Iterations()); @@ -23,7 +23,7 @@ Y_CPU_BENCHMARK(EmptyF, iface) { Y_CPU_BENCHMARK(AlmostEmptyF, iface) { (void)iface; - TVector<size_t> x; + TVector<size_t> x; x.resize(1); } diff --git a/library/cpp/testing/common/env.cpp b/library/cpp/testing/common/env.cpp index fa3a47fe16b..edd9ab4e886 100644 --- a/library/cpp/testing/common/env.cpp +++ b/library/cpp/testing/common/env.cpp @@ -40,7 +40,7 @@ TString BinaryPath(TStringBuf path) { return (TFsPath(BuildRoot()) / path).Fix(); } -TString GetArcadiaTestsData() { +TString GetArcadiaTestsData() { TString atdRoot = NPrivate::GetTestEnv().ArcadiaTestsDataDir; if (atdRoot) { return atdRoot; @@ -49,7 +49,7 @@ TString GetArcadiaTestsData() { TString path = NPrivate::GetCwd(); const char pathsep = GetDirectorySeparator(); while (!path.empty()) { - TString dataDir = path + "/arcadia_tests_data"; + TString dataDir = path + "/arcadia_tests_data"; if (IsDir(dataDir)) { return dataDir; } @@ -64,7 +64,7 @@ TString GetArcadiaTestsData() { return {}; } -TString GetWorkPath() { +TString GetWorkPath() { TString workPath = NPrivate::GetTestEnv().WorkPath; if (workPath) { return workPath; diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h index 7b89aa1bed8..f2878c2d262 100644 --- a/library/cpp/testing/common/env.h +++ b/library/cpp/testing/common/env.h @@ -3,7 +3,7 @@ #include <unordered_map> #include <util/folder/path.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/system/src_location.h> diff --git a/library/cpp/testing/gmock_in_unittest/events.cpp b/library/cpp/testing/gmock_in_unittest/events.cpp index dbd65b727d7..9169cc3abb7 100644 --- a/library/cpp/testing/gmock_in_unittest/events.cpp +++ b/library/cpp/testing/gmock_in_unittest/events.cpp @@ -3,13 +3,13 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/builder.h> void TGMockTestEventListener::OnTestPartResult(const testing::TestPartResult& result) { if (result.failed()) { - const TString message = result.message(); - const TString summary = result.summary(); + const TString message = result.message(); + const TString summary = result.summary(); TStringBuilder msg; if (result.file_name()) msg << result.file_name() << TStringBuf(":"); diff --git a/library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp b/library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp index 97f19050e42..7174802c9fe 100644 --- a/library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp +++ b/library/cpp/testing/gmock_in_unittest/example_ut/example_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> // Set this variable to true if you want to see failures ///////////////////////////////////////////////////////// @@ -16,7 +16,7 @@ public: virtual void Func1() = 0; - virtual int Func2(const TString&) const = 0; + virtual int Func2(const TString&) const = 0; }; class TTestMock: public ITestIface { @@ -50,11 +50,11 @@ Y_UNIT_TEST_SUITE(TExampleGMockTest) { Y_UNIT_TEST(TReturnValuesTest) { TTestMock mock; - EXPECT_CALL(mock, Func2(TString("1"))) + EXPECT_CALL(mock, Func2(TString("1"))) .WillOnce(Return(1)) .WillRepeatedly(Return(42)); - EXPECT_CALL(mock, Func2(TString("hello"))) + EXPECT_CALL(mock, Func2(TString("hello"))) .WillOnce(Return(-1)); UNIT_ASSERT_VALUES_EQUAL(mock.Func2("hello"), -1); diff --git a/library/cpp/testing/unittest/checks.cpp b/library/cpp/testing/unittest/checks.cpp index c5712ae9d21..0f4b3dae9df 100644 --- a/library/cpp/testing/unittest/checks.cpp +++ b/library/cpp/testing/unittest/checks.cpp @@ -1,7 +1,7 @@ #include <util/generic/string.h> #include <util/string/type.h> -bool CheckExceptionMessage(const char* msg, TString& err) { +bool CheckExceptionMessage(const char* msg, TString& err) { static const char* badMsg[] = { // Операция успешно завершена [cp1251] "\xce\xef\xe5\xf0\xe0\xf6\xe8\xff\x20\xf3\xf1\xef\xe5\xf8\xed\xee\x20\xe7\xe0\xe2\xe5\xf0\xf8\xe5\xed\xe0", @@ -22,7 +22,7 @@ bool CheckExceptionMessage(const char* msg, TString& err) { for (auto& i : badMsg) { if (strstr(msg, i) != nullptr) { - err = "Invalid error message: " + TString(msg); + err = "Invalid error message: " + TString(msg); return false; } } diff --git a/library/cpp/testing/unittest/gtest.cpp b/library/cpp/testing/unittest/gtest.cpp index ebad1ea4d67..6aded3e0855 100644 --- a/library/cpp/testing/unittest/gtest.cpp +++ b/library/cpp/testing/unittest/gtest.cpp @@ -8,7 +8,7 @@ using namespace NUnitTest; using namespace NUnitTest::NPrivate; -IGTestFactory::~IGTestFactory() { +IGTestFactory::~IGTestFactory() { } namespace { @@ -18,12 +18,12 @@ namespace { { } - TString TypeId() const override { + TString TypeId() const override { return TypeName(*this) + "-" + MyName; } - TString Name() const noexcept override { - return TString(MyName); + TString Name() const noexcept override { + return TString(MyName); } const TStringBuf MyName; @@ -35,10 +35,10 @@ namespace { { } - ~TGTestFactory() override { + ~TGTestFactory() override { } - TString Name() const noexcept override { + TString Name() const noexcept override { return Test.Name(); } @@ -55,7 +55,7 @@ namespace { } IGTestFactory* NUnitTest::NPrivate::ByName(const char* name) { - static TMap<TStringBuf, TAutoPtr<TGTestFactory>> tests; + static TMap<TStringBuf, TAutoPtr<TGTestFactory>> tests; auto& ret = tests[name]; diff --git a/library/cpp/testing/unittest/gtest.h b/library/cpp/testing/unittest/gtest.h index b6768b1bf0b..15e71cc495c 100644 --- a/library/cpp/testing/unittest/gtest.h +++ b/library/cpp/testing/unittest/gtest.h @@ -13,7 +13,7 @@ namespace NUnitTest { namespace NPrivate { struct IGTestFactory: public ITestBaseFactory { - ~IGTestFactory() override; + ~IGTestFactory() override; virtual void AddTest(const char* name, void (*body)(TTestContext&), bool forceFork) = 0; }; @@ -30,7 +30,7 @@ namespace NTesting { virtual void TearDown() { } - inline TTest* _This() noexcept { + inline TTest* _This() noexcept { return this; } }; diff --git a/library/cpp/testing/unittest/plugin.cpp b/library/cpp/testing/unittest/plugin.cpp index 543112f7ac6..194de772541 100644 --- a/library/cpp/testing/unittest/plugin.cpp +++ b/library/cpp/testing/unittest/plugin.cpp @@ -30,7 +30,7 @@ namespace NUnitTest { } private: - TVector<TSimpleSharedPtr<IPlugin>> Plugins; + TVector<TSimpleSharedPtr<IPlugin>> Plugins; }; } // anonymous namespace diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 3679b768ed4..9b75850e97a 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -15,9 +15,9 @@ bool NUnitTest::ShouldColorizeDiff = true; bool NUnitTest::ContinueOnFail = false; -TString NUnitTest::RandomString(size_t len, ui32 seed) { +TString NUnitTest::RandomString(size_t len, ui32 seed) { TReallyFastRng32 rand(seed); - TString ret; + TString ret; ret.reserve(len); @@ -34,7 +34,7 @@ Y_POD_STATIC_THREAD(NUnitTest::TTestBase*) currentTest; ::NUnitTest::TRaiseErrorHandler RaiseErrorHandler; -void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, bool fatalFailure) { +void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, bool fatalFailure) { Y_VERIFY(UnittestThread, "%s in non-unittest thread with message:\n%s", what, msg.data()); Y_VERIFY(GetCurrentTest()); @@ -119,7 +119,7 @@ struct TTraceDiffFormatter { } TString Common(TArrayRef<const char> str) const { - return TString(str.begin(), str.end()); + return TString(str.begin(), str.end()); } TString Left(TArrayRef<const char> str) const { @@ -135,17 +135,17 @@ struct TTraceDiffFormatter { } }; -TString NUnitTest::GetFormatTag(const char* name) { +TString NUnitTest::GetFormatTag(const char* name) { return Sprintf("[[%s]]", name); } -TString NUnitTest::GetResetTag() { - return TString("[[rst]]"); +TString NUnitTest::GetResetTag() { + return TString("[[rst]]"); } -TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims, bool reverse) { +TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims, bool reverse) { TStringStream res; - TVector<NDiff::TChunk<char>> chunks; + TVector<NDiff::TChunk<char>> chunks; NDiff::InlineDiff(chunks, s1, s2, delims); if (NUnitTest::ShouldColorizeDiff) { NDiff::PrintChunks(res, TDiffColorizer(reverse), chunks); @@ -160,7 +160,7 @@ static TString MakeTestName(const NUnitTest::ITestSuiteProcessor::TTest& test) { return TStringBuilder() << test.unit->name << "::" << test.name; } -static size_t CountTests(const TMap<TString, size_t>& testErrors, bool succeeded) { +static size_t CountTests(const TMap<TString, size_t>& testErrors, bool succeeded) { size_t cnt = 0; for (const auto& t : testErrors) { if (succeeded && t.second == 0) { @@ -465,7 +465,7 @@ unsigned NUnitTest::TTestFactory::Execute() { Items_.QuickSort(TCmp()); Processor_->Start(); - TSet<TString> types; + TSet<TString> types; size_t cnt = 0; for (TIntrusiveList<ITestBaseFactory>::TIterator factory = Items_.Begin(); factory != Items_.End(); ++factory) { diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a00924..a02b5ffe905 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -27,13 +27,13 @@ #include <cstdio> #include <functional> -extern bool CheckExceptionMessage(const char*, TString&); +extern bool CheckExceptionMessage(const char*, TString&); namespace NUnitTest { class TTestBase; namespace NPrivate { - void RaiseError(const char* what, const TString& msg, bool fatalFailure); + void RaiseError(const char* what, const TString& msg, bool fatalFailure); void SetUnittestThread(bool); void SetCurrentTest(TTestBase*); TTestBase* GetCurrentTest(); @@ -41,9 +41,9 @@ namespace NUnitTest { extern bool ShouldColorizeDiff; extern bool ContinueOnFail; - TString ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims = TString(), bool reverse = false); - TString GetFormatTag(const char* name); - TString GetResetTag(); + TString ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& delims = TString(), bool reverse = false); + TString GetFormatTag(const char* name); + TString GetResetTag(); // Raise error handler // Used for testing library/cpp/testing/unittest macroses @@ -73,7 +73,7 @@ namespace NUnitTest { { } - using TMetrics = THashMap<TString, double>; + using TMetrics = THashMap<TString, double>; TMetrics Metrics; ITestSuiteProcessor* Processor; @@ -82,7 +82,7 @@ namespace NUnitTest { class ITestSuiteProcessor { public: struct TUnit { - const TString name; + const TString name; }; struct TTest { @@ -93,7 +93,7 @@ namespace NUnitTest { struct TError { const TTest* test; const char* msg; - TString BackTrace; + TString BackTrace; TTestContext* Context; }; @@ -163,8 +163,8 @@ namespace NUnitTest { void AddTestFinish(const TTest& test); private: - TMap<TString, size_t> TestErrors_; - TMap<TString, size_t> CurTestErrors_; + TMap<TString, size_t> TestErrors_; + TMap<TString, size_t> CurTestErrors_; }; class TTestBase; @@ -177,7 +177,7 @@ namespace NUnitTest { virtual ~ITestBaseFactory(); // name of test suite - virtual TString Name() const noexcept = 0; + virtual TString Name() const noexcept = 0; virtual TTestBase* ConstructTest() = 0; private: @@ -195,7 +195,7 @@ namespace NUnitTest { virtual TString TypeId() const; - virtual TString Name() const noexcept = 0; + virtual TString Name() const noexcept = 0; virtual void Execute() = 0; virtual void SetUp(); @@ -431,7 +431,7 @@ public: \ const TString _b(B); \ if (_a != _b) { \ auto&& failMsg = Sprintf("%s != %s %s", ToString(_a).data(), ToString(_b).data(), (::TStringBuilder() << C).data()); \ - UNIT_FAIL_IMPL("strings equal assertion failed", failMsg); \ + UNIT_FAIL_IMPL("strings equal assertion failed", failMsg); \ } \ } while (false) @@ -686,7 +686,7 @@ public: \ // helper method to avoid double evaluation of A and B expressions in UNIT_ASSERT_VALUES_EQUAL_C template <typename T, typename U> - static inline bool CompareAndMakeStrings(const T& a, const U& b, TString& as, TString& asInd, TString& bs, TString& bsInd, bool& usePlainDiff, bool want) { + static inline bool CompareAndMakeStrings(const T& a, const U& b, TString& as, TString& asInd, TString& bs, TString& bsInd, bool& usePlainDiff, bool want) { const bool have = CompareEqual(a, b); usePlainDiff = std::is_integral<T>::value && std::is_integral<U>::value; @@ -714,10 +714,10 @@ public: \ if (!::NUnitTest::NPrivate::CompareAndMakeStrings(A, B, _as, _asInd, _bs, _bsInd, _usePlainDiff, EQflag)) { \ auto&& failMsg = Sprintf("(%s %s %s) failed: (%s %s %s) %s", #A, EQstr, #B, _as.data(), NEQstr, _bs.data(), (::TStringBuilder() << C).data()); \ if (EQflag && !_usePlainDiff) { \ - failMsg += ", with diff:\n"; \ - failMsg += ::NUnitTest::ColoredDiff(_asInd, _bsInd); \ + failMsg += ", with diff:\n"; \ + failMsg += ::NUnitTest::ColoredDiff(_asInd, _bsInd); \ } \ - UNIT_FAIL_IMPL("assertion failed", failMsg); \ + UNIT_FAIL_IMPL("assertion failed", failMsg); \ } \ } while (false) @@ -1024,7 +1024,7 @@ public: \ #define Y_UNIT_TEST_FRIEND(N, T) \ friend NTestSuite##N::TTestCase##T \ - TString RandomString(size_t len, ui32 seed = 0); + TString RandomString(size_t len, ui32 seed = 0); } using ::NUnitTest::TTestBase; diff --git a/library/cpp/testing/unittest/tests_data.h b/library/cpp/testing/unittest/tests_data.h index 6536bc1ae69..14ea88eb7ca 100644 --- a/library/cpp/testing/unittest/tests_data.h +++ b/library/cpp/testing/unittest/tests_data.h @@ -4,7 +4,7 @@ #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/network/sock.h> class TInet6StreamSocket; diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 305bc6b40fc..b2e9d676902 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -14,7 +14,7 @@ #include <util/generic/hash.h> #include <util/generic/hash_set.h> #include <util/generic/scope.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/network/init.h> @@ -58,16 +58,16 @@ public: inline TTraceWriterProcessor(const char* traceFilePath, EOpenMode mode) : PrevTime(TInstant::Now()) { - TraceFile = new TUnbufferedFileOutput(TFile(traceFilePath, mode | WrOnly | Seq)); + TraceFile = new TUnbufferedFileOutput(TFile(traceFilePath, mode | WrOnly | Seq)); } private: - TAutoPtr<TUnbufferedFileOutput> TraceFile; - TString TraceFilePath; + TAutoPtr<TUnbufferedFileOutput> TraceFile; + TString TraceFilePath; TInstant PrevTime; - TVector<TString> ErrorMessages; + TVector<TString> ErrorMessages; - inline void Trace(const TString eventName, const NJson::TJsonValue eventValue) { + inline void Trace(const TString eventName, const NJson::TJsonValue eventValue) { NJsonWriter::TBuf json(NJsonWriter::HEM_UNSAFE); json.BeginObject(); @@ -81,7 +81,7 @@ private: *TraceFile << "\n"; } - inline void TraceSubtestFinished(const char* className, const char* subtestName, const char* status, const TString comment, const TTestContext* context) { + inline void TraceSubtestFinished(const char* className, const char* subtestName, const char* status, const TString comment, const TTestContext* context) { const TInstant now = TInstant::Now(); NJson::TJsonValue event; event.InsertValue("class", className); @@ -97,7 +97,7 @@ private: Trace("subtest-finished", event); PrevTime = now; - TString marker = Join("", "\n###subtest-finished:", className, "::", subtestName, "\n"); + TString marker = Join("", "\n###subtest-finished:", className, "::", subtestName, "\n"); Cout << marker; Cout.Flush(); Cerr << comment; @@ -105,7 +105,7 @@ private: Cerr.Flush(); } - virtual TString BuildComment(const char* message, const char* backTrace) { + virtual TString BuildComment(const char* message, const char* backTrace) { return NUnitTest::GetFormatTag("bad") + TString(message).substr(0, MAX_COMMENT_MESSAGE_LENGTH) + NUnitTest::GetResetTag() + @@ -120,7 +120,7 @@ private: event.InsertValue("class", test->unit->name); event.InsertValue("subtest", test->name); Trace("subtest-started", event); - TString marker = Join("", "\n###subtest-started:", test->unit->name, "::", test->name, "\n"); + TString marker = Join("", "\n###subtest-started:", test->unit->name, "::", test->name, "\n"); Cout << marker; Cout.Flush(); Cerr << marker; @@ -149,7 +149,7 @@ private: TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "good", "", descr->Context); } else { TStringBuilder msgs; - for (const TString& m : ErrorMessages) { + for (const TString& m : ErrorMessages) { if (msgs) { msgs << TStringBuf("\n"); } @@ -166,7 +166,7 @@ private: class TColoredProcessor: public ITestSuiteProcessor, public NColorizer::TColors { public: - inline TColoredProcessor(const TString& appName) + inline TColoredProcessor(const TString& appName) : PrintBeforeSuite_(true) , PrintBeforeTest_(true) , PrintAfterTest_(true) @@ -186,30 +186,30 @@ public: { } - ~TColoredProcessor() override { + ~TColoredProcessor() override { } inline void Disable(const char* name) { - size_t colon = TString(name).find("::"); - if (colon == TString::npos) { + size_t colon = TString(name).find("::"); + if (colon == TString::npos) { DisabledSuites_.insert(name); } else { - TString suite = TString(name).substr(0, colon); + TString suite = TString(name).substr(0, colon); DisabledTests_.insert(name); } } inline void Enable(const char* name) { - size_t colon = TString(name).rfind("::"); - if (colon == TString::npos) { + size_t colon = TString(name).rfind("::"); + if (colon == TString::npos) { EnabledSuites_.insert(name); - EnabledTests_.insert(TString() + name + "::*"); + EnabledTests_.insert(TString() + name + "::*"); } else { - TString suite = TString(name).substr(0, colon); + TString suite = TString(name).substr(0, colon); EnabledSuites_.insert(suite); EnabledSuites_.insert(name); EnabledTests_.insert(name); - EnabledTests_.insert(TString() + name + "::*"); + EnabledTests_.insert(TString() + name + "::*"); } } @@ -425,7 +425,7 @@ private: } } - bool CheckAccess(TString name, size_t num) override { + bool CheckAccess(TString name, size_t num) override { if (num < Start) { return false; } @@ -445,8 +445,8 @@ private: return EnabledSuites_.find(name.data()) != EnabledSuites_.end(); } - bool CheckAccessTest(TString suite, const char* test) override { - TString name = suite + "::" + test; + bool CheckAccessTest(TString suite, const char* test) override { + TString name = suite + "::" + test; if (DisabledTests_.find(name) != DisabledTests_.end()) { return false; } @@ -455,7 +455,7 @@ private: return true; } - if (EnabledTests_.find(TString() + suite + "::*") != EnabledTests_.end()) { + if (EnabledTests_.find(TString() + suite + "::*") != EnabledTests_.end()) { return true; } @@ -467,7 +467,7 @@ private: return f(); } - TList<TString> args(1, "--is-forked-internal"); + TList<TString> args(1, "--is-forked-internal"); args.push_back(Sprintf("+%s::%s", suite.data(), name)); // stdin is ignored - unittest should not need them... @@ -475,12 +475,12 @@ private: TShellCommandOptions().SetUseShell(false).SetCloseAllFdsOnExec(true).SetAsync(false).SetLatency(1)); cmd.Run(); - const TString& err = cmd.GetError(); + const TString& err = cmd.GetError(); const size_t msgIndex = err.find(ForkCorrectExitMsg); // everything is printed by parent process except test's result output ("good" or "fail") // which is printed by child. If there was no output - parent process prints default message. - ForkExitedCorrectly = msgIndex != TString::npos; + ForkExitedCorrectly = msgIndex != TString::npos; // TODO: stderr output is always printed after stdout Cout.Write(cmd.GetOutput()); @@ -517,16 +517,16 @@ private: bool PrintAfterSuite_; bool PrintTimes_; bool PrintSummary_; - THashSet<TString> DisabledSuites_; - THashSet<TString> EnabledSuites_; - THashSet<TString> DisabledTests_; - THashSet<TString> EnabledTests_; + THashSet<TString> DisabledSuites_; + THashSet<TString> EnabledSuites_; + THashSet<TString> DisabledTests_; + THashSet<TString> EnabledTests_; TInstant PrevTime_; bool ShowFails; - TVector<TString> Fails; + TVector<TString> Fails; size_t Start; size_t End; - TString AppName; + TString AppName; bool ForkTests; bool IsForked; bool Loop; @@ -545,10 +545,10 @@ public: { } - ~TEnumeratingProcessor() override { + ~TEnumeratingProcessor() override { } - bool CheckAccess(TString name, size_t /*num*/) override { + bool CheckAccess(TString name, size_t /*num*/) override { if (Verbose_) { return true; } else { @@ -557,7 +557,7 @@ public: } } - bool CheckAccessTest(TString suite, const char* name) override { + bool CheckAccessTest(TString suite, const char* name) override { Stream_ << suite << "::" << name << "\n"; return false; } @@ -732,7 +732,7 @@ int NUnitTest::RunMain(int argc, char** argv) { TString param(argv[i]); size_t assign = param.find('='); Singleton<::NPrivate::TTestEnv>()->AddTestParam(param.substr(0, assign), param.substr(assign + 1)); - } else if (TString(name).StartsWith("--")) { + } else if (TString(name).StartsWith("--")) { return DoUsage(argv[0]), 1; } else if (*name == '-') { processor.Disable(name + 1); diff --git a/library/cpp/threading/future/perf/main.cpp b/library/cpp/threading/future/perf/main.cpp index 5a0690af473..17a29654985 100644 --- a/library/cpp/threading/future/perf/main.cpp +++ b/library/cpp/threading/future/perf/main.cpp @@ -1,7 +1,7 @@ #include <library/cpp/testing/benchmark/bench.h> #include <library/cpp/threading/future/future.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/xrange.h> using namespace NThreading; @@ -38,7 +38,7 @@ Y_CPU_BENCHMARK(AllocPromiseUI64, iface) { } Y_CPU_BENCHMARK(AllocPromiseStroka, iface) { - TestAllocPromise<TString>(iface); + TestAllocPromise<TString>(iface); } Y_CPU_BENCHMARK(SetPromiseUI64, iface) { @@ -46,5 +46,5 @@ Y_CPU_BENCHMARK(SetPromiseUI64, iface) { } Y_CPU_BENCHMARK(SetPromiseStroka, iface) { - TestSetPromise<TString>(iface, "test test test"); + TestSetPromise<TString>(iface, "test test test"); } diff --git a/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp b/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp index 74176368643..f842d98ca25 100644 --- a/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp +++ b/library/cpp/threading/poor_man_openmp/thread_helper_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> Y_UNIT_TEST_SUITE(TestMP) { @@ -13,7 +13,7 @@ Y_UNIT_TEST_SUITE(TestMP) { } }; - TString s; + TString s; try { NYmp::ParallelForStaticAutoChunk(0, 10, f); diff --git a/library/cpp/threading/queue/basic_ut.cpp b/library/cpp/threading/queue/basic_ut.cpp index 5f56f8583ec..f6b8d0f8102 100644 --- a/library/cpp/threading/queue/basic_ut.cpp +++ b/library/cpp/threading/queue/basic_ut.cpp @@ -4,10 +4,10 @@ #include "ut_helpers.h" -template <typename TQueueType> +template <typename TQueueType> class TQueueTestsInSingleThread: public TTestBase { private: - using TSelf = TQueueTestsInSingleThread<TQueueType>; + using TSelf = TQueueTestsInSingleThread<TQueueType>; using TLink = TIntrusiveLink; UNIT_TEST_SUITE_DEMANGLE(TSelf); @@ -18,7 +18,7 @@ private: public: void OnePushOnePop() { - TQueueType queue; + TQueueType queue; auto popped = queue.Pop(); UNIT_ASSERT_VALUES_EQUAL(popped, nullptr); @@ -33,7 +33,7 @@ public: }; void OnePushOnePop_Repeat1M() { - TQueueType queue; + TQueueType queue; TLink msg; auto popped = queue.Pop(); @@ -54,7 +54,7 @@ public: class TCycleThread: public ISimpleThread { public: void* ThreadProc() override { - TQueueType queue; + TQueueType queue; TLink msg; auto popped = queue.Pop(); UNIT_ASSERT_VALUES_EQUAL(popped, nullptr); @@ -71,7 +71,7 @@ public: } }; - TVector<TAutoPtr<TCycleThread>> cyclers; + TVector<TAutoPtr<TCycleThread>> cyclers; for (size_t i = 0; i < NUMBER_OF_THREADS; ++i) { cyclers.emplace_back(new TCycleThread); diff --git a/library/cpp/threading/queue/mpsc_read_as_filled.h b/library/cpp/threading/queue/mpsc_read_as_filled.h index be33ba5a584..de8f596833f 100644 --- a/library/cpp/threading/queue/mpsc_read_as_filled.h +++ b/library/cpp/threading/queue/mpsc_read_as_filled.h @@ -544,7 +544,7 @@ namespace NThreading { using TBunchBase = TEmpty; template <typename TElem, typename... TRest> - using TContainer = TDeque<TElem, TRest...>; + using TContainer = TDeque<TElem, TRest...>; static constexpr bool DeleteItems = true; }; diff --git a/library/cpp/threading/queue/queue_ut.cpp b/library/cpp/threading/queue/queue_ut.cpp index 80eca147da9..299025adccc 100644 --- a/library/cpp/threading/queue/queue_ut.cpp +++ b/library/cpp/threading/queue/queue_ut.cpp @@ -5,10 +5,10 @@ typedef void* TMsgLink; -template <typename TQueueType> +template <typename TQueueType> class TQueueTestProcs: public TTestBase { private: - UNIT_TEST_SUITE_DEMANGLE(TQueueTestProcs<TQueueType>); + UNIT_TEST_SUITE_DEMANGLE(TQueueTestProcs<TQueueType>); UNIT_TEST(Threads2_Push1M_Threads1_Pop2M) UNIT_TEST(Threads4_Push1M_Threads1_Pop4M) UNIT_TEST(Threads8_RndPush100K_Threads8_Queues) @@ -21,7 +21,7 @@ private: public: void Push1M_Pop1M() { - TQueueType queue; + TQueueType queue; TMsgLink msg = &queue; auto pmsg = queue.Pop(); @@ -41,17 +41,17 @@ public: } void Threads2_Push1M_Threads1_Pop2M() { - TQueueType queue; + TQueueType queue; class TPusherThread: public ISimpleThread { public: - TPusherThread(TQueueType& theQueue, char* start) - : Queue(theQueue) + TPusherThread(TQueueType& theQueue, char* start) + : Queue(theQueue) , Arg(start) { } - TQueueType& Queue; + TQueueType& Queue; char* Arg; void* ThreadProc() override { @@ -79,17 +79,17 @@ public: } void Threads4_Push1M_Threads1_Pop4M() { - TQueueType queue; + TQueueType queue; class TPusherThread: public ISimpleThread { public: - TPusherThread(TQueueType& theQueue, char* start) - : Queue(theQueue) + TPusherThread(TQueueType& theQueue, char* start) + : Queue(theQueue) , Arg(start) { } - TQueueType& Queue; + TQueueType& Queue; char* Arg; void* ThreadProc() override { @@ -122,17 +122,17 @@ public: template <size_t NUMBER_OF_PUSHERS, size_t NUMBER_OF_QUEUES> void ManyRndPush100K_ManyQueues() { - TQueueType queue[NUMBER_OF_QUEUES]; + TQueueType queue[NUMBER_OF_QUEUES]; class TPusherThread: public ISimpleThread { public: - TPusherThread(TQueueType* queues, char* start) + TPusherThread(TQueueType* queues, char* start) : Queues(queues) , Arg(start) { } - TQueueType* Queues; + TQueueType* Queues; char* Arg; void* ThreadProc() override { @@ -157,13 +157,13 @@ public: class TPopperThread: public ISimpleThread { public: - TPopperThread(TQueueType* theQueue, char* base) - : Queue(theQueue) + TPopperThread(TQueueType* theQueue, char* base) + : Queue(theQueue) , Base(base) { } - TQueueType* Queue; + TQueueType* Queue; char* Base; void* ThreadProc() override { @@ -197,8 +197,8 @@ public: } }; - TVector<TAutoPtr<TPopperThread>> poppers; - TVector<TAutoPtr<TPusherThread>> pushers; + TVector<TAutoPtr<TPopperThread>> poppers; + TVector<TAutoPtr<TPusherThread>> pushers; for (size_t i = 0; i < NUMBER_OF_QUEUES; ++i) { poppers.emplace_back(new TPopperThread(&queue[i], (char*)&queue)); diff --git a/library/cpp/threading/queue/unordered_ut.cpp b/library/cpp/threading/queue/unordered_ut.cpp index a43b7f520e5..494cffcbe5b 100644 --- a/library/cpp/threading/queue/unordered_ut.cpp +++ b/library/cpp/threading/queue/unordered_ut.cpp @@ -6,19 +6,19 @@ #include "ut_helpers.h" -template <typename TQueueType> +template <typename TQueueType> class TTestUnorderedQueue: public TTestBase { private: using TLink = TIntrusiveLink; - UNIT_TEST_SUITE_DEMANGLE(TTestUnorderedQueue<TQueueType>); + UNIT_TEST_SUITE_DEMANGLE(TTestUnorderedQueue<TQueueType>); UNIT_TEST(Push1M_Pop1M_Unordered) UNIT_TEST_SUITE_END(); public: void Push1M_Pop1M_Unordered() { constexpr int REPEAT = 1000000; - TQueueType queue; + TQueueType queue; TLink msg[REPEAT]; auto pmsg = queue.Pop(); @@ -28,7 +28,7 @@ public: queue.Push(&msg[i]); } - TVector<TLink*> popped; + TVector<TLink*> popped; popped.reserve(REPEAT); for (int i = 0; i < REPEAT; ++i) { popped.push_back((TLink*)queue.Pop()); @@ -44,17 +44,17 @@ public: } }; -template <typename TQueueType> +template <typename TQueueType> class TTestWeakQueue: public TTestBase { private: - UNIT_TEST_SUITE_DEMANGLE(TTestWeakQueue<TQueueType>); + UNIT_TEST_SUITE_DEMANGLE(TTestWeakQueue<TQueueType>); UNIT_TEST(Threads8_Rnd_Exchange) UNIT_TEST_SUITE_END(); public: template <ui16 COUNT = 48, ui32 MSG_COUNT = 10000> void ManyThreadsRndExchange() { - TQueueType queues[COUNT]; + TQueueType queues[COUNT]; class TWorker: public ISimpleThread { public: @@ -68,9 +68,9 @@ public: { } - TQueueType* Queues; + TQueueType* Queues; ui16 MineQueue; - TVector<uintptr_t> Received; + TVector<uintptr_t> Received; TAtomic* PushDone; void* ThreadProc() override { @@ -120,7 +120,7 @@ public: } }; - TVector<TAutoPtr<TWorker>> workers; + TVector<TAutoPtr<TWorker>> workers; TAtomic pushDone = 0; for (ui32 i = 0; i < COUNT; ++i) { @@ -128,7 +128,7 @@ public: workers.back()->Start(); } - TVector<uintptr_t> all; + TVector<uintptr_t> all; for (ui32 i = 0; i < COUNT; ++i) { workers[i]->Join(); all.insert(all.begin(), diff --git a/library/cpp/threading/task_scheduler/task_scheduler.cpp b/library/cpp/threading/task_scheduler/task_scheduler.cpp index 174dde4bf75..4e2239c2d7c 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler.cpp @@ -18,8 +18,8 @@ public: { } - TString DebugState = "?"; - TString DebugId = ""; + TString DebugState = "?"; + TString DebugId = ""; private: void* ThreadProc() noexcept override { Scheduler_.WorkerFunc(this); @@ -150,7 +150,7 @@ bool TTaskScheduler::Add(IRepeatedTaskRef task, TDuration period) { const bool debugOutput = false; -void TTaskScheduler::ChangeDebugState(TWorkerThread* thread, const TString& state) { +void TTaskScheduler::ChangeDebugState(TWorkerThread* thread, const TString& state) { if (!debugOutput) { Y_UNUSED(thread); Y_UNUSED(state); diff --git a/library/cpp/threading/task_scheduler/task_scheduler.h b/library/cpp/threading/task_scheduler/task_scheduler.h index df4da941a88..e2381c2b38b 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler.h +++ b/library/cpp/threading/task_scheduler/task_scheduler.h @@ -40,10 +40,10 @@ private: TWorkerThread* WaitingWorker = nullptr; }; - using TQueueType = TMultiMap<TInstant, TTaskHolder>; - using TQueueIterator = TQueueType::iterator; + using TQueueType = TMultiMap<TInstant, TTaskHolder>; + using TQueueIterator = TQueueType::iterator; private: - void ChangeDebugState(TWorkerThread* thread, const TString& state); + void ChangeDebugState(TWorkerThread* thread, const TString& state); void ChooseFromQueue(TQueueIterator& toWait); bool Wait(TWorkerThread* thread, TQueueIterator& toWait); @@ -52,12 +52,12 @@ private: bool IsStopped_ = false; TAtomic TaskCounter_ = 0; - TQueueType Queue_; + TQueueType Queue_; TCondVar CondVar_; TMutex Lock_; - TVector<TAutoPtr<TWorkerThread>> Workers_; + TVector<TAutoPtr<TWorkerThread>> Workers_; const size_t MaxTaskCount_; }; diff --git a/library/cpp/timezone_conversion/convert.cpp b/library/cpp/timezone_conversion/convert.cpp index 490bb4e2700..4a690b6191d 100644 --- a/library/cpp/timezone_conversion/convert.cpp +++ b/library/cpp/timezone_conversion/convert.cpp @@ -53,7 +53,7 @@ namespace NDatetime { } /* - TTimeZone GetTimeZone(const TString& name) { + TTimeZone GetTimeZone(const TString& name) { TTimeZone result; if (!cctz::load_time_zone(name, &result)) { ythrow yexception() << "Failed to load time zone " << name << ", " << result.name(); diff --git a/library/cpp/unicode/normalization/normalization.h b/library/cpp/unicode/normalization/normalization.h index 4f5f57881c3..bce2759dc1a 100644 --- a/library/cpp/unicode/normalization/normalization.h +++ b/library/cpp/unicode/normalization/normalization.h @@ -127,7 +127,7 @@ namespace NUnicode { }; typedef std::pair<wchar32, TCombining> TSymbol; - typedef TVector<TSymbol> TBuffer; + typedef TVector<TSymbol> TBuffer; template <bool doCompose> class TCompositor; diff --git a/library/cpp/unicode/normalization/ut/normalization_ut.cpp b/library/cpp/unicode/normalization/ut/normalization_ut.cpp index 54d4940a268..dbccd0810d2 100644 --- a/library/cpp/unicode/normalization/ut/normalization_ut.cpp +++ b/library/cpp/unicode/normalization/ut/normalization_ut.cpp @@ -8,8 +8,8 @@ Y_UNIT_TEST_SUITE(TUnicodeNormalizationTest) { template <NUnicode::ENormalization NormType> void TestInit() { NUnicode::TNormalizer<NormType> normalizer; - TString s("упячка detected"); - TUtf16String w; + TString s("упячка detected"); + TUtf16String w; UTF8ToWide(s, w); normalizer.Normalize(w); } diff --git a/library/cpp/unicode/punycode/punycode.cpp b/library/cpp/unicode/punycode/punycode.cpp index 800d1f19fe4..4a8993a95b8 100644 --- a/library/cpp/unicode/punycode/punycode.cpp +++ b/library/cpp/unicode/punycode/punycode.cpp @@ -39,7 +39,7 @@ static inline void AppendUtf32ToWide(const ui32* in, size_t len, TUtf16String& o } } -TStringBuf WideToPunycode(const TWtringBuf& in16, TString& out) { +TStringBuf WideToPunycode(const TWtringBuf& in16, TString& out) { TVector<ui32> in32; AppendWideToUtf32(in16, in32); size_t outlen = in32.size(); @@ -57,7 +57,7 @@ TStringBuf WideToPunycode(const TWtringBuf& in16, TString& out) { return out; } -TWtringBuf PunycodeToWide(const TStringBuf& in, TUtf16String& out16) { +TWtringBuf PunycodeToWide(const TStringBuf& in, TUtf16String& out16) { size_t outlen = in.size(); TVector<ui32> out32(outlen); @@ -79,7 +79,7 @@ namespace { }; } -TString HostNameToPunycode(const TWtringBuf& unicodeHost) { +TString HostNameToPunycode(const TWtringBuf& unicodeHost) { TVector<ui32> in32; AppendWideToUtf32(unicodeHost, in32); in32.push_back(0); @@ -91,7 +91,7 @@ TString HostNameToPunycode(const TWtringBuf& unicodeHost) { return out.Data; } -TUtf16String PunycodeToHostName(const TStringBuf& punycodeHost) { +TUtf16String PunycodeToHostName(const TStringBuf& punycodeHost) { if (!IsStringASCII(punycodeHost.begin(), punycodeHost.end())) ythrow TPunycodeError() << "Non-ASCII punycode input"; @@ -105,12 +105,12 @@ TUtf16String PunycodeToHostName(const TStringBuf& punycodeHost) { int rc = idna_to_unicode_4z4z(in32.begin(), &out.Data, 0); CheckIdnaResult(rc); - TUtf16String decoded; + TUtf16String decoded; AppendUtf32ToWide(out.Data, std::char_traits<ui32>::length(out.Data), decoded); return decoded; } -TString ForceHostNameToPunycode(const TWtringBuf& unicodeHost) { +TString ForceHostNameToPunycode(const TWtringBuf& unicodeHost) { try { return HostNameToPunycode(unicodeHost); } catch (const TPunycodeError&) { @@ -118,7 +118,7 @@ TString ForceHostNameToPunycode(const TWtringBuf& unicodeHost) { } } -TUtf16String ForcePunycodeToHostName(const TStringBuf& punycodeHost) { +TUtf16String ForcePunycodeToHostName(const TStringBuf& punycodeHost) { try { return PunycodeToHostName(punycodeHost); } catch (const TPunycodeError&) { diff --git a/library/cpp/unicode/punycode/punycode.h b/library/cpp/unicode/punycode/punycode.h index af4acc25c14..868e473253d 100644 --- a/library/cpp/unicode/punycode/punycode.h +++ b/library/cpp/unicode/punycode/punycode.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/yexception.h> @@ -9,17 +9,17 @@ // Raw strings encoder/decoder: does not prepend with ACE prefix ("xn--"), // does not limit input length. Throws TPunycodeError on any internal error. // Returned strbuf points to @out data. -TStringBuf WideToPunycode(const TWtringBuf& in, TString& out); -TWtringBuf PunycodeToWide(const TStringBuf& in, TUtf16String& out); +TStringBuf WideToPunycode(const TWtringBuf& in, TString& out); +TWtringBuf PunycodeToWide(const TStringBuf& in, TUtf16String& out); -inline TString WideToPunycode(const TWtringBuf& in) { - TString out; +inline TString WideToPunycode(const TWtringBuf& in) { + TString out; WideToPunycode(in, out); return out; } -inline TUtf16String PunycodeToWide(const TStringBuf& in) { - TUtf16String out; +inline TUtf16String PunycodeToWide(const TStringBuf& in) { + TUtf16String out; PunycodeToWide(in, out); return out; } @@ -29,12 +29,12 @@ inline TUtf16String PunycodeToWide(const TStringBuf& in) { // Labels containing non-ASCII characters are prefixed with ACE prefix ("xn--"). // Limits maximal encoded domain label length to IDNA_LABEL_MAX_LENGTH (255 by default). // Throws TPunycodeError on failure. -TString HostNameToPunycode(const TWtringBuf& unicodeHost); -TUtf16String PunycodeToHostName(const TStringBuf& punycodeHost); +TString HostNameToPunycode(const TWtringBuf& unicodeHost); +TUtf16String PunycodeToHostName(const TStringBuf& punycodeHost); // Robust versions: on failure return original input, converted to/from UTF8 -TString ForceHostNameToPunycode(const TWtringBuf& unicodeHost); -TUtf16String ForcePunycodeToHostName(const TStringBuf& punycodeHost); +TString ForceHostNameToPunycode(const TWtringBuf& unicodeHost); +TUtf16String ForcePunycodeToHostName(const TStringBuf& punycodeHost); // True if @host looks like punycode domain label sequence, // containing at least one ACE-prefixed label. diff --git a/library/cpp/unicode/punycode/punycode_ut.cpp b/library/cpp/unicode/punycode/punycode_ut.cpp index 97271cf0d80..bb192169d76 100644 --- a/library/cpp/unicode/punycode/punycode_ut.cpp +++ b/library/cpp/unicode/punycode/punycode_ut.cpp @@ -11,10 +11,10 @@ namespace { } Y_UNIT_TEST_SUITE(TPunycodeTest) { - static bool TestRaw(const TString& utf8, const TString& punycode) { - TUtf16String unicode = UTF8ToWide(utf8); - TString buf1; - TUtf16String buf2; + static bool TestRaw(const TString& utf8, const TString& punycode) { + TUtf16String unicode = UTF8ToWide(utf8); + TString buf1; + TUtf16String buf2; return HasSameBuffer(WideToPunycode(unicode, buf1), buf1) && buf1 == punycode && HasSameBuffer(PunycodeToWide(punycode, buf2), buf2) && buf2 == unicode && WideToPunycode(unicode) == punycode && PunycodeToWide(punycode) == unicode; } @@ -48,25 +48,25 @@ Y_UNIT_TEST_SUITE(TPunycodeTest) { UNIT_ASSERT_EXCEPTION(PunycodeToWide("-"), TPunycodeError); { - TString longIn; + TString longIn; for (size_t i = 0; i < 1024; ++i) longIn += "Qй"; - TString longOut = "QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ-lo11fbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; + TString longOut = "QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ-lo11fbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; UNIT_ASSERT(TestRaw(longIn, longOut)); } } - static bool TestHostName(const TString& utf8, const TString& punycode, bool canBePunycode = false) { - TUtf16String unicode = UTF8ToWide(utf8); - TString buf1; - TUtf16String buf2; + static bool TestHostName(const TString& utf8, const TString& punycode, bool canBePunycode = false) { + TUtf16String unicode = UTF8ToWide(utf8); + TString buf1; + TUtf16String buf2; //Cerr << "Testing " << utf8 << Endl; return HostNameToPunycode(unicode) == punycode && HostNameToPunycode(UTF8ToWide(punycode)) == punycode // repeated encoding should give same result && PunycodeToHostName(punycode) == unicode && CanBePunycodeHostName(punycode) == canBePunycode; } - static bool TestForced(const TString& bad) { + static bool TestForced(const TString& bad) { return ForceHostNameToPunycode(UTF8ToWide(bad)) == bad && ForcePunycodeToHostName(bad) == UTF8ToWide(bad); } @@ -89,25 +89,25 @@ Y_UNIT_TEST_SUITE(TPunycodeTest) { { // non-ascii - TString bad = "президент.рф"; + TString bad = "президент.рф"; UNIT_ASSERT_EXCEPTION(PunycodeToHostName("президент.рф"), TPunycodeError); UNIT_ASSERT(ForcePunycodeToHostName(bad) == UTF8ToWide(bad)); } { // too long domain label - TString bad(500, 'a'); + TString bad(500, 'a'); UNIT_ASSERT_EXCEPTION(HostNameToPunycode(UTF8ToWide(bad)), TPunycodeError); UNIT_ASSERT(TestForced(bad)); // but can decode it } { // already has ACE prefix - TString bad("xn--яндекс.xn--рф"); + TString bad("xn--яндекс.xn--рф"); UNIT_ASSERT_EXCEPTION(HostNameToPunycode(UTF8ToWide(bad)), TPunycodeError); UNIT_ASSERT(TestForced(bad)); } { // empty non-root domain is not allowed (?) - TString bad(".яндекс.рф"); + TString bad(".яндекс.рф"); UNIT_ASSERT_EXCEPTION(HostNameToPunycode(UTF8ToWide(bad)), TPunycodeError); UNIT_ASSERT(TestForced(bad)); } diff --git a/library/cpp/uri/other.h b/library/cpp/uri/other.h index 7aec22e77b3..c2f5ec794e9 100644 --- a/library/cpp/uri/other.h +++ b/library/cpp/uri/other.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> // Some functions for inverted url representation // No scheme cut-off, no 80th port normalization @@ -14,7 +14,7 @@ void UnTrspChars(const char* s, char* d); void InvertDomain(char* begin, char* end); -inline TString& InvertDomain(TString& url) { +inline TString& InvertDomain(TString& url) { InvertDomain(url.begin(), url.begin() + url.size()); return url; } @@ -25,7 +25,7 @@ inline void InvertUrl(char* url) { InvertUrl(url, url + strlen(url)); } -inline TString& InvertUrl(TString& url) { +inline TString& InvertUrl(TString& url) { InvertUrl(url.begin(), url.begin() + url.size()); return url; } @@ -36,7 +36,7 @@ inline void RevertUrl(char* url) { RevertUrl(url, url + strlen(url)); } -inline TString& RevertUrl(TString& url) { +inline TString& RevertUrl(TString& url) { RevertUrl(url.begin(), url.begin() + url.size()); return url; } diff --git a/library/cpp/uri/uri.h b/library/cpp/uri/uri.h index 3b6c19fe4a8..c8d08285722 100644 --- a/library/cpp/uri/uri.h +++ b/library/cpp/uri/uri.h @@ -7,7 +7,7 @@ #include <util/generic/buffer.h> #include <util/generic/ptr.h> #include <util/generic/singleton.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/memory/alloc.h> #include <util/stream/mem.h> #include <util/stream/output.h> diff --git a/library/cpp/uri/uri_ut.h b/library/cpp/uri/uri_ut.h index f8ac6e40927..2089edf7bf0 100644 --- a/library/cpp/uri/uri_ut.h +++ b/library/cpp/uri/uri_ut.h @@ -22,7 +22,7 @@ namespace NUri { } #define URL_MSG(url1, url2, cmp) \ - (TString("[") + url1.PrintS() + ("] " cmp " [") + url2.PrintS() + "]") + (TString("[") + url1.PrintS() + ("] " cmp " [") + url2.PrintS() + "]") #define URL_EQ(url1, url2) \ UNIT_ASSERT_EQUAL_C(url, url2, URL_MSG(url1, url2, "!=")) #define URL_NEQ(url1, url2) \ diff --git a/library/cpp/uri/ut/ya.make b/library/cpp/uri/ut/ya.make index b2b2c1291a9..51a7ebf1b26 100644 --- a/library/cpp/uri/ut/ya.make +++ b/library/cpp/uri/ut/ya.make @@ -4,7 +4,7 @@ OWNER(leo) NO_OPTIMIZE() -NO_WSHADOW() +NO_WSHADOW() PEERDIR( library/cpp/html/entity diff --git a/library/cpp/xml/document/README b/library/cpp/xml/document/README index b2649523d8f..164d3a1c9c3 100644 --- a/library/cpp/xml/document/README +++ b/library/cpp/xml/document/README @@ -16,9 +16,9 @@ The standard way to use it is as follows: using namespace NXml; TConstNode& node = nodes[i]; // query node - TString name = node.Name(); - TString lang = node.Attr<TString>("lang"); - TString text = node.Value<TString>(); + TString name = node.Name(); + TString lang = node.Attr<TString>("lang"); + TString text = node.Value<TString>(); TConstNode child = node.GetFirstChild(""); // edit node TNode node = child.ConstCast(); @@ -34,9 +34,9 @@ The standard way to use it is as follows: // copy node's subtree from one document to another place.AddChild(xml.Root()); // save (render) single element - TString modifiedNode = place.ToString(); + TString modifiedNode = place.ToString(); // save whole document with optional encoding - TString modifiedDoc = xml2.ToString("ISO-8559-1"); + TString modifiedDoc = xml2.ToString("ISO-8559-1"); See xml-document_ut.cpp for more examples. diff --git a/library/cpp/xml/document/node-attr.h b/library/cpp/xml/document/node-attr.h index 6e74403943c..6321fcb2671 100644 --- a/library/cpp/xml/document/node-attr.h +++ b/library/cpp/xml/document/node-attr.h @@ -28,7 +28,7 @@ namespace NXml { template <> inline void TNode::AttrInternal(TCharPtr& value, TString& res, TStringBuf /*errContext*/) const { - TString tmp(CAST2CHAR(value.Get())); + TString tmp(CAST2CHAR(value.Get())); res.swap(tmp); } diff --git a/library/cpp/xml/document/xml-document-decl.h b/library/cpp/xml/document/xml-document-decl.h index bfda1fb7e6e..b481d8164cd 100644 --- a/library/cpp/xml/document/xml-document-decl.h +++ b/library/cpp/xml/document/xml-document-decl.h @@ -2,7 +2,7 @@ #include <library/cpp/string_utils/ztstrbuf/ztstrbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/stream/output.h> #include <util/stream/str.h> @@ -32,7 +32,7 @@ namespace NXml { * @param src: source type: File | String | RootName * throws if file not found or cannot be parsed */ - TDocument(const TString& source, Source type = File); + TDocument(const TString& source, Source type = File); public: TDocument(const TDocument& that) = delete; @@ -71,7 +71,7 @@ namespace NXml { } private: - void ParseFile(const TString& file); + void ParseFile(const TString& file); void ParseString(TZtStringBuf xml); TDocument(TDocHolder doc) @@ -83,10 +83,10 @@ namespace NXml { }; struct TNamespaceForXPath { - TString Prefix; - TString Url; + TString Prefix; + TString Url; }; - typedef TVector<TNamespaceForXPath> TNamespacesForXPath; + typedef TVector<TNamespaceForXPath> TNamespacesForXPath; class TConstNodes { private: @@ -411,12 +411,12 @@ namespace NXml { /** * get node name */ - TString Name() const; + TString Name() const; /** * get node xpath */ - TString Path() const; + TString Path() const; /** * get node xml representation @@ -662,7 +662,7 @@ namespace NXml { /** * get node name */ - TString Name() const { + TString Name() const { return ActualNode.Name(); } diff --git a/library/cpp/xml/document/xml-document.cpp b/library/cpp/xml/document/xml-document.cpp index 18a554d7321..17e7f784242 100644 --- a/library/cpp/xml/document/xml-document.cpp +++ b/library/cpp/xml/document/xml-document.cpp @@ -270,7 +270,7 @@ namespace NXml { return TNode(); } - TString TNode::Name() const { + TString TNode::Name() const { if (IsNull()) THROW(XmlException, "Node is null"); diff --git a/library/cpp/xml/document/xml-document_ut.cpp b/library/cpp/xml/document/xml-document_ut.cpp index 9f537b75c4c..c56d2110593 100644 --- a/library/cpp/xml/document/xml-document_ut.cpp +++ b/library/cpp/xml/document/xml-document_ut.cpp @@ -33,7 +33,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { UNIT_ASSERT_EQUAL(b.Attr<bool>("correct"), true); NXml::TConstNode text = root.Node("text"); - UNIT_ASSERT_EQUAL(text.Value<TString>(), "Некоторый текст"); + UNIT_ASSERT_EQUAL(text.Value<TString>(), "Некоторый текст"); } Y_UNIT_TEST(SerializeString) { NXml::TDocument xml("frob", NXml::TDocument::RootName); @@ -46,7 +46,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { authors.AddChild("zarf").SetValue("Andrew Plotkin"); authors.AddChild("emshort", "Emily Short"); - TString data = xml.ToString("utf-8"); + TString data = xml.ToString("utf-8"); UNIT_ASSERT_EQUAL(data, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<frob xyzzy=\"Frobozz\" kulness=\"0.3\" timelimit=\"3\">\n" " <authors>\n" @@ -57,9 +57,9 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { "</frob>\n"); // check default utf8 output with ru { - NXml::TDocument xml2("frob", NXml::TDocument::RootName); - xml2.Root().SetAttr("xyzzy", "привет =)"); - UNIT_ASSERT_VALUES_EQUAL(xml2.ToString(), "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + NXml::TDocument xml2("frob", NXml::TDocument::RootName); + xml2.Root().SetAttr("xyzzy", "привет =)"); + UNIT_ASSERT_VALUES_EQUAL(xml2.ToString(), "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<frob xyzzy=\"привет =)\"/>\n"); } } @@ -83,13 +83,13 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { UNIT_ASSERT_EQUAL(b.Attr<bool>("correct"), true); TConstNode text = root.Node("h:text", false, nss); - UNIT_ASSERT_EQUAL(text.Value<TString>(), "Некоторый текст"); + UNIT_ASSERT_EQUAL(text.Value<TString>(), "Некоторый текст"); // For performance you can create xpath context once using nss and pass it. TXPathContextPtr ctxt = root.CreateXPathContext(nss); UNIT_ASSERT(root.Node("text", true, *ctxt).IsNull()); UNIT_ASSERT_EXCEPTION(root.Node("text", false, *ctxt), yexception); - UNIT_ASSERT_EQUAL(root.Node("h:text", false, *ctxt).Value<TString>(), "Некоторый текст"); + UNIT_ASSERT_EQUAL(root.Node("h:text", false, *ctxt).Value<TString>(), "Некоторый текст"); } Y_UNIT_TEST(XmlNodes) { using namespace NXml; @@ -97,34 +97,34 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { "<root>qq<a><b>asdfg</b></a>ww<c></c></root>", NXml::TDocument::String); TNode root = xml.Root(); - UNIT_ASSERT_EQUAL(root.Value<TString>(), "qqasdfgww"); + UNIT_ASSERT_EQUAL(root.Value<TString>(), "qqasdfgww"); TConstNode node = root.FirstChild(); UNIT_ASSERT_EQUAL(node.IsText(), true); - UNIT_ASSERT_EQUAL(node.Value<TString>(), "qq"); + UNIT_ASSERT_EQUAL(node.Value<TString>(), "qq"); node = node.NextSibling(); UNIT_ASSERT_EQUAL(node.IsText(), false); UNIT_ASSERT_EQUAL(node.Name(), "a"); - UNIT_ASSERT_EQUAL(node.Value<TString>(), "asdfg"); + UNIT_ASSERT_EQUAL(node.Value<TString>(), "asdfg"); node = node.NextSibling(); UNIT_ASSERT_EQUAL(node.IsText(), true); - UNIT_ASSERT_EQUAL(node.Value<TString>(), "ww"); + UNIT_ASSERT_EQUAL(node.Value<TString>(), "ww"); node = node.NextSibling(); UNIT_ASSERT_EQUAL(node.IsText(), false); UNIT_ASSERT_EQUAL(node.Name(), "c"); - UNIT_ASSERT_EQUAL(node.Value<TString>(), ""); + UNIT_ASSERT_EQUAL(node.Value<TString>(), ""); node = node.NextSibling(); UNIT_ASSERT_EQUAL(node.IsNull(), true); TStringStream iterLog; for (const auto& node2 : root.Nodes("/root/*")) { - iterLog << node2.Name() << ';'; + iterLog << node2.Name() << ';'; } UNIT_ASSERT_STRINGS_EQUAL(iterLog.Str(), "a;c;"); // get only element nodes, ignore text nodes with empty "name" param - node = root.FirstChild(TString()); + node = root.FirstChild(TString()); UNIT_ASSERT_EQUAL(node.IsText(), false); UNIT_ASSERT_EQUAL(node.Name(), "a"); - node = node.NextSibling(TString()); + node = node.NextSibling(TString()); UNIT_ASSERT_EQUAL(node.IsText(), false); UNIT_ASSERT_EQUAL(node.Name(), "c"); @@ -148,7 +148,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { node = root.NextSibling("unknownnode"); UNIT_ASSERT_EQUAL(node.IsNull(), true); UNIT_ASSERT_EXCEPTION(node.Name(), yexception); - UNIT_ASSERT_EXCEPTION(node.Value<TString>(), yexception); + UNIT_ASSERT_EXCEPTION(node.Value<TString>(), yexception); UNIT_ASSERT_EXCEPTION(node.IsText(), yexception); } Y_UNIT_TEST(DefVal) { @@ -173,14 +173,14 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { "<a>second</a></root>", NXml::TDocument::String); UNIT_ASSERT_EXCEPTION(xml.Root().Node("/root/a/@x"), yexception); - UNIT_ASSERT_STRINGS_EQUAL(xml.Root().Node("/root/a").Value<TString>(), "first"); + UNIT_ASSERT_STRINGS_EQUAL(xml.Root().Node("/root/a").Value<TString>(), "first"); } Y_UNIT_TEST(CopyNode) { using namespace NXml; // default-construct empty node TNode empty; // put to container - TMap<int, TNode> nmap; + TMap<int, TNode> nmap; nmap[2]; // do copy @@ -255,11 +255,11 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { // We can use root node context for xpath evaluation in any node TConstNode c1 = b.Node("c", false, *rootCtxt); - UNIT_ASSERT_EQUAL(c1.Value<TString>(), "Hello, world!"); + UNIT_ASSERT_EQUAL(c1.Value<TString>(), "Hello, world!"); TXPathContextPtr bCtxt = b.CreateXPathContext(); TConstNode c2 = b.Node("c", false, *bCtxt); - UNIT_ASSERT_EQUAL(c2.Value<TString>(), "Hello, world!"); + UNIT_ASSERT_EQUAL(c2.Value<TString>(), "Hello, world!"); // Mixing contexts from different documents is forbidden TDocument otherXml("<root></root>", TDocument::String); diff --git a/library/cpp/xml/document/xml-textreader.cpp b/library/cpp/xml/document/xml-textreader.cpp index b946f1fbf2f..f7d64670c83 100644 --- a/library/cpp/xml/document/xml-textreader.cpp +++ b/library/cpp/xml/document/xml-textreader.cpp @@ -27,15 +27,15 @@ namespace NXml { return BoolResult(xmlTextReaderRead(Impl.Get())); } - TString TTextReader::ReadInnerXml() const { + TString TTextReader::ReadInnerXml() const { return TempStringOrEmptyResult(xmlTextReaderReadInnerXml(Impl.Get())); } - TString TTextReader::ReadOuterXml() const { + TString TTextReader::ReadOuterXml() const { return TempStringOrEmptyResult(xmlTextReaderReadOuterXml(Impl.Get())); } - TString TTextReader::ReadString() const { + TString TTextReader::ReadString() const { return TempStringOrEmptyResult(xmlTextReaderReadString(Impl.Get())); } @@ -109,7 +109,7 @@ namespace NXml { } } - TString TTextReader::GetAttribute(int number) const { + TString TTextReader::GetAttribute(int number) const { return TempStringResult(xmlTextReaderGetAttributeNo(Impl.Get(), number)); } @@ -166,7 +166,7 @@ namespace NXml { } // Callback for xmlReaderForIO() to read more data. - // It is almost "noexcept" (std::bad_alloc may happen when saving exception message to new TString). + // It is almost "noexcept" (std::bad_alloc may happen when saving exception message to new TString). // Waiting for std::exception_ptr and std::rethrow_exception from C++11 in Arcadia to make it really "noexcept". int TTextReader::ReadFromInputStreamCallback(void* context, char* buffer, int len) { Y_ASSERT(len >= 0); @@ -251,7 +251,7 @@ namespace NXml { return; } - const TString message = ErrorBuffer.Str(); + const TString message = ErrorBuffer.Str(); ErrorBuffer.clear(); IsError = false; @@ -298,16 +298,16 @@ namespace NXml { return (value != nullptr) ? TStringBuf(CAST2CHAR(value)) : TStringBuf(); } - TString TTextReader::TempStringResult(TCharPtr value) const { + TString TTextReader::TempStringResult(TCharPtr value) const { if (Y_UNLIKELY(value == nullptr)) { ThrowException(); } - return TString(CAST2CHAR(value.Get())); + return TString(CAST2CHAR(value.Get())); } - TString TTextReader::TempStringOrEmptyResult(TCharPtr value) const { + TString TTextReader::TempStringOrEmptyResult(TCharPtr value) const { CheckForExceptions(); - return (value != nullptr) ? TString(CAST2CHAR(value.Get())) : TString(); + return (value != nullptr) ? TString(CAST2CHAR(value.Get())) : TString(); } struct TTextReader::TDeleter { diff --git a/library/cpp/xml/document/xml-textreader.h b/library/cpp/xml/document/xml-textreader.h index ab4c329d26d..f0cba3182c4 100644 --- a/library/cpp/xml/document/xml-textreader.h +++ b/library/cpp/xml/document/xml-textreader.h @@ -10,7 +10,7 @@ #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <functional> #include <util/stream/input.h> #include <util/stream/str.h> @@ -91,21 +91,21 @@ namespace NXml { * @return A string containing the XML content, or an empty string * if the current node is neither an element nor attribute, or has no child nodes */ - TString ReadInnerXml() const; + TString ReadInnerXml() const; /** * Reads the current node and its contents, including child nodes and markup. * @return A string containing the XML content, or an empty string * if the current node is neither an element nor attribute */ - TString ReadOuterXml() const; + TString ReadOuterXml() const; /** * Reads the contents of an element or a text node as a string. * @return A string containing the contents of the Element or Text node, * or an empty string if the reader is positioned on any other type of node */ - TString ReadString() const; + TString ReadString() const; /** * Parses an attribute value into one or more Text and EntityReference nodes. @@ -216,7 +216,7 @@ namespace NXml { * Provides the value of the attribute with the specified index relative to the containing element. * @param number the zero-based index of the attribute relative to the containing element */ - TString GetAttribute(int number) const; + TString GetAttribute(int number) const; /** * Provides the value of the attribute with the specified qualified name. @@ -309,8 +309,8 @@ namespace NXml { char CharResult(int value) const; TStringBuf ConstStringResult(const xmlChar* value) const; TStringBuf ConstStringOrEmptyResult(const xmlChar* value) const; - TString TempStringResult(TCharPtr value) const; - TString TempStringOrEmptyResult(TCharPtr value) const; + TString TempStringResult(TCharPtr value) const; + TString TempStringOrEmptyResult(TCharPtr value) const; private: IInputStream& Stream; diff --git a/library/cpp/xml/document/xml-textreader_ut.cpp b/library/cpp/xml/document/xml-textreader_ut.cpp index 6232dfe47e2..32558b95e6a 100644 --- a/library/cpp/xml/document/xml-textreader_ut.cpp +++ b/library/cpp/xml/document/xml-textreader_ut.cpp @@ -10,10 +10,10 @@ namespace { /** * Simple wrapper around the xmlTextReader wrapper */ - void ParseXml(const TString& xmlData, + void ParseXml(const TString& xmlData, std::function<void(NXml::TConstNode)> nodeHandlerFunc, - const TString& localName, - const TString& namespaceUri = TString()) { + const TString& localName, + const TString& namespaceUri = TString()) { TStringInput in(xmlData); NXml::TTextReader reader(in); @@ -31,7 +31,7 @@ namespace { Y_UNIT_TEST_SUITE(TestXmlTextReader) { Y_UNIT_TEST(BasicExample) { - const TString xml = "<?xml version=\"1.0\"?>\n" + const TString xml = "<?xml version=\"1.0\"?>\n" "<example toto=\"1\">\n" " <examplechild id=\"1\">\n" " <child_of_child/>\n" @@ -49,21 +49,21 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { struct TItem { int Depth; ENT Type; - TString Name; - TString Attrs; - TString Value; + TString Name; + TString Attrs; + TString Value; }; - TVector<TItem> found; - TVector<TString> msgs; + TVector<TItem> found; + TVector<TString> msgs; while (reader.Read()) { // dump attributes as "k1: v1, k2: v2, ..." - TVector<TString> kv; + TVector<TString> kv; if (reader.HasAttributes()) { reader.MoveToFirstAttribute(); do { - kv.push_back(TString::Join(reader.GetName(), ": ", reader.GetValue())); + kv.push_back(TString::Join(reader.GetName(), ": ", reader.GetValue())); } while (reader.MoveToNextAttribute()); reader.MoveToElement(); } @@ -71,13 +71,13 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { found.push_back(TItem{ reader.GetDepth(), reader.GetNodeType(), - TString(reader.GetName()), + TString(reader.GetName()), JoinSeq(", ", kv), - reader.HasValue() ? TString(reader.GetValue()) : TString(), + reader.HasValue() ? TString(reader.GetValue()) : TString(), }); } - const TVector<TItem> expected = { + const TVector<TItem> expected = { TItem{0, ENT::Element, "example", "toto: 1", ""}, TItem{1, ENT::SignificantWhitespace, "#text", "", "\n "}, TItem{1, ENT::Element, "examplechild", "id: 1", ""}, @@ -107,7 +107,7 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { } } - const TString GEODATA = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + const TString GEODATA = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" "<root>" "" " <country id=\"225\">" @@ -136,22 +136,22 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { Y_UNIT_TEST(ParseXmlSimple) { struct TCountry { - TString Name; - TVector<TString> Cities; + TString Name; + TVector<TString> Cities; }; - THashMap<int, TCountry> data; + THashMap<int, TCountry> data; auto handler = [&data](NXml::TConstNode node) { const int id = node.Attr<int>("id"); TCountry& c = data[id]; - c.Name = node.FirstChild("name").Value<TString>(); + c.Name = node.FirstChild("name").Value<TString>(); const NXml::TConstNodes cityNodes = node.Nodes("cities/city"); for (auto cityNode : cityNodes) { - c.Cities.push_back(cityNode.Value<TString>()); + c.Cities.push_back(cityNode.Value<TString>()); } }; @@ -180,10 +180,10 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { } Y_UNIT_TEST(ParseXmlDeepLevel) { - TVector<TString> cities; + TVector<TString> cities; auto handler = [&cities](NXml::TConstNode node) { - cities.push_back(node.Value<TString>()); + cities.push_back(node.Value<TString>()); }; ParseXml(GEODATA, handler, "city"); @@ -211,7 +211,7 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { UNIT_ASSERT_EXCEPTION(ParseXml("<root><a id=\"1\"></a><a id=\"2></a></root>", handler, "a"), yexception); } - const TString BACKA = // UTF-8 encoding is used implicitly + const TString BACKA = // UTF-8 encoding is used implicitly "<Companies" " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" " xmlns=\"http://maps.yandex.ru/backa/1.x\"" @@ -259,18 +259,18 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { TNS{"xal", "urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"}}; int count = 0; - THashMap<TString, TString> positions; - THashMap<TString, TString> addresses; + THashMap<TString, TString> positions; + THashMap<TString, TString> addresses; auto handler = [&](NXml::TConstNode node) { count++; - const auto id = node.Attr<TString>("id"); + const auto id = node.Attr<TString>("id"); NXml::TXPathContextPtr ctxt = node.CreateXPathContext(ns); const NXml::TConstNode location = node.Node("b:Geo/b:Location", false, *ctxt); - positions[id] = location.Node("gml:pos", false, *ctxt).Value<TString>(); - addresses[id] = node.Node("b:Geo/xal:AddressDetails/xal:Country/xal:AddressLine", false, *ctxt).Value<TString>(); + positions[id] = location.Node("gml:pos", false, *ctxt).Value<TString>(); + addresses[id] = node.Node("b:Geo/xal:AddressDetails/xal:Country/xal:AddressLine", false, *ctxt).Value<TString>(); }; ParseXml(BACKA, handler, "Company"); diff --git a/library/cpp/xml/init/init.cpp b/library/cpp/xml/init/init.cpp index aa96c2dd317..a3992113930 100644 --- a/library/cpp/xml/init/init.cpp +++ b/library/cpp/xml/init/init.cpp @@ -28,7 +28,7 @@ namespace { xmlNewCharEncodingHandler("windows-1251", CharEncodingInput, nullptr); } - inline ~TLibXml2() { + inline ~TLibXml2() { xmlCleanupParser(); } }; diff --git a/library/cpp/xml/init/ptr.h b/library/cpp/xml/init/ptr.h index 7387c7cc40e..6fc431787a4 100644 --- a/library/cpp/xml/init/ptr.h +++ b/library/cpp/xml/init/ptr.h @@ -11,7 +11,7 @@ template <class T, void (*DestroyFun)(T*)> struct TFunctionDestroy { - static inline void Destroy(T* t) noexcept { + static inline void Destroy(T* t) noexcept { if (t) DestroyFun(t); } diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp index b39e0707187..d2deeeb7647 100644 --- a/library/cpp/yson/node/node.cpp +++ b/library/cpp/yson/node/node.cpp @@ -111,7 +111,7 @@ TNode::TNode(const std::string& s) : Value_(TString(s)) { } -TNode::TNode(TString s) +TNode::TNode(TString s) : Value_(std::move(s)) { } @@ -292,7 +292,7 @@ TNode::EType TNode::GetType() const }, Value_); } -const TString& TNode::AsString() const +const TString& TNode::AsString() const { CheckType(String); return std::get<TString>(Value_); @@ -322,25 +322,25 @@ bool TNode::AsBool() const return std::get<bool>(Value_); } -const TNode::TListType& TNode::AsList() const +const TNode::TListType& TNode::AsList() const { CheckType(List); return std::get<TListType>(Value_); } -const TNode::TMapType& TNode::AsMap() const +const TNode::TMapType& TNode::AsMap() const { CheckType(Map); return std::get<TMapType>(Value_); } -TNode::TListType& TNode::AsList() +TNode::TListType& TNode::AsList() { CheckType(List); return std::get<TListType>(Value_); } -TNode::TMapType& TNode::AsMap() +TNode::TMapType& TNode::AsMap() { CheckType(Map); return std::get<TMapType>(Value_); @@ -371,22 +371,22 @@ bool TNode::UncheckedAsBool() const noexcept return std::get<bool>(Value_); } -const TNode::TListType& TNode::UncheckedAsList() const noexcept +const TNode::TListType& TNode::UncheckedAsList() const noexcept { return std::get<TListType>(Value_); } -const TNode::TMapType& TNode::UncheckedAsMap() const noexcept +const TNode::TMapType& TNode::UncheckedAsMap() const noexcept { return std::get<TMapType>(Value_); } -TNode::TListType& TNode::UncheckedAsList() noexcept +TNode::TListType& TNode::UncheckedAsList() noexcept { return std::get<TListType>(Value_); } -TNode::TMapType& TNode::UncheckedAsMap() noexcept +TNode::TMapType& TNode::UncheckedAsMap() noexcept { return std::get<TMapType>(Value_); } @@ -526,7 +526,7 @@ const TNode& TNode::operator[](const TStringBuf key) const CheckType(Map); static TNode notFound; const auto& map = std::get<TMapType>(Value_); - TMapType::const_iterator i = map.find(key); + TMapType::const_iterator i = map.find(key); if (i == map.end()) { return notFound; } else { @@ -829,7 +829,7 @@ void TNode::CheckType(EType type) const void TNode::AssureMap() { if (std::holds_alternative<TUndefined>(Value_)) { - Value_ = TMapType(); + Value_ = TMapType(); } else { CheckType(Map); } @@ -838,7 +838,7 @@ void TNode::AssureMap() void TNode::AssureList() { if (std::holds_alternative<TUndefined>(Value_)) { - Value_ = TListType(); + Value_ = TListType(); } else { CheckType(List); } @@ -847,7 +847,7 @@ void TNode::AssureList() void TNode::CreateAttributes() { Attributes_ = MakeHolder<TNode>(); - Attributes_->Value_ = TMapType(); + Attributes_->Value_ = TMapType(); } void TNode::Save(IOutputStream* out) const diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h index 5f90f95df07..c82e846adf5 100644 --- a/library/cpp/yson/node/node.h +++ b/library/cpp/yson/node/node.h @@ -45,8 +45,8 @@ public: Null = 8 /*"null"*/, }; - using TListType = TVector<TNode>; - using TMapType = THashMap<TString, TNode>; + using TListType = TVector<TNode>; + using TMapType = THashMap<TString, TNode>; private: struct TNull { @@ -62,9 +62,9 @@ private: i64, ui64, double, - TString, - TListType, - TMapType, + TString, + TListType, + TMapType, TNull, TUndefined >; @@ -76,7 +76,7 @@ public: TNode(TStringBuf s); explicit TNode(std::string_view s); explicit TNode(const std::string& s); - TNode(TString s); + TNode(TString s); TNode(int i); //this case made speccially for prevent mess cast of EType into TNode through TNode(int) constructor @@ -139,25 +139,25 @@ public: EType GetType() const; - const TString& AsString() const; + const TString& AsString() const; i64 AsInt64() const; ui64 AsUint64() const; double AsDouble() const; bool AsBool() const; - const TListType& AsList() const; - const TMapType& AsMap() const; - TListType& AsList(); - TMapType& AsMap(); + const TListType& AsList() const; + const TMapType& AsMap() const; + TListType& AsList(); + TMapType& AsMap(); const TString& UncheckedAsString() const noexcept; i64 UncheckedAsInt64() const noexcept; ui64 UncheckedAsUint64() const noexcept; double UncheckedAsDouble() const noexcept; bool UncheckedAsBool() const noexcept; - const TListType& UncheckedAsList() const noexcept; - const TMapType& UncheckedAsMap() const noexcept; - TListType& UncheckedAsList() noexcept; - TMapType& UncheckedAsMap() noexcept; + const TListType& UncheckedAsList() const noexcept; + const TMapType& UncheckedAsMap() const noexcept; + TListType& UncheckedAsList() noexcept; + TMapType& UncheckedAsMap() noexcept; // integer types cast // makes overflow checks diff --git a/library/cpp/yson/node/node_builder.cpp b/library/cpp/yson/node/node_builder.cpp index b4431bc77af..25fcb0f1f8f 100644 --- a/library/cpp/yson/node/node_builder.cpp +++ b/library/cpp/yson/node/node_builder.cpp @@ -61,7 +61,7 @@ void TNodeBuilder::OnBeginMap() void TNodeBuilder::OnKeyedItem(TStringBuf key) { - Stack_.push(&(*Stack_.top())[TString(key)]); + Stack_.push(&(*Stack_.top())[TString(key)]); } void TNodeBuilder::OnEndMap() diff --git a/library/cpp/yson/node/node_builder.h b/library/cpp/yson/node/node_builder.h index 69800016e09..0190870f917 100644 --- a/library/cpp/yson/node/node_builder.h +++ b/library/cpp/yson/node/node_builder.h @@ -35,7 +35,7 @@ public: void OnNode(TNode node); private: - TStack<TNode*> Stack_; + TStack<TNode*> Stack_; private: inline void AddNode(TNode node, bool pop); diff --git a/library/cpp/yson/node/node_visitor.cpp b/library/cpp/yson/node/node_visitor.cpp index 899fbfa02aa..69a66cc4ed8 100644 --- a/library/cpp/yson/node/node_visitor.cpp +++ b/library/cpp/yson/node/node_visitor.cpp @@ -112,7 +112,7 @@ void TNodeVisitor::VisitBool(const TNode& node) Consumer_->OnBooleanScalar(node.AsBool()); } -void TNodeVisitor::VisitList(const TNode::TListType& nodeList) +void TNodeVisitor::VisitList(const TNode::TListType& nodeList) { Consumer_->OnBeginList(); size_t index = 0; @@ -128,7 +128,7 @@ void TNodeVisitor::VisitList(const TNode::TListType& nodeList) Consumer_->OnEndList(); } -void TNodeVisitor::VisitMap(const TNode::TMapType& nodeMap) +void TNodeVisitor::VisitMap(const TNode::TMapType& nodeMap) { Consumer_->OnBeginMap(); Iterate(nodeMap, SortMapKeys_, [&](const std::pair<TString, TNode>& item) { diff --git a/library/cpp/yson/node/node_visitor.h b/library/cpp/yson/node/node_visitor.h index db258323092..927df5d9e76 100644 --- a/library/cpp/yson/node/node_visitor.h +++ b/library/cpp/yson/node/node_visitor.h @@ -14,8 +14,8 @@ public: TNodeVisitor(NYson::IYsonConsumer* consumer, bool sortMapKeys = false); void Visit(const TNode& node); - void VisitMap(const TNode::TMapType& nodeMap); - void VisitList(const TNode::TListType& nodeMap); + void VisitMap(const TNode::TMapType& nodeMap); + void VisitList(const TNode::TListType& nodeMap); private: NYson::IYsonConsumer* Consumer_; diff --git a/library/cpp/yson_pull/detail/cescape.h b/library/cpp/yson_pull/detail/cescape.h index 1ea150e69aa..738e8ec32f4 100644 --- a/library/cpp/yson_pull/detail/cescape.h +++ b/library/cpp/yson_pull/detail/cescape.h @@ -6,7 +6,7 @@ #include "macros.h" #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> /* REFERENCES FOR ESCAPE SEQUENCE INTERPRETATION: @@ -38,7 +38,7 @@ namespace NYsonPull { namespace NDetail { namespace NCEscape { - inline void encode(TString& dest, TStringBuf data) { + inline void encode(TString& dest, TStringBuf data) { NImpl::escape_impl( reinterpret_cast<const ui8*>(data.data()), data.size(), @@ -78,14 +78,14 @@ namespace NYsonPull { } } - inline TString encode(TStringBuf data) { - TString result; + inline TString encode(TStringBuf data) { + TString result; result.reserve(data.size()); encode(result, data); return result; } - inline void decode(TString& dest, TStringBuf data) { + inline void decode(TString& dest, TStringBuf data) { NImpl::unescape_impl( reinterpret_cast<const ui8*>(data.begin()), reinterpret_cast<const ui8*>(data.end()), @@ -97,7 +97,7 @@ namespace NYsonPull { }); } - inline void decode_inplace(TVector<ui8>& data) { + inline void decode_inplace(TVector<ui8>& data) { auto* out = static_cast<ui8*>( ::memchr(data.data(), '\\', data.size())); if (out == nullptr) { @@ -116,16 +116,16 @@ namespace NYsonPull { data.resize(out - &data[0]); } - inline TString decode(TStringBuf data) { - TString result; + inline TString decode(TStringBuf data) { + TString result; result.reserve(data.size()); decode(result, data); return result; } ATTRIBUTE(noinline, cold) - inline TString quote(TStringBuf str) { - TString result; + inline TString quote(TStringBuf str) { + TString result; result.reserve(str.size() + 16); result += '"'; encode(result, str); @@ -134,7 +134,7 @@ namespace NYsonPull { } ATTRIBUTE(noinline, cold) - inline TString quote(ui8 ch) { + inline TString quote(ui8 ch) { char c = ch; return quote(TStringBuf(&c, 1)); } diff --git a/library/cpp/yson_pull/detail/format_string.h b/library/cpp/yson_pull/detail/format_string.h index 683fd1bf361..57bc2697ae1 100644 --- a/library/cpp/yson_pull/detail/format_string.h +++ b/library/cpp/yson_pull/detail/format_string.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/builder.h> namespace NYsonPull { @@ -17,10 +17,10 @@ namespace NYsonPull { } template <typename... Args> - TString format_string(Args&&... args) { + TString format_string(Args&&... args) { TStringBuilder builder; NImpl::apply_args(builder, std::forward<Args>(args)...); - return TString(std::move(builder)); + return TString(std::move(builder)); } } } diff --git a/library/cpp/yson_pull/detail/input/stream.h b/library/cpp/yson_pull/detail/input/stream.h index 791cd5a3f52..abe495aa478 100644 --- a/library/cpp/yson_pull/detail/input/stream.h +++ b/library/cpp/yson_pull/detail/input/stream.h @@ -57,10 +57,10 @@ namespace NYsonPull { } }; - class TFHandle: public TOwned<TFileInput> { + class TFHandle: public TOwned<TFileInput> { public: TFHandle(int fd, size_t buffer_size) - : TOwned<TFileInput>(Duplicate(fd), buffer_size) + : TOwned<TFileInput>(Duplicate(fd), buffer_size) { } }; diff --git a/library/cpp/yson_pull/detail/lexer_base.h b/library/cpp/yson_pull/detail/lexer_base.h index 572bdb3d18b..525304ec8ee 100644 --- a/library/cpp/yson_pull/detail/lexer_base.h +++ b/library/cpp/yson_pull/detail/lexer_base.h @@ -19,7 +19,7 @@ namespace NYsonPull { using Base = byte_reader< stream_counter<EnableLinePositionInfo>>; - TVector<ui8> token_buffer_; + TVector<ui8> token_buffer_; TMaybe<size_t> memory_limit_; public: diff --git a/library/cpp/yson_pull/detail/output/stream.h b/library/cpp/yson_pull/detail/output/stream.h index d4810f33538..4c5ca4db827 100644 --- a/library/cpp/yson_pull/detail/output/stream.h +++ b/library/cpp/yson_pull/detail/output/stream.h @@ -44,10 +44,10 @@ namespace NYsonPull { } }; - class TFHandle: public TOwned<TUnbufferedFileOutput> { + class TFHandle: public TOwned<TUnbufferedFileOutput> { public: TFHandle(int fd, size_t buffer_size) - : TOwned<TUnbufferedFileOutput>(buffer_size, Duplicate(fd)) + : TOwned<TUnbufferedFileOutput>(buffer_size, Duplicate(fd)) { } }; diff --git a/library/cpp/yson_pull/detail/reader.h b/library/cpp/yson_pull/detail/reader.h index 0e023963581..655d450b8e7 100644 --- a/library/cpp/yson_pull/detail/reader.h +++ b/library/cpp/yson_pull/detail/reader.h @@ -188,7 +188,7 @@ namespace NYsonPull { lexer_base<EnableLinePositionInfo> lexer_; state state_; TEvent event_; - TVector<EEventType> stack_; + TVector<EEventType> stack_; EStreamType mode_; public: diff --git a/library/cpp/yson_pull/detail/writer.h b/library/cpp/yson_pull/detail/writer.h index b24b9942927..4b3238ec336 100644 --- a/library/cpp/yson_pull/detail/writer.h +++ b/library/cpp/yson_pull/detail/writer.h @@ -32,7 +32,7 @@ namespace NYsonPull { }; byte_writer<stream_counter<false>> stream_; - TVector<EEventType> stack_; + TVector<EEventType> stack_; bool need_item_separator_ = false; EStreamType mode_ = EStreamType::ListFragment; state state_ = state::before_begin; diff --git a/library/cpp/yson_pull/exceptions.h b/library/cpp/yson_pull/exceptions.h index ebfed950a54..2d651990f89 100644 --- a/library/cpp/yson_pull/exceptions.h +++ b/library/cpp/yson_pull/exceptions.h @@ -2,7 +2,7 @@ #include "position_info.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <stdexcept> #include <string> @@ -10,13 +10,13 @@ namespace NYsonPull { namespace NException { class TBadStream: public std::exception { - TString Message_; + TString Message_; TPositionInfo Position_; - mutable TString FormattedMessage_; + mutable TString FormattedMessage_; public: TBadStream( - TString message, + TString message, const TPositionInfo& position) : Message_(std::move(message)) , Position_(position) diff --git a/library/cpp/yson_pull/output.cpp b/library/cpp/yson_pull/output.cpp index 27c9ef9e694..5b01023e378 100644 --- a/library/cpp/yson_pull/output.cpp +++ b/library/cpp/yson_pull/output.cpp @@ -20,7 +20,7 @@ THolder<IStream> NOutput::FromPosixFd(int fd, size_t buffer_size) { return MakeHolder<TFHandle>(fd, buffer_size); } -THolder<IStream> NOutput::FromString(TString* output, size_t buffer_size) { +THolder<IStream> NOutput::FromString(TString* output, size_t buffer_size) { return MakeHolder<TOwned<TStringOutput>>(buffer_size, *output); } diff --git a/library/cpp/yson_pull/output.h b/library/cpp/yson_pull/output.h index 2d78107a93f..ba1c1bee319 100644 --- a/library/cpp/yson_pull/output.h +++ b/library/cpp/yson_pull/output.h @@ -60,6 +60,6 @@ namespace NYsonPull { THolder<IStream> FromOutputStream(IOutputStream* output, size_t buffer_size = 65536); - THolder<IStream> FromString(TString* output, size_t buffer_size = 1024); + THolder<IStream> FromString(TString* output, size_t buffer_size = 1024); } } diff --git a/library/cpp/yson_pull/read_ops.h b/library/cpp/yson_pull/read_ops.h index 5c084983ead..125f6c9a579 100644 --- a/library/cpp/yson_pull/read_ops.h +++ b/library/cpp/yson_pull/read_ops.h @@ -119,8 +119,8 @@ namespace NYsonPull { } template <> - inline TString ReadScalar<TString>(TReader& reader) { - return TString(ReadScalar<TStringBuf>(reader)); + inline TString ReadScalar<TString>(TReader& reader) { + return TString(ReadScalar<TStringBuf>(reader)); } template <> diff --git a/library/cpp/yson_pull/ut/cescape_ut.cpp b/library/cpp/yson_pull/ut/cescape_ut.cpp index 6628ba1d156..d0f65be3fe1 100644 --- a/library/cpp/yson_pull/ut/cescape_ut.cpp +++ b/library/cpp/yson_pull/ut/cescape_ut.cpp @@ -5,7 +5,7 @@ using namespace NYsonPull::NDetail; namespace { - void test_roundtrip(const TVector<ui8>& str) { + void test_roundtrip(const TVector<ui8>& str) { TStringBuf str_buf( reinterpret_cast<const char*>(str.data()), str.size()); @@ -19,7 +19,7 @@ namespace { } template <size_t N> - void test_exhaustive(TVector<ui8>& str) { + void test_exhaustive(TVector<ui8>& str) { for (int i = 0; i < 256; ++i) { str[str.size() - N] = static_cast<char>(i); test_exhaustive<N - 1>(str); @@ -27,13 +27,13 @@ namespace { } template <> - void test_exhaustive<0>(TVector<ui8>& str) { + void test_exhaustive<0>(TVector<ui8>& str) { test_roundtrip(str); } template <size_t N> void test_exhaustive() { - TVector<ui8> str(N, ' '); + TVector<ui8> str(N, ' '); test_exhaustive<N>(str); } diff --git a/library/cpp/yson_pull/ut/loop_ut.cpp b/library/cpp/yson_pull/ut/loop_ut.cpp index 8c7b11dd1cd..361c3df8ca5 100644 --- a/library/cpp/yson_pull/ut/loop_ut.cpp +++ b/library/cpp/yson_pull/ut/loop_ut.cpp @@ -215,7 +215,7 @@ namespace { template <typename Function> void test_memory(Function make_writer, size_t nrepeat) { - TString text; + TString text; { auto writer = make_writer(NYsonPull::NOutput::FromString(&text)); generate(writer, nrepeat); diff --git a/library/cpp/yson_pull/ut/writer_ut.cpp b/library/cpp/yson_pull/ut/writer_ut.cpp index 5c304bad0f3..da204696978 100644 --- a/library/cpp/yson_pull/ut/writer_ut.cpp +++ b/library/cpp/yson_pull/ut/writer_ut.cpp @@ -3,7 +3,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <climits> #include <limits> @@ -12,8 +12,8 @@ using namespace std::string_view_literals; namespace { template <typename Writer, typename Function> - TString with_writer(Function&& function) { - TString result; + TString with_writer(Function&& function) { + TString result; auto writer = NYsonPull::NDetail::make_writer<Writer>( NYsonPull::NOutput::FromString(&result), NYsonPull::EStreamType::Node); @@ -24,19 +24,19 @@ namespace { } template <typename Writer> - TString to_yson_string(const NYsonPull::TScalar& value) { + TString to_yson_string(const NYsonPull::TScalar& value) { return with_writer<Writer>([&](NYsonPull::TWriter& writer) { writer.BeginStream().Scalar(value).EndStream(); }); } template <typename T> - TString to_yson_binary_string(T&& value) { + TString to_yson_binary_string(T&& value) { return to_yson_string<NYsonPull::NDetail::TBinaryWriterImpl>(std::forward<T>(value)); } template <typename T> - TString to_yson_text_string(T&& value) { + TString to_yson_text_string(T&& value) { return to_yson_string<NYsonPull::NDetail::TTextWriterImpl>(std::forward<T>(value)); } diff --git a/library/python/runtime_py3/__res.pyx b/library/python/runtime_py3/__res.pyx index 97190d9f293..5b2681ccdc8 100644 --- a/library/python/runtime_py3/__res.pyx +++ b/library/python/runtime_py3/__res.pyx @@ -22,7 +22,7 @@ def key_by_index(idx): def find(s): - cdef TString res + cdef TString res if isinstance(s, str): s = utf_8_encode(s)[0] diff --git a/library/python/runtime_py3/ya.make b/library/python/runtime_py3/ya.make index fa5c11341ad..58f9b236de0 100644 --- a/library/python/runtime_py3/ya.make +++ b/library/python/runtime_py3/ya.make @@ -6,8 +6,8 @@ OWNER( pg ) -NO_WSHADOW() - +NO_WSHADOW() + PEERDIR( contrib/tools/python3/src contrib/tools/python3/lib/py diff --git a/library/python/ya.make b/library/python/ya.make index 2e1eb6e0e1f..f0afabb7d1b 100644 --- a/library/python/ya.make +++ b/library/python/ya.make @@ -143,8 +143,8 @@ RECURSE( pytest pytest-mongodb pytest/allure - pytest/empty - pytest/plugins + pytest/empty + pytest/plugins python-blackboxer python-django-tanker python-django-yauth/tests diff --git a/tools/archiver/main.cpp b/tools/archiver/main.cpp index 6cda54c1ea8..30ffea8aabd 100644 --- a/tools/archiver/main.cpp +++ b/tools/archiver/main.cpp @@ -48,7 +48,7 @@ namespace { private: IOutputStream& Slave; const size_t Stride; - TString Buf; + TString Buf; }; class THexOutput: public IOutputStream { @@ -158,7 +158,7 @@ namespace { } IOutputStream* Out_ = nullptr; - const TString Base_; + const TString Base_; ui64 Count_ = 0; }; @@ -177,7 +177,7 @@ namespace { *Slave() << "\n};\nextern const unsigned int " << B << "Size = sizeof(" << B << ") / sizeof(" << B << "[0]);\n}\n"; } - const TString B; + const TString B; }; struct TCStringOutput: public IOutputStream { @@ -192,7 +192,7 @@ namespace { } void DoWrite(const void* data, size_t len) override { - *O << TString((const char*)data, len).Quote() << '\n'; + *O << TString((const char*)data, len).Quote() << '\n'; } void DoFinish() override { @@ -201,7 +201,7 @@ namespace { } IOutputStream* O = nullptr; - const TString B; + const TString B; }; struct TMyFileComparator { @@ -228,7 +228,7 @@ namespace { return res < 0; } - mutable THashMap<std::pair<TString, TString>, int> SavedResults; + mutable THashMap<std::pair<TString, TString>, int> SavedResults; }; struct TDuplicatesMap { @@ -241,14 +241,14 @@ namespace { void Finish() { Y_ENSURE(!InitialFillingDone); InitialFillingDone = true; - TMap<i64, TVector<TString>> bySize; + TMap<i64, TVector<TString>> bySize; for (const TString& fname: FileNames) { TFile file(fname, OpenExisting | RdOnly); bySize[file.GetLength()].push_back(fname); } for (const auto& bySizeElement: bySize) { if (bySizeElement.second.size() > 1) { - TMap<TString, TVector<TString>, TMyFileComparator> byContents; + TMap<TString, TVector<TString>, TMyFileComparator> byContents; for (const TString& fname: bySizeElement.second) { byContents[fname].push_back(fname); } @@ -270,9 +270,9 @@ namespace { } bool InitialFillingDone = false; - TVector<TString> FileNames; - THashMap<TString, TString> FileNameToRecordName; - THashMap<TString, TString> Synonyms; + TVector<TString> FileNames; + THashMap<TString, TString> FileNameToRecordName; + THashMap<TString, TString> Synonyms; }; struct TDeduplicationArchiveWriter { @@ -292,9 +292,9 @@ namespace { static inline TAutoPtr<IOutputStream> OpenOutput(const TString& url) { if (url.empty()) { - return new TBuffered<TUnbufferedFileOutput>(8192, Duplicate(1)); + return new TBuffered<TUnbufferedFileOutput>(8192, Duplicate(1)); } else { - return new TBuffered<TUnbufferedFileOutput>(8192, url); + return new TBuffered<TUnbufferedFileOutput>(8192, url); } } @@ -302,7 +302,7 @@ static inline bool IsDelim(char ch) noexcept { return ch == '/' || ch == '\\'; } -static inline TString GetFile(const TString& s) { +static inline TString GetFile(const TString& s) { const char* e = s.end(); const char* b = s.begin(); const char* c = e - 1; @@ -315,10 +315,10 @@ static inline TString GetFile(const TString& s) { ++c; } - return TString(c, e - c); + return TString(c, e - c); } -static inline TString Fix(TString f) { +static inline TString Fix(TString f) { if (!f.empty() && IsDelim(f[f.size() - 1])) { f.pop_back(); } @@ -358,9 +358,9 @@ static inline void Append(TDeduplicationArchiveWriter& w, const TString& fname, namespace { struct TRec { bool Recursive = false; - TString Key; - TString Path; - TString Prefix; + TString Key; + TString Path; + TString Prefix; TRec() = default; @@ -379,18 +379,18 @@ namespace { } template <typename T> - inline void DoRecurse(T& w, const TString& off) const { + inline void DoRecurse(T& w, const TString& off) const { { TFileList fl; const char* name; - const TString p = Path + off; + const TString p = Path + off; fl.Fill(p, true); while ((name = fl.Next())) { - const TString fname = p + name; - const TString rname = Prefix + off + name; + const TString fname = p + name; + const TString rname = Prefix + off + name; Append(w, fname, rname); } @@ -400,7 +400,7 @@ namespace { TDirsList dl; const char* name; - const TString p = Path + off; + const TString p = Path + off; dl.Fill(p, true); @@ -427,7 +427,7 @@ struct TMappingReader { TBlob Blob; TArchiveReader Reader; - TMappingReader(const TString& archive) + TMappingReader(const TString& archive) : Map(archive) , Blob(TBlob::FromMemoryMapSingleThreaded(Map, 0, Map.Length())) , Reader(Blob) @@ -435,12 +435,12 @@ struct TMappingReader { } }; -static void UnpackArchive(const TString& archive, const TFsPath& dir = TFsPath()) { +static void UnpackArchive(const TString& archive, const TFsPath& dir = TFsPath()) { TMappingReader mappingReader(archive); const TArchiveReader& reader = mappingReader.Reader; const size_t count = reader.Count(); for (size_t i = 0; i < count; ++i) { - const TString key = reader.KeyByIndex(i); + const TString key = reader.KeyByIndex(i); const TString fileName = CutFirstSlash(key); if (!Quiet) { Cerr << archive << " --> " << fileName << Endl; @@ -448,7 +448,7 @@ static void UnpackArchive(const TString& archive, const TFsPath& dir = TFsPath() const TFsPath path(dir / fileName); path.Parent().MkDirs(); TAutoPtr<IInputStream> in = reader.ObjectByKey(key); - TFixedBufferFileOutput out(path); + TFixedBufferFileOutput out(path); TransferData(in.Get(), &out); out.Finish(); } @@ -459,7 +459,7 @@ static void ListArchive(const TString& archive, bool cutSlash) { const TArchiveReader& reader = mappingReader.Reader; const size_t count = reader.Count(); for (size_t i = 0; i < count; ++i) { - const TString key = reader.KeyByIndex(i); + const TString key = reader.KeyByIndex(i); TString fileName = key; if (cutSlash) { fileName = CutFirstSlash(key); @@ -473,7 +473,7 @@ static void ListArchiveMd5(const TString& archive, bool cutSlash) { const TArchiveReader& reader = mappingReader.Reader; const size_t count = reader.Count(); for (size_t i = 0; i < count; ++i) { - const TString key = reader.KeyByIndex(i); + const TString key = reader.KeyByIndex(i); TString fileName = key; if (cutSlash) { fileName = CutFirstSlash(key); @@ -558,38 +558,38 @@ int main(int argc, char** argv) { .Optional() .StoreValue(&Quiet, true); - TString prepend; + TString prepend; opts.AddLongOption('z', "prepend", "Prepend string to output") .RequiredArgument("<prefix>") .StoreResult(&prepend); - TString append; + TString append; opts.AddLongOption('a', "append", "Append string to output") .RequiredArgument("<suffix>") .StoreResult(&append); - TString outputf; + TString outputf; opts.AddLongOption('o', "output", "Output to file instead stdout") .RequiredArgument("<file>") .StoreResult(&outputf); - TString unpackDir; + TString unpackDir; opts.AddLongOption('d', "unpackdir", "Unpack destination directory") .RequiredArgument("<dir>") .DefaultValue(".") .StoreResult(&unpackDir); - TString yasmBase; + TString yasmBase; opts.AddLongOption('A', "yasm", "Output dump is yasm format") .RequiredArgument("<base>") .StoreResult(&yasmBase); - TString cppBase; + TString cppBase; opts.AddLongOption('C', "cpp", "Output dump is C/C++ format") .RequiredArgument("<base>") .StoreResult(&cppBase); - TString forceKeys; + TString forceKeys; opts.AddLongOption('k', "keys", "Set explicit list of keys for elements") .RequiredArgument("<keys>") .StoreResult(&forceKeys); @@ -601,10 +601,10 @@ int main(int argc, char** argv) { SubstGlobal(append, "\\n", "\n"); SubstGlobal(prepend, "\\n", "\n"); - TVector<TRec> recs; + TVector<TRec> recs; const auto& files = optsRes.GetFreeArgs(); - TVector<TStringBuf> keys; + TVector<TStringBuf> keys; if (forceKeys.size()) StringSplitter(forceKeys).Split(':').SkipEmpty().Collect(&keys); @@ -623,7 +623,7 @@ int main(int argc, char** argv) { const size_t pos = path.find(':', off); TRec cur; cur.Path = path.substr(0, pos); - if (pos != TString::npos) + if (pos != TString::npos) cur.Prefix = path.substr(pos + 1); if (keys.size()) cur.Key = keys[i]; diff --git a/tools/enum_parser/enum_parser/main.cpp b/tools/enum_parser/enum_parser/main.cpp index 0943c69c1da..dbbc8ab4b4a 100644 --- a/tools/enum_parser/enum_parser/main.cpp +++ b/tools/enum_parser/enum_parser/main.cpp @@ -16,7 +16,7 @@ #include <util/string/join.h> #include <util/string/subst.h> #include <util/generic/map.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/ptr.h> #include <util/generic/yexception.h> @@ -31,23 +31,23 @@ void WriteHeader(const TString& headerName, IOutputStream& out, IOutputStream* h out << "#include <tools/enum_parser/enum_parser/stdlib_deps.h>\n\n"; out << "#include <util/generic/typetraits.h>\n"; out << "#include <util/generic/singleton.h>\n"; - out << "#include <util/generic/string.h>\n"; + out << "#include <util/generic/string.h>\n"; out << "#include <util/generic/vector.h>\n"; out << "#include <util/generic/map.h>\n"; out << "#include <util/generic/serialized_enum.h>\n"; out << "#include <util/string/cast.h>\n"; out << "#include <util/stream/output.h>\n\n"; - - if (headerOutPtr) { - auto& outHeader = *headerOutPtr; - outHeader << "// This file was auto-generated. Do not edit!!!\n"; - outHeader << "#pragma once\n\n"; - outHeader << "#include <util/generic/serialized_enum.h>\n"; - outHeader << "#include " << headerName << "\n"; - } + + if (headerOutPtr) { + auto& outHeader = *headerOutPtr; + outHeader << "// This file was auto-generated. Do not edit!!!\n"; + outHeader << "#pragma once\n\n"; + outHeader << "#include <util/generic/serialized_enum.h>\n"; + outHeader << "#include " << headerName << "\n"; + } } -static inline void JsonEscape(TString& s) { +static inline void JsonEscape(TString& s) { SubstGlobal(s, "\\", "\\\\"); SubstGlobal(s, "\"", "\\\""); SubstGlobal(s, "\r", "\\r"); @@ -55,8 +55,8 @@ static inline void JsonEscape(TString& s) { SubstGlobal(s, "\t", "\\t"); } -static inline TString JsonQuote(const TString& s) { - TString quoted = s; +static inline TString JsonQuote(const TString& s) { + TString quoted = s; JsonEscape(quoted); return "\"" + quoted + "\""; // do not use .Quote() here, it performs escaping! } @@ -65,7 +65,7 @@ static inline TString JsonQuote(const TString& s) { /// Simplifed JSON map encoder for generic types template<typename T> void OutKey(IOutputStream& out, const TString& key, const T& value, bool escape = true) { - TString quoted = ToString(value); + TString quoted = ToString(value); if (escape) { quoted = JsonQuote(quoted); } @@ -74,7 +74,7 @@ void OutKey(IOutputStream& out, const TString& key, const T& value, bool escape /// Simplifed JSON map encoder for TMaybe void OutKey(IOutputStream& out, const TString& key, const TMaybe<TString>& value) { - TString quoted; + TString quoted; if (value) { quoted = JsonQuote(ToString(*value)); } else { @@ -93,7 +93,7 @@ void OutKey(IOutputStream& out, const TString& key, const bool& value) { /// Simplifed JSON map encoder for array items template<typename T> void OutItem(IOutputStream& out, const T& value, bool escape = true) { - TString quoted = ToString(value); + TString quoted = ToString(value); if (escape) { quoted = JsonQuote(quoted); } @@ -102,7 +102,7 @@ void OutItem(IOutputStream& out, const T& value, bool escape = true) { /// Cut trailing ",\n" or "," static inline void FinishItems(TStringStream& out) { - TString& s = out.Str(); + TString& s = out.Str(); if (s.EndsWith(",\n")) { s.remove(s.size() - 2, 2); } @@ -143,7 +143,7 @@ void GenerateEnum( size_t count = en.Items.size(); OutKey(jEnum, "count", count); - const TString name = TEnumParser::ScopeStr(en.Scope) + en.CppName; + const TString name = TEnumParser::ScopeStr(en.Scope) + en.CppName; OutKey(jEnum, "full_name", name); OutKey(jEnum, "cpp_name", en.CppName); TStringStream scopeJson; @@ -162,20 +162,20 @@ void GenerateEnum( outerScope.push_back(en.CppName); } - TString outerScopeStr = TEnumParser::ScopeStr(outerScope); + TString outerScopeStr = TEnumParser::ScopeStr(outerScope); - TString cName = name; + TString cName = name; SubstGlobal(cName, "::", ""); out << "// I/O for " << name << "\n"; - TString nsName = "N" + cName + "Private"; + TString nsName = "N" + cName + "Private"; out << "namespace { namespace " << nsName << " {\n"; - TVector<TString> nameInitializerPairs; - TVector<TString> valueInitializerPairs; - TVector<TString> cppNamesInitializer; + TVector<TString> nameInitializerPairs; + TVector<TString> valueInitializerPairs; + TVector<TString> cppNamesInitializer; TStringStream jItems; OpenArray(jItems); @@ -191,7 +191,7 @@ void GenerateEnum( TStringStream jAliases; OpenArray(jAliases); - TString strValue = it.CppName; + TString strValue = it.CppName; if (it.Aliases) { // first alias is main strValue = it.Aliases[0]; @@ -280,7 +280,7 @@ void GenerateEnum( if (headerOutPtr) { (*headerOutPtr) << "const TString& ToString(" << name << ");\n"; } - out << "const TString& ToString(" << name << " x) {\n"; + out << "const TString& ToString(" << name << " x) {\n"; out << " const " << nsName << "::TNameBufs& names = " << nsName << "::TNameBufs::Instance();\n"; out << " return names.ToString(x);\n"; out << "}\n\n"; @@ -289,7 +289,7 @@ void GenerateEnum( if (headerOutPtr) { (*headerOutPtr) << "bool FromString(const TString& name, " << name << "& ret);\n"; } - out << "bool FromString(const TString& name, " << name << "& ret) {\n"; + out << "bool FromString(const TString& name, " << name << "& ret) {\n"; out << " const " << nsName << "::TNameBufs& names = " << nsName << "::TNameBufs::Instance();\n"; out << " return names.FromString(name, ret);\n"; out << "}\n\n"; @@ -355,14 +355,14 @@ void GenerateEnum( out << "}\n\n"; - if (headerOutPtr) { - // <EnumType>Count - auto& outHeader = *headerOutPtr; - outHeader << "template <>\n"; - outHeader << "constexpr size_t GetEnumItemsCount<" << name << ">() {\n"; - outHeader << " return " << en.Items.size() << ";\n"; - outHeader << "}\n"; - } + if (headerOutPtr) { + // <EnumType>Count + auto& outHeader = *headerOutPtr; + outHeader << "template <>\n"; + outHeader << "constexpr size_t GetEnumItemsCount<" << name << ">() {\n"; + outHeader << " return " << en.Items.size() << ";\n"; + outHeader << "}\n"; + } FinishItems(jEnum); jEnum << "}\n"; @@ -378,20 +378,20 @@ int main(int argc, char** argv) { TOpts opts = NLastGetopt::TOpts::Default(); opts.AddHelpOption(); - TString outputFileName; - TString outputHeaderFileName; - TString outputJsonFileName; - TString includePath; + TString outputFileName; + TString outputHeaderFileName; + TString outputJsonFileName; + TString includePath; opts.AddLongOption('o', "output").OptionalArgument("<output-file>").StoreResult(&outputFileName) .Help( "Output generated code to specified file.\n" "When not set, standard output is used." ); - opts.AddLongOption('h', "header").OptionalArgument("<output-header>").StoreResult(&outputHeaderFileName) - .Help( - "Generate appropriate header to specified file.\n" - "Works only if output file specified." - ); + opts.AddLongOption('h', "header").OptionalArgument("<output-header>").StoreResult(&outputHeaderFileName) + .Help( + "Generate appropriate header to specified file.\n" + "Works only if output file specified." + ); opts.AddLongOption("include-path").OptionalArgument("<header-path>").StoreResult(&includePath) .Help( "Include input header using this path in angle brackets.\n" @@ -408,35 +408,35 @@ int main(int argc, char** argv) { TOptsParseResult res(&opts, argc, argv); - TVector<TString> freeArgs = res.GetFreeArgs(); - TString inputFileName = freeArgs[0]; + TVector<TString> freeArgs = res.GetFreeArgs(); + TString inputFileName = freeArgs[0]; THolder<IOutputStream> hOut; IOutputStream* out = &Cout; THolder<IOutputStream> headerOut; - + THolder<IOutputStream> jsonOut; if (outputFileName) { NFs::Remove(outputFileName); - hOut.Reset(new TFileOutput(outputFileName)); + hOut.Reset(new TFileOutput(outputFileName)); out = hOut.Get(); - - if (outputHeaderFileName) { - headerOut.Reset(new TFileOutput(outputHeaderFileName)); - } + + if (outputHeaderFileName) { + headerOut.Reset(new TFileOutput(outputHeaderFileName)); + } if (outputJsonFileName) { - jsonOut.Reset(new TFileOutput(outputJsonFileName)); + jsonOut.Reset(new TFileOutput(outputJsonFileName)); } } if (!includePath) { - includePath = TString() + '"' + TFsPath(inputFileName).Basename() + '"'; + includePath = TString() + '"' + TFsPath(inputFileName).Basename() + '"'; } else { - includePath = TString() + '<' + includePath + '>'; + includePath = TString() + '<' + includePath + '>'; } TEnumParser parser(inputFileName); diff --git a/tools/fix_elf/elf.h b/tools/fix_elf/elf.h index c22973533a2..f0f87b9aa58 100644 --- a/tools/fix_elf/elf.h +++ b/tools/fix_elf/elf.h @@ -1,3172 +1,3172 @@ -#ifndef _ELF_H -#define _ELF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -typedef uint16_t Elf32_Half; -typedef uint16_t Elf64_Half; - -typedef uint32_t Elf32_Word; -typedef int32_t Elf32_Sword; -typedef uint32_t Elf64_Word; -typedef int32_t Elf64_Sword; - -typedef uint64_t Elf32_Xword; -typedef int64_t Elf32_Sxword; -typedef uint64_t Elf64_Xword; -typedef int64_t Elf64_Sxword; - -typedef uint32_t Elf32_Addr; -typedef uint64_t Elf64_Addr; - -typedef uint32_t Elf32_Off; -typedef uint64_t Elf64_Off; - -typedef uint16_t Elf32_Section; -typedef uint16_t Elf64_Section; - -typedef Elf32_Half Elf32_Versym; -typedef Elf64_Half Elf64_Versym; - -#define EI_NIDENT (16) - -typedef struct { - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; -} Elf32_Ehdr; - -typedef struct { - unsigned char e_ident[EI_NIDENT]; - Elf64_Half e_type; - Elf64_Half e_machine; - Elf64_Word e_version; - Elf64_Addr e_entry; - Elf64_Off e_phoff; - Elf64_Off e_shoff; - Elf64_Word e_flags; - Elf64_Half e_ehsize; - Elf64_Half e_phentsize; - Elf64_Half e_phnum; - Elf64_Half e_shentsize; - Elf64_Half e_shnum; - Elf64_Half e_shstrndx; -} Elf64_Ehdr; - -#define EI_MAG0 0 -#define ELFMAG0 0x7f - -#define EI_MAG1 1 -#define ELFMAG1 'E' - -#define EI_MAG2 2 -#define ELFMAG2 'L' - -#define EI_MAG3 3 -#define ELFMAG3 'F' - - -#define ELFMAG "\177ELF" -#define SELFMAG 4 - -#define EI_CLASS 4 -#define ELFCLASSNONE 0 -#define ELFCLASS32 1 -#define ELFCLASS64 2 -#define ELFCLASSNUM 3 - -#define EI_DATA 5 -#define ELFDATANONE 0 -#define ELFDATA2LSB 1 -#define ELFDATA2MSB 2 -#define ELFDATANUM 3 - -#define EI_VERSION 6 - - -#define EI_OSABI 7 -#define ELFOSABI_NONE 0 -#define ELFOSABI_SYSV 0 -#define ELFOSABI_HPUX 1 -#define ELFOSABI_NETBSD 2 -#define ELFOSABI_LINUX 3 -#define ELFOSABI_GNU 3 -#define ELFOSABI_SOLARIS 6 -#define ELFOSABI_AIX 7 -#define ELFOSABI_IRIX 8 -#define ELFOSABI_FREEBSD 9 -#define ELFOSABI_TRU64 10 -#define ELFOSABI_MODESTO 11 -#define ELFOSABI_OPENBSD 12 -#define ELFOSABI_ARM 97 -#define ELFOSABI_STANDALONE 255 - -#define EI_ABIVERSION 8 - -#define EI_PAD 9 - - - -#define ET_NONE 0 -#define ET_REL 1 -#define ET_EXEC 2 -#define ET_DYN 3 -#define ET_CORE 4 -#define ET_NUM 5 -#define ET_LOOS 0xfe00 -#define ET_HIOS 0xfeff -#define ET_LOPROC 0xff00 -#define ET_HIPROC 0xffff - - - -#define EM_NONE 0 -#define EM_M32 1 -#define EM_SPARC 2 -#define EM_386 3 -#define EM_68K 4 -#define EM_88K 5 -#define EM_860 7 -#define EM_MIPS 8 -#define EM_S370 9 -#define EM_MIPS_RS3_LE 10 - -#define EM_PARISC 15 -#define EM_VPP500 17 -#define EM_SPARC32PLUS 18 -#define EM_960 19 -#define EM_PPC 20 -#define EM_PPC64 21 -#define EM_S390 22 - -#define EM_V800 36 -#define EM_FR20 37 -#define EM_RH32 38 -#define EM_RCE 39 -#define EM_ARM 40 -#define EM_FAKE_ALPHA 41 -#define EM_SH 42 -#define EM_SPARCV9 43 -#define EM_TRICORE 44 -#define EM_ARC 45 -#define EM_H8_300 46 -#define EM_H8_300H 47 -#define EM_H8S 48 -#define EM_H8_500 49 -#define EM_IA_64 50 -#define EM_MIPS_X 51 -#define EM_COLDFIRE 52 -#define EM_68HC12 53 -#define EM_MMA 54 -#define EM_PCP 55 -#define EM_NCPU 56 -#define EM_NDR1 57 -#define EM_STARCORE 58 -#define EM_ME16 59 -#define EM_ST100 60 -#define EM_TINYJ 61 -#define EM_X86_64 62 -#define EM_PDSP 63 - -#define EM_FX66 66 -#define EM_ST9PLUS 67 -#define EM_ST7 68 -#define EM_68HC16 69 -#define EM_68HC11 70 -#define EM_68HC08 71 -#define EM_68HC05 72 -#define EM_SVX 73 -#define EM_ST19 74 -#define EM_VAX 75 -#define EM_CRIS 76 -#define EM_JAVELIN 77 -#define EM_FIREPATH 78 -#define EM_ZSP 79 -#define EM_MMIX 80 -#define EM_HUANY 81 -#define EM_PRISM 82 -#define EM_AVR 83 -#define EM_FR30 84 -#define EM_D10V 85 -#define EM_D30V 86 -#define EM_V850 87 -#define EM_M32R 88 -#define EM_MN10300 89 -#define EM_MN10200 90 -#define EM_PJ 91 -#define EM_OR1K 92 -#define EM_OPENRISC 92 -#define EM_ARC_A5 93 -#define EM_ARC_COMPACT 93 -#define EM_XTENSA 94 -#define EM_VIDEOCORE 95 -#define EM_TMM_GPP 96 -#define EM_NS32K 97 -#define EM_TPC 98 -#define EM_SNP1K 99 -#define EM_ST200 100 -#define EM_IP2K 101 -#define EM_MAX 102 -#define EM_CR 103 -#define EM_F2MC16 104 -#define EM_MSP430 105 -#define EM_BLACKFIN 106 -#define EM_SE_C33 107 -#define EM_SEP 108 -#define EM_ARCA 109 -#define EM_UNICORE 110 -#define EM_EXCESS 111 -#define EM_DXP 112 -#define EM_ALTERA_NIOS2 113 -#define EM_CRX 114 -#define EM_XGATE 115 -#define EM_C166 116 -#define EM_M16C 117 -#define EM_DSPIC30F 118 -#define EM_CE 119 -#define EM_M32C 120 -#define EM_TSK3000 131 -#define EM_RS08 132 -#define EM_SHARC 133 -#define EM_ECOG2 134 -#define EM_SCORE7 135 -#define EM_DSP24 136 -#define EM_VIDEOCORE3 137 -#define EM_LATTICEMICO32 138 -#define EM_SE_C17 139 -#define EM_TI_C6000 140 -#define EM_TI_C2000 141 -#define EM_TI_C5500 142 -#define EM_TI_ARP32 143 -#define EM_TI_PRU 144 -#define EM_MMDSP_PLUS 160 -#define EM_CYPRESS_M8C 161 -#define EM_R32C 162 -#define EM_TRIMEDIA 163 -#define EM_QDSP6 164 -#define EM_8051 165 -#define EM_STXP7X 166 -#define EM_NDS32 167 -#define EM_ECOG1X 168 -#define EM_MAXQ30 169 -#define EM_XIMO16 170 -#define EM_MANIK 171 -#define EM_CRAYNV2 172 -#define EM_RX 173 -#define EM_METAG 174 -#define EM_MCST_ELBRUS 175 -#define EM_ECOG16 176 -#define EM_CR16 177 -#define EM_ETPU 178 -#define EM_SLE9X 179 -#define EM_L10M 180 -#define EM_K10M 181 -#define EM_AARCH64 183 -#define EM_AVR32 185 -#define EM_STM8 186 -#define EM_TILE64 187 -#define EM_TILEPRO 188 -#define EM_MICROBLAZE 189 -#define EM_CUDA 190 -#define EM_TILEGX 191 -#define EM_CLOUDSHIELD 192 -#define EM_COREA_1ST 193 -#define EM_COREA_2ND 194 -#define EM_ARC_COMPACT2 195 -#define EM_OPEN8 196 -#define EM_RL78 197 -#define EM_VIDEOCORE5 198 -#define EM_78KOR 199 -#define EM_56800EX 200 -#define EM_BA1 201 -#define EM_BA2 202 -#define EM_XCORE 203 -#define EM_MCHP_PIC 204 -#define EM_KM32 210 -#define EM_KMX32 211 -#define EM_EMX16 212 -#define EM_EMX8 213 -#define EM_KVARC 214 -#define EM_CDP 215 -#define EM_COGE 216 -#define EM_COOL 217 -#define EM_NORC 218 -#define EM_CSR_KALIMBA 219 -#define EM_Z80 220 -#define EM_VISIUM 221 -#define EM_FT32 222 -#define EM_MOXIE 223 -#define EM_AMDGPU 224 -#define EM_RISCV 243 -#define EM_BPF 247 -#define EM_NUM 248 - -#define EM_ALPHA 0x9026 - -#define EV_NONE 0 -#define EV_CURRENT 1 -#define EV_NUM 2 - -typedef struct { - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; -} Elf32_Shdr; - -typedef struct { - Elf64_Word sh_name; - Elf64_Word sh_type; - Elf64_Xword sh_flags; - Elf64_Addr sh_addr; - Elf64_Off sh_offset; - Elf64_Xword sh_size; - Elf64_Word sh_link; - Elf64_Word sh_info; - Elf64_Xword sh_addralign; - Elf64_Xword sh_entsize; -} Elf64_Shdr; - - - -#define SHN_UNDEF 0 -#define SHN_LORESERVE 0xff00 -#define SHN_LOPROC 0xff00 -#define SHN_BEFORE 0xff00 - -#define SHN_AFTER 0xff01 - -#define SHN_HIPROC 0xff1f -#define SHN_LOOS 0xff20 -#define SHN_HIOS 0xff3f -#define SHN_ABS 0xfff1 -#define SHN_COMMON 0xfff2 -#define SHN_XINDEX 0xffff -#define SHN_HIRESERVE 0xffff - - - -#define SHT_NULL 0 -#define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_RELA 4 -#define SHT_HASH 5 -#define SHT_DYNAMIC 6 -#define SHT_NOTE 7 -#define SHT_NOBITS 8 -#define SHT_REL 9 -#define SHT_SHLIB 10 -#define SHT_DYNSYM 11 -#define SHT_INIT_ARRAY 14 -#define SHT_FINI_ARRAY 15 -#define SHT_PREINIT_ARRAY 16 -#define SHT_GROUP 17 -#define SHT_SYMTAB_SHNDX 18 -#define SHT_NUM 19 -#define SHT_LOOS 0x60000000 -#define SHT_GNU_ATTRIBUTES 0x6ffffff5 -#define SHT_GNU_HASH 0x6ffffff6 -#define SHT_GNU_LIBLIST 0x6ffffff7 -#define SHT_CHECKSUM 0x6ffffff8 -#define SHT_LOSUNW 0x6ffffffa -#define SHT_SUNW_move 0x6ffffffa -#define SHT_SUNW_COMDAT 0x6ffffffb -#define SHT_SUNW_syminfo 0x6ffffffc -#define SHT_GNU_verdef 0x6ffffffd -#define SHT_GNU_verneed 0x6ffffffe -#define SHT_GNU_versym 0x6fffffff -#define SHT_HISUNW 0x6fffffff -#define SHT_HIOS 0x6fffffff -#define SHT_LOPROC 0x70000000 -#define SHT_HIPROC 0x7fffffff -#define SHT_LOUSER 0x80000000 -#define SHT_HIUSER 0x8fffffff - -#define SHF_WRITE (1 << 0) -#define SHF_ALLOC (1 << 1) -#define SHF_EXECINSTR (1 << 2) -#define SHF_MERGE (1 << 4) -#define SHF_STRINGS (1 << 5) -#define SHF_INFO_LINK (1 << 6) -#define SHF_LINK_ORDER (1 << 7) -#define SHF_OS_NONCONFORMING (1 << 8) - -#define SHF_GROUP (1 << 9) -#define SHF_TLS (1 << 10) -#define SHF_COMPRESSED (1 << 11) -#define SHF_MASKOS 0x0ff00000 -#define SHF_MASKPROC 0xf0000000 -#define SHF_ORDERED (1 << 30) -#define SHF_EXCLUDE (1U << 31) - -typedef struct { - Elf32_Word ch_type; - Elf32_Word ch_size; - Elf32_Word ch_addralign; -} Elf32_Chdr; - -typedef struct { - Elf64_Word ch_type; - Elf64_Word ch_reserved; - Elf64_Xword ch_size; - Elf64_Xword ch_addralign; -} Elf64_Chdr; - -#define ELFCOMPRESS_ZLIB 1 -#define ELFCOMPRESS_LOOS 0x60000000 -#define ELFCOMPRESS_HIOS 0x6fffffff -#define ELFCOMPRESS_LOPROC 0x70000000 -#define ELFCOMPRESS_HIPROC 0x7fffffff - - -#define GRP_COMDAT 0x1 - -typedef struct { - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Section st_shndx; -} Elf32_Sym; - -typedef struct { - Elf64_Word st_name; - unsigned char st_info; - unsigned char st_other; - Elf64_Section st_shndx; - Elf64_Addr st_value; - Elf64_Xword st_size; -} Elf64_Sym; - -typedef struct { - Elf32_Half si_boundto; - Elf32_Half si_flags; -} Elf32_Syminfo; - -typedef struct { - Elf64_Half si_boundto; - Elf64_Half si_flags; -} Elf64_Syminfo; - -#define SYMINFO_BT_SELF 0xffff -#define SYMINFO_BT_PARENT 0xfffe -#define SYMINFO_BT_LOWRESERVE 0xff00 - -#define SYMINFO_FLG_DIRECT 0x0001 -#define SYMINFO_FLG_PASSTHRU 0x0002 -#define SYMINFO_FLG_COPY 0x0004 -#define SYMINFO_FLG_LAZYLOAD 0x0008 - -#define SYMINFO_NONE 0 -#define SYMINFO_CURRENT 1 -#define SYMINFO_NUM 2 - -#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) -#define ELF32_ST_TYPE(val) ((val) & 0xf) -#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) - -#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) -#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) -#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) - -#define STB_LOCAL 0 -#define STB_GLOBAL 1 -#define STB_WEAK 2 -#define STB_NUM 3 -#define STB_LOOS 10 -#define STB_GNU_UNIQUE 10 -#define STB_HIOS 12 -#define STB_LOPROC 13 -#define STB_HIPROC 15 - -#define STT_NOTYPE 0 -#define STT_OBJECT 1 -#define STT_FUNC 2 -#define STT_SECTION 3 -#define STT_FILE 4 -#define STT_COMMON 5 -#define STT_TLS 6 -#define STT_NUM 7 -#define STT_LOOS 10 -#define STT_GNU_IFUNC 10 -#define STT_HIOS 12 -#define STT_LOPROC 13 -#define STT_HIPROC 15 - -#define STN_UNDEF 0 - -#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) -#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) - -#define STV_DEFAULT 0 -#define STV_INTERNAL 1 -#define STV_HIDDEN 2 -#define STV_PROTECTED 3 - - - - -typedef struct { - Elf32_Addr r_offset; - Elf32_Word r_info; -} Elf32_Rel; - -typedef struct { - Elf64_Addr r_offset; - Elf64_Xword r_info; -} Elf64_Rel; - - - -typedef struct { - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; -} Elf32_Rela; - -typedef struct { - Elf64_Addr r_offset; - Elf64_Xword r_info; - Elf64_Sxword r_addend; -} Elf64_Rela; - - - -#define ELF32_R_SYM(val) ((val) >> 8) -#define ELF32_R_TYPE(val) ((val) & 0xff) -#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) - -#define ELF64_R_SYM(i) ((i) >> 32) -#define ELF64_R_TYPE(i) ((i) & 0xffffffff) -#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) - - - -typedef struct { - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; -} Elf32_Phdr; - -typedef struct { - Elf64_Word p_type; - Elf64_Word p_flags; - Elf64_Off p_offset; - Elf64_Addr p_vaddr; - Elf64_Addr p_paddr; - Elf64_Xword p_filesz; - Elf64_Xword p_memsz; - Elf64_Xword p_align; -} Elf64_Phdr; - - - -#define PT_NULL 0 -#define PT_LOAD 1 -#define PT_DYNAMIC 2 -#define PT_INTERP 3 -#define PT_NOTE 4 -#define PT_SHLIB 5 -#define PT_PHDR 6 -#define PT_TLS 7 -#define PT_NUM 8 -#define PT_LOOS 0x60000000 -#define PT_GNU_EH_FRAME 0x6474e550 -#define PT_GNU_STACK 0x6474e551 -#define PT_GNU_RELRO 0x6474e552 -#define PT_LOSUNW 0x6ffffffa -#define PT_SUNWBSS 0x6ffffffa -#define PT_SUNWSTACK 0x6ffffffb -#define PT_HISUNW 0x6fffffff -#define PT_HIOS 0x6fffffff -#define PT_LOPROC 0x70000000 -#define PT_HIPROC 0x7fffffff - - -#define PN_XNUM 0xffff - - -#define PF_X (1 << 0) -#define PF_W (1 << 1) -#define PF_R (1 << 2) -#define PF_MASKOS 0x0ff00000 -#define PF_MASKPROC 0xf0000000 - - - -#define NT_PRSTATUS 1 -#define NT_PRFPREG 2 -#define NT_FPREGSET 2 -#define NT_PRPSINFO 3 -#define NT_PRXREG 4 -#define NT_TASKSTRUCT 4 -#define NT_PLATFORM 5 -#define NT_AUXV 6 -#define NT_GWINDOWS 7 -#define NT_ASRS 8 -#define NT_PSTATUS 10 -#define NT_PSINFO 13 -#define NT_PRCRED 14 -#define NT_UTSNAME 15 -#define NT_LWPSTATUS 16 -#define NT_LWPSINFO 17 -#define NT_PRFPXREG 20 -#define NT_SIGINFO 0x53494749 -#define NT_FILE 0x46494c45 -#define NT_PRXFPREG 0x46e62b7f -#define NT_PPC_VMX 0x100 -#define NT_PPC_SPE 0x101 -#define NT_PPC_VSX 0x102 -#define NT_PPC_TAR 0x103 -#define NT_PPC_PPR 0x104 -#define NT_PPC_DSCR 0x105 -#define NT_PPC_EBB 0x106 -#define NT_PPC_PMU 0x107 -#define NT_PPC_TM_CGPR 0x108 -#define NT_PPC_TM_CFPR 0x109 -#define NT_PPC_TM_CVMX 0x10a -#define NT_PPC_TM_CVSX 0x10b -#define NT_PPC_TM_SPR 0x10c -#define NT_PPC_TM_CTAR 0x10d -#define NT_PPC_TM_CPPR 0x10e -#define NT_PPC_TM_CDSCR 0x10f -#define NT_386_TLS 0x200 -#define NT_386_IOPERM 0x201 -#define NT_X86_XSTATE 0x202 -#define NT_S390_HIGH_GPRS 0x300 -#define NT_S390_TIMER 0x301 -#define NT_S390_TODCMP 0x302 -#define NT_S390_TODPREG 0x303 -#define NT_S390_CTRS 0x304 -#define NT_S390_PREFIX 0x305 -#define NT_S390_LAST_BREAK 0x306 -#define NT_S390_SYSTEM_CALL 0x307 -#define NT_S390_TDB 0x308 -#define NT_S390_VXRS_LOW 0x309 -#define NT_S390_VXRS_HIGH 0x30a -#define NT_S390_GS_CB 0x30b -#define NT_S390_GS_BC 0x30c -#define NT_S390_RI_CB 0x30d -#define NT_ARM_VFP 0x400 -#define NT_ARM_TLS 0x401 -#define NT_ARM_HW_BREAK 0x402 -#define NT_ARM_HW_WATCH 0x403 -#define NT_ARM_SYSTEM_CALL 0x404 -#define NT_ARM_SVE 0x405 -#define NT_METAG_CBUF 0x500 -#define NT_METAG_RPIPE 0x501 -#define NT_METAG_TLS 0x502 -#define NT_ARC_V2 0x600 -#define NT_VERSION 1 - - - - -typedef struct { - Elf32_Sword d_tag; - union { - Elf32_Word d_val; - Elf32_Addr d_ptr; - } d_un; -} Elf32_Dyn; - -typedef struct { - Elf64_Sxword d_tag; - union { - Elf64_Xword d_val; - Elf64_Addr d_ptr; - } d_un; -} Elf64_Dyn; - - - -#define DT_NULL 0 -#define DT_NEEDED 1 -#define DT_PLTRELSZ 2 -#define DT_PLTGOT 3 -#define DT_HASH 4 -#define DT_STRTAB 5 -#define DT_SYMTAB 6 -#define DT_RELA 7 -#define DT_RELASZ 8 -#define DT_RELAENT 9 -#define DT_STRSZ 10 -#define DT_SYMENT 11 -#define DT_INIT 12 -#define DT_FINI 13 -#define DT_SONAME 14 -#define DT_RPATH 15 -#define DT_SYMBOLIC 16 -#define DT_REL 17 -#define DT_RELSZ 18 -#define DT_RELENT 19 -#define DT_PLTREL 20 -#define DT_DEBUG 21 -#define DT_TEXTREL 22 -#define DT_JMPREL 23 -#define DT_BIND_NOW 24 -#define DT_INIT_ARRAY 25 -#define DT_FINI_ARRAY 26 -#define DT_INIT_ARRAYSZ 27 -#define DT_FINI_ARRAYSZ 28 -#define DT_RUNPATH 29 -#define DT_FLAGS 30 -#define DT_ENCODING 32 -#define DT_PREINIT_ARRAY 32 -#define DT_PREINIT_ARRAYSZ 33 -#define DT_SYMTAB_SHNDX 34 -#define DT_NUM 35 -#define DT_LOOS 0x6000000d -#define DT_HIOS 0x6ffff000 -#define DT_LOPROC 0x70000000 -#define DT_HIPROC 0x7fffffff -#define DT_PROCNUM DT_MIPS_NUM - -#define DT_VALRNGLO 0x6ffffd00 -#define DT_GNU_PRELINKED 0x6ffffdf5 -#define DT_GNU_CONFLICTSZ 0x6ffffdf6 -#define DT_GNU_LIBLISTSZ 0x6ffffdf7 -#define DT_CHECKSUM 0x6ffffdf8 -#define DT_PLTPADSZ 0x6ffffdf9 -#define DT_MOVEENT 0x6ffffdfa -#define DT_MOVESZ 0x6ffffdfb -#define DT_FEATURE_1 0x6ffffdfc -#define DT_POSFLAG_1 0x6ffffdfd - -#define DT_SYMINSZ 0x6ffffdfe -#define DT_SYMINENT 0x6ffffdff -#define DT_VALRNGHI 0x6ffffdff -#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) -#define DT_VALNUM 12 - -#define DT_ADDRRNGLO 0x6ffffe00 -#define DT_GNU_HASH 0x6ffffef5 -#define DT_TLSDESC_PLT 0x6ffffef6 -#define DT_TLSDESC_GOT 0x6ffffef7 -#define DT_GNU_CONFLICT 0x6ffffef8 -#define DT_GNU_LIBLIST 0x6ffffef9 -#define DT_CONFIG 0x6ffffefa -#define DT_DEPAUDIT 0x6ffffefb -#define DT_AUDIT 0x6ffffefc -#define DT_PLTPAD 0x6ffffefd -#define DT_MOVETAB 0x6ffffefe -#define DT_SYMINFO 0x6ffffeff -#define DT_ADDRRNGHI 0x6ffffeff -#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) -#define DT_ADDRNUM 11 - - - -#define DT_VERSYM 0x6ffffff0 - -#define DT_RELACOUNT 0x6ffffff9 -#define DT_RELCOUNT 0x6ffffffa - - -#define DT_FLAGS_1 0x6ffffffb -#define DT_VERDEF 0x6ffffffc - -#define DT_VERDEFNUM 0x6ffffffd -#define DT_VERNEED 0x6ffffffe - -#define DT_VERNEEDNUM 0x6fffffff -#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) -#define DT_VERSIONTAGNUM 16 - - - -#define DT_AUXILIARY 0x7ffffffd -#define DT_FILTER 0x7fffffff -#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) -#define DT_EXTRANUM 3 - - -#define DF_ORIGIN 0x00000001 -#define DF_SYMBOLIC 0x00000002 -#define DF_TEXTREL 0x00000004 -#define DF_BIND_NOW 0x00000008 -#define DF_STATIC_TLS 0x00000010 - - - -#define DF_1_NOW 0x00000001 -#define DF_1_GLOBAL 0x00000002 -#define DF_1_GROUP 0x00000004 -#define DF_1_NODELETE 0x00000008 -#define DF_1_LOADFLTR 0x00000010 -#define DF_1_INITFIRST 0x00000020 -#define DF_1_NOOPEN 0x00000040 -#define DF_1_ORIGIN 0x00000080 -#define DF_1_DIRECT 0x00000100 -#define DF_1_TRANS 0x00000200 -#define DF_1_INTERPOSE 0x00000400 -#define DF_1_NODEFLIB 0x00000800 -#define DF_1_NODUMP 0x00001000 -#define DF_1_CONFALT 0x00002000 -#define DF_1_ENDFILTEE 0x00004000 -#define DF_1_DISPRELDNE 0x00008000 -#define DF_1_DISPRELPND 0x00010000 -#define DF_1_NODIRECT 0x00020000 -#define DF_1_IGNMULDEF 0x00040000 -#define DF_1_NOKSYMS 0x00080000 -#define DF_1_NOHDR 0x00100000 -#define DF_1_EDITED 0x00200000 -#define DF_1_NORELOC 0x00400000 -#define DF_1_SYMINTPOSE 0x00800000 -#define DF_1_GLOBAUDIT 0x01000000 -#define DF_1_SINGLETON 0x02000000 -#define DF_1_STUB 0x04000000 -#define DF_1_PIE 0x08000000 - -#define DTF_1_PARINIT 0x00000001 -#define DTF_1_CONFEXP 0x00000002 - - -#define DF_P1_LAZYLOAD 0x00000001 -#define DF_P1_GROUPPERM 0x00000002 - - - - -typedef struct { - Elf32_Half vd_version; - Elf32_Half vd_flags; - Elf32_Half vd_ndx; - Elf32_Half vd_cnt; - Elf32_Word vd_hash; - Elf32_Word vd_aux; - Elf32_Word vd_next; -} Elf32_Verdef; - -typedef struct { - Elf64_Half vd_version; - Elf64_Half vd_flags; - Elf64_Half vd_ndx; - Elf64_Half vd_cnt; - Elf64_Word vd_hash; - Elf64_Word vd_aux; - Elf64_Word vd_next; -} Elf64_Verdef; - - - -#define VER_DEF_NONE 0 -#define VER_DEF_CURRENT 1 -#define VER_DEF_NUM 2 - - -#define VER_FLG_BASE 0x1 -#define VER_FLG_WEAK 0x2 - - -#define VER_NDX_LOCAL 0 -#define VER_NDX_GLOBAL 1 -#define VER_NDX_LORESERVE 0xff00 -#define VER_NDX_ELIMINATE 0xff01 - - - -typedef struct { - Elf32_Word vda_name; - Elf32_Word vda_next; -} Elf32_Verdaux; - -typedef struct { - Elf64_Word vda_name; - Elf64_Word vda_next; -} Elf64_Verdaux; - - - - -typedef struct { - Elf32_Half vn_version; - Elf32_Half vn_cnt; - Elf32_Word vn_file; - Elf32_Word vn_aux; - Elf32_Word vn_next; -} Elf32_Verneed; - -typedef struct { - Elf64_Half vn_version; - Elf64_Half vn_cnt; - Elf64_Word vn_file; - Elf64_Word vn_aux; - Elf64_Word vn_next; -} Elf64_Verneed; - - - -#define VER_NEED_NONE 0 -#define VER_NEED_CURRENT 1 -#define VER_NEED_NUM 2 - - - -typedef struct { - Elf32_Word vna_hash; - Elf32_Half vna_flags; - Elf32_Half vna_other; - Elf32_Word vna_name; - Elf32_Word vna_next; -} Elf32_Vernaux; - -typedef struct { - Elf64_Word vna_hash; - Elf64_Half vna_flags; - Elf64_Half vna_other; - Elf64_Word vna_name; - Elf64_Word vna_next; -} Elf64_Vernaux; - - - -#define VER_FLG_WEAK 0x2 - - - -typedef struct { - uint32_t a_type; - union { - uint32_t a_val; - } a_un; -} Elf32_auxv_t; - -typedef struct { - uint64_t a_type; - union { - uint64_t a_val; - } a_un; -} Elf64_auxv_t; - - - -#define AT_NULL 0 -#define AT_IGNORE 1 -#define AT_EXECFD 2 -#define AT_PHDR 3 -#define AT_PHENT 4 -#define AT_PHNUM 5 -#define AT_PAGESZ 6 -#define AT_BASE 7 -#define AT_FLAGS 8 -#define AT_ENTRY 9 -#define AT_NOTELF 10 -#define AT_UID 11 -#define AT_EUID 12 -#define AT_GID 13 -#define AT_EGID 14 -#define AT_CLKTCK 17 - - -#define AT_PLATFORM 15 -#define AT_HWCAP 16 - - - - -#define AT_FPUCW 18 - - -#define AT_DCACHEBSIZE 19 -#define AT_ICACHEBSIZE 20 -#define AT_UCACHEBSIZE 21 - - - -#define AT_IGNOREPPC 22 - -#define AT_SECURE 23 - -#define AT_BASE_PLATFORM 24 - -#define AT_RANDOM 25 - -#define AT_HWCAP2 26 - -#define AT_EXECFN 31 - - - -#define AT_SYSINFO 32 -#define AT_SYSINFO_EHDR 33 - - - -#define AT_L1I_CACHESHAPE 34 -#define AT_L1D_CACHESHAPE 35 -#define AT_L2_CACHESHAPE 36 -#define AT_L3_CACHESHAPE 37 - -#define AT_L1I_CACHESIZE 40 -#define AT_L1I_CACHEGEOMETRY 41 -#define AT_L1D_CACHESIZE 42 -#define AT_L1D_CACHEGEOMETRY 43 -#define AT_L2_CACHESIZE 44 -#define AT_L2_CACHEGEOMETRY 45 -#define AT_L3_CACHESIZE 46 -#define AT_L3_CACHEGEOMETRY 47 - - - -typedef struct { - Elf32_Word n_namesz; - Elf32_Word n_descsz; - Elf32_Word n_type; -} Elf32_Nhdr; - -typedef struct { - Elf64_Word n_namesz; - Elf64_Word n_descsz; - Elf64_Word n_type; -} Elf64_Nhdr; - - - - -#define ELF_NOTE_SOLARIS "SUNW Solaris" - - -#define ELF_NOTE_GNU "GNU" - - - - - -#define ELF_NOTE_PAGESIZE_HINT 1 - - -#define NT_GNU_ABI_TAG 1 -#define ELF_NOTE_ABI NT_GNU_ABI_TAG - - - -#define ELF_NOTE_OS_LINUX 0 -#define ELF_NOTE_OS_GNU 1 -#define ELF_NOTE_OS_SOLARIS2 2 -#define ELF_NOTE_OS_FREEBSD 3 - -#define NT_GNU_BUILD_ID 3 -#define NT_GNU_GOLD_VERSION 4 - - - -typedef struct { - Elf32_Xword m_value; - Elf32_Word m_info; - Elf32_Word m_poffset; - Elf32_Half m_repeat; - Elf32_Half m_stride; -} Elf32_Move; - -typedef struct { - Elf64_Xword m_value; - Elf64_Xword m_info; - Elf64_Xword m_poffset; - Elf64_Half m_repeat; - Elf64_Half m_stride; -} Elf64_Move; - - -#define ELF32_M_SYM(info) ((info) >> 8) -#define ELF32_M_SIZE(info) ((unsigned char) (info)) -#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) - -#define ELF64_M_SYM(info) ELF32_M_SYM (info) -#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) -#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) - -#define EF_CPU32 0x00810000 - -#define R_68K_NONE 0 -#define R_68K_32 1 -#define R_68K_16 2 -#define R_68K_8 3 -#define R_68K_PC32 4 -#define R_68K_PC16 5 -#define R_68K_PC8 6 -#define R_68K_GOT32 7 -#define R_68K_GOT16 8 -#define R_68K_GOT8 9 -#define R_68K_GOT32O 10 -#define R_68K_GOT16O 11 -#define R_68K_GOT8O 12 -#define R_68K_PLT32 13 -#define R_68K_PLT16 14 -#define R_68K_PLT8 15 -#define R_68K_PLT32O 16 -#define R_68K_PLT16O 17 -#define R_68K_PLT8O 18 -#define R_68K_COPY 19 -#define R_68K_GLOB_DAT 20 -#define R_68K_JMP_SLOT 21 -#define R_68K_RELATIVE 22 -#define R_68K_TLS_GD32 25 -#define R_68K_TLS_GD16 26 -#define R_68K_TLS_GD8 27 -#define R_68K_TLS_LDM32 28 -#define R_68K_TLS_LDM16 29 -#define R_68K_TLS_LDM8 30 -#define R_68K_TLS_LDO32 31 -#define R_68K_TLS_LDO16 32 -#define R_68K_TLS_LDO8 33 -#define R_68K_TLS_IE32 34 -#define R_68K_TLS_IE16 35 -#define R_68K_TLS_IE8 36 -#define R_68K_TLS_LE32 37 -#define R_68K_TLS_LE16 38 -#define R_68K_TLS_LE8 39 -#define R_68K_TLS_DTPMOD32 40 -#define R_68K_TLS_DTPREL32 41 -#define R_68K_TLS_TPREL32 42 -#define R_68K_NUM 43 - -#define R_386_NONE 0 -#define R_386_32 1 -#define R_386_PC32 2 -#define R_386_GOT32 3 -#define R_386_PLT32 4 -#define R_386_COPY 5 -#define R_386_GLOB_DAT 6 -#define R_386_JMP_SLOT 7 -#define R_386_RELATIVE 8 -#define R_386_GOTOFF 9 -#define R_386_GOTPC 10 -#define R_386_32PLT 11 -#define R_386_TLS_TPOFF 14 -#define R_386_TLS_IE 15 -#define R_386_TLS_GOTIE 16 -#define R_386_TLS_LE 17 -#define R_386_TLS_GD 18 -#define R_386_TLS_LDM 19 -#define R_386_16 20 -#define R_386_PC16 21 -#define R_386_8 22 -#define R_386_PC8 23 -#define R_386_TLS_GD_32 24 -#define R_386_TLS_GD_PUSH 25 -#define R_386_TLS_GD_CALL 26 -#define R_386_TLS_GD_POP 27 -#define R_386_TLS_LDM_32 28 -#define R_386_TLS_LDM_PUSH 29 -#define R_386_TLS_LDM_CALL 30 -#define R_386_TLS_LDM_POP 31 -#define R_386_TLS_LDO_32 32 -#define R_386_TLS_IE_32 33 -#define R_386_TLS_LE_32 34 -#define R_386_TLS_DTPMOD32 35 -#define R_386_TLS_DTPOFF32 36 -#define R_386_TLS_TPOFF32 37 -#define R_386_SIZE32 38 -#define R_386_TLS_GOTDESC 39 -#define R_386_TLS_DESC_CALL 40 -#define R_386_TLS_DESC 41 -#define R_386_IRELATIVE 42 -#define R_386_GOT32X 43 -#define R_386_NUM 44 - - - - - -#define STT_SPARC_REGISTER 13 - - - -#define EF_SPARCV9_MM 3 -#define EF_SPARCV9_TSO 0 -#define EF_SPARCV9_PSO 1 -#define EF_SPARCV9_RMO 2 -#define EF_SPARC_LEDATA 0x800000 -#define EF_SPARC_EXT_MASK 0xFFFF00 -#define EF_SPARC_32PLUS 0x000100 -#define EF_SPARC_SUN_US1 0x000200 -#define EF_SPARC_HAL_R1 0x000400 -#define EF_SPARC_SUN_US3 0x000800 - - - -#define R_SPARC_NONE 0 -#define R_SPARC_8 1 -#define R_SPARC_16 2 -#define R_SPARC_32 3 -#define R_SPARC_DISP8 4 -#define R_SPARC_DISP16 5 -#define R_SPARC_DISP32 6 -#define R_SPARC_WDISP30 7 -#define R_SPARC_WDISP22 8 -#define R_SPARC_HI22 9 -#define R_SPARC_22 10 -#define R_SPARC_13 11 -#define R_SPARC_LO10 12 -#define R_SPARC_GOT10 13 -#define R_SPARC_GOT13 14 -#define R_SPARC_GOT22 15 -#define R_SPARC_PC10 16 -#define R_SPARC_PC22 17 -#define R_SPARC_WPLT30 18 -#define R_SPARC_COPY 19 -#define R_SPARC_GLOB_DAT 20 -#define R_SPARC_JMP_SLOT 21 -#define R_SPARC_RELATIVE 22 -#define R_SPARC_UA32 23 - - - -#define R_SPARC_PLT32 24 -#define R_SPARC_HIPLT22 25 -#define R_SPARC_LOPLT10 26 -#define R_SPARC_PCPLT32 27 -#define R_SPARC_PCPLT22 28 -#define R_SPARC_PCPLT10 29 -#define R_SPARC_10 30 -#define R_SPARC_11 31 -#define R_SPARC_64 32 -#define R_SPARC_OLO10 33 -#define R_SPARC_HH22 34 -#define R_SPARC_HM10 35 -#define R_SPARC_LM22 36 -#define R_SPARC_PC_HH22 37 -#define R_SPARC_PC_HM10 38 -#define R_SPARC_PC_LM22 39 -#define R_SPARC_WDISP16 40 -#define R_SPARC_WDISP19 41 -#define R_SPARC_GLOB_JMP 42 -#define R_SPARC_7 43 -#define R_SPARC_5 44 -#define R_SPARC_6 45 -#define R_SPARC_DISP64 46 -#define R_SPARC_PLT64 47 -#define R_SPARC_HIX22 48 -#define R_SPARC_LOX10 49 -#define R_SPARC_H44 50 -#define R_SPARC_M44 51 -#define R_SPARC_L44 52 -#define R_SPARC_REGISTER 53 -#define R_SPARC_UA64 54 -#define R_SPARC_UA16 55 -#define R_SPARC_TLS_GD_HI22 56 -#define R_SPARC_TLS_GD_LO10 57 -#define R_SPARC_TLS_GD_ADD 58 -#define R_SPARC_TLS_GD_CALL 59 -#define R_SPARC_TLS_LDM_HI22 60 -#define R_SPARC_TLS_LDM_LO10 61 -#define R_SPARC_TLS_LDM_ADD 62 -#define R_SPARC_TLS_LDM_CALL 63 -#define R_SPARC_TLS_LDO_HIX22 64 -#define R_SPARC_TLS_LDO_LOX10 65 -#define R_SPARC_TLS_LDO_ADD 66 -#define R_SPARC_TLS_IE_HI22 67 -#define R_SPARC_TLS_IE_LO10 68 -#define R_SPARC_TLS_IE_LD 69 -#define R_SPARC_TLS_IE_LDX 70 -#define R_SPARC_TLS_IE_ADD 71 -#define R_SPARC_TLS_LE_HIX22 72 -#define R_SPARC_TLS_LE_LOX10 73 -#define R_SPARC_TLS_DTPMOD32 74 -#define R_SPARC_TLS_DTPMOD64 75 -#define R_SPARC_TLS_DTPOFF32 76 -#define R_SPARC_TLS_DTPOFF64 77 -#define R_SPARC_TLS_TPOFF32 78 -#define R_SPARC_TLS_TPOFF64 79 -#define R_SPARC_GOTDATA_HIX22 80 -#define R_SPARC_GOTDATA_LOX10 81 -#define R_SPARC_GOTDATA_OP_HIX22 82 -#define R_SPARC_GOTDATA_OP_LOX10 83 -#define R_SPARC_GOTDATA_OP 84 -#define R_SPARC_H34 85 -#define R_SPARC_SIZE32 86 -#define R_SPARC_SIZE64 87 -#define R_SPARC_GNU_VTINHERIT 250 -#define R_SPARC_GNU_VTENTRY 251 -#define R_SPARC_REV32 252 - -#define R_SPARC_NUM 253 - - - -#define DT_SPARC_REGISTER 0x70000001 -#define DT_SPARC_NUM 2 - - -#define EF_MIPS_NOREORDER 1 -#define EF_MIPS_PIC 2 -#define EF_MIPS_CPIC 4 -#define EF_MIPS_XGOT 8 -#define EF_MIPS_64BIT_WHIRL 16 -#define EF_MIPS_ABI2 32 -#define EF_MIPS_ABI_ON32 64 -#define EF_MIPS_FP64 512 -#define EF_MIPS_NAN2008 1024 -#define EF_MIPS_ARCH 0xf0000000 - - - -#define EF_MIPS_ARCH_1 0x00000000 -#define EF_MIPS_ARCH_2 0x10000000 -#define EF_MIPS_ARCH_3 0x20000000 -#define EF_MIPS_ARCH_4 0x30000000 -#define EF_MIPS_ARCH_5 0x40000000 -#define EF_MIPS_ARCH_32 0x50000000 -#define EF_MIPS_ARCH_64 0x60000000 -#define EF_MIPS_ARCH_32R2 0x70000000 -#define EF_MIPS_ARCH_64R2 0x80000000 - - -#define E_MIPS_ARCH_1 0x00000000 -#define E_MIPS_ARCH_2 0x10000000 -#define E_MIPS_ARCH_3 0x20000000 -#define E_MIPS_ARCH_4 0x30000000 -#define E_MIPS_ARCH_5 0x40000000 -#define E_MIPS_ARCH_32 0x50000000 -#define E_MIPS_ARCH_64 0x60000000 - - - -#define SHN_MIPS_ACOMMON 0xff00 -#define SHN_MIPS_TEXT 0xff01 -#define SHN_MIPS_DATA 0xff02 -#define SHN_MIPS_SCOMMON 0xff03 -#define SHN_MIPS_SUNDEFINED 0xff04 - - - -#define SHT_MIPS_LIBLIST 0x70000000 -#define SHT_MIPS_MSYM 0x70000001 -#define SHT_MIPS_CONFLICT 0x70000002 -#define SHT_MIPS_GPTAB 0x70000003 -#define SHT_MIPS_UCODE 0x70000004 -#define SHT_MIPS_DEBUG 0x70000005 -#define SHT_MIPS_REGINFO 0x70000006 -#define SHT_MIPS_PACKAGE 0x70000007 -#define SHT_MIPS_PACKSYM 0x70000008 -#define SHT_MIPS_RELD 0x70000009 -#define SHT_MIPS_IFACE 0x7000000b -#define SHT_MIPS_CONTENT 0x7000000c -#define SHT_MIPS_OPTIONS 0x7000000d -#define SHT_MIPS_SHDR 0x70000010 -#define SHT_MIPS_FDESC 0x70000011 -#define SHT_MIPS_EXTSYM 0x70000012 -#define SHT_MIPS_DENSE 0x70000013 -#define SHT_MIPS_PDESC 0x70000014 -#define SHT_MIPS_LOCSYM 0x70000015 -#define SHT_MIPS_AUXSYM 0x70000016 -#define SHT_MIPS_OPTSYM 0x70000017 -#define SHT_MIPS_LOCSTR 0x70000018 -#define SHT_MIPS_LINE 0x70000019 -#define SHT_MIPS_RFDESC 0x7000001a -#define SHT_MIPS_DELTASYM 0x7000001b -#define SHT_MIPS_DELTAINST 0x7000001c -#define SHT_MIPS_DELTACLASS 0x7000001d -#define SHT_MIPS_DWARF 0x7000001e -#define SHT_MIPS_DELTADECL 0x7000001f -#define SHT_MIPS_SYMBOL_LIB 0x70000020 -#define SHT_MIPS_EVENTS 0x70000021 -#define SHT_MIPS_TRANSLATE 0x70000022 -#define SHT_MIPS_PIXIE 0x70000023 -#define SHT_MIPS_XLATE 0x70000024 -#define SHT_MIPS_XLATE_DEBUG 0x70000025 -#define SHT_MIPS_WHIRL 0x70000026 -#define SHT_MIPS_EH_REGION 0x70000027 -#define SHT_MIPS_XLATE_OLD 0x70000028 -#define SHT_MIPS_PDR_EXCEPTION 0x70000029 - - - -#define SHF_MIPS_GPREL 0x10000000 -#define SHF_MIPS_MERGE 0x20000000 -#define SHF_MIPS_ADDR 0x40000000 -#define SHF_MIPS_STRINGS 0x80000000 -#define SHF_MIPS_NOSTRIP 0x08000000 -#define SHF_MIPS_LOCAL 0x04000000 -#define SHF_MIPS_NAMES 0x02000000 -#define SHF_MIPS_NODUPE 0x01000000 - - - - - -#define STO_MIPS_DEFAULT 0x0 -#define STO_MIPS_INTERNAL 0x1 -#define STO_MIPS_HIDDEN 0x2 -#define STO_MIPS_PROTECTED 0x3 -#define STO_MIPS_PLT 0x8 -#define STO_MIPS_SC_ALIGN_UNUSED 0xff - - -#define STB_MIPS_SPLIT_COMMON 13 - - - -typedef union { - struct { - Elf32_Word gt_current_g_value; - Elf32_Word gt_unused; - } gt_header; - struct { - Elf32_Word gt_g_value; - Elf32_Word gt_bytes; - } gt_entry; -} Elf32_gptab; - - - -typedef struct { - Elf32_Word ri_gprmask; - Elf32_Word ri_cprmask[4]; - Elf32_Sword ri_gp_value; -} Elf32_RegInfo; - - - -typedef struct { - unsigned char kind; - - unsigned char size; - Elf32_Section section; - - Elf32_Word info; -} Elf_Options; - - - -#define ODK_NULL 0 -#define ODK_REGINFO 1 -#define ODK_EXCEPTIONS 2 -#define ODK_PAD 3 -#define ODK_HWPATCH 4 -#define ODK_FILL 5 -#define ODK_TAGS 6 -#define ODK_HWAND 7 -#define ODK_HWOR 8 - - - -#define OEX_FPU_MIN 0x1f -#define OEX_FPU_MAX 0x1f00 -#define OEX_PAGE0 0x10000 -#define OEX_SMM 0x20000 -#define OEX_FPDBUG 0x40000 -#define OEX_PRECISEFP OEX_FPDBUG -#define OEX_DISMISS 0x80000 - -#define OEX_FPU_INVAL 0x10 -#define OEX_FPU_DIV0 0x08 -#define OEX_FPU_OFLO 0x04 -#define OEX_FPU_UFLO 0x02 -#define OEX_FPU_INEX 0x01 - - - -#define OHW_R4KEOP 0x1 -#define OHW_R8KPFETCH 0x2 -#define OHW_R5KEOP 0x4 -#define OHW_R5KCVTL 0x8 - -#define OPAD_PREFIX 0x1 -#define OPAD_POSTFIX 0x2 -#define OPAD_SYMBOL 0x4 - - - -typedef struct { - Elf32_Word hwp_flags1; - Elf32_Word hwp_flags2; -} Elf_Options_Hw; - - - -#define OHWA0_R4KEOP_CHECKED 0x00000001 -#define OHWA1_R4KEOP_CLEAN 0x00000002 - - - -#define R_MIPS_NONE 0 -#define R_MIPS_16 1 -#define R_MIPS_32 2 -#define R_MIPS_REL32 3 -#define R_MIPS_26 4 -#define R_MIPS_HI16 5 -#define R_MIPS_LO16 6 -#define R_MIPS_GPREL16 7 -#define R_MIPS_LITERAL 8 -#define R_MIPS_GOT16 9 -#define R_MIPS_PC16 10 -#define R_MIPS_CALL16 11 -#define R_MIPS_GPREL32 12 - -#define R_MIPS_SHIFT5 16 -#define R_MIPS_SHIFT6 17 -#define R_MIPS_64 18 -#define R_MIPS_GOT_DISP 19 -#define R_MIPS_GOT_PAGE 20 -#define R_MIPS_GOT_OFST 21 -#define R_MIPS_GOT_HI16 22 -#define R_MIPS_GOT_LO16 23 -#define R_MIPS_SUB 24 -#define R_MIPS_INSERT_A 25 -#define R_MIPS_INSERT_B 26 -#define R_MIPS_DELETE 27 -#define R_MIPS_HIGHER 28 -#define R_MIPS_HIGHEST 29 -#define R_MIPS_CALL_HI16 30 -#define R_MIPS_CALL_LO16 31 -#define R_MIPS_SCN_DISP 32 -#define R_MIPS_REL16 33 -#define R_MIPS_ADD_IMMEDIATE 34 -#define R_MIPS_PJUMP 35 -#define R_MIPS_RELGOT 36 -#define R_MIPS_JALR 37 -#define R_MIPS_TLS_DTPMOD32 38 -#define R_MIPS_TLS_DTPREL32 39 -#define R_MIPS_TLS_DTPMOD64 40 -#define R_MIPS_TLS_DTPREL64 41 -#define R_MIPS_TLS_GD 42 -#define R_MIPS_TLS_LDM 43 -#define R_MIPS_TLS_DTPREL_HI16 44 -#define R_MIPS_TLS_DTPREL_LO16 45 -#define R_MIPS_TLS_GOTTPREL 46 -#define R_MIPS_TLS_TPREL32 47 -#define R_MIPS_TLS_TPREL64 48 -#define R_MIPS_TLS_TPREL_HI16 49 -#define R_MIPS_TLS_TPREL_LO16 50 -#define R_MIPS_GLOB_DAT 51 -#define R_MIPS_COPY 126 -#define R_MIPS_JUMP_SLOT 127 - -#define R_MIPS_NUM 128 - - - -#define PT_MIPS_REGINFO 0x70000000 -#define PT_MIPS_RTPROC 0x70000001 -#define PT_MIPS_OPTIONS 0x70000002 -#define PT_MIPS_ABIFLAGS 0x70000003 - - - -#define PF_MIPS_LOCAL 0x10000000 - - - -#define DT_MIPS_RLD_VERSION 0x70000001 -#define DT_MIPS_TIME_STAMP 0x70000002 -#define DT_MIPS_ICHECKSUM 0x70000003 -#define DT_MIPS_IVERSION 0x70000004 -#define DT_MIPS_FLAGS 0x70000005 -#define DT_MIPS_BASE_ADDRESS 0x70000006 -#define DT_MIPS_MSYM 0x70000007 -#define DT_MIPS_CONFLICT 0x70000008 -#define DT_MIPS_LIBLIST 0x70000009 -#define DT_MIPS_LOCAL_GOTNO 0x7000000a -#define DT_MIPS_CONFLICTNO 0x7000000b -#define DT_MIPS_LIBLISTNO 0x70000010 -#define DT_MIPS_SYMTABNO 0x70000011 -#define DT_MIPS_UNREFEXTNO 0x70000012 -#define DT_MIPS_GOTSYM 0x70000013 -#define DT_MIPS_HIPAGENO 0x70000014 -#define DT_MIPS_RLD_MAP 0x70000016 -#define DT_MIPS_DELTA_CLASS 0x70000017 -#define DT_MIPS_DELTA_CLASS_NO 0x70000018 - -#define DT_MIPS_DELTA_INSTANCE 0x70000019 -#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a - -#define DT_MIPS_DELTA_RELOC 0x7000001b -#define DT_MIPS_DELTA_RELOC_NO 0x7000001c - -#define DT_MIPS_DELTA_SYM 0x7000001d - -#define DT_MIPS_DELTA_SYM_NO 0x7000001e - -#define DT_MIPS_DELTA_CLASSSYM 0x70000020 - -#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 - -#define DT_MIPS_CXX_FLAGS 0x70000022 -#define DT_MIPS_PIXIE_INIT 0x70000023 -#define DT_MIPS_SYMBOL_LIB 0x70000024 -#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 -#define DT_MIPS_LOCAL_GOTIDX 0x70000026 -#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 -#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 -#define DT_MIPS_OPTIONS 0x70000029 -#define DT_MIPS_INTERFACE 0x7000002a -#define DT_MIPS_DYNSTR_ALIGN 0x7000002b -#define DT_MIPS_INTERFACE_SIZE 0x7000002c -#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d - -#define DT_MIPS_PERF_SUFFIX 0x7000002e - -#define DT_MIPS_COMPACT_SIZE 0x7000002f -#define DT_MIPS_GP_VALUE 0x70000030 -#define DT_MIPS_AUX_DYNAMIC 0x70000031 - -#define DT_MIPS_PLTGOT 0x70000032 - -#define DT_MIPS_RWPLT 0x70000034 -#define DT_MIPS_RLD_MAP_REL 0x70000035 -#define DT_MIPS_NUM 0x36 - - - -#define RHF_NONE 0 -#define RHF_QUICKSTART (1 << 0) -#define RHF_NOTPOT (1 << 1) -#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) -#define RHF_NO_MOVE (1 << 3) -#define RHF_SGI_ONLY (1 << 4) -#define RHF_GUARANTEE_INIT (1 << 5) -#define RHF_DELTA_C_PLUS_PLUS (1 << 6) -#define RHF_GUARANTEE_START_INIT (1 << 7) -#define RHF_PIXIE (1 << 8) -#define RHF_DEFAULT_DELAY_LOAD (1 << 9) -#define RHF_REQUICKSTART (1 << 10) -#define RHF_REQUICKSTARTED (1 << 11) -#define RHF_CORD (1 << 12) -#define RHF_NO_UNRES_UNDEF (1 << 13) -#define RHF_RLD_ORDER_SAFE (1 << 14) - - - -typedef struct { - Elf32_Word l_name; - Elf32_Word l_time_stamp; - Elf32_Word l_checksum; - Elf32_Word l_version; - Elf32_Word l_flags; -} Elf32_Lib; - -typedef struct { - Elf64_Word l_name; - Elf64_Word l_time_stamp; - Elf64_Word l_checksum; - Elf64_Word l_version; - Elf64_Word l_flags; -} Elf64_Lib; - - - - -#define LL_NONE 0 -#define LL_EXACT_MATCH (1 << 0) -#define LL_IGNORE_INT_VER (1 << 1) -#define LL_REQUIRE_MINOR (1 << 2) -#define LL_EXPORTS (1 << 3) -#define LL_DELAY_LOAD (1 << 4) -#define LL_DELTA (1 << 5) - - - -typedef Elf32_Addr Elf32_Conflict; - -typedef struct { - Elf32_Half version; - unsigned char isa_level; - unsigned char isa_rev; - unsigned char gpr_size; - unsigned char cpr1_size; - unsigned char cpr2_size; - unsigned char fp_abi; - Elf32_Word isa_ext; - Elf32_Word ases; - Elf32_Word flags1; - Elf32_Word flags2; -} Elf_MIPS_ABIFlags_v0; - -#define MIPS_AFL_REG_NONE 0x00 -#define MIPS_AFL_REG_32 0x01 -#define MIPS_AFL_REG_64 0x02 -#define MIPS_AFL_REG_128 0x03 - -#define MIPS_AFL_ASE_DSP 0x00000001 -#define MIPS_AFL_ASE_DSPR2 0x00000002 -#define MIPS_AFL_ASE_EVA 0x00000004 -#define MIPS_AFL_ASE_MCU 0x00000008 -#define MIPS_AFL_ASE_MDMX 0x00000010 -#define MIPS_AFL_ASE_MIPS3D 0x00000020 -#define MIPS_AFL_ASE_MT 0x00000040 -#define MIPS_AFL_ASE_SMARTMIPS 0x00000080 -#define MIPS_AFL_ASE_VIRT 0x00000100 -#define MIPS_AFL_ASE_MSA 0x00000200 -#define MIPS_AFL_ASE_MIPS16 0x00000400 -#define MIPS_AFL_ASE_MICROMIPS 0x00000800 -#define MIPS_AFL_ASE_XPA 0x00001000 -#define MIPS_AFL_ASE_MASK 0x00001fff - -#define MIPS_AFL_EXT_XLR 1 -#define MIPS_AFL_EXT_OCTEON2 2 -#define MIPS_AFL_EXT_OCTEONP 3 -#define MIPS_AFL_EXT_LOONGSON_3A 4 -#define MIPS_AFL_EXT_OCTEON 5 -#define MIPS_AFL_EXT_5900 6 -#define MIPS_AFL_EXT_4650 7 -#define MIPS_AFL_EXT_4010 8 -#define MIPS_AFL_EXT_4100 9 -#define MIPS_AFL_EXT_3900 10 -#define MIPS_AFL_EXT_10000 11 -#define MIPS_AFL_EXT_SB1 12 -#define MIPS_AFL_EXT_4111 13 -#define MIPS_AFL_EXT_4120 14 -#define MIPS_AFL_EXT_5400 15 -#define MIPS_AFL_EXT_5500 16 -#define MIPS_AFL_EXT_LOONGSON_2E 17 -#define MIPS_AFL_EXT_LOONGSON_2F 18 - -#define MIPS_AFL_FLAGS1_ODDSPREG 1 - -enum -{ - Val_GNU_MIPS_ABI_FP_ANY = 0, - Val_GNU_MIPS_ABI_FP_DOUBLE = 1, - Val_GNU_MIPS_ABI_FP_SINGLE = 2, - Val_GNU_MIPS_ABI_FP_SOFT = 3, - Val_GNU_MIPS_ABI_FP_OLD_64 = 4, - Val_GNU_MIPS_ABI_FP_XX = 5, - Val_GNU_MIPS_ABI_FP_64 = 6, - Val_GNU_MIPS_ABI_FP_64A = 7, - Val_GNU_MIPS_ABI_FP_MAX = 7 -}; - - - - -#define EF_PARISC_TRAPNIL 0x00010000 -#define EF_PARISC_EXT 0x00020000 -#define EF_PARISC_LSB 0x00040000 -#define EF_PARISC_WIDE 0x00080000 -#define EF_PARISC_NO_KABP 0x00100000 - -#define EF_PARISC_LAZYSWAP 0x00400000 -#define EF_PARISC_ARCH 0x0000ffff - - - -#define EFA_PARISC_1_0 0x020b -#define EFA_PARISC_1_1 0x0210 -#define EFA_PARISC_2_0 0x0214 - - - -#define SHN_PARISC_ANSI_COMMON 0xff00 - -#define SHN_PARISC_HUGE_COMMON 0xff01 - - - -#define SHT_PARISC_EXT 0x70000000 -#define SHT_PARISC_UNWIND 0x70000001 -#define SHT_PARISC_DOC 0x70000002 - - - -#define SHF_PARISC_SHORT 0x20000000 -#define SHF_PARISC_HUGE 0x40000000 -#define SHF_PARISC_SBP 0x80000000 - - - -#define STT_PARISC_MILLICODE 13 - -#define STT_HP_OPAQUE (STT_LOOS + 0x1) -#define STT_HP_STUB (STT_LOOS + 0x2) - - - -#define R_PARISC_NONE 0 -#define R_PARISC_DIR32 1 -#define R_PARISC_DIR21L 2 -#define R_PARISC_DIR17R 3 -#define R_PARISC_DIR17F 4 -#define R_PARISC_DIR14R 6 -#define R_PARISC_PCREL32 9 -#define R_PARISC_PCREL21L 10 -#define R_PARISC_PCREL17R 11 -#define R_PARISC_PCREL17F 12 -#define R_PARISC_PCREL14R 14 -#define R_PARISC_DPREL21L 18 -#define R_PARISC_DPREL14R 22 -#define R_PARISC_GPREL21L 26 -#define R_PARISC_GPREL14R 30 -#define R_PARISC_LTOFF21L 34 -#define R_PARISC_LTOFF14R 38 -#define R_PARISC_SECREL32 41 -#define R_PARISC_SEGBASE 48 -#define R_PARISC_SEGREL32 49 -#define R_PARISC_PLTOFF21L 50 -#define R_PARISC_PLTOFF14R 54 -#define R_PARISC_LTOFF_FPTR32 57 -#define R_PARISC_LTOFF_FPTR21L 58 -#define R_PARISC_LTOFF_FPTR14R 62 -#define R_PARISC_FPTR64 64 -#define R_PARISC_PLABEL32 65 -#define R_PARISC_PLABEL21L 66 -#define R_PARISC_PLABEL14R 70 -#define R_PARISC_PCREL64 72 -#define R_PARISC_PCREL22F 74 -#define R_PARISC_PCREL14WR 75 -#define R_PARISC_PCREL14DR 76 -#define R_PARISC_PCREL16F 77 -#define R_PARISC_PCREL16WF 78 -#define R_PARISC_PCREL16DF 79 -#define R_PARISC_DIR64 80 -#define R_PARISC_DIR14WR 83 -#define R_PARISC_DIR14DR 84 -#define R_PARISC_DIR16F 85 -#define R_PARISC_DIR16WF 86 -#define R_PARISC_DIR16DF 87 -#define R_PARISC_GPREL64 88 -#define R_PARISC_GPREL14WR 91 -#define R_PARISC_GPREL14DR 92 -#define R_PARISC_GPREL16F 93 -#define R_PARISC_GPREL16WF 94 -#define R_PARISC_GPREL16DF 95 -#define R_PARISC_LTOFF64 96 -#define R_PARISC_LTOFF14WR 99 -#define R_PARISC_LTOFF14DR 100 -#define R_PARISC_LTOFF16F 101 -#define R_PARISC_LTOFF16WF 102 -#define R_PARISC_LTOFF16DF 103 -#define R_PARISC_SECREL64 104 -#define R_PARISC_SEGREL64 112 -#define R_PARISC_PLTOFF14WR 115 -#define R_PARISC_PLTOFF14DR 116 -#define R_PARISC_PLTOFF16F 117 -#define R_PARISC_PLTOFF16WF 118 -#define R_PARISC_PLTOFF16DF 119 -#define R_PARISC_LTOFF_FPTR64 120 -#define R_PARISC_LTOFF_FPTR14WR 123 -#define R_PARISC_LTOFF_FPTR14DR 124 -#define R_PARISC_LTOFF_FPTR16F 125 -#define R_PARISC_LTOFF_FPTR16WF 126 -#define R_PARISC_LTOFF_FPTR16DF 127 -#define R_PARISC_LORESERVE 128 -#define R_PARISC_COPY 128 -#define R_PARISC_IPLT 129 -#define R_PARISC_EPLT 130 -#define R_PARISC_TPREL32 153 -#define R_PARISC_TPREL21L 154 -#define R_PARISC_TPREL14R 158 -#define R_PARISC_LTOFF_TP21L 162 -#define R_PARISC_LTOFF_TP14R 166 -#define R_PARISC_LTOFF_TP14F 167 -#define R_PARISC_TPREL64 216 -#define R_PARISC_TPREL14WR 219 -#define R_PARISC_TPREL14DR 220 -#define R_PARISC_TPREL16F 221 -#define R_PARISC_TPREL16WF 222 -#define R_PARISC_TPREL16DF 223 -#define R_PARISC_LTOFF_TP64 224 -#define R_PARISC_LTOFF_TP14WR 227 -#define R_PARISC_LTOFF_TP14DR 228 -#define R_PARISC_LTOFF_TP16F 229 -#define R_PARISC_LTOFF_TP16WF 230 -#define R_PARISC_LTOFF_TP16DF 231 -#define R_PARISC_GNU_VTENTRY 232 -#define R_PARISC_GNU_VTINHERIT 233 -#define R_PARISC_TLS_GD21L 234 -#define R_PARISC_TLS_GD14R 235 -#define R_PARISC_TLS_GDCALL 236 -#define R_PARISC_TLS_LDM21L 237 -#define R_PARISC_TLS_LDM14R 238 -#define R_PARISC_TLS_LDMCALL 239 -#define R_PARISC_TLS_LDO21L 240 -#define R_PARISC_TLS_LDO14R 241 -#define R_PARISC_TLS_DTPMOD32 242 -#define R_PARISC_TLS_DTPMOD64 243 -#define R_PARISC_TLS_DTPOFF32 244 -#define R_PARISC_TLS_DTPOFF64 245 -#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L -#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R -#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L -#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R -#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 -#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 -#define R_PARISC_HIRESERVE 255 - - - -#define PT_HP_TLS (PT_LOOS + 0x0) -#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -#define PT_HP_PARALLEL (PT_LOOS + 0x10) -#define PT_HP_FASTBIND (PT_LOOS + 0x11) -#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) -#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) -#define PT_HP_STACK (PT_LOOS + 0x14) - -#define PT_PARISC_ARCHEXT 0x70000000 -#define PT_PARISC_UNWIND 0x70000001 - - - -#define PF_PARISC_SBP 0x08000000 - -#define PF_HP_PAGE_SIZE 0x00100000 -#define PF_HP_FAR_SHARED 0x00200000 -#define PF_HP_NEAR_SHARED 0x00400000 -#define PF_HP_CODE 0x01000000 -#define PF_HP_MODIFY 0x02000000 -#define PF_HP_LAZYSWAP 0x04000000 -#define PF_HP_SBP 0x08000000 - - - - - - -#define EF_ALPHA_32BIT 1 -#define EF_ALPHA_CANRELAX 2 - - - - -#define SHT_ALPHA_DEBUG 0x70000001 -#define SHT_ALPHA_REGINFO 0x70000002 - - - -#define SHF_ALPHA_GPREL 0x10000000 - - -#define STO_ALPHA_NOPV 0x80 -#define STO_ALPHA_STD_GPLOAD 0x88 - - - -#define R_ALPHA_NONE 0 -#define R_ALPHA_REFLONG 1 -#define R_ALPHA_REFQUAD 2 -#define R_ALPHA_GPREL32 3 -#define R_ALPHA_LITERAL 4 -#define R_ALPHA_LITUSE 5 -#define R_ALPHA_GPDISP 6 -#define R_ALPHA_BRADDR 7 -#define R_ALPHA_HINT 8 -#define R_ALPHA_SREL16 9 -#define R_ALPHA_SREL32 10 -#define R_ALPHA_SREL64 11 -#define R_ALPHA_GPRELHIGH 17 -#define R_ALPHA_GPRELLOW 18 -#define R_ALPHA_GPREL16 19 -#define R_ALPHA_COPY 24 -#define R_ALPHA_GLOB_DAT 25 -#define R_ALPHA_JMP_SLOT 26 -#define R_ALPHA_RELATIVE 27 -#define R_ALPHA_TLS_GD_HI 28 -#define R_ALPHA_TLSGD 29 -#define R_ALPHA_TLS_LDM 30 -#define R_ALPHA_DTPMOD64 31 -#define R_ALPHA_GOTDTPREL 32 -#define R_ALPHA_DTPREL64 33 -#define R_ALPHA_DTPRELHI 34 -#define R_ALPHA_DTPRELLO 35 -#define R_ALPHA_DTPREL16 36 -#define R_ALPHA_GOTTPREL 37 -#define R_ALPHA_TPREL64 38 -#define R_ALPHA_TPRELHI 39 -#define R_ALPHA_TPRELLO 40 -#define R_ALPHA_TPREL16 41 - -#define R_ALPHA_NUM 46 - - -#define LITUSE_ALPHA_ADDR 0 -#define LITUSE_ALPHA_BASE 1 -#define LITUSE_ALPHA_BYTOFF 2 -#define LITUSE_ALPHA_JSR 3 -#define LITUSE_ALPHA_TLS_GD 4 -#define LITUSE_ALPHA_TLS_LDM 5 - - -#define DT_ALPHA_PLTRO (DT_LOPROC + 0) -#define DT_ALPHA_NUM 1 - - - - -#define EF_PPC_EMB 0x80000000 - - -#define EF_PPC_RELOCATABLE 0x00010000 -#define EF_PPC_RELOCATABLE_LIB 0x00008000 - - - -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 -#define R_PPC_ADDR24 2 -#define R_PPC_ADDR16 3 -#define R_PPC_ADDR16_LO 4 -#define R_PPC_ADDR16_HI 5 -#define R_PPC_ADDR16_HA 6 -#define R_PPC_ADDR14 7 -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 -#define R_PPC_REL14 11 -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 - - -#define R_PPC_TLS 67 -#define R_PPC_DTPMOD32 68 -#define R_PPC_TPREL16 69 -#define R_PPC_TPREL16_LO 70 -#define R_PPC_TPREL16_HI 71 -#define R_PPC_TPREL16_HA 72 -#define R_PPC_TPREL32 73 -#define R_PPC_DTPREL16 74 -#define R_PPC_DTPREL16_LO 75 -#define R_PPC_DTPREL16_HI 76 -#define R_PPC_DTPREL16_HA 77 -#define R_PPC_DTPREL32 78 -#define R_PPC_GOT_TLSGD16 79 -#define R_PPC_GOT_TLSGD16_LO 80 -#define R_PPC_GOT_TLSGD16_HI 81 -#define R_PPC_GOT_TLSGD16_HA 82 -#define R_PPC_GOT_TLSLD16 83 -#define R_PPC_GOT_TLSLD16_LO 84 -#define R_PPC_GOT_TLSLD16_HI 85 -#define R_PPC_GOT_TLSLD16_HA 86 -#define R_PPC_GOT_TPREL16 87 -#define R_PPC_GOT_TPREL16_LO 88 -#define R_PPC_GOT_TPREL16_HI 89 -#define R_PPC_GOT_TPREL16_HA 90 -#define R_PPC_GOT_DTPREL16 91 -#define R_PPC_GOT_DTPREL16_LO 92 -#define R_PPC_GOT_DTPREL16_HI 93 -#define R_PPC_GOT_DTPREL16_HA 94 -#define R_PPC_TLSGD 95 -#define R_PPC_TLSLD 96 - - -#define R_PPC_EMB_NADDR32 101 -#define R_PPC_EMB_NADDR16 102 -#define R_PPC_EMB_NADDR16_LO 103 -#define R_PPC_EMB_NADDR16_HI 104 -#define R_PPC_EMB_NADDR16_HA 105 -#define R_PPC_EMB_SDAI16 106 -#define R_PPC_EMB_SDA2I16 107 -#define R_PPC_EMB_SDA2REL 108 -#define R_PPC_EMB_SDA21 109 -#define R_PPC_EMB_MRKREF 110 -#define R_PPC_EMB_RELSEC16 111 -#define R_PPC_EMB_RELST_LO 112 -#define R_PPC_EMB_RELST_HI 113 -#define R_PPC_EMB_RELST_HA 114 -#define R_PPC_EMB_BIT_FLD 115 -#define R_PPC_EMB_RELSDA 116 - - -#define R_PPC_DIAB_SDA21_LO 180 -#define R_PPC_DIAB_SDA21_HI 181 -#define R_PPC_DIAB_SDA21_HA 182 -#define R_PPC_DIAB_RELSDA_LO 183 -#define R_PPC_DIAB_RELSDA_HI 184 -#define R_PPC_DIAB_RELSDA_HA 185 - - -#define R_PPC_IRELATIVE 248 - - -#define R_PPC_REL16 249 -#define R_PPC_REL16_LO 250 -#define R_PPC_REL16_HI 251 -#define R_PPC_REL16_HA 252 - - - -#define R_PPC_TOC16 255 - - -#define DT_PPC_GOT (DT_LOPROC + 0) -#define DT_PPC_OPT (DT_LOPROC + 1) -#define DT_PPC_NUM 2 - -#define PPC_OPT_TLS 1 - - -#define R_PPC64_NONE R_PPC_NONE -#define R_PPC64_ADDR32 R_PPC_ADDR32 -#define R_PPC64_ADDR24 R_PPC_ADDR24 -#define R_PPC64_ADDR16 R_PPC_ADDR16 -#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO -#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI -#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA -#define R_PPC64_ADDR14 R_PPC_ADDR14 -#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN -#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN -#define R_PPC64_REL24 R_PPC_REL24 -#define R_PPC64_REL14 R_PPC_REL14 -#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN -#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN -#define R_PPC64_GOT16 R_PPC_GOT16 -#define R_PPC64_GOT16_LO R_PPC_GOT16_LO -#define R_PPC64_GOT16_HI R_PPC_GOT16_HI -#define R_PPC64_GOT16_HA R_PPC_GOT16_HA - -#define R_PPC64_COPY R_PPC_COPY -#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT -#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT -#define R_PPC64_RELATIVE R_PPC_RELATIVE - -#define R_PPC64_UADDR32 R_PPC_UADDR32 -#define R_PPC64_UADDR16 R_PPC_UADDR16 -#define R_PPC64_REL32 R_PPC_REL32 -#define R_PPC64_PLT32 R_PPC_PLT32 -#define R_PPC64_PLTREL32 R_PPC_PLTREL32 -#define R_PPC64_PLT16_LO R_PPC_PLT16_LO -#define R_PPC64_PLT16_HI R_PPC_PLT16_HI -#define R_PPC64_PLT16_HA R_PPC_PLT16_HA - -#define R_PPC64_SECTOFF R_PPC_SECTOFF -#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO -#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI -#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA -#define R_PPC64_ADDR30 37 -#define R_PPC64_ADDR64 38 -#define R_PPC64_ADDR16_HIGHER 39 -#define R_PPC64_ADDR16_HIGHERA 40 -#define R_PPC64_ADDR16_HIGHEST 41 -#define R_PPC64_ADDR16_HIGHESTA 42 -#define R_PPC64_UADDR64 43 -#define R_PPC64_REL64 44 -#define R_PPC64_PLT64 45 -#define R_PPC64_PLTREL64 46 -#define R_PPC64_TOC16 47 -#define R_PPC64_TOC16_LO 48 -#define R_PPC64_TOC16_HI 49 -#define R_PPC64_TOC16_HA 50 -#define R_PPC64_TOC 51 -#define R_PPC64_PLTGOT16 52 -#define R_PPC64_PLTGOT16_LO 53 -#define R_PPC64_PLTGOT16_HI 54 -#define R_PPC64_PLTGOT16_HA 55 - -#define R_PPC64_ADDR16_DS 56 -#define R_PPC64_ADDR16_LO_DS 57 -#define R_PPC64_GOT16_DS 58 -#define R_PPC64_GOT16_LO_DS 59 -#define R_PPC64_PLT16_LO_DS 60 -#define R_PPC64_SECTOFF_DS 61 -#define R_PPC64_SECTOFF_LO_DS 62 -#define R_PPC64_TOC16_DS 63 -#define R_PPC64_TOC16_LO_DS 64 -#define R_PPC64_PLTGOT16_DS 65 -#define R_PPC64_PLTGOT16_LO_DS 66 - - -#define R_PPC64_TLS 67 -#define R_PPC64_DTPMOD64 68 -#define R_PPC64_TPREL16 69 -#define R_PPC64_TPREL16_LO 70 -#define R_PPC64_TPREL16_HI 71 -#define R_PPC64_TPREL16_HA 72 -#define R_PPC64_TPREL64 73 -#define R_PPC64_DTPREL16 74 -#define R_PPC64_DTPREL16_LO 75 -#define R_PPC64_DTPREL16_HI 76 -#define R_PPC64_DTPREL16_HA 77 -#define R_PPC64_DTPREL64 78 -#define R_PPC64_GOT_TLSGD16 79 -#define R_PPC64_GOT_TLSGD16_LO 80 -#define R_PPC64_GOT_TLSGD16_HI 81 -#define R_PPC64_GOT_TLSGD16_HA 82 -#define R_PPC64_GOT_TLSLD16 83 -#define R_PPC64_GOT_TLSLD16_LO 84 -#define R_PPC64_GOT_TLSLD16_HI 85 -#define R_PPC64_GOT_TLSLD16_HA 86 -#define R_PPC64_GOT_TPREL16_DS 87 -#define R_PPC64_GOT_TPREL16_LO_DS 88 -#define R_PPC64_GOT_TPREL16_HI 89 -#define R_PPC64_GOT_TPREL16_HA 90 -#define R_PPC64_GOT_DTPREL16_DS 91 -#define R_PPC64_GOT_DTPREL16_LO_DS 92 -#define R_PPC64_GOT_DTPREL16_HI 93 -#define R_PPC64_GOT_DTPREL16_HA 94 -#define R_PPC64_TPREL16_DS 95 -#define R_PPC64_TPREL16_LO_DS 96 -#define R_PPC64_TPREL16_HIGHER 97 -#define R_PPC64_TPREL16_HIGHERA 98 -#define R_PPC64_TPREL16_HIGHEST 99 -#define R_PPC64_TPREL16_HIGHESTA 100 -#define R_PPC64_DTPREL16_DS 101 -#define R_PPC64_DTPREL16_LO_DS 102 -#define R_PPC64_DTPREL16_HIGHER 103 -#define R_PPC64_DTPREL16_HIGHERA 104 -#define R_PPC64_DTPREL16_HIGHEST 105 -#define R_PPC64_DTPREL16_HIGHESTA 106 -#define R_PPC64_TLSGD 107 -#define R_PPC64_TLSLD 108 -#define R_PPC64_TOCSAVE 109 -#define R_PPC64_ADDR16_HIGH 110 -#define R_PPC64_ADDR16_HIGHA 111 -#define R_PPC64_TPREL16_HIGH 112 -#define R_PPC64_TPREL16_HIGHA 113 -#define R_PPC64_DTPREL16_HIGH 114 -#define R_PPC64_DTPREL16_HIGHA 115 - - -#define R_PPC64_JMP_IREL 247 -#define R_PPC64_IRELATIVE 248 -#define R_PPC64_REL16 249 -#define R_PPC64_REL16_LO 250 -#define R_PPC64_REL16_HI 251 -#define R_PPC64_REL16_HA 252 - -#define EF_PPC64_ABI 3 - -#define DT_PPC64_GLINK (DT_LOPROC + 0) -#define DT_PPC64_OPD (DT_LOPROC + 1) -#define DT_PPC64_OPDSZ (DT_LOPROC + 2) -#define DT_PPC64_OPT (DT_LOPROC + 3) -#define DT_PPC64_NUM 4 - -#define PPC64_OPT_TLS 1 -#define PPC64_OPT_MULTI_TOC 2 -#define PPC64_OPT_LOCALENTRY 4 - -#define STO_PPC64_LOCAL_BIT 5 -#define STO_PPC64_LOCAL_MASK 0xe0 -#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc) - - -#define EF_ARM_RELEXEC 0x01 -#define EF_ARM_HASENTRY 0x02 -#define EF_ARM_INTERWORK 0x04 -#define EF_ARM_APCS_26 0x08 -#define EF_ARM_APCS_FLOAT 0x10 -#define EF_ARM_PIC 0x20 -#define EF_ARM_ALIGN8 0x40 -#define EF_ARM_NEW_ABI 0x80 -#define EF_ARM_OLD_ABI 0x100 -#define EF_ARM_SOFT_FLOAT 0x200 -#define EF_ARM_VFP_FLOAT 0x400 -#define EF_ARM_MAVERICK_FLOAT 0x800 - -#define EF_ARM_ABI_FLOAT_SOFT 0x200 -#define EF_ARM_ABI_FLOAT_HARD 0x400 - - -#define EF_ARM_SYMSARESORTED 0x04 -#define EF_ARM_DYNSYMSUSESEGIDX 0x08 -#define EF_ARM_MAPSYMSFIRST 0x10 -#define EF_ARM_EABIMASK 0XFF000000 - - -#define EF_ARM_BE8 0x00800000 -#define EF_ARM_LE8 0x00400000 - -#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) -#define EF_ARM_EABI_UNKNOWN 0x00000000 -#define EF_ARM_EABI_VER1 0x01000000 -#define EF_ARM_EABI_VER2 0x02000000 -#define EF_ARM_EABI_VER3 0x03000000 -#define EF_ARM_EABI_VER4 0x04000000 -#define EF_ARM_EABI_VER5 0x05000000 - - -#define STT_ARM_TFUNC STT_LOPROC -#define STT_ARM_16BIT STT_HIPROC - - -#define SHF_ARM_ENTRYSECT 0x10000000 -#define SHF_ARM_COMDEF 0x80000000 - - - -#define PF_ARM_SB 0x10000000 - -#define PF_ARM_PI 0x20000000 -#define PF_ARM_ABS 0x40000000 - - -#define PT_ARM_EXIDX (PT_LOPROC + 1) - - -#define SHT_ARM_EXIDX (SHT_LOPROC + 1) -#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) -#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) - -#define R_AARCH64_NONE 0 -#define R_AARCH64_P32_ABS32 1 -#define R_AARCH64_P32_COPY 180 -#define R_AARCH64_P32_GLOB_DAT 181 -#define R_AARCH64_P32_JUMP_SLOT 182 -#define R_AARCH64_P32_RELATIVE 183 -#define R_AARCH64_P32_TLS_DTPMOD 184 -#define R_AARCH64_P32_TLS_DTPREL 185 -#define R_AARCH64_P32_TLS_TPREL 186 -#define R_AARCH64_P32_TLSDESC 187 -#define R_AARCH64_P32_IRELATIVE 188 -#define R_AARCH64_ABS64 257 -#define R_AARCH64_ABS32 258 -#define R_AARCH64_ABS16 259 -#define R_AARCH64_PREL64 260 -#define R_AARCH64_PREL32 261 -#define R_AARCH64_PREL16 262 -#define R_AARCH64_MOVW_UABS_G0 263 -#define R_AARCH64_MOVW_UABS_G0_NC 264 -#define R_AARCH64_MOVW_UABS_G1 265 -#define R_AARCH64_MOVW_UABS_G1_NC 266 -#define R_AARCH64_MOVW_UABS_G2 267 -#define R_AARCH64_MOVW_UABS_G2_NC 268 -#define R_AARCH64_MOVW_UABS_G3 269 -#define R_AARCH64_MOVW_SABS_G0 270 -#define R_AARCH64_MOVW_SABS_G1 271 -#define R_AARCH64_MOVW_SABS_G2 272 -#define R_AARCH64_LD_PREL_LO19 273 -#define R_AARCH64_ADR_PREL_LO21 274 -#define R_AARCH64_ADR_PREL_PG_HI21 275 -#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 -#define R_AARCH64_ADD_ABS_LO12_NC 277 -#define R_AARCH64_LDST8_ABS_LO12_NC 278 -#define R_AARCH64_TSTBR14 279 -#define R_AARCH64_CONDBR19 280 -#define R_AARCH64_JUMP26 282 -#define R_AARCH64_CALL26 283 -#define R_AARCH64_LDST16_ABS_LO12_NC 284 -#define R_AARCH64_LDST32_ABS_LO12_NC 285 -#define R_AARCH64_LDST64_ABS_LO12_NC 286 -#define R_AARCH64_MOVW_PREL_G0 287 -#define R_AARCH64_MOVW_PREL_G0_NC 288 -#define R_AARCH64_MOVW_PREL_G1 289 -#define R_AARCH64_MOVW_PREL_G1_NC 290 -#define R_AARCH64_MOVW_PREL_G2 291 -#define R_AARCH64_MOVW_PREL_G2_NC 292 -#define R_AARCH64_MOVW_PREL_G3 293 -#define R_AARCH64_LDST128_ABS_LO12_NC 299 -#define R_AARCH64_MOVW_GOTOFF_G0 300 -#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 -#define R_AARCH64_MOVW_GOTOFF_G1 302 -#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 -#define R_AARCH64_MOVW_GOTOFF_G2 304 -#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 -#define R_AARCH64_MOVW_GOTOFF_G3 306 -#define R_AARCH64_GOTREL64 307 -#define R_AARCH64_GOTREL32 308 -#define R_AARCH64_GOT_LD_PREL19 309 -#define R_AARCH64_LD64_GOTOFF_LO15 310 -#define R_AARCH64_ADR_GOT_PAGE 311 -#define R_AARCH64_LD64_GOT_LO12_NC 312 -#define R_AARCH64_LD64_GOTPAGE_LO15 313 -#define R_AARCH64_TLSGD_ADR_PREL21 512 -#define R_AARCH64_TLSGD_ADR_PAGE21 513 -#define R_AARCH64_TLSGD_ADD_LO12_NC 514 -#define R_AARCH64_TLSGD_MOVW_G1 515 -#define R_AARCH64_TLSGD_MOVW_G0_NC 516 -#define R_AARCH64_TLSLD_ADR_PREL21 517 -#define R_AARCH64_TLSLD_ADR_PAGE21 518 -#define R_AARCH64_TLSLD_ADD_LO12_NC 519 -#define R_AARCH64_TLSLD_MOVW_G1 520 -#define R_AARCH64_TLSLD_MOVW_G0_NC 521 -#define R_AARCH64_TLSLD_LD_PREL19 522 -#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 -#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 -#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 -#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 -#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 -#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 -#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 -#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 -#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 -#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 -#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 -#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 -#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 -#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 -#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 -#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 -#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 -#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 -#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 -#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 -#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 -#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 -#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 -#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 -#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 -#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 -#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 -#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 -#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 -#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 -#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 -#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 -#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 -#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 -#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 -#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 -#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 -#define R_AARCH64_TLSDESC_LD_PREL19 560 -#define R_AARCH64_TLSDESC_ADR_PREL21 561 -#define R_AARCH64_TLSDESC_ADR_PAGE21 562 -#define R_AARCH64_TLSDESC_LD64_LO12 563 -#define R_AARCH64_TLSDESC_ADD_LO12 564 -#define R_AARCH64_TLSDESC_OFF_G1 565 -#define R_AARCH64_TLSDESC_OFF_G0_NC 566 -#define R_AARCH64_TLSDESC_LDR 567 -#define R_AARCH64_TLSDESC_ADD 568 -#define R_AARCH64_TLSDESC_CALL 569 -#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 -#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 -#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 -#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 -#define R_AARCH64_COPY 1024 -#define R_AARCH64_GLOB_DAT 1025 -#define R_AARCH64_JUMP_SLOT 1026 -#define R_AARCH64_RELATIVE 1027 -#define R_AARCH64_TLS_DTPMOD 1028 -#define R_AARCH64_TLS_DTPMOD64 1028 -#define R_AARCH64_TLS_DTPREL 1029 -#define R_AARCH64_TLS_DTPREL64 1029 -#define R_AARCH64_TLS_TPREL 1030 -#define R_AARCH64_TLS_TPREL64 1030 -#define R_AARCH64_TLSDESC 1031 - - -#define R_ARM_NONE 0 -#define R_ARM_PC24 1 -#define R_ARM_ABS32 2 -#define R_ARM_REL32 3 -#define R_ARM_PC13 4 -#define R_ARM_ABS16 5 -#define R_ARM_ABS12 6 -#define R_ARM_THM_ABS5 7 -#define R_ARM_ABS8 8 -#define R_ARM_SBREL32 9 -#define R_ARM_THM_PC22 10 -#define R_ARM_THM_PC8 11 -#define R_ARM_AMP_VCALL9 12 -#define R_ARM_TLS_DESC 13 -#define R_ARM_THM_SWI8 14 -#define R_ARM_XPC25 15 -#define R_ARM_THM_XPC22 16 -#define R_ARM_TLS_DTPMOD32 17 -#define R_ARM_TLS_DTPOFF32 18 -#define R_ARM_TLS_TPOFF32 19 -#define R_ARM_COPY 20 -#define R_ARM_GLOB_DAT 21 -#define R_ARM_JUMP_SLOT 22 -#define R_ARM_RELATIVE 23 -#define R_ARM_GOTOFF 24 -#define R_ARM_GOTPC 25 -#define R_ARM_GOT32 26 -#define R_ARM_PLT32 27 -#define R_ARM_CALL 28 -#define R_ARM_JUMP24 29 -#define R_ARM_THM_JUMP24 30 -#define R_ARM_BASE_ABS 31 -#define R_ARM_ALU_PCREL_7_0 32 -#define R_ARM_ALU_PCREL_15_8 33 -#define R_ARM_ALU_PCREL_23_15 34 -#define R_ARM_LDR_SBREL_11_0 35 -#define R_ARM_ALU_SBREL_19_12 36 -#define R_ARM_ALU_SBREL_27_20 37 -#define R_ARM_TARGET1 38 -#define R_ARM_SBREL31 39 -#define R_ARM_V4BX 40 -#define R_ARM_TARGET2 41 -#define R_ARM_PREL31 42 -#define R_ARM_MOVW_ABS_NC 43 -#define R_ARM_MOVT_ABS 44 -#define R_ARM_MOVW_PREL_NC 45 -#define R_ARM_MOVT_PREL 46 -#define R_ARM_THM_MOVW_ABS_NC 47 -#define R_ARM_THM_MOVT_ABS 48 -#define R_ARM_THM_MOVW_PREL_NC 49 -#define R_ARM_THM_MOVT_PREL 50 -#define R_ARM_THM_JUMP19 51 -#define R_ARM_THM_JUMP6 52 -#define R_ARM_THM_ALU_PREL_11_0 53 -#define R_ARM_THM_PC12 54 -#define R_ARM_ABS32_NOI 55 -#define R_ARM_REL32_NOI 56 -#define R_ARM_ALU_PC_G0_NC 57 -#define R_ARM_ALU_PC_G0 58 -#define R_ARM_ALU_PC_G1_NC 59 -#define R_ARM_ALU_PC_G1 60 -#define R_ARM_ALU_PC_G2 61 -#define R_ARM_LDR_PC_G1 62 -#define R_ARM_LDR_PC_G2 63 -#define R_ARM_LDRS_PC_G0 64 -#define R_ARM_LDRS_PC_G1 65 -#define R_ARM_LDRS_PC_G2 66 -#define R_ARM_LDC_PC_G0 67 -#define R_ARM_LDC_PC_G1 68 -#define R_ARM_LDC_PC_G2 69 -#define R_ARM_ALU_SB_G0_NC 70 -#define R_ARM_ALU_SB_G0 71 -#define R_ARM_ALU_SB_G1_NC 72 -#define R_ARM_ALU_SB_G1 73 -#define R_ARM_ALU_SB_G2 74 -#define R_ARM_LDR_SB_G0 75 -#define R_ARM_LDR_SB_G1 76 -#define R_ARM_LDR_SB_G2 77 -#define R_ARM_LDRS_SB_G0 78 -#define R_ARM_LDRS_SB_G1 79 -#define R_ARM_LDRS_SB_G2 80 -#define R_ARM_LDC_SB_G0 81 -#define R_ARM_LDC_SB_G1 82 -#define R_ARM_LDC_SB_G2 83 -#define R_ARM_MOVW_BREL_NC 84 -#define R_ARM_MOVT_BREL 85 -#define R_ARM_MOVW_BREL 86 -#define R_ARM_THM_MOVW_BREL_NC 87 -#define R_ARM_THM_MOVT_BREL 88 -#define R_ARM_THM_MOVW_BREL 89 -#define R_ARM_TLS_GOTDESC 90 -#define R_ARM_TLS_CALL 91 -#define R_ARM_TLS_DESCSEQ 92 -#define R_ARM_THM_TLS_CALL 93 -#define R_ARM_PLT32_ABS 94 -#define R_ARM_GOT_ABS 95 -#define R_ARM_GOT_PREL 96 -#define R_ARM_GOT_BREL12 97 -#define R_ARM_GOTOFF12 98 -#define R_ARM_GOTRELAX 99 -#define R_ARM_GNU_VTENTRY 100 -#define R_ARM_GNU_VTINHERIT 101 -#define R_ARM_THM_PC11 102 -#define R_ARM_THM_PC9 103 -#define R_ARM_TLS_GD32 104 - -#define R_ARM_TLS_LDM32 105 - -#define R_ARM_TLS_LDO32 106 - -#define R_ARM_TLS_IE32 107 - -#define R_ARM_TLS_LE32 108 -#define R_ARM_TLS_LDO12 109 -#define R_ARM_TLS_LE12 110 -#define R_ARM_TLS_IE12GP 111 -#define R_ARM_ME_TOO 128 -#define R_ARM_THM_TLS_DESCSEQ 129 -#define R_ARM_THM_TLS_DESCSEQ16 129 -#define R_ARM_THM_TLS_DESCSEQ32 130 -#define R_ARM_THM_GOT_BREL12 131 -#define R_ARM_IRELATIVE 160 -#define R_ARM_RXPC25 249 -#define R_ARM_RSBREL32 250 -#define R_ARM_THM_RPC22 251 -#define R_ARM_RREL32 252 -#define R_ARM_RABS22 253 -#define R_ARM_RPC24 254 -#define R_ARM_RBASE 255 - -#define R_ARM_NUM 256 - - - - -#define EF_IA_64_MASKOS 0x0000000f -#define EF_IA_64_ABI64 0x00000010 -#define EF_IA_64_ARCH 0xff000000 - - -#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) -#define PT_IA_64_UNWIND (PT_LOPROC + 1) -#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) -#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) -#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) - - -#define PF_IA_64_NORECOV 0x80000000 - - -#define SHT_IA_64_EXT (SHT_LOPROC + 0) -#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) - - -#define SHF_IA_64_SHORT 0x10000000 -#define SHF_IA_64_NORECOV 0x20000000 - - -#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) -#define DT_IA_64_NUM 1 - - -#define R_IA64_NONE 0x00 -#define R_IA64_IMM14 0x21 -#define R_IA64_IMM22 0x22 -#define R_IA64_IMM64 0x23 -#define R_IA64_DIR32MSB 0x24 -#define R_IA64_DIR32LSB 0x25 -#define R_IA64_DIR64MSB 0x26 -#define R_IA64_DIR64LSB 0x27 -#define R_IA64_GPREL22 0x2a -#define R_IA64_GPREL64I 0x2b -#define R_IA64_GPREL32MSB 0x2c -#define R_IA64_GPREL32LSB 0x2d -#define R_IA64_GPREL64MSB 0x2e -#define R_IA64_GPREL64LSB 0x2f -#define R_IA64_LTOFF22 0x32 -#define R_IA64_LTOFF64I 0x33 -#define R_IA64_PLTOFF22 0x3a -#define R_IA64_PLTOFF64I 0x3b -#define R_IA64_PLTOFF64MSB 0x3e -#define R_IA64_PLTOFF64LSB 0x3f -#define R_IA64_FPTR64I 0x43 -#define R_IA64_FPTR32MSB 0x44 -#define R_IA64_FPTR32LSB 0x45 -#define R_IA64_FPTR64MSB 0x46 -#define R_IA64_FPTR64LSB 0x47 -#define R_IA64_PCREL60B 0x48 -#define R_IA64_PCREL21B 0x49 -#define R_IA64_PCREL21M 0x4a -#define R_IA64_PCREL21F 0x4b -#define R_IA64_PCREL32MSB 0x4c -#define R_IA64_PCREL32LSB 0x4d -#define R_IA64_PCREL64MSB 0x4e -#define R_IA64_PCREL64LSB 0x4f -#define R_IA64_LTOFF_FPTR22 0x52 -#define R_IA64_LTOFF_FPTR64I 0x53 -#define R_IA64_LTOFF_FPTR32MSB 0x54 -#define R_IA64_LTOFF_FPTR32LSB 0x55 -#define R_IA64_LTOFF_FPTR64MSB 0x56 -#define R_IA64_LTOFF_FPTR64LSB 0x57 -#define R_IA64_SEGREL32MSB 0x5c -#define R_IA64_SEGREL32LSB 0x5d -#define R_IA64_SEGREL64MSB 0x5e -#define R_IA64_SEGREL64LSB 0x5f -#define R_IA64_SECREL32MSB 0x64 -#define R_IA64_SECREL32LSB 0x65 -#define R_IA64_SECREL64MSB 0x66 -#define R_IA64_SECREL64LSB 0x67 -#define R_IA64_REL32MSB 0x6c -#define R_IA64_REL32LSB 0x6d -#define R_IA64_REL64MSB 0x6e -#define R_IA64_REL64LSB 0x6f -#define R_IA64_LTV32MSB 0x74 -#define R_IA64_LTV32LSB 0x75 -#define R_IA64_LTV64MSB 0x76 -#define R_IA64_LTV64LSB 0x77 -#define R_IA64_PCREL21BI 0x79 -#define R_IA64_PCREL22 0x7a -#define R_IA64_PCREL64I 0x7b -#define R_IA64_IPLTMSB 0x80 -#define R_IA64_IPLTLSB 0x81 -#define R_IA64_COPY 0x84 -#define R_IA64_SUB 0x85 -#define R_IA64_LTOFF22X 0x86 -#define R_IA64_LDXMOV 0x87 -#define R_IA64_TPREL14 0x91 -#define R_IA64_TPREL22 0x92 -#define R_IA64_TPREL64I 0x93 -#define R_IA64_TPREL64MSB 0x96 -#define R_IA64_TPREL64LSB 0x97 -#define R_IA64_LTOFF_TPREL22 0x9a -#define R_IA64_DTPMOD64MSB 0xa6 -#define R_IA64_DTPMOD64LSB 0xa7 -#define R_IA64_LTOFF_DTPMOD22 0xaa -#define R_IA64_DTPREL14 0xb1 -#define R_IA64_DTPREL22 0xb2 -#define R_IA64_DTPREL64I 0xb3 -#define R_IA64_DTPREL32MSB 0xb4 -#define R_IA64_DTPREL32LSB 0xb5 -#define R_IA64_DTPREL64MSB 0xb6 -#define R_IA64_DTPREL64LSB 0xb7 -#define R_IA64_LTOFF_DTPREL22 0xba - - -#define EF_SH_MACH_MASK 0x1f -#define EF_SH_UNKNOWN 0x0 -#define EF_SH1 0x1 -#define EF_SH2 0x2 -#define EF_SH3 0x3 -#define EF_SH_DSP 0x4 -#define EF_SH3_DSP 0x5 -#define EF_SH4AL_DSP 0x6 -#define EF_SH3E 0x8 -#define EF_SH4 0x9 -#define EF_SH2E 0xb -#define EF_SH4A 0xc -#define EF_SH2A 0xd -#define EF_SH4_NOFPU 0x10 -#define EF_SH4A_NOFPU 0x11 -#define EF_SH4_NOMMU_NOFPU 0x12 -#define EF_SH2A_NOFPU 0x13 -#define EF_SH3_NOMMU 0x14 -#define EF_SH2A_SH4_NOFPU 0x15 -#define EF_SH2A_SH3_NOFPU 0x16 -#define EF_SH2A_SH4 0x17 -#define EF_SH2A_SH3E 0x18 - -#define R_SH_NONE 0 -#define R_SH_DIR32 1 -#define R_SH_REL32 2 -#define R_SH_DIR8WPN 3 -#define R_SH_IND12W 4 -#define R_SH_DIR8WPL 5 -#define R_SH_DIR8WPZ 6 -#define R_SH_DIR8BP 7 -#define R_SH_DIR8W 8 -#define R_SH_DIR8L 9 -#define R_SH_SWITCH16 25 -#define R_SH_SWITCH32 26 -#define R_SH_USES 27 -#define R_SH_COUNT 28 -#define R_SH_ALIGN 29 -#define R_SH_CODE 30 -#define R_SH_DATA 31 -#define R_SH_LABEL 32 -#define R_SH_SWITCH8 33 -#define R_SH_GNU_VTINHERIT 34 -#define R_SH_GNU_VTENTRY 35 -#define R_SH_TLS_GD_32 144 -#define R_SH_TLS_LD_32 145 -#define R_SH_TLS_LDO_32 146 -#define R_SH_TLS_IE_32 147 -#define R_SH_TLS_LE_32 148 -#define R_SH_TLS_DTPMOD32 149 -#define R_SH_TLS_DTPOFF32 150 -#define R_SH_TLS_TPOFF32 151 -#define R_SH_GOT32 160 -#define R_SH_PLT32 161 -#define R_SH_COPY 162 -#define R_SH_GLOB_DAT 163 -#define R_SH_JMP_SLOT 164 -#define R_SH_RELATIVE 165 -#define R_SH_GOTOFF 166 -#define R_SH_GOTPC 167 -#define R_SH_GOT20 201 -#define R_SH_GOTOFF20 202 -#define R_SH_GOTFUNCDESC 203 -#define R_SH_GOTFUNCDEST20 204 -#define R_SH_GOTOFFFUNCDESC 205 -#define R_SH_GOTOFFFUNCDEST20 206 -#define R_SH_FUNCDESC 207 -#define R_SH_FUNCDESC_VALUE 208 - -#define R_SH_NUM 256 - - - -#define R_390_NONE 0 -#define R_390_8 1 -#define R_390_12 2 -#define R_390_16 3 -#define R_390_32 4 -#define R_390_PC32 5 -#define R_390_GOT12 6 -#define R_390_GOT32 7 -#define R_390_PLT32 8 -#define R_390_COPY 9 -#define R_390_GLOB_DAT 10 -#define R_390_JMP_SLOT 11 -#define R_390_RELATIVE 12 -#define R_390_GOTOFF32 13 -#define R_390_GOTPC 14 -#define R_390_GOT16 15 -#define R_390_PC16 16 -#define R_390_PC16DBL 17 -#define R_390_PLT16DBL 18 -#define R_390_PC32DBL 19 -#define R_390_PLT32DBL 20 -#define R_390_GOTPCDBL 21 -#define R_390_64 22 -#define R_390_PC64 23 -#define R_390_GOT64 24 -#define R_390_PLT64 25 -#define R_390_GOTENT 26 -#define R_390_GOTOFF16 27 -#define R_390_GOTOFF64 28 -#define R_390_GOTPLT12 29 -#define R_390_GOTPLT16 30 -#define R_390_GOTPLT32 31 -#define R_390_GOTPLT64 32 -#define R_390_GOTPLTENT 33 -#define R_390_PLTOFF16 34 -#define R_390_PLTOFF32 35 -#define R_390_PLTOFF64 36 -#define R_390_TLS_LOAD 37 -#define R_390_TLS_GDCALL 38 - -#define R_390_TLS_LDCALL 39 - -#define R_390_TLS_GD32 40 - -#define R_390_TLS_GD64 41 - -#define R_390_TLS_GOTIE12 42 - -#define R_390_TLS_GOTIE32 43 - -#define R_390_TLS_GOTIE64 44 - -#define R_390_TLS_LDM32 45 - -#define R_390_TLS_LDM64 46 - -#define R_390_TLS_IE32 47 - -#define R_390_TLS_IE64 48 - -#define R_390_TLS_IEENT 49 - -#define R_390_TLS_LE32 50 - -#define R_390_TLS_LE64 51 - -#define R_390_TLS_LDO32 52 - -#define R_390_TLS_LDO64 53 - -#define R_390_TLS_DTPMOD 54 -#define R_390_TLS_DTPOFF 55 -#define R_390_TLS_TPOFF 56 - -#define R_390_20 57 -#define R_390_GOT20 58 -#define R_390_GOTPLT20 59 -#define R_390_TLS_GOTIE20 60 - - -#define R_390_NUM 61 - - - -#define R_CRIS_NONE 0 -#define R_CRIS_8 1 -#define R_CRIS_16 2 -#define R_CRIS_32 3 -#define R_CRIS_8_PCREL 4 -#define R_CRIS_16_PCREL 5 -#define R_CRIS_32_PCREL 6 -#define R_CRIS_GNU_VTINHERIT 7 -#define R_CRIS_GNU_VTENTRY 8 -#define R_CRIS_COPY 9 -#define R_CRIS_GLOB_DAT 10 -#define R_CRIS_JUMP_SLOT 11 -#define R_CRIS_RELATIVE 12 -#define R_CRIS_16_GOT 13 -#define R_CRIS_32_GOT 14 -#define R_CRIS_16_GOTPLT 15 -#define R_CRIS_32_GOTPLT 16 -#define R_CRIS_32_GOTREL 17 -#define R_CRIS_32_PLT_GOTREL 18 -#define R_CRIS_32_PLT_PCREL 19 - -#define R_CRIS_NUM 20 - - - -#define R_X86_64_NONE 0 -#define R_X86_64_64 1 -#define R_X86_64_PC32 2 -#define R_X86_64_GOT32 3 -#define R_X86_64_PLT32 4 -#define R_X86_64_COPY 5 -#define R_X86_64_GLOB_DAT 6 -#define R_X86_64_JUMP_SLOT 7 -#define R_X86_64_RELATIVE 8 -#define R_X86_64_GOTPCREL 9 - -#define R_X86_64_32 10 -#define R_X86_64_32S 11 -#define R_X86_64_16 12 -#define R_X86_64_PC16 13 -#define R_X86_64_8 14 -#define R_X86_64_PC8 15 -#define R_X86_64_DTPMOD64 16 -#define R_X86_64_DTPOFF64 17 -#define R_X86_64_TPOFF64 18 -#define R_X86_64_TLSGD 19 - -#define R_X86_64_TLSLD 20 - -#define R_X86_64_DTPOFF32 21 -#define R_X86_64_GOTTPOFF 22 - -#define R_X86_64_TPOFF32 23 -#define R_X86_64_PC64 24 -#define R_X86_64_GOTOFF64 25 -#define R_X86_64_GOTPC32 26 -#define R_X86_64_GOT64 27 -#define R_X86_64_GOTPCREL64 28 -#define R_X86_64_GOTPC64 29 -#define R_X86_64_GOTPLT64 30 -#define R_X86_64_PLTOFF64 31 -#define R_X86_64_SIZE32 32 -#define R_X86_64_SIZE64 33 - -#define R_X86_64_GOTPC32_TLSDESC 34 -#define R_X86_64_TLSDESC_CALL 35 - -#define R_X86_64_TLSDESC 36 -#define R_X86_64_IRELATIVE 37 -#define R_X86_64_RELATIVE64 38 -#define R_X86_64_GOTPCRELX 41 -#define R_X86_64_REX_GOTPCRELX 42 -#define R_X86_64_NUM 43 - - - -#define R_MN10300_NONE 0 -#define R_MN10300_32 1 -#define R_MN10300_16 2 -#define R_MN10300_8 3 -#define R_MN10300_PCREL32 4 -#define R_MN10300_PCREL16 5 -#define R_MN10300_PCREL8 6 -#define R_MN10300_GNU_VTINHERIT 7 -#define R_MN10300_GNU_VTENTRY 8 -#define R_MN10300_24 9 -#define R_MN10300_GOTPC32 10 -#define R_MN10300_GOTPC16 11 -#define R_MN10300_GOTOFF32 12 -#define R_MN10300_GOTOFF24 13 -#define R_MN10300_GOTOFF16 14 -#define R_MN10300_PLT32 15 -#define R_MN10300_PLT16 16 -#define R_MN10300_GOT32 17 -#define R_MN10300_GOT24 18 -#define R_MN10300_GOT16 19 -#define R_MN10300_COPY 20 -#define R_MN10300_GLOB_DAT 21 -#define R_MN10300_JMP_SLOT 22 -#define R_MN10300_RELATIVE 23 - -#define R_MN10300_NUM 24 - - - -#define R_M32R_NONE 0 -#define R_M32R_16 1 -#define R_M32R_32 2 -#define R_M32R_24 3 -#define R_M32R_10_PCREL 4 -#define R_M32R_18_PCREL 5 -#define R_M32R_26_PCREL 6 -#define R_M32R_HI16_ULO 7 -#define R_M32R_HI16_SLO 8 -#define R_M32R_LO16 9 -#define R_M32R_SDA16 10 -#define R_M32R_GNU_VTINHERIT 11 -#define R_M32R_GNU_VTENTRY 12 - -#define R_M32R_16_RELA 33 -#define R_M32R_32_RELA 34 -#define R_M32R_24_RELA 35 -#define R_M32R_10_PCREL_RELA 36 -#define R_M32R_18_PCREL_RELA 37 -#define R_M32R_26_PCREL_RELA 38 -#define R_M32R_HI16_ULO_RELA 39 -#define R_M32R_HI16_SLO_RELA 40 -#define R_M32R_LO16_RELA 41 -#define R_M32R_SDA16_RELA 42 -#define R_M32R_RELA_GNU_VTINHERIT 43 -#define R_M32R_RELA_GNU_VTENTRY 44 -#define R_M32R_REL32 45 - -#define R_M32R_GOT24 48 -#define R_M32R_26_PLTREL 49 -#define R_M32R_COPY 50 -#define R_M32R_GLOB_DAT 51 -#define R_M32R_JMP_SLOT 52 -#define R_M32R_RELATIVE 53 -#define R_M32R_GOTOFF 54 -#define R_M32R_GOTPC24 55 -#define R_M32R_GOT16_HI_ULO 56 - -#define R_M32R_GOT16_HI_SLO 57 - -#define R_M32R_GOT16_LO 58 -#define R_M32R_GOTPC_HI_ULO 59 - -#define R_M32R_GOTPC_HI_SLO 60 - -#define R_M32R_GOTPC_LO 61 - -#define R_M32R_GOTOFF_HI_ULO 62 - -#define R_M32R_GOTOFF_HI_SLO 63 - -#define R_M32R_GOTOFF_LO 64 -#define R_M32R_NUM 256 - -#define R_MICROBLAZE_NONE 0 -#define R_MICROBLAZE_32 1 -#define R_MICROBLAZE_32_PCREL 2 -#define R_MICROBLAZE_64_PCREL 3 -#define R_MICROBLAZE_32_PCREL_LO 4 -#define R_MICROBLAZE_64 5 -#define R_MICROBLAZE_32_LO 6 -#define R_MICROBLAZE_SRO32 7 -#define R_MICROBLAZE_SRW32 8 -#define R_MICROBLAZE_64_NONE 9 -#define R_MICROBLAZE_32_SYM_OP_SYM 10 -#define R_MICROBLAZE_GNU_VTINHERIT 11 -#define R_MICROBLAZE_GNU_VTENTRY 12 -#define R_MICROBLAZE_GOTPC_64 13 -#define R_MICROBLAZE_GOT_64 14 -#define R_MICROBLAZE_PLT_64 15 -#define R_MICROBLAZE_REL 16 -#define R_MICROBLAZE_JUMP_SLOT 17 -#define R_MICROBLAZE_GLOB_DAT 18 -#define R_MICROBLAZE_GOTOFF_64 19 -#define R_MICROBLAZE_GOTOFF_32 20 -#define R_MICROBLAZE_COPY 21 -#define R_MICROBLAZE_TLS 22 -#define R_MICROBLAZE_TLSGD 23 -#define R_MICROBLAZE_TLSLD 24 -#define R_MICROBLAZE_TLSDTPMOD32 25 -#define R_MICROBLAZE_TLSDTPREL32 26 -#define R_MICROBLAZE_TLSDTPREL64 27 -#define R_MICROBLAZE_TLSGOTTPREL32 28 -#define R_MICROBLAZE_TLSTPREL32 29 - -#define DT_NIOS2_GP 0x70000002 - -#define R_NIOS2_NONE 0 -#define R_NIOS2_S16 1 -#define R_NIOS2_U16 2 -#define R_NIOS2_PCREL16 3 -#define R_NIOS2_CALL26 4 -#define R_NIOS2_IMM5 5 -#define R_NIOS2_CACHE_OPX 6 -#define R_NIOS2_IMM6 7 -#define R_NIOS2_IMM8 8 -#define R_NIOS2_HI16 9 -#define R_NIOS2_LO16 10 -#define R_NIOS2_HIADJ16 11 -#define R_NIOS2_BFD_RELOC_32 12 -#define R_NIOS2_BFD_RELOC_16 13 -#define R_NIOS2_BFD_RELOC_8 14 -#define R_NIOS2_GPREL 15 -#define R_NIOS2_GNU_VTINHERIT 16 -#define R_NIOS2_GNU_VTENTRY 17 -#define R_NIOS2_UJMP 18 -#define R_NIOS2_CJMP 19 -#define R_NIOS2_CALLR 20 -#define R_NIOS2_ALIGN 21 -#define R_NIOS2_GOT16 22 -#define R_NIOS2_CALL16 23 -#define R_NIOS2_GOTOFF_LO 24 -#define R_NIOS2_GOTOFF_HA 25 -#define R_NIOS2_PCREL_LO 26 -#define R_NIOS2_PCREL_HA 27 -#define R_NIOS2_TLS_GD16 28 -#define R_NIOS2_TLS_LDM16 29 -#define R_NIOS2_TLS_LDO16 30 -#define R_NIOS2_TLS_IE16 31 -#define R_NIOS2_TLS_LE16 32 -#define R_NIOS2_TLS_DTPMOD 33 -#define R_NIOS2_TLS_DTPREL 34 -#define R_NIOS2_TLS_TPREL 35 -#define R_NIOS2_COPY 36 -#define R_NIOS2_GLOB_DAT 37 -#define R_NIOS2_JUMP_SLOT 38 -#define R_NIOS2_RELATIVE 39 -#define R_NIOS2_GOTOFF 40 -#define R_NIOS2_CALL26_NOAT 41 -#define R_NIOS2_GOT_LO 42 -#define R_NIOS2_GOT_HA 43 -#define R_NIOS2_CALL_LO 44 -#define R_NIOS2_CALL_HA 45 - -#define R_OR1K_NONE 0 -#define R_OR1K_32 1 -#define R_OR1K_16 2 -#define R_OR1K_8 3 -#define R_OR1K_LO_16_IN_INSN 4 -#define R_OR1K_HI_16_IN_INSN 5 -#define R_OR1K_INSN_REL_26 6 -#define R_OR1K_GNU_VTENTRY 7 -#define R_OR1K_GNU_VTINHERIT 8 -#define R_OR1K_32_PCREL 9 -#define R_OR1K_16_PCREL 10 -#define R_OR1K_8_PCREL 11 -#define R_OR1K_GOTPC_HI16 12 -#define R_OR1K_GOTPC_LO16 13 -#define R_OR1K_GOT16 14 -#define R_OR1K_PLT26 15 -#define R_OR1K_GOTOFF_HI16 16 -#define R_OR1K_GOTOFF_LO16 17 -#define R_OR1K_COPY 18 -#define R_OR1K_GLOB_DAT 19 -#define R_OR1K_JMP_SLOT 20 -#define R_OR1K_RELATIVE 21 -#define R_OR1K_TLS_GD_HI16 22 -#define R_OR1K_TLS_GD_LO16 23 -#define R_OR1K_TLS_LDM_HI16 24 -#define R_OR1K_TLS_LDM_LO16 25 -#define R_OR1K_TLS_LDO_HI16 26 -#define R_OR1K_TLS_LDO_LO16 27 -#define R_OR1K_TLS_IE_HI16 28 -#define R_OR1K_TLS_IE_LO16 29 -#define R_OR1K_TLS_LE_HI16 30 -#define R_OR1K_TLS_LE_LO16 31 -#define R_OR1K_TLS_TPOFF 32 -#define R_OR1K_TLS_DTPOFF 33 -#define R_OR1K_TLS_DTPMOD 34 - -#define R_BPF_NONE 0 -#define R_BPF_MAP_FD 1 - -#ifdef __cplusplus -} -#endif - - -#endif +#ifndef _ELF_H +#define _ELF_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +typedef uint16_t Elf32_Half; +typedef uint16_t Elf64_Half; + +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; + +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +typedef uint32_t Elf32_Addr; +typedef uint64_t Elf64_Addr; + +typedef uint32_t Elf32_Off; +typedef uint64_t Elf64_Off; + +typedef uint16_t Elf32_Section; +typedef uint16_t Elf64_Section; + +typedef Elf32_Half Elf32_Versym; +typedef Elf64_Half Elf64_Versym; + +#define EI_NIDENT (16) + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +typedef struct { + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +#define EI_MAG0 0 +#define ELFMAG0 0x7f + +#define EI_MAG1 1 +#define ELFMAG1 'E' + +#define EI_MAG2 2 +#define ELFMAG2 'L' + +#define EI_MAG3 3 +#define ELFMAG3 'F' + + +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define EI_CLASS 4 +#define ELFCLASSNONE 0 +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define EI_DATA 5 +#define ELFDATANONE 0 +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 +#define ELFDATANUM 3 + +#define EI_VERSION 6 + + +#define EI_OSABI 7 +#define ELFOSABI_NONE 0 +#define ELFOSABI_SYSV 0 +#define ELFOSABI_HPUX 1 +#define ELFOSABI_NETBSD 2 +#define ELFOSABI_LINUX 3 +#define ELFOSABI_GNU 3 +#define ELFOSABI_SOLARIS 6 +#define ELFOSABI_AIX 7 +#define ELFOSABI_IRIX 8 +#define ELFOSABI_FREEBSD 9 +#define ELFOSABI_TRU64 10 +#define ELFOSABI_MODESTO 11 +#define ELFOSABI_OPENBSD 12 +#define ELFOSABI_ARM 97 +#define ELFOSABI_STANDALONE 255 + +#define EI_ABIVERSION 8 + +#define EI_PAD 9 + + + +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_NUM 5 +#define ET_LOOS 0xfe00 +#define ET_HIOS 0xfeff +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + + + +#define EM_NONE 0 +#define EM_M32 1 +#define EM_SPARC 2 +#define EM_386 3 +#define EM_68K 4 +#define EM_88K 5 +#define EM_860 7 +#define EM_MIPS 8 +#define EM_S370 9 +#define EM_MIPS_RS3_LE 10 + +#define EM_PARISC 15 +#define EM_VPP500 17 +#define EM_SPARC32PLUS 18 +#define EM_960 19 +#define EM_PPC 20 +#define EM_PPC64 21 +#define EM_S390 22 + +#define EM_V800 36 +#define EM_FR20 37 +#define EM_RH32 38 +#define EM_RCE 39 +#define EM_ARM 40 +#define EM_FAKE_ALPHA 41 +#define EM_SH 42 +#define EM_SPARCV9 43 +#define EM_TRICORE 44 +#define EM_ARC 45 +#define EM_H8_300 46 +#define EM_H8_300H 47 +#define EM_H8S 48 +#define EM_H8_500 49 +#define EM_IA_64 50 +#define EM_MIPS_X 51 +#define EM_COLDFIRE 52 +#define EM_68HC12 53 +#define EM_MMA 54 +#define EM_PCP 55 +#define EM_NCPU 56 +#define EM_NDR1 57 +#define EM_STARCORE 58 +#define EM_ME16 59 +#define EM_ST100 60 +#define EM_TINYJ 61 +#define EM_X86_64 62 +#define EM_PDSP 63 + +#define EM_FX66 66 +#define EM_ST9PLUS 67 +#define EM_ST7 68 +#define EM_68HC16 69 +#define EM_68HC11 70 +#define EM_68HC08 71 +#define EM_68HC05 72 +#define EM_SVX 73 +#define EM_ST19 74 +#define EM_VAX 75 +#define EM_CRIS 76 +#define EM_JAVELIN 77 +#define EM_FIREPATH 78 +#define EM_ZSP 79 +#define EM_MMIX 80 +#define EM_HUANY 81 +#define EM_PRISM 82 +#define EM_AVR 83 +#define EM_FR30 84 +#define EM_D10V 85 +#define EM_D30V 86 +#define EM_V850 87 +#define EM_M32R 88 +#define EM_MN10300 89 +#define EM_MN10200 90 +#define EM_PJ 91 +#define EM_OR1K 92 +#define EM_OPENRISC 92 +#define EM_ARC_A5 93 +#define EM_ARC_COMPACT 93 +#define EM_XTENSA 94 +#define EM_VIDEOCORE 95 +#define EM_TMM_GPP 96 +#define EM_NS32K 97 +#define EM_TPC 98 +#define EM_SNP1K 99 +#define EM_ST200 100 +#define EM_IP2K 101 +#define EM_MAX 102 +#define EM_CR 103 +#define EM_F2MC16 104 +#define EM_MSP430 105 +#define EM_BLACKFIN 106 +#define EM_SE_C33 107 +#define EM_SEP 108 +#define EM_ARCA 109 +#define EM_UNICORE 110 +#define EM_EXCESS 111 +#define EM_DXP 112 +#define EM_ALTERA_NIOS2 113 +#define EM_CRX 114 +#define EM_XGATE 115 +#define EM_C166 116 +#define EM_M16C 117 +#define EM_DSPIC30F 118 +#define EM_CE 119 +#define EM_M32C 120 +#define EM_TSK3000 131 +#define EM_RS08 132 +#define EM_SHARC 133 +#define EM_ECOG2 134 +#define EM_SCORE7 135 +#define EM_DSP24 136 +#define EM_VIDEOCORE3 137 +#define EM_LATTICEMICO32 138 +#define EM_SE_C17 139 +#define EM_TI_C6000 140 +#define EM_TI_C2000 141 +#define EM_TI_C5500 142 +#define EM_TI_ARP32 143 +#define EM_TI_PRU 144 +#define EM_MMDSP_PLUS 160 +#define EM_CYPRESS_M8C 161 +#define EM_R32C 162 +#define EM_TRIMEDIA 163 +#define EM_QDSP6 164 +#define EM_8051 165 +#define EM_STXP7X 166 +#define EM_NDS32 167 +#define EM_ECOG1X 168 +#define EM_MAXQ30 169 +#define EM_XIMO16 170 +#define EM_MANIK 171 +#define EM_CRAYNV2 172 +#define EM_RX 173 +#define EM_METAG 174 +#define EM_MCST_ELBRUS 175 +#define EM_ECOG16 176 +#define EM_CR16 177 +#define EM_ETPU 178 +#define EM_SLE9X 179 +#define EM_L10M 180 +#define EM_K10M 181 +#define EM_AARCH64 183 +#define EM_AVR32 185 +#define EM_STM8 186 +#define EM_TILE64 187 +#define EM_TILEPRO 188 +#define EM_MICROBLAZE 189 +#define EM_CUDA 190 +#define EM_TILEGX 191 +#define EM_CLOUDSHIELD 192 +#define EM_COREA_1ST 193 +#define EM_COREA_2ND 194 +#define EM_ARC_COMPACT2 195 +#define EM_OPEN8 196 +#define EM_RL78 197 +#define EM_VIDEOCORE5 198 +#define EM_78KOR 199 +#define EM_56800EX 200 +#define EM_BA1 201 +#define EM_BA2 202 +#define EM_XCORE 203 +#define EM_MCHP_PIC 204 +#define EM_KM32 210 +#define EM_KMX32 211 +#define EM_EMX16 212 +#define EM_EMX8 213 +#define EM_KVARC 214 +#define EM_CDP 215 +#define EM_COGE 216 +#define EM_COOL 217 +#define EM_NORC 218 +#define EM_CSR_KALIMBA 219 +#define EM_Z80 220 +#define EM_VISIUM 221 +#define EM_FT32 222 +#define EM_MOXIE 223 +#define EM_AMDGPU 224 +#define EM_RISCV 243 +#define EM_BPF 247 +#define EM_NUM 248 + +#define EM_ALPHA 0x9026 + +#define EV_NONE 0 +#define EV_CURRENT 1 +#define EV_NUM 2 + +typedef struct { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +typedef struct { + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +} Elf64_Shdr; + + + +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_BEFORE 0xff00 + +#define SHN_AFTER 0xff01 + +#define SHN_HIPROC 0xff1f +#define SHN_LOOS 0xff20 +#define SHN_HIOS 0xff3f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_XINDEX 0xffff +#define SHN_HIRESERVE 0xffff + + + +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_INIT_ARRAY 14 +#define SHT_FINI_ARRAY 15 +#define SHT_PREINIT_ARRAY 16 +#define SHT_GROUP 17 +#define SHT_SYMTAB_SHNDX 18 +#define SHT_NUM 19 +#define SHT_LOOS 0x60000000 +#define SHT_GNU_ATTRIBUTES 0x6ffffff5 +#define SHT_GNU_HASH 0x6ffffff6 +#define SHT_GNU_LIBLIST 0x6ffffff7 +#define SHT_CHECKSUM 0x6ffffff8 +#define SHT_LOSUNW 0x6ffffffa +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_GNU_verdef 0x6ffffffd +#define SHT_GNU_verneed 0x6ffffffe +#define SHT_GNU_versym 0x6fffffff +#define SHT_HISUNW 0x6fffffff +#define SHT_HIOS 0x6fffffff +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0x8fffffff + +#define SHF_WRITE (1 << 0) +#define SHF_ALLOC (1 << 1) +#define SHF_EXECINSTR (1 << 2) +#define SHF_MERGE (1 << 4) +#define SHF_STRINGS (1 << 5) +#define SHF_INFO_LINK (1 << 6) +#define SHF_LINK_ORDER (1 << 7) +#define SHF_OS_NONCONFORMING (1 << 8) + +#define SHF_GROUP (1 << 9) +#define SHF_TLS (1 << 10) +#define SHF_COMPRESSED (1 << 11) +#define SHF_MASKOS 0x0ff00000 +#define SHF_MASKPROC 0xf0000000 +#define SHF_ORDERED (1 << 30) +#define SHF_EXCLUDE (1U << 31) + +typedef struct { + Elf32_Word ch_type; + Elf32_Word ch_size; + Elf32_Word ch_addralign; +} Elf32_Chdr; + +typedef struct { + Elf64_Word ch_type; + Elf64_Word ch_reserved; + Elf64_Xword ch_size; + Elf64_Xword ch_addralign; +} Elf64_Chdr; + +#define ELFCOMPRESS_ZLIB 1 +#define ELFCOMPRESS_LOOS 0x60000000 +#define ELFCOMPRESS_HIOS 0x6fffffff +#define ELFCOMPRESS_LOPROC 0x70000000 +#define ELFCOMPRESS_HIPROC 0x7fffffff + + +#define GRP_COMDAT 0x1 + +typedef struct { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Section st_shndx; +} Elf32_Sym; + +typedef struct { + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Section st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; +} Elf64_Sym; + +typedef struct { + Elf32_Half si_boundto; + Elf32_Half si_flags; +} Elf32_Syminfo; + +typedef struct { + Elf64_Half si_boundto; + Elf64_Half si_flags; +} Elf64_Syminfo; + +#define SYMINFO_BT_SELF 0xffff +#define SYMINFO_BT_PARENT 0xfffe +#define SYMINFO_BT_LOWRESERVE 0xff00 + +#define SYMINFO_FLG_DIRECT 0x0001 +#define SYMINFO_FLG_PASSTHRU 0x0002 +#define SYMINFO_FLG_COPY 0x0004 +#define SYMINFO_FLG_LAZYLOAD 0x0008 + +#define SYMINFO_NONE 0 +#define SYMINFO_CURRENT 1 +#define SYMINFO_NUM 2 + +#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4) +#define ELF32_ST_TYPE(val) ((val) & 0xf) +#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) + +#define ELF64_ST_BIND(val) ELF32_ST_BIND (val) +#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val) +#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type)) + +#define STB_LOCAL 0 +#define STB_GLOBAL 1 +#define STB_WEAK 2 +#define STB_NUM 3 +#define STB_LOOS 10 +#define STB_GNU_UNIQUE 10 +#define STB_HIOS 12 +#define STB_LOPROC 13 +#define STB_HIPROC 15 + +#define STT_NOTYPE 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define STT_SECTION 3 +#define STT_FILE 4 +#define STT_COMMON 5 +#define STT_TLS 6 +#define STT_NUM 7 +#define STT_LOOS 10 +#define STT_GNU_IFUNC 10 +#define STT_HIOS 12 +#define STT_LOPROC 13 +#define STT_HIPROC 15 + +#define STN_UNDEF 0 + +#define ELF32_ST_VISIBILITY(o) ((o) & 0x03) +#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) + +#define STV_DEFAULT 0 +#define STV_INTERNAL 1 +#define STV_HIDDEN 2 +#define STV_PROTECTED 3 + + + + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct { + Elf64_Addr r_offset; + Elf64_Xword r_info; +} Elf64_Rel; + + + +typedef struct { + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +typedef struct { + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; +} Elf64_Rela; + + + +#define ELF32_R_SYM(val) ((val) >> 8) +#define ELF32_R_TYPE(val) ((val) & 0xff) +#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) + +#define ELF64_R_SYM(i) ((i) >> 32) +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) +#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type)) + + + +typedef struct { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +typedef struct { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + + + +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_TLS 7 +#define PT_NUM 8 +#define PT_LOOS 0x60000000 +#define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK 0x6474e551 +#define PT_GNU_RELRO 0x6474e552 +#define PT_LOSUNW 0x6ffffffa +#define PT_SUNWBSS 0x6ffffffa +#define PT_SUNWSTACK 0x6ffffffb +#define PT_HISUNW 0x6fffffff +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff + + +#define PN_XNUM 0xffff + + +#define PF_X (1 << 0) +#define PF_W (1 << 1) +#define PF_R (1 << 2) +#define PF_MASKOS 0x0ff00000 +#define PF_MASKPROC 0xf0000000 + + + +#define NT_PRSTATUS 1 +#define NT_PRFPREG 2 +#define NT_FPREGSET 2 +#define NT_PRPSINFO 3 +#define NT_PRXREG 4 +#define NT_TASKSTRUCT 4 +#define NT_PLATFORM 5 +#define NT_AUXV 6 +#define NT_GWINDOWS 7 +#define NT_ASRS 8 +#define NT_PSTATUS 10 +#define NT_PSINFO 13 +#define NT_PRCRED 14 +#define NT_UTSNAME 15 +#define NT_LWPSTATUS 16 +#define NT_LWPSINFO 17 +#define NT_PRFPXREG 20 +#define NT_SIGINFO 0x53494749 +#define NT_FILE 0x46494c45 +#define NT_PRXFPREG 0x46e62b7f +#define NT_PPC_VMX 0x100 +#define NT_PPC_SPE 0x101 +#define NT_PPC_VSX 0x102 +#define NT_PPC_TAR 0x103 +#define NT_PPC_PPR 0x104 +#define NT_PPC_DSCR 0x105 +#define NT_PPC_EBB 0x106 +#define NT_PPC_PMU 0x107 +#define NT_PPC_TM_CGPR 0x108 +#define NT_PPC_TM_CFPR 0x109 +#define NT_PPC_TM_CVMX 0x10a +#define NT_PPC_TM_CVSX 0x10b +#define NT_PPC_TM_SPR 0x10c +#define NT_PPC_TM_CTAR 0x10d +#define NT_PPC_TM_CPPR 0x10e +#define NT_PPC_TM_CDSCR 0x10f +#define NT_386_TLS 0x200 +#define NT_386_IOPERM 0x201 +#define NT_X86_XSTATE 0x202 +#define NT_S390_HIGH_GPRS 0x300 +#define NT_S390_TIMER 0x301 +#define NT_S390_TODCMP 0x302 +#define NT_S390_TODPREG 0x303 +#define NT_S390_CTRS 0x304 +#define NT_S390_PREFIX 0x305 +#define NT_S390_LAST_BREAK 0x306 +#define NT_S390_SYSTEM_CALL 0x307 +#define NT_S390_TDB 0x308 +#define NT_S390_VXRS_LOW 0x309 +#define NT_S390_VXRS_HIGH 0x30a +#define NT_S390_GS_CB 0x30b +#define NT_S390_GS_BC 0x30c +#define NT_S390_RI_CB 0x30d +#define NT_ARM_VFP 0x400 +#define NT_ARM_TLS 0x401 +#define NT_ARM_HW_BREAK 0x402 +#define NT_ARM_HW_WATCH 0x403 +#define NT_ARM_SYSTEM_CALL 0x404 +#define NT_ARM_SVE 0x405 +#define NT_METAG_CBUF 0x500 +#define NT_METAG_RPIPE 0x501 +#define NT_METAG_TLS 0x502 +#define NT_ARC_V2 0x600 +#define NT_VERSION 1 + + + + +typedef struct { + Elf32_Sword d_tag; + union { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +typedef struct { + Elf64_Sxword d_tag; + union { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + + + +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_BIND_NOW 24 +#define DT_INIT_ARRAY 25 +#define DT_FINI_ARRAY 26 +#define DT_INIT_ARRAYSZ 27 +#define DT_FINI_ARRAYSZ 28 +#define DT_RUNPATH 29 +#define DT_FLAGS 30 +#define DT_ENCODING 32 +#define DT_PREINIT_ARRAY 32 +#define DT_PREINIT_ARRAYSZ 33 +#define DT_SYMTAB_SHNDX 34 +#define DT_NUM 35 +#define DT_LOOS 0x6000000d +#define DT_HIOS 0x6ffff000 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff +#define DT_PROCNUM DT_MIPS_NUM + +#define DT_VALRNGLO 0x6ffffd00 +#define DT_GNU_PRELINKED 0x6ffffdf5 +#define DT_GNU_CONFLICTSZ 0x6ffffdf6 +#define DT_GNU_LIBLISTSZ 0x6ffffdf7 +#define DT_CHECKSUM 0x6ffffdf8 +#define DT_PLTPADSZ 0x6ffffdf9 +#define DT_MOVEENT 0x6ffffdfa +#define DT_MOVESZ 0x6ffffdfb +#define DT_FEATURE_1 0x6ffffdfc +#define DT_POSFLAG_1 0x6ffffdfd + +#define DT_SYMINSZ 0x6ffffdfe +#define DT_SYMINENT 0x6ffffdff +#define DT_VALRNGHI 0x6ffffdff +#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) +#define DT_VALNUM 12 + +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 +#define DT_TLSDESC_PLT 0x6ffffef6 +#define DT_TLSDESC_GOT 0x6ffffef7 +#define DT_GNU_CONFLICT 0x6ffffef8 +#define DT_GNU_LIBLIST 0x6ffffef9 +#define DT_CONFIG 0x6ffffefa +#define DT_DEPAUDIT 0x6ffffefb +#define DT_AUDIT 0x6ffffefc +#define DT_PLTPAD 0x6ffffefd +#define DT_MOVETAB 0x6ffffefe +#define DT_SYMINFO 0x6ffffeff +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) +#define DT_ADDRNUM 11 + + + +#define DT_VERSYM 0x6ffffff0 + +#define DT_RELACOUNT 0x6ffffff9 +#define DT_RELCOUNT 0x6ffffffa + + +#define DT_FLAGS_1 0x6ffffffb +#define DT_VERDEF 0x6ffffffc + +#define DT_VERDEFNUM 0x6ffffffd +#define DT_VERNEED 0x6ffffffe + +#define DT_VERNEEDNUM 0x6fffffff +#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) +#define DT_VERSIONTAGNUM 16 + + + +#define DT_AUXILIARY 0x7ffffffd +#define DT_FILTER 0x7fffffff +#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1) +#define DT_EXTRANUM 3 + + +#define DF_ORIGIN 0x00000001 +#define DF_SYMBOLIC 0x00000002 +#define DF_TEXTREL 0x00000004 +#define DF_BIND_NOW 0x00000008 +#define DF_STATIC_TLS 0x00000010 + + + +#define DF_1_NOW 0x00000001 +#define DF_1_GLOBAL 0x00000002 +#define DF_1_GROUP 0x00000004 +#define DF_1_NODELETE 0x00000008 +#define DF_1_LOADFLTR 0x00000010 +#define DF_1_INITFIRST 0x00000020 +#define DF_1_NOOPEN 0x00000040 +#define DF_1_ORIGIN 0x00000080 +#define DF_1_DIRECT 0x00000100 +#define DF_1_TRANS 0x00000200 +#define DF_1_INTERPOSE 0x00000400 +#define DF_1_NODEFLIB 0x00000800 +#define DF_1_NODUMP 0x00001000 +#define DF_1_CONFALT 0x00002000 +#define DF_1_ENDFILTEE 0x00004000 +#define DF_1_DISPRELDNE 0x00008000 +#define DF_1_DISPRELPND 0x00010000 +#define DF_1_NODIRECT 0x00020000 +#define DF_1_IGNMULDEF 0x00040000 +#define DF_1_NOKSYMS 0x00080000 +#define DF_1_NOHDR 0x00100000 +#define DF_1_EDITED 0x00200000 +#define DF_1_NORELOC 0x00400000 +#define DF_1_SYMINTPOSE 0x00800000 +#define DF_1_GLOBAUDIT 0x01000000 +#define DF_1_SINGLETON 0x02000000 +#define DF_1_STUB 0x04000000 +#define DF_1_PIE 0x08000000 + +#define DTF_1_PARINIT 0x00000001 +#define DTF_1_CONFEXP 0x00000002 + + +#define DF_P1_LAZYLOAD 0x00000001 +#define DF_P1_GROUPPERM 0x00000002 + + + + +typedef struct { + Elf32_Half vd_version; + Elf32_Half vd_flags; + Elf32_Half vd_ndx; + Elf32_Half vd_cnt; + Elf32_Word vd_hash; + Elf32_Word vd_aux; + Elf32_Word vd_next; +} Elf32_Verdef; + +typedef struct { + Elf64_Half vd_version; + Elf64_Half vd_flags; + Elf64_Half vd_ndx; + Elf64_Half vd_cnt; + Elf64_Word vd_hash; + Elf64_Word vd_aux; + Elf64_Word vd_next; +} Elf64_Verdef; + + + +#define VER_DEF_NONE 0 +#define VER_DEF_CURRENT 1 +#define VER_DEF_NUM 2 + + +#define VER_FLG_BASE 0x1 +#define VER_FLG_WEAK 0x2 + + +#define VER_NDX_LOCAL 0 +#define VER_NDX_GLOBAL 1 +#define VER_NDX_LORESERVE 0xff00 +#define VER_NDX_ELIMINATE 0xff01 + + + +typedef struct { + Elf32_Word vda_name; + Elf32_Word vda_next; +} Elf32_Verdaux; + +typedef struct { + Elf64_Word vda_name; + Elf64_Word vda_next; +} Elf64_Verdaux; + + + + +typedef struct { + Elf32_Half vn_version; + Elf32_Half vn_cnt; + Elf32_Word vn_file; + Elf32_Word vn_aux; + Elf32_Word vn_next; +} Elf32_Verneed; + +typedef struct { + Elf64_Half vn_version; + Elf64_Half vn_cnt; + Elf64_Word vn_file; + Elf64_Word vn_aux; + Elf64_Word vn_next; +} Elf64_Verneed; + + + +#define VER_NEED_NONE 0 +#define VER_NEED_CURRENT 1 +#define VER_NEED_NUM 2 + + + +typedef struct { + Elf32_Word vna_hash; + Elf32_Half vna_flags; + Elf32_Half vna_other; + Elf32_Word vna_name; + Elf32_Word vna_next; +} Elf32_Vernaux; + +typedef struct { + Elf64_Word vna_hash; + Elf64_Half vna_flags; + Elf64_Half vna_other; + Elf64_Word vna_name; + Elf64_Word vna_next; +} Elf64_Vernaux; + + + +#define VER_FLG_WEAK 0x2 + + + +typedef struct { + uint32_t a_type; + union { + uint32_t a_val; + } a_un; +} Elf32_auxv_t; + +typedef struct { + uint64_t a_type; + union { + uint64_t a_val; + } a_un; +} Elf64_auxv_t; + + + +#define AT_NULL 0 +#define AT_IGNORE 1 +#define AT_EXECFD 2 +#define AT_PHDR 3 +#define AT_PHENT 4 +#define AT_PHNUM 5 +#define AT_PAGESZ 6 +#define AT_BASE 7 +#define AT_FLAGS 8 +#define AT_ENTRY 9 +#define AT_NOTELF 10 +#define AT_UID 11 +#define AT_EUID 12 +#define AT_GID 13 +#define AT_EGID 14 +#define AT_CLKTCK 17 + + +#define AT_PLATFORM 15 +#define AT_HWCAP 16 + + + + +#define AT_FPUCW 18 + + +#define AT_DCACHEBSIZE 19 +#define AT_ICACHEBSIZE 20 +#define AT_UCACHEBSIZE 21 + + + +#define AT_IGNOREPPC 22 + +#define AT_SECURE 23 + +#define AT_BASE_PLATFORM 24 + +#define AT_RANDOM 25 + +#define AT_HWCAP2 26 + +#define AT_EXECFN 31 + + + +#define AT_SYSINFO 32 +#define AT_SYSINFO_EHDR 33 + + + +#define AT_L1I_CACHESHAPE 34 +#define AT_L1D_CACHESHAPE 35 +#define AT_L2_CACHESHAPE 36 +#define AT_L3_CACHESHAPE 37 + +#define AT_L1I_CACHESIZE 40 +#define AT_L1I_CACHEGEOMETRY 41 +#define AT_L1D_CACHESIZE 42 +#define AT_L1D_CACHEGEOMETRY 43 +#define AT_L2_CACHESIZE 44 +#define AT_L2_CACHEGEOMETRY 45 +#define AT_L3_CACHESIZE 46 +#define AT_L3_CACHEGEOMETRY 47 + + + +typedef struct { + Elf32_Word n_namesz; + Elf32_Word n_descsz; + Elf32_Word n_type; +} Elf32_Nhdr; + +typedef struct { + Elf64_Word n_namesz; + Elf64_Word n_descsz; + Elf64_Word n_type; +} Elf64_Nhdr; + + + + +#define ELF_NOTE_SOLARIS "SUNW Solaris" + + +#define ELF_NOTE_GNU "GNU" + + + + + +#define ELF_NOTE_PAGESIZE_HINT 1 + + +#define NT_GNU_ABI_TAG 1 +#define ELF_NOTE_ABI NT_GNU_ABI_TAG + + + +#define ELF_NOTE_OS_LINUX 0 +#define ELF_NOTE_OS_GNU 1 +#define ELF_NOTE_OS_SOLARIS2 2 +#define ELF_NOTE_OS_FREEBSD 3 + +#define NT_GNU_BUILD_ID 3 +#define NT_GNU_GOLD_VERSION 4 + + + +typedef struct { + Elf32_Xword m_value; + Elf32_Word m_info; + Elf32_Word m_poffset; + Elf32_Half m_repeat; + Elf32_Half m_stride; +} Elf32_Move; + +typedef struct { + Elf64_Xword m_value; + Elf64_Xword m_info; + Elf64_Xword m_poffset; + Elf64_Half m_repeat; + Elf64_Half m_stride; +} Elf64_Move; + + +#define ELF32_M_SYM(info) ((info) >> 8) +#define ELF32_M_SIZE(info) ((unsigned char) (info)) +#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size)) + +#define ELF64_M_SYM(info) ELF32_M_SYM (info) +#define ELF64_M_SIZE(info) ELF32_M_SIZE (info) +#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size) + +#define EF_CPU32 0x00810000 + +#define R_68K_NONE 0 +#define R_68K_32 1 +#define R_68K_16 2 +#define R_68K_8 3 +#define R_68K_PC32 4 +#define R_68K_PC16 5 +#define R_68K_PC8 6 +#define R_68K_GOT32 7 +#define R_68K_GOT16 8 +#define R_68K_GOT8 9 +#define R_68K_GOT32O 10 +#define R_68K_GOT16O 11 +#define R_68K_GOT8O 12 +#define R_68K_PLT32 13 +#define R_68K_PLT16 14 +#define R_68K_PLT8 15 +#define R_68K_PLT32O 16 +#define R_68K_PLT16O 17 +#define R_68K_PLT8O 18 +#define R_68K_COPY 19 +#define R_68K_GLOB_DAT 20 +#define R_68K_JMP_SLOT 21 +#define R_68K_RELATIVE 22 +#define R_68K_TLS_GD32 25 +#define R_68K_TLS_GD16 26 +#define R_68K_TLS_GD8 27 +#define R_68K_TLS_LDM32 28 +#define R_68K_TLS_LDM16 29 +#define R_68K_TLS_LDM8 30 +#define R_68K_TLS_LDO32 31 +#define R_68K_TLS_LDO16 32 +#define R_68K_TLS_LDO8 33 +#define R_68K_TLS_IE32 34 +#define R_68K_TLS_IE16 35 +#define R_68K_TLS_IE8 36 +#define R_68K_TLS_LE32 37 +#define R_68K_TLS_LE16 38 +#define R_68K_TLS_LE8 39 +#define R_68K_TLS_DTPMOD32 40 +#define R_68K_TLS_DTPREL32 41 +#define R_68K_TLS_TPREL32 42 +#define R_68K_NUM 43 + +#define R_386_NONE 0 +#define R_386_32 1 +#define R_386_PC32 2 +#define R_386_GOT32 3 +#define R_386_PLT32 4 +#define R_386_COPY 5 +#define R_386_GLOB_DAT 6 +#define R_386_JMP_SLOT 7 +#define R_386_RELATIVE 8 +#define R_386_GOTOFF 9 +#define R_386_GOTPC 10 +#define R_386_32PLT 11 +#define R_386_TLS_TPOFF 14 +#define R_386_TLS_IE 15 +#define R_386_TLS_GOTIE 16 +#define R_386_TLS_LE 17 +#define R_386_TLS_GD 18 +#define R_386_TLS_LDM 19 +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 +#define R_386_TLS_GD_32 24 +#define R_386_TLS_GD_PUSH 25 +#define R_386_TLS_GD_CALL 26 +#define R_386_TLS_GD_POP 27 +#define R_386_TLS_LDM_32 28 +#define R_386_TLS_LDM_PUSH 29 +#define R_386_TLS_LDM_CALL 30 +#define R_386_TLS_LDM_POP 31 +#define R_386_TLS_LDO_32 32 +#define R_386_TLS_IE_32 33 +#define R_386_TLS_LE_32 34 +#define R_386_TLS_DTPMOD32 35 +#define R_386_TLS_DTPOFF32 36 +#define R_386_TLS_TPOFF32 37 +#define R_386_SIZE32 38 +#define R_386_TLS_GOTDESC 39 +#define R_386_TLS_DESC_CALL 40 +#define R_386_TLS_DESC 41 +#define R_386_IRELATIVE 42 +#define R_386_GOT32X 43 +#define R_386_NUM 44 + + + + + +#define STT_SPARC_REGISTER 13 + + + +#define EF_SPARCV9_MM 3 +#define EF_SPARCV9_TSO 0 +#define EF_SPARCV9_PSO 1 +#define EF_SPARCV9_RMO 2 +#define EF_SPARC_LEDATA 0x800000 +#define EF_SPARC_EXT_MASK 0xFFFF00 +#define EF_SPARC_32PLUS 0x000100 +#define EF_SPARC_SUN_US1 0x000200 +#define EF_SPARC_HAL_R1 0x000400 +#define EF_SPARC_SUN_US3 0x000800 + + + +#define R_SPARC_NONE 0 +#define R_SPARC_8 1 +#define R_SPARC_16 2 +#define R_SPARC_32 3 +#define R_SPARC_DISP8 4 +#define R_SPARC_DISP16 5 +#define R_SPARC_DISP32 6 +#define R_SPARC_WDISP30 7 +#define R_SPARC_WDISP22 8 +#define R_SPARC_HI22 9 +#define R_SPARC_22 10 +#define R_SPARC_13 11 +#define R_SPARC_LO10 12 +#define R_SPARC_GOT10 13 +#define R_SPARC_GOT13 14 +#define R_SPARC_GOT22 15 +#define R_SPARC_PC10 16 +#define R_SPARC_PC22 17 +#define R_SPARC_WPLT30 18 +#define R_SPARC_COPY 19 +#define R_SPARC_GLOB_DAT 20 +#define R_SPARC_JMP_SLOT 21 +#define R_SPARC_RELATIVE 22 +#define R_SPARC_UA32 23 + + + +#define R_SPARC_PLT32 24 +#define R_SPARC_HIPLT22 25 +#define R_SPARC_LOPLT10 26 +#define R_SPARC_PCPLT32 27 +#define R_SPARC_PCPLT22 28 +#define R_SPARC_PCPLT10 29 +#define R_SPARC_10 30 +#define R_SPARC_11 31 +#define R_SPARC_64 32 +#define R_SPARC_OLO10 33 +#define R_SPARC_HH22 34 +#define R_SPARC_HM10 35 +#define R_SPARC_LM22 36 +#define R_SPARC_PC_HH22 37 +#define R_SPARC_PC_HM10 38 +#define R_SPARC_PC_LM22 39 +#define R_SPARC_WDISP16 40 +#define R_SPARC_WDISP19 41 +#define R_SPARC_GLOB_JMP 42 +#define R_SPARC_7 43 +#define R_SPARC_5 44 +#define R_SPARC_6 45 +#define R_SPARC_DISP64 46 +#define R_SPARC_PLT64 47 +#define R_SPARC_HIX22 48 +#define R_SPARC_LOX10 49 +#define R_SPARC_H44 50 +#define R_SPARC_M44 51 +#define R_SPARC_L44 52 +#define R_SPARC_REGISTER 53 +#define R_SPARC_UA64 54 +#define R_SPARC_UA16 55 +#define R_SPARC_TLS_GD_HI22 56 +#define R_SPARC_TLS_GD_LO10 57 +#define R_SPARC_TLS_GD_ADD 58 +#define R_SPARC_TLS_GD_CALL 59 +#define R_SPARC_TLS_LDM_HI22 60 +#define R_SPARC_TLS_LDM_LO10 61 +#define R_SPARC_TLS_LDM_ADD 62 +#define R_SPARC_TLS_LDM_CALL 63 +#define R_SPARC_TLS_LDO_HIX22 64 +#define R_SPARC_TLS_LDO_LOX10 65 +#define R_SPARC_TLS_LDO_ADD 66 +#define R_SPARC_TLS_IE_HI22 67 +#define R_SPARC_TLS_IE_LO10 68 +#define R_SPARC_TLS_IE_LD 69 +#define R_SPARC_TLS_IE_LDX 70 +#define R_SPARC_TLS_IE_ADD 71 +#define R_SPARC_TLS_LE_HIX22 72 +#define R_SPARC_TLS_LE_LOX10 73 +#define R_SPARC_TLS_DTPMOD32 74 +#define R_SPARC_TLS_DTPMOD64 75 +#define R_SPARC_TLS_DTPOFF32 76 +#define R_SPARC_TLS_DTPOFF64 77 +#define R_SPARC_TLS_TPOFF32 78 +#define R_SPARC_TLS_TPOFF64 79 +#define R_SPARC_GOTDATA_HIX22 80 +#define R_SPARC_GOTDATA_LOX10 81 +#define R_SPARC_GOTDATA_OP_HIX22 82 +#define R_SPARC_GOTDATA_OP_LOX10 83 +#define R_SPARC_GOTDATA_OP 84 +#define R_SPARC_H34 85 +#define R_SPARC_SIZE32 86 +#define R_SPARC_SIZE64 87 +#define R_SPARC_GNU_VTINHERIT 250 +#define R_SPARC_GNU_VTENTRY 251 +#define R_SPARC_REV32 252 + +#define R_SPARC_NUM 253 + + + +#define DT_SPARC_REGISTER 0x70000001 +#define DT_SPARC_NUM 2 + + +#define EF_MIPS_NOREORDER 1 +#define EF_MIPS_PIC 2 +#define EF_MIPS_CPIC 4 +#define EF_MIPS_XGOT 8 +#define EF_MIPS_64BIT_WHIRL 16 +#define EF_MIPS_ABI2 32 +#define EF_MIPS_ABI_ON32 64 +#define EF_MIPS_FP64 512 +#define EF_MIPS_NAN2008 1024 +#define EF_MIPS_ARCH 0xf0000000 + + + +#define EF_MIPS_ARCH_1 0x00000000 +#define EF_MIPS_ARCH_2 0x10000000 +#define EF_MIPS_ARCH_3 0x20000000 +#define EF_MIPS_ARCH_4 0x30000000 +#define EF_MIPS_ARCH_5 0x40000000 +#define EF_MIPS_ARCH_32 0x50000000 +#define EF_MIPS_ARCH_64 0x60000000 +#define EF_MIPS_ARCH_32R2 0x70000000 +#define EF_MIPS_ARCH_64R2 0x80000000 + + +#define E_MIPS_ARCH_1 0x00000000 +#define E_MIPS_ARCH_2 0x10000000 +#define E_MIPS_ARCH_3 0x20000000 +#define E_MIPS_ARCH_4 0x30000000 +#define E_MIPS_ARCH_5 0x40000000 +#define E_MIPS_ARCH_32 0x50000000 +#define E_MIPS_ARCH_64 0x60000000 + + + +#define SHN_MIPS_ACOMMON 0xff00 +#define SHN_MIPS_TEXT 0xff01 +#define SHN_MIPS_DATA 0xff02 +#define SHN_MIPS_SCOMMON 0xff03 +#define SHN_MIPS_SUNDEFINED 0xff04 + + + +#define SHT_MIPS_LIBLIST 0x70000000 +#define SHT_MIPS_MSYM 0x70000001 +#define SHT_MIPS_CONFLICT 0x70000002 +#define SHT_MIPS_GPTAB 0x70000003 +#define SHT_MIPS_UCODE 0x70000004 +#define SHT_MIPS_DEBUG 0x70000005 +#define SHT_MIPS_REGINFO 0x70000006 +#define SHT_MIPS_PACKAGE 0x70000007 +#define SHT_MIPS_PACKSYM 0x70000008 +#define SHT_MIPS_RELD 0x70000009 +#define SHT_MIPS_IFACE 0x7000000b +#define SHT_MIPS_CONTENT 0x7000000c +#define SHT_MIPS_OPTIONS 0x7000000d +#define SHT_MIPS_SHDR 0x70000010 +#define SHT_MIPS_FDESC 0x70000011 +#define SHT_MIPS_EXTSYM 0x70000012 +#define SHT_MIPS_DENSE 0x70000013 +#define SHT_MIPS_PDESC 0x70000014 +#define SHT_MIPS_LOCSYM 0x70000015 +#define SHT_MIPS_AUXSYM 0x70000016 +#define SHT_MIPS_OPTSYM 0x70000017 +#define SHT_MIPS_LOCSTR 0x70000018 +#define SHT_MIPS_LINE 0x70000019 +#define SHT_MIPS_RFDESC 0x7000001a +#define SHT_MIPS_DELTASYM 0x7000001b +#define SHT_MIPS_DELTAINST 0x7000001c +#define SHT_MIPS_DELTACLASS 0x7000001d +#define SHT_MIPS_DWARF 0x7000001e +#define SHT_MIPS_DELTADECL 0x7000001f +#define SHT_MIPS_SYMBOL_LIB 0x70000020 +#define SHT_MIPS_EVENTS 0x70000021 +#define SHT_MIPS_TRANSLATE 0x70000022 +#define SHT_MIPS_PIXIE 0x70000023 +#define SHT_MIPS_XLATE 0x70000024 +#define SHT_MIPS_XLATE_DEBUG 0x70000025 +#define SHT_MIPS_WHIRL 0x70000026 +#define SHT_MIPS_EH_REGION 0x70000027 +#define SHT_MIPS_XLATE_OLD 0x70000028 +#define SHT_MIPS_PDR_EXCEPTION 0x70000029 + + + +#define SHF_MIPS_GPREL 0x10000000 +#define SHF_MIPS_MERGE 0x20000000 +#define SHF_MIPS_ADDR 0x40000000 +#define SHF_MIPS_STRINGS 0x80000000 +#define SHF_MIPS_NOSTRIP 0x08000000 +#define SHF_MIPS_LOCAL 0x04000000 +#define SHF_MIPS_NAMES 0x02000000 +#define SHF_MIPS_NODUPE 0x01000000 + + + + + +#define STO_MIPS_DEFAULT 0x0 +#define STO_MIPS_INTERNAL 0x1 +#define STO_MIPS_HIDDEN 0x2 +#define STO_MIPS_PROTECTED 0x3 +#define STO_MIPS_PLT 0x8 +#define STO_MIPS_SC_ALIGN_UNUSED 0xff + + +#define STB_MIPS_SPLIT_COMMON 13 + + + +typedef union { + struct { + Elf32_Word gt_current_g_value; + Elf32_Word gt_unused; + } gt_header; + struct { + Elf32_Word gt_g_value; + Elf32_Word gt_bytes; + } gt_entry; +} Elf32_gptab; + + + +typedef struct { + Elf32_Word ri_gprmask; + Elf32_Word ri_cprmask[4]; + Elf32_Sword ri_gp_value; +} Elf32_RegInfo; + + + +typedef struct { + unsigned char kind; + + unsigned char size; + Elf32_Section section; + + Elf32_Word info; +} Elf_Options; + + + +#define ODK_NULL 0 +#define ODK_REGINFO 1 +#define ODK_EXCEPTIONS 2 +#define ODK_PAD 3 +#define ODK_HWPATCH 4 +#define ODK_FILL 5 +#define ODK_TAGS 6 +#define ODK_HWAND 7 +#define ODK_HWOR 8 + + + +#define OEX_FPU_MIN 0x1f +#define OEX_FPU_MAX 0x1f00 +#define OEX_PAGE0 0x10000 +#define OEX_SMM 0x20000 +#define OEX_FPDBUG 0x40000 +#define OEX_PRECISEFP OEX_FPDBUG +#define OEX_DISMISS 0x80000 + +#define OEX_FPU_INVAL 0x10 +#define OEX_FPU_DIV0 0x08 +#define OEX_FPU_OFLO 0x04 +#define OEX_FPU_UFLO 0x02 +#define OEX_FPU_INEX 0x01 + + + +#define OHW_R4KEOP 0x1 +#define OHW_R8KPFETCH 0x2 +#define OHW_R5KEOP 0x4 +#define OHW_R5KCVTL 0x8 + +#define OPAD_PREFIX 0x1 +#define OPAD_POSTFIX 0x2 +#define OPAD_SYMBOL 0x4 + + + +typedef struct { + Elf32_Word hwp_flags1; + Elf32_Word hwp_flags2; +} Elf_Options_Hw; + + + +#define OHWA0_R4KEOP_CHECKED 0x00000001 +#define OHWA1_R4KEOP_CLEAN 0x00000002 + + + +#define R_MIPS_NONE 0 +#define R_MIPS_16 1 +#define R_MIPS_32 2 +#define R_MIPS_REL32 3 +#define R_MIPS_26 4 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 +#define R_MIPS_GPREL16 7 +#define R_MIPS_LITERAL 8 +#define R_MIPS_GOT16 9 +#define R_MIPS_PC16 10 +#define R_MIPS_CALL16 11 +#define R_MIPS_GPREL32 12 + +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +#define R_MIPS_GOT_HI16 22 +#define R_MIPS_GOT_LO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +#define R_MIPS_CALL_HI16 30 +#define R_MIPS_CALL_LO16 31 +#define R_MIPS_SCN_DISP 32 +#define R_MIPS_REL16 33 +#define R_MIPS_ADD_IMMEDIATE 34 +#define R_MIPS_PJUMP 35 +#define R_MIPS_RELGOT 36 +#define R_MIPS_JALR 37 +#define R_MIPS_TLS_DTPMOD32 38 +#define R_MIPS_TLS_DTPREL32 39 +#define R_MIPS_TLS_DTPMOD64 40 +#define R_MIPS_TLS_DTPREL64 41 +#define R_MIPS_TLS_GD 42 +#define R_MIPS_TLS_LDM 43 +#define R_MIPS_TLS_DTPREL_HI16 44 +#define R_MIPS_TLS_DTPREL_LO16 45 +#define R_MIPS_TLS_GOTTPREL 46 +#define R_MIPS_TLS_TPREL32 47 +#define R_MIPS_TLS_TPREL64 48 +#define R_MIPS_TLS_TPREL_HI16 49 +#define R_MIPS_TLS_TPREL_LO16 50 +#define R_MIPS_GLOB_DAT 51 +#define R_MIPS_COPY 126 +#define R_MIPS_JUMP_SLOT 127 + +#define R_MIPS_NUM 128 + + + +#define PT_MIPS_REGINFO 0x70000000 +#define PT_MIPS_RTPROC 0x70000001 +#define PT_MIPS_OPTIONS 0x70000002 +#define PT_MIPS_ABIFLAGS 0x70000003 + + + +#define PF_MIPS_LOCAL 0x10000000 + + + +#define DT_MIPS_RLD_VERSION 0x70000001 +#define DT_MIPS_TIME_STAMP 0x70000002 +#define DT_MIPS_ICHECKSUM 0x70000003 +#define DT_MIPS_IVERSION 0x70000004 +#define DT_MIPS_FLAGS 0x70000005 +#define DT_MIPS_BASE_ADDRESS 0x70000006 +#define DT_MIPS_MSYM 0x70000007 +#define DT_MIPS_CONFLICT 0x70000008 +#define DT_MIPS_LIBLIST 0x70000009 +#define DT_MIPS_LOCAL_GOTNO 0x7000000a +#define DT_MIPS_CONFLICTNO 0x7000000b +#define DT_MIPS_LIBLISTNO 0x70000010 +#define DT_MIPS_SYMTABNO 0x70000011 +#define DT_MIPS_UNREFEXTNO 0x70000012 +#define DT_MIPS_GOTSYM 0x70000013 +#define DT_MIPS_HIPAGENO 0x70000014 +#define DT_MIPS_RLD_MAP 0x70000016 +#define DT_MIPS_DELTA_CLASS 0x70000017 +#define DT_MIPS_DELTA_CLASS_NO 0x70000018 + +#define DT_MIPS_DELTA_INSTANCE 0x70000019 +#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a + +#define DT_MIPS_DELTA_RELOC 0x7000001b +#define DT_MIPS_DELTA_RELOC_NO 0x7000001c + +#define DT_MIPS_DELTA_SYM 0x7000001d + +#define DT_MIPS_DELTA_SYM_NO 0x7000001e + +#define DT_MIPS_DELTA_CLASSSYM 0x70000020 + +#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 + +#define DT_MIPS_CXX_FLAGS 0x70000022 +#define DT_MIPS_PIXIE_INIT 0x70000023 +#define DT_MIPS_SYMBOL_LIB 0x70000024 +#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025 +#define DT_MIPS_LOCAL_GOTIDX 0x70000026 +#define DT_MIPS_HIDDEN_GOTIDX 0x70000027 +#define DT_MIPS_PROTECTED_GOTIDX 0x70000028 +#define DT_MIPS_OPTIONS 0x70000029 +#define DT_MIPS_INTERFACE 0x7000002a +#define DT_MIPS_DYNSTR_ALIGN 0x7000002b +#define DT_MIPS_INTERFACE_SIZE 0x7000002c +#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d + +#define DT_MIPS_PERF_SUFFIX 0x7000002e + +#define DT_MIPS_COMPACT_SIZE 0x7000002f +#define DT_MIPS_GP_VALUE 0x70000030 +#define DT_MIPS_AUX_DYNAMIC 0x70000031 + +#define DT_MIPS_PLTGOT 0x70000032 + +#define DT_MIPS_RWPLT 0x70000034 +#define DT_MIPS_RLD_MAP_REL 0x70000035 +#define DT_MIPS_NUM 0x36 + + + +#define RHF_NONE 0 +#define RHF_QUICKSTART (1 << 0) +#define RHF_NOTPOT (1 << 1) +#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) +#define RHF_NO_MOVE (1 << 3) +#define RHF_SGI_ONLY (1 << 4) +#define RHF_GUARANTEE_INIT (1 << 5) +#define RHF_DELTA_C_PLUS_PLUS (1 << 6) +#define RHF_GUARANTEE_START_INIT (1 << 7) +#define RHF_PIXIE (1 << 8) +#define RHF_DEFAULT_DELAY_LOAD (1 << 9) +#define RHF_REQUICKSTART (1 << 10) +#define RHF_REQUICKSTARTED (1 << 11) +#define RHF_CORD (1 << 12) +#define RHF_NO_UNRES_UNDEF (1 << 13) +#define RHF_RLD_ORDER_SAFE (1 << 14) + + + +typedef struct { + Elf32_Word l_name; + Elf32_Word l_time_stamp; + Elf32_Word l_checksum; + Elf32_Word l_version; + Elf32_Word l_flags; +} Elf32_Lib; + +typedef struct { + Elf64_Word l_name; + Elf64_Word l_time_stamp; + Elf64_Word l_checksum; + Elf64_Word l_version; + Elf64_Word l_flags; +} Elf64_Lib; + + + + +#define LL_NONE 0 +#define LL_EXACT_MATCH (1 << 0) +#define LL_IGNORE_INT_VER (1 << 1) +#define LL_REQUIRE_MINOR (1 << 2) +#define LL_EXPORTS (1 << 3) +#define LL_DELAY_LOAD (1 << 4) +#define LL_DELTA (1 << 5) + + + +typedef Elf32_Addr Elf32_Conflict; + +typedef struct { + Elf32_Half version; + unsigned char isa_level; + unsigned char isa_rev; + unsigned char gpr_size; + unsigned char cpr1_size; + unsigned char cpr2_size; + unsigned char fp_abi; + Elf32_Word isa_ext; + Elf32_Word ases; + Elf32_Word flags1; + Elf32_Word flags2; +} Elf_MIPS_ABIFlags_v0; + +#define MIPS_AFL_REG_NONE 0x00 +#define MIPS_AFL_REG_32 0x01 +#define MIPS_AFL_REG_64 0x02 +#define MIPS_AFL_REG_128 0x03 + +#define MIPS_AFL_ASE_DSP 0x00000001 +#define MIPS_AFL_ASE_DSPR2 0x00000002 +#define MIPS_AFL_ASE_EVA 0x00000004 +#define MIPS_AFL_ASE_MCU 0x00000008 +#define MIPS_AFL_ASE_MDMX 0x00000010 +#define MIPS_AFL_ASE_MIPS3D 0x00000020 +#define MIPS_AFL_ASE_MT 0x00000040 +#define MIPS_AFL_ASE_SMARTMIPS 0x00000080 +#define MIPS_AFL_ASE_VIRT 0x00000100 +#define MIPS_AFL_ASE_MSA 0x00000200 +#define MIPS_AFL_ASE_MIPS16 0x00000400 +#define MIPS_AFL_ASE_MICROMIPS 0x00000800 +#define MIPS_AFL_ASE_XPA 0x00001000 +#define MIPS_AFL_ASE_MASK 0x00001fff + +#define MIPS_AFL_EXT_XLR 1 +#define MIPS_AFL_EXT_OCTEON2 2 +#define MIPS_AFL_EXT_OCTEONP 3 +#define MIPS_AFL_EXT_LOONGSON_3A 4 +#define MIPS_AFL_EXT_OCTEON 5 +#define MIPS_AFL_EXT_5900 6 +#define MIPS_AFL_EXT_4650 7 +#define MIPS_AFL_EXT_4010 8 +#define MIPS_AFL_EXT_4100 9 +#define MIPS_AFL_EXT_3900 10 +#define MIPS_AFL_EXT_10000 11 +#define MIPS_AFL_EXT_SB1 12 +#define MIPS_AFL_EXT_4111 13 +#define MIPS_AFL_EXT_4120 14 +#define MIPS_AFL_EXT_5400 15 +#define MIPS_AFL_EXT_5500 16 +#define MIPS_AFL_EXT_LOONGSON_2E 17 +#define MIPS_AFL_EXT_LOONGSON_2F 18 + +#define MIPS_AFL_FLAGS1_ODDSPREG 1 + +enum +{ + Val_GNU_MIPS_ABI_FP_ANY = 0, + Val_GNU_MIPS_ABI_FP_DOUBLE = 1, + Val_GNU_MIPS_ABI_FP_SINGLE = 2, + Val_GNU_MIPS_ABI_FP_SOFT = 3, + Val_GNU_MIPS_ABI_FP_OLD_64 = 4, + Val_GNU_MIPS_ABI_FP_XX = 5, + Val_GNU_MIPS_ABI_FP_64 = 6, + Val_GNU_MIPS_ABI_FP_64A = 7, + Val_GNU_MIPS_ABI_FP_MAX = 7 +}; + + + + +#define EF_PARISC_TRAPNIL 0x00010000 +#define EF_PARISC_EXT 0x00020000 +#define EF_PARISC_LSB 0x00040000 +#define EF_PARISC_WIDE 0x00080000 +#define EF_PARISC_NO_KABP 0x00100000 + +#define EF_PARISC_LAZYSWAP 0x00400000 +#define EF_PARISC_ARCH 0x0000ffff + + + +#define EFA_PARISC_1_0 0x020b +#define EFA_PARISC_1_1 0x0210 +#define EFA_PARISC_2_0 0x0214 + + + +#define SHN_PARISC_ANSI_COMMON 0xff00 + +#define SHN_PARISC_HUGE_COMMON 0xff01 + + + +#define SHT_PARISC_EXT 0x70000000 +#define SHT_PARISC_UNWIND 0x70000001 +#define SHT_PARISC_DOC 0x70000002 + + + +#define SHF_PARISC_SHORT 0x20000000 +#define SHF_PARISC_HUGE 0x40000000 +#define SHF_PARISC_SBP 0x80000000 + + + +#define STT_PARISC_MILLICODE 13 + +#define STT_HP_OPAQUE (STT_LOOS + 0x1) +#define STT_HP_STUB (STT_LOOS + 0x2) + + + +#define R_PARISC_NONE 0 +#define R_PARISC_DIR32 1 +#define R_PARISC_DIR21L 2 +#define R_PARISC_DIR17R 3 +#define R_PARISC_DIR17F 4 +#define R_PARISC_DIR14R 6 +#define R_PARISC_PCREL32 9 +#define R_PARISC_PCREL21L 10 +#define R_PARISC_PCREL17R 11 +#define R_PARISC_PCREL17F 12 +#define R_PARISC_PCREL14R 14 +#define R_PARISC_DPREL21L 18 +#define R_PARISC_DPREL14R 22 +#define R_PARISC_GPREL21L 26 +#define R_PARISC_GPREL14R 30 +#define R_PARISC_LTOFF21L 34 +#define R_PARISC_LTOFF14R 38 +#define R_PARISC_SECREL32 41 +#define R_PARISC_SEGBASE 48 +#define R_PARISC_SEGREL32 49 +#define R_PARISC_PLTOFF21L 50 +#define R_PARISC_PLTOFF14R 54 +#define R_PARISC_LTOFF_FPTR32 57 +#define R_PARISC_LTOFF_FPTR21L 58 +#define R_PARISC_LTOFF_FPTR14R 62 +#define R_PARISC_FPTR64 64 +#define R_PARISC_PLABEL32 65 +#define R_PARISC_PLABEL21L 66 +#define R_PARISC_PLABEL14R 70 +#define R_PARISC_PCREL64 72 +#define R_PARISC_PCREL22F 74 +#define R_PARISC_PCREL14WR 75 +#define R_PARISC_PCREL14DR 76 +#define R_PARISC_PCREL16F 77 +#define R_PARISC_PCREL16WF 78 +#define R_PARISC_PCREL16DF 79 +#define R_PARISC_DIR64 80 +#define R_PARISC_DIR14WR 83 +#define R_PARISC_DIR14DR 84 +#define R_PARISC_DIR16F 85 +#define R_PARISC_DIR16WF 86 +#define R_PARISC_DIR16DF 87 +#define R_PARISC_GPREL64 88 +#define R_PARISC_GPREL14WR 91 +#define R_PARISC_GPREL14DR 92 +#define R_PARISC_GPREL16F 93 +#define R_PARISC_GPREL16WF 94 +#define R_PARISC_GPREL16DF 95 +#define R_PARISC_LTOFF64 96 +#define R_PARISC_LTOFF14WR 99 +#define R_PARISC_LTOFF14DR 100 +#define R_PARISC_LTOFF16F 101 +#define R_PARISC_LTOFF16WF 102 +#define R_PARISC_LTOFF16DF 103 +#define R_PARISC_SECREL64 104 +#define R_PARISC_SEGREL64 112 +#define R_PARISC_PLTOFF14WR 115 +#define R_PARISC_PLTOFF14DR 116 +#define R_PARISC_PLTOFF16F 117 +#define R_PARISC_PLTOFF16WF 118 +#define R_PARISC_PLTOFF16DF 119 +#define R_PARISC_LTOFF_FPTR64 120 +#define R_PARISC_LTOFF_FPTR14WR 123 +#define R_PARISC_LTOFF_FPTR14DR 124 +#define R_PARISC_LTOFF_FPTR16F 125 +#define R_PARISC_LTOFF_FPTR16WF 126 +#define R_PARISC_LTOFF_FPTR16DF 127 +#define R_PARISC_LORESERVE 128 +#define R_PARISC_COPY 128 +#define R_PARISC_IPLT 129 +#define R_PARISC_EPLT 130 +#define R_PARISC_TPREL32 153 +#define R_PARISC_TPREL21L 154 +#define R_PARISC_TPREL14R 158 +#define R_PARISC_LTOFF_TP21L 162 +#define R_PARISC_LTOFF_TP14R 166 +#define R_PARISC_LTOFF_TP14F 167 +#define R_PARISC_TPREL64 216 +#define R_PARISC_TPREL14WR 219 +#define R_PARISC_TPREL14DR 220 +#define R_PARISC_TPREL16F 221 +#define R_PARISC_TPREL16WF 222 +#define R_PARISC_TPREL16DF 223 +#define R_PARISC_LTOFF_TP64 224 +#define R_PARISC_LTOFF_TP14WR 227 +#define R_PARISC_LTOFF_TP14DR 228 +#define R_PARISC_LTOFF_TP16F 229 +#define R_PARISC_LTOFF_TP16WF 230 +#define R_PARISC_LTOFF_TP16DF 231 +#define R_PARISC_GNU_VTENTRY 232 +#define R_PARISC_GNU_VTINHERIT 233 +#define R_PARISC_TLS_GD21L 234 +#define R_PARISC_TLS_GD14R 235 +#define R_PARISC_TLS_GDCALL 236 +#define R_PARISC_TLS_LDM21L 237 +#define R_PARISC_TLS_LDM14R 238 +#define R_PARISC_TLS_LDMCALL 239 +#define R_PARISC_TLS_LDO21L 240 +#define R_PARISC_TLS_LDO14R 241 +#define R_PARISC_TLS_DTPMOD32 242 +#define R_PARISC_TLS_DTPMOD64 243 +#define R_PARISC_TLS_DTPOFF32 244 +#define R_PARISC_TLS_DTPOFF64 245 +#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L +#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R +#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L +#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R +#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32 +#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64 +#define R_PARISC_HIRESERVE 255 + + + +#define PT_HP_TLS (PT_LOOS + 0x0) +#define PT_HP_CORE_NONE (PT_LOOS + 0x1) +#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) +#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) +#define PT_HP_CORE_COMM (PT_LOOS + 0x4) +#define PT_HP_CORE_PROC (PT_LOOS + 0x5) +#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) +#define PT_HP_CORE_STACK (PT_LOOS + 0x7) +#define PT_HP_CORE_SHM (PT_LOOS + 0x8) +#define PT_HP_CORE_MMF (PT_LOOS + 0x9) +#define PT_HP_PARALLEL (PT_LOOS + 0x10) +#define PT_HP_FASTBIND (PT_LOOS + 0x11) +#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12) +#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13) +#define PT_HP_STACK (PT_LOOS + 0x14) + +#define PT_PARISC_ARCHEXT 0x70000000 +#define PT_PARISC_UNWIND 0x70000001 + + + +#define PF_PARISC_SBP 0x08000000 + +#define PF_HP_PAGE_SIZE 0x00100000 +#define PF_HP_FAR_SHARED 0x00200000 +#define PF_HP_NEAR_SHARED 0x00400000 +#define PF_HP_CODE 0x01000000 +#define PF_HP_MODIFY 0x02000000 +#define PF_HP_LAZYSWAP 0x04000000 +#define PF_HP_SBP 0x08000000 + + + + + + +#define EF_ALPHA_32BIT 1 +#define EF_ALPHA_CANRELAX 2 + + + + +#define SHT_ALPHA_DEBUG 0x70000001 +#define SHT_ALPHA_REGINFO 0x70000002 + + + +#define SHF_ALPHA_GPREL 0x10000000 + + +#define STO_ALPHA_NOPV 0x80 +#define STO_ALPHA_STD_GPLOAD 0x88 + + + +#define R_ALPHA_NONE 0 +#define R_ALPHA_REFLONG 1 +#define R_ALPHA_REFQUAD 2 +#define R_ALPHA_GPREL32 3 +#define R_ALPHA_LITERAL 4 +#define R_ALPHA_LITUSE 5 +#define R_ALPHA_GPDISP 6 +#define R_ALPHA_BRADDR 7 +#define R_ALPHA_HINT 8 +#define R_ALPHA_SREL16 9 +#define R_ALPHA_SREL32 10 +#define R_ALPHA_SREL64 11 +#define R_ALPHA_GPRELHIGH 17 +#define R_ALPHA_GPRELLOW 18 +#define R_ALPHA_GPREL16 19 +#define R_ALPHA_COPY 24 +#define R_ALPHA_GLOB_DAT 25 +#define R_ALPHA_JMP_SLOT 26 +#define R_ALPHA_RELATIVE 27 +#define R_ALPHA_TLS_GD_HI 28 +#define R_ALPHA_TLSGD 29 +#define R_ALPHA_TLS_LDM 30 +#define R_ALPHA_DTPMOD64 31 +#define R_ALPHA_GOTDTPREL 32 +#define R_ALPHA_DTPREL64 33 +#define R_ALPHA_DTPRELHI 34 +#define R_ALPHA_DTPRELLO 35 +#define R_ALPHA_DTPREL16 36 +#define R_ALPHA_GOTTPREL 37 +#define R_ALPHA_TPREL64 38 +#define R_ALPHA_TPRELHI 39 +#define R_ALPHA_TPRELLO 40 +#define R_ALPHA_TPREL16 41 + +#define R_ALPHA_NUM 46 + + +#define LITUSE_ALPHA_ADDR 0 +#define LITUSE_ALPHA_BASE 1 +#define LITUSE_ALPHA_BYTOFF 2 +#define LITUSE_ALPHA_JSR 3 +#define LITUSE_ALPHA_TLS_GD 4 +#define LITUSE_ALPHA_TLS_LDM 5 + + +#define DT_ALPHA_PLTRO (DT_LOPROC + 0) +#define DT_ALPHA_NUM 1 + + + + +#define EF_PPC_EMB 0x80000000 + + +#define EF_PPC_RELOCATABLE 0x00010000 +#define EF_PPC_RELOCATABLE_LIB 0x00008000 + + + +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 +#define R_PPC_ADDR24 2 +#define R_PPC_ADDR16 3 +#define R_PPC_ADDR16_LO 4 +#define R_PPC_ADDR16_HI 5 +#define R_PPC_ADDR16_HA 6 +#define R_PPC_ADDR14 7 +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 +#define R_PPC_REL14 11 +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + + +#define R_PPC_TLS 67 +#define R_PPC_DTPMOD32 68 +#define R_PPC_TPREL16 69 +#define R_PPC_TPREL16_LO 70 +#define R_PPC_TPREL16_HI 71 +#define R_PPC_TPREL16_HA 72 +#define R_PPC_TPREL32 73 +#define R_PPC_DTPREL16 74 +#define R_PPC_DTPREL16_LO 75 +#define R_PPC_DTPREL16_HI 76 +#define R_PPC_DTPREL16_HA 77 +#define R_PPC_DTPREL32 78 +#define R_PPC_GOT_TLSGD16 79 +#define R_PPC_GOT_TLSGD16_LO 80 +#define R_PPC_GOT_TLSGD16_HI 81 +#define R_PPC_GOT_TLSGD16_HA 82 +#define R_PPC_GOT_TLSLD16 83 +#define R_PPC_GOT_TLSLD16_LO 84 +#define R_PPC_GOT_TLSLD16_HI 85 +#define R_PPC_GOT_TLSLD16_HA 86 +#define R_PPC_GOT_TPREL16 87 +#define R_PPC_GOT_TPREL16_LO 88 +#define R_PPC_GOT_TPREL16_HI 89 +#define R_PPC_GOT_TPREL16_HA 90 +#define R_PPC_GOT_DTPREL16 91 +#define R_PPC_GOT_DTPREL16_LO 92 +#define R_PPC_GOT_DTPREL16_HI 93 +#define R_PPC_GOT_DTPREL16_HA 94 +#define R_PPC_TLSGD 95 +#define R_PPC_TLSLD 96 + + +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 + + +#define R_PPC_DIAB_SDA21_LO 180 +#define R_PPC_DIAB_SDA21_HI 181 +#define R_PPC_DIAB_SDA21_HA 182 +#define R_PPC_DIAB_RELSDA_LO 183 +#define R_PPC_DIAB_RELSDA_HI 184 +#define R_PPC_DIAB_RELSDA_HA 185 + + +#define R_PPC_IRELATIVE 248 + + +#define R_PPC_REL16 249 +#define R_PPC_REL16_LO 250 +#define R_PPC_REL16_HI 251 +#define R_PPC_REL16_HA 252 + + + +#define R_PPC_TOC16 255 + + +#define DT_PPC_GOT (DT_LOPROC + 0) +#define DT_PPC_OPT (DT_LOPROC + 1) +#define DT_PPC_NUM 2 + +#define PPC_OPT_TLS 1 + + +#define R_PPC64_NONE R_PPC_NONE +#define R_PPC64_ADDR32 R_PPC_ADDR32 +#define R_PPC64_ADDR24 R_PPC_ADDR24 +#define R_PPC64_ADDR16 R_PPC_ADDR16 +#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO +#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI +#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA +#define R_PPC64_ADDR14 R_PPC_ADDR14 +#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN +#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN +#define R_PPC64_REL24 R_PPC_REL24 +#define R_PPC64_REL14 R_PPC_REL14 +#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN +#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN +#define R_PPC64_GOT16 R_PPC_GOT16 +#define R_PPC64_GOT16_LO R_PPC_GOT16_LO +#define R_PPC64_GOT16_HI R_PPC_GOT16_HI +#define R_PPC64_GOT16_HA R_PPC_GOT16_HA + +#define R_PPC64_COPY R_PPC_COPY +#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT +#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT +#define R_PPC64_RELATIVE R_PPC_RELATIVE + +#define R_PPC64_UADDR32 R_PPC_UADDR32 +#define R_PPC64_UADDR16 R_PPC_UADDR16 +#define R_PPC64_REL32 R_PPC_REL32 +#define R_PPC64_PLT32 R_PPC_PLT32 +#define R_PPC64_PLTREL32 R_PPC_PLTREL32 +#define R_PPC64_PLT16_LO R_PPC_PLT16_LO +#define R_PPC64_PLT16_HI R_PPC_PLT16_HI +#define R_PPC64_PLT16_HA R_PPC_PLT16_HA + +#define R_PPC64_SECTOFF R_PPC_SECTOFF +#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO +#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI +#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA +#define R_PPC64_ADDR30 37 +#define R_PPC64_ADDR64 38 +#define R_PPC64_ADDR16_HIGHER 39 +#define R_PPC64_ADDR16_HIGHERA 40 +#define R_PPC64_ADDR16_HIGHEST 41 +#define R_PPC64_ADDR16_HIGHESTA 42 +#define R_PPC64_UADDR64 43 +#define R_PPC64_REL64 44 +#define R_PPC64_PLT64 45 +#define R_PPC64_PLTREL64 46 +#define R_PPC64_TOC16 47 +#define R_PPC64_TOC16_LO 48 +#define R_PPC64_TOC16_HI 49 +#define R_PPC64_TOC16_HA 50 +#define R_PPC64_TOC 51 +#define R_PPC64_PLTGOT16 52 +#define R_PPC64_PLTGOT16_LO 53 +#define R_PPC64_PLTGOT16_HI 54 +#define R_PPC64_PLTGOT16_HA 55 + +#define R_PPC64_ADDR16_DS 56 +#define R_PPC64_ADDR16_LO_DS 57 +#define R_PPC64_GOT16_DS 58 +#define R_PPC64_GOT16_LO_DS 59 +#define R_PPC64_PLT16_LO_DS 60 +#define R_PPC64_SECTOFF_DS 61 +#define R_PPC64_SECTOFF_LO_DS 62 +#define R_PPC64_TOC16_DS 63 +#define R_PPC64_TOC16_LO_DS 64 +#define R_PPC64_PLTGOT16_DS 65 +#define R_PPC64_PLTGOT16_LO_DS 66 + + +#define R_PPC64_TLS 67 +#define R_PPC64_DTPMOD64 68 +#define R_PPC64_TPREL16 69 +#define R_PPC64_TPREL16_LO 70 +#define R_PPC64_TPREL16_HI 71 +#define R_PPC64_TPREL16_HA 72 +#define R_PPC64_TPREL64 73 +#define R_PPC64_DTPREL16 74 +#define R_PPC64_DTPREL16_LO 75 +#define R_PPC64_DTPREL16_HI 76 +#define R_PPC64_DTPREL16_HA 77 +#define R_PPC64_DTPREL64 78 +#define R_PPC64_GOT_TLSGD16 79 +#define R_PPC64_GOT_TLSGD16_LO 80 +#define R_PPC64_GOT_TLSGD16_HI 81 +#define R_PPC64_GOT_TLSGD16_HA 82 +#define R_PPC64_GOT_TLSLD16 83 +#define R_PPC64_GOT_TLSLD16_LO 84 +#define R_PPC64_GOT_TLSLD16_HI 85 +#define R_PPC64_GOT_TLSLD16_HA 86 +#define R_PPC64_GOT_TPREL16_DS 87 +#define R_PPC64_GOT_TPREL16_LO_DS 88 +#define R_PPC64_GOT_TPREL16_HI 89 +#define R_PPC64_GOT_TPREL16_HA 90 +#define R_PPC64_GOT_DTPREL16_DS 91 +#define R_PPC64_GOT_DTPREL16_LO_DS 92 +#define R_PPC64_GOT_DTPREL16_HI 93 +#define R_PPC64_GOT_DTPREL16_HA 94 +#define R_PPC64_TPREL16_DS 95 +#define R_PPC64_TPREL16_LO_DS 96 +#define R_PPC64_TPREL16_HIGHER 97 +#define R_PPC64_TPREL16_HIGHERA 98 +#define R_PPC64_TPREL16_HIGHEST 99 +#define R_PPC64_TPREL16_HIGHESTA 100 +#define R_PPC64_DTPREL16_DS 101 +#define R_PPC64_DTPREL16_LO_DS 102 +#define R_PPC64_DTPREL16_HIGHER 103 +#define R_PPC64_DTPREL16_HIGHERA 104 +#define R_PPC64_DTPREL16_HIGHEST 105 +#define R_PPC64_DTPREL16_HIGHESTA 106 +#define R_PPC64_TLSGD 107 +#define R_PPC64_TLSLD 108 +#define R_PPC64_TOCSAVE 109 +#define R_PPC64_ADDR16_HIGH 110 +#define R_PPC64_ADDR16_HIGHA 111 +#define R_PPC64_TPREL16_HIGH 112 +#define R_PPC64_TPREL16_HIGHA 113 +#define R_PPC64_DTPREL16_HIGH 114 +#define R_PPC64_DTPREL16_HIGHA 115 + + +#define R_PPC64_JMP_IREL 247 +#define R_PPC64_IRELATIVE 248 +#define R_PPC64_REL16 249 +#define R_PPC64_REL16_LO 250 +#define R_PPC64_REL16_HI 251 +#define R_PPC64_REL16_HA 252 + +#define EF_PPC64_ABI 3 + +#define DT_PPC64_GLINK (DT_LOPROC + 0) +#define DT_PPC64_OPD (DT_LOPROC + 1) +#define DT_PPC64_OPDSZ (DT_LOPROC + 2) +#define DT_PPC64_OPT (DT_LOPROC + 3) +#define DT_PPC64_NUM 4 + +#define PPC64_OPT_TLS 1 +#define PPC64_OPT_MULTI_TOC 2 +#define PPC64_OPT_LOCALENTRY 4 + +#define STO_PPC64_LOCAL_BIT 5 +#define STO_PPC64_LOCAL_MASK 0xe0 +#define PPC64_LOCAL_ENTRY_OFFSET(x) (1 << (((x)&0xe0)>>5) & 0xfc) + + +#define EF_ARM_RELEXEC 0x01 +#define EF_ARM_HASENTRY 0x02 +#define EF_ARM_INTERWORK 0x04 +#define EF_ARM_APCS_26 0x08 +#define EF_ARM_APCS_FLOAT 0x10 +#define EF_ARM_PIC 0x20 +#define EF_ARM_ALIGN8 0x40 +#define EF_ARM_NEW_ABI 0x80 +#define EF_ARM_OLD_ABI 0x100 +#define EF_ARM_SOFT_FLOAT 0x200 +#define EF_ARM_VFP_FLOAT 0x400 +#define EF_ARM_MAVERICK_FLOAT 0x800 + +#define EF_ARM_ABI_FLOAT_SOFT 0x200 +#define EF_ARM_ABI_FLOAT_HARD 0x400 + + +#define EF_ARM_SYMSARESORTED 0x04 +#define EF_ARM_DYNSYMSUSESEGIDX 0x08 +#define EF_ARM_MAPSYMSFIRST 0x10 +#define EF_ARM_EABIMASK 0XFF000000 + + +#define EF_ARM_BE8 0x00800000 +#define EF_ARM_LE8 0x00400000 + +#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK) +#define EF_ARM_EABI_UNKNOWN 0x00000000 +#define EF_ARM_EABI_VER1 0x01000000 +#define EF_ARM_EABI_VER2 0x02000000 +#define EF_ARM_EABI_VER3 0x03000000 +#define EF_ARM_EABI_VER4 0x04000000 +#define EF_ARM_EABI_VER5 0x05000000 + + +#define STT_ARM_TFUNC STT_LOPROC +#define STT_ARM_16BIT STT_HIPROC + + +#define SHF_ARM_ENTRYSECT 0x10000000 +#define SHF_ARM_COMDEF 0x80000000 + + + +#define PF_ARM_SB 0x10000000 + +#define PF_ARM_PI 0x20000000 +#define PF_ARM_ABS 0x40000000 + + +#define PT_ARM_EXIDX (PT_LOPROC + 1) + + +#define SHT_ARM_EXIDX (SHT_LOPROC + 1) +#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) +#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) + +#define R_AARCH64_NONE 0 +#define R_AARCH64_P32_ABS32 1 +#define R_AARCH64_P32_COPY 180 +#define R_AARCH64_P32_GLOB_DAT 181 +#define R_AARCH64_P32_JUMP_SLOT 182 +#define R_AARCH64_P32_RELATIVE 183 +#define R_AARCH64_P32_TLS_DTPMOD 184 +#define R_AARCH64_P32_TLS_DTPREL 185 +#define R_AARCH64_P32_TLS_TPREL 186 +#define R_AARCH64_P32_TLSDESC 187 +#define R_AARCH64_P32_IRELATIVE 188 +#define R_AARCH64_ABS64 257 +#define R_AARCH64_ABS32 258 +#define R_AARCH64_ABS16 259 +#define R_AARCH64_PREL64 260 +#define R_AARCH64_PREL32 261 +#define R_AARCH64_PREL16 262 +#define R_AARCH64_MOVW_UABS_G0 263 +#define R_AARCH64_MOVW_UABS_G0_NC 264 +#define R_AARCH64_MOVW_UABS_G1 265 +#define R_AARCH64_MOVW_UABS_G1_NC 266 +#define R_AARCH64_MOVW_UABS_G2 267 +#define R_AARCH64_MOVW_UABS_G2_NC 268 +#define R_AARCH64_MOVW_UABS_G3 269 +#define R_AARCH64_MOVW_SABS_G0 270 +#define R_AARCH64_MOVW_SABS_G1 271 +#define R_AARCH64_MOVW_SABS_G2 272 +#define R_AARCH64_LD_PREL_LO19 273 +#define R_AARCH64_ADR_PREL_LO21 274 +#define R_AARCH64_ADR_PREL_PG_HI21 275 +#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 +#define R_AARCH64_ADD_ABS_LO12_NC 277 +#define R_AARCH64_LDST8_ABS_LO12_NC 278 +#define R_AARCH64_TSTBR14 279 +#define R_AARCH64_CONDBR19 280 +#define R_AARCH64_JUMP26 282 +#define R_AARCH64_CALL26 283 +#define R_AARCH64_LDST16_ABS_LO12_NC 284 +#define R_AARCH64_LDST32_ABS_LO12_NC 285 +#define R_AARCH64_LDST64_ABS_LO12_NC 286 +#define R_AARCH64_MOVW_PREL_G0 287 +#define R_AARCH64_MOVW_PREL_G0_NC 288 +#define R_AARCH64_MOVW_PREL_G1 289 +#define R_AARCH64_MOVW_PREL_G1_NC 290 +#define R_AARCH64_MOVW_PREL_G2 291 +#define R_AARCH64_MOVW_PREL_G2_NC 292 +#define R_AARCH64_MOVW_PREL_G3 293 +#define R_AARCH64_LDST128_ABS_LO12_NC 299 +#define R_AARCH64_MOVW_GOTOFF_G0 300 +#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 +#define R_AARCH64_MOVW_GOTOFF_G1 302 +#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 +#define R_AARCH64_MOVW_GOTOFF_G2 304 +#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 +#define R_AARCH64_MOVW_GOTOFF_G3 306 +#define R_AARCH64_GOTREL64 307 +#define R_AARCH64_GOTREL32 308 +#define R_AARCH64_GOT_LD_PREL19 309 +#define R_AARCH64_LD64_GOTOFF_LO15 310 +#define R_AARCH64_ADR_GOT_PAGE 311 +#define R_AARCH64_LD64_GOT_LO12_NC 312 +#define R_AARCH64_LD64_GOTPAGE_LO15 313 +#define R_AARCH64_TLSGD_ADR_PREL21 512 +#define R_AARCH64_TLSGD_ADR_PAGE21 513 +#define R_AARCH64_TLSGD_ADD_LO12_NC 514 +#define R_AARCH64_TLSGD_MOVW_G1 515 +#define R_AARCH64_TLSGD_MOVW_G0_NC 516 +#define R_AARCH64_TLSLD_ADR_PREL21 517 +#define R_AARCH64_TLSLD_ADR_PAGE21 518 +#define R_AARCH64_TLSLD_ADD_LO12_NC 519 +#define R_AARCH64_TLSLD_MOVW_G1 520 +#define R_AARCH64_TLSLD_MOVW_G0_NC 521 +#define R_AARCH64_TLSLD_LD_PREL19 522 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 +#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 +#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 +#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 +#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 +#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 +#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 +#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 +#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 +#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 +#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 +#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 +#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 +#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 +#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 +#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 +#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 +#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 +#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 +#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 +#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 +#define R_AARCH64_TLSDESC_LD_PREL19 560 +#define R_AARCH64_TLSDESC_ADR_PREL21 561 +#define R_AARCH64_TLSDESC_ADR_PAGE21 562 +#define R_AARCH64_TLSDESC_LD64_LO12 563 +#define R_AARCH64_TLSDESC_ADD_LO12 564 +#define R_AARCH64_TLSDESC_OFF_G1 565 +#define R_AARCH64_TLSDESC_OFF_G0_NC 566 +#define R_AARCH64_TLSDESC_LDR 567 +#define R_AARCH64_TLSDESC_ADD 568 +#define R_AARCH64_TLSDESC_CALL 569 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 +#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 +#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 +#define R_AARCH64_COPY 1024 +#define R_AARCH64_GLOB_DAT 1025 +#define R_AARCH64_JUMP_SLOT 1026 +#define R_AARCH64_RELATIVE 1027 +#define R_AARCH64_TLS_DTPMOD 1028 +#define R_AARCH64_TLS_DTPMOD64 1028 +#define R_AARCH64_TLS_DTPREL 1029 +#define R_AARCH64_TLS_DTPREL64 1029 +#define R_AARCH64_TLS_TPREL 1030 +#define R_AARCH64_TLS_TPREL64 1030 +#define R_AARCH64_TLSDESC 1031 + + +#define R_ARM_NONE 0 +#define R_ARM_PC24 1 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 +#define R_ARM_ABS12 6 +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_TLS_DESC 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +#define R_ARM_TLS_DTPMOD32 17 +#define R_ARM_TLS_DTPOFF32 18 +#define R_ARM_TLS_TPOFF32 19 +#define R_ARM_COPY 20 +#define R_ARM_GLOB_DAT 21 +#define R_ARM_JUMP_SLOT 22 +#define R_ARM_RELATIVE 23 +#define R_ARM_GOTOFF 24 +#define R_ARM_GOTPC 25 +#define R_ARM_GOT32 26 +#define R_ARM_PLT32 27 +#define R_ARM_CALL 28 +#define R_ARM_JUMP24 29 +#define R_ARM_THM_JUMP24 30 +#define R_ARM_BASE_ABS 31 +#define R_ARM_ALU_PCREL_7_0 32 +#define R_ARM_ALU_PCREL_15_8 33 +#define R_ARM_ALU_PCREL_23_15 34 +#define R_ARM_LDR_SBREL_11_0 35 +#define R_ARM_ALU_SBREL_19_12 36 +#define R_ARM_ALU_SBREL_27_20 37 +#define R_ARM_TARGET1 38 +#define R_ARM_SBREL31 39 +#define R_ARM_V4BX 40 +#define R_ARM_TARGET2 41 +#define R_ARM_PREL31 42 +#define R_ARM_MOVW_ABS_NC 43 +#define R_ARM_MOVT_ABS 44 +#define R_ARM_MOVW_PREL_NC 45 +#define R_ARM_MOVT_PREL 46 +#define R_ARM_THM_MOVW_ABS_NC 47 +#define R_ARM_THM_MOVT_ABS 48 +#define R_ARM_THM_MOVW_PREL_NC 49 +#define R_ARM_THM_MOVT_PREL 50 +#define R_ARM_THM_JUMP19 51 +#define R_ARM_THM_JUMP6 52 +#define R_ARM_THM_ALU_PREL_11_0 53 +#define R_ARM_THM_PC12 54 +#define R_ARM_ABS32_NOI 55 +#define R_ARM_REL32_NOI 56 +#define R_ARM_ALU_PC_G0_NC 57 +#define R_ARM_ALU_PC_G0 58 +#define R_ARM_ALU_PC_G1_NC 59 +#define R_ARM_ALU_PC_G1 60 +#define R_ARM_ALU_PC_G2 61 +#define R_ARM_LDR_PC_G1 62 +#define R_ARM_LDR_PC_G2 63 +#define R_ARM_LDRS_PC_G0 64 +#define R_ARM_LDRS_PC_G1 65 +#define R_ARM_LDRS_PC_G2 66 +#define R_ARM_LDC_PC_G0 67 +#define R_ARM_LDC_PC_G1 68 +#define R_ARM_LDC_PC_G2 69 +#define R_ARM_ALU_SB_G0_NC 70 +#define R_ARM_ALU_SB_G0 71 +#define R_ARM_ALU_SB_G1_NC 72 +#define R_ARM_ALU_SB_G1 73 +#define R_ARM_ALU_SB_G2 74 +#define R_ARM_LDR_SB_G0 75 +#define R_ARM_LDR_SB_G1 76 +#define R_ARM_LDR_SB_G2 77 +#define R_ARM_LDRS_SB_G0 78 +#define R_ARM_LDRS_SB_G1 79 +#define R_ARM_LDRS_SB_G2 80 +#define R_ARM_LDC_SB_G0 81 +#define R_ARM_LDC_SB_G1 82 +#define R_ARM_LDC_SB_G2 83 +#define R_ARM_MOVW_BREL_NC 84 +#define R_ARM_MOVT_BREL 85 +#define R_ARM_MOVW_BREL 86 +#define R_ARM_THM_MOVW_BREL_NC 87 +#define R_ARM_THM_MOVT_BREL 88 +#define R_ARM_THM_MOVW_BREL 89 +#define R_ARM_TLS_GOTDESC 90 +#define R_ARM_TLS_CALL 91 +#define R_ARM_TLS_DESCSEQ 92 +#define R_ARM_THM_TLS_CALL 93 +#define R_ARM_PLT32_ABS 94 +#define R_ARM_GOT_ABS 95 +#define R_ARM_GOT_PREL 96 +#define R_ARM_GOT_BREL12 97 +#define R_ARM_GOTOFF12 98 +#define R_ARM_GOTRELAX 99 +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_THM_PC11 102 +#define R_ARM_THM_PC9 103 +#define R_ARM_TLS_GD32 104 + +#define R_ARM_TLS_LDM32 105 + +#define R_ARM_TLS_LDO32 106 + +#define R_ARM_TLS_IE32 107 + +#define R_ARM_TLS_LE32 108 +#define R_ARM_TLS_LDO12 109 +#define R_ARM_TLS_LE12 110 +#define R_ARM_TLS_IE12GP 111 +#define R_ARM_ME_TOO 128 +#define R_ARM_THM_TLS_DESCSEQ 129 +#define R_ARM_THM_TLS_DESCSEQ16 129 +#define R_ARM_THM_TLS_DESCSEQ32 130 +#define R_ARM_THM_GOT_BREL12 131 +#define R_ARM_IRELATIVE 160 +#define R_ARM_RXPC25 249 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS22 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 + +#define R_ARM_NUM 256 + + + + +#define EF_IA_64_MASKOS 0x0000000f +#define EF_IA_64_ABI64 0x00000010 +#define EF_IA_64_ARCH 0xff000000 + + +#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) +#define PT_IA_64_UNWIND (PT_LOPROC + 1) +#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12) +#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13) +#define PT_IA_64_HP_STACK (PT_LOOS + 0x14) + + +#define PF_IA_64_NORECOV 0x80000000 + + +#define SHT_IA_64_EXT (SHT_LOPROC + 0) +#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) + + +#define SHF_IA_64_SHORT 0x10000000 +#define SHF_IA_64_NORECOV 0x20000000 + + +#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0) +#define DT_IA_64_NUM 1 + + +#define R_IA64_NONE 0x00 +#define R_IA64_IMM14 0x21 +#define R_IA64_IMM22 0x22 +#define R_IA64_IMM64 0x23 +#define R_IA64_DIR32MSB 0x24 +#define R_IA64_DIR32LSB 0x25 +#define R_IA64_DIR64MSB 0x26 +#define R_IA64_DIR64LSB 0x27 +#define R_IA64_GPREL22 0x2a +#define R_IA64_GPREL64I 0x2b +#define R_IA64_GPREL32MSB 0x2c +#define R_IA64_GPREL32LSB 0x2d +#define R_IA64_GPREL64MSB 0x2e +#define R_IA64_GPREL64LSB 0x2f +#define R_IA64_LTOFF22 0x32 +#define R_IA64_LTOFF64I 0x33 +#define R_IA64_PLTOFF22 0x3a +#define R_IA64_PLTOFF64I 0x3b +#define R_IA64_PLTOFF64MSB 0x3e +#define R_IA64_PLTOFF64LSB 0x3f +#define R_IA64_FPTR64I 0x43 +#define R_IA64_FPTR32MSB 0x44 +#define R_IA64_FPTR32LSB 0x45 +#define R_IA64_FPTR64MSB 0x46 +#define R_IA64_FPTR64LSB 0x47 +#define R_IA64_PCREL60B 0x48 +#define R_IA64_PCREL21B 0x49 +#define R_IA64_PCREL21M 0x4a +#define R_IA64_PCREL21F 0x4b +#define R_IA64_PCREL32MSB 0x4c +#define R_IA64_PCREL32LSB 0x4d +#define R_IA64_PCREL64MSB 0x4e +#define R_IA64_PCREL64LSB 0x4f +#define R_IA64_LTOFF_FPTR22 0x52 +#define R_IA64_LTOFF_FPTR64I 0x53 +#define R_IA64_LTOFF_FPTR32MSB 0x54 +#define R_IA64_LTOFF_FPTR32LSB 0x55 +#define R_IA64_LTOFF_FPTR64MSB 0x56 +#define R_IA64_LTOFF_FPTR64LSB 0x57 +#define R_IA64_SEGREL32MSB 0x5c +#define R_IA64_SEGREL32LSB 0x5d +#define R_IA64_SEGREL64MSB 0x5e +#define R_IA64_SEGREL64LSB 0x5f +#define R_IA64_SECREL32MSB 0x64 +#define R_IA64_SECREL32LSB 0x65 +#define R_IA64_SECREL64MSB 0x66 +#define R_IA64_SECREL64LSB 0x67 +#define R_IA64_REL32MSB 0x6c +#define R_IA64_REL32LSB 0x6d +#define R_IA64_REL64MSB 0x6e +#define R_IA64_REL64LSB 0x6f +#define R_IA64_LTV32MSB 0x74 +#define R_IA64_LTV32LSB 0x75 +#define R_IA64_LTV64MSB 0x76 +#define R_IA64_LTV64LSB 0x77 +#define R_IA64_PCREL21BI 0x79 +#define R_IA64_PCREL22 0x7a +#define R_IA64_PCREL64I 0x7b +#define R_IA64_IPLTMSB 0x80 +#define R_IA64_IPLTLSB 0x81 +#define R_IA64_COPY 0x84 +#define R_IA64_SUB 0x85 +#define R_IA64_LTOFF22X 0x86 +#define R_IA64_LDXMOV 0x87 +#define R_IA64_TPREL14 0x91 +#define R_IA64_TPREL22 0x92 +#define R_IA64_TPREL64I 0x93 +#define R_IA64_TPREL64MSB 0x96 +#define R_IA64_TPREL64LSB 0x97 +#define R_IA64_LTOFF_TPREL22 0x9a +#define R_IA64_DTPMOD64MSB 0xa6 +#define R_IA64_DTPMOD64LSB 0xa7 +#define R_IA64_LTOFF_DTPMOD22 0xaa +#define R_IA64_DTPREL14 0xb1 +#define R_IA64_DTPREL22 0xb2 +#define R_IA64_DTPREL64I 0xb3 +#define R_IA64_DTPREL32MSB 0xb4 +#define R_IA64_DTPREL32LSB 0xb5 +#define R_IA64_DTPREL64MSB 0xb6 +#define R_IA64_DTPREL64LSB 0xb7 +#define R_IA64_LTOFF_DTPREL22 0xba + + +#define EF_SH_MACH_MASK 0x1f +#define EF_SH_UNKNOWN 0x0 +#define EF_SH1 0x1 +#define EF_SH2 0x2 +#define EF_SH3 0x3 +#define EF_SH_DSP 0x4 +#define EF_SH3_DSP 0x5 +#define EF_SH4AL_DSP 0x6 +#define EF_SH3E 0x8 +#define EF_SH4 0x9 +#define EF_SH2E 0xb +#define EF_SH4A 0xc +#define EF_SH2A 0xd +#define EF_SH4_NOFPU 0x10 +#define EF_SH4A_NOFPU 0x11 +#define EF_SH4_NOMMU_NOFPU 0x12 +#define EF_SH2A_NOFPU 0x13 +#define EF_SH3_NOMMU 0x14 +#define EF_SH2A_SH4_NOFPU 0x15 +#define EF_SH2A_SH3_NOFPU 0x16 +#define EF_SH2A_SH4 0x17 +#define EF_SH2A_SH3E 0x18 + +#define R_SH_NONE 0 +#define R_SH_DIR32 1 +#define R_SH_REL32 2 +#define R_SH_DIR8WPN 3 +#define R_SH_IND12W 4 +#define R_SH_DIR8WPL 5 +#define R_SH_DIR8WPZ 6 +#define R_SH_DIR8BP 7 +#define R_SH_DIR8W 8 +#define R_SH_DIR8L 9 +#define R_SH_SWITCH16 25 +#define R_SH_SWITCH32 26 +#define R_SH_USES 27 +#define R_SH_COUNT 28 +#define R_SH_ALIGN 29 +#define R_SH_CODE 30 +#define R_SH_DATA 31 +#define R_SH_LABEL 32 +#define R_SH_SWITCH8 33 +#define R_SH_GNU_VTINHERIT 34 +#define R_SH_GNU_VTENTRY 35 +#define R_SH_TLS_GD_32 144 +#define R_SH_TLS_LD_32 145 +#define R_SH_TLS_LDO_32 146 +#define R_SH_TLS_IE_32 147 +#define R_SH_TLS_LE_32 148 +#define R_SH_TLS_DTPMOD32 149 +#define R_SH_TLS_DTPOFF32 150 +#define R_SH_TLS_TPOFF32 151 +#define R_SH_GOT32 160 +#define R_SH_PLT32 161 +#define R_SH_COPY 162 +#define R_SH_GLOB_DAT 163 +#define R_SH_JMP_SLOT 164 +#define R_SH_RELATIVE 165 +#define R_SH_GOTOFF 166 +#define R_SH_GOTPC 167 +#define R_SH_GOT20 201 +#define R_SH_GOTOFF20 202 +#define R_SH_GOTFUNCDESC 203 +#define R_SH_GOTFUNCDEST20 204 +#define R_SH_GOTOFFFUNCDESC 205 +#define R_SH_GOTOFFFUNCDEST20 206 +#define R_SH_FUNCDESC 207 +#define R_SH_FUNCDESC_VALUE 208 + +#define R_SH_NUM 256 + + + +#define R_390_NONE 0 +#define R_390_8 1 +#define R_390_12 2 +#define R_390_16 3 +#define R_390_32 4 +#define R_390_PC32 5 +#define R_390_GOT12 6 +#define R_390_GOT32 7 +#define R_390_PLT32 8 +#define R_390_COPY 9 +#define R_390_GLOB_DAT 10 +#define R_390_JMP_SLOT 11 +#define R_390_RELATIVE 12 +#define R_390_GOTOFF32 13 +#define R_390_GOTPC 14 +#define R_390_GOT16 15 +#define R_390_PC16 16 +#define R_390_PC16DBL 17 +#define R_390_PLT16DBL 18 +#define R_390_PC32DBL 19 +#define R_390_PLT32DBL 20 +#define R_390_GOTPCDBL 21 +#define R_390_64 22 +#define R_390_PC64 23 +#define R_390_GOT64 24 +#define R_390_PLT64 25 +#define R_390_GOTENT 26 +#define R_390_GOTOFF16 27 +#define R_390_GOTOFF64 28 +#define R_390_GOTPLT12 29 +#define R_390_GOTPLT16 30 +#define R_390_GOTPLT32 31 +#define R_390_GOTPLT64 32 +#define R_390_GOTPLTENT 33 +#define R_390_PLTOFF16 34 +#define R_390_PLTOFF32 35 +#define R_390_PLTOFF64 36 +#define R_390_TLS_LOAD 37 +#define R_390_TLS_GDCALL 38 + +#define R_390_TLS_LDCALL 39 + +#define R_390_TLS_GD32 40 + +#define R_390_TLS_GD64 41 + +#define R_390_TLS_GOTIE12 42 + +#define R_390_TLS_GOTIE32 43 + +#define R_390_TLS_GOTIE64 44 + +#define R_390_TLS_LDM32 45 + +#define R_390_TLS_LDM64 46 + +#define R_390_TLS_IE32 47 + +#define R_390_TLS_IE64 48 + +#define R_390_TLS_IEENT 49 + +#define R_390_TLS_LE32 50 + +#define R_390_TLS_LE64 51 + +#define R_390_TLS_LDO32 52 + +#define R_390_TLS_LDO64 53 + +#define R_390_TLS_DTPMOD 54 +#define R_390_TLS_DTPOFF 55 +#define R_390_TLS_TPOFF 56 + +#define R_390_20 57 +#define R_390_GOT20 58 +#define R_390_GOTPLT20 59 +#define R_390_TLS_GOTIE20 60 + + +#define R_390_NUM 61 + + + +#define R_CRIS_NONE 0 +#define R_CRIS_8 1 +#define R_CRIS_16 2 +#define R_CRIS_32 3 +#define R_CRIS_8_PCREL 4 +#define R_CRIS_16_PCREL 5 +#define R_CRIS_32_PCREL 6 +#define R_CRIS_GNU_VTINHERIT 7 +#define R_CRIS_GNU_VTENTRY 8 +#define R_CRIS_COPY 9 +#define R_CRIS_GLOB_DAT 10 +#define R_CRIS_JUMP_SLOT 11 +#define R_CRIS_RELATIVE 12 +#define R_CRIS_16_GOT 13 +#define R_CRIS_32_GOT 14 +#define R_CRIS_16_GOTPLT 15 +#define R_CRIS_32_GOTPLT 16 +#define R_CRIS_32_GOTREL 17 +#define R_CRIS_32_PLT_GOTREL 18 +#define R_CRIS_32_PLT_PCREL 19 + +#define R_CRIS_NUM 20 + + + +#define R_X86_64_NONE 0 +#define R_X86_64_64 1 +#define R_X86_64_PC32 2 +#define R_X86_64_GOT32 3 +#define R_X86_64_PLT32 4 +#define R_X86_64_COPY 5 +#define R_X86_64_GLOB_DAT 6 +#define R_X86_64_JUMP_SLOT 7 +#define R_X86_64_RELATIVE 8 +#define R_X86_64_GOTPCREL 9 + +#define R_X86_64_32 10 +#define R_X86_64_32S 11 +#define R_X86_64_16 12 +#define R_X86_64_PC16 13 +#define R_X86_64_8 14 +#define R_X86_64_PC8 15 +#define R_X86_64_DTPMOD64 16 +#define R_X86_64_DTPOFF64 17 +#define R_X86_64_TPOFF64 18 +#define R_X86_64_TLSGD 19 + +#define R_X86_64_TLSLD 20 + +#define R_X86_64_DTPOFF32 21 +#define R_X86_64_GOTTPOFF 22 + +#define R_X86_64_TPOFF32 23 +#define R_X86_64_PC64 24 +#define R_X86_64_GOTOFF64 25 +#define R_X86_64_GOTPC32 26 +#define R_X86_64_GOT64 27 +#define R_X86_64_GOTPCREL64 28 +#define R_X86_64_GOTPC64 29 +#define R_X86_64_GOTPLT64 30 +#define R_X86_64_PLTOFF64 31 +#define R_X86_64_SIZE32 32 +#define R_X86_64_SIZE64 33 + +#define R_X86_64_GOTPC32_TLSDESC 34 +#define R_X86_64_TLSDESC_CALL 35 + +#define R_X86_64_TLSDESC 36 +#define R_X86_64_IRELATIVE 37 +#define R_X86_64_RELATIVE64 38 +#define R_X86_64_GOTPCRELX 41 +#define R_X86_64_REX_GOTPCRELX 42 +#define R_X86_64_NUM 43 + + + +#define R_MN10300_NONE 0 +#define R_MN10300_32 1 +#define R_MN10300_16 2 +#define R_MN10300_8 3 +#define R_MN10300_PCREL32 4 +#define R_MN10300_PCREL16 5 +#define R_MN10300_PCREL8 6 +#define R_MN10300_GNU_VTINHERIT 7 +#define R_MN10300_GNU_VTENTRY 8 +#define R_MN10300_24 9 +#define R_MN10300_GOTPC32 10 +#define R_MN10300_GOTPC16 11 +#define R_MN10300_GOTOFF32 12 +#define R_MN10300_GOTOFF24 13 +#define R_MN10300_GOTOFF16 14 +#define R_MN10300_PLT32 15 +#define R_MN10300_PLT16 16 +#define R_MN10300_GOT32 17 +#define R_MN10300_GOT24 18 +#define R_MN10300_GOT16 19 +#define R_MN10300_COPY 20 +#define R_MN10300_GLOB_DAT 21 +#define R_MN10300_JMP_SLOT 22 +#define R_MN10300_RELATIVE 23 + +#define R_MN10300_NUM 24 + + + +#define R_M32R_NONE 0 +#define R_M32R_16 1 +#define R_M32R_32 2 +#define R_M32R_24 3 +#define R_M32R_10_PCREL 4 +#define R_M32R_18_PCREL 5 +#define R_M32R_26_PCREL 6 +#define R_M32R_HI16_ULO 7 +#define R_M32R_HI16_SLO 8 +#define R_M32R_LO16 9 +#define R_M32R_SDA16 10 +#define R_M32R_GNU_VTINHERIT 11 +#define R_M32R_GNU_VTENTRY 12 + +#define R_M32R_16_RELA 33 +#define R_M32R_32_RELA 34 +#define R_M32R_24_RELA 35 +#define R_M32R_10_PCREL_RELA 36 +#define R_M32R_18_PCREL_RELA 37 +#define R_M32R_26_PCREL_RELA 38 +#define R_M32R_HI16_ULO_RELA 39 +#define R_M32R_HI16_SLO_RELA 40 +#define R_M32R_LO16_RELA 41 +#define R_M32R_SDA16_RELA 42 +#define R_M32R_RELA_GNU_VTINHERIT 43 +#define R_M32R_RELA_GNU_VTENTRY 44 +#define R_M32R_REL32 45 + +#define R_M32R_GOT24 48 +#define R_M32R_26_PLTREL 49 +#define R_M32R_COPY 50 +#define R_M32R_GLOB_DAT 51 +#define R_M32R_JMP_SLOT 52 +#define R_M32R_RELATIVE 53 +#define R_M32R_GOTOFF 54 +#define R_M32R_GOTPC24 55 +#define R_M32R_GOT16_HI_ULO 56 + +#define R_M32R_GOT16_HI_SLO 57 + +#define R_M32R_GOT16_LO 58 +#define R_M32R_GOTPC_HI_ULO 59 + +#define R_M32R_GOTPC_HI_SLO 60 + +#define R_M32R_GOTPC_LO 61 + +#define R_M32R_GOTOFF_HI_ULO 62 + +#define R_M32R_GOTOFF_HI_SLO 63 + +#define R_M32R_GOTOFF_LO 64 +#define R_M32R_NUM 256 + +#define R_MICROBLAZE_NONE 0 +#define R_MICROBLAZE_32 1 +#define R_MICROBLAZE_32_PCREL 2 +#define R_MICROBLAZE_64_PCREL 3 +#define R_MICROBLAZE_32_PCREL_LO 4 +#define R_MICROBLAZE_64 5 +#define R_MICROBLAZE_32_LO 6 +#define R_MICROBLAZE_SRO32 7 +#define R_MICROBLAZE_SRW32 8 +#define R_MICROBLAZE_64_NONE 9 +#define R_MICROBLAZE_32_SYM_OP_SYM 10 +#define R_MICROBLAZE_GNU_VTINHERIT 11 +#define R_MICROBLAZE_GNU_VTENTRY 12 +#define R_MICROBLAZE_GOTPC_64 13 +#define R_MICROBLAZE_GOT_64 14 +#define R_MICROBLAZE_PLT_64 15 +#define R_MICROBLAZE_REL 16 +#define R_MICROBLAZE_JUMP_SLOT 17 +#define R_MICROBLAZE_GLOB_DAT 18 +#define R_MICROBLAZE_GOTOFF_64 19 +#define R_MICROBLAZE_GOTOFF_32 20 +#define R_MICROBLAZE_COPY 21 +#define R_MICROBLAZE_TLS 22 +#define R_MICROBLAZE_TLSGD 23 +#define R_MICROBLAZE_TLSLD 24 +#define R_MICROBLAZE_TLSDTPMOD32 25 +#define R_MICROBLAZE_TLSDTPREL32 26 +#define R_MICROBLAZE_TLSDTPREL64 27 +#define R_MICROBLAZE_TLSGOTTPREL32 28 +#define R_MICROBLAZE_TLSTPREL32 29 + +#define DT_NIOS2_GP 0x70000002 + +#define R_NIOS2_NONE 0 +#define R_NIOS2_S16 1 +#define R_NIOS2_U16 2 +#define R_NIOS2_PCREL16 3 +#define R_NIOS2_CALL26 4 +#define R_NIOS2_IMM5 5 +#define R_NIOS2_CACHE_OPX 6 +#define R_NIOS2_IMM6 7 +#define R_NIOS2_IMM8 8 +#define R_NIOS2_HI16 9 +#define R_NIOS2_LO16 10 +#define R_NIOS2_HIADJ16 11 +#define R_NIOS2_BFD_RELOC_32 12 +#define R_NIOS2_BFD_RELOC_16 13 +#define R_NIOS2_BFD_RELOC_8 14 +#define R_NIOS2_GPREL 15 +#define R_NIOS2_GNU_VTINHERIT 16 +#define R_NIOS2_GNU_VTENTRY 17 +#define R_NIOS2_UJMP 18 +#define R_NIOS2_CJMP 19 +#define R_NIOS2_CALLR 20 +#define R_NIOS2_ALIGN 21 +#define R_NIOS2_GOT16 22 +#define R_NIOS2_CALL16 23 +#define R_NIOS2_GOTOFF_LO 24 +#define R_NIOS2_GOTOFF_HA 25 +#define R_NIOS2_PCREL_LO 26 +#define R_NIOS2_PCREL_HA 27 +#define R_NIOS2_TLS_GD16 28 +#define R_NIOS2_TLS_LDM16 29 +#define R_NIOS2_TLS_LDO16 30 +#define R_NIOS2_TLS_IE16 31 +#define R_NIOS2_TLS_LE16 32 +#define R_NIOS2_TLS_DTPMOD 33 +#define R_NIOS2_TLS_DTPREL 34 +#define R_NIOS2_TLS_TPREL 35 +#define R_NIOS2_COPY 36 +#define R_NIOS2_GLOB_DAT 37 +#define R_NIOS2_JUMP_SLOT 38 +#define R_NIOS2_RELATIVE 39 +#define R_NIOS2_GOTOFF 40 +#define R_NIOS2_CALL26_NOAT 41 +#define R_NIOS2_GOT_LO 42 +#define R_NIOS2_GOT_HA 43 +#define R_NIOS2_CALL_LO 44 +#define R_NIOS2_CALL_HA 45 + +#define R_OR1K_NONE 0 +#define R_OR1K_32 1 +#define R_OR1K_16 2 +#define R_OR1K_8 3 +#define R_OR1K_LO_16_IN_INSN 4 +#define R_OR1K_HI_16_IN_INSN 5 +#define R_OR1K_INSN_REL_26 6 +#define R_OR1K_GNU_VTENTRY 7 +#define R_OR1K_GNU_VTINHERIT 8 +#define R_OR1K_32_PCREL 9 +#define R_OR1K_16_PCREL 10 +#define R_OR1K_8_PCREL 11 +#define R_OR1K_GOTPC_HI16 12 +#define R_OR1K_GOTPC_LO16 13 +#define R_OR1K_GOT16 14 +#define R_OR1K_PLT26 15 +#define R_OR1K_GOTOFF_HI16 16 +#define R_OR1K_GOTOFF_LO16 17 +#define R_OR1K_COPY 18 +#define R_OR1K_GLOB_DAT 19 +#define R_OR1K_JMP_SLOT 20 +#define R_OR1K_RELATIVE 21 +#define R_OR1K_TLS_GD_HI16 22 +#define R_OR1K_TLS_GD_LO16 23 +#define R_OR1K_TLS_LDM_HI16 24 +#define R_OR1K_TLS_LDM_LO16 25 +#define R_OR1K_TLS_LDO_HI16 26 +#define R_OR1K_TLS_LDO_LO16 27 +#define R_OR1K_TLS_IE_HI16 28 +#define R_OR1K_TLS_IE_LO16 29 +#define R_OR1K_TLS_LE_HI16 30 +#define R_OR1K_TLS_LE_LO16 31 +#define R_OR1K_TLS_TPOFF 32 +#define R_OR1K_TLS_DTPOFF 33 +#define R_OR1K_TLS_DTPMOD 34 + +#define R_BPF_NONE 0 +#define R_BPF_MAP_FD 1 + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/tools/fix_elf/patch.cpp b/tools/fix_elf/patch.cpp index d49ebab307d..42df174ed8f 100644 --- a/tools/fix_elf/patch.cpp +++ b/tools/fix_elf/patch.cpp @@ -10,8 +10,8 @@ namespace NElf { -bool IsElf(const TString& path) { - TUnbufferedFileInput in(path); +bool IsElf(const TString& path) { + TUnbufferedFileInput in(path); char buffer[EI_NIDENT]; size_t nread = in.Load(buffer, sizeof(buffer)); @@ -82,8 +82,8 @@ int NumericStrCmp(TStringBuf s1, TStringBuf s2) { } } - s1.Skip(1); - s2.Skip(1); + s1.Skip(1); + s2.Skip(1); } return 0; @@ -121,7 +121,7 @@ void Patch(const TString& path, const TString& library, IOutputStream& verboseOu TStringBuf skipFrom("GLIBC_2.14"); TStringBuf patchFrom("GLIBC_2.2.5"); - TVector<Elf64_Vernaux*> patchAux; + TVector<Elf64_Vernaux*> patchAux; Elf64_Vernaux* patchFromAux = nullptr; @@ -235,7 +235,7 @@ int main(int argc, char* argv[]) { opts.SetFreeArgTitle(0, "<file>", "File"); TOptsParseResult res(&opts, argc, argv); - TVector<TString> files = res.GetFreeArgs(); + TVector<TString> files = res.GetFreeArgs(); IOutputStream& verboseOut = verbose ? Cout : Cnull; diff --git a/tools/fix_elf/patch.h b/tools/fix_elf/patch.h index c3dcd242249..58cf229910a 100644 --- a/tools/fix_elf/patch.h +++ b/tools/fix_elf/patch.h @@ -2,7 +2,7 @@ #include "elf.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/file.h> #include <util/system/filemap.h> @@ -13,11 +13,11 @@ inline TTo Offset(TFrom from, size_t off) { return reinterpret_cast<TTo>(reinterpret_cast<char*>(from) + off); } -bool IsElf(const TString& path); +bool IsElf(const TString& path); class TElf { public: - TElf(const TString& path) + TElf(const TString& path) : Map(path, TFileMap::oRdWr) { Map.Map(0, Map.Length()); diff --git a/tools/rorescompiler/main.cpp b/tools/rorescompiler/main.cpp index 7ca5346e4c8..1cb03afa453 100644 --- a/tools/rorescompiler/main.cpp +++ b/tools/rorescompiler/main.cpp @@ -26,7 +26,7 @@ int main(int argc, char** argv) { return 1; } - TFixedBufferFileOutput out(argv[1]); + TFixedBufferFileOutput out(argv[1]); argv = argv + 2; out << "#include <library/cpp/resource/registry.h>\n\n"; diff --git a/util/charset/benchmark/utf8_to_wide/main.cpp b/util/charset/benchmark/utf8_to_wide/main.cpp index 09fa567fe55..da4782c3bd8 100644 --- a/util/charset/benchmark/utf8_to_wide/main.cpp +++ b/util/charset/benchmark/utf8_to_wide/main.cpp @@ -10,7 +10,7 @@ namespace { template <size_t N> - struct TRandomAsciiString: public TVector<char> { + struct TRandomAsciiString: public TVector<char> { inline TRandomAsciiString() { reserve(N); for (size_t i = 0; i < N; ++i) { @@ -20,9 +20,9 @@ namespace { }; template <size_t N> - struct TRandomRuString: public TVector<char> { + struct TRandomRuString: public TVector<char> { inline TRandomRuString() { - TVector<unsigned char> data(N * 2); + TVector<unsigned char> data(N * 2); unsigned char* textEnd = data.begin(); for (size_t i = 0; i < N; ++i) { size_t runeLen; diff --git a/util/charset/utf8.cpp b/util/charset/utf8.cpp index efe3a52f615..33eb298185d 100644 --- a/util/charset/utf8.cpp +++ b/util/charset/utf8.cpp @@ -129,23 +129,23 @@ EUTF8Detect UTF8Detect(const char* s, size_t len) { return res; } -bool ToLowerUTF8Impl(const char* beg, size_t n, TString& newString) { +bool ToLowerUTF8Impl(const char* beg, size_t n, TString& newString) { return ConvertCaseUTF8Impl(ECaseConversion::ToLower, beg, n, newString); } -TString ToLowerUTF8(const TString& s) { - TString newString; +TString ToLowerUTF8(const TString& s) { + TString newString; bool changed = ToLowerUTF8Impl(s.data(), s.size(), newString); return changed ? newString : s; } -TString ToLowerUTF8(TStringBuf s) { - TString newString; +TString ToLowerUTF8(TStringBuf s) { + TString newString; bool changed = ToLowerUTF8Impl(s.data(), s.size(), newString); return changed ? newString : TString(s.data(), s.size()); } -TString ToLowerUTF8(const char* s) { +TString ToLowerUTF8(const char* s) { return ToLowerUTF8(TStringBuf(s)); } diff --git a/util/charset/utf8.h b/util/charset/utf8.h index 5039b46ae9b..1997f73771c 100644 --- a/util/charset/utf8.h +++ b/util/charset/utf8.h @@ -3,7 +3,7 @@ #include "recode_result.h" #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/system/defaults.h> #include <util/system/yassert.h> @@ -134,7 +134,7 @@ inline bool GetNumberOfUTF8Chars(const char* text, size_t len, size_t& number) { inline size_t GetNumberOfUTF8Chars(TStringBuf text) { size_t number; if (!GetNumberOfUTF8Chars(text.data(), text.size(), number)) { - ythrow yexception() << "GetNumberOfUTF8Chars failed on invalid utf-8 " << TString(text.substr(0, 50)).Quote(); + ythrow yexception() << "GetNumberOfUTF8Chars failed on invalid utf-8 " << TString(text.substr(0, 50)).Quote(); } return number; } @@ -369,11 +369,11 @@ inline bool IsUtf(const TStringBuf input) { //! returns true, if result is not the same as input, and put it in newString //! returns false, if result is unmodified -bool ToLowerUTF8Impl(const char* beg, size_t n, TString& newString); +bool ToLowerUTF8Impl(const char* beg, size_t n, TString& newString); -TString ToLowerUTF8(const TString& s); -TString ToLowerUTF8(TStringBuf s); -TString ToLowerUTF8(const char* s); +TString ToLowerUTF8(const TString& s); +TString ToLowerUTF8(TStringBuf s); +TString ToLowerUTF8(const char* s); inline TString ToLowerUTF8(const std::string& s) { return ToLowerUTF8(TStringBuf(s)); diff --git a/util/charset/utf8_ut.cpp b/util/charset/utf8_ut.cpp index 9e68881cca2..fc379ff6949 100644 --- a/util/charset/utf8_ut.cpp +++ b/util/charset/utf8_ut.cpp @@ -17,37 +17,37 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) { UNIT_ASSERT_VALUES_EQUAL(ToLowerUTF8(TStringBuf("xyz")), "xyz"); - { - TString s = "привет!"; - TString q = "ПРИВЕТ!"; - TString tmp; + { + TString s = "привет!"; + TString q = "ПРИВЕТ!"; + TString tmp; UNIT_ASSERT(ToLowerUTF8Impl(s.data(), s.size(), tmp) == false); UNIT_ASSERT(ToLowerUTF8Impl(q.data(), q.size(), tmp) == true); - } - - { - const char* weird = "\xC8\xBE"; // 'Ⱦ', U+023E. strlen(weird)==2, strlen(tolower_utf8(weird)) is 3 - const char* turkI = "İ"; //strlen("İ") == 2, strlen(tolower_utf8("İ") == 1 - TStringBuf chars[] = {"f", "F", "Б", "б", weird, turkI}; - const int N = Y_ARRAY_SIZE(chars); - //try all combinations of these letters. - int numberOfVariants = 1; - for (int len = 0; len <= 4; ++len) { - for (int i = 0; i < numberOfVariants; ++i) { - TString s; - int k = i; - for (int j = 0; j < len; ++j) { - //Treat 'i' like number in base-N system with digits from 'chars'-array - s += chars[k % N]; - k /= N; - } - - TUtf16String tmp = UTF8ToWide(s); - tmp.to_lower(); - - UNIT_ASSERT_VALUES_EQUAL(ToLowerUTF8(s), WideToUTF8(tmp)); - } - numberOfVariants *= N; + } + + { + const char* weird = "\xC8\xBE"; // 'Ⱦ', U+023E. strlen(weird)==2, strlen(tolower_utf8(weird)) is 3 + const char* turkI = "İ"; //strlen("İ") == 2, strlen(tolower_utf8("İ") == 1 + TStringBuf chars[] = {"f", "F", "Б", "б", weird, turkI}; + const int N = Y_ARRAY_SIZE(chars); + //try all combinations of these letters. + int numberOfVariants = 1; + for (int len = 0; len <= 4; ++len) { + for (int i = 0; i < numberOfVariants; ++i) { + TString s; + int k = i; + for (int j = 0; j < len; ++j) { + //Treat 'i' like number in base-N system with digits from 'chars'-array + s += chars[k % N]; + k /= N; + } + + TUtf16String tmp = UTF8ToWide(s); + tmp.to_lower(); + + UNIT_ASSERT_VALUES_EQUAL(ToLowerUTF8(s), WideToUTF8(tmp)); + } + numberOfVariants *= N; } } } @@ -95,12 +95,12 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) { Y_UNIT_TEST(TestUTF8ToWide) { TFileInput in(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/test1.txt")); - TString text = in.ReadAll(); + TString text = in.ReadAll(); UNIT_ASSERT(WideToUTF8(UTF8ToWide(text)) == text); } Y_UNIT_TEST(TestInvalidUTF8) { - TVector<TString> testData; + TVector<TString> testData; TFileInput input(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/invalid_UTF8.bin")); Load(&input, testData); @@ -112,9 +112,9 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) { Y_UNIT_TEST(TestUTF8ToWideScalar) { TFileInput in(ArcadiaSourceRoot() + TStringBuf("/util/charset/ut/utf8/test1.txt")); - TString text = in.ReadAll(); - TUtf16String wtextSSE = UTF8ToWide(text); - TUtf16String wtextScalar = TUtf16String::Uninitialized(text.size()); + TString text = in.ReadAll(); + TUtf16String wtextSSE = UTF8ToWide(text); + TUtf16String wtextScalar = TUtf16String::Uninitialized(text.size()); const unsigned char* textBegin = reinterpret_cast<const unsigned char*>(text.c_str()); wchar16* wtextBegin = wtextScalar.begin(); ::NDetail::UTF8ToWideImplScalar<false>(textBegin, textBegin + text.size(), wtextBegin); diff --git a/util/charset/wide.cpp b/util/charset/wide.cpp index a287438ddde..49badb7f14d 100644 --- a/util/charset/wide.cpp +++ b/util/charset/wide.cpp @@ -31,7 +31,7 @@ namespace { } } -void Collapse(TUtf16String& w) { +void Collapse(TUtf16String& w) { CollapseImpl(w, w, 0, IsWhitespace); } @@ -532,20 +532,20 @@ static TUtf32String ToSmthRet(const TUtf32StringBuf text, size_t pos, size_t cou } TUtf16String ToLowerRet(const TWtringBuf text, size_t pos, size_t count) { - return ToSmthRet(text, pos, count, [](const wchar16* theText, size_t length, wchar16* out) { - ToLower(theText, length, out); + return ToSmthRet(text, pos, count, [](const wchar16* theText, size_t length, wchar16* out) { + ToLower(theText, length, out); }); } TUtf16String ToUpperRet(const TWtringBuf text, size_t pos, size_t count) { - return ToSmthRet(text, pos, count, [](const wchar16* theText, size_t length, wchar16* out) { - ToUpper(theText, length, out); + return ToSmthRet(text, pos, count, [](const wchar16* theText, size_t length, wchar16* out) { + ToUpper(theText, length, out); }); } TUtf16String ToTitleRet(const TWtringBuf text, size_t pos, size_t count) { - return ToSmthRet(text, pos, count, [](const wchar16* theText, size_t length, wchar16* out) { - ToTitle(theText, length, out); + return ToSmthRet(text, pos, count, [](const wchar16* theText, size_t length, wchar16* out) { + ToTitle(theText, length, out); }); } @@ -568,16 +568,16 @@ TUtf32String ToTitleRet(const TUtf32StringBuf text, size_t pos, size_t count) { } template <bool insertBr> -void EscapeHtmlChars(TUtf16String& str) { - static const TUtf16String lt(LT, Y_ARRAY_SIZE(LT)); - static const TUtf16String gt(GT, Y_ARRAY_SIZE(GT)); - static const TUtf16String amp(AMP, Y_ARRAY_SIZE(AMP)); - static const TUtf16String br(BR, Y_ARRAY_SIZE(BR)); - static const TUtf16String quot(QUOT, Y_ARRAY_SIZE(QUOT)); +void EscapeHtmlChars(TUtf16String& str) { + static const TUtf16String lt(LT, Y_ARRAY_SIZE(LT)); + static const TUtf16String gt(GT, Y_ARRAY_SIZE(GT)); + static const TUtf16String amp(AMP, Y_ARRAY_SIZE(AMP)); + static const TUtf16String br(BR, Y_ARRAY_SIZE(BR)); + static const TUtf16String quot(QUOT, Y_ARRAY_SIZE(QUOT)); size_t escapedLen = 0; - const TUtf16String& cs = str; + const TUtf16String& cs = str; for (size_t i = 0; i < cs.size(); ++i) escapedLen += EscapedLen<insertBr>(cs[i]); @@ -585,13 +585,13 @@ void EscapeHtmlChars(TUtf16String& str) { if (escapedLen == cs.size()) return; - TUtf16String res; + TUtf16String res; res.reserve(escapedLen); size_t start = 0; for (size_t i = 0; i < cs.size(); ++i) { - const TUtf16String* ent = nullptr; + const TUtf16String* ent = nullptr; switch (cs[i]) { case '<': ent = < @@ -622,5 +622,5 @@ void EscapeHtmlChars(TUtf16String& str) { res.swap(str); } -template void EscapeHtmlChars<false>(TUtf16String& str); -template void EscapeHtmlChars<true>(TUtf16String& str); +template void EscapeHtmlChars<false>(TUtf16String& str); +template void EscapeHtmlChars<true>(TUtf16String& str); diff --git a/util/charset/wide.h b/util/charset/wide.h index 04e6928aab3..22f922df5a7 100644 --- a/util/charset/wide.h +++ b/util/charset/wide.h @@ -6,7 +6,7 @@ #include "wide_specific.h" #include <util/generic/algorithm.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/memory/tempbuf.h> #include <util/system/compiler.h> @@ -24,8 +24,8 @@ class TTempArray; using TCharTemp = TTempArray<wchar16>; namespace NDetail { - inline TString InStringMsg(const char* s, size_t len) { - return (len <= 50) ? " in string " + TString(s, len).Quote() : TString(); + inline TString InStringMsg(const char* s, size_t len) { + return (len <= 50) ? " in string " + TString(s, len).Quote() : TString(); } template <bool isPointer> @@ -321,8 +321,8 @@ inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size } template <bool robust> -inline TUtf16String UTF8ToWide(const char* text, size_t len) { - TUtf16String w = TUtf16String::Uninitialized(len); +inline TUtf16String UTF8ToWide(const char* text, size_t len) { + TUtf16String w = TUtf16String::Uninitialized(len); size_t written; size_t pos = UTF8ToWideImpl<robust>(text, len, w.begin(), written); if (pos != len) @@ -347,7 +347,7 @@ inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& wr } template <bool robust> -inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) { +inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) { dst.ReserveAndResize(src.size()); size_t written = 0; UTF8ToWideImpl<robust>(src.data(), src.size(), dst.begin(), written); @@ -365,16 +365,16 @@ inline TUtf32StringBuf UTF8ToUTF32(const TStringBuf src, TUtf32String& dst) { return dst; } -inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) { +inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) { return UTF8ToWide<false>(src, dst); } -inline TUtf16String UTF8ToWide(const char* text, size_t len) { +inline TUtf16String UTF8ToWide(const char* text, size_t len) { return UTF8ToWide<false>(text, len); } template <bool robust> -inline TUtf16String UTF8ToWide(const TStringBuf s) { +inline TUtf16String UTF8ToWide(const TStringBuf s) { return UTF8ToWide<robust>(s.data(), s.size()); } @@ -385,7 +385,7 @@ inline TUtf32String UTF8ToUTF32(const TStringBuf s) { return r; } -inline TUtf16String UTF8ToWide(const TStringBuf s) { +inline TUtf16String UTF8ToWide(const TStringBuf s) { return UTF8ToWide<false>(s.data(), s.size()); } @@ -410,7 +410,7 @@ constexpr size_t WideToUTF8BufferSize(const size_t inputStringSize) noexcept { return inputStringSize * 4; // * 4 because the conversion functions can convert unicode character into maximum 4 bytes of UTF8 } -inline TStringBuf WideToUTF8(const TWtringBuf src, TString& dst) { +inline TStringBuf WideToUTF8(const TWtringBuf src, TString& dst) { dst.ReserveAndResize(WideToUTF8BufferSize(src.size())); size_t written = 0; WideToUTF8(src.data(), src.size(), dst.begin(), written); @@ -419,8 +419,8 @@ inline TStringBuf WideToUTF8(const TWtringBuf src, TString& dst) { return dst; } -inline TString WideToUTF8(const wchar16* text, size_t len) { - TString s = TString::Uninitialized(WideToUTF8BufferSize(len)); +inline TString WideToUTF8(const wchar16* text, size_t len) { + TString s = TString::Uninitialized(WideToUTF8BufferSize(len)); size_t written = 0; WideToUTF8(text, len, s.begin(), written); Y_ASSERT(s.size() >= written); @@ -437,7 +437,7 @@ inline TString WideToUTF8(const wchar32* text, size_t len) { return s; } -inline TString WideToUTF8(const TWtringBuf w) { +inline TString WideToUTF8(const TWtringBuf w) { return WideToUTF8(w.data(), w.size()); } @@ -445,8 +445,8 @@ inline TString WideToUTF8(const TUtf32StringBuf w) { return WideToUTF8(w.data(), w.size()); } -inline TUtf16String UTF32ToWide(const wchar32* begin, size_t len) { - TUtf16String res; +inline TUtf16String UTF32ToWide(const wchar32* begin, size_t len) { + TUtf16String res; res.reserve(len); const wchar32* end = begin + len; @@ -628,29 +628,29 @@ inline void Copy(const TChar1* first, size_t len, TChar2* result) { //! template <typename InputIterator> //! basic_string(InputIterator begin, InputIterator end, const Allocator& a = Allocator()); //! and the family of template member functions: append, assign, insert, replace. -template <typename TStringType, typename TChar> -inline TStringType CopyTo(const TChar* first, const TChar* last) { +template <typename TStringType, typename TChar> +inline TStringType CopyTo(const TChar* first, const TChar* last) { Y_ASSERT(first <= last); - TStringType str = TStringType::Uninitialized(last - first); + TStringType str = TStringType::Uninitialized(last - first); Copy(first, last, str.begin()); return str; } -template <typename TStringType, typename TChar> -inline TStringType CopyTo(const TChar* s, size_t n) { - TStringType str = TStringType::Uninitialized(n); +template <typename TStringType, typename TChar> +inline TStringType CopyTo(const TChar* s, size_t n) { + TStringType str = TStringType::Uninitialized(n); Copy(s, n, str.begin()); return str; } -inline TString WideToASCII(const TWtringBuf w) { +inline TString WideToASCII(const TWtringBuf w) { Y_ASSERT(IsStringASCII(w.begin(), w.end())); - return CopyTo<TString>(w.begin(), w.end()); + return CopyTo<TString>(w.begin(), w.end()); } -inline TUtf16String ASCIIToWide(const TStringBuf s) { +inline TUtf16String ASCIIToWide(const TStringBuf s) { Y_ASSERT(IsStringASCII(s.begin(), s.end())); - return CopyTo<TUtf16String>(s.begin(), s.end()); + return CopyTo<TUtf16String>(s.begin(), s.end()); } inline TUtf32String ASCIIToUTF32(const TStringBuf s) { @@ -679,7 +679,7 @@ inline bool IsSpace(const TWtringBuf s) { } //! replaces multiple sequential whitespace characters with a single space character -void Collapse(TUtf16String& w); +void Collapse(TUtf16String& w); //! @return new length size_t Collapse(wchar16* s, size_t n); @@ -810,7 +810,7 @@ TUtf32String ToTitleRet(const TUtf32StringBuf text, size_t pos = 0, size_t count //! replaces the '<', '>' and '&' characters in string with '<', '>' and '&' respectively // insertBr=true - replace '\r' and '\n' with "<BR>" template <bool insertBr> -void EscapeHtmlChars(TUtf16String& str); +void EscapeHtmlChars(TUtf16String& str); //! returns number of characters in range. Handle surrogate pairs as one character. inline size_t CountWideChars(const wchar16* b, const wchar16* e) { diff --git a/util/charset/wide_ut.cpp b/util/charset/wide_ut.cpp index d8f3233e732..9eecf20ae00 100644 --- a/util/charset/wide_ut.cpp +++ b/util/charset/wide_ut.cpp @@ -53,7 +53,7 @@ namespace { {0x01C5, 0x10428, 0x10429, 0x10447, 0x10441, 0x1C03, 0x00A0, 0x10428, 0x1043D, 0x10437}, // title }; - TUtf16String CreateUnicodeText() { + TUtf16String CreateUnicodeText() { const int len = 256; wchar16 text[len] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x00 - 0x0F @@ -77,10 +77,10 @@ namespace { text[i] = static_cast<wchar16>(i + 0x0350); // 0x0410 - 0x044F } } - return TUtf16String(text, len); + return TUtf16String(text, len); } - TString CreateUTF8Text() { + TString CreateUTF8Text() { char text[] = { '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', @@ -107,12 +107,12 @@ namespace { '\xd0', '\xbf', '\xd1', '\x80', '\xd1', '\x81', '\xd1', '\x82', '\xd1', '\x83', '\xd1', '\x84', '\xd1', '\x85', '\xd1', '\x86', '\xd1', '\x87', '\xd1', '\x88', '\xd1', '\x89', '\xd1', '\x8a', '\xd1', '\x8b', '\xd1', '\x8c', '\xd1', '\x8d', '\xd1', '\x8e', '\xd1', '\x8f'}; - return TString(text, Y_ARRAY_SIZE(text)); + return TString(text, Y_ARRAY_SIZE(text)); } //! use this function to dump UTF8 text into a file in case of any changes // void DumpUTF8Text() { - // TString s = WideToUTF8(UnicodeText); + // TString s = WideToUTF8(UnicodeText); // std::ofstream f("utf8.txt"); // f << std::hex; // for (int i = 0; i < (int)s.size(); ++i) { @@ -455,12 +455,12 @@ void TConversionTest::TestWriteUTF8Char() { } static void TestSurrogates(const char* str, const wchar16* wide, size_t wideSize) { - TUtf16String w = UTF8ToWide(str); + TUtf16String w = UTF8ToWide(str); UNIT_ASSERT(w.size() == wideSize); UNIT_ASSERT(!memcmp(w.c_str(), wide, wideSize)); - TString s = WideToUTF8(w); + TString s = WideToUTF8(w); UNIT_ASSERT(s == str); } @@ -511,7 +511,7 @@ void TConversionTest::TestUTF8ToWide() { UNIT_ASSERT_VALUES_EQUAL(WideToUTF8(UTF8ToWide(WideToUTF8(UTF8ToWide<true>( "m\xFB\xB2\xA5\xAA\xAFyeuse.sexwebcamz.com")))), - TString( + TString( "m\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBDyeuse.sexwebcamz.com")); } @@ -571,7 +571,7 @@ void TConversionTest::TestUnicodeCase() { } void TConversionTest::TestUnicodeDetails() { - TUtf16String temp; + TUtf16String temp; for (wchar32 i = 0; i != NUnicode::UnicodeInstancesLimit(); ++i) { temp.clear(); WriteSymbol(i, temp); @@ -604,12 +604,12 @@ class TWideUtilTest: public TTestBase { public: void TestCollapse() { - TUtf16String s; + TUtf16String s; s.append(ws, Y_ARRAY_SIZE(ws)).append(3, 'a').append(ws, Y_ARRAY_SIZE(ws)).append(3, 'b').append(ws, Y_ARRAY_SIZE(ws)); Collapse(s); UNIT_ASSERT(s == ASCIIToWide(" aaa bbb ")); { - const TUtf16String w(ASCIIToWide(" a b c ")); + const TUtf16String w(ASCIIToWide(" a b c ")); s = w; Collapse(s); UNIT_ASSERT(s == w); @@ -637,7 +637,7 @@ public: Collapse(s); UNIT_ASSERT(s == ASCIIToWide("1 23 ")); { - const TUtf16String w = ASCIIToWide(" "); + const TUtf16String w = ASCIIToWide(" "); s = w; Collapse(s); UNIT_ASSERT(s == w); @@ -659,11 +659,11 @@ public: s.clear(); Collapse(s); - UNIT_ASSERT(s == TUtf16String()); + UNIT_ASSERT(s == TUtf16String()); } void TestCollapseBuffer() { - TUtf16String s; + TUtf16String s; s.append(ws, Y_ARRAY_SIZE(ws)).append(3, 'a').append(ws, Y_ARRAY_SIZE(ws)).append(3, 'b').append(ws, Y_ARRAY_SIZE(ws)); size_t n = Collapse(s.begin(), s.size()); s.resize(n); @@ -727,14 +727,14 @@ public: s.clear(); n = Collapse(s.begin(), s.size()); UNIT_ASSERT(n == 0); - UNIT_ASSERT(s == TUtf16String()); + UNIT_ASSERT(s == TUtf16String()); } void TestStrip() { - TUtf16String s; + TUtf16String s; Strip(s); - UNIT_ASSERT(s == TUtf16String()); + UNIT_ASSERT(s == TUtf16String()); StripLeft(s); UNIT_ASSERT(s == TUtf16String()); StripRight(s); @@ -742,7 +742,7 @@ public: s = ASCIIToWide(" \t\r\n"); Strip(s); - UNIT_ASSERT(s == TUtf16String()); + UNIT_ASSERT(s == TUtf16String()); s = ASCIIToWide(" \t\r\n"); StripLeft(s); UNIT_ASSERT(s == TUtf16String()); @@ -770,7 +770,7 @@ public: StripRight(s); UNIT_ASSERT(s == ASCIIToWide("\r\na\r\nb\t\tc")); - const TUtf16String w(ASCIIToWide("a b")); + const TUtf16String w(ASCIIToWide("a b")); s = w; Strip(s); UNIT_ASSERT(s == w); @@ -792,25 +792,25 @@ public: } void TestIsSpace() { - UNIT_ASSERT(!IsSpace(TUtf16String())); + UNIT_ASSERT(!IsSpace(TUtf16String())); UNIT_ASSERT(IsSpace(ws, Y_ARRAY_SIZE(ws))); - TUtf16String w; - w.assign(ws, Y_ARRAY_SIZE(ws)).append(TUtf16String(1, '!')); + TUtf16String w; + w.assign(ws, Y_ARRAY_SIZE(ws)).append(TUtf16String(1, '!')); UNIT_ASSERT(!IsSpace(w.c_str(), w.size())); - w.assign(TUtf16String(1, '_')).append(ws, Y_ARRAY_SIZE(ws)); + w.assign(TUtf16String(1, '_')).append(ws, Y_ARRAY_SIZE(ws)); UNIT_ASSERT(!IsSpace(w.c_str(), w.size())); - w.assign(ws, Y_ARRAY_SIZE(ws)).append(TUtf16String(1, '$')).append(ws, Y_ARRAY_SIZE(ws)); + w.assign(ws, Y_ARRAY_SIZE(ws)).append(TUtf16String(1, '$')).append(ws, Y_ARRAY_SIZE(ws)); UNIT_ASSERT(!IsSpace(w.c_str(), w.size())); } void TestEscapeHtmlChars() { // characters from the first half of the ASCII table for (wchar16 c = 1; c < 0x7F; ++c) { - TUtf16String w(1, c); + TUtf16String w(1, c); EscapeHtmlChars<false>(w); switch (c) { @@ -827,13 +827,13 @@ public: UNIT_ASSERT(w == ASCIIToWide(""")); break; default: - UNIT_ASSERT(w == TUtf16String(1, c)); + UNIT_ASSERT(w == TUtf16String(1, c)); break; } } for (wchar16 c = 1; c < 0x7F; ++c) { - TUtf16String w(1, c); + TUtf16String w(1, c); EscapeHtmlChars<true>(w); switch (c) { @@ -854,7 +854,7 @@ public: UNIT_ASSERT(w == ASCIIToWide("<BR>")); break; default: - UNIT_ASSERT(w == TUtf16String(1, c)); + UNIT_ASSERT(w == TUtf16String(1, c)); break; } } @@ -877,11 +877,11 @@ public: } void TestWideString() { - const TUtf16String original = UTF32ToWide(WideStringTestData[0], CaseTestDataSize); - const TUtf16String lower = UTF32ToWide(WideStringTestData[1], CaseTestDataSize); - const TUtf16String upper = UTF32ToWide(WideStringTestData[2], CaseTestDataSize); - const TUtf16String title = UTF32ToWide(WideStringTestData[3], CaseTestDataSize); - TUtf16String temp; + const TUtf16String original = UTF32ToWide(WideStringTestData[0], CaseTestDataSize); + const TUtf16String lower = UTF32ToWide(WideStringTestData[1], CaseTestDataSize); + const TUtf16String upper = UTF32ToWide(WideStringTestData[2], CaseTestDataSize); + const TUtf16String title = UTF32ToWide(WideStringTestData[3], CaseTestDataSize); + TUtf16String temp; temp = original; temp.to_lower(); @@ -907,7 +907,7 @@ public: ToTitle(temp.begin(), temp.size()); UNIT_ASSERT(temp == title); - TVector<wchar32> buffer(WideStringTestData[0], WideStringTestData[0] + CaseTestDataSize); + TVector<wchar32> buffer(WideStringTestData[0], WideStringTestData[0] + CaseTestDataSize); std::reverse(buffer.begin(), buffer.end()); const TUtf16String reversed = UTF32ToWide(buffer.data(), buffer.size()); @@ -918,7 +918,7 @@ public: void TestCountWideChars() { UNIT_ASSERT_EQUAL(CountWideChars(UTF8ToWide("привет!")), 7); - TUtf16String wideStr = UTF8ToWide("\xf0\x9f\x92\xb8привет!"); + TUtf16String wideStr = UTF8ToWide("\xf0\x9f\x92\xb8привет!"); UNIT_ASSERT_EQUAL(wideStr.size(), 9); UNIT_ASSERT_EQUAL(CountWideChars(wideStr), 8); } diff --git a/util/datetime/base.cpp b/util/datetime/base.cpp index 38ecc3ab962..f0df9b1b400 100644 --- a/util/datetime/base.cpp +++ b/util/datetime/base.cpp @@ -5,17 +5,17 @@ #include <util/stream/mem.h> #include <util/system/compat.h> #include <util/memory/tempbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/yexception.h> -TString Strftime(const char* format, const struct tm* tm) { +TString Strftime(const char* format, const struct tm* tm) { size_t size = Max<size_t>(strlen(format) * 2 + 1, 107); for (;;) { TTempBuf buf(size); int r = strftime(buf.Data(), buf.Size(), format, tm); if (r != 0) { - return TString(buf.Data(), r); + return TString(buf.Data(), r); } size *= 2; } @@ -173,11 +173,11 @@ void Out<::NPrivate::TPrintableLocalTime<true, true>>(IOutputStream& os, TTypeTr WritePrintableLocalTimeToStream(os, localTime); } -TString TDuration::ToString() const { +TString TDuration::ToString() const { return ::ToString(*this); } -TString TInstant::ToString() const { +TString TInstant::ToString() const { return ::ToString(*this); } @@ -185,20 +185,20 @@ TString TInstant::ToRfc822String() const { return FormatGmTime("%a, %d %b %Y %H:%M:%S GMT"); } -TString TInstant::ToStringUpToSeconds() const { +TString TInstant::ToStringUpToSeconds() const { char buf[64]; auto len = FormatDate8601(buf, sizeof(buf), TimeT()); if (!len) { ythrow yexception() << "TInstant::ToStringUpToSeconds: year does not fit into an integer"; } - return TString(buf, len); + return TString(buf, len); } TString TInstant::ToIsoStringLocal() const { return ::ToString(FormatIsoLocal(*this)); } -TString TInstant::ToStringLocal() const { +TString TInstant::ToStringLocal() const { return ::ToString(FormatLocal(*this)); } @@ -210,7 +210,7 @@ TString TInstant::ToIsoStringLocalUpToSeconds() const { return ::ToString(FormatIsoLocalUpToSeconds(*this)); } -TString TInstant::ToStringLocalUpToSeconds() const { +TString TInstant::ToStringLocalUpToSeconds() const { return ::ToString(FormatLocalUpToSeconds(*this)); } diff --git a/util/datetime/base.h b/util/datetime/base.h index 5e902b8f633..b64b9de7116 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -5,7 +5,7 @@ #include <util/str_stl.h> #include <util/system/platform.h> #include <util/system/datetime.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/ylimits.h> #include <util/generic/utility.h> @@ -36,7 +36,7 @@ class TInstant; class TDuration; /// Current time -static inline TInstant Now() noexcept; +static inline TInstant Now() noexcept; /// Use Now() method to obtain current time instead of *Seconds() unless you understand what are you doing. @@ -82,7 +82,7 @@ constexpr long TVdiff(timeval r1, timeval r2) { return (1000000 * (r2.tv_sec - r1.tv_sec) + (r2.tv_usec - r1.tv_usec)); } -TString Strftime(const char* format, const struct tm* tm); +TString Strftime(const char* format, const struct tm* tm); // Use functions below instead of sprint_date (check IGNIETFERRO-892 for details) void DateToString(char* buf, const struct tm& theTm); @@ -98,28 +98,28 @@ class TTimeBase { public: using TValue = ui64; -protected: - constexpr TTimeBase(const TValue& value) noexcept +protected: + constexpr TTimeBase(const TValue& value) noexcept : Value_(value) { } -public: - constexpr TTimeBase() noexcept - : Value_(0) - { - } - - constexpr TTimeBase(const struct timeval& tv) noexcept +public: + constexpr TTimeBase() noexcept + : Value_(0) + { + } + + constexpr TTimeBase(const struct timeval& tv) noexcept : Value_(tv.tv_sec * (ui64)1000000 + tv.tv_usec) { } - constexpr TValue GetValue() const noexcept { + constexpr TValue GetValue() const noexcept { return Value_; } - constexpr double SecondsFloat() const noexcept { + constexpr double SecondsFloat() const noexcept { return Value_ * (1 / 1000000.0); } @@ -127,43 +127,43 @@ public: return Value_ * (1 / 1000.0); } - constexpr TValue MicroSeconds() const noexcept { + constexpr TValue MicroSeconds() const noexcept { return Value_; } - constexpr TValue MilliSeconds() const noexcept { + constexpr TValue MilliSeconds() const noexcept { return MicroSeconds() / 1000; } - constexpr TValue Seconds() const noexcept { + constexpr TValue Seconds() const noexcept { return MilliSeconds() / 1000; } - constexpr TValue Minutes() const noexcept { + constexpr TValue Minutes() const noexcept { return Seconds() / 60; } - constexpr TValue Hours() const noexcept { + constexpr TValue Hours() const noexcept { return Minutes() / 60; } - constexpr TValue Days() const noexcept { + constexpr TValue Days() const noexcept { return Hours() / 24; } - constexpr TValue NanoSeconds() const noexcept { + constexpr TValue NanoSeconds() const noexcept { return MicroSeconds() >= (Max<TValue>() / (TValue)1000) ? Max<TValue>() : MicroSeconds() * (TValue)1000; } - constexpr ui32 MicroSecondsOfSecond() const noexcept { + constexpr ui32 MicroSecondsOfSecond() const noexcept { return MicroSeconds() % (TValue)1000000; } - constexpr ui32 MilliSecondsOfSecond() const noexcept { + constexpr ui32 MilliSecondsOfSecond() const noexcept { return MicroSecondsOfSecond() / (TValue)1000; } - constexpr ui32 NanoSecondsOfSecond() const noexcept { + constexpr ui32 NanoSecondsOfSecond() const noexcept { return MicroSecondsOfSecond() * (TValue)1000; } @@ -195,20 +195,20 @@ namespace NDateTimeHelpers { class TDuration: public TTimeBase<TDuration> { using TBase = TTimeBase<TDuration>; -private: - /** - * private construct from microseconds - */ - constexpr explicit TDuration(TValue value) noexcept +private: + /** + * private construct from microseconds + */ + constexpr explicit TDuration(TValue value) noexcept : TBase(value) { } -public: - constexpr TDuration() noexcept { - } - - constexpr TDuration(const struct timeval& tv) noexcept +public: + constexpr TDuration() noexcept { + } + + constexpr TDuration(const struct timeval& tv) noexcept : TBase(tv) { } @@ -256,11 +256,11 @@ public: } } - static constexpr TDuration FromValue(TValue value) noexcept { - return TDuration(value); - } - - static constexpr TDuration MicroSeconds(ui64 us) noexcept { + static constexpr TDuration FromValue(TValue value) noexcept { + return TDuration(value); + } + + static constexpr TDuration MicroSeconds(ui64 us) noexcept { return TDuration(us); } @@ -281,11 +281,11 @@ public: inline TInstant ToDeadLine() const; constexpr TInstant ToDeadLine(TInstant now) const; - static constexpr TDuration Max() noexcept { + static constexpr TDuration Max() noexcept { return TDuration(::Max<TValue>()); } - static constexpr TDuration Zero() noexcept { + static constexpr TDuration Zero() noexcept { return TDuration(); } @@ -295,15 +295,15 @@ public: return MilliSeconds(typename NDateTimeHelpers::TPrecisionHelper<T>::THighPrecision(s) * 1000); } - static constexpr TDuration Minutes(ui64 m) noexcept { + static constexpr TDuration Minutes(ui64 m) noexcept { return Seconds(m * 60); } - static constexpr TDuration Hours(ui64 h) noexcept { + static constexpr TDuration Hours(ui64 h) noexcept { return Minutes(h * 60); } - static constexpr TDuration Days(ui64 d) noexcept { + static constexpr TDuration Days(ui64 d) noexcept { return Hours(d * 24); } @@ -315,26 +315,26 @@ public: // note global Out method is defined for TDuration, so it could be written to IOutputStream as text template <class T> - inline TDuration& operator+=(const T& t) noexcept { + inline TDuration& operator+=(const T& t) noexcept { return (*this = (*this + t)); } template <class T> - inline TDuration& operator-=(const T& t) noexcept { + inline TDuration& operator-=(const T& t) noexcept { return (*this = (*this - t)); } template <class T> - inline TDuration& operator*=(const T& t) noexcept { + inline TDuration& operator*=(const T& t) noexcept { return (*this = (*this * t)); } template <class T> - inline TDuration& operator/=(const T& t) noexcept { + inline TDuration& operator/=(const T& t) noexcept { return (*this = (*this / t)); } - TString ToString() const; + TString ToString() const; }; Y_DECLARE_PODTYPE(TDuration); @@ -350,28 +350,28 @@ struct THash<TDuration> { class TInstant: public TTimeBase<TInstant> { using TBase = TTimeBase<TInstant>; -private: - /** - * private construct from microseconds since epoch - */ +private: + /** + * private construct from microseconds since epoch + */ constexpr explicit TInstant(TValue value) noexcept : TBase(value) { } -public: - constexpr TInstant() noexcept { - } - +public: + constexpr TInstant() noexcept { + } + constexpr TInstant(const struct timeval& tv) noexcept : TBase(tv) { } - static constexpr TInstant FromValue(TValue value) noexcept { - return TInstant(value); - } - + static constexpr TInstant FromValue(TValue value) noexcept { + return TInstant(value); + } + static inline TInstant Now() { return TInstant::MicroSeconds(::MicroSeconds()); } @@ -383,49 +383,49 @@ public: using TBase::Minutes; using TBase::Seconds; - static constexpr TInstant Max() noexcept { + static constexpr TInstant Max() noexcept { return TInstant(::Max<TValue>()); } - static constexpr TInstant Zero() noexcept { + static constexpr TInstant Zero() noexcept { return TInstant(); } /// us since epoch - static constexpr TInstant MicroSeconds(ui64 us) noexcept { + static constexpr TInstant MicroSeconds(ui64 us) noexcept { return TInstant(us); } /// ms since epoch - static constexpr TInstant MilliSeconds(ui64 ms) noexcept { + static constexpr TInstant MilliSeconds(ui64 ms) noexcept { return MicroSeconds(ms * 1000); } /// seconds since epoch - static constexpr TInstant Seconds(ui64 s) noexcept { + static constexpr TInstant Seconds(ui64 s) noexcept { return MilliSeconds(s * 1000); } /// minutes since epoch - static constexpr TInstant Minutes(ui64 m) noexcept { + static constexpr TInstant Minutes(ui64 m) noexcept { return Seconds(m * 60); } /// hours since epoch - static constexpr TInstant Hours(ui64 h) noexcept { + static constexpr TInstant Hours(ui64 h) noexcept { return Minutes(h * 60); } /// days since epoch - static constexpr TInstant Days(ui64 d) noexcept { + static constexpr TInstant Days(ui64 d) noexcept { return Hours(d * 24); } - constexpr time_t TimeT() const noexcept { + constexpr time_t TimeT() const noexcept { return (time_t)Seconds(); } - inline struct timeval TimeVal() const noexcept { + inline struct timeval TimeVal() const noexcept { struct timeval tv; ::Zero(tv); tv.tv_sec = TimeT(); @@ -433,12 +433,12 @@ public: return tv; } - inline struct tm* LocalTime(struct tm* tm) const noexcept { + inline struct tm* LocalTime(struct tm* tm) const noexcept { time_t clock = Seconds(); return localtime_r(&clock, tm); } - inline struct tm* GmTime(struct tm* tm) const noexcept { + inline struct tm* GmTime(struct tm* tm) const noexcept { time_t clock = Seconds(); return GmTimeR(&clock, tm); } @@ -449,7 +449,7 @@ public: * @returns An ISO 8601 formatted string, e.g. '2015-11-21T23:30:27.991669Z'. * @note Global Out method is defined to TInstant, so it can be written as text to IOutputStream. */ - TString ToString() const; + TString ToString() const; /** * Formats the instant using the UTC time zone. @@ -463,7 +463,7 @@ public: * * @returns An ISO 8601 formatted string, e.g. '2015-11-21T23:30:27Z'. */ - TString ToStringUpToSeconds() const; + TString ToStringUpToSeconds() const; /** * Formats the instant using the system time zone, with microsecond precision. @@ -479,7 +479,7 @@ public: * @returns A semi-ISO 8601 formatted string with timezone without colon, * e.g. '2015-11-22T04:30:27.991669+0500'. */ - TString ToStringLocal() const; + TString ToStringLocal() const; /** * Formats the instant using the system time zone. @@ -502,7 +502,7 @@ public: * @returns A semi-ISO 8601 formatted string with timezone without colon, * e.g. '2015-11-22T04:30:27+0500'. */ - TString ToStringLocalUpToSeconds() const; + TString ToStringLocalUpToSeconds() const; TString FormatLocalTime(const char* format) const noexcept; TString FormatGmTime(const char* format) const noexcept; @@ -547,12 +547,12 @@ public: static bool TryParseX509Deprecated(TStringBuf input, TInstant& instant); template <class T> - inline TInstant& operator+=(const T& t) noexcept { + inline TInstant& operator+=(const T& t) noexcept { return (*this = (*this + t)); } template <class T> - inline TInstant& operator-=(const T& t) noexcept { + inline TInstant& operator-=(const T& t) noexcept { return (*this = (*this - t)); } }; @@ -602,32 +602,32 @@ namespace NPrivate { ///@} template <class S> -static constexpr bool operator<(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { +static constexpr bool operator<(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { return l.GetValue() < r.GetValue(); } template <class S> -static constexpr bool operator<=(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { +static constexpr bool operator<=(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { return l.GetValue() <= r.GetValue(); } template <class S> -static constexpr bool operator==(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { +static constexpr bool operator==(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { return l.GetValue() == r.GetValue(); } template <class S> -static constexpr bool operator!=(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { +static constexpr bool operator!=(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { return l.GetValue() != r.GetValue(); } template <class S> -static constexpr bool operator>(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { +static constexpr bool operator>(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { return l.GetValue() > r.GetValue(); } template <class S> -static constexpr bool operator>=(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { +static constexpr bool operator>=(const TTimeBase<S>& l, const TTimeBase<S>& r) noexcept { return l.GetValue() >= r.GetValue(); } @@ -647,24 +647,24 @@ namespace NDateTimeHelpers { } } -constexpr TDuration operator-(const TInstant& l, const TInstant& r) noexcept { - return TDuration::FromValue(::NDateTimeHelpers::DiffWithSaturation(l.GetValue(), r.GetValue())); +constexpr TDuration operator-(const TInstant& l, const TInstant& r) noexcept { + return TDuration::FromValue(::NDateTimeHelpers::DiffWithSaturation(l.GetValue(), r.GetValue())); } -constexpr TInstant operator+(const TInstant& i, const TDuration& d) noexcept { - return TInstant::FromValue(::NDateTimeHelpers::SumWithSaturation(i.GetValue(), d.GetValue())); +constexpr TInstant operator+(const TInstant& i, const TDuration& d) noexcept { + return TInstant::FromValue(::NDateTimeHelpers::SumWithSaturation(i.GetValue(), d.GetValue())); } -constexpr TInstant operator-(const TInstant& i, const TDuration& d) noexcept { - return TInstant::FromValue(::NDateTimeHelpers::DiffWithSaturation(i.GetValue(), d.GetValue())); +constexpr TInstant operator-(const TInstant& i, const TDuration& d) noexcept { + return TInstant::FromValue(::NDateTimeHelpers::DiffWithSaturation(i.GetValue(), d.GetValue())); } -constexpr TDuration operator-(const TDuration& l, const TDuration& r) noexcept { - return TDuration::FromValue(::NDateTimeHelpers::DiffWithSaturation(l.GetValue(), r.GetValue())); +constexpr TDuration operator-(const TDuration& l, const TDuration& r) noexcept { + return TDuration::FromValue(::NDateTimeHelpers::DiffWithSaturation(l.GetValue(), r.GetValue())); } -constexpr TDuration operator+(const TDuration& l, const TDuration& r) noexcept { - return TDuration::FromValue(::NDateTimeHelpers::SumWithSaturation(l.GetValue(), r.GetValue())); +constexpr TDuration operator+(const TDuration& l, const TDuration& r) noexcept { + return TDuration::FromValue(::NDateTimeHelpers::SumWithSaturation(l.GetValue(), r.GetValue())); } template <typename T, typename TRatio> @@ -775,7 +775,7 @@ template <class T> inline TDuration operator*(TDuration d, T t) noexcept { Y_ASSERT(t >= T()); Y_ASSERT(t == T() || Max<TDuration::TValue>() / t >= d.GetValue()); - return TDuration::FromValue(d.GetValue() * t); + return TDuration::FromValue(d.GetValue() * t); } template <> @@ -795,14 +795,14 @@ inline TDuration operator*(T t, TDuration d) noexcept { } template <class T, std::enable_if_t<!std::is_same<TDuration, T>::value, int> = 0> -constexpr TDuration operator/(const TDuration& d, const T& t) noexcept { - return TDuration::FromValue(d.GetValue() / t); -} - -constexpr double operator/(const TDuration& x, const TDuration& y) noexcept { - return static_cast<double>(x.GetValue()) / static_cast<double>(y.GetValue()); +constexpr TDuration operator/(const TDuration& d, const T& t) noexcept { + return TDuration::FromValue(d.GetValue() / t); } +constexpr double operator/(const TDuration& x, const TDuration& y) noexcept { + return static_cast<double>(x.GetValue()) / static_cast<double>(y.GetValue()); +} + inline TInstant TDuration::ToDeadLine() const { return ToDeadLine(TInstant::Now()); } @@ -814,7 +814,7 @@ constexpr TInstant TDuration::ToDeadLine(TInstant now) const { void Sleep(TDuration duration); void SleepUntil(TInstant instant); -static inline TInstant Now() noexcept { +static inline TInstant Now() noexcept { return TInstant::Now(); } diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index afc3f802eb2..66990769491 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -411,9 +411,9 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { } Y_UNIT_TEST(TestInstantToString) { - UNIT_ASSERT_VALUES_EQUAL(TString("2009-08-06T15:19:06.023455Z"), ToString(TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455))); - UNIT_ASSERT_VALUES_EQUAL(TString("2009-08-06T15:19:06.023455Z"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToString()); - UNIT_ASSERT_VALUES_EQUAL(TString("2009-08-06T15:19:06Z"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToStringUpToSeconds()); + UNIT_ASSERT_VALUES_EQUAL(TString("2009-08-06T15:19:06.023455Z"), ToString(TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455))); + UNIT_ASSERT_VALUES_EQUAL(TString("2009-08-06T15:19:06.023455Z"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToString()); + UNIT_ASSERT_VALUES_EQUAL(TString("2009-08-06T15:19:06Z"), (TInstant::Seconds(1249571946) + TDuration::MicroSeconds(23455)).ToStringUpToSeconds()); } Y_UNIT_TEST(TestInstantToRfc822String) { @@ -461,10 +461,10 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { template <class T> void TestTimeUnits() { - T withTime = T::MicroSeconds(1249571946000000L); - T onlyMinutes = T::MicroSeconds(1249571940000000L); - T onlyHours = T::MicroSeconds(1249570800000000L); - T onlyDays = T::MicroSeconds(1249516800000000L); + T withTime = T::MicroSeconds(1249571946000000L); + T onlyMinutes = T::MicroSeconds(1249571940000000L); + T onlyHours = T::MicroSeconds(1249570800000000L); + T onlyDays = T::MicroSeconds(1249516800000000L); ui64 minutes = 20826199; ui64 hours = 347103; ui64 days = 14462; @@ -496,22 +496,22 @@ Y_UNIT_TEST_SUITE(DateTimeTest) { UNIT_ASSERT_EXCEPTION(TDuration::MilliSeconds(FromString(TStringBuf("not a number"))), yexception); UNIT_ASSERT_EXCEPTION(TDuration::Seconds(FromString(TStringBuf("not a number"))), yexception); } - + Y_UNIT_TEST(TestFromValueForTDuration) { - // check that FromValue creates the same TDuration - TDuration d1 = TDuration::MicroSeconds(12345); - TDuration d2 = TDuration::FromValue(d1.GetValue()); - - UNIT_ASSERT_VALUES_EQUAL(d1, d2); - } - + // check that FromValue creates the same TDuration + TDuration d1 = TDuration::MicroSeconds(12345); + TDuration d2 = TDuration::FromValue(d1.GetValue()); + + UNIT_ASSERT_VALUES_EQUAL(d1, d2); + } + Y_UNIT_TEST(TestFromValueForTInstant) { - // check that FromValue creates the same TInstant - TInstant i1 = TInstant::MicroSeconds(12345); - TInstant i2 = TInstant::FromValue(i1.GetValue()); - - UNIT_ASSERT_VALUES_EQUAL(i1, i2); - } + // check that FromValue creates the same TInstant + TInstant i1 = TInstant::MicroSeconds(12345); + TInstant i2 = TInstant::FromValue(i1.GetValue()); + + UNIT_ASSERT_VALUES_EQUAL(i1, i2); + } Y_UNIT_TEST(TestTimeGmDateConversion) { tm time{}; diff --git a/util/datetime/cputimer.cpp b/util/datetime/cputimer.cpp index 516d372c374..08f97a2c7a8 100644 --- a/util/datetime/cputimer.cpp +++ b/util/datetime/cputimer.cpp @@ -65,14 +65,14 @@ ui64 TPrecisionTimer::GetCycleCount() const { return ::GetCycleCount() - Start; } -TString FormatCycles(ui64 cycles) { +TString FormatCycles(ui64 cycles) { ui64 milliseconds = cycles / GetCyclesPerMillisecond(); ui32 ms = ui32(milliseconds % 1000); milliseconds /= 1000; ui32 secs = ui32(milliseconds % 60); milliseconds /= 60; ui32 mins = ui32(milliseconds); - TString result; + TString result; sprintf(result, "%" PRIu32 " m %.2" PRIu32 " s %.3" PRIu32 " ms", mins, secs, ms); return result; } @@ -98,11 +98,11 @@ TFuncTimer::TFuncTimer(const char* func) Cerr << "enter " << Func_ << Endl; } -TFuncTimer::~TFuncTimer() { +TFuncTimer::~TFuncTimer() { Cerr << "leave " << Func_ << " -> " << (TInstant::Now() - Start_) << Endl; } -TTimeLogger::TTimeLogger(const TString& message, bool verbose) +TTimeLogger::TTimeLogger(const TString& message, bool verbose) : Message(message) , Verbose(verbose) , OK(false) diff --git a/util/datetime/cputimer.h b/util/datetime/cputimer.h index 7d38d5bdb38..eae2f535ad5 100644 --- a/util/datetime/cputimer.h +++ b/util/datetime/cputimer.h @@ -3,7 +3,7 @@ #include "base.h" #include <util/system/rusage.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/str.h> class TTimer { @@ -72,7 +72,7 @@ public: ui64 GetCycleCount() const; }; -TString FormatCycles(ui64 cycles); +TString FormatCycles(ui64 cycles); class TFormattedPrecisionTimer { private: @@ -88,7 +88,7 @@ public: class TFuncTimer { public: TFuncTimer(const char* func); - ~TFuncTimer(); + ~TFuncTimer(); private: const TInstant Start_; @@ -97,7 +97,7 @@ private: class TFakeTimer { public: - inline TFakeTimer(const char* = nullptr) noexcept { + inline TFakeTimer(const char* = nullptr) noexcept { } }; @@ -109,14 +109,14 @@ public: class TTimeLogger { private: - TString Message; + TString Message; bool Verbose; bool OK; time_t Begin; ui64 BeginCycles; public: - TTimeLogger(const TString& message, bool verbose = true); + TTimeLogger(const TString& message, bool verbose = true); ~TTimeLogger(); void SetOK(); diff --git a/util/datetime/parser.h b/util/datetime/parser.h index f0c1b4a0c78..007c5a4615e 100644 --- a/util/datetime/parser.h +++ b/util/datetime/parser.h @@ -28,7 +28,7 @@ struct TDateTimeFields { Year = year; } - bool IsOk() const noexcept { + bool IsOk() const noexcept { if (Year < 1970) return false; if (Month < 1 || Month > 12) diff --git a/util/datetime/systime.cpp b/util/datetime/systime.cpp index 6ee7e8fc6ed..d7e5a69b034 100644 --- a/util/datetime/systime.cpp +++ b/util/datetime/systime.cpp @@ -132,7 +132,7 @@ struct tm* GmTimeR(const time_t* timer, struct tm* tmbuf) { return tmbuf; } -TString CTimeR(const time_t* timer) { +TString CTimeR(const time_t* timer) { char sTime[32]; sTime[0] = 0; ctime_r(timer, &sTime[0]); diff --git a/util/datetime/systime.h b/util/datetime/systime.h index 491d36e802a..e64744977ce 100644 --- a/util/datetime/systime.h +++ b/util/datetime/systime.h @@ -1,7 +1,7 @@ #pragma once #include <util/system/platform.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <ctime> @@ -9,7 +9,7 @@ time_t TimeGM(const struct tm* t); struct tm* GmTimeR(const time_t* timer, struct tm* tmbuf); // safe version of ctime, convinient version of ctime_r -TString CTimeR(const time_t* timer); +TString CTimeR(const time_t* timer); #ifdef _win_ #include <util/system/winint.h> diff --git a/util/datetime/uptime.cpp b/util/datetime/uptime.cpp index 12476a94bfa..322a229000a 100644 --- a/util/datetime/uptime.cpp +++ b/util/datetime/uptime.cpp @@ -1,56 +1,56 @@ -#include "uptime.h" - -#if defined(_win_) +#include "uptime.h" + +#if defined(_win_) #include <util/system/winint.h> -#elif defined(_linux_) +#elif defined(_linux_) #include <util/stream/file.h> #include <util/string/cast.h> -#elif defined(_darwin_) +#elif defined(_darwin_) #include <sys/sysctl.h> -#endif - -#if defined(_darwin_) -namespace { - TInstant GetBootTime() { - struct timeval timeSinceBoot; - size_t len = sizeof(timeSinceBoot); - int request[2] = {CTL_KERN, KERN_BOOTTIME}; - if (sysctl(request, 2, &timeSinceBoot, &len, nullptr, 0) < 0) { - ythrow yexception() << "cannot get kern.boottime from sysctl"; - } - return TInstant::MicroSeconds(timeSinceBoot.tv_sec * 1'000'000 + timeSinceBoot.tv_usec); - } - - TDuration GetDarwinUptime() { - TInstant beforeNow; - TInstant afterNow; - TInstant now; - - // avoid race when NTP changes machine time between getting Now() and uptime - afterNow = GetBootTime(); - do { - beforeNow = afterNow; - now = Now(); - afterNow = GetBootTime(); - } while (afterNow != beforeNow); - - return now - beforeNow; - } -} -#endif // _darwin_ - -TDuration Uptime() { -#if defined(_win_) - return TDuration::MilliSeconds(GetTickCount64()); -#elif defined(_linux_) - TUnbufferedFileInput in("/proc/uptime"); - TString uptimeStr = in.ReadLine(); - double up, idle; - if (sscanf(uptimeStr.data(), "%lf %lf", &up, &idle) < 2) { - ythrow yexception() << "cannot read values from /proc/uptime"; - } - return TDuration::MilliSeconds(up * 1000.0); -#elif defined(_darwin_) - return GetDarwinUptime(); -#endif -} +#endif + +#if defined(_darwin_) +namespace { + TInstant GetBootTime() { + struct timeval timeSinceBoot; + size_t len = sizeof(timeSinceBoot); + int request[2] = {CTL_KERN, KERN_BOOTTIME}; + if (sysctl(request, 2, &timeSinceBoot, &len, nullptr, 0) < 0) { + ythrow yexception() << "cannot get kern.boottime from sysctl"; + } + return TInstant::MicroSeconds(timeSinceBoot.tv_sec * 1'000'000 + timeSinceBoot.tv_usec); + } + + TDuration GetDarwinUptime() { + TInstant beforeNow; + TInstant afterNow; + TInstant now; + + // avoid race when NTP changes machine time between getting Now() and uptime + afterNow = GetBootTime(); + do { + beforeNow = afterNow; + now = Now(); + afterNow = GetBootTime(); + } while (afterNow != beforeNow); + + return now - beforeNow; + } +} +#endif // _darwin_ + +TDuration Uptime() { +#if defined(_win_) + return TDuration::MilliSeconds(GetTickCount64()); +#elif defined(_linux_) + TUnbufferedFileInput in("/proc/uptime"); + TString uptimeStr = in.ReadLine(); + double up, idle; + if (sscanf(uptimeStr.data(), "%lf %lf", &up, &idle) < 2) { + ythrow yexception() << "cannot read values from /proc/uptime"; + } + return TDuration::MilliSeconds(up * 1000.0); +#elif defined(_darwin_) + return GetDarwinUptime(); +#endif +} diff --git a/util/datetime/uptime.h b/util/datetime/uptime.h index 88f0de63dad..fabf141734c 100644 --- a/util/datetime/uptime.h +++ b/util/datetime/uptime.h @@ -1,8 +1,8 @@ -#pragma once - -#include "base.h" - -/** - * Returns system uptime - */ -TDuration Uptime(); +#pragma once + +#include "base.h" + +/** + * Returns system uptime + */ +TDuration Uptime(); diff --git a/util/datetime/uptime_ut.cpp b/util/datetime/uptime_ut.cpp index 7f5ecc482c8..5ffc372784d 100644 --- a/util/datetime/uptime_ut.cpp +++ b/util/datetime/uptime_ut.cpp @@ -1,12 +1,12 @@ #include <library/cpp/testing/unittest/registar.h> - -#include "uptime.h" - -Y_UNIT_TEST_SUITE(TestUptimeSuite) { - Y_UNIT_TEST(TestUptime) { - auto t1 = Uptime(); - Sleep(TDuration::MilliSeconds(50)); // typical uptime resolution is 10-16 ms - auto t2 = Uptime(); - UNIT_ASSERT(t2 > t1); - } -} + +#include "uptime.h" + +Y_UNIT_TEST_SUITE(TestUptimeSuite) { + Y_UNIT_TEST(TestUptime) { + auto t1 = Uptime(); + Sleep(TDuration::MilliSeconds(50)); // typical uptime resolution is 10-16 ms + auto t2 = Uptime(); + UNIT_ASSERT(t2 > t1); + } +} diff --git a/util/datetime/ut/ya.make b/util/datetime/ut/ya.make index c2bc714059e..9f5b65aeee8 100644 --- a/util/datetime/ut/ya.make +++ b/util/datetime/ut/ya.make @@ -7,7 +7,7 @@ SRCS( datetime/base_ut.cpp datetime/parser_deprecated_ut.cpp datetime/parser_ut.cpp - datetime/uptime_ut.cpp + datetime/uptime_ut.cpp ) INCLUDE(${ARCADIA_ROOT}/util/tests/ya_util_tests.inc) diff --git a/util/digest/city.h b/util/digest/city.h index 675a798074f..ce37768d7f9 100644 --- a/util/digest/city.h +++ b/util/digest/city.h @@ -52,32 +52,32 @@ namespace NPrivateCityHash { } } -template <class TStringType> -inline ui64 CityHash64(const TStringType& str) { +template <class TStringType> +inline ui64 CityHash64(const TStringType& str) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash64(buf.data(), buf.size()); } -template <class TStringType> -inline ui64 CityHash64WithSeeds(const TStringType& str, ui64 seed0, ui64 seed1) { +template <class TStringType> +inline ui64 CityHash64WithSeeds(const TStringType& str, ui64 seed0, ui64 seed1) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash64WithSeeds(buf.data(), buf.size(), seed0, seed1); } -template <class TStringType> -inline ui64 CityHash64WithSeed(const TStringType& str, ui64 seed) { +template <class TStringType> +inline ui64 CityHash64WithSeed(const TStringType& str, ui64 seed) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash64WithSeed(buf.data(), buf.size(), seed); } -template <class TStringType> -inline uint128 CityHash128(const TStringType& str) { +template <class TStringType> +inline uint128 CityHash128(const TStringType& str) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash128(buf.data(), buf.size()); } -template <class TStringType> -inline uint128 CityHash128WithSeed(const TStringType& str, uint128 seed) { +template <class TStringType> +inline uint128 CityHash128WithSeed(const TStringType& str, uint128 seed) { TStringBuf buf = NPrivateCityHash::GetBufFromStr(str); return CityHash128WithSeed(buf.data(), buf.size(), seed); } diff --git a/util/digest/multi_ut.pyx b/util/digest/multi_ut.pyx index 26faa0069b2..6dbdb32d8fe 100644 --- a/util/digest/multi_ut.pyx +++ b/util/digest/multi_ut.pyx @@ -1,5 +1,5 @@ from util.digest.multi cimport MultiHash -from util.generic.string cimport TString +from util.generic.string cimport TString import pytest import unittest diff --git a/util/digest/sequence_ut.cpp b/util/digest/sequence_ut.cpp index 87d6102ee59..d915d7ad06e 100644 --- a/util/digest/sequence_ut.cpp +++ b/util/digest/sequence_ut.cpp @@ -16,18 +16,18 @@ class TRangeHashTest: public TTestBase { private: inline void TestStrokaInt() { const size_t canonicalHash = static_cast<size_t>(ULL(12727184940294366172)); - UNIT_ASSERT_EQUAL(canonicalHash, TRangeHash<>()(TString("12345"))); + UNIT_ASSERT_EQUAL(canonicalHash, TRangeHash<>()(TString("12345"))); } inline void TestIntVector() { const size_t canonicalHash = static_cast<size_t>(ULL(1351128487744230578)); - TVector<int> testVec = {1, 2, 4, 3}; + TVector<int> testVec = {1, 2, 4, 3}; UNIT_ASSERT_EQUAL(canonicalHash, TRangeHash<>()(testVec)); } inline void TestOneElement() { const int testVal = 42; - TVector<int> testVec = {testVal}; + TVector<int> testVec = {testVal}; UNIT_ASSERT_UNEQUAL(THash<int>()(testVal), TRangeHash<>()(testVec)); } @@ -38,8 +38,8 @@ private: } inline void TestCollectionIndependancy() { - TVector<char> testVec = {'a', 'b', 'c'}; - TString testStroka = "abc"; + TVector<char> testVec = {'a', 'b', 'c'}; + TString testStroka = "abc"; UNIT_ASSERT_EQUAL(TRangeHash<>()(testVec), TRangeHash<>()(testStroka)); } }; diff --git a/util/draft/date.cpp b/util/draft/date.cpp index a290c460505..645edad0138 100644 --- a/util/draft/date.cpp +++ b/util/draft/date.cpp @@ -44,7 +44,7 @@ TDate::TDate(const char* yyyymmdd) { } -TDate::TDate(const TString& yyyymmdd) +TDate::TDate(const TString& yyyymmdd) : Timestamp(GetDateStart(ParseDate(yyyymmdd.c_str()))) { } @@ -54,7 +54,7 @@ TDate::TDate(time_t ts) { } -TDate::TDate(const TString& date, const TString& format) +TDate::TDate(const TString& date, const TString& format) : Timestamp(GetDateStart(ParseDate(date.data(), format.data()))) { } @@ -82,7 +82,7 @@ time_t TDate::GetStartUTC() const { return TimeGM(&dateTm); } -TString TDate::ToStroka(const char* format) const { +TString TDate::ToStroka(const char* format) const { tm dateTm; localtime_r(&Timestamp, &dateTm); return Strftime(format, &dateTm); diff --git a/util/draft/date.h b/util/draft/date.h index e3eb616fe5d..b973a8d1971 100644 --- a/util/draft/date.h +++ b/util/draft/date.h @@ -2,7 +2,7 @@ #include <util/stream/output.h> #include <util/stream/input.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/datetime/constants.h> #include <ctime> @@ -28,9 +28,9 @@ public: } TDate(const char* yyyymmdd); - TDate(const TString& yyyymmdd); + TDate(const TString& yyyymmdd); TDate(unsigned year, unsigned month, unsigned monthDay); // month from 01, monthDay from 01 - TDate(const TString& date, const TString& format); + TDate(const TString& date, const TString& format); explicit TDate(time_t t); @@ -40,7 +40,7 @@ public: time_t GetStartUTC() const; - TString ToStroka(const char* format = "%Y%m%d") const; + TString ToStroka(const char* format = "%Y%m%d") const; TDate& operator++() { Timestamp = GetDateStart(Timestamp + 3 * (SECONDS_IN_DAY / 2)); @@ -117,7 +117,7 @@ inline int operator-(const TDate& left, const TDate& right) { } inline IInputStream& operator>>(IInputStream& left, TDate& right) { - TString stroka; + TString stroka; left >> stroka; TDate date(stroka.c_str()); right = date; diff --git a/util/draft/datetime.cpp b/util/draft/datetime.cpp index 5cbe7d88477..5365dd737ad 100644 --- a/util/draft/datetime.cpp +++ b/util/draft/datetime.cpp @@ -178,7 +178,7 @@ namespace NDatetime { } } - TString TSimpleTM::ToString(const char* fmt) const { + TString TSimpleTM::ToString(const char* fmt) const { struct tm t = *this; return Strftime(fmt, &t); } diff --git a/util/draft/datetime.h b/util/draft/datetime.h index 8a387ea6f1b..5bf0ee7156f 100644 --- a/util/draft/datetime.h +++ b/util/draft/datetime.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/algorithm.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/generic/ymath.h> #include <util/datetime/base.h> @@ -70,7 +70,7 @@ namespace NDatetime { // keeps the object consistent TSimpleTM& Add(EField f, i32 amount = 1); - TString ToString(const char* fmt = "%a, %d %b %Y %H:%M:%S %z") const; + TString ToString(const char* fmt = "%a, %d %b %Y %H:%M:%S %z") const; TSimpleTM& ToUTC() { return *this = New(AsTimeT()); @@ -133,16 +133,16 @@ namespace NDatetime { }; } -inline TString date2str(const time_t date) { +inline TString date2str(const time_t date) { struct tm dateTm; memset(&dateTm, 0, sizeof(dateTm)); localtime_r(&date, &dateTm); char buf[9]; strftime(buf, sizeof(buf), "%Y%m%d", &dateTm); - return TString(buf); + return TString(buf); } -inline time_t str2date(const TString& dateStr) { +inline time_t str2date(const TString& dateStr) { struct tm dateTm; memset(&dateTm, 0, sizeof(tm)); strptime(dateStr.data(), "%Y%m%d", &dateTm); diff --git a/util/draft/datetime_ut.cpp b/util/draft/datetime_ut.cpp index a5e065ef6e8..2af8430977b 100644 --- a/util/draft/datetime_ut.cpp +++ b/util/draft/datetime_ut.cpp @@ -5,19 +5,19 @@ #include <util/string/builder.h> Y_UNIT_TEST_SUITE(TSimpleTMTest) { - TString PrintMarker(const TString& test, int line) { + TString PrintMarker(const TString& test, int line) { return TStringBuilder() << "test " << test << " at line " << line; } - TString JoinMarker(const TString& marker, time_t t) { + TString JoinMarker(const TString& marker, time_t t) { return TStringBuilder() << marker << " (tstamp=" << t << ")"; } - TString PrintMarker(const TString& test, int line, time_t t) { + TString PrintMarker(const TString& test, int line, time_t t) { return JoinMarker(PrintMarker(test, line), t); } - void AssertStructTmEqual(const TString& marker, const struct tm& tmt, const NDatetime::TSimpleTM& tms) { + void AssertStructTmEqual(const TString& marker, const struct tm& tmt, const NDatetime::TSimpleTM& tms) { UNIT_ASSERT_VALUES_EQUAL_C((int)tms.Sec, tmt.tm_sec, marker); UNIT_ASSERT_VALUES_EQUAL_C((int)tms.Min, tmt.tm_min, marker); UNIT_ASSERT_VALUES_EQUAL_C((int)tms.Hour, tmt.tm_hour, marker); @@ -32,10 +32,10 @@ Y_UNIT_TEST_SUITE(TSimpleTMTest) { #endif } - void AssertSimpleTM(const TString& mark, + void AssertSimpleTM(const TString& mark, const NDatetime::TSimpleTM& tms, time_t tstamp, ui32 year, ui32 mon, ui32 mday, ui32 hour, ui32 minu, ui32 sec) { - TString marker = JoinMarker(mark, tstamp); + TString marker = JoinMarker(mark, tstamp); struct tm tmt; Zero(tmt); GmTimeR(&tstamp, &tmt); diff --git a/util/draft/enum.h b/util/draft/enum.h index 18002b7df20..a7adc49c324 100644 --- a/util/draft/enum.h +++ b/util/draft/enum.h @@ -37,8 +37,8 @@ const V* FindEnumFromStringImpl(const char* key, const std::pair<const char*, V> } template <class K, class V> -TString PrintEnumItemsImpl(const std::pair<K, V>* entries, size_t arraySize) { - TString result; +TString PrintEnumItemsImpl(const std::pair<K, V>* entries, size_t arraySize) { + TString result; TStringOutput out(result); for (size_t i = 0; i < arraySize; i++) out << (i ? ", " : "") << "'" << entries[i].first << "'"; @@ -47,8 +47,8 @@ TString PrintEnumItemsImpl(const std::pair<K, V>* entries, size_t arraySize) { // special version for const char* template <class V> -TString PrintEnumItemsImpl(const std::pair<const char*, V>* entries, size_t arraySize) { - TString result; +TString PrintEnumItemsImpl(const std::pair<const char*, V>* entries, size_t arraySize) { + TString result; TStringOutput out(result); for (size_t i = 0; i < arraySize; i++) out << (i ? ", " : "") << "'" << (entries[i].first ? entries[i].first : "<null>") << "'"; diff --git a/util/draft/holder_vector.h b/util/draft/holder_vector.h index 1c62055bd95..b1d9b695d8b 100644 --- a/util/draft/holder_vector.h +++ b/util/draft/holder_vector.h @@ -6,7 +6,7 @@ template <class T, class D = TDelete> class THolderVector: public TVector<T*>, public TNonCopyable { - using TBase = TVector<T*>; + using TBase = TVector<T*>; public: explicit THolderVector(size_t n = 0) @@ -30,7 +30,7 @@ public: return TBase::size(); } - // TVector takes ownership of T + // TVector takes ownership of T void PushBack(T* t) { try { TBase::push_back(t); diff --git a/util/draft/holder_vector_ut.cpp b/util/draft/holder_vector_ut.cpp index f64393860af..3acb823941a 100644 --- a/util/draft/holder_vector_ut.cpp +++ b/util/draft/holder_vector_ut.cpp @@ -60,8 +60,8 @@ Y_UNIT_TEST_SUITE(THolderVectorTest) { } Y_UNIT_TEST(TestUniquePtr) { - THolderVector<TString> v; - std::unique_ptr<TString> str(new TString("hello")); + THolderVector<TString> v; + std::unique_ptr<TString> str(new TString("hello")); v.PushBack(std::move(str)); UNIT_ASSERT(v.Size() == 1); UNIT_ASSERT(str.get() == nullptr); diff --git a/util/draft/ip.h b/util/draft/ip.h index eb947cd2cd5..550bdbf8e5a 100644 --- a/util/draft/ip.h +++ b/util/draft/ip.h @@ -80,10 +80,10 @@ static inline char* Ip6ToString(const TIp6& ip, char* buf, size_t len) { return buf; } -static inline TString Ip6ToString(const TIp6& ip) { +static inline TString Ip6ToString(const TIp6& ip) { char buf[INET6_ADDRSTRLEN]; - return TString(Ip6ToString(ip, buf, sizeof(buf))); + return TString(Ip6ToString(ip, buf, sizeof(buf))); } template <> @@ -106,7 +106,7 @@ static inline TIp4Or6 Ip4Or6FromString(const char* ipStr) { ythrow TSystemError() << "Failed to convert (" << ipStr << ") to ipv4 or ipv6 address"; } -static inline TString Ip4Or6ToString(const TIp4Or6& ip) { +static inline TString Ip4Or6ToString(const TIp4Or6& ip) { if (std::holds_alternative<TIp6>(ip)) { return Ip6ToString(std::get<TIp6>(ip)); } else { diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index ffc9b09f967..84d00932414 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -11,12 +11,12 @@ #include <util/system/maxlen.h> #include <util/system/yassert.h> -void SlashFolderLocal(TString& folder) { +void SlashFolderLocal(TString& folder) { if (!folder) return; #ifdef _win32_ size_t pos; - while ((pos = folder.find('/')) != TString::npos) + while ((pos = folder.find('/')) != TString::npos) folder.replace(pos, 1, LOCSLASH_S); #endif if (folder[folder.size() - 1] != LOCSLASH_C) @@ -25,11 +25,11 @@ void SlashFolderLocal(TString& folder) { #ifndef _win32_ -bool correctpath(TString& folder) { +bool correctpath(TString& folder) { return resolvepath(folder, "/"); } -bool resolvepath(TString& folder, const TString& home) { +bool resolvepath(TString& folder, const TString& home) { Y_ASSERT(home && home.at(0) == '/'); if (!folder) { return false; @@ -348,7 +348,7 @@ int resolvepath(char* apath, const char* rpath, const char* cpath) { return correctpath(apath, tpath); } -bool correctpath(TString& filename) { +bool correctpath(TString& filename) { char* ptr = (char*)alloca(filename.size() + 2); if (correctpath(ptr, filename.data())) { filename = ptr; @@ -357,7 +357,7 @@ bool correctpath(TString& filename) { return false; } -bool resolvepath(TString& folder, const TString& home) { +bool resolvepath(TString& folder, const TString& home) { char* ptr = (char*)alloca(folder.size() + 3 + home.size()); if (resolvepath(ptr, folder.data(), home.data())) { folder = ptr; @@ -376,7 +376,7 @@ const char* GetDirectorySeparatorS() { return LOCSLASH_S; } -void RemoveDirWithContents(TString dirName) { +void RemoveDirWithContents(TString dirName) { SlashFolderLocal(dirName); TDirIterator dir(dirName, TDirIterator::TOptions(FTS_NOSTAT)); @@ -402,7 +402,7 @@ int mkpath(char* path, int mode) { // Implementation of realpath in FreeBSD (version 9.0 and less) and GetFullPathName in Windows // did not require last component of the file name to exist (other implementations will fail // if it does not). Use RealLocation if that behaviour is required. -TString RealPath(const TString& path) { +TString RealPath(const TString& path) { TTempBuf result; Y_ASSERT(result.Size() > MAX_PATH); //TMP_BUF_LEN > MAX_PATH #ifdef _win_ @@ -414,10 +414,10 @@ TString RealPath(const TString& path) { return result.Data(); } -TString RealLocation(const TString& path) { +TString RealLocation(const TString& path) { if (NFs::Exists(path)) return RealPath(path); - TString dirpath = GetDirName(path); + TString dirpath = GetDirName(path); if (NFs::Exists(dirpath)) return RealPath(dirpath) + GetDirectorySeparatorS() + GetFileNameComponent(path.data()); ythrow TFileError() << "RealLocation failed \"" << path << "\""; @@ -426,7 +426,7 @@ TString RealLocation(const TString& path) { int MakeTempDir(char path[/*FILENAME_MAX*/], const char* prefix) { int ret; - TString sysTmp; + TString sysTmp; #ifdef _win32_ if (!prefix || *prefix == '/') { @@ -449,12 +449,12 @@ int MakeTempDir(char path[/*FILENAME_MAX*/], const char* prefix) { return 0; } -bool IsDir(const TString& path) { +bool IsDir(const TString& path) { return TFileStat(path).IsDir(); } -TString GetHomeDir() { - TString s(getenv("HOME")); +TString GetHomeDir() { + TString s(getenv("HOME")); if (!s) { #ifndef _win32_ passwd* pw = nullptr; @@ -505,14 +505,14 @@ const char* GetFileNameComponent(const char* f) { return f; } -TString GetSystemTempDir() { +TString GetSystemTempDir() { #ifdef _win_ char buffer[1024]; DWORD size = GetTempPath(1024, buffer); if (!size) { ythrow TSystemError() << "failed to get system temporary directory"; } - return TString(buffer, size); + return TString(buffer, size); #else const char* var = "TMPDIR"; const char* def = "/tmp"; @@ -522,11 +522,11 @@ TString GetSystemTempDir() { #endif } -TString ResolveDir(const char* path) { +TString ResolveDir(const char* path) { return ResolvePath(path, true); } -bool SafeResolveDir(const char* path, TString& result) { +bool SafeResolveDir(const char* path, TString& result) { try { result = ResolvePath(path, true); return true; @@ -535,7 +535,7 @@ bool SafeResolveDir(const char* path, TString& result) { } } -TString GetDirName(const TString& path) { +TString GetDirName(const TString& path) { return TFsPath(path).Dirname(); } @@ -548,7 +548,7 @@ char* realpath(const char* pathname, char resolved_path[MAXPATHLEN]) { #endif -TString GetBaseName(const TString& path) { +TString GetBaseName(const TString& path) { return TFsPath(path).Basename(); } @@ -612,8 +612,8 @@ TString ResolvePath(const char* path, bool isDir) { return ResolvePath(path, nullptr, isDir); } -TString StripFileComponent(const TString& fileName) { - TString dir = IsDir(fileName) ? fileName : GetDirName(fileName); +TString StripFileComponent(const TString& fileName) { + TString dir = IsDir(fileName) ? fileName : GetDirName(fileName); if (!dir.empty() && dir.back() != GetDirectorySeparator()) { dir.append(GetDirectorySeparator()); } diff --git a/util/folder/dirut.h b/util/folder/dirut.h index 2537027b12d..f523aa085e3 100644 --- a/util/folder/dirut.h +++ b/util/folder/dirut.h @@ -3,7 +3,7 @@ #include <util/system/defaults.h> #include <util/system/sysstat.h> #include <util/system/fs.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <sys/types.h> @@ -37,57 +37,57 @@ char* mkdtemp(char* path); #endif #endif -bool IsDir(const TString& path); +bool IsDir(const TString& path); int mkpath(char* path, int mode = 0777); -TString GetHomeDir(); +TString GetHomeDir(); void MakeDirIfNotExist(const char* path, int mode = 0777); -inline void MakeDirIfNotExist(const TString& path, int mode = 0777) { +inline void MakeDirIfNotExist(const TString& path, int mode = 0777) { MakeDirIfNotExist(path.data(), mode); } /// Create path making parent directories as needed void MakePathIfNotExist(const char* path, int mode = 0777); -void SlashFolderLocal(TString& folder); -bool correctpath(TString& filename); -bool resolvepath(TString& folder, const TString& home); +void SlashFolderLocal(TString& folder); +bool correctpath(TString& filename); +bool resolvepath(TString& folder, const TString& home); char GetDirectorySeparator(); const char* GetDirectorySeparatorS(); -void RemoveDirWithContents(TString dirName); +void RemoveDirWithContents(TString dirName); const char* GetFileNameComponent(const char* f); -inline TString GetFileNameComponent(const TString& f) { +inline TString GetFileNameComponent(const TString& f) { return GetFileNameComponent(f.data()); } /// RealPath doesn't guarantee trailing separator to be stripped or left in place for directories. -TString RealPath(const TString& path); // throws -TString RealLocation(const TString& path); /// throws; last file name component doesn't need to exist +TString RealPath(const TString& path); // throws +TString RealLocation(const TString& path); /// throws; last file name component doesn't need to exist -TString GetSystemTempDir(); +TString GetSystemTempDir(); int MakeTempDir(char path[/*FILENAME_MAX*/], const char* prefix); int ResolvePath(const char* rel, const char* abs, char res[/*FILENAME_MAX*/], bool isdir = false); TString ResolvePath(const char* rel, const char* abs, bool isdir = false); -TString ResolvePath(const char* path, bool isDir = false); +TString ResolvePath(const char* path, bool isDir = false); -TString ResolveDir(const char* path); +TString ResolveDir(const char* path); -bool SafeResolveDir(const char* path, TString& result); +bool SafeResolveDir(const char* path, TString& result); -TString GetDirName(const TString& path); +TString GetDirName(const TString& path); -TString GetBaseName(const TString& path); +TString GetBaseName(const TString& path); -TString StripFileComponent(const TString& fileName); +TString StripFileComponent(const TString& fileName); class TExistenceChecker { public: diff --git a/util/folder/dirut_ut.cpp b/util/folder/dirut_ut.cpp index 45ebfc842ca..9afcf036213 100644 --- a/util/folder/dirut_ut.cpp +++ b/util/folder/dirut_ut.cpp @@ -3,7 +3,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/memory/tempbuf.h> #include <util/stream/file.h> #include <util/system/platform.h> diff --git a/util/folder/filelist.cpp b/util/folder/filelist.cpp index b21fcdbf208..beb543734cc 100644 --- a/util/folder/filelist.cpp +++ b/util/folder/filelist.cpp @@ -4,7 +4,7 @@ #include <util/system/defaults.h> -void TFileEntitiesList::Fill(const TString& dirname, TStringBuf prefix, TStringBuf suffix, int depth, bool sort) { +void TFileEntitiesList::Fill(const TString& dirname, TStringBuf prefix, TStringBuf suffix, int depth, bool sort) { TDirIterator::TOptions opts; opts.SetMaxLevel(depth); if (sort) { diff --git a/util/folder/filelist.h b/util/folder/filelist.h index 3f615fa4c2e..1228a086130 100644 --- a/util/folder/filelist.h +++ b/util/folder/filelist.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/buffer.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/flags.h> @@ -40,15 +40,15 @@ public: return FileNamesSize; } - inline void Fill(const TString& dirname, bool sort = false) { + inline void Fill(const TString& dirname, bool sort = false) { Fill(dirname, TStringBuf(), sort); } - inline void Fill(const TString& dirname, TStringBuf prefix, bool sort = false) { + inline void Fill(const TString& dirname, TStringBuf prefix, bool sort = false) { Fill(dirname, prefix, TStringBuf(), 1, sort); } - void Fill(const TString& dirname, TStringBuf prefix, TStringBuf suffix, int depth, bool sort = false); + void Fill(const TString& dirname, TStringBuf prefix, TStringBuf suffix, int depth, bool sort = false); void Restart() { Cur = FileNames.Data(); diff --git a/util/folder/filelist_ut.cpp b/util/folder/filelist_ut.cpp index 0cdcdf3d003..60db164e565 100644 --- a/util/folder/filelist_ut.cpp +++ b/util/folder/filelist_ut.cpp @@ -5,7 +5,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/system/file.h> -#include <util/generic/string.h> +#include <util/generic/string.h> class TFileListTest: public TTestBase { UNIT_TEST_SUITE(TFileListTest); @@ -25,7 +25,7 @@ void TFileListTest::TestSimple() { TFileList fileList; fileList.Fill(tempDir().data(), "", "", 1000); - TString fileName(fileList.Next()); + TString fileName(fileList.Next()); UNIT_ASSERT_EQUAL(fileName, "subdir" LOCSLASH_S "file"); UNIT_ASSERT_EQUAL(fileList.Next(), nullptr); } @@ -41,14 +41,14 @@ void TFileListTest::TestPrefix() { TFileList fileList; { fileList.Fill(tempDir().data(), "good_file", SORT); - UNIT_ASSERT_EQUAL(TString(fileList.Next()), "good_file1"); - UNIT_ASSERT_EQUAL(TString(fileList.Next()), "good_file2"); + UNIT_ASSERT_EQUAL(TString(fileList.Next()), "good_file1"); + UNIT_ASSERT_EQUAL(TString(fileList.Next()), "good_file2"); UNIT_ASSERT_EQUAL(fileList.Next(), nullptr); } { fileList.Fill(tempDir().data(), "bad_file", SORT); - UNIT_ASSERT_EQUAL(TString(fileList.Next()), "bad_file1"); - UNIT_ASSERT_EQUAL(TString(fileList.Next()), "bad_file2"); + UNIT_ASSERT_EQUAL(TString(fileList.Next()), "bad_file1"); + UNIT_ASSERT_EQUAL(TString(fileList.Next()), "bad_file2"); UNIT_ASSERT_EQUAL(fileList.Next(), nullptr); } } diff --git a/util/folder/fts_ut.cpp b/util/folder/fts_ut.cpp index c5d59e35f42..a628efd90e8 100644 --- a/util/folder/fts_ut.cpp +++ b/util/folder/fts_ut.cpp @@ -7,7 +7,7 @@ #include <util/system/file.h> #include <util/system/tempfile.h> -#include <util/generic/string.h> +#include <util/generic/string.h> class TFtsTest: public TTestBase { UNIT_TEST_SUITE(TFtsTest); diff --git a/util/folder/iterator.cpp b/util/folder/iterator.cpp index 73703d31f91..722238c67be 100644 --- a/util/folder/iterator.cpp +++ b/util/folder/iterator.cpp @@ -6,6 +6,6 @@ static int SortFTSENTByName(const FTSENT** a, const FTSENT** b) { return strcmp((*a)->fts_name, (*b)->fts_name); } -TDirIterator::TOptions& TDirIterator::TOptions::SetSortByName() noexcept { +TDirIterator::TOptions& TDirIterator::TOptions::SetSortByName() noexcept { return SetSortFunctor(SortFTSENTByName); } diff --git a/util/folder/iterator.h b/util/folder/iterator.h index 69e025b9c49..cce6aee8d47 100644 --- a/util/folder/iterator.h +++ b/util/folder/iterator.h @@ -11,7 +11,7 @@ class TDirIterator: public TInputRangeAdaptor<TDirIterator> { struct TFtsDestroy { - static inline void Destroy(FTS* f) noexcept { + static inline void Destroy(FTS* f) noexcept { yfts_close(f); } }; @@ -36,33 +36,33 @@ public: Init(opts); } - inline TOptions& SetMaxLevel(size_t level) noexcept { + inline TOptions& SetMaxLevel(size_t level) noexcept { MaxLevel = level; return *this; } - inline TOptions& SetSortFunctor(TCompare cmp) noexcept { + inline TOptions& SetSortFunctor(TCompare cmp) noexcept { Cmp = cmp; return *this; } - TOptions& SetSortByName() noexcept; + TOptions& SetSortByName() noexcept; int FtsOptions; size_t MaxLevel; TCompare Cmp; private: - inline void Init(int opts) noexcept { + inline void Init(int opts) noexcept { FtsOptions = opts | FTS_NOCHDIR; MaxLevel = Max<size_t>(); Cmp = nullptr; } }; - inline TDirIterator(const TString& path, const TOptions& options = TOptions()) + inline TDirIterator(const TString& path, const TOptions& options = TOptions()) : Options_(options) , Path_(path) { @@ -103,7 +103,7 @@ public: private: TOptions Options_; - TString Path_; + TString Path_; char* Trees_[2]; THolder<FTS, TFtsDestroy> FileTree_; }; diff --git a/util/folder/iterator_ut.cpp b/util/folder/iterator_ut.cpp index 936becd139b..0cae693ef6e 100644 --- a/util/folder/iterator_ut.cpp +++ b/util/folder/iterator_ut.cpp @@ -9,7 +9,7 @@ #include <util/generic/algorithm.h> #include <util/random/mersenne.h> -static TString JoinWithNewline(const TVector<TString>& strings) { +static TString JoinWithNewline(const TVector<TString>& strings) { TStringStream ss; for (const auto& string : strings) { ss << string << "\n"; @@ -30,19 +30,19 @@ private: class TDirHier { public: struct TPath { - TString Path; + TString Path; int Type; }; - inline void AddFile(const TString& path) { + inline void AddFile(const TString& path) { Add(path, 0); } - inline void AddDir(const TString& path) { + inline void AddDir(const TString& path) { Add(path, 1); } - inline void Add(const TString& path, int type) { + inline void Add(const TString& path, int type) { const TPath p = { path, type}; @@ -67,15 +67,15 @@ private: Srch_[path.Path] = path; } - inline int Type(const TString& path) { - THashMap<TString, TPath>::const_iterator it = Srch_.find(path); + inline int Type(const TString& path) { + THashMap<TString, TPath>::const_iterator it = Srch_.find(path); UNIT_ASSERT(it != Srch_.end()); return it->second.Type; } - inline bool Have(const TString& path, int type) { + inline bool Have(const TString& path, int type) { return Type(path) == type; } @@ -86,12 +86,12 @@ private: } private: - TVector<TPath> Paths_; - THashMap<TString, TPath> Srch_; + TVector<TPath> Paths_; + THashMap<TString, TPath> Srch_; }; inline void TestLocal() { - TString dirname("." LOCSLASH_S); + TString dirname("." LOCSLASH_S); TDirIterator d(dirname, FTS_NOCHDIR); for (auto it = d.begin(); it != d.end(); ++it) { } @@ -100,26 +100,26 @@ private: inline void TestIt() { TDirHier hier; - const TString dir = "tmpdir"; + const TString dir = "tmpdir"; const TDirHier::TPath path = {dir, 1}; hier.Add(path); for (size_t i = 0; i < 10; ++i) { - const TString dir1 = dir + LOCSLASH_C + ToString(i); + const TString dir1 = dir + LOCSLASH_C + ToString(i); const TDirHier::TPath path1 = {dir1, 1}; hier.Add(path1); for (size_t j = 0; j < 10; ++j) { - const TString subdir2 = ToString(j); - const TString dir2 = dir1 + LOCSLASH_C + subdir2; + const TString subdir2 = ToString(j); + const TString dir2 = dir1 + LOCSLASH_C + subdir2; const TDirHier::TPath path2 = {dir2, 1}; hier.Add(path2); for (size_t k = 0; k < 3; ++k) { - const TString file = dir2 + LOCSLASH_C + "file" + ToString(k); + const TString file = dir2 + LOCSLASH_C + "file" + ToString(k); const TDirHier::TPath fpath = {file, 0}; hier.Add(fpath); @@ -175,24 +175,24 @@ private: inline void TestSort() { TDirHier dh; - const TString dir("tmpdir"); + const TString dir("tmpdir"); //prepare fs { TMersenne<ui32> rnd; - const TString prefixes[] = { + const TString prefixes[] = { "a", "b", "xxx", "111", ""}; dh.AddDir(dir); for (size_t i = 0; i < 100; ++i) { - const TString fname = dir + LOCSLASH_C + prefixes[i % Y_ARRAY_SIZE(prefixes)] + ToString(rnd.GenRand()); + const TString fname = dir + LOCSLASH_C + prefixes[i % Y_ARRAY_SIZE(prefixes)] + ToString(rnd.GenRand()); dh.AddFile(fname); } } - TVector<TString> fnames; + TVector<TString> fnames; { TDirIterator d(dir, TDirIterator::TOptions().SetSortByName()); @@ -204,7 +204,7 @@ private: } } - TVector<TString> sorted(fnames); + TVector<TString> sorted(fnames); Sort(sorted.begin(), sorted.end()); UNIT_ASSERT_VALUES_EQUAL(JoinWithNewline(fnames), JoinWithNewline(sorted)); diff --git a/util/folder/path.cpp b/util/folder/path.cpp index bfe0c67d687..e2392760670 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -89,7 +89,7 @@ TFsPath TFsPath::RelativePath(const TFsPath& root) const { if (cnt == 0 && !absboth) { ythrow TIoException() << "No common parts in " << *this << " and " << root; } - TString r; + TString r; for (size_t i = 0; i < rsplit.size() - cnt; i++) { r += i == 0 ? ".." : "/.."; } @@ -139,16 +139,16 @@ TFsPath& TFsPath::Fix() { return *this; } -TString TFsPath::GetName() const { +TString TFsPath::GetName() const { if (!IsDefined()) { - return TString(); + return TString(); } const TSplit& split = GetSplit(); if (split.size() > 0) { if (split.back() != "..") { - return TString(split.back()); + return TString(split.back()); } else { // cannot just drop last component, because path itself may be a symlink return RealPath().GetName(); @@ -162,8 +162,8 @@ TString TFsPath::GetName() const { } } -TString TFsPath::GetExtension() const { - return TString(GetSplit().Extension()); +TString TFsPath::GetExtension() const { + return TString(GetSplit().Extension()); } bool TFsPath::IsAbsolute() const { @@ -193,7 +193,7 @@ static Y_FORCE_INLINE void VerifyPath(const TStringBuf path) { TFsPath::TFsPath() { } -TFsPath::TFsPath(const TString& path) +TFsPath::TFsPath(const TString& path) : Path_(path) { VerifyPath(Path_); @@ -210,7 +210,7 @@ TFsPath::TFsPath(const char* path) { } -TFsPath TFsPath::Child(const TString& name) const { +TFsPath TFsPath::Child(const TString& name) const { if (!name) { ythrow TIoException() << "child name must not be empty"; } @@ -228,7 +228,7 @@ struct TClosedir { } }; -void TFsPath::ListNames(TVector<TString>& children) const { +void TFsPath::ListNames(TVector<TString>& children) const { CheckDefined(); THolder<DIR, TClosedir> dir(opendir(this->c_str())); if (!dir) { @@ -250,7 +250,7 @@ void TFsPath::ListNames(TVector<TString>& children) const { if (ok == nullptr) { return; } - TString name(de.d_name); + TString name(de.d_name); if (name == "." || name == "..") { continue; } @@ -275,15 +275,15 @@ bool TFsPath::Contains(const TString& component) const { return false; } -void TFsPath::List(TVector<TFsPath>& files) const { - TVector<TString> names; +void TFsPath::List(TVector<TFsPath>& files) const { + TVector<TString> names; ListNames(names); for (auto& name : names) { files.push_back(Child(name)); } } -void TFsPath::RenameTo(const TString& newPath) const { +void TFsPath::RenameTo(const TString& newPath) const { CheckDefined(); if (!newPath) { ythrow TIoException() << "bad new file name"; @@ -294,7 +294,7 @@ void TFsPath::RenameTo(const TString& newPath) const { } void TFsPath::RenameTo(const char* newPath) const { - RenameTo(TString(newPath)); + RenameTo(TString(newPath)); } void TFsPath::RenameTo(const TFsPath& newPath) const { @@ -407,7 +407,7 @@ void TFsPath::ForceDelete() const { ClearLastSystemError(); if (stat.IsDir()) { - TVector<TFsPath> children; + TVector<TFsPath> children; List(children); for (auto& i : children) { i.ForceDelete(); @@ -422,14 +422,14 @@ void TFsPath::ForceDelete() const { } } -void TFsPath::CopyTo(const TString& newPath, bool force) const { +void TFsPath::CopyTo(const TString& newPath, bool force) const { if (IsDirectory()) { if (force) { TFsPath(newPath).MkDirs(); } else if (!TFsPath(newPath).IsDirectory()) { ythrow TIoException() << "Target path is not a directory " << newPath; } - TVector<TFsPath> children; + TVector<TFsPath> children; List(children); for (auto&& i : children) { i.CopyTo(newPath + "/" + i.GetName(), force); @@ -449,7 +449,7 @@ void TFsPath::CopyTo(const TString& newPath, bool force) const { } } -void TFsPath::ForceRenameTo(const TString& newPath) const { +void TFsPath::ForceRenameTo(const TString& newPath) const { try { RenameTo(newPath); } catch (const TIoSystemError& /* error */) { diff --git a/util/folder/path.h b/util/folder/path.h index 2fb4d6b4ef3..1c987144925 100644 --- a/util/folder/path.h +++ b/util/folder/path.h @@ -5,7 +5,7 @@ #include <util/generic/ptr.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/string/cast.h> #include <util/system/fstat.h> @@ -25,7 +25,7 @@ private: public: TFsPath(); - TFsPath(const TString& path); + TFsPath(const TString& path); TFsPath(const TStringBuf path); TFsPath(const char* path); @@ -48,7 +48,7 @@ public: return Path_.c_str(); } - inline operator const TString&() const { + inline operator const TString&() const { return Path_; } @@ -71,19 +71,19 @@ public: TFsPath& Fix(); - inline const TString& GetPath() const { + inline const TString& GetPath() const { return Path_; } /// last component of path, or "/" if root - TString GetName() const; + TString GetName() const; /** * "a.b.tmp" -> "tmp" * "a.tmp" -> "tmp" * ".tmp" -> "" */ - TString GetExtension() const; + TString GetExtension() const; bool IsAbsolute() const; bool IsRelative() const; @@ -126,14 +126,14 @@ public: */ TFsPath Parent() const; - TString Basename() const { + TString Basename() const { return GetName(); } - TString Dirname() const { + TString Dirname() const { return Parent(); } - TFsPath Child(const TString& name) const; + TFsPath Child(const TString& name) const; /** * @brief create this directory @@ -152,8 +152,8 @@ public: void MkDirs(const int mode = MODE0777) const; // XXX: rewrite to return iterator - void List(TVector<TFsPath>& children) const; - void ListNames(TVector<TString>& children) const; + void List(TVector<TFsPath>& children) const; + void ListNames(TVector<TString>& children) const; // Check, if path contains at least one component with a specific name. bool Contains(const TString& component) const; @@ -181,12 +181,12 @@ public: /// throw TIoException if not exists void CheckExists() const; - void RenameTo(const TString& newPath) const; + void RenameTo(const TString& newPath) const; void RenameTo(const char* newPath) const; void RenameTo(const TFsPath& newFile) const; - void ForceRenameTo(const TString& newPath) const; + void ForceRenameTo(const TString& newPath) const; - void CopyTo(const TString& newPath, bool force) const; + void CopyTo(const TString& newPath, bool force) const; void Touch() const; @@ -197,7 +197,7 @@ public: /// always absolute static TFsPath Cwd(); - inline void Swap(TFsPath& p) noexcept { + inline void Swap(TFsPath& p) noexcept { DoSwap(Path_, p.Path_); Split_.Swap(p.Split_); } @@ -207,7 +207,7 @@ private: TSplit& GetSplit() const; private: - TString Path_; + TString Path_; /// cache mutable TSimpleIntrusivePtr<TSplit> Split_; }; @@ -224,7 +224,7 @@ namespace NPrivate { } template <class... Ts> -TString JoinFsPaths(Ts&&... args) { +TString JoinFsPaths(Ts&&... args) { TFsPath fsPath; ::NPrivate::AppendToFsPath(fsPath, std::forward<Ts>(args)...); return fsPath.GetPath(); diff --git a/util/folder/path_ut.cpp b/util/folder/path_ut.cpp index e6a34510164..595e727f2c6 100644 --- a/util/folder/path_ut.cpp +++ b/util/folder/path_ut.cpp @@ -26,23 +26,23 @@ namespace { TFsPath Path_; public: - TTestDirectory(const TString& name); + TTestDirectory(const TString& name); ~TTestDirectory(); TFsPath GetFsPath() const { return Path_; } - TFsPath Child(const TString& name) const { + TFsPath Child(const TString& name) const { return Path_.Child(name); } }; - TTestDirectory::TTestDirectory(const TString& name) { + TTestDirectory::TTestDirectory(const TString& name) { Y_VERIFY(name.length() > 0, "have to specify name"); - Y_VERIFY(name.find('.') == TString::npos, "must be simple name"); - Y_VERIFY(name.find('/') == TString::npos, "must be simple name"); - Y_VERIFY(name.find('\\') == TString::npos, "must be simple name"); + Y_VERIFY(name.find('.') == TString::npos, "must be simple name"); + Y_VERIFY(name.find('/') == TString::npos, "must be simple name"); + Y_VERIFY(name.find('\\') == TString::npos, "must be simple name"); Path_ = TFsPath(name); Path_.ForceDelete(); @@ -119,13 +119,13 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { Y_UNIT_TEST(GetName) { TTestDirectory d("GetName"); - UNIT_ASSERT_VALUES_EQUAL(TString("dfgh"), d.Child("dfgh").GetName()); + UNIT_ASSERT_VALUES_EQUAL(TString("dfgh"), d.Child("dfgh").GetName()); // check does not fail TFsPath(".").GetName(); #ifdef _unix_ - UNIT_ASSERT_VALUES_EQUAL(TString("/"), TFsPath("/").GetName()); + UNIT_ASSERT_VALUES_EQUAL(TString("/"), TFsPath("/").GetName()); #endif } @@ -235,11 +235,11 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { dir.Child("c").MkDir(); dir.Child("d").Touch(); - TVector<TString> children; + TVector<TString> children; dir.ListNames(children); std::sort(children.begin(), children.end()); - TVector<TString> expected; + TVector<TString> expected; expected.push_back("a"); expected.push_back("b"); expected.push_back("c"); @@ -430,16 +430,16 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { TTempDir tempDir; TFsPath tempDirPath(tempDir()); - const TString originDir = tempDirPath.Child("origin"); + const TString originDir = tempDirPath.Child("origin"); MakePathIfNotExist(originDir.c_str()); - const TString originFile = TFsPath(originDir).Child("data"); + const TString originFile = TFsPath(originDir).Child("data"); { - TFixedBufferFileOutput out(originFile); + TFixedBufferFileOutput out(originFile); out << "data111!!!"; } - const TString link = tempDirPath.Child("origin_symlink"); + const TString link = tempDirPath.Child("origin_symlink"); NFs::SymLink(originDir, link); TFsPath(link).ForceDelete(); @@ -453,16 +453,16 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { TTempDir tempDir; TFsPath tempDirPath(tempDir()); - const TString originDir = tempDirPath.Child("origin"); + const TString originDir = tempDirPath.Child("origin"); MakePathIfNotExist(originDir.c_str()); - const TString originFile = TFsPath(originDir).Child("data"); + const TString originFile = TFsPath(originDir).Child("data"); { - TFixedBufferFileOutput out(originFile); + TFixedBufferFileOutput out(originFile); out << "data111!!!"; } - const TString link = tempDirPath.Child("origin_symlink"); + const TString link = tempDirPath.Child("origin_symlink"); NFs::SymLink(originFile, link); TFsPath(link).ForceDelete(); @@ -476,19 +476,19 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { TTempDir tempDir; TFsPath tempDirPath(tempDir()); - const TString symlinkedDir = tempDirPath.Child("to_remove"); + const TString symlinkedDir = tempDirPath.Child("to_remove"); MakePathIfNotExist(symlinkedDir.c_str()); - const TString originDir = tempDirPath.Child("origin"); + const TString originDir = tempDirPath.Child("origin"); MakePathIfNotExist(originDir.c_str()); - const TString originFile = TFsPath(originDir).Child("data"); + const TString originFile = TFsPath(originDir).Child("data"); { - TFixedBufferFileOutput out(originFile); + TFixedBufferFileOutput out(originFile); out << "data111!!!"; } - const TString symlinkedFile = TFsPath(symlinkedDir).Child("origin_symlink"); + const TString symlinkedFile = TFsPath(symlinkedDir).Child("origin_symlink"); NFs::SymLink(originDir, symlinkedFile); TFsPath(symlinkedDir).ForceDelete(); @@ -503,19 +503,19 @@ Y_UNIT_TEST_SUITE(TFsPathTests) { TTempDir tempDir; TFsPath tempDirPath(tempDir()); - const TString symlinkedDir = tempDirPath.Child("to_remove"); + const TString symlinkedDir = tempDirPath.Child("to_remove"); MakePathIfNotExist(symlinkedDir.c_str()); - const TString originDir = tempDirPath.Child("origin"); + const TString originDir = tempDirPath.Child("origin"); MakePathIfNotExist(originDir.c_str()); - const TString originFile = TFsPath(originDir).Child("data"); + const TString originFile = TFsPath(originDir).Child("data"); { - TFixedBufferFileOutput out(originFile); + TFixedBufferFileOutput out(originFile); out << "data111!!!"; } - const TString symlinkedFile = TFsPath(symlinkedDir).Child("origin_symlink"); + const TString symlinkedFile = TFsPath(symlinkedDir).Child("origin_symlink"); NFs::SymLink(originFile, symlinkedFile); TFsPath(symlinkedDir).ForceDelete(); diff --git a/util/folder/pathsplit.cpp b/util/folder/pathsplit.cpp index 81d439a727b..44a4810fefc 100644 --- a/util/folder/pathsplit.cpp +++ b/util/folder/pathsplit.cpp @@ -85,8 +85,8 @@ void TPathSplitTraitsWindows::DoParsePart(const TStringBuf part0) { } } -TString TPathSplitStore::DoReconstruct(const TStringBuf slash) const { - TString r; +TString TPathSplitStore::DoReconstruct(const TStringBuf slash) const { + TString r; r.reserve(ToReserve(*this)); @@ -126,7 +126,7 @@ void Out<TPathSplit>(IOutputStream& o, const TPathSplit& ps) { o << ps.Reconstruct(); } -TString JoinPaths(const TPathSplit& p1, const TPathSplit& p2) { +TString JoinPaths(const TPathSplit& p1, const TPathSplit& p2) { if (p2.IsAbsolute) { ythrow yexception() << "can not join " << p1 << " and " << p2; } diff --git a/util/folder/pathsplit.h b/util/folder/pathsplit.h index d134338e35d..af14c672d4b 100644 --- a/util/folder/pathsplit.h +++ b/util/folder/pathsplit.h @@ -2,11 +2,11 @@ #include <util/generic/vector.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/ascii.h> //do not own any data -struct TPathSplitStore: public TVector<TStringBuf> { +struct TPathSplitStore: public TVector<TStringBuf> { TStringBuf Drive; bool IsAbsolute = false; @@ -14,7 +14,7 @@ struct TPathSplitStore: public TVector<TStringBuf> { TStringBuf Extension() const; protected: - TString DoReconstruct(const TStringBuf slash) const; + TString DoReconstruct(const TStringBuf slash) const; inline void DoAppendHint(size_t hint) { reserve(size() + hint); @@ -24,7 +24,7 @@ protected: struct TPathSplitTraitsUnix: public TPathSplitStore { static constexpr char MainPathSep = '/'; - inline TString Reconstruct() const { + inline TString Reconstruct() const { return DoReconstruct(TStringBuf("/")); } @@ -43,7 +43,7 @@ struct TPathSplitTraitsUnix: public TPathSplitStore { struct TPathSplitTraitsWindows: public TPathSplitStore { static constexpr char MainPathSep = '\\'; - inline TString Reconstruct() const { + inline TString Reconstruct() const { return DoReconstruct(TStringBuf("\\")); } @@ -108,6 +108,6 @@ using TPathSplit = TPathSplitBase<TPathSplitTraitsLocal>; using TPathSplitUnix = TPathSplitBase<TPathSplitTraitsUnix>; using TPathSplitWindows = TPathSplitBase<TPathSplitTraitsWindows>; -TString JoinPaths(const TPathSplit& p1, const TPathSplit& p2); +TString JoinPaths(const TPathSplit& p1, const TPathSplit& p2); TStringBuf CutExtension(const TStringBuf fileName); diff --git a/util/folder/tempdir.cpp b/util/folder/tempdir.cpp index 6fdf8f753c1..6574a530090 100644 --- a/util/folder/tempdir.cpp +++ b/util/folder/tempdir.cpp @@ -21,7 +21,7 @@ TTempDir::TTempDir(const char* prefix, TCreationToken) TempDir = tempDir; } -TTempDir::TTempDir(const TString& tempDir) +TTempDir::TTempDir(const TString& tempDir) : TempDir(tempDir) , Remove(true) { diff --git a/util/folder/tempdir.h b/util/folder/tempdir.h index ff458f83b9b..a6cac0cfc23 100644 --- a/util/folder/tempdir.h +++ b/util/folder/tempdir.h @@ -2,7 +2,7 @@ #include "fwd.h" #include "path.h" -#include <util/generic/string.h> +#include <util/generic/string.h> class TTempDir { public: @@ -10,18 +10,18 @@ public: TTempDir(); /// Create new directory with this fixed name. If it already exists, clear it. - TTempDir(const TString& tempDir); + TTempDir(const TString& tempDir); ~TTempDir(); /// Create new directory in given folder. static TTempDir NewTempDir(const TString& root); - const TString& operator()() const { + const TString& operator()() const { return Name(); } - const TString& Name() const { + const TString& Name() const { return TempDir.GetPath(); } diff --git a/util/generic/adaptor_ut.cpp b/util/generic/adaptor_ut.cpp index 721f849f934..3ce6437adda 100644 --- a/util/generic/adaptor_ut.cpp +++ b/util/generic/adaptor_ut.cpp @@ -34,8 +34,8 @@ struct TState { Y_UNIT_TEST_SUITE(TReverseAdaptor) { Y_UNIT_TEST(ReadTest) { - TVector<int> cont = {1, 2, 3}; - TVector<int> etalon = {3, 2, 1}; + TVector<int> cont = {1, 2, 3}; + TVector<int> etalon = {3, 2, 1}; size_t idx = 0; for (const auto& x : Reversed(cont)) { UNIT_ASSERT_VALUES_EQUAL(etalon[idx++], x); @@ -47,8 +47,8 @@ Y_UNIT_TEST_SUITE(TReverseAdaptor) { } Y_UNIT_TEST(WriteTest) { - TVector<int> cont = {1, 2, 3}; - TVector<int> etalon = {3, 6, 9}; + TVector<int> cont = {1, 2, 3}; + TVector<int> etalon = {3, 6, 9}; size_t idx = 0; for (auto& x : Reversed(cont)) { x *= x + idx++; @@ -60,7 +60,7 @@ Y_UNIT_TEST_SUITE(TReverseAdaptor) { } Y_UNIT_TEST(InnerTypeTest) { - using TStub = TVector<int>; + using TStub = TVector<int>; TStub stub; const TStub cstub; diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index badfb889933..12fd914c158 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -487,13 +487,13 @@ static inline Val InnerProduct(It1 begin1, It1 end1, It2 begin2, Val val, BinOp1 return std::inner_product(begin1, end1, begin2, val, binOp1, binOp2); } -template <typename TVectorType> -static inline typename TVectorType::value_type InnerProduct(const TVectorType& lhs, const TVectorType& rhs, typename TVectorType::value_type val = typename TVectorType::value_type()) { +template <typename TVectorType> +static inline typename TVectorType::value_type InnerProduct(const TVectorType& lhs, const TVectorType& rhs, typename TVectorType::value_type val = typename TVectorType::value_type()) { return std::inner_product(lhs.begin(), lhs.end(), rhs.begin(), val); } -template <typename TVectorType, typename BinOp1, typename BinOp2> -static inline typename TVectorType::value_type InnerProduct(const TVectorType& lhs, const TVectorType& rhs, typename TVectorType::value_type val, BinOp1 binOp1, BinOp2 binOp2) { +template <typename TVectorType, typename BinOp1, typename BinOp2> +static inline typename TVectorType::value_type InnerProduct(const TVectorType& lhs, const TVectorType& rhs, typename TVectorType::value_type val, BinOp1 binOp1, BinOp2 binOp2) { return std::inner_product(lhs.begin(), lhs.end(), rhs.begin(), val, binOp1, binOp2); } diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp index 8d732fcc0cf..45f35b7ca71 100644 --- a/util/generic/algorithm_ut.cpp +++ b/util/generic/algorithm_ut.cpp @@ -2,7 +2,7 @@ #include "algorithm.h" #include "strbuf.h" -#include "string.h" +#include "string.h" static auto isOne = [](char c) { return c == '1'; }; @@ -59,7 +59,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { struct TStrokaNoCopy: TString { public: TStrokaNoCopy(const char* p) - : TString(p) + : TString(p) { } @@ -80,11 +80,11 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { UNIT_ASSERT_VALUES_EQUAL(CountOf(0x61, 'a', 'b', 'c', 0x61), 2); UNIT_ASSERT_VALUES_EQUAL(CountOf(0x61, 'a', 'b', 'c', 0x61ll), 2); - // TString and const char * - UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), "123", "poi"), 0); - UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), "123", "poi", "xyz"), 1); + // TString and const char * + UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), "123", "poi"), 0); + UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), "123", "poi", "xyz"), 1); - // TString and TStringBuf + // TString and TStringBuf UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), TStringBuf("123"), TStringBuf("poi")), 0); UNIT_ASSERT_VALUES_EQUAL(CountOf(TString("xyz"), TStringBuf("123"), TStringBuf("poi"), TStringBuf("xyz")), @@ -94,10 +94,10 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), "123", "poi"), 0); UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), "123", "poi", "xyz"), 1); - // TStringBuf and TString + // TStringBuf and TString UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), TString("123"), TString("poi")), 0); UNIT_ASSERT_VALUES_EQUAL(CountOf(TStringBuf("xyz"), TString("123"), TString("poi"), - TString("xyz")), + TString("xyz")), 1); } @@ -221,7 +221,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { UNIT_ASSERT_EQUAL(2, FindIndex(array, 3)); UNIT_ASSERT_EQUAL(NPOS, FindIndex(array, 42)); - TVector<int> empty; + TVector<int> empty; UNIT_ASSERT_EQUAL(NPOS, FindIndex(empty, 0)); } @@ -249,33 +249,33 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { Y_UNIT_TEST(SortUniqueTest) { { - TVector<TString> v; + TVector<TString> v; SortUnique(v); - UNIT_ASSERT_EQUAL(v, TVector<TString>()); + UNIT_ASSERT_EQUAL(v, TVector<TString>()); } { const char* ar[] = {"345", "3", "123", "2", "23", "3", "2"}; - TVector<TString> v(ar, ar + Y_ARRAY_SIZE(ar)); + TVector<TString> v(ar, ar + Y_ARRAY_SIZE(ar)); SortUnique(v); const char* suAr[] = {"123", "2", "23", "3", "345"}; - TVector<TString> suV(suAr, suAr + Y_ARRAY_SIZE(suAr)); + TVector<TString> suV(suAr, suAr + Y_ARRAY_SIZE(suAr)); UNIT_ASSERT_EQUAL(v, suV); } } Y_UNIT_TEST(EraseTest) { - TVector<int> data = {5, 4, 3, 2, 1, 0}; - TVector<int> expected = {5, 4, 2, 1, 0}; + TVector<int> data = {5, 4, 3, 2, 1, 0}; + TVector<int> expected = {5, 4, 2, 1, 0}; Erase(data, 3); UNIT_ASSERT_EQUAL(data, expected); } Y_UNIT_TEST(EraseIfTest) { - TVector<int> data = {5, 4, 3, 2, 1, 0}; - TVector<int> expected = {2, 1, 0}; + TVector<int> data = {5, 4, 3, 2, 1, 0}; + TVector<int> expected = {2, 1, 0}; EraseIf(data, [](int i) { return i >= 3; }); UNIT_ASSERT_EQUAL(data, expected); } @@ -314,14 +314,14 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { Y_UNIT_TEST(NthElementTest) { { - TVector<TString> v; + TVector<TString> v; NthElement(v.begin(), v.begin(), v.end()); - UNIT_ASSERT_EQUAL(v, TVector<TString>()); + UNIT_ASSERT_EQUAL(v, TVector<TString>()); } { int data[] = {3, 2, 1, 4, 6, 5, 7, 9, 8}; - TVector<int> testVector(data, data + Y_ARRAY_SIZE(data)); + TVector<int> testVector(data, data + Y_ARRAY_SIZE(data)); size_t medianInd = testVector.size() / 2; @@ -334,7 +334,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { { const char* data[] = {"3", "234", "1231", "333", "545345", "11", "111", "55", "66"}; - TVector<TString> testVector(data, data + Y_ARRAY_SIZE(data)); + TVector<TString> testVector(data, data + Y_ARRAY_SIZE(data)); size_t medianInd = testVector.size() / 2; NthElement(testVector.begin(), testVector.begin() + medianInd, testVector.end()); @@ -350,7 +350,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { Y_UNIT_TEST(BinarySearchTest) { { - TVector<TString> v; + TVector<TString> v; bool test = BinarySearch(v.begin(), v.end(), "test"); UNIT_ASSERT_EQUAL(test, false); } @@ -366,7 +366,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } { - TVector<size_t> data = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; + TVector<size_t> data = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; bool test = BinarySearch(data.begin(), data.end(), (size_t)9, TGreater<size_t>()); UNIT_ASSERT_EQUAL(test, true); @@ -381,8 +381,8 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { Y_UNIT_TEST(EqualRangeTest) { { - TVector<TString> v; - using PairOfVector = std::pair<TVector<TString>::iterator, TVector<TString>::iterator>; + TVector<TString> v; + using PairOfVector = std::pair<TVector<TString>::iterator, TVector<TString>::iterator>; PairOfVector tmp = EqualRange(v.begin(), v.end(), "tmp"); UNIT_ASSERT_EQUAL(tmp.first, tmp.second); @@ -400,15 +400,15 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } { - TVector<size_t> data = {9, 9, 8, 8, 8, 5, 4, 3, 3, 0, 0}; + TVector<size_t> data = {9, 9, 8, 8, 8, 5, 4, 3, 3, 0, 0}; - using PairOfVector = std::pair<TVector<size_t>::iterator, TVector<size_t>::iterator>; + using PairOfVector = std::pair<TVector<size_t>::iterator, TVector<size_t>::iterator>; PairOfVector tmp = EqualRange(data.begin(), data.end(), 8, TGreater<size_t>()); UNIT_ASSERT_EQUAL(tmp.first - data.begin(), 2); UNIT_ASSERT_EQUAL(tmp.second - tmp.first, 3); - using PairOfVectorReverse = std::pair<TVector<size_t>::reverse_iterator, TVector<size_t>::reverse_iterator>; + using PairOfVectorReverse = std::pair<TVector<size_t>::reverse_iterator, TVector<size_t>::reverse_iterator>; PairOfVectorReverse tmpR = EqualRange(data.rbegin(), data.rend(), (size_t)0); UNIT_ASSERT_EQUAL(tmpR.first, data.rbegin()); @@ -417,15 +417,15 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(IsSortedTest) { - TVector<int> v0; + TVector<int> v0; UNIT_ASSERT_VALUES_EQUAL(IsSorted(v0.begin(), v0.end()), true); - TVector<int> v1 = {1, 2, 3, 4, 5, 5, 5, 6, 6, 7, 8}; + TVector<int> v1 = {1, 2, 3, 4, 5, 5, 5, 6, 6, 7, 8}; UNIT_ASSERT_VALUES_EQUAL(IsSorted(v1.begin(), v1.end()), true); UNIT_ASSERT_VALUES_EQUAL(IsSorted(v1.begin(), v1.end(), TLess<int>()), true); UNIT_ASSERT_VALUES_EQUAL(IsSorted(v1.begin(), v1.end(), TGreater<int>()), false); - TVector<int> v2 = {1, 2, 1}; + TVector<int> v2 = {1, 2, 1}; UNIT_ASSERT_VALUES_EQUAL(IsSorted(v2.begin(), v2.end()), false); UNIT_ASSERT_VALUES_EQUAL(IsSorted(v2.begin(), v2.end(), TLess<int>()), false); UNIT_ASSERT_VALUES_EQUAL(IsSorted(v2.begin(), v2.end(), TGreater<int>()), false); @@ -502,35 +502,35 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(SortByTest) { - TVector<int> collection = {10, 2, 7}; + TVector<int> collection = {10, 2, 7}; SortBy(collection, [](int x) { return -x; }); - TVector<int> expected = {10, 7, 2}; + TVector<int> expected = {10, 7, 2}; UNIT_ASSERT_VALUES_EQUAL(collection, expected); } Y_UNIT_TEST(StableSortByTest) { - TVector<int> collection = {404, 101, 106, 203, 102, 205, 401}; + TVector<int> collection = {404, 101, 106, 203, 102, 205, 401}; StableSortBy(collection, [](int x) { return x / 100; }); - TVector<int> expected = {101, 106, 102, 203, 205, 404, 401}; + TVector<int> expected = {101, 106, 102, 203, 205, 404, 401}; UNIT_ASSERT_VALUES_EQUAL(collection, expected); } Y_UNIT_TEST(SortUniqueByTest) { - TVector<int> collection = {404, 101, 101, 203, 101, 203, 404}; + TVector<int> collection = {404, 101, 101, 203, 101, 203, 404}; StableSortUniqueBy(collection, [](int x) { return x / 100; }); - TVector<int> expected = {101, 203, 404}; + TVector<int> expected = {101, 203, 404}; UNIT_ASSERT_VALUES_EQUAL(collection, expected); } Y_UNIT_TEST(StableSortUniqueByTest) { - TVector<int> collection = {404, 101, 106, 203, 102, 205, 401}; + TVector<int> collection = {404, 101, 106, 203, 102, 205, 401}; StableSortUniqueBy(collection, [](int x) { return x / 100; }); - TVector<int> expected = {101, 203, 404}; + TVector<int> expected = {101, 203, 404}; UNIT_ASSERT_VALUES_EQUAL(collection, expected); } Y_UNIT_TEST(IotaTest) { - TVector<int> v(10); + TVector<int> v(10); Iota(v.begin(), v.end(), 0); UNIT_ASSERT_VALUES_EQUAL(v[0], 0); @@ -546,10 +546,10 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { Y_UNIT_TEST(CopyNTest) { int data[] = {1, 2, 3, 4, 8, 7, 6, 5}; const size_t vSize = 10; - TVector<int> result(10, 0); + TVector<int> result(10, 0); size_t toCopy = 5; - TVector<int>::iterator iter = CopyN(data, toCopy, result.begin()); + TVector<int>::iterator iter = CopyN(data, toCopy, result.begin()); UNIT_ASSERT_VALUES_EQUAL(iter - result.begin(), toCopy); UNIT_ASSERT_VALUES_EQUAL(result.size(), 10); for (size_t idx = 0; idx < toCopy; ++idx) { @@ -579,9 +579,9 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { const size_t count = 9; int data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; const size_t vSize = 10; - TVector<int> v(vSize, 0); + TVector<int> v(vSize, 0); - TVector<int>::iterator iter = CopyIf(data, data + count, v.begin(), [](int x) { return !(x % 3); }); + TVector<int>::iterator iter = CopyIf(data, data + count, v.begin(), [](int x) { return !(x % 3); }); UNIT_ASSERT_VALUES_EQUAL(v.size(), vSize); UNIT_ASSERT_VALUES_EQUAL(iter - v.begin(), 3); v.resize(iter - v.begin()); @@ -591,7 +591,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(MinMaxElementTest) { - TVector<int> v(10); + TVector<int> v(10); Iota(v.begin(), v.end(), 0); UNIT_ASSERT_EQUAL(*MinMaxElement(v.begin(), v.end()).first, 0); UNIT_ASSERT_EQUAL(*MinMaxElement(v.begin(), v.end()).second, 9); @@ -607,9 +607,9 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { UNIT_ASSERT_EQUAL(p1.first, 5); UNIT_ASSERT_EQUAL(p1.second, 12); - std::pair<TString, TString> p2 = MinMax(TString("test"), TString("data")); - UNIT_ASSERT_EQUAL(p2.first, TString("data")); - UNIT_ASSERT_EQUAL(p2.second, TString("test")); + std::pair<TString, TString> p2 = MinMax(TString("test"), TString("data")); + UNIT_ASSERT_EQUAL(p2.first, TString("data")); + UNIT_ASSERT_EQUAL(p2.second, TString("test")); } Y_UNIT_TEST(TestMaxElementBy) { @@ -618,7 +618,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { return x * x; }), 5); - const TVector<int> vec(array, array + Y_ARRAY_SIZE(array)); + const TVector<int> vec(array, array + Y_ARRAY_SIZE(array)); UNIT_ASSERT_VALUES_EQUAL(*MaxElementBy(vec, [](int x) { return -1.0 * x; }), 1); @@ -634,8 +634,8 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { auto singleElementSequence = {'z'}; UNIT_ASSERT_VALUES_EQUAL(*MaxElementBy(singleElementSequence, identity), 'z'); - const TString strings[] = {"one", "two", "three", "four"}; - UNIT_ASSERT_STRINGS_EQUAL(*MaxElementBy(strings, [](TString s) { return s.size(); }), "three"); + const TString strings[] = {"one", "two", "three", "four"}; + UNIT_ASSERT_STRINGS_EQUAL(*MaxElementBy(strings, [](TString s) { return s.size(); }), "three"); } Y_UNIT_TEST(TestMinElementBy) { @@ -644,7 +644,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { return 'a' + x; }), 1); - const TVector<int> vec(std::begin(array), std::end(array)); + const TVector<int> vec(std::begin(array), std::end(array)); UNIT_ASSERT_VALUES_EQUAL(*MinElementBy(vec, [](int x) { return -x; }), 5); @@ -660,7 +660,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { auto singleElementSequence = {'z'}; UNIT_ASSERT_VALUES_EQUAL(*MinElementBy(singleElementSequence, identity), 'z'); - const TVector<TStringBuf> strings = {"one", "two", "three", "four"}; + const TVector<TStringBuf> strings = {"one", "two", "three", "four"}; auto stringLength = [](TStringBuf s) { return s.size(); }; @@ -669,12 +669,12 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(MaxElementByReturnsEndForEmptyRange) { - const TVector<int> empty; + const TVector<int> empty; UNIT_ASSERT_EQUAL(MaxElementBy(empty, [](int) { return 0; }), empty.end()); } Y_UNIT_TEST(MaxElementByDoesntCallFunctorForEmptyRange) { - const TVector<int> empty; + const TVector<int> empty; auto functor = [](int) { UNIT_ASSERT(false); return 0; @@ -683,12 +683,12 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(MinElementByReturnsEndForEmptyRange) { - const TVector<int> empty; + const TVector<int> empty; UNIT_ASSERT_EQUAL(MinElementBy(empty, [](int) { return 0; }), empty.end()); } Y_UNIT_TEST(MinElementByDoesntCallFunctorForEmptyRange) { - const TVector<int> empty; + const TVector<int> empty; auto functor = [](int) { UNIT_ASSERT(false); return 0; @@ -764,7 +764,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { UNIT_ASSERT_EQUAL(FindIf(array, [](int x) { return x == 1; }), begin(array)); UNIT_ASSERT_EQUAL(FindIf(array, [](int x) { return x > 5; }), end(array)); - TVector<int> vector = {1, 2, 3, 4, 5}; + TVector<int> vector = {1, 2, 3, 4, 5}; UNIT_ASSERT_EQUAL(FindIf(vector, [](int x) { return x == 1; }), begin(vector)); UNIT_ASSERT_EQUAL(FindIf(vector, [](int x) { return x > 5; }), end(vector)); @@ -773,7 +773,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { *iter = 5; // Compilability test. Check if the returned iterator is const. Should not compile - const TVector<int> constVector = {1, 2, 3, 4, 5}; + const TVector<int> constVector = {1, 2, 3, 4, 5}; auto constIter = FindIf(constVector, [](int x) { return x == 1; }); Y_UNUSED(constIter); // *constIter = 5; @@ -798,7 +798,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(TestLowerBoundBy) { - using TIntPairs = TVector<std::pair<i32, i32>>; + using TIntPairs = TVector<std::pair<i32, i32>>; auto data = TIntPairs{{1, 5}, {3, 2}, {3, 4}, {8, 0}, {5, 4}}; auto getKey = [](const auto& x) { return x.second; }; @@ -818,7 +818,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) { } Y_UNIT_TEST(TestUpperBoundBy) { - using TIntPairs = TVector<std::pair<i32, i32>>; + using TIntPairs = TVector<std::pair<i32, i32>>; auto data = TIntPairs{{1, 5}, {3, 2}, {3, 4}, {8, 0}, {5, 4}}; auto getKey = [](const auto& x) { return x.second; }; diff --git a/util/generic/array_ref_ut.cpp b/util/generic/array_ref_ut.cpp index 4c8eaf7135a..a8588f65ecf 100644 --- a/util/generic/array_ref_ut.cpp +++ b/util/generic/array_ref_ut.cpp @@ -1,7 +1,7 @@ -#include "array_ref.h" - +#include "array_ref.h" + #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TestArrayRef) { Y_UNIT_TEST(TestDefaultConstructor) { TArrayRef<int> defaulted; @@ -65,10 +65,10 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { UNIT_ASSERT(iterator != r.end()); UNIT_ASSERT_VALUES_EQUAL(i, *iterator); ++iterator; - } + } UNIT_ASSERT(iterator == r.end()); } - + Y_UNIT_TEST(TestReverseIterators) { const int x[] = {1, 2, 3}; const TArrayRef<const int> rx{x}; @@ -80,8 +80,8 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { UNIT_ASSERT_VALUES_EQUAL(*i, 1); ++i; UNIT_ASSERT_EQUAL(i, rx.crend()); - } - + } + Y_UNIT_TEST(TestConstIterators) { int x[] = {1, 2, 3}; TArrayRef<int> rx{x}; @@ -121,16 +121,16 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { Y_UNIT_TEST(TestCreatingFromStringLiteral) { TConstArrayRef<char> knownSizeRef("123", 3); - size_t ret = 0; - + size_t ret = 0; + for (char ch : knownSizeRef) { - ret += ch - '0'; - } - - UNIT_ASSERT_VALUES_EQUAL(ret, 6); + ret += ch - '0'; + } + + UNIT_ASSERT_VALUES_EQUAL(ret, 6); UNIT_ASSERT_VALUES_EQUAL(knownSizeRef.size(), 3); UNIT_ASSERT_VALUES_EQUAL(knownSizeRef.at(0), '1'); - + /* * When TArrayRef is being constructed from string literal, * trailing zero will be added into it. @@ -138,7 +138,7 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { TConstArrayRef<char> autoSizeRef("456"); UNIT_ASSERT_VALUES_EQUAL(autoSizeRef[0], '4'); UNIT_ASSERT_VALUES_EQUAL(autoSizeRef[3], '\0'); - } + } Y_UNIT_TEST(TestEqualityOperator) { static constexpr size_t size = 5; @@ -174,10 +174,10 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { auto fc = [](TArrayRef<const int>) {}; auto fm = [](TArrayRef<int>) {}; - fc(TVector<int>({1})); + fc(TVector<int>({1})); - const TVector<int> ac = {1}; - TVector<int> am = {1}; + const TVector<int> ac = {1}; + TVector<int> am = {1}; fc(ac); fc(am); @@ -319,4 +319,4 @@ Y_UNIT_TEST_SUITE(TestArrayRef) { const TVector<int> constData; Foo(MakeConstArrayRef(constData)); } -} +} diff --git a/util/generic/benchmark/fastclp2/main.cpp b/util/generic/benchmark/fastclp2/main.cpp index 49277db077c..bd01f97d23a 100644 --- a/util/generic/benchmark/fastclp2/main.cpp +++ b/util/generic/benchmark/fastclp2/main.cpp @@ -19,7 +19,7 @@ namespace { } } - TVector<T> Examples; + TVector<T> Examples; }; } diff --git a/util/generic/benchmark/log2/main.cpp b/util/generic/benchmark/log2/main.cpp index 969f09a3090..61dcafa3195 100644 --- a/util/generic/benchmark/log2/main.cpp +++ b/util/generic/benchmark/log2/main.cpp @@ -11,7 +11,7 @@ namespace { template <typename T, size_t N> struct TExamplesHolder { - TVector<T> Examples; + TVector<T> Examples; TExamplesHolder() : Examples(N) diff --git a/util/generic/benchmark/rotate_bits/main.cpp b/util/generic/benchmark/rotate_bits/main.cpp index 057edbe864f..31019f15082 100644 --- a/util/generic/benchmark/rotate_bits/main.cpp +++ b/util/generic/benchmark/rotate_bits/main.cpp @@ -25,7 +25,7 @@ namespace { } } - TVector<TExample<T>> Examples; + TVector<TExample<T>> Examples; }; } diff --git a/util/generic/benchmark/sort/main.cpp b/util/generic/benchmark/sort/main.cpp index d58f491f4d5..fce7ef06ef3 100644 --- a/util/generic/benchmark/sort/main.cpp +++ b/util/generic/benchmark/sort/main.cpp @@ -5,7 +5,7 @@ #include <util/generic/xrange.h> Y_CPU_BENCHMARK(Sort1, iface) { - TVector<int> x = {1}; + TVector<int> x = {1}; for (const auto i : xrange(iface.Iterations())) { Y_UNUSED(i); @@ -14,7 +14,7 @@ Y_CPU_BENCHMARK(Sort1, iface) { } Y_CPU_BENCHMARK(Sort2, iface) { - TVector<int> x = {2, 1}; + TVector<int> x = {2, 1}; for (const auto i : xrange(iface.Iterations())) { Y_UNUSED(i); @@ -23,7 +23,7 @@ Y_CPU_BENCHMARK(Sort2, iface) { } Y_CPU_BENCHMARK(Sort4, iface) { - TVector<int> x = {4, 3, 2, 1}; + TVector<int> x = {4, 3, 2, 1}; for (const auto i : xrange(iface.Iterations())) { Y_UNUSED(i); @@ -32,7 +32,7 @@ Y_CPU_BENCHMARK(Sort4, iface) { } Y_CPU_BENCHMARK(Sort16, iface) { - TVector<int> x = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; + TVector<int> x = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; for (const auto i : xrange(iface.Iterations())) { Y_UNUSED(i); @@ -41,7 +41,7 @@ Y_CPU_BENCHMARK(Sort16, iface) { } Y_CPU_BENCHMARK(StableSort1, iface) { - TVector<int> x = {1}; + TVector<int> x = {1}; for (const auto i : xrange(iface.Iterations())) { Y_UNUSED(i); @@ -50,7 +50,7 @@ Y_CPU_BENCHMARK(StableSort1, iface) { } Y_CPU_BENCHMARK(StableSort2, iface) { - TVector<int> x = {2, 1}; + TVector<int> x = {2, 1}; for (const auto i : xrange(iface.Iterations())) { Y_UNUSED(i); @@ -59,7 +59,7 @@ Y_CPU_BENCHMARK(StableSort2, iface) { } Y_CPU_BENCHMARK(StableSort4, iface) { - TVector<int> x = {4, 3, 2, 1}; + TVector<int> x = {4, 3, 2, 1}; for (const auto i : xrange(iface.Iterations())) { Y_UNUSED(i); @@ -68,7 +68,7 @@ Y_CPU_BENCHMARK(StableSort4, iface) { } Y_CPU_BENCHMARK(StableSort16, iface) { - TVector<int> x = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; + TVector<int> x = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; for (const auto i : xrange(iface.Iterations())) { Y_UNUSED(i); diff --git a/util/generic/benchmark/vector_count_ctor/f.cpp b/util/generic/benchmark/vector_count_ctor/f.cpp index b89e351ba72..f758faf8082 100644 --- a/util/generic/benchmark/vector_count_ctor/f.cpp +++ b/util/generic/benchmark/vector_count_ctor/f.cpp @@ -8,7 +8,7 @@ void CreateYvector(const size_t size, const size_t count) { for (size_t i = 0; i < count; ++i) { NBench::Clobber(); - TVector<ui8> v(size); + TVector<ui8> v(size); NBench::Escape(v.data()); NBench::Clobber(); } diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h index f77d1824607..ca82f88bc67 100644 --- a/util/generic/bitmap.h +++ b/util/generic/bitmap.h @@ -25,7 +25,7 @@ namespace NBitMapPrivate { // better than intrinsics without -mpopcnt template <typename T> - static unsigned CountBitsPrivate(T v) noexcept { + static unsigned CountBitsPrivate(T v) noexcept { return static_cast<unsigned>(ByteSums(v) >> 56); } diff --git a/util/generic/bitops.h b/util/generic/bitops.h index 2db15fc59b6..11d3b78f3db 100644 --- a/util/generic/bitops.h +++ b/util/generic/bitops.h @@ -14,7 +14,7 @@ namespace NBitOps { namespace NPrivate { template <unsigned N, typename T> struct TClp2Helper { - static Y_FORCE_INLINE T Calc(T t) noexcept { + static Y_FORCE_INLINE T Calc(T t) noexcept { const T prev = TClp2Helper<N / 2, T>::Calc(t); return prev | (prev >> N); @@ -23,7 +23,7 @@ namespace NBitOps { template <typename T> struct TClp2Helper<0u, T> { - static Y_FORCE_INLINE T Calc(T t) noexcept { + static Y_FORCE_INLINE T Calc(T t) noexcept { return t - 1; } }; @@ -58,24 +58,24 @@ namespace NBitOps { } #if defined(__GNUC__) - inline unsigned GetValueBitCountImpl(unsigned int value) noexcept { + inline unsigned GetValueBitCountImpl(unsigned int value) noexcept { Y_ASSERT(value); // because __builtin_clz* have undefined result for zero. return std::numeric_limits<unsigned int>::digits - __builtin_clz(value); } - inline unsigned GetValueBitCountImpl(unsigned long value) noexcept { + inline unsigned GetValueBitCountImpl(unsigned long value) noexcept { Y_ASSERT(value); // because __builtin_clz* have undefined result for zero. return std::numeric_limits<unsigned long>::digits - __builtin_clzl(value); } - inline unsigned GetValueBitCountImpl(unsigned long long value) noexcept { + inline unsigned GetValueBitCountImpl(unsigned long long value) noexcept { Y_ASSERT(value); // because __builtin_clz* have undefined result for zero. return std::numeric_limits<unsigned long long>::digits - __builtin_clzll(value); } #else /// Stupid realization for non-GCC. Can use BSR from x86 instructions set. template <typename T> - inline unsigned GetValueBitCountImpl(T value) noexcept { + inline unsigned GetValueBitCountImpl(T value) noexcept { Y_ASSERT(value); // because __builtin_clz* have undefined result for zero. unsigned result = 1; // result == 0 - impossible value, see Y_ASSERT(). value >>= 1; @@ -89,24 +89,24 @@ namespace NBitOps { #endif #if defined(__GNUC__) - inline unsigned CountTrailingZeroBitsImpl(unsigned int value) noexcept { + inline unsigned CountTrailingZeroBitsImpl(unsigned int value) noexcept { Y_ASSERT(value); // because __builtin_ctz* have undefined result for zero. return __builtin_ctz(value); } - inline unsigned CountTrailingZeroBitsImpl(unsigned long value) noexcept { + inline unsigned CountTrailingZeroBitsImpl(unsigned long value) noexcept { Y_ASSERT(value); // because __builtin_ctz* have undefined result for zero. return __builtin_ctzl(value); } - inline unsigned CountTrailingZeroBitsImpl(unsigned long long value) noexcept { + inline unsigned CountTrailingZeroBitsImpl(unsigned long long value) noexcept { Y_ASSERT(value); // because __builtin_ctz* have undefined result for zero. return __builtin_ctzll(value); } #else /// Stupid realization for non-GCC. Can use BSF from x86 instructions set. template <typename T> - inline unsigned CountTrailingZeroBitsImpl(T value) noexcept { + inline unsigned CountTrailingZeroBitsImpl(T value) noexcept { Y_ASSERT(value); // because __builtin_ctz* have undefined result for zero. unsigned result = 0; while (!(value & 1)) { @@ -206,7 +206,7 @@ namespace NBitOps { * Result is undefined for `t == 0`. */ template <typename T> -static inline T FastClp2(T t) noexcept { +static inline T FastClp2(T t) noexcept { Y_ASSERT(t > 0); using TCvt = typename ::TUnsignedInts::template TSelectBy<TSizeOfPredicate<sizeof(T)>::template TResult>::type; return 1 + ::NBitOps::NPrivate::TClp2Helper<sizeof(TCvt) * 4, T>::Calc(static_cast<TCvt>(t)); @@ -224,7 +224,7 @@ Y_CONST_FUNCTION constexpr bool IsPowerOf2(T v) noexcept { * Returns the number of leading 0-bits in `value`, starting at the most significant bit position. */ template <typename T> -static inline unsigned GetValueBitCount(T value) noexcept { +static inline unsigned GetValueBitCount(T value) noexcept { Y_ASSERT(value > 0); using TCvt = typename ::TUnsignedInts::template TSelectBy<TSizeOfPredicate<sizeof(T)>::template TResult>::type; return ::NBitOps::NPrivate::GetValueBitCountImpl(static_cast<TCvt>(value)); @@ -234,7 +234,7 @@ static inline unsigned GetValueBitCount(T value) noexcept { * Returns the number of trailing 0-bits in `value`, starting at the least significant bit position */ template <typename T> -static inline unsigned CountTrailingZeroBits(T value) noexcept { +static inline unsigned CountTrailingZeroBits(T value) noexcept { Y_ASSERT(value > 0); using TCvt = typename ::TUnsignedInts::template TSelectBy<TSizeOfPredicate<sizeof(T)>::template TResult>::type; return ::NBitOps::NPrivate::CountTrailingZeroBitsImpl(static_cast<TCvt>(value)); diff --git a/util/generic/bt_exception.h b/util/generic/bt_exception.h index 018d2bc89a1..12333e0c4b8 100644 --- a/util/generic/bt_exception.h +++ b/util/generic/bt_exception.h @@ -15,7 +15,7 @@ public: BT_.Capture(); } - const TBackTrace* BackTrace() const noexcept override { + const TBackTrace* BackTrace() const noexcept override { return &BT_; } diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp index b92697e1d00..70f0539d046 100644 --- a/util/generic/buffer.cpp +++ b/util/generic/buffer.cpp @@ -89,11 +89,11 @@ void TBuffer::Realloc(size_t len) { Len_ = len; } -TBuffer::~TBuffer() { +TBuffer::~TBuffer() { y_deallocate(Data_); } -void TBuffer::AsString(TString& s) { +void TBuffer::AsString(TString& s) { s.assign(Data(), Size()); Clear(); } diff --git a/util/generic/buffer.h b/util/generic/buffer.h index 95764674049..f2b29a61b60 100644 --- a/util/generic/buffer.h +++ b/util/generic/buffer.h @@ -35,18 +35,18 @@ public: return *this; } - ~TBuffer(); + ~TBuffer(); - inline void Clear() noexcept { + inline void Clear() noexcept { Pos_ = 0; } - inline void EraseBack(size_t n) noexcept { + inline void EraseBack(size_t n) noexcept { Y_ASSERT(n <= Pos_); Pos_ -= n; } - inline void Reset() noexcept { + inline void Reset() noexcept { TBuffer().Swap(*this); } @@ -59,24 +59,24 @@ public: Assign(b, e - b); } - inline char* Data() noexcept { + inline char* Data() noexcept { return Data_; } - inline const char* Data() const noexcept { + inline const char* Data() const noexcept { return Data_; } - inline char* Pos() noexcept { + inline char* Pos() noexcept { return Data_ + Pos_; } - inline const char* Pos() const noexcept { + inline const char* Pos() const noexcept { return Data_ + Pos_; } /// Used space in bytes (do not mix with Capacity!) - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return Pos_; } @@ -84,11 +84,11 @@ public: return !Size(); } - inline explicit operator bool() const noexcept { + inline explicit operator bool() const noexcept { return Size(); } - inline size_t Avail() const noexcept { + inline size_t Avail() const noexcept { return Len_ - Pos_; } @@ -170,7 +170,7 @@ public: Pos_ = len; } - inline size_t Capacity() const noexcept { + inline size_t Capacity() const noexcept { return Len_; } @@ -193,7 +193,7 @@ public: return Size(); } - inline void Swap(TBuffer& r) noexcept { + inline void Swap(TBuffer& r) noexcept { DoSwap(Data_, r.Data_); DoSwap(Len_, r.Len_); DoSwap(Pos_, r.Pos_); @@ -202,24 +202,24 @@ public: /* * after this call buffer becomes empty */ - void AsString(TString& s); + void AsString(TString& s); /* * iterator-like interface */ - inline TIterator Begin() noexcept { + inline TIterator Begin() noexcept { return Data(); } - inline TIterator End() noexcept { + inline TIterator End() noexcept { return Begin() + Size(); } - inline TConstIterator Begin() const noexcept { + inline TConstIterator Begin() const noexcept { return Data(); } - inline TConstIterator End() const noexcept { + inline TConstIterator End() const noexcept { return Begin() + Size(); } diff --git a/util/generic/buffer_ut.cpp b/util/generic/buffer_ut.cpp index 437d7122ec2..ba4c2e94bb8 100644 --- a/util/generic/buffer_ut.cpp +++ b/util/generic/buffer_ut.cpp @@ -1,7 +1,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/system/datetime.h> -#include "string.h" +#include "string.h" #include "vector.h" #include "buffer.h" @@ -21,7 +21,7 @@ Y_UNIT_TEST_SUITE(TBufferTest) { const char data[] = "1234567890qwertyuiop"; TBuffer buf(13); - TString str; + TString str; for (size_t i = 0; i < 10; ++i) { for (size_t j = 0; j < sizeof(data) - 1; ++j) { @@ -91,11 +91,11 @@ Y_UNIT_TEST_SUITE(TBufferTest) { buf.Append('a'); UNIT_ASSERT_EQUAL(buf.Capacity(), 256); - TString tmp1 = "abcdef"; + TString tmp1 = "abcdef"; buf.Append(tmp1.data(), tmp1.size()); UNIT_ASSERT_EQUAL(buf.Capacity(), 256); - TString tmp2 = "30498290sfokdsflj2308w"; + TString tmp2 = "30498290sfokdsflj2308w"; buf.Resize(1020); buf.Append(tmp2.data(), tmp2.size()); UNIT_ASSERT_EQUAL(buf.Capacity(), 2048); @@ -104,7 +104,7 @@ Y_UNIT_TEST_SUITE(TBufferTest) { Y_UNIT_TEST(TestShrinkToFit) { TBuffer buf; - TString content = "some text"; + TString content = "some text"; buf.Append(content.data(), content.size()); UNIT_ASSERT_EQUAL(buf.Size(), 9); UNIT_ASSERT_EQUAL(buf.Capacity(), 16); @@ -134,13 +134,13 @@ Y_UNIT_TEST(TestAlignUp) { buf.AlignUp(4, '!'); UNIT_ASSERT(buf.Size() % 4 == 0); - UNIT_ASSERT_VALUES_EQUAL(TString(~buf, +buf), "some text!!!"); + UNIT_ASSERT_VALUES_EQUAL(TString(~buf, +buf), "some text!!!"); char addContent[] = "1234"; buf.Append(addContent, sizeof(addContent)); buf.AlignUp(4, 'X'); UNIT_ASSERT(buf.Size() % 4 == 0); - UNIT_ASSERT_VALUES_EQUAL(TString(~buf, +buf), "some text!!!1234"); + UNIT_ASSERT_VALUES_EQUAL(TString(~buf, +buf), "some text!!!1234"); } #endif @@ -164,7 +164,7 @@ Y_UNIT_TEST(TestSpeed) { } { - TVector<char> buf; + TVector<char> buf; t2 = MicroSeconds(); diff --git a/util/generic/cast.h b/util/generic/cast.h index 0d4a41f385b..792de223684 100644 --- a/util/generic/cast.h +++ b/util/generic/cast.h @@ -143,7 +143,7 @@ inline std::enable_if_t<!::NPrivate::TSafelyConvertible<TSmall, TLarge>::Result, } template <class TSmallInt, class TLargeInt> -inline TSmallInt IntegerCast(TLargeInt largeInt) noexcept { +inline TSmallInt IntegerCast(TLargeInt largeInt) noexcept { try { return SafeIntegerCast<TSmallInt>(largeInt); } catch (const yexception& exc) { diff --git a/util/generic/deque.h b/util/generic/deque.h index 2dabaf3177d..b32beaca00a 100644 --- a/util/generic/deque.h +++ b/util/generic/deque.h @@ -9,7 +9,7 @@ #include <initializer_list> template <class T, class A> -class TDeque: public std::deque<T, TReboundAllocator<A, T>> { +class TDeque: public std::deque<T, TReboundAllocator<A, T>> { using TBase = std::deque<T, TReboundAllocator<A, T>>; public: diff --git a/util/generic/deque_ut.cpp b/util/generic/deque_ut.cpp index 93bf50fa92a..1c522bc187c 100644 --- a/util/generic/deque_ut.cpp +++ b/util/generic/deque_ut.cpp @@ -27,7 +27,7 @@ protected: UNIT_TEST_SUITE_REGISTRATION(TDequeTest); void TDequeTest::TestConstructorsAndAssignments() { - using container = TDeque<int>; + using container = TDeque<int>; container c1; c1.push_back(100); @@ -66,7 +66,7 @@ void TDequeTest::TestConstructorsAndAssignments() { } void TDequeTest::TestDeque1() { - TDeque<int> d; + TDeque<int> d; UNIT_ASSERT(!d); d.push_back(4); @@ -89,8 +89,8 @@ void TDequeTest::TestDeque1() { UNIT_ASSERT(d[2] == 25); //Some compile time tests: - TDeque<int>::iterator dit = d.begin(); - TDeque<int>::const_iterator cdit(d.begin()); + TDeque<int>::iterator dit = d.begin(); + TDeque<int>::const_iterator cdit(d.begin()); UNIT_ASSERT((dit - cdit) == 0); UNIT_ASSERT((cdit - dit) == 0); @@ -100,14 +100,14 @@ void TDequeTest::TestDeque1() { } void TDequeTest::TestInsert() { - TDeque<int> d; + TDeque<int> d; d.push_back(0); d.push_back(1); d.push_back(2); UNIT_ASSERT(d.size() == 3); - TDeque<int>::iterator dit; + TDeque<int>::iterator dit; //Insertion before begin: dit = d.insert(d.begin(), 3); @@ -177,8 +177,8 @@ void TDequeTest::TestInsert() { } void TDequeTest::TestAt() { - TDeque<int> d; - TDeque<int> const& cd = d; + TDeque<int> d; + TDeque<int> const& cd = d; d.push_back(10); UNIT_ASSERT(d.at(0) == 10); @@ -197,12 +197,12 @@ void TDequeTest::TestAt() { void TDequeTest::TestAutoRef() { int i; - TDeque<int> ref; + TDeque<int> ref; for (i = 0; i < 5; ++i) { ref.push_back(i); } - TDeque<TDeque<int>> d_d_int(1, ref); + TDeque<TDeque<int>> d_d_int(1, ref); d_d_int.push_back(d_d_int[0]); d_d_int.push_back(ref); d_d_int.push_back(d_d_int[0]); @@ -215,7 +215,7 @@ void TDequeTest::TestAutoRef() { } void TDequeTest::TestErase() { - TDeque<int> dint; + TDeque<int> dint; dint.push_back(3); dint.push_front(2); dint.push_back(4); @@ -224,7 +224,7 @@ void TDequeTest::TestErase() { dint.push_front(0); dint.push_back(6); - TDeque<int>::iterator it(dint.begin() + 1); + TDeque<int>::iterator it(dint.begin() + 1); UNIT_ASSERT(*it == 1); dint.erase(dint.begin()); diff --git a/util/generic/explicit_type_ut.cpp b/util/generic/explicit_type_ut.cpp index 50a745f090e..f7cb501a355 100644 --- a/util/generic/explicit_type_ut.cpp +++ b/util/generic/explicit_type_ut.cpp @@ -17,7 +17,7 @@ public: template <class T, class Arg> struct TCallable: public TCallableBase { enum { - Result = sizeof(Test(std::declval<T>(), std::declval<Arg>(), 1)) == sizeof(TYes) + Result = sizeof(Test(std::declval<T>(), std::declval<Arg>(), 1)) == sizeof(TYes) }; }; diff --git a/util/generic/fastqueue.h b/util/generic/fastqueue.h index 1fee5b86f6e..461dd52af3e 100644 --- a/util/generic/fastqueue.h +++ b/util/generic/fastqueue.h @@ -35,7 +35,7 @@ public: return tmp->Obj; } - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return Size_; } @@ -43,7 +43,7 @@ public: return !this->Size(); } - inline explicit operator bool() const noexcept { + inline explicit operator bool() const noexcept { return !this->Empty(); } diff --git a/util/generic/flags_ut.cpp b/util/generic/flags_ut.cpp index 5377c6a0580..a87d9eb920a 100644 --- a/util/generic/flags_ut.cpp +++ b/util/generic/flags_ut.cpp @@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(TFlagsTest) { Y_UNIT_TEST(TestHash) { ETest1 value0 = nullptr, value1 = Test1; - THashMap<ETest1, int> hash; + THashMap<ETest1, int> hash; hash[value0] = 0; hash[value1] = 1; diff --git a/util/generic/fuzz/vector/main.cpp b/util/generic/fuzz/vector/main.cpp index 0a0293f7954..ed7eb43ad84 100644 --- a/util/generic/fuzz/vector/main.cpp +++ b/util/generic/fuzz/vector/main.cpp @@ -14,7 +14,7 @@ extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) { TMemoryInput mi(data, size); try { - TVector<ui16> v; + TVector<ui16> v; while (mi.Avail()) { char cmd = Read<char>(mi); diff --git a/util/generic/fwd.h b/util/generic/fwd.h index 5cc2da40e51..7681b5df5c5 100644 --- a/util/generic/fwd.h +++ b/util/generic/fwd.h @@ -53,46 +53,46 @@ class TRbTree; //containers template <class T, class A = std::allocator<T>> -class TVector; +class TVector; template <class T, class A = std::allocator<T>> -class TDeque; +class TDeque; -template <class T, class S = TDeque<T>> -class TQueue; +template <class T, class S = TDeque<T>> +class TQueue; -template <class T, class S = TVector<T>, class C = TLess<T>> -class TPriorityQueue; +template <class T, class S = TVector<T>, class C = TLess<T>> +class TPriorityQueue; template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> -class THashMap; +class THashMap; template <class Key, class T, class HashFcn = THash<Key>, class EqualKey = TEqualTo<Key>, class Alloc = std::allocator<Key>> -class THashMultiMap; +class THashMultiMap; template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> -class THashSet; +class THashSet; template <class Value, class HashFcn = THash<Value>, class EqualKey = TEqualTo<Value>, class Alloc = std::allocator<Value>> -class THashMultiSet; +class THashMultiSet; template <class T, class A = std::allocator<T>> -class TList; +class TList; template <class K, class V, class Less = TLess<K>, class A = std::allocator<K>> -class TMap; +class TMap; template <class K, class V, class Less = TLess<K>, class A = std::allocator<K>> -class TMultiMap; +class TMultiMap; template <class K, class L = TLess<K>, class A = std::allocator<K>> -class TSet; +class TSet; template <class K, class L = TLess<K>, class A = std::allocator<K>> -class TMultiSet; +class TMultiSet; -template <class T, class S = TDeque<T>> -class TStack; +template <class T, class S = TDeque<T>> +class TStack; template <size_t BitCount, typename TChunkType = ui64> class TBitMap; diff --git a/util/generic/guid.cpp b/util/generic/guid.cpp index 8b907457bc6..e85bcb28ba5 100644 --- a/util/generic/guid.cpp +++ b/util/generic/guid.cpp @@ -1,6 +1,6 @@ #include "guid.h" #include "ylimits.h" -#include "string.h" +#include "string.h" #include <util/string/ascii.h> #include <util/string/builder.h> @@ -65,11 +65,11 @@ TGUID TGUID::CreateTimebased() { return result; } -TString GetGuidAsString(const TGUID& g) { +TString GetGuidAsString(const TGUID& g) { return g.AsGuidString(); } -TString CreateGuidAsString() { +TString CreateGuidAsString() { return TGUID::Create().AsGuidString(); } diff --git a/util/generic/guid.h b/util/generic/guid.h index 2bf6c8ad99c..9212b3edb65 100644 --- a/util/generic/guid.h +++ b/util/generic/guid.h @@ -66,8 +66,8 @@ struct THash<TGUID> { }; void CreateGuid(TGUID* res); -TString GetGuidAsString(const TGUID& g); -TString CreateGuidAsString(); +TString GetGuidAsString(const TGUID& g); +TString CreateGuidAsString(); TGUID GetGuid(TStringBuf s); bool GetGuid(TStringBuf s, TGUID& result); diff --git a/util/generic/guid_ut.cpp b/util/generic/guid_ut.cpp index 048354ff399..6b9118851fc 100644 --- a/util/generic/guid_ut.cpp +++ b/util/generic/guid_ut.cpp @@ -17,7 +17,7 @@ Y_UNIT_TEST_SUITE(TGuidTest) { struct TTest { TGUID G; - TString S; + TString S; }; Y_UNIT_TEST(Test1) { diff --git a/util/generic/hash.cpp b/util/generic/hash.cpp index a674ee4538a..96b3b139810 100644 --- a/util/generic/hash.cpp +++ b/util/generic/hash.cpp @@ -3,9 +3,9 @@ #include <util/string/escape.h> #include <util/string/cast.h> -const void* const _yhashtable_empty_data[] = {(void*)3, nullptr, (void*)1}; +const void* const _yhashtable_empty_data[] = {(void*)3, nullptr, (void*)1}; -TString NPrivate::MapKeyToString(TStringBuf key) { +TString NPrivate::MapKeyToString(TStringBuf key) { constexpr size_t HASH_KEY_MAX_LENGTH = 500; try { return EscapeC(key.substr(0, HASH_KEY_MAX_LENGTH)); @@ -14,35 +14,35 @@ TString NPrivate::MapKeyToString(TStringBuf key) { } } -TString NPrivate::MapKeyToString(unsigned short key) { +TString NPrivate::MapKeyToString(unsigned short key) { return ToString(key); } -TString NPrivate::MapKeyToString(short key) { +TString NPrivate::MapKeyToString(short key) { return ToString(key); } -TString NPrivate::MapKeyToString(unsigned int key) { +TString NPrivate::MapKeyToString(unsigned int key) { return ToString(key); } -TString NPrivate::MapKeyToString(int key) { +TString NPrivate::MapKeyToString(int key) { return ToString(key); } -TString NPrivate::MapKeyToString(unsigned long key) { +TString NPrivate::MapKeyToString(unsigned long key) { return ToString(key); } -TString NPrivate::MapKeyToString(long key) { +TString NPrivate::MapKeyToString(long key) { return ToString(key); } -TString NPrivate::MapKeyToString(unsigned long long key) { +TString NPrivate::MapKeyToString(unsigned long long key) { return ToString(key); } -TString NPrivate::MapKeyToString(long long key) { +TString NPrivate::MapKeyToString(long long key) { return ToString(key); } diff --git a/util/generic/hash.h b/util/generic/hash.h index e46db21fa97..aa9981e9f19 100644 --- a/util/generic/hash.h +++ b/util/generic/hash.h @@ -29,40 +29,40 @@ struct TSelect1st { }; template <class Value> -struct __yhashtable_node { +struct __yhashtable_node { /** If the first bit is not set, then this is a pointer to the next node in * the list of nodes for the current bucket. Otherwise this is a pointer of - * type __yhashtable_node**, pointing back into the buckets array. + * type __yhashtable_node**, pointing back into the buckets array. * * This trick makes it possible to use only one node pointer in a hash table * iterator. */ - __yhashtable_node* next; + __yhashtable_node* next; /** Value stored in a node. */ Value val; - __yhashtable_node& operator=(const __yhashtable_node&) = delete; + __yhashtable_node& operator=(const __yhashtable_node&) = delete; }; template <class Value, class Key, class HashFcn, class ExtractKey, class EqualKey, class Alloc> -class THashTable; +class THashTable; template <class Key, class T, class HashFcn, class EqualKey, typename size_type_f> class sthash; template <class Value> -struct __yhashtable_iterator; +struct __yhashtable_iterator; template <class Value> -struct __yhashtable_const_iterator; +struct __yhashtable_const_iterator; template <class Value> -struct __yhashtable_iterator { - using iterator = __yhashtable_iterator<Value>; - using const_iterator = __yhashtable_const_iterator<Value>; - using node = __yhashtable_node<Value>; +struct __yhashtable_iterator { + using iterator = __yhashtable_iterator<Value>; + using const_iterator = __yhashtable_const_iterator<Value>; + using node = __yhashtable_node<Value>; using iterator_category = std::forward_iterator_tag; using value_type = Value; @@ -73,7 +73,7 @@ struct __yhashtable_iterator { node* cur; - explicit __yhashtable_iterator(node* n) + explicit __yhashtable_iterator(node* n) : cur(n) { } /*y*/ @@ -96,16 +96,16 @@ struct __yhashtable_iterator { bool IsEnd() const { return !cur; } - Y_FORCE_INLINE explicit operator bool() const noexcept { + Y_FORCE_INLINE explicit operator bool() const noexcept { return cur != nullptr; } }; template <class Value> -struct __yhashtable_const_iterator { - using iterator = __yhashtable_iterator<Value>; - using const_iterator = __yhashtable_const_iterator<Value>; - using node = __yhashtable_node<Value>; +struct __yhashtable_const_iterator { + using iterator = __yhashtable_iterator<Value>; + using const_iterator = __yhashtable_const_iterator<Value>; + using node = __yhashtable_node<Value>; using iterator_category = std::forward_iterator_tag; using value_type = Value; @@ -116,13 +116,13 @@ struct __yhashtable_const_iterator { const node* cur; - explicit __yhashtable_const_iterator(const node* n) + explicit __yhashtable_const_iterator(const node* n) : cur(n) { } - __yhashtable_const_iterator() { + __yhashtable_const_iterator() { } - __yhashtable_const_iterator(const iterator& it) + __yhashtable_const_iterator(const iterator& it) : cur(it.cur) { } @@ -143,7 +143,7 @@ struct __yhashtable_const_iterator { bool IsEnd() const { return !cur; } - Y_FORCE_INLINE explicit operator bool() const noexcept { + Y_FORCE_INLINE explicit operator bool() const noexcept { return cur != nullptr; } }; @@ -156,8 +156,8 @@ struct __yhashtable_const_iterator { template <class Alloc> class _allocator_base: private Alloc { public: - _allocator_base(const Alloc& other) - : Alloc(other) + _allocator_base(const Alloc& other) + : Alloc(other) { } @@ -177,12 +177,12 @@ public: }; /** - * Wrapper for an array of THashTable buckets. + * Wrapper for an array of THashTable buckets. * * Is better than vector for this particular use case. Main differences: * - Occupies one less word on stack. - * - Doesn't even try to initialize its elements. It is THashTable's responsibility. - * - Presents a better interface in relation to THashTable's marker element trick. + * - Doesn't even try to initialize its elements. It is THashTable's responsibility. + * - Presents a better interface in relation to THashTable's marker element trick. * * Internally this class is just a pointer-size pair, and the data on the heap * has the following structure: @@ -197,13 +197,13 @@ public: * `raw_size` stores the size of the allocated memory block. It is used to * support resizing without reallocation. * - * `marker` is a special marker element that is set by the THashTable that is + * `marker` is a special marker element that is set by the THashTable that is * then used in iterator implementation to know when the end is reached. * * Unused space at the end of the memory block may not be present. */ template <class T, class Alloc> -class _yhashtable_buckets: private _allocator_base<Alloc> { +class _yhashtable_buckets: private _allocator_base<Alloc> { using base_type = _allocator_base<Alloc>; static_assert(sizeof(T) == sizeof(size_t), "T is expected to be the same size as size_t."); @@ -221,14 +221,14 @@ public: using difference_type = ptrdiff_t; using TBucketDivisor = ::NPrivate::THashDivisor; - _yhashtable_buckets(const Alloc& other) - : base_type(other) + _yhashtable_buckets(const Alloc& other) + : base_type(other) , Data(nullptr) , Size() { } - ~_yhashtable_buckets() { + ~_yhashtable_buckets() { Y_ASSERT(!Data); } @@ -318,7 +318,7 @@ public: return *(Data + index); } - void swap(_yhashtable_buckets& other) { + void swap(_yhashtable_buckets& other) { base_type::swap(other); DoSwap(Data, other.Data); DoSwap(Size, other.Size); @@ -333,7 +333,7 @@ private: }; /** - * This class saves one word in THashTable for the most common use case of empty + * This class saves one word in THashTable for the most common use case of empty * functors. The exact implementation picks a specialization with storage allocated * for the functors if those are non-empty, and another specialization that creates * functors on the fly if they are empty. It is expected that empty functors have @@ -348,67 +348,67 @@ private: * of the functors are empty as this is a case that's just way too rare. */ template <class HashFcn, class ExtractKey, class EqualKey, class Alloc, bool IsEmpty = std::is_empty<HashFcn>::value&& std::is_empty<ExtractKey>::value&& std::is_empty<EqualKey>::value> -class _yhashtable_base: public _allocator_base<Alloc> { +class _yhashtable_base: public _allocator_base<Alloc> { using base_type = _allocator_base<Alloc>; public: - _yhashtable_base(const HashFcn& hash, const ExtractKey& extract, const EqualKey& equals, const Alloc& alloc) + _yhashtable_base(const HashFcn& hash, const ExtractKey& extract, const EqualKey& equals, const Alloc& alloc) : base_type(alloc) - , hash_(hash) - , extract_(extract) - , equals_(equals) + , hash_(hash) + , extract_(extract) + , equals_(equals) { } const EqualKey& _get_key_eq() const { - return equals_; + return equals_; } EqualKey& _get_key_eq() { - return equals_; + return equals_; } void _set_key_eq(const EqualKey& equals) { - this->equals_ = equals; + this->equals_ = equals; } const ExtractKey& _get_key_extract() const { - return extract_; + return extract_; } ExtractKey& _get_key_extract() { - return extract_; + return extract_; } void _set_key_extract(const ExtractKey& extract) { - this->extract_ = extract; + this->extract_ = extract; } const HashFcn& _get_hash_fun() const { - return hash_; + return hash_; } HashFcn& _get_hash_fun() { - return hash_; + return hash_; } void _set_hash_fun(const HashFcn& hash) { - this->hash_ = hash; + this->hash_ = hash; } - void swap(_yhashtable_base& other) { + void swap(_yhashtable_base& other) { base_type::swap(other); - DoSwap(equals_, other.equals_); - DoSwap(extract_, other.extract_); - DoSwap(hash_, other.hash_); + DoSwap(equals_, other.equals_); + DoSwap(extract_, other.extract_); + DoSwap(hash_, other.hash_); } private: - HashFcn hash_; - ExtractKey extract_; - EqualKey equals_; + HashFcn hash_; + ExtractKey extract_; + EqualKey equals_; }; template <class HashFcn, class ExtractKey, class EqualKey, class Alloc> -class _yhashtable_base<HashFcn, ExtractKey, EqualKey, Alloc, true>: public _allocator_base<Alloc> { +class _yhashtable_base<HashFcn, ExtractKey, EqualKey, Alloc, true>: public _allocator_base<Alloc> { using base_type = _allocator_base<Alloc>; public: - _yhashtable_base(const HashFcn&, const ExtractKey&, const EqualKey&, const Alloc& alloc) + _yhashtable_base(const HashFcn&, const ExtractKey&, const EqualKey&, const Alloc& alloc) : base_type(alloc) { } @@ -431,30 +431,30 @@ public: void _set_hash_fun(const HashFcn&) { } - void swap(_yhashtable_base& other) { + void swap(_yhashtable_base& other) { base_type::swap(other); } }; template <class Value, class Key, class HashFcn, class ExtractKey, class EqualKey, class Alloc> -struct _yhashtable_traits { - using node = __yhashtable_node<Value>; +struct _yhashtable_traits { + using node = __yhashtable_node<Value>; using node_allocator_type = TReboundAllocator<Alloc, node>; using nodep_allocator_type = TReboundAllocator<Alloc, node*>; - using base_type = _yhashtable_base<HashFcn, ExtractKey, EqualKey, node_allocator_type>; + using base_type = _yhashtable_base<HashFcn, ExtractKey, EqualKey, node_allocator_type>; }; -extern const void* const _yhashtable_empty_data[]; +extern const void* const _yhashtable_empty_data[]; template <class Value, class Key, class HashFcn, class ExtractKey, class EqualKey, class Alloc> -class THashTable: private _yhashtable_traits<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::base_type { - using traits_type = _yhashtable_traits<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>; +class THashTable: private _yhashtable_traits<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>::base_type { + using traits_type = _yhashtable_traits<Value, Key, HashFcn, ExtractKey, EqualKey, Alloc>; using base_type = typename traits_type::base_type; using node = typename traits_type::node; using nodep_allocator_type = typename traits_type::nodep_allocator_type; - using buckets_type = _yhashtable_buckets<node*, nodep_allocator_type>; + using buckets_type = _yhashtable_buckets<node*, nodep_allocator_type>; using TBucketDivisor = ::NPrivate::THashDivisor; public: @@ -511,15 +511,15 @@ private: size_type num_elements; public: - using iterator = __yhashtable_iterator<Value>; - using const_iterator = __yhashtable_const_iterator<Value>; + using iterator = __yhashtable_iterator<Value>; + using const_iterator = __yhashtable_const_iterator<Value>; using insert_ctx = node**; - friend struct __yhashtable_iterator<Value>; - friend struct __yhashtable_const_iterator<Value>; + friend struct __yhashtable_iterator<Value>; + friend struct __yhashtable_const_iterator<Value>; public: - THashTable() + THashTable() : base_type(HashFcn(), ExtractKey(), EqualKey(), node_allocator_type()) , buckets(nodep_allocator_type()) , num_elements(0) @@ -527,7 +527,7 @@ public: initialize_buckets(buckets, 0); } - THashTable(size_type n, const HashFcn& hf, const EqualKey& eql, const ExtractKey& ext) + THashTable(size_type n, const HashFcn& hf, const EqualKey& eql, const ExtractKey& ext) : base_type(hf, ext, eql, node_allocator_type()) , buckets(nodep_allocator_type()) , num_elements(0) @@ -535,7 +535,7 @@ public: initialize_buckets(buckets, n); } - THashTable(size_type n, const HashFcn& hf, const EqualKey& eql) + THashTable(size_type n, const HashFcn& hf, const EqualKey& eql) : base_type(hf, ExtractKey(), eql, node_allocator_type()) , buckets(nodep_allocator_type()) , num_elements(0) @@ -544,7 +544,7 @@ public: } template <class TAllocParam> - THashTable(size_type n, const HashFcn& hf, const EqualKey& eql, TAllocParam* allocParam) + THashTable(size_type n, const HashFcn& hf, const EqualKey& eql, TAllocParam* allocParam) : base_type(hf, ExtractKey(), eql, allocParam) , buckets(allocParam) , num_elements(0) @@ -552,7 +552,7 @@ public: initialize_buckets(buckets, n); } - THashTable(const THashTable& ht) + THashTable(const THashTable& ht) : base_type(ht._get_hash_fun(), ht._get_key_extract(), ht._get_key_eq(), ht._get_alloc()) , buckets(ht.buckets.get_allocator()) , num_elements(0) @@ -565,7 +565,7 @@ public: } } - THashTable(THashTable&& ht) noexcept + THashTable(THashTable&& ht) noexcept : base_type(ht._get_hash_fun(), ht._get_key_extract(), ht._get_key_eq(), ht._get_alloc()) , buckets(ht.buckets.get_allocator()) , num_elements(0) @@ -574,7 +574,7 @@ public: this->swap(ht); } - THashTable& operator=(const THashTable& ht) { + THashTable& operator=(const THashTable& ht) { if (&ht != this) { basic_clear(); this->_set_hash_fun(ht._get_hash_fun()); @@ -603,14 +603,14 @@ public: return *this; } - THashTable& operator=(THashTable&& ht) noexcept { + THashTable& operator=(THashTable&& ht) noexcept { basic_clear(); swap(ht); return *this; } - ~THashTable() { + ~THashTable() { basic_clear(); deinitialize_buckets(buckets); } @@ -626,7 +626,7 @@ public: return size() == 0; } - void swap(THashTable& ht) { + void swap(THashTable& ht) { base_type::swap(ht); buckets.swap(ht.buckets); DoSwap(num_elements, ht.num_elements); @@ -857,7 +857,7 @@ public: * Clears the hashtable and tries to reasonably downsize it. Note that * downsizing is mainly for the following use case: * - * THashTable hash; + * THashTable hash; * for(...) { * if (someCond()) * hash.clear(); @@ -951,11 +951,11 @@ private: void erase_bucket(const size_type n, node* first, node* last); void erase_bucket(const size_type n, node* last); - void copy_from_dynamic(const THashTable& ht); + void copy_from_dynamic(const THashTable& ht); }; template <class V> -__yhashtable_iterator<V>& __yhashtable_iterator<V>::operator++() { +__yhashtable_iterator<V>& __yhashtable_iterator<V>::operator++() { Y_ASSERT(cur); cur = cur->next; if ((uintptr_t)cur & 1) { @@ -969,14 +969,14 @@ __yhashtable_iterator<V>& __yhashtable_iterator<V>::operator++() { } template <class V> -inline __yhashtable_iterator<V> __yhashtable_iterator<V>::operator++(int) { +inline __yhashtable_iterator<V> __yhashtable_iterator<V>::operator++(int) { iterator tmp = *this; ++*this; return tmp; } template <class V> -__yhashtable_const_iterator<V>& __yhashtable_const_iterator<V>::operator++() { +__yhashtable_const_iterator<V>& __yhashtable_const_iterator<V>::operator++() { Y_ASSERT(cur); cur = cur->next; if ((uintptr_t)cur & 1) { @@ -990,7 +990,7 @@ __yhashtable_const_iterator<V>& __yhashtable_const_iterator<V>::operator++() { } template <class V> -inline __yhashtable_const_iterator<V> __yhashtable_const_iterator<V>::operator++(int) { +inline __yhashtable_const_iterator<V> __yhashtable_const_iterator<V>::operator++(int) { const_iterator tmp = *this; ++*this; return tmp; @@ -998,7 +998,7 @@ inline __yhashtable_const_iterator<V> __yhashtable_const_iterator<V>::operator++ template <class V, class K, class HF, class Ex, class Eq, class A> template <typename... Args> -std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V, K, HF, Ex, Eq, A>::emplace_unique_noresize(Args&&... args) { +std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V, K, HF, Ex, Eq, A>::emplace_unique_noresize(Args&&... args) { auto deleter = [&](node* tmp) { delete_node(tmp); }; node* tmp = new_node(std::forward<Args>(args)...); std::unique_ptr<node, decltype(deleter)> guard(tmp, deleter); @@ -1020,7 +1020,7 @@ std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherValue> -std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V, K, HF, Ex, Eq, A>::insert_unique_noresize(const OtherValue& obj) { +std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V, K, HF, Ex, Eq, A>::insert_unique_noresize(const OtherValue& obj) { const size_type n = bkt_num(obj); node* first = buckets[n]; @@ -1038,7 +1038,7 @@ std::pair<typename THashTable<V, K, HF, Ex, Eq, A>::iterator, bool> THashTable<V template <class V, class K, class HF, class Ex, class Eq, class A> template <typename... Args> -__yhashtable_iterator<V> THashTable<V, K, HF, Ex, Eq, A>::emplace_equal_noresize(Args&&... args) { +__yhashtable_iterator<V> THashTable<V, K, HF, Ex, Eq, A>::emplace_equal_noresize(Args&&... args) { auto deleter = [&](node* tmp) { delete_node(tmp); }; node* tmp = new_node(std::forward<Args>(args)...); std::unique_ptr<node, decltype(deleter)> guard(tmp, deleter); @@ -1064,7 +1064,7 @@ __yhashtable_iterator<V> THashTable<V, K, HF, Ex, Eq, A>::emplace_equal_noresize template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherValue> -typename THashTable<V, K, HF, Ex, Eq, A>::reference THashTable<V, K, HF, Ex, Eq, A>::find_or_insert(const OtherValue& v) { +typename THashTable<V, K, HF, Ex, Eq, A>::reference THashTable<V, K, HF, Ex, Eq, A>::find_or_insert(const OtherValue& v) { reserve(num_elements + 1); size_type n = bkt_num_key(get_key(v)); @@ -1084,7 +1084,7 @@ typename THashTable<V, K, HF, Ex, Eq, A>::reference THashTable<V, K, HF, Ex, Eq, template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherKey> -__yhashtable_iterator<V> THashTable<V, K, HF, Ex, Eq, A>::find_i(const OtherKey& key, insert_ctx& ins) { +__yhashtable_iterator<V> THashTable<V, K, HF, Ex, Eq, A>::find_i(const OtherKey& key, insert_ctx& ins) { size_type n = bkt_num_key(key); ins = &buckets[n]; node* first = buckets[n]; @@ -1098,7 +1098,7 @@ __yhashtable_iterator<V> THashTable<V, K, HF, Ex, Eq, A>::find_i(const OtherKey& template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherKey> -std::pair<__yhashtable_iterator<V>, __yhashtable_iterator<V>> THashTable<V, K, HF, Ex, Eq, A>::equal_range(const OtherKey& key) { +std::pair<__yhashtable_iterator<V>, __yhashtable_iterator<V>> THashTable<V, K, HF, Ex, Eq, A>::equal_range(const OtherKey& key) { using pii = std::pair<iterator, iterator>; const size_type n = bkt_num_key(key); node* first = buckets[n]; @@ -1121,7 +1121,7 @@ std::pair<__yhashtable_iterator<V>, __yhashtable_iterator<V>> THashTable<V, K, H template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherKey> -std::pair<__yhashtable_const_iterator<V>, __yhashtable_const_iterator<V>> THashTable<V, K, HF, Ex, Eq, A>::equal_range(const OtherKey& key) const { +std::pair<__yhashtable_const_iterator<V>, __yhashtable_const_iterator<V>> THashTable<V, K, HF, Ex, Eq, A>::equal_range(const OtherKey& key) const { using pii = std::pair<const_iterator, const_iterator>; const size_type n = bkt_num_key(key); const node* first = buckets[n]; @@ -1145,7 +1145,7 @@ std::pair<__yhashtable_const_iterator<V>, __yhashtable_const_iterator<V>> THashT template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherKey> -typename THashTable<V, K, HF, Ex, Eq, A>::size_type THashTable<V, K, HF, Ex, Eq, A>::erase(const OtherKey& key) { +typename THashTable<V, K, HF, Ex, Eq, A>::size_type THashTable<V, K, HF, Ex, Eq, A>::erase(const OtherKey& key) { const size_type n = bkt_num_key(key); node* first = buckets[n]; size_type erased = 0; @@ -1177,7 +1177,7 @@ typename THashTable<V, K, HF, Ex, Eq, A>::size_type THashTable<V, K, HF, Ex, Eq, template <class V, class K, class HF, class Ex, class Eq, class A> template <class OtherKey> -typename THashTable<V, K, HF, Ex, Eq, A>::size_type THashTable<V, K, HF, Ex, Eq, A>::erase_one(const OtherKey& key) { +typename THashTable<V, K, HF, Ex, Eq, A>::size_type THashTable<V, K, HF, Ex, Eq, A>::erase_one(const OtherKey& key) { const size_type n = bkt_num_key(key); node* first = buckets[n]; @@ -1206,7 +1206,7 @@ typename THashTable<V, K, HF, Ex, Eq, A>::size_type THashTable<V, K, HF, Ex, Eq, } template <class V, class K, class HF, class Ex, class Eq, class A> -void THashTable<V, K, HF, Ex, Eq, A>::erase(const iterator& it) { +void THashTable<V, K, HF, Ex, Eq, A>::erase(const iterator& it) { if (node* const p = it.cur) { const size_type n = bkt_num(p->val); node* cur = buckets[n]; @@ -1233,7 +1233,7 @@ void THashTable<V, K, HF, Ex, Eq, A>::erase(const iterator& it) { } template <class V, class K, class HF, class Ex, class Eq, class A> -void THashTable<V, K, HF, Ex, Eq, A>::erase(iterator first, iterator last) { +void THashTable<V, K, HF, Ex, Eq, A>::erase(iterator first, iterator last) { size_type f_bucket = first.cur ? bkt_num(first.cur->val) : buckets.size(); /*y*/ size_type l_bucket = last.cur ? bkt_num(last.cur->val) : buckets.size(); /*y*/ @@ -1252,22 +1252,22 @@ void THashTable<V, K, HF, Ex, Eq, A>::erase(iterator first, iterator last) { template <class V, class K, class HF, class Ex, class Eq, class A> inline void -THashTable<V, K, HF, Ex, Eq, A>::erase(const_iterator first, const_iterator last) { +THashTable<V, K, HF, Ex, Eq, A>::erase(const_iterator first, const_iterator last) { erase(iterator(const_cast<node*>(first.cur)), iterator(const_cast<node*>(last.cur))); } template <class V, class K, class HF, class Ex, class Eq, class A> -inline void THashTable<V, K, HF, Ex, Eq, A>::erase(const const_iterator& it) { +inline void THashTable<V, K, HF, Ex, Eq, A>::erase(const const_iterator& it) { erase(iterator(const_cast<node*>(it.cur))); } template <class V, class K, class HF, class Ex, class Eq, class A> -bool THashTable<V, K, HF, Ex, Eq, A>::reserve(size_type num_elements_hint) { +bool THashTable<V, K, HF, Ex, Eq, A>::reserve(size_type num_elements_hint) { const size_type old_n = buckets.size(); /*y*/ if (num_elements_hint + 1 > old_n) { - if (old_n != 1 && num_elements_hint <= old_n) // TODO: this if is for backwards compatibility down to order-in-buckets level. Can be safely removed. - return false; - + if (old_n != 1 && num_elements_hint <= old_n) // TODO: this if is for backwards compatibility down to order-in-buckets level. Can be safely removed. + return false; + const TBucketDivisor n = HashBucketCountExt(num_elements_hint + 1, buckets.BucketDivisorHint() + 1); if (n() > old_n) { buckets_type tmp(buckets.get_allocator()); @@ -1311,7 +1311,7 @@ bool THashTable<V, K, HF, Ex, Eq, A>::reserve(size_type num_elements_hint) { } template <class V, class K, class HF, class Ex, class Eq, class A> -void THashTable<V, K, HF, Ex, Eq, A>::erase_bucket(const size_type n, node* first, node* last) { +void THashTable<V, K, HF, Ex, Eq, A>::erase_bucket(const size_type n, node* first, node* last) { node* cur = buckets[n]; if (cur == first) erase_bucket(n, last); @@ -1329,7 +1329,7 @@ void THashTable<V, K, HF, Ex, Eq, A>::erase_bucket(const size_type n, node* firs } template <class V, class K, class HF, class Ex, class Eq, class A> -void THashTable<V, K, HF, Ex, Eq, A>::erase_bucket(const size_type n, node* last) { +void THashTable<V, K, HF, Ex, Eq, A>::erase_bucket(const size_type n, node* last) { node* cur = buckets[n]; while (cur != last) { node* next = cur->next; @@ -1341,7 +1341,7 @@ void THashTable<V, K, HF, Ex, Eq, A>::erase_bucket(const size_type n, node* last } template <class V, class K, class HF, class Ex, class Eq, class A> -void THashTable<V, K, HF, Ex, Eq, A>::basic_clear() { +void THashTable<V, K, HF, Ex, Eq, A>::basic_clear() { if (!num_elements) { return; } @@ -1363,7 +1363,7 @@ void THashTable<V, K, HF, Ex, Eq, A>::basic_clear() { } template <class V, class K, class HF, class Ex, class Eq, class A> -void THashTable<V, K, HF, Ex, Eq, A>::copy_from_dynamic(const THashTable& ht) { +void THashTable<V, K, HF, Ex, Eq, A>::copy_from_dynamic(const THashTable& ht) { Y_ASSERT(buckets.size() == ht.buckets.size() && !ht.empty()); #ifdef __STL_USE_EXCEPTIONS @@ -1392,29 +1392,29 @@ void THashTable<V, K, HF, Ex, Eq, A>::copy_from_dynamic(const THashTable& ht) { namespace NPrivate { template <class Key> - inline TString MapKeyToString(const Key&) { + inline TString MapKeyToString(const Key&) { return TypeName<Key>(); } - TString MapKeyToString(TStringBuf key); - TString MapKeyToString(unsigned short key); - TString MapKeyToString(short key); - TString MapKeyToString(unsigned int key); - TString MapKeyToString(int key); - TString MapKeyToString(unsigned long key); - TString MapKeyToString(long key); - TString MapKeyToString(unsigned long long key); - TString MapKeyToString(long long key); + TString MapKeyToString(TStringBuf key); + TString MapKeyToString(unsigned short key); + TString MapKeyToString(short key); + TString MapKeyToString(unsigned int key); + TString MapKeyToString(int key); + TString MapKeyToString(unsigned long key); + TString MapKeyToString(long key); + TString MapKeyToString(unsigned long long key); + TString MapKeyToString(long long key); - inline TString MapKeyToString(const TString& key) { + inline TString MapKeyToString(const TString& key) { return MapKeyToString(TStringBuf(key)); } - inline TString MapKeyToString(const char* key) { + inline TString MapKeyToString(const char* key) { return MapKeyToString(TStringBuf(key)); } - inline TString MapKeyToString(char* key) { + inline TString MapKeyToString(char* key) { return MapKeyToString(TStringBuf(key)); } @@ -1422,9 +1422,9 @@ namespace NPrivate { } template <class Key, class T, class HashFcn, class EqualKey, class Alloc> -class THashMap: public TMapOps<THashMap<Key, T, HashFcn, EqualKey, Alloc>> { +class THashMap: public TMapOps<THashMap<Key, T, HashFcn, EqualKey, Alloc>> { private: - using ht = THashTable<std::pair<const Key, T>, Key, HashFcn, TSelect1st, EqualKey, Alloc>; + using ht = THashTable<std::pair<const Key, T>, Key, HashFcn, TSelect1st, EqualKey, Alloc>; ht rep; public: @@ -1455,60 +1455,60 @@ public: } public: - THashMap() + THashMap() : rep(0, hasher(), key_equal()) { } template <class TAllocParam> - explicit THashMap(TAllocParam* allocParam, size_type n = 0) + explicit THashMap(TAllocParam* allocParam, size_type n = 0) : rep(n, hasher(), key_equal(), allocParam) { } - explicit THashMap(size_type n) + explicit THashMap(size_type n) : rep(n, hasher(), key_equal()) { } - THashMap(size_type n, const hasher& hf) + THashMap(size_type n, const hasher& hf) : rep(n, hf, key_equal()) { } - THashMap(size_type n, const hasher& hf, const key_equal& eql) + THashMap(size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { } template <class TAllocParam> - explicit THashMap(size_type n, TAllocParam* allocParam) + explicit THashMap(size_type n, TAllocParam* allocParam) : rep(n, hasher(), key_equal(), allocParam) { } template <class InputIterator> - THashMap(InputIterator f, InputIterator l) + THashMap(InputIterator f, InputIterator l) : rep(0, hasher(), key_equal()) { rep.insert_unique(f, l); } template <class InputIterator> - THashMap(InputIterator f, InputIterator l, size_type n) + THashMap(InputIterator f, InputIterator l, size_type n) : rep(n, hasher(), key_equal()) { rep.insert_unique(f, l); } template <class InputIterator> - THashMap(InputIterator f, InputIterator l, size_type n, + THashMap(InputIterator f, InputIterator l, size_type n, const hasher& hf) : rep(n, hf, key_equal()) { rep.insert_unique(f, l); } template <class InputIterator> - THashMap(InputIterator f, InputIterator l, size_type n, + THashMap(InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { rep.insert_unique(f, l); } - THashMap(const std::initializer_list<std::pair<Key, T>>& list) + THashMap(const std::initializer_list<std::pair<Key, T>>& list) : rep(list.size(), hasher(), key_equal()) { for (const auto& v : list) { @@ -1516,8 +1516,8 @@ public: } } - // THashMap has implicit copy/move constructors and copy-/move-assignment operators - // because its implementation is backed by THashTable. + // THashMap has implicit copy/move constructors and copy-/move-assignment operators + // because its implementation is backed by THashTable. // See hash_ut.cpp public: @@ -1537,7 +1537,7 @@ public: explicit operator bool() const noexcept { return !empty(); } - void swap(THashMap& hs) { + void swap(THashMap& hs) { rep.swap(hs.rep); } @@ -1735,7 +1735,7 @@ public: }; template <class Key, class T, class HashFcn, class EqualKey, class Alloc> -inline bool operator==(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm1, const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm2) { +inline bool operator==(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm1, const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm2) { if (hm1.size() != hm2.size()) { return false; } @@ -1749,14 +1749,14 @@ inline bool operator==(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm1, co } template <class Key, class T, class HashFcn, class EqualKey, class Alloc> -inline bool operator!=(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm1, const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm2) { +inline bool operator!=(const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm1, const THashMap<Key, T, HashFcn, EqualKey, Alloc>& hm2) { return !(hm1 == hm2); } template <class Key, class T, class HashFcn, class EqualKey, class Alloc> -class THashMultiMap { +class THashMultiMap { private: - using ht = THashTable<std::pair<const Key, T>, Key, HashFcn, TSelect1st, EqualKey, Alloc>; + using ht = THashTable<std::pair<const Key, T>, Key, HashFcn, TSelect1st, EqualKey, Alloc>; ht rep; public: @@ -1786,54 +1786,54 @@ public: } public: - THashMultiMap() + THashMultiMap() : rep(0, hasher(), key_equal()) { } template <typename TAllocParam> - explicit THashMultiMap(TAllocParam* allocParam) + explicit THashMultiMap(TAllocParam* allocParam) : rep(0, hasher(), key_equal(), allocParam) { } - explicit THashMultiMap(size_type n) + explicit THashMultiMap(size_type n) : rep(n, hasher(), key_equal()) { } - THashMultiMap(size_type n, const hasher& hf) + THashMultiMap(size_type n, const hasher& hf) : rep(n, hf, key_equal()) { } - THashMultiMap(size_type n, const hasher& hf, const key_equal& eql) + THashMultiMap(size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { } template <class InputIterator> - THashMultiMap(InputIterator f, InputIterator l) + THashMultiMap(InputIterator f, InputIterator l) : rep(0, hasher(), key_equal()) { rep.insert_equal(f, l); } template <class InputIterator> - THashMultiMap(InputIterator f, InputIterator l, size_type n) + THashMultiMap(InputIterator f, InputIterator l, size_type n) : rep(n, hasher(), key_equal()) { rep.insert_equal(f, l); } template <class InputIterator> - THashMultiMap(InputIterator f, InputIterator l, size_type n, const hasher& hf) + THashMultiMap(InputIterator f, InputIterator l, size_type n, const hasher& hf) : rep(n, hf, key_equal()) { rep.insert_equal(f, l); } template <class InputIterator> - THashMultiMap(InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eql) + THashMultiMap(InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { rep.insert_equal(f, l); } - THashMultiMap(std::initializer_list<std::pair<Key, T>> list) + THashMultiMap(std::initializer_list<std::pair<Key, T>> list) : rep(list.size(), hasher(), key_equal()) { for (const auto& v : list) { @@ -1841,8 +1841,8 @@ public: } } - // THashMultiMap has implicit copy/move constructors and copy-/move-assignment operators - // because its implementation is backed by THashTable. + // THashMultiMap has implicit copy/move constructors and copy-/move-assignment operators + // because its implementation is backed by THashTable. // See hash_ut.cpp public: @@ -1862,7 +1862,7 @@ public: explicit operator bool() const noexcept { return !empty(); } - void swap(THashMultiMap& hs) { + void swap(THashMultiMap& hs) { rep.swap(hs.rep); } @@ -1995,14 +1995,14 @@ public: }; template <class Key, class T, class HF, class EqKey, class Alloc> -inline bool operator==(const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm1, const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm2) { +inline bool operator==(const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm1, const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm2) { // NOTE: copy-pasted from // contrib/libs/cxxsupp/libcxx/include/unordered_map - // and adapted to THashMultiMap + // and adapted to THashMultiMap if (hm1.size() != hm2.size()) { return false; } - using const_iterator = typename THashMultiMap<Key, T, HF, EqKey, Alloc>::const_iterator; + using const_iterator = typename THashMultiMap<Key, T, HF, EqKey, Alloc>::const_iterator; using TEqualRange = std::pair<const_iterator, const_iterator>; for (const_iterator it = hm1.begin(), end = hm1.end(); it != end;) { TEqualRange eq1 = hm1.equal_range(it->first); @@ -2018,7 +2018,7 @@ inline bool operator==(const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm1, const } template <class Key, class T, class HF, class EqKey, class Alloc> -inline bool operator!=(const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm1, const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm2) { +inline bool operator!=(const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm1, const THashMultiMap<Key, T, HF, EqKey, Alloc>& hm2) { return !(hm1 == hm2); } diff --git a/util/generic/hash.pxd b/util/generic/hash.pxd index 385c10d805f..fd24d1ef276 100644 --- a/util/generic/hash.pxd +++ b/util/generic/hash.pxd @@ -1,7 +1,7 @@ from libcpp.pair cimport pair cdef extern from "util/generic/hash.h" nogil: - cdef cppclass THashMap[T, U]: + cdef cppclass THashMap[T, U]: cppclass iterator: pair[T, U]& operator*() iterator operator++() @@ -22,17 +22,17 @@ cdef extern from "util/generic/hash.h" nogil: cppclass const_reverse_iterator(reverse_iterator): pass - THashMap() except + - THashMap(THashMap&) except + + THashMap() except + + THashMap(THashMap&) except + U& operator[](T&) - THashMap& operator=(THashMap&) + THashMap& operator=(THashMap&) - bint operator==(THashMap&) - bint operator!=(THashMap&) - bint operator<(THashMap&) - bint operator>(THashMap&) - bint operator<=(THashMap&) - bint operator>=(THashMap&) + bint operator==(THashMap&) + bint operator!=(THashMap&) + bint operator<(THashMap&) + bint operator>(THashMap&) + bint operator<=(THashMap&) + bint operator>=(THashMap&) U& at(T&) except + iterator begin() @@ -53,7 +53,7 @@ cdef extern from "util/generic/hash.h" nogil: iterator insert(iterator, pair[T, U]) # XXX pair[T,U]& size_t max_size() size_t size() - void swap(THashMap&) + void swap(THashMap&) iterator lower_bound(T&) const_iterator const_lower_bound "lower_bound"(T&) reverse_iterator rbegin() diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h index e8088cf23b4..7890b7ab07e 100644 --- a/util/generic/hash_set.h +++ b/util/generic/hash_set.h @@ -9,9 +9,9 @@ #undef value_type template <class Value, class HashFcn, class EqualKey, class Alloc> -class THashSet { +class THashSet { private: - using ht = THashTable<Value, Value, HashFcn, ::TIdentity, EqualKey, Alloc>; + using ht = THashTable<Value, Value, HashFcn, ::TIdentity, EqualKey, Alloc>; ht rep; using mutable_iterator = typename ht::iterator; @@ -43,76 +43,76 @@ public: } public: - THashSet() { + THashSet() { } template <class TT> - explicit THashSet(TT* allocParam, size_type n = 0) + explicit THashSet(TT* allocParam, size_type n = 0) : rep(n, hasher(), key_equal(), allocParam) { } - explicit THashSet(size_type n) + explicit THashSet(size_type n) : rep(n, hasher(), key_equal()) { } - THashSet(size_type n, const hasher& hf) + THashSet(size_type n, const hasher& hf) : rep(n, hf, key_equal()) { } - THashSet(size_type n, const hasher& hf, const key_equal& eql) + THashSet(size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { } - THashSet(std::initializer_list<value_type> list) + THashSet(std::initializer_list<value_type> list) : rep(list.size(), hasher(), key_equal()) { rep.insert_unique(list.begin(), list.end()); } - THashSet(std::initializer_list<value_type> list, size_type n) + THashSet(std::initializer_list<value_type> list, size_type n) : rep(n, hasher(), key_equal()) { rep.insert_unique(list.begin(), list.end()); } - THashSet(std::initializer_list<value_type> list, size_type n, const hasher& hf) + THashSet(std::initializer_list<value_type> list, size_type n, const hasher& hf) : rep(n, hf, key_equal()) { rep.insert_unique(list.begin(), list.end()); } - THashSet(std::initializer_list<value_type> list, size_type n, const hasher& hf, const key_equal& eql) + THashSet(std::initializer_list<value_type> list, size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { rep.insert_unique(list.begin(), list.end()); } template <class InputIterator> - THashSet(InputIterator f, InputIterator l) + THashSet(InputIterator f, InputIterator l) : rep(0, hasher(), key_equal()) { rep.insert_unique(f, l); } template <class InputIterator> - THashSet(InputIterator f, InputIterator l, size_type n) + THashSet(InputIterator f, InputIterator l, size_type n) : rep(n, hasher(), key_equal()) { rep.insert_unique(f, l); } template <class InputIterator> - THashSet(InputIterator f, InputIterator l, size_type n, + THashSet(InputIterator f, InputIterator l, size_type n, const hasher& hf) : rep(n, hf, key_equal()) { rep.insert_unique(f, l); } template <class InputIterator> - THashSet(InputIterator f, InputIterator l, size_type n, + THashSet(InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { rep.insert_unique(f, l); } - // THashSet has implicit copy/move constructors and copy-/move-assignment operators - // because its implementation is backed by THashTable. + // THashSet has implicit copy/move constructors and copy-/move-assignment operators + // because its implementation is backed by THashTable. // See hash_ut.cpp public: @@ -129,7 +129,7 @@ public: explicit operator bool() const noexcept { return !empty(); } - void swap(THashSet& hs) { + void swap(THashSet& hs) { rep.swap(hs.rep); } @@ -261,7 +261,7 @@ public: }; template <class Value, class HashFcn, class EqualKey, class Alloc> -inline bool operator==(const THashSet<Value, HashFcn, EqualKey, Alloc>& hs1, const THashSet<Value, HashFcn, EqualKey, Alloc>& hs2) { +inline bool operator==(const THashSet<Value, HashFcn, EqualKey, Alloc>& hs1, const THashSet<Value, HashFcn, EqualKey, Alloc>& hs2) { if (hs1.size() != hs2.size()) { return false; } @@ -274,14 +274,14 @@ inline bool operator==(const THashSet<Value, HashFcn, EqualKey, Alloc>& hs1, con } template <class Value, class HashFcn, class EqualKey, class Alloc> -inline bool operator!=(const THashSet<Value, HashFcn, EqualKey, Alloc>& hs1, const THashSet<Value, HashFcn, EqualKey, Alloc>& hs2) { +inline bool operator!=(const THashSet<Value, HashFcn, EqualKey, Alloc>& hs1, const THashSet<Value, HashFcn, EqualKey, Alloc>& hs2) { return !(hs1 == hs2); } template <class Value, class HashFcn, class EqualKey, class Alloc> -class THashMultiSet { +class THashMultiSet { private: - using ht = THashTable<Value, Value, HashFcn, ::TIdentity, EqualKey, Alloc>; + using ht = THashTable<Value, Value, HashFcn, ::TIdentity, EqualKey, Alloc>; ht rep; public: @@ -310,58 +310,58 @@ public: } public: - THashMultiSet() + THashMultiSet() : rep(0, hasher(), key_equal()) { } - explicit THashMultiSet(size_type n) + explicit THashMultiSet(size_type n) : rep(n, hasher(), key_equal()) { } - THashMultiSet(size_type n, const hasher& hf) + THashMultiSet(size_type n, const hasher& hf) : rep(n, hf, key_equal()) { } - THashMultiSet(size_type n, const hasher& hf, const key_equal& eql) + THashMultiSet(size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { } template <class InputIterator> - THashMultiSet(InputIterator f, InputIterator l) + THashMultiSet(InputIterator f, InputIterator l) : rep(0, hasher(), key_equal()) { rep.insert_equal(f, l); } template <class InputIterator> - THashMultiSet(InputIterator f, InputIterator l, size_type n) + THashMultiSet(InputIterator f, InputIterator l, size_type n) : rep(n, hasher(), key_equal()) { rep.insert_equal(f, l); } template <class InputIterator> - THashMultiSet(InputIterator f, InputIterator l, size_type n, + THashMultiSet(InputIterator f, InputIterator l, size_type n, const hasher& hf) : rep(n, hf, key_equal()) { rep.insert_equal(f, l); } template <class InputIterator> - THashMultiSet(InputIterator f, InputIterator l, size_type n, + THashMultiSet(InputIterator f, InputIterator l, size_type n, const hasher& hf, const key_equal& eql) : rep(n, hf, eql) { rep.insert_equal(f, l); } - THashMultiSet(std::initializer_list<value_type> list) + THashMultiSet(std::initializer_list<value_type> list) : rep(list.size(), hasher(), key_equal()) { rep.insert_equal(list.begin(), list.end()); } - // THashMultiSet has implicit copy/move constructors and copy-/move-assignment operators - // because its implementation is backed by THashTable. + // THashMultiSet has implicit copy/move constructors and copy-/move-assignment operators + // because its implementation is backed by THashTable. // See hash_ut.cpp public: @@ -378,7 +378,7 @@ public: explicit operator bool() const noexcept { return !empty(); } - void swap(THashMultiSet& hs) { + void swap(THashMultiSet& hs) { rep.swap(hs.rep); } @@ -464,7 +464,7 @@ public: }; template <class Val, class HashFcn, class EqualKey, class Alloc> -inline bool operator==(const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs1, const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs2) { +inline bool operator==(const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs1, const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs2) { if (hs1.size() != hs2.size()) { return false; } @@ -483,6 +483,6 @@ inline bool operator==(const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs1, } template <class Val, class HashFcn, class EqualKey, class Alloc> -inline bool operator!=(const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs1, const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs2) { +inline bool operator!=(const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs1, const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs2) { return !(hs1 == hs2); } diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp index 0551d587708..12de252a26f 100644 --- a/util/generic/hash_ut.cpp +++ b/util/generic/hash_ut.cpp @@ -61,7 +61,7 @@ class THashTest: public TTestBase { UNIT_TEST(TestTupleHash); UNIT_TEST_SUITE_END(); - using hmset = THashMultiSet<char, hash<char>, TEqualTo<char>>; + using hmset = THashMultiSet<char, hash<char>, TEqualTo<char>>; protected: void TestHMapConstructorsAndAssignments(); @@ -115,7 +115,7 @@ protected: UNIT_TEST_SUITE_REGISTRATION(THashTest); void THashTest::TestHMapConstructorsAndAssignments() { - using container = THashMap<TString, int>; + using container = THashMap<TString, int>; container c1; c1["one"] = 1; @@ -166,7 +166,7 @@ void THashTest::TestHMapConstructorsAndAssignments() { } void THashTest::TestHMap1() { - using maptype = THashMap<char, TString, THash<char>, TEqualTo<char>>; + using maptype = THashMap<char, TString, THash<char>, TEqualTo<char>>; maptype m; // Store mappings between roman numerals and decimals. m['l'] = "50"; @@ -182,11 +182,11 @@ void THashTest::TestHMap1() { UNIT_ASSERT(m.contains('z')); UNIT_ASSERT(m.count('z') == 1); - auto p = m.insert(std::pair<const char, TString>('c', TString("100"))); + auto p = m.insert(std::pair<const char, TString>('c', TString("100"))); UNIT_ASSERT(p.second); - p = m.insert(std::pair<const char, TString>('c', TString("100"))); + p = m.insert(std::pair<const char, TString>('c', TString("100"))); UNIT_ASSERT(!p.second); //Some iterators compare check, really compile time checks @@ -203,7 +203,7 @@ void THashTest::TestHMap1() { } void THashTest::TestHMapEqualityOperator() { - using container = THashMap<TString, int>; + using container = THashMap<TString, int>; container base; base["one"] = 1; @@ -226,7 +226,7 @@ void THashTest::TestHMapEqualityOperator() { } void THashTest::TestHMMapEqualityOperator() { - using container = THashMultiMap<TString, int>; + using container = THashMultiMap<TString, int>; using value = container::value_type; container base; @@ -261,7 +261,7 @@ void THashTest::TestHMMapEqualityOperator() { } void THashTest::TestHMMapConstructorsAndAssignments() { - using container = THashMultiMap<TString, int>; + using container = THashMultiMap<TString, int>; container c1; c1.insert(container::value_type("one", 1)); @@ -291,7 +291,7 @@ void THashTest::TestHMMapConstructorsAndAssignments() { } void THashTest::TestHMMap1() { - using mmap = THashMultiMap<char, int, THash<char>, TEqualTo<char>>; + using mmap = THashMultiMap<char, int, THash<char>, TEqualTo<char>>; mmap m; UNIT_ASSERT(m.count('X') == 0); @@ -329,7 +329,7 @@ void THashTest::TestHMMap1() { UNIT_ASSERT(cite == (mmap::const_iterator)ite); UNIT_ASSERT(!(cite != (mmap::const_iterator)ite)); - using HMapType = THashMultiMap<size_t, size_t>; + using HMapType = THashMultiMap<size_t, size_t>; HMapType hmap; //We fill the map to implicitely start a rehash. @@ -356,7 +356,7 @@ void THashTest::TestHMMap1() { } void THashTest::TestHMMapHas() { - using mmap = THashMultiMap<char, int, THash<char>, TEqualTo<char>>; + using mmap = THashMultiMap<char, int, THash<char>, TEqualTo<char>>; mmap m; m.insert(std::pair<const char, int>('X', 10)); m.insert(std::pair<const char, int>('X', 20)); @@ -367,7 +367,7 @@ void THashTest::TestHMMapHas() { } void THashTest::TestHSetConstructorsAndAssignments() { - using container = THashSet<int>; + using container = THashSet<int>; container c1; c1.insert(100); @@ -408,7 +408,7 @@ void THashTest::TestHSetConstructorsAndAssignments() { } void THashTest::TestHSetSize() { - using container = THashSet<int>; + using container = THashSet<int>; container c; c.insert(100); @@ -422,7 +422,7 @@ void THashTest::TestHSetSize() { } void THashTest::TestHSet2() { - THashSet<int, THash<int>, TEqualTo<int>> s; + THashSet<int, THash<int>, TEqualTo<int>> s; auto p = s.insert(42); UNIT_ASSERT(p.second); UNIT_ASSERT(*(p.first) == 42); @@ -432,7 +432,7 @@ void THashTest::TestHSet2() { } void THashTest::TestHSetEqualityOperator() { - using container = THashSet<int>; + using container = THashSet<int>; container base; base.insert(1); @@ -458,7 +458,7 @@ void THashTest::TestHSetEqualityOperator() { } void THashTest::TestHMSetConstructorsAndAssignments() { - using container = THashMultiSet<int>; + using container = THashMultiSet<int>; container c1; c1.insert(100); @@ -493,7 +493,7 @@ void THashTest::TestHMSetConstructorsAndAssignments() { } void THashTest::TestHMSetSize() { - using container = THashMultiSet<int>; + using container = THashMultiSet<int>; container c; c.insert(100); @@ -523,7 +523,7 @@ void THashTest::TestHMSet1() { } void THashTest::TestHMSetEqualityOperator() { - using container = THashMultiSet<int>; + using container = THashMultiSet<int>; container base; base.insert(1); @@ -605,7 +605,7 @@ void THashTest::TestHMSetEmplace() { } void THashTest::TestInsertErase() { - using hmap = THashMap<TString, size_t, THash<TString>, TEqualTo<TString>>; + using hmap = THashMap<TString, size_t, THash<TString>, TEqualTo<TString>>; using val_type = hmap::value_type; { @@ -635,10 +635,10 @@ void THashTest::TestInsertErase() { namespace { struct TItem: public TSimpleRefCount<TItem> { - const TString Key; - const TString Value; + const TString Key; + const TString Value; - TItem(const TString& key, const TString& value) + TItem(const TString& key, const TString& value) : Key(key) , Value(value) { @@ -648,26 +648,26 @@ namespace { using TItemPtr = TIntrusivePtr<TItem>; struct TSelectKey { - const TString& operator()(const TItemPtr& item) const { + const TString& operator()(const TItemPtr& item) const { return item->Key; } }; - using TItemMapBase = THashTable< + using TItemMapBase = THashTable< TItemPtr, - TString, - THash<TString>, + TString, + THash<TString>, TSelectKey, - TEqualTo<TString>, + TEqualTo<TString>, std::allocator<TItemPtr>>; struct TItemMap: public TItemMapBase { TItemMap() - : TItemMapBase(1, THash<TString>(), TEqualTo<TString>()) + : TItemMapBase(1, THash<TString>(), TEqualTo<TString>()) { } - TItem& Add(const TString& key, const TString& value) { + TItem& Add(const TString& key, const TString& value) { insert_ctx ins; iterator it = find_i(key, ins); if (it == end()) { @@ -701,13 +701,13 @@ static void EmptyAndInsertTest(typename T::value_type v) { } void THashTest::TestEmpty() { - EmptyAndInsertTest<THashSet<int>>(1); - EmptyAndInsertTest<THashMap<int, int>>(std::pair<int, int>(1, 2)); - EmptyAndInsertTest<THashMultiMap<int, int>>(std::pair<int, int>(1, 2)); + EmptyAndInsertTest<THashSet<int>>(1); + EmptyAndInsertTest<THashMap<int, int>>(std::pair<int, int>(1, 2)); + EmptyAndInsertTest<THashMultiMap<int, int>>(std::pair<int, int>(1, 2)); } void THashTest::TestDefaultConstructor() { - THashSet<int> set; + THashSet<int> set; UNIT_ASSERT(set.begin() == set.end()); @@ -719,18 +719,18 @@ void THashTest::TestDefaultConstructor() { void THashTest::TestSizeOf() { /* This test checks that we don't waste memory when all functors passed to - * THashTable are empty. It does rely on knowledge of THashTable internals, + * THashTable are empty. It does rely on knowledge of THashTable internals, * so if those change, the test will have to be adjusted accordingly. */ size_t expectedSize = sizeof(uintptr_t) + 3 * sizeof(size_t); - UNIT_ASSERT_VALUES_EQUAL(sizeof(THashMap<int, int>), expectedSize); - UNIT_ASSERT_VALUES_EQUAL(sizeof(THashMap<std::pair<int, int>, std::pair<int, int>>), expectedSize); + UNIT_ASSERT_VALUES_EQUAL(sizeof(THashMap<int, int>), expectedSize); + UNIT_ASSERT_VALUES_EQUAL(sizeof(THashMap<std::pair<int, int>, std::pair<int, int>>), expectedSize); } void THashTest::TestInvariants() { std::set<int> reference_set; - THashSet<int> set; + THashSet<int> set; for (int i = 0; i < 1000; i++) { set.insert(i); @@ -775,7 +775,7 @@ struct TAllocatorCounters { size_t Allocations; size_t Deallocations; - TSet<std::pair<void*, size_t>> Chunks; + TSet<std::pair<void*, size_t>> Chunks; }; template <class T> @@ -834,7 +834,7 @@ private: void THashTest::TestAllocation() { TAllocatorCounters counters; - using int_set = THashSet<int, THash<int>, TEqualTo<int>, TCountingAllocator<int>>; + using int_set = THashSet<int, THash<int>, TEqualTo<int>, TCountingAllocator<int>>; { int_set set0(&counters); @@ -881,14 +881,14 @@ public: }; void THashTest::TestInsertCopy() { - THashMap<int, int> hash; + THashMap<int, int> hash; /* Insertion should not make copies of the provided key. */ hash[TNonCopyableInt<0>(0)] = 0; } void THashTest::TestEmplace() { - using hash_t = THashMap<int, TNonCopyableInt<0>>; + using hash_t = THashMap<int, TNonCopyableInt<0>>; hash_t hash; hash.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(0)); auto it = hash.find(1); @@ -896,7 +896,7 @@ void THashTest::TestEmplace() { } void THashTest::TestEmplaceNoresize() { - using hash_t = THashMap<int, TNonCopyableInt<0>>; + using hash_t = THashMap<int, TNonCopyableInt<0>>; hash_t hash; hash.reserve(1); hash.emplace_noresize(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(0)); @@ -905,7 +905,7 @@ void THashTest::TestEmplaceNoresize() { } void THashTest::TestEmplaceDirect() { - using hash_t = THashMap<int, TNonCopyableInt<0>>; + using hash_t = THashMap<int, TNonCopyableInt<0>>; hash_t hash; hash_t::insert_ctx ins; hash.find(1, ins); @@ -981,7 +981,7 @@ void THashTest::TestTryEmplaceCopyKey() { } void THashTest::TestHMMapEmplace() { - using hash_t = THashMultiMap<int, TNonCopyableInt<0>>; + using hash_t = THashMultiMap<int, TNonCopyableInt<0>>; hash_t hash; hash.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(0)); auto it = hash.find(1); @@ -989,7 +989,7 @@ void THashTest::TestHMMapEmplace() { } void THashTest::TestHMMapEmplaceNoresize() { - using hash_t = THashMultiMap<int, TNonCopyableInt<0>>; + using hash_t = THashMultiMap<int, TNonCopyableInt<0>>; hash_t hash; hash.reserve(1); hash.emplace_noresize(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(0)); @@ -998,7 +998,7 @@ void THashTest::TestHMMapEmplaceNoresize() { } void THashTest::TestHMMapEmplaceDirect() { - using hash_t = THashMultiMap<int, TNonCopyableInt<0>>; + using hash_t = THashMultiMap<int, TNonCopyableInt<0>>; hash_t hash; hash_t::insert_ctx ins; hash.find(1, ins); @@ -1008,7 +1008,7 @@ void THashTest::TestHMMapEmplaceDirect() { } void THashTest::TestHSetEmplace() { - using hash_t = THashSet<TNonCopyableInt<0>, THash<int>, TEqualTo<int>>; + using hash_t = THashSet<TNonCopyableInt<0>, THash<int>, TEqualTo<int>>; hash_t hash; UNIT_ASSERT(!hash.contains(0)); hash.emplace(0); @@ -1017,7 +1017,7 @@ void THashTest::TestHSetEmplace() { } void THashTest::TestHSetEmplaceNoresize() { - using hash_t = THashSet<TNonCopyableInt<0>, THash<int>, TEqualTo<int>>; + using hash_t = THashSet<TNonCopyableInt<0>, THash<int>, TEqualTo<int>>; hash_t hash; hash.reserve(1); UNIT_ASSERT(!hash.contains(0)); @@ -1027,7 +1027,7 @@ void THashTest::TestHSetEmplaceNoresize() { } void THashTest::TestHSetEmplaceDirect() { - using hash_t = THashSet<TNonCopyableInt<0>, THash<int>, TEqualTo<int>>; + using hash_t = THashSet<TNonCopyableInt<0>, THash<int>, TEqualTo<int>>; hash_t hash; UNIT_ASSERT(!hash.contains(0)); hash_t::insert_ctx ins; @@ -1049,7 +1049,7 @@ void THashTest::TestNonCopyable() { } }; - THashMap<int, TValue> hash; + THashMap<int, TValue> hash; hash.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple(5)); auto&& value = hash[1]; UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(value), 5); @@ -1058,7 +1058,7 @@ void THashTest::TestNonCopyable() { } void THashTest::TestValueInitialization() { - THashMap<int, int> hash; + THashMap<int, int> hash; int& value = hash[0]; @@ -1070,21 +1070,21 @@ void THashTest::TestAssignmentClear() { /* This one tests that assigning an empty hash resets the buckets array. * See operator= for details. */ - THashMap<int, int> hash; + THashMap<int, int> hash; size_t emptyBucketCount = hash.bucket_count(); for (int i = 0; i < 100; i++) { hash[i] = i; } - hash = THashMap<int, int>(); + hash = THashMap<int, int>(); UNIT_ASSERT_VALUES_EQUAL(hash.bucket_count(), emptyBucketCount); } void THashTest::TestReleaseNodes() { TAllocatorCounters counters; - using TIntSet = THashSet<int, THash<int>, TEqualTo<int>, TCountingAllocator<int>>; + using TIntSet = THashSet<int, THash<int>, TEqualTo<int>, TCountingAllocator<int>>; TIntSet set(&counters); for (int i = 0; i < 3; i++) { @@ -1127,10 +1127,10 @@ void THashTest::TestAt() { } \ } - TEST_AT_THROWN_EXCEPTION(TString, TString, TString, "111", "111"); - TEST_AT_THROWN_EXCEPTION(TString, TString, const TString, "111", "111"); - TEST_AT_THROWN_EXCEPTION(TString, TString, TStringBuf, "111", "111"); - TEST_AT_THROWN_EXCEPTION(TString, TString, const TStringBuf, "111", "111"); + TEST_AT_THROWN_EXCEPTION(TString, TString, TString, "111", "111"); + TEST_AT_THROWN_EXCEPTION(TString, TString, const TString, "111", "111"); + TEST_AT_THROWN_EXCEPTION(TString, TString, TStringBuf, "111", "111"); + TEST_AT_THROWN_EXCEPTION(TString, TString, const TStringBuf, "111", "111"); TEST_AT_THROWN_EXCEPTION(TStringBuf, TStringBuf, const char*, "111", "111"); TEST_AT_THROWN_EXCEPTION(int, int, short, 11, "11"); TEST_AT_THROWN_EXCEPTION(int, int, int, -1, "-1"); @@ -1142,36 +1142,36 @@ void THashTest::TestAt() { TEST_AT_THROWN_EXCEPTION(int, int, unsigned long long, 1000000000000ll, "1000000000000"); char key[] = {11, 12, 0, 1, 2, 11, 0}; - TEST_AT_THROWN_EXCEPTION(TString, TString, char*, key, "\\x0B\\x0C"); + TEST_AT_THROWN_EXCEPTION(TString, TString, char*, key, "\\x0B\\x0C"); TEST_AT_THROWN_EXCEPTION(TString, TString, TStringBuf, TStringBuf(key, sizeof(key) - 1), "\\x0B\\x0C\\0\\1\\2\\x0B"); #undef TEST_AT_THROWN_EXCEPTION } void THashTest::TestHMapInitializerList() { - THashMap<TString, TString> h1 = {{"foo", "bar"}, {"bar", "baz"}, {"baz", "qux"}}; - THashMap<TString, TString> h2; - h2.insert(std::pair<TString, TString>("foo", "bar")); - h2.insert(std::pair<TString, TString>("bar", "baz")); - h2.insert(std::pair<TString, TString>("baz", "qux")); + THashMap<TString, TString> h1 = {{"foo", "bar"}, {"bar", "baz"}, {"baz", "qux"}}; + THashMap<TString, TString> h2; + h2.insert(std::pair<TString, TString>("foo", "bar")); + h2.insert(std::pair<TString, TString>("bar", "baz")); + h2.insert(std::pair<TString, TString>("baz", "qux")); UNIT_ASSERT_EQUAL(h1, h2); } void THashTest::TestHMMapInitializerList() { - THashMultiMap<TString, TString> h1 = { + THashMultiMap<TString, TString> h1 = { {"foo", "bar"}, {"foo", "baz"}, {"baz", "qux"}}; - THashMultiMap<TString, TString> h2; - h2.insert(std::pair<TString, TString>("foo", "bar")); - h2.insert(std::pair<TString, TString>("foo", "baz")); - h2.insert(std::pair<TString, TString>("baz", "qux")); + THashMultiMap<TString, TString> h2; + h2.insert(std::pair<TString, TString>("foo", "bar")); + h2.insert(std::pair<TString, TString>("foo", "baz")); + h2.insert(std::pair<TString, TString>("baz", "qux")); UNIT_ASSERT_EQUAL(h1, h2); } void THashTest::TestHSetInitializerList() { - THashSet<TString> h1 = {"foo", "bar", "baz"}; - THashSet<TString> h2; + THashSet<TString> h1 = {"foo", "bar", "baz"}; + THashSet<TString> h2; h2.insert("foo"); h2.insert("bar"); h2.insert("baz"); @@ -1179,8 +1179,8 @@ void THashTest::TestHSetInitializerList() { } void THashTest::TestHMSetInitializerList() { - THashMultiSet<TString> h1 = {"foo", "foo", "bar", "baz"}; - THashMultiSet<TString> h2; + THashMultiSet<TString> h1 = {"foo", "foo", "bar", "baz"}; + THashMultiSet<TString> h2; h2.insert("foo"); h2.insert("foo"); h2.insert("bar"); @@ -1213,20 +1213,20 @@ void Out<TFoo>(IOutputStream& o, const TFoo& v) { void THashTest::TestHSetInsertInitializerList() { { - const THashSet<int> x = {1}; - THashSet<int> y; + const THashSet<int> x = {1}; + THashSet<int> y; y.insert({1}); UNIT_ASSERT_VALUES_EQUAL(x, y); } { - const THashSet<int> x = {1, 2}; - THashSet<int> y; + const THashSet<int> x = {1, 2}; + THashSet<int> y; y.insert({1, 2}); UNIT_ASSERT_VALUES_EQUAL(x, y); } { - const THashSet<int> x = {1, 2, 3, 4, 5}; - THashSet<int> y; + const THashSet<int> x = {1, 2, 3, 4, 5}; + THashSet<int> y; y.insert({ 1, 2, @@ -1237,14 +1237,14 @@ void THashTest::TestHSetInsertInitializerList() { UNIT_ASSERT_VALUES_EQUAL(x, y); } { - const THashSet<TFoo> x = {{1, 2}}; - THashSet<TFoo> y; + const THashSet<TFoo> x = {{1, 2}}; + THashSet<TFoo> y; y.insert({{1, 2}}); UNIT_ASSERT_VALUES_EQUAL(x, y); } { - const THashSet<TFoo> x = {{1, 2}, {3, 4}}; - THashSet<TFoo> y; + const THashSet<TFoo> x = {{1, 2}, {3, 4}}; + THashSet<TFoo> y; y.insert({{1, 2}, {3, 4}}); UNIT_ASSERT_VALUES_EQUAL(x, y); } diff --git a/util/generic/hash_ut.pyx b/util/generic/hash_ut.pyx index ecf6dac2e68..ba630cecfd2 100644 --- a/util/generic/hash_ut.pyx +++ b/util/generic/hash_ut.pyx @@ -1,6 +1,6 @@ # cython: c_string_type=str, c_string_encoding=utf8 -from util.generic.hash cimport THashMap +from util.generic.hash cimport THashMap from util.generic.string cimport TString import pytest @@ -10,17 +10,17 @@ from libcpp.pair cimport pair from cython.operator cimport dereference as deref -def _check_convert(THashMap[TString, int] x): +def _check_convert(THashMap[TString, int] x): return x class TestHash(unittest.TestCase): def test_constructors_and_assignments(self): - cdef THashMap[TString, int] c1 + cdef THashMap[TString, int] c1 c1["one"] = 1 c1["two"] = 2 - cdef THashMap[TString, int] c2 = THashMap[TString, int](c1) + cdef THashMap[TString, int] c2 = THashMap[TString, int](c1) self.assertEqual(2, c1.size()) self.assertEqual(2, c2.size()) self.assertEqual(1, c1.at("one")) @@ -34,14 +34,14 @@ class TestHash(unittest.TestCase): self.assertEqual(3, c1.at("three")) def test_equality_operator(self): - cdef THashMap[TString, int] base + cdef THashMap[TString, int] base base["one"] = 1 base["two"] = 2 - cdef THashMap[TString, int] c1 = THashMap[TString, int](base) + cdef THashMap[TString, int] c1 = THashMap[TString, int](base) self.assertTrue(c1==base) - cdef THashMap[TString, int] c2 + cdef THashMap[TString, int] c2 c2["one"] = 1 c2["two"] = 2 self.assertTrue(c2 == base) @@ -49,12 +49,12 @@ class TestHash(unittest.TestCase): c2["three"] = 3 self.assertTrue(c2 != base) - cdef THashMap[TString, int] c3 = THashMap[TString, int](base) + cdef THashMap[TString, int] c3 = THashMap[TString, int](base) c3["one"] = 0 self.assertTrue(c3 != base) def test_insert_erase(self): - cdef THashMap[TString, int] tmp + cdef THashMap[TString, int] tmp self.assertTrue(tmp.insert(pair[TString, int]("one", 0)).second) self.assertFalse(tmp.insert(pair[TString, int]("one", 1)).second) self.assertTrue(tmp.insert(pair[TString, int]("two", 2)).second) @@ -66,12 +66,12 @@ class TestHash(unittest.TestCase): self.assertTrue(tmp.empty()) def test_iterators_and_find(self): - cdef THashMap[TString, int] tmp + cdef THashMap[TString, int] tmp self.assertTrue(tmp.begin() == tmp.end()) self.assertTrue(tmp.find("1") == tmp.end()) tmp["1"] = 1 self.assertTrue(tmp.begin() != tmp.end()) - cdef THashMap[TString, int].iterator it = tmp.find("1") + cdef THashMap[TString, int].iterator it = tmp.find("1") self.assertTrue(it != tmp.end()) self.assertEqual(deref(it).second, 1) diff --git a/util/generic/intrlist.h b/util/generic/intrlist.h index b5d3f2051b5..f90561e24cd 100644 --- a/util/generic/intrlist.h +++ b/util/generic/intrlist.h @@ -16,13 +16,13 @@ private: using TListItem = TIntrusiveListItem<T, Tag>; public: - inline TIntrusiveListItem() noexcept + inline TIntrusiveListItem() noexcept : Next_(this) , Prev_(Next_) { } - inline ~TIntrusiveListItem() { + inline ~TIntrusiveListItem() { Unlink(); } @@ -31,7 +31,7 @@ public: return (Prev_ == this) && (Next_ == this); } - inline void Unlink() noexcept { + inline void Unlink() noexcept { if (Empty()) { return; } @@ -42,12 +42,12 @@ public: SetEnd(); } - inline void LinkBefore(TListItem* before) noexcept { + inline void LinkBefore(TListItem* before) noexcept { Unlink(); LinkBeforeNoUnlink(before); } - inline void LinkBeforeNoUnlink(TListItem* before) noexcept { + inline void LinkBeforeNoUnlink(TListItem* before) noexcept { TListItem* const after = before->Prev(); after->SetNext(this); @@ -56,56 +56,56 @@ public: before->SetPrev(this); } - inline void LinkBefore(TListItem& before) noexcept { + inline void LinkBefore(TListItem& before) noexcept { LinkBefore(&before); } - inline void LinkAfter(TListItem* after) noexcept { + inline void LinkAfter(TListItem* after) noexcept { Unlink(); LinkBeforeNoUnlink(after->Next()); } - inline void LinkAfter(TListItem& after) noexcept { + inline void LinkAfter(TListItem& after) noexcept { LinkAfter(&after); } public: - inline TListItem* Prev() noexcept { + inline TListItem* Prev() noexcept { return Prev_; } - inline const TListItem* Prev() const noexcept { + inline const TListItem* Prev() const noexcept { return Prev_; } - inline TListItem* Next() noexcept { + inline TListItem* Next() noexcept { return Next_; } - inline const TListItem* Next() const noexcept { + inline const TListItem* Next() const noexcept { return Next_; } public: - inline void SetEnd() noexcept { + inline void SetEnd() noexcept { Prev_ = this; Next_ = Prev_; } - inline void SetNext(TListItem* item) noexcept { + inline void SetNext(TListItem* item) noexcept { Next_ = item; } - inline void SetPrev(TListItem* item) noexcept { + inline void SetPrev(TListItem* item) noexcept { Prev_ = item; } public: - inline T* Node() noexcept { + inline T* Node() noexcept { return static_cast<T*>(this); } - inline const T* Node() const noexcept { + inline const T* Node() const noexcept { return static_cast<const T*>(this); } @@ -137,51 +137,51 @@ private: using reference = TReference; using pointer = TPointer; - inline TIteratorBase() noexcept + inline TIteratorBase() noexcept : Item_(nullptr) { } template <class TListItem_, class TNode_> - inline TIteratorBase(const TIteratorBase<TListItem_, TNode_>& right) noexcept + inline TIteratorBase(const TIteratorBase<TListItem_, TNode_>& right) noexcept : Item_(right.Item()) { } - inline TIteratorBase(TItem* item) noexcept + inline TIteratorBase(TItem* item) noexcept : Item_(item) { } - inline TItem* Item() const noexcept { + inline TItem* Item() const noexcept { return Item_; } - inline void Next() noexcept { + inline void Next() noexcept { Item_ = Item_->Next(); } - inline void Prev() noexcept { + inline void Prev() noexcept { Item_ = Item_->Prev(); } template <class TListItem_, class TNode_> - inline bool operator==(const TIteratorBase<TListItem_, TNode_>& right) const noexcept { + inline bool operator==(const TIteratorBase<TListItem_, TNode_>& right) const noexcept { return Item() == right.Item(); } template <class TListItem_, class TNode_> - inline bool operator!=(const TIteratorBase<TListItem_, TNode_>& right) const noexcept { + inline bool operator!=(const TIteratorBase<TListItem_, TNode_>& right) const noexcept { return Item() != right.Item(); } - inline TIteratorBase& operator++() noexcept { + inline TIteratorBase& operator++() noexcept { Next(); return *this; } - inline TIteratorBase operator++(int) noexcept { + inline TIteratorBase operator++(int) noexcept { TIteratorBase ret(*this); Next(); @@ -189,13 +189,13 @@ private: return ret; } - inline TIteratorBase& operator--() noexcept { + inline TIteratorBase& operator--() noexcept { Prev(); return *this; } - inline TIteratorBase operator--(int) noexcept { + inline TIteratorBase operator--(int) noexcept { TIteratorBase ret(*this); Prev(); @@ -203,11 +203,11 @@ private: return ret; } - inline TReference operator*() const noexcept { + inline TReference operator*() const noexcept { return *Item_->Node(); } - inline TPointer operator->() const noexcept { + inline TPointer operator->() const noexcept { return Item_->Node(); } @@ -232,51 +232,51 @@ private: inline TReverseIteratorBase() noexcept = default; template <class TIterator_> - inline TReverseIteratorBase(const TReverseIteratorBase<TIterator_>& right) noexcept + inline TReverseIteratorBase(const TReverseIteratorBase<TIterator_>& right) noexcept : Current_(right.Base()) { } - inline explicit TReverseIteratorBase(TIterator item) noexcept + inline explicit TReverseIteratorBase(TIterator item) noexcept : Current_(item) { } - inline TIterator Base() const noexcept { + inline TIterator Base() const noexcept { return Current_; } - inline TItem* Item() const noexcept { + inline TItem* Item() const noexcept { TIterator ret = Current_; return (--ret).Item(); } - inline void Next() noexcept { + inline void Next() noexcept { Current_.Prev(); } - inline void Prev() noexcept { + inline void Prev() noexcept { Current_.Next(); } template <class TIterator_> - inline bool operator==(const TReverseIteratorBase<TIterator_>& right) const noexcept { + inline bool operator==(const TReverseIteratorBase<TIterator_>& right) const noexcept { return Base() == right.Base(); } template <class TIterator_> - inline bool operator!=(const TReverseIteratorBase<TIterator_>& right) const noexcept { + inline bool operator!=(const TReverseIteratorBase<TIterator_>& right) const noexcept { return Base() != right.Base(); } - inline TReverseIteratorBase& operator++() noexcept { + inline TReverseIteratorBase& operator++() noexcept { Next(); return *this; } - inline TReverseIteratorBase operator++(int) noexcept { + inline TReverseIteratorBase operator++(int) noexcept { TReverseIteratorBase ret(*this); Next(); @@ -284,13 +284,13 @@ private: return ret; } - inline TReverseIteratorBase& operator--() noexcept { + inline TReverseIteratorBase& operator--() noexcept { Prev(); return *this; } - inline TReverseIteratorBase operator--(int) noexcept { + inline TReverseIteratorBase operator--(int) noexcept { TReverseIteratorBase ret(*this); Prev(); @@ -298,13 +298,13 @@ private: return ret; } - inline TReference operator*() const noexcept { + inline TReference operator*() const noexcept { TIterator ret = Current_; return *--ret; } - inline TPointer operator->() const noexcept { + inline TPointer operator->() const noexcept { TIterator ret = Current_; return &*--ret; @@ -328,7 +328,7 @@ public: using const_reverse_iterator = TConstReverseIterator; public: - inline void Swap(TIntrusiveList& right) noexcept { + inline void Swap(TIntrusiveList& right) noexcept { TIntrusiveList temp; temp.Append(right); @@ -344,7 +344,7 @@ public: inline ~TIntrusiveList() = default; - inline TIntrusiveList(TIntrusiveList&& right) noexcept { + inline TIntrusiveList(TIntrusiveList&& right) noexcept { this->Swap(right); } @@ -353,7 +353,7 @@ public: return *this; } - inline explicit operator bool() const noexcept { + inline explicit operator bool() const noexcept { return !Empty(); } @@ -361,7 +361,7 @@ public: return End_.Empty(); } - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return std::distance(Begin(), End()); } @@ -369,126 +369,126 @@ public: item->Unlink(); } - inline void Clear() noexcept { + inline void Clear() noexcept { End_.Unlink(); } public: - inline TIterator Begin() noexcept { + inline TIterator Begin() noexcept { return ++End(); } - inline TIterator End() noexcept { + inline TIterator End() noexcept { return TIterator(&End_); } - inline TConstIterator Begin() const noexcept { + inline TConstIterator Begin() const noexcept { return ++End(); } - inline TConstIterator End() const noexcept { + inline TConstIterator End() const noexcept { return TConstIterator(&End_); } - inline TReverseIterator RBegin() noexcept { + inline TReverseIterator RBegin() noexcept { return TReverseIterator(End()); } - inline TReverseIterator REnd() noexcept { + inline TReverseIterator REnd() noexcept { return TReverseIterator(Begin()); } - inline TConstReverseIterator RBegin() const noexcept { + inline TConstReverseIterator RBegin() const noexcept { return TConstReverseIterator(End()); } - inline TConstReverseIterator REnd() const noexcept { + inline TConstReverseIterator REnd() const noexcept { return TConstReverseIterator(Begin()); } - inline TConstIterator CBegin() const noexcept { + inline TConstIterator CBegin() const noexcept { return Begin(); } - inline TConstIterator CEnd() const noexcept { + inline TConstIterator CEnd() const noexcept { return End(); } - inline TConstReverseIterator CRBegin() const noexcept { + inline TConstReverseIterator CRBegin() const noexcept { return RBegin(); } - inline TConstReverseIterator CREnd() const noexcept { + inline TConstReverseIterator CREnd() const noexcept { return REnd(); } public: - inline iterator begin() noexcept { + inline iterator begin() noexcept { return Begin(); } - inline iterator end() noexcept { + inline iterator end() noexcept { return End(); } - inline const_iterator begin() const noexcept { + inline const_iterator begin() const noexcept { return Begin(); } - inline const_iterator end() const noexcept { + inline const_iterator end() const noexcept { return End(); } - inline reverse_iterator rbegin() noexcept { + inline reverse_iterator rbegin() noexcept { return RBegin(); } - inline reverse_iterator rend() noexcept { + inline reverse_iterator rend() noexcept { return REnd(); } - inline const_iterator cbegin() const noexcept { + inline const_iterator cbegin() const noexcept { return CBegin(); } - inline const_iterator cend() const noexcept { + inline const_iterator cend() const noexcept { return CEnd(); } - inline const_reverse_iterator crbegin() const noexcept { + inline const_reverse_iterator crbegin() const noexcept { return CRBegin(); } - inline const_reverse_iterator crend() const noexcept { + inline const_reverse_iterator crend() const noexcept { return CREnd(); } public: - inline T* Back() noexcept { + inline T* Back() noexcept { return End_.Prev()->Node(); } - inline T* Front() noexcept { + inline T* Front() noexcept { return End_.Next()->Node(); } - inline const T* Back() const noexcept { + inline const T* Back() const noexcept { return End_.Prev()->Node(); } - inline const T* Front() const noexcept { + inline const T* Front() const noexcept { return End_.Next()->Node(); } - inline void PushBack(TListItem* item) noexcept { + inline void PushBack(TListItem* item) noexcept { item->LinkBefore(End_); } - inline void PushFront(TListItem* item) noexcept { + inline void PushFront(TListItem* item) noexcept { item->LinkAfter(End_); } - inline T* PopBack() noexcept { + inline T* PopBack() noexcept { TListItem* const ret = End_.Prev(); ret->Unlink(); @@ -496,7 +496,7 @@ public: return ret->Node(); } - inline T* PopFront() noexcept { + inline T* PopFront() noexcept { TListItem* const ret = End_.Next(); ret->Unlink(); @@ -504,11 +504,11 @@ public: return ret->Node(); } - inline void Append(TIntrusiveList& list) noexcept { + inline void Append(TIntrusiveList& list) noexcept { Cut(list.Begin(), list.End(), End()); } - inline static void Cut(TIterator begin, TIterator end, TIterator pasteBefore) noexcept { + inline static void Cut(TIterator begin, TIterator end, TIterator pasteBefore) noexcept { if (begin == end) { return; } @@ -602,12 +602,12 @@ public: public: inline TIntrusiveListWithAutoDelete() noexcept = default; - inline TIntrusiveListWithAutoDelete(TIntrusiveListWithAutoDelete&& right) noexcept + inline TIntrusiveListWithAutoDelete(TIntrusiveListWithAutoDelete&& right) noexcept : TIntrusiveList<T, Tag>(std::move(right)) { } - inline ~TIntrusiveListWithAutoDelete() { + inline ~TIntrusiveListWithAutoDelete() { this->Clear(); } @@ -617,18 +617,18 @@ public: } public: - inline void Clear() noexcept { + inline void Clear() noexcept { this->ForEach([](auto* item) { D::Destroy(item); }); } - inline static void Cut(TIterator begin, TIterator end) noexcept { + inline static void Cut(TIterator begin, TIterator end) noexcept { TIntrusiveListWithAutoDelete<T, D, Tag> temp; Cut(begin, end, temp.End()); } - inline static void Cut(TIterator begin, TIterator end, TIterator pasteBefore) noexcept { + inline static void Cut(TIterator begin, TIterator end, TIterator pasteBefore) noexcept { TIntrusiveList<T, Tag>::Cut(begin, end, pasteBefore); } }; @@ -642,35 +642,35 @@ private: using TListItem = TIntrusiveSListItem<T, Tag>; public: - inline TIntrusiveSListItem() noexcept + inline TIntrusiveSListItem() noexcept : Next_(nullptr) { } inline ~TIntrusiveSListItem() = default; - inline bool IsEnd() const noexcept { + inline bool IsEnd() const noexcept { return Next_ == nullptr; } - inline TListItem* Next() noexcept { + inline TListItem* Next() noexcept { return Next_; } - inline const TListItem* Next() const noexcept { + inline const TListItem* Next() const noexcept { return Next_; } - inline void SetNext(TListItem* item) noexcept { + inline void SetNext(TListItem* item) noexcept { Next_ = item; } public: - inline T* Node() noexcept { + inline T* Node() noexcept { return static_cast<T*>(this); } - inline const T* Node() const noexcept { + inline const T* Node() const noexcept { return static_cast<const T*>(this); } @@ -697,30 +697,30 @@ public: using reference = TReference; using iterator_category = std::forward_iterator_tag; - inline TIteratorBase(TListItem* item) noexcept + inline TIteratorBase(TListItem* item) noexcept : Item_(item) { } - inline void Next() noexcept { + inline void Next() noexcept { Item_ = Item_->Next(); } - inline bool operator==(const TIteratorBase& right) const noexcept { + inline bool operator==(const TIteratorBase& right) const noexcept { return Item_ == right.Item_; } - inline bool operator!=(const TIteratorBase& right) const noexcept { + inline bool operator!=(const TIteratorBase& right) const noexcept { return Item_ != right.Item_; } - inline TIteratorBase& operator++() noexcept { + inline TIteratorBase& operator++() noexcept { Next(); return *this; } - inline TIteratorBase operator++(int) noexcept { + inline TIteratorBase operator++(int) noexcept { TIteratorBase ret(*this); Next(); @@ -728,11 +728,11 @@ public: return ret; } - inline TNode& operator*() noexcept { + inline TNode& operator*() noexcept { return *Item_->Node(); } - inline TNode* operator->() noexcept { + inline TNode* operator->() noexcept { return Item_->Node(); } @@ -748,16 +748,16 @@ public: using const_iterator = TConstIterator; public: - inline TIntrusiveSList() noexcept + inline TIntrusiveSList() noexcept : Begin_(nullptr) { } - inline void Swap(TIntrusiveSList& right) noexcept { + inline void Swap(TIntrusiveSList& right) noexcept { DoSwap(Begin_, right.Begin_); } - inline explicit operator bool() const noexcept { + inline explicit operator bool() const noexcept { return !Empty(); } @@ -765,79 +765,79 @@ public: return Begin_ == nullptr; } - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return std::distance(Begin(), End()); } - inline void Clear() noexcept { + inline void Clear() noexcept { Begin_ = nullptr; } - inline TIterator Begin() noexcept { + inline TIterator Begin() noexcept { return TIterator(Begin_); } - inline TIterator End() noexcept { + inline TIterator End() noexcept { return TIterator(nullptr); } - inline TConstIterator Begin() const noexcept { + inline TConstIterator Begin() const noexcept { return TConstIterator(Begin_); } - inline TConstIterator End() const noexcept { + inline TConstIterator End() const noexcept { return TConstIterator(nullptr); } - inline TConstIterator CBegin() const noexcept { + inline TConstIterator CBegin() const noexcept { return Begin(); } - inline TConstIterator CEnd() const noexcept { + inline TConstIterator CEnd() const noexcept { return End(); } //compat methods - inline iterator begin() noexcept { + inline iterator begin() noexcept { return Begin(); } - inline iterator end() noexcept { + inline iterator end() noexcept { return End(); } - inline const_iterator begin() const noexcept { + inline const_iterator begin() const noexcept { return Begin(); } - inline const_iterator end() const noexcept { + inline const_iterator end() const noexcept { return End(); } - inline const_iterator cbegin() const noexcept { + inline const_iterator cbegin() const noexcept { return CBegin(); } - inline const_iterator cend() const noexcept { + inline const_iterator cend() const noexcept { return CEnd(); } - inline T* Front() noexcept { + inline T* Front() noexcept { Y_ASSERT(Begin_); return Begin_->Node(); } - inline const T* Front() const noexcept { + inline const T* Front() const noexcept { Y_ASSERT(Begin_); return Begin_->Node(); } - inline void PushFront(TListItem* item) noexcept { + inline void PushFront(TListItem* item) noexcept { item->SetNext(Begin_); Begin_ = item; } - inline T* PopFront() noexcept { + inline T* PopFront() noexcept { Y_ASSERT(Begin_); TListItem* const ret = Begin_; @@ -846,7 +846,7 @@ public: return ret->Node(); } - inline void Reverse() noexcept { + inline void Reverse() noexcept { TIntrusiveSList temp; while (!Empty()) { diff --git a/util/generic/intrlist_ut.cpp b/util/generic/intrlist_ut.cpp index eff7cdf2eee..7d6322d6930 100644 --- a/util/generic/intrlist_ut.cpp +++ b/util/generic/intrlist_ut.cpp @@ -45,7 +45,7 @@ UNIT_TEST_SUITE_REGISTRATION(TListTest); class TInt: public TIntrusiveListItem<TInt> { public: - inline TInt(int value) noexcept + inline TInt(int value) noexcept : Value_(value) { } @@ -62,11 +62,11 @@ public: return *this; } - inline operator int&() noexcept { + inline operator int&() noexcept { return Value_; } - inline operator const int&() const noexcept { + inline operator const int&() const noexcept { return Value_; } @@ -88,7 +88,7 @@ public: //operator=(const TMyList& rhs) = default; TMyList& operator=(TMyList&& rhs) noexcept = default; - inline ~TMyList() { + inline ~TMyList() { while (!Empty()) { delete PopBack(); } @@ -96,7 +96,7 @@ public: }; struct TIntGreater: private TGreater<int> { - inline bool operator()(const TInt& l, const TInt& r) const noexcept { + inline bool operator()(const TInt& l, const TInt& r) const noexcept { return TGreater<int>::operator()(l, r); } }; @@ -154,7 +154,7 @@ public: { } - inline void operator()(const TInt* v) noexcept { + inline void operator()(const TInt* v) noexcept { Sum_ += *v; } @@ -169,7 +169,7 @@ public: { } - inline void operator()(TInt* v) noexcept { + inline void operator()(TInt* v) noexcept { if (*v % 2) { Sum_ += *v; } else { @@ -393,10 +393,10 @@ struct TSelfCountingIntDelete { }; void TListTest::TestListWithAutoDelete() { - using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; + using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; int counter{0}; { - TListType lst; + TListType lst; UNIT_ASSERT(lst.Empty()); lst.PushFront(new TSelfCountingInt(counter, 2)); UNIT_ASSERT_EQUAL(lst.Size(), 1); @@ -411,17 +411,17 @@ void TListTest::TestListWithAutoDelete() { } void TListTest::TestListWithAutoDeleteMoveCtor() { - using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; + using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; int counter{0}; { - TListType lst; + TListType lst; lst.PushFront(new TSelfCountingInt(counter, 2)); lst.PushFront(new TSelfCountingInt(counter, 1)); UNIT_ASSERT_EQUAL(lst.Size(), 2); UNIT_ASSERT_EQUAL(counter, 2); CheckList(lst); - TListType nextList(std::move(lst)); + TListType nextList(std::move(lst)); UNIT_ASSERT_EQUAL(nextList.Size(), 2); CheckList(nextList); UNIT_ASSERT_EQUAL(counter, 2); @@ -431,17 +431,17 @@ void TListTest::TestListWithAutoDeleteMoveCtor() { } void TListTest::TestListWithAutoDeleteMoveOpEq() { - using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; + using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; int counter{0}; { - TListType lst; + TListType lst; lst.PushFront(new TSelfCountingInt(counter, 2)); lst.PushFront(new TSelfCountingInt(counter, 1)); UNIT_ASSERT_EQUAL(lst.Size(), 2); UNIT_ASSERT_EQUAL(counter, 2); CheckList(lst); - TListType nextList; + TListType nextList; UNIT_ASSERT(nextList.Empty()); nextList = std::move(lst); UNIT_ASSERT_EQUAL(nextList.Size(), 2); @@ -453,10 +453,10 @@ void TListTest::TestListWithAutoDeleteMoveOpEq() { } void TListTest::TestListWithAutoDeleteClear() { - using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; + using TListType = TIntrusiveListWithAutoDelete<TSelfCountingInt, TSelfCountingIntDelete>; int counter{0}; { - TListType lst; + TListType lst; UNIT_ASSERT(lst.Empty()); lst.PushFront(new TSelfCountingInt(counter, 2)); UNIT_ASSERT_EQUAL(lst.Size(), 1); diff --git a/util/generic/is_in_ut.cpp b/util/generic/is_in_ut.cpp index c668bce8078..b98b37aa70e 100644 --- a/util/generic/is_in_ut.cpp +++ b/util/generic/is_in_ut.cpp @@ -7,7 +7,7 @@ #include "map.h" #include "set.h" #include "strbuf.h" -#include "string.h" +#include "string.h" Y_UNIT_TEST_SUITE(TIsIn) { template <class TCont, class T> @@ -41,18 +41,18 @@ Y_UNIT_TEST_SUITE(TIsIn) { } Y_UNIT_TEST(IsInTest) { - TestIsInWithCont<TMap<TString, TString>>(std::make_pair("found", "1")); - TestIsInWithCont<TMultiMap<TString, TString>>(std::make_pair("found", "1")); - TestIsInWithCont<THashMap<TString, TString>>(std::make_pair("found", "1")); - TestIsInWithCont<THashMultiMap<TString, TString>>(std::make_pair("found", "1")); + TestIsInWithCont<TMap<TString, TString>>(std::make_pair("found", "1")); + TestIsInWithCont<TMultiMap<TString, TString>>(std::make_pair("found", "1")); + TestIsInWithCont<THashMap<TString, TString>>(std::make_pair("found", "1")); + TestIsInWithCont<THashMultiMap<TString, TString>>(std::make_pair("found", "1")); - TestIsInWithCont<TSet<TString>>("found"); - TestIsInWithCont<TMultiSet<TString>>("found"); - TestIsInWithCont<THashSet<TString>>("found"); - TestIsInWithCont<THashMultiSet<TString>>("found"); + TestIsInWithCont<TSet<TString>>("found"); + TestIsInWithCont<TMultiSet<TString>>("found"); + TestIsInWithCont<THashSet<TString>>("found"); + TestIsInWithCont<THashMultiSet<TString>>("found"); // vector also compiles and works - TVector<TString> v; + TVector<TString> v; v.push_back("found"); UNIT_ASSERT(IsIn(v, "found")); UNIT_ASSERT(!IsIn(v, "not found")); @@ -61,8 +61,8 @@ Y_UNIT_TEST_SUITE(TIsIn) { UNIT_ASSERT(IsIn(v.begin(), v.end(), "found")); UNIT_ASSERT(!IsIn(v.begin(), v.end(), "not found")); - // Works with TString (it has find, but find is not used) - TString s = "found"; + // Works with TString (it has find, but find is not used) + TString s = "found"; UNIT_ASSERT(IsIn(s, 'f')); UNIT_ASSERT(!IsIn(s, 'z')); @@ -87,7 +87,7 @@ Y_UNIT_TEST_SUITE(TIsIn) { UNIT_ASSERT(IsIn({abc, def}, def)); // direct pointer comparison UNIT_ASSERT(!IsIn({TStringBuf("abc"), TStringBuf("def")}, TStringBuf("ghi"))); UNIT_ASSERT(!IsIn({"abc", "def"}, TStringBuf("ghi"))); - UNIT_ASSERT(!IsIn({"abc", "def"}, TString("ghi"))); + UNIT_ASSERT(!IsIn({"abc", "def"}, TString("ghi"))); const TStringBuf str = "abc////"; @@ -98,11 +98,11 @@ Y_UNIT_TEST_SUITE(TIsIn) { UNIT_ASSERT(IsIn({1, 2, 3}, 1)); UNIT_ASSERT(!IsIn({1, 2, 3}, 4)); - const TString b = "b"; + const TString b = "b"; UNIT_ASSERT(!IsIn({"a", "b", "c"}, b.data())); // compares pointers by value. Whether it's good or not. UNIT_ASSERT(IsIn(TVector<TStringBuf>({"a", "b", "c"}), b.data())); - UNIT_ASSERT(IsIn(TVector<TStringBuf>({"a", "b", "c"}), "b")); + UNIT_ASSERT(IsIn(TVector<TStringBuf>({"a", "b", "c"}), "b")); } Y_UNIT_TEST(IsInArrayTest) { diff --git a/util/generic/iterator_range_ut.cpp b/util/generic/iterator_range_ut.cpp index a7e3670ae10..abd59a94cdb 100644 --- a/util/generic/iterator_range_ut.cpp +++ b/util/generic/iterator_range_ut.cpp @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(IteratorRange) { } Y_UNIT_TEST(OperatorsAndReferences) { - TVector<size_t> values{1, 2, 3, 4, 5}; + TVector<size_t> values{1, 2, 3, 4, 5}; auto range = MakeIteratorRange(values.begin(), values.end()); UNIT_ASSERT_VALUES_EQUAL(range[2], 3); UNIT_ASSERT_VALUES_EQUAL(range[range[2]], 4); @@ -78,7 +78,7 @@ Y_UNIT_TEST_SUITE(IteratorRange) { range[0] = 100501; UNIT_ASSERT_VALUES_EQUAL(range[0], 100501); - TVector<bool> valuesBool{false, true, false, false, false, false, true}; + TVector<bool> valuesBool{false, true, false, false, false, false, true}; auto rangeBVector = MakeIteratorRange(valuesBool.begin(), valuesBool.end()); UNIT_ASSERT_VALUES_EQUAL(rangeBVector[1], true); rangeBVector[0] = true; diff --git a/util/generic/iterator_ut.cpp b/util/generic/iterator_ut.cpp index 00be19e10ec..a24e7502efa 100644 --- a/util/generic/iterator_ut.cpp +++ b/util/generic/iterator_ut.cpp @@ -4,7 +4,7 @@ Y_UNIT_TEST_SUITE(TIterator) { Y_UNIT_TEST(ToForwardIteratorTest) { - TVector<int> x = {1, 2}; + TVector<int> x = {1, 2}; UNIT_ASSERT_VALUES_EQUAL(*std::prev(x.end()), *ToForwardIterator(x.rbegin())); UNIT_ASSERT_VALUES_EQUAL(*ToForwardIterator(std::prev(x.rend())), *x.begin()); } diff --git a/util/generic/lazy_value_ut.cpp b/util/generic/lazy_value_ut.cpp index f6135880c3c..9669204b6b1 100644 --- a/util/generic/lazy_value_ut.cpp +++ b/util/generic/lazy_value_ut.cpp @@ -98,7 +98,7 @@ Y_UNIT_TEST_SUITE(TLazyValueTestSuite) { { } - const TString& GetData() const { + const TString& GetData() const { return *Data_; } diff --git a/util/generic/list.h b/util/generic/list.h index 7b0b8ffc723..40b99bc4741 100644 --- a/util/generic/list.h +++ b/util/generic/list.h @@ -10,7 +10,7 @@ #include <utility> template <class T, class A> -class TList: public std::list<T, TReboundAllocator<A, T>> { +class TList: public std::list<T, TReboundAllocator<A, T>> { using TBase = std::list<T, TReboundAllocator<A, T>>; public: diff --git a/util/generic/list_ut.cpp b/util/generic/list_ut.cpp index 9e60ecf01b4..79c806f827e 100644 --- a/util/generic/list_ut.cpp +++ b/util/generic/list_ut.cpp @@ -4,8 +4,8 @@ Y_UNIT_TEST_SUITE(TYListSuite) { Y_UNIT_TEST(TestInitializerList) { - TList<int> l = {3, 42, 6}; - TList<int> expected; + TList<int> l = {3, 42, 6}; + TList<int> expected; expected.push_back(3); expected.push_back(42); expected.push_back(6); diff --git a/util/generic/map.h b/util/generic/map.h index b5001b56c03..399a521683a 100644 --- a/util/generic/map.h +++ b/util/generic/map.h @@ -12,7 +12,7 @@ #include <memory> template <class K, class V, class Less, class A> -class TMap: public std::map<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>, public TMapOps<TMap<K, V, Less, A>> { +class TMap: public std::map<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>, public TMapOps<TMap<K, V, Less, A>> { using TBase = std::map<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>; public: @@ -28,7 +28,7 @@ public: }; template <class K, class V, class Less, class A> -class TMultiMap: public std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>> { +class TMultiMap: public std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>> { using TBase = std::multimap<K, V, Less, TReboundAllocator<A, std::pair<const K, V>>>; public: diff --git a/util/generic/map_ut.cpp b/util/generic/map_ut.cpp index 79e832b024f..0987ecf7053 100644 --- a/util/generic/map_ut.cpp +++ b/util/generic/map_ut.cpp @@ -13,31 +13,31 @@ Y_UNIT_TEST_SUITE(TYMapTest) { Y_UNIT_TEST(TestMap1) { { - TMap<char, int, TLess<char>> m; + TMap<char, int, TLess<char>> m; DoTestMap1(m); } { TMemoryPool p(100); - TMap<char, int, TLess<char>, TPoolAllocator> m(&p); + TMap<char, int, TLess<char>, TPoolAllocator> m(&p); DoTestMap1(m); } } Y_UNIT_TEST(TestMMap1) { { - TMultiMap<char, int, TLess<char>> mm; + TMultiMap<char, int, TLess<char>> mm; DoTestMMap1(mm); } { TMemoryPool p(100); - TMultiMap<char, int, TLess<char>, TPoolAllocator> mm(&p); + TMultiMap<char, int, TLess<char>, TPoolAllocator> mm(&p); DoTestMMap1(mm); } } template <typename TAlloc> void DoTestMap1(TMap<char, int, TLess<char>, TAlloc>& m) { - using maptype = TMap<char, int, TLess<char>, TAlloc>; + using maptype = TMap<char, int, TLess<char>, TAlloc>; // Store mappings between roman numerals and decimals. m['l'] = 50; m['x'] = 20; // Deliberate mistake. @@ -68,7 +68,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { template <typename TAlloc> void DoTestMMap1(TMultiMap<char, int, TLess<char>, TAlloc>& m) { - using mmap = TMultiMap<char, int, TLess<char>, TAlloc>; + using mmap = TMultiMap<char, int, TLess<char>, TAlloc>; UNIT_ASSERT(m.count('X') == 0); @@ -103,7 +103,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { pair_type p5(3, 'x'); pair_type p6(6, 'f'); - using mmap = TMultiMap<int, char, TLess<int>>; + using mmap = TMultiMap<int, char, TLess<int>>; pair_type array[] = { p1, @@ -125,7 +125,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } Y_UNIT_TEST(TestIterators) { - using int_map = TMap<int, char, TLess<int>>; + using int_map = TMap<int, char, TLess<int>>; int_map imap; { @@ -138,7 +138,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { UNIT_ASSERT(!(cite != ite)); } - using mmap = TMultiMap<int, char, TLess<int>>; + using mmap = TMultiMap<int, char, TLess<int>>; using pair_type = mmap::value_type; pair_type p1(3, 'c'); @@ -188,7 +188,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } Y_UNIT_TEST(TestEqualRange) { - using maptype = TMap<char, int, TLess<char>>; + using maptype = TMap<char, int, TLess<char>>; { maptype m; @@ -276,7 +276,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { Y_UNIT_TEST(TestTemplateMethods) { { - using Container = TMap<TKey, int, TKeyCmp>; + using Container = TMap<TKey, int, TKeyCmp>; using value = Container::value_type; Container cont; @@ -304,7 +304,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } { - using Container = TMap<TKey*, int, TKeyCmpPtr>; + using Container = TMap<TKey*, int, TKeyCmpPtr>; using value = Container::value_type; Container cont; @@ -333,7 +333,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } { - using Container = TMultiMap<TKey, int, TKeyCmp>; + using Container = TMultiMap<TKey, int, TKeyCmp>; using value = Container::value_type; Container cont; @@ -361,7 +361,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } { - using Container = TMultiMap<TKey const volatile*, int, TKeyCmpPtr>; + using Container = TMultiMap<TKey const volatile*, int, TKeyCmpPtr>; using value = Container::value_type; Container cont; @@ -399,8 +399,8 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } Y_UNIT_TEST(TestEmpty) { - EmptyAndInsertTest<TMap<char, int, TLess<char>>>(std::pair<char, int>('a', 1)); - EmptyAndInsertTest<TMultiMap<char, int, TLess<char>>>(std::pair<char, int>('a', 1)); + EmptyAndInsertTest<TMap<char, int, TLess<char>>>(std::pair<char, int>('a', 1)); + EmptyAndInsertTest<TMultiMap<char, int, TLess<char>>>(std::pair<char, int>('a', 1)); } struct TParametrizedKeyCmp { @@ -421,7 +421,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { }; Y_UNIT_TEST(TestMoveComparator) { - using Container = TMultiMap<TKey, int, TParametrizedKeyCmp>; + using Container = TMultiMap<TKey, int, TParametrizedKeyCmp>; TParametrizedKeyCmp direct(false); TParametrizedKeyCmp inverse(true); @@ -434,7 +434,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { c.insert(std::make_pair(TKey(2), 102)); c.insert(std::make_pair(TKey(3), 103)); - TVector<int> values; + TVector<int> values; for (auto& i : c) { values.push_back(i.second); } @@ -447,7 +447,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } Y_UNIT_TEST(TestMapInitializerList) { - TMap<TString, int> m = { + TMap<TString, int> m = { {"one", 1}, {"two", 2}, {"three", 3}, @@ -462,14 +462,14 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } Y_UNIT_TEST(TestMMapInitializerList) { - TMultiMap<TString, int> mm = { + TMultiMap<TString, int> mm = { {"one", 1}, {"two", 2}, {"two", -2}, {"three", 3}, }; UNIT_ASSERT(mm.contains("two")); - TMultiMap<TString, int> expected; + TMultiMap<TString, int> expected; expected.emplace("one", 1); expected.emplace("two", 2); expected.emplace("two", -2); @@ -478,7 +478,7 @@ Y_UNIT_TEST_SUITE(TYMapTest) { } Y_UNIT_TEST(TestMovePoolAlloc) { - using TMapInPool = TMap<int, int, TLess<int>, TPoolAllocator>; + using TMapInPool = TMap<int, int, TLess<int>, TPoolAllocator>; TMemoryPool pool(1); diff --git a/util/generic/mapfindptr.h b/util/generic/mapfindptr.h index bc10cac60f8..540b4df20a4 100644 --- a/util/generic/mapfindptr.h +++ b/util/generic/mapfindptr.h @@ -24,7 +24,7 @@ inline auto MapFindPtr(const Map& map, const K& key) { return (i == map.end() ? nullptr : &i->second); } -/** helper for THashMap/TMap */ +/** helper for THashMap/TMap */ template <class Derived> struct TMapOps { template <class K> diff --git a/util/generic/mapfindptr_ut.cpp b/util/generic/mapfindptr_ut.cpp index 613da7a96b7..83e3c220bce 100644 --- a/util/generic/mapfindptr_ut.cpp +++ b/util/generic/mapfindptr_ut.cpp @@ -1,4 +1,4 @@ -#include "string.h" +#include "string.h" #include "hash.h" #include <library/cpp/testing/unittest/registar.h> @@ -19,7 +19,7 @@ Y_UNIT_TEST_SUITE(TMapFindPtrTest) { UNIT_ASSERT_EQUAL(a.FindPtr(0), nullptr); //test mutation - if (TString* p = a.FindPtr(42)) { + if (TString* p = a.FindPtr(42)) { *p = "dog"; } UNIT_ASSERT(a.FindPtr(42)); @@ -35,9 +35,9 @@ Y_UNIT_TEST_SUITE(TMapFindPtrTest) { } Y_UNIT_TEST(TestTemplateFind) { - THashMap<TString, int> m; + THashMap<TString, int> m; - m[TString("x")] = 2; + m[TString("x")] = 2; UNIT_ASSERT(m.FindPtr(TStringBuf("x"))); UNIT_ASSERT_EQUAL(*m.FindPtr(TStringBuf("x")), 2); @@ -57,8 +57,8 @@ Y_UNIT_TEST_SUITE(TMapFindPtrTest) { a[1] = "lol"; - const TString str123 = "123"; - TString str1234 = "1234"; + const TString str123 = "123"; + TString str1234 = "1234"; UNIT_ASSERT_VALUES_EQUAL(a.ValueRef(1, str123), "lol"); UNIT_ASSERT_VALUES_EQUAL(a.ValueRef(2, str123), "123"); diff --git a/util/generic/maybe.h b/util/generic/maybe.h index 34d21aebcdc..f5226fee469 100644 --- a/util/generic/maybe.h +++ b/util/generic/maybe.h @@ -19,21 +19,21 @@ namespace NMaybe { }; } -struct TNothing { +struct TNothing { explicit constexpr TNothing(int) noexcept { } -}; - -constexpr TNothing NothingObject{0}; - -constexpr TNothing Nothing() noexcept { - return NothingObject; -} - -constexpr bool operator==(TNothing, TNothing) noexcept { - return true; -} - +}; + +constexpr TNothing NothingObject{0}; + +constexpr TNothing Nothing() noexcept { + return NothingObject; +} + +constexpr bool operator==(TNothing, TNothing) noexcept { + return true; +} + template <class T, class Policy /*= ::NMaybe::TPolicyUndefinedExcept*/> class TMaybe: private TMaybeBase<T> { public: @@ -48,7 +48,7 @@ private: "Instantiation of TMaybe with reference type is ill-formed"); static_assert(std::is_destructible<T>::value, "Instantiation of TMaybe with non-destructible type is ill-formed"); - + template <class U> struct TConstructibleFromMaybeSomehow { public: @@ -152,13 +152,13 @@ private: }; using TBase = TMaybeBase<T>; - + public: using value_type = T; using TValueType = value_type; - + TMaybe() noexcept = default; - + constexpr TMaybe(const TMaybe&) = default; constexpr TMaybe(TMaybe&&) = default; @@ -168,15 +168,15 @@ public: { } - template <class U, class... TArgs> - constexpr explicit TMaybe(TInPlace, std::initializer_list<U> il, TArgs&&... args) + template <class U, class... TArgs> + constexpr explicit TMaybe(TInPlace, std::initializer_list<U> il, TArgs&&... args) : TBase(TInPlace{}, il, std::forward<TArgs>(args)...) { } - + constexpr TMaybe(TNothing) noexcept { } - + template <class U, class = std::enable_if_t<TImplicitCopyCtor<U>::value>> TMaybe(const TMaybe<U, Policy>& right) { if (right.Defined()) { @@ -227,10 +227,10 @@ public: constexpr TMaybe& operator=(TMaybe&&) = default; TMaybe& operator=(TNothing) noexcept { - Clear(); - return *this; - } - + Clear(); + return *this; + } + template <class U = T> std::enable_if_t<TAssignableFromAny<U>::value, TMaybe&> operator=(U&& right) { if (Defined()) { @@ -287,7 +287,7 @@ public: void Clear() noexcept { if (Defined()) { this->Defined_ = false; - Data()->~T(); + Data()->~T(); } } @@ -382,7 +382,7 @@ public: return Defined() ? TMaybe<U, Policy>(*Data()) : TMaybe<U, Policy>(); } - constexpr explicit operator bool() const noexcept { + constexpr explicit operator bool() const noexcept { return Defined(); } @@ -413,25 +413,25 @@ public: } void Swap(TMaybe& other) { - if (this->Defined_ == other.Defined_) { - if (this->Defined_) { - ::DoSwap(this->Data_, other.Data_); - } - } else { - if (this->Defined_) { - other.Init(std::move(this->Data_)); - this->Clear(); - } else { - this->Init(std::move(other.Data_)); - other.Clear(); - } - } - } - + if (this->Defined_ == other.Defined_) { + if (this->Defined_) { + ::DoSwap(this->Data_, other.Data_); + } + } else { + if (this->Defined_) { + other.Init(std::move(this->Data_)); + this->Clear(); + } else { + this->Init(std::move(other.Data_)); + other.Clear(); + } + } + } + void swap(TMaybe& other) { - Swap(other); - } - + Swap(other); + } + private: constexpr const T* Data() const noexcept { return std::addressof(this->Data_); @@ -454,28 +454,28 @@ using TMaybeFail = TMaybe<T, NMaybe::TPolicyUndefinedFail>; template <class T, class TPolicy = ::NMaybe::TPolicyUndefinedExcept> constexpr TMaybe<std::decay_t<T>, TPolicy> MakeMaybe(T&& value) { return TMaybe<std::decay_t<T>, TPolicy>(std::forward<T>(value)); -} - -template <class T, class... TArgs> -constexpr TMaybe<T> MakeMaybe(TArgs&&... args) { - return TMaybe<T>(typename TMaybe<T>::TInPlace{}, std::forward<TArgs>(args)...); -} - -template <class T, class U, class... TArgs> -constexpr TMaybe<T> MakeMaybe(std::initializer_list<U> il, TArgs&&... args) { - return TMaybe<T>(typename TMaybe<T>::TInPlace{}, il, std::forward<TArgs>(args)...); -} - +} + +template <class T, class... TArgs> +constexpr TMaybe<T> MakeMaybe(TArgs&&... args) { + return TMaybe<T>(typename TMaybe<T>::TInPlace{}, std::forward<TArgs>(args)...); +} + +template <class T, class U, class... TArgs> +constexpr TMaybe<T> MakeMaybe(std::initializer_list<U> il, TArgs&&... args) { + return TMaybe<T>(typename TMaybe<T>::TInPlace{}, il, std::forward<TArgs>(args)...); +} + template <class T, class TPolicy> void Swap(TMaybe<T, TPolicy>& lhs, TMaybe<T, TPolicy>& rhs) { - lhs.Swap(rhs); -} - + lhs.Swap(rhs); +} + template <class T, class TPolicy> void swap(TMaybe<T, TPolicy>& lhs, TMaybe<T, TPolicy>& rhs) { - lhs.Swap(rhs); -} - + lhs.Swap(rhs); +} + template <typename T, class TPolicy> struct THash<TMaybe<T, TPolicy>> { constexpr size_t operator()(const TMaybe<T, TPolicy>& data) const { @@ -483,7 +483,7 @@ struct THash<TMaybe<T, TPolicy>> { } }; -// Comparisons between TMaybe +// Comparisons between TMaybe template <class T, class TPolicy> constexpr bool operator==(const ::TMaybe<T, TPolicy>& left, const ::TMaybe<T, TPolicy>& right) { return (static_cast<bool>(left) != static_cast<bool>(right)) @@ -496,218 +496,218 @@ constexpr bool operator==(const ::TMaybe<T, TPolicy>& left, const ::TMaybe<T, TP template <class T, class TPolicy> constexpr bool operator!=(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) { - return !(left == right); + return !(left == right); } - + template <class T, class TPolicy> constexpr bool operator<(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) { - return (!static_cast<bool>(right)) + return (!static_cast<bool>(right)) ? false : ( !static_cast<bool>(left) ? true : (*left < *right)); -} - +} + template <class T, class TPolicy> constexpr bool operator>(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) { - return right < left; -} - + return right < left; +} + template <class T, class TPolicy> constexpr bool operator<=(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) { - return !(right < left); -} - + return !(right < left); +} + template <class T, class TPolicy> constexpr bool operator>=(const TMaybe<T, TPolicy>& left, const TMaybe<T, TPolicy>& right) { - return !(left < right); -} - -// Comparisons with TNothing + return !(left < right); +} + +// Comparisons with TNothing template <class T, class TPolicy> constexpr bool operator==(const TMaybe<T, TPolicy>& left, TNothing) noexcept { - return !static_cast<bool>(left); -} - + return !static_cast<bool>(left); +} + template <class T, class TPolicy> constexpr bool operator==(TNothing, const TMaybe<T, TPolicy>& right) noexcept { - return !static_cast<bool>(right); -} - + return !static_cast<bool>(right); +} + template <class T, class TPolicy> constexpr bool operator!=(const TMaybe<T, TPolicy>& left, TNothing) noexcept { - return static_cast<bool>(left); -} - + return static_cast<bool>(left); +} + template <class T, class TPolicy> constexpr bool operator!=(TNothing, const TMaybe<T, TPolicy>& right) noexcept { - return static_cast<bool>(right); -} - + return static_cast<bool>(right); +} + template <class T, class TPolicy> constexpr bool operator<(const TMaybe<T, TPolicy>&, TNothing) noexcept { - return false; -} - + return false; +} + template <class T, class TPolicy> constexpr bool operator<(TNothing, const TMaybe<T, TPolicy>& right) noexcept { - return static_cast<bool>(right); -} - + return static_cast<bool>(right); +} + template <class T, class TPolicy> constexpr bool operator<=(const TMaybe<T, TPolicy>& left, TNothing) noexcept { - return !static_cast<bool>(left); -} - + return !static_cast<bool>(left); +} + template <class T, class TPolicy> constexpr bool operator<=(TNothing, const TMaybe<T, TPolicy>&) noexcept { - return true; -} - + return true; +} + template <class T, class TPolicy> constexpr bool operator>(const TMaybe<T, TPolicy>& left, TNothing) noexcept { - return static_cast<bool>(left); -} - + return static_cast<bool>(left); +} + template <class T, class TPolicy> constexpr bool operator>(TNothing, const TMaybe<T, TPolicy>&) noexcept { - return false; -} - + return false; +} + template <class T, class TPolicy> constexpr bool operator>=(const TMaybe<T, TPolicy>&, TNothing) noexcept { - return true; -} - + return true; +} + template <class T, class TPolicy> constexpr bool operator>=(TNothing, const TMaybe<T, TPolicy>& right) noexcept { - return !static_cast<bool>(right); -} - -// Comparisons with T - + return !static_cast<bool>(right); +} + +// Comparisons with T + template <class T, class TPolicy> constexpr bool operator==(const TMaybe<T, TPolicy>& maybe, const T& value) { - return static_cast<bool>(maybe) ? *maybe == value : false; -} - + return static_cast<bool>(maybe) ? *maybe == value : false; +} + template <class T, class TPolicy> constexpr bool operator==(const T& value, const TMaybe<T, TPolicy>& maybe) { - return static_cast<bool>(maybe) ? *maybe == value : false; -} - + return static_cast<bool>(maybe) ? *maybe == value : false; +} + template <class T, class TPolicy> constexpr bool operator!=(const TMaybe<T, TPolicy>& maybe, const T& value) { - return static_cast<bool>(maybe) ? !(*maybe == value) : true; -} - + return static_cast<bool>(maybe) ? !(*maybe == value) : true; +} + template <class T, class TPolicy> constexpr bool operator!=(const T& value, const TMaybe<T, TPolicy>& maybe) { - return static_cast<bool>(maybe) ? !(*maybe == value) : true; -} - + return static_cast<bool>(maybe) ? !(*maybe == value) : true; +} + template <class T, class TPolicy> constexpr bool operator<(const TMaybe<T, TPolicy>& maybe, const T& value) { - return static_cast<bool>(maybe) ? std::less<T>{}(*maybe, value) : true; -} - + return static_cast<bool>(maybe) ? std::less<T>{}(*maybe, value) : true; +} + template <class T, class TPolicy> constexpr bool operator<(const T& value, const TMaybe<T, TPolicy>& maybe) { - return static_cast<bool>(maybe) ? std::less<T>{}(value, *maybe) : false; -} - + return static_cast<bool>(maybe) ? std::less<T>{}(value, *maybe) : false; +} + template <class T, class TPolicy> constexpr bool operator<=(const TMaybe<T, TPolicy>& maybe, const T& value) { - return !(maybe > value); -} - + return !(maybe > value); +} + template <class T, class TPolicy> constexpr bool operator<=(const T& value, const TMaybe<T, TPolicy>& maybe) { - return !(value > maybe); -} - + return !(value > maybe); +} + template <class T, class TPolicy> constexpr bool operator>(const TMaybe<T, TPolicy>& maybe, const T& value) { - return static_cast<bool>(maybe) ? value < maybe : false; -} - + return static_cast<bool>(maybe) ? value < maybe : false; +} + template <class T, class TPolicy> constexpr bool operator>(const T& value, const TMaybe<T, TPolicy>& maybe) { - return static_cast<bool>(maybe) ? maybe < value : true; -} - + return static_cast<bool>(maybe) ? maybe < value : true; +} + template <class T, class TPolicy> constexpr bool operator>=(const TMaybe<T, TPolicy>& maybe, const T& value) { - return !(maybe < value); -} - + return !(maybe < value); +} + template <class T, class TPolicy> constexpr bool operator>=(const T& value, const TMaybe<T, TPolicy>& maybe) { - return !(value < maybe); -} - -// Comparison with values convertible to T - + return !(value < maybe); +} + +// Comparison with values convertible to T + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator==(const ::TMaybe<T, TPolicy>& maybe, const U& value) { - return static_cast<bool>(maybe) ? *maybe == value : false; -} - + return static_cast<bool>(maybe) ? *maybe == value : false; +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator==(const U& value, const ::TMaybe<T, TPolicy>& maybe) { - return static_cast<bool>(maybe) ? *maybe == value : false; -} - + return static_cast<bool>(maybe) ? *maybe == value : false; +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator!=(const TMaybe<T, TPolicy>& maybe, const U& value) { - return static_cast<bool>(maybe) ? !(*maybe == value) : true; -} - + return static_cast<bool>(maybe) ? !(*maybe == value) : true; +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator!=(const U& value, const TMaybe<T, TPolicy>& maybe) { - return static_cast<bool>(maybe) ? !(*maybe == value) : true; -} - + return static_cast<bool>(maybe) ? !(*maybe == value) : true; +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator<(const TMaybe<T, TPolicy>& maybe, const U& value) { - return static_cast<bool>(maybe) ? std::less<T>{}(*maybe, value) : true; -} - + return static_cast<bool>(maybe) ? std::less<T>{}(*maybe, value) : true; +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator<(const U& value, const TMaybe<T, TPolicy>& maybe) { - return static_cast<bool>(maybe) ? std::less<T>{}(value, *maybe) : false; -} - + return static_cast<bool>(maybe) ? std::less<T>{}(value, *maybe) : false; +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator<=(const TMaybe<T, TPolicy>& maybe, const U& value) { - return !(maybe > value); -} - + return !(maybe > value); +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator<=(const U& value, const TMaybe<T, TPolicy>& maybe) { - return !(value > maybe); -} - + return !(value > maybe); +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator>(const TMaybe<T, TPolicy>& maybe, const U& value) { - return static_cast<bool>(maybe) ? value < maybe : false; -} - + return static_cast<bool>(maybe) ? value < maybe : false; +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator>(const U& value, const TMaybe<T, TPolicy>& maybe) { - return static_cast<bool>(maybe) ? maybe < value : true; -} - + return static_cast<bool>(maybe) ? maybe < value : true; +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator>=(const TMaybe<T, TPolicy>& maybe, const U& value) { - return !(maybe < value); -} - + return !(maybe < value); +} + template <class T, class TPolicy, class U, std::enable_if_t<std::is_convertible<U, T>::value, int> = 0> constexpr bool operator>=(const U& value, const TMaybe<T, TPolicy>& maybe) { - return !(value < maybe); -} + return !(value < maybe); +} class IOutputStream; diff --git a/util/generic/maybe_ut.cpp b/util/generic/maybe_ut.cpp index 2c1a425c5ef..85c328309b9 100644 --- a/util/generic/maybe_ut.cpp +++ b/util/generic/maybe_ut.cpp @@ -1,5 +1,5 @@ -#include <util/generic/string.h> -#include <util/generic/vector.h> +#include <util/generic/string.h> +#include <util/generic/vector.h> #include <util/stream/str.h> #include <library/cpp/testing/unittest/registar.h> @@ -10,12 +10,12 @@ private: int* Ptr_; public: - TIncrementOnDestroy(int* ptr) noexcept + TIncrementOnDestroy(int* ptr) noexcept : Ptr_(ptr) { } - ~TIncrementOnDestroy() { + ~TIncrementOnDestroy() { ++*Ptr_; } }; @@ -42,13 +42,13 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { Y_UNIT_TEST(TestWarning) { TMaybe<size_t> x; TStringStream ss; - TString line; + TString line; while (ss.ReadLine(line)) { x = line.size(); } - if (x == 5u) { + if (x == 5u) { ss << "5\n"; } } @@ -221,575 +221,575 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { UNIT_ASSERT(longMaybe.Defined()); UNIT_ASSERT_VALUES_EQUAL(34, longMaybe.GetRef()); } - + Y_UNIT_TEST(TestGetOr) { - UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>().GetOrElse("xxx"), TString("xxx")); - UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>("yyy").GetOrElse("xxx"), TString("yyy")); + UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>().GetOrElse("xxx"), TString("xxx")); + UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>("yyy").GetOrElse("xxx"), TString("yyy")); { - TString xxx = "xxx"; - UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>().GetOrElse(xxx).append('x'), TString("xxxx")); + TString xxx = "xxx"; + UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>().GetOrElse(xxx).append('x'), TString("xxxx")); UNIT_ASSERT_VALUES_EQUAL(xxx, "xxxx"); } { - TString xxx = "xxx"; - UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>("yyy").GetOrElse(xxx).append('x'), TString("yyyx")); + TString xxx = "xxx"; + UNIT_ASSERT_VALUES_EQUAL(TMaybe<TString>("yyy").GetOrElse(xxx).append('x'), TString("yyyx")); UNIT_ASSERT_VALUES_EQUAL(xxx, "xxx"); } } /* - == - != - < - <= - > - >= -*/ - + == + != + < + <= + > + >= +*/ + Y_UNIT_TEST(TestCompareEqualEmpty) { - TMaybe<int> m1; - TMaybe<int> m2; - - UNIT_ASSERT(m1 == m2); - UNIT_ASSERT(!(m1 != m2)); - UNIT_ASSERT(!(m1 < m2)); - UNIT_ASSERT(m1 <= m2); - UNIT_ASSERT(!(m1 > m2)); - UNIT_ASSERT(m1 >= m2); - } - + TMaybe<int> m1; + TMaybe<int> m2; + + UNIT_ASSERT(m1 == m2); + UNIT_ASSERT(!(m1 != m2)); + UNIT_ASSERT(!(m1 < m2)); + UNIT_ASSERT(m1 <= m2); + UNIT_ASSERT(!(m1 > m2)); + UNIT_ASSERT(m1 >= m2); + } + Y_UNIT_TEST(TestCompareEqualNonEmpty) { TMaybe<int> m1{1}; TMaybe<int> m2{1}; - - UNIT_ASSERT(m1 == m2); - UNIT_ASSERT(!(m1 != m2)); - UNIT_ASSERT(!(m1 < m2)); - UNIT_ASSERT(m1 <= m2); - UNIT_ASSERT(!(m1 > m2)); - UNIT_ASSERT(m1 >= m2); - } - + + UNIT_ASSERT(m1 == m2); + UNIT_ASSERT(!(m1 != m2)); + UNIT_ASSERT(!(m1 < m2)); + UNIT_ASSERT(m1 <= m2); + UNIT_ASSERT(!(m1 > m2)); + UNIT_ASSERT(m1 >= m2); + } + Y_UNIT_TEST(TestCompareOneLessThanOther) { TMaybe<int> m1{1}; TMaybe<int> m2{2}; - - UNIT_ASSERT(!(m1 == m2)); - UNIT_ASSERT(m1 != m2); - UNIT_ASSERT(m1 < m2); - UNIT_ASSERT(m1 <= m2); - UNIT_ASSERT(!(m1 > m2)); - UNIT_ASSERT(!(m1 >= m2)); - } - + + UNIT_ASSERT(!(m1 == m2)); + UNIT_ASSERT(m1 != m2); + UNIT_ASSERT(m1 < m2); + UNIT_ASSERT(m1 <= m2); + UNIT_ASSERT(!(m1 > m2)); + UNIT_ASSERT(!(m1 >= m2)); + } + Y_UNIT_TEST(TestCompareTMaybeAndT_Equal) { TMaybe<int> m{1}; int v{1}; - - UNIT_ASSERT(m == v); - UNIT_ASSERT(!(m != v)); - UNIT_ASSERT(!(m < v)); - UNIT_ASSERT(m <= v); - UNIT_ASSERT(!(m > v)); - UNIT_ASSERT(m >= v); - - UNIT_ASSERT(v == m); - UNIT_ASSERT(!(v != m)); - UNIT_ASSERT(!(v < m)); - UNIT_ASSERT(v <= m); - UNIT_ASSERT(!(v > m)); - UNIT_ASSERT(v >= m); - } - + + UNIT_ASSERT(m == v); + UNIT_ASSERT(!(m != v)); + UNIT_ASSERT(!(m < v)); + UNIT_ASSERT(m <= v); + UNIT_ASSERT(!(m > v)); + UNIT_ASSERT(m >= v); + + UNIT_ASSERT(v == m); + UNIT_ASSERT(!(v != m)); + UNIT_ASSERT(!(v < m)); + UNIT_ASSERT(v <= m); + UNIT_ASSERT(!(v > m)); + UNIT_ASSERT(v >= m); + } + Y_UNIT_TEST(TestCompareTMaybeAndT_TMaybeLessThanT) { TMaybe<int> m{1}; int v{2}; - - UNIT_ASSERT(!(m == v)); - UNIT_ASSERT(m != v); - UNIT_ASSERT(m < v); - UNIT_ASSERT(m <= v); - UNIT_ASSERT(!(m > v)); - UNIT_ASSERT(!(m >= v)); - - UNIT_ASSERT(!(v == m)); - UNIT_ASSERT(v != m); - UNIT_ASSERT(!(v < m)); - UNIT_ASSERT(!(v <= m)); - UNIT_ASSERT(v > m); - UNIT_ASSERT(v >= m); - } - + + UNIT_ASSERT(!(m == v)); + UNIT_ASSERT(m != v); + UNIT_ASSERT(m < v); + UNIT_ASSERT(m <= v); + UNIT_ASSERT(!(m > v)); + UNIT_ASSERT(!(m >= v)); + + UNIT_ASSERT(!(v == m)); + UNIT_ASSERT(v != m); + UNIT_ASSERT(!(v < m)); + UNIT_ASSERT(!(v <= m)); + UNIT_ASSERT(v > m); + UNIT_ASSERT(v >= m); + } + Y_UNIT_TEST(TestCompareTMaybeAndT_TMaybeGreaterThanT) { TMaybe<int> m{2}; int v{1}; - - UNIT_ASSERT(!(m == v)); - UNIT_ASSERT(m != v); - UNIT_ASSERT(!(m < v)); - UNIT_ASSERT(!(m <= v)); - UNIT_ASSERT(m > v); - UNIT_ASSERT(m >= v); - - UNIT_ASSERT(!(v == m)); - UNIT_ASSERT(v != m); - UNIT_ASSERT(v < m); - UNIT_ASSERT(v <= m); - UNIT_ASSERT(!(v > m)); - UNIT_ASSERT(!(v >= m)); - } - + + UNIT_ASSERT(!(m == v)); + UNIT_ASSERT(m != v); + UNIT_ASSERT(!(m < v)); + UNIT_ASSERT(!(m <= v)); + UNIT_ASSERT(m > v); + UNIT_ASSERT(m >= v); + + UNIT_ASSERT(!(v == m)); + UNIT_ASSERT(v != m); + UNIT_ASSERT(v < m); + UNIT_ASSERT(v <= m); + UNIT_ASSERT(!(v > m)); + UNIT_ASSERT(!(v >= m)); + } + Y_UNIT_TEST(TestCompareEmptyTMaybeAndT) { - TMaybe<int> m; + TMaybe<int> m; int v{1}; - - UNIT_ASSERT(!(m == v)); - UNIT_ASSERT(m != v); - UNIT_ASSERT(m < v); - UNIT_ASSERT(m <= v); - UNIT_ASSERT(!(m > v)); - UNIT_ASSERT(!(m >= v)); - - UNIT_ASSERT(!(v == m)); - UNIT_ASSERT(v != m); - UNIT_ASSERT(!(v < m)); - UNIT_ASSERT(!(v <= m)); - UNIT_ASSERT(v > m); - UNIT_ASSERT(v >= m); - } - + + UNIT_ASSERT(!(m == v)); + UNIT_ASSERT(m != v); + UNIT_ASSERT(m < v); + UNIT_ASSERT(m <= v); + UNIT_ASSERT(!(m > v)); + UNIT_ASSERT(!(m >= v)); + + UNIT_ASSERT(!(v == m)); + UNIT_ASSERT(v != m); + UNIT_ASSERT(!(v < m)); + UNIT_ASSERT(!(v <= m)); + UNIT_ASSERT(v > m); + UNIT_ASSERT(v >= m); + } + Y_UNIT_TEST(TestCompareEmptyTMaybeAndNothing) { - TMaybe<int> m; - auto n = Nothing(); - - UNIT_ASSERT(m == n); - UNIT_ASSERT(!(m != n)); - UNIT_ASSERT(!(m < n)); - UNIT_ASSERT(m <= n); - UNIT_ASSERT(!(m > n)); - UNIT_ASSERT(m >= n); - - UNIT_ASSERT(n == m); - UNIT_ASSERT(!(n != m)); - UNIT_ASSERT(!(n < m)); - UNIT_ASSERT(n <= m); - UNIT_ASSERT(!(n > m)); - UNIT_ASSERT(n >= m); - } - + TMaybe<int> m; + auto n = Nothing(); + + UNIT_ASSERT(m == n); + UNIT_ASSERT(!(m != n)); + UNIT_ASSERT(!(m < n)); + UNIT_ASSERT(m <= n); + UNIT_ASSERT(!(m > n)); + UNIT_ASSERT(m >= n); + + UNIT_ASSERT(n == m); + UNIT_ASSERT(!(n != m)); + UNIT_ASSERT(!(n < m)); + UNIT_ASSERT(n <= m); + UNIT_ASSERT(!(n > m)); + UNIT_ASSERT(n >= m); + } + Y_UNIT_TEST(TestCompareNonEmptyTMaybeAndNothing) { TMaybe<int> m{1}; - auto n = Nothing(); - - UNIT_ASSERT(!(m == n)); - UNIT_ASSERT(m != n); - UNIT_ASSERT(!(m < n)); - UNIT_ASSERT(!(m <= n)); - UNIT_ASSERT(m > n); - UNIT_ASSERT(m >= n); - - UNIT_ASSERT(!(n == m)); - UNIT_ASSERT(n != m); - UNIT_ASSERT(n < m); - UNIT_ASSERT(n <= m); - UNIT_ASSERT(!(n > m)); - UNIT_ASSERT(!(n >= m)); - } - + auto n = Nothing(); + + UNIT_ASSERT(!(m == n)); + UNIT_ASSERT(m != n); + UNIT_ASSERT(!(m < n)); + UNIT_ASSERT(!(m <= n)); + UNIT_ASSERT(m > n); + UNIT_ASSERT(m >= n); + + UNIT_ASSERT(!(n == m)); + UNIT_ASSERT(n != m); + UNIT_ASSERT(n < m); + UNIT_ASSERT(n <= m); + UNIT_ASSERT(!(n > m)); + UNIT_ASSERT(!(n >= m)); + } + Y_UNIT_TEST(TestCompareTMaybeAndConvertibleT_Equal) { TMaybe<size_t> m{1}; unsigned int v{1}; - - UNIT_ASSERT(m == v); - UNIT_ASSERT(!(m != v)); - UNIT_ASSERT(!(m < v)); - UNIT_ASSERT(m <= v); - UNIT_ASSERT(!(m > v)); - UNIT_ASSERT(m >= v); - - UNIT_ASSERT(v == m); - UNIT_ASSERT(!(v != m)); - UNIT_ASSERT(!(v < m)); - UNIT_ASSERT(v <= m); - UNIT_ASSERT(!(v > m)); - UNIT_ASSERT(v >= m); - } - + + UNIT_ASSERT(m == v); + UNIT_ASSERT(!(m != v)); + UNIT_ASSERT(!(m < v)); + UNIT_ASSERT(m <= v); + UNIT_ASSERT(!(m > v)); + UNIT_ASSERT(m >= v); + + UNIT_ASSERT(v == m); + UNIT_ASSERT(!(v != m)); + UNIT_ASSERT(!(v < m)); + UNIT_ASSERT(v <= m); + UNIT_ASSERT(!(v > m)); + UNIT_ASSERT(v >= m); + } + Y_UNIT_TEST(TestCompareTMaybeAndConvertibleT_TMaybeLessThanT) { TMaybe<size_t> m{1}; unsigned int v{2}; - - UNIT_ASSERT(!(m == v)); - UNIT_ASSERT(m != v); - UNIT_ASSERT(m < v); - UNIT_ASSERT(m <= v); - UNIT_ASSERT(!(m > v)); - UNIT_ASSERT(!(m >= v)); - - UNIT_ASSERT(!(v == m)); - UNIT_ASSERT(v != m); - UNIT_ASSERT(!(v < m)); - UNIT_ASSERT(!(v <= m)); - UNIT_ASSERT(v > m); - UNIT_ASSERT(v >= m); - } - + + UNIT_ASSERT(!(m == v)); + UNIT_ASSERT(m != v); + UNIT_ASSERT(m < v); + UNIT_ASSERT(m <= v); + UNIT_ASSERT(!(m > v)); + UNIT_ASSERT(!(m >= v)); + + UNIT_ASSERT(!(v == m)); + UNIT_ASSERT(v != m); + UNIT_ASSERT(!(v < m)); + UNIT_ASSERT(!(v <= m)); + UNIT_ASSERT(v > m); + UNIT_ASSERT(v >= m); + } + Y_UNIT_TEST(TestCompareTMaybeAndConvertibleT_TMaybeGreaterThanT) { TMaybe<size_t> m{2}; unsigned int v{1}; - - UNIT_ASSERT(!(m == v)); - UNIT_ASSERT(m != v); - UNIT_ASSERT(!(m < v)); - UNIT_ASSERT(!(m <= v)); - UNIT_ASSERT(m > v); - UNIT_ASSERT(m >= v); - - UNIT_ASSERT(!(v == m)); - UNIT_ASSERT(v != m); - UNIT_ASSERT(v < m); - UNIT_ASSERT(v <= m); - UNIT_ASSERT(!(v > m)); - UNIT_ASSERT(!(v >= m)); - } - + + UNIT_ASSERT(!(m == v)); + UNIT_ASSERT(m != v); + UNIT_ASSERT(!(m < v)); + UNIT_ASSERT(!(m <= v)); + UNIT_ASSERT(m > v); + UNIT_ASSERT(m >= v); + + UNIT_ASSERT(!(v == m)); + UNIT_ASSERT(v != m); + UNIT_ASSERT(v < m); + UNIT_ASSERT(v <= m); + UNIT_ASSERT(!(v > m)); + UNIT_ASSERT(!(v >= m)); + } + Y_UNIT_TEST(TestCompareEmptyTMaybeAndConvertibleT) { - TMaybe<size_t> m; + TMaybe<size_t> m; unsigned int v{1}; - - UNIT_ASSERT(!(m == v)); - UNIT_ASSERT(m != v); - UNIT_ASSERT(m < v); - UNIT_ASSERT(m <= v); - UNIT_ASSERT(!(m > v)); - UNIT_ASSERT(!(m >= v)); - - UNIT_ASSERT(!(v == m)); - UNIT_ASSERT(v != m); - UNIT_ASSERT(!(v < m)); - UNIT_ASSERT(!(v <= m)); - UNIT_ASSERT(v > m); - UNIT_ASSERT(v >= m); - } - + + UNIT_ASSERT(!(m == v)); + UNIT_ASSERT(m != v); + UNIT_ASSERT(m < v); + UNIT_ASSERT(m <= v); + UNIT_ASSERT(!(m > v)); + UNIT_ASSERT(!(m >= v)); + + UNIT_ASSERT(!(v == m)); + UNIT_ASSERT(v != m); + UNIT_ASSERT(!(v < m)); + UNIT_ASSERT(!(v <= m)); + UNIT_ASSERT(v > m); + UNIT_ASSERT(v >= m); + } + Y_UNIT_TEST(TestMakeMaybe) { - { - auto m1 = MakeMaybe<int>(1); - UNIT_ASSERT(*m1 == 1); - } - - { - struct TMockClass { - TMockClass(int i) - : I_(i) - { - } - - TMockClass(const TMockClass& other) - : I_(other.I_) - { - IsCopyConstructorCalled_ = true; - } - - TMockClass& operator=(const TMockClass& other) { - if (this != &other) { - I_ = other.I_; - IsCopyAssignmentOperatorCalled_ = true; - } - - return *this; - } - - TMockClass(TMockClass&& other) - : I_(other.I_) - { - IsMoveConstructorCalled_ = true; - } - - TMockClass& operator=(TMockClass&& other) { - if (this != &other) { - I_ = other.I_; - IsMoveAssignmentOperatorCalled_ = true; - } - - return *this; - } - - int I_; + { + auto m1 = MakeMaybe<int>(1); + UNIT_ASSERT(*m1 == 1); + } + + { + struct TMockClass { + TMockClass(int i) + : I_(i) + { + } + + TMockClass(const TMockClass& other) + : I_(other.I_) + { + IsCopyConstructorCalled_ = true; + } + + TMockClass& operator=(const TMockClass& other) { + if (this != &other) { + I_ = other.I_; + IsCopyAssignmentOperatorCalled_ = true; + } + + return *this; + } + + TMockClass(TMockClass&& other) + : I_(other.I_) + { + IsMoveConstructorCalled_ = true; + } + + TMockClass& operator=(TMockClass&& other) { + if (this != &other) { + I_ = other.I_; + IsMoveAssignmentOperatorCalled_ = true; + } + + return *this; + } + + int I_; bool IsCopyConstructorCalled_{false}; bool IsMoveConstructorCalled_{false}; bool IsCopyAssignmentOperatorCalled_{false}; bool IsMoveAssignmentOperatorCalled_{false}; - }; - - auto m2 = MakeMaybe<TMockClass>(1); - UNIT_ASSERT(m2->I_ == 1); - UNIT_ASSERT(!m2->IsCopyConstructorCalled_); - UNIT_ASSERT(!m2->IsMoveConstructorCalled_); - UNIT_ASSERT(!m2->IsCopyAssignmentOperatorCalled_); - UNIT_ASSERT(!m2->IsMoveAssignmentOperatorCalled_); - } - - { - auto m3 = MakeMaybe<TVector<int>>({1, 2, 3, 4, 5}); - UNIT_ASSERT(m3->size() == 5); - UNIT_ASSERT(m3->at(0) == 1); - UNIT_ASSERT(m3->at(1) == 2); - UNIT_ASSERT(m3->at(2) == 3); - UNIT_ASSERT(m3->at(3) == 4); - UNIT_ASSERT(m3->at(4) == 5); - } - - { - struct TMockStruct4 { - TMockStruct4(int a, int b, int c) - : A_(a) - , B_(b) - , C_(c) - { - } - - int A_; - int B_; - int C_; - }; - - auto m4 = MakeMaybe<TMockStruct4>(1, 2, 3); - UNIT_ASSERT(m4->A_ == 1); - UNIT_ASSERT(m4->B_ == 2); - UNIT_ASSERT(m4->C_ == 3); - } - - { - struct TMockStruct5 { - TMockStruct5(const TVector<int>& vec, bool someFlag) - : Vec_(vec) - , SomeFlag_(someFlag) - { - } - - TVector<int> Vec_; - bool SomeFlag_; - }; - + }; + + auto m2 = MakeMaybe<TMockClass>(1); + UNIT_ASSERT(m2->I_ == 1); + UNIT_ASSERT(!m2->IsCopyConstructorCalled_); + UNIT_ASSERT(!m2->IsMoveConstructorCalled_); + UNIT_ASSERT(!m2->IsCopyAssignmentOperatorCalled_); + UNIT_ASSERT(!m2->IsMoveAssignmentOperatorCalled_); + } + + { + auto m3 = MakeMaybe<TVector<int>>({1, 2, 3, 4, 5}); + UNIT_ASSERT(m3->size() == 5); + UNIT_ASSERT(m3->at(0) == 1); + UNIT_ASSERT(m3->at(1) == 2); + UNIT_ASSERT(m3->at(2) == 3); + UNIT_ASSERT(m3->at(3) == 4); + UNIT_ASSERT(m3->at(4) == 5); + } + + { + struct TMockStruct4 { + TMockStruct4(int a, int b, int c) + : A_(a) + , B_(b) + , C_(c) + { + } + + int A_; + int B_; + int C_; + }; + + auto m4 = MakeMaybe<TMockStruct4>(1, 2, 3); + UNIT_ASSERT(m4->A_ == 1); + UNIT_ASSERT(m4->B_ == 2); + UNIT_ASSERT(m4->C_ == 3); + } + + { + struct TMockStruct5 { + TMockStruct5(const TVector<int>& vec, bool someFlag) + : Vec_(vec) + , SomeFlag_(someFlag) + { + } + + TVector<int> Vec_; + bool SomeFlag_; + }; + auto m5 = MakeMaybe<TMockStruct5>({1, 2, 3}, true); - UNIT_ASSERT(m5->Vec_.size() == 3); - UNIT_ASSERT(m5->Vec_[0] == 1); - UNIT_ASSERT(m5->Vec_[1] == 2); - UNIT_ASSERT(m5->Vec_[2] == 3); - UNIT_ASSERT(m5->SomeFlag_); - } - } - + UNIT_ASSERT(m5->Vec_.size() == 3); + UNIT_ASSERT(m5->Vec_[0] == 1); + UNIT_ASSERT(m5->Vec_[1] == 2); + UNIT_ASSERT(m5->Vec_[2] == 3); + UNIT_ASSERT(m5->SomeFlag_); + } + } + Y_UNIT_TEST(TestSwappingUsingMemberSwap) { - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = 2; - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(*m2 == 2); - - m1.Swap(m2); - - UNIT_ASSERT(*m1 == 2); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = Nothing(); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - - m1.Swap(m2); - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = Nothing(); - TMaybe<int> m2 = 1; - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - - m1.Swap(m2); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - } - } - + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = 2; + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(*m2 == 2); + + m1.Swap(m2); + + UNIT_ASSERT(*m1 == 2); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = Nothing(); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + + m1.Swap(m2); + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = Nothing(); + TMaybe<int> m2 = 1; + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + + m1.Swap(m2); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + } + } + Y_UNIT_TEST(TestSwappingUsingMemberLittleSwap) { - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = 2; - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(*m2 == 2); - - m1.swap(m2); - - UNIT_ASSERT(*m1 == 2); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = Nothing(); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - - m1.swap(m2); - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = Nothing(); - TMaybe<int> m2 = 1; - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - - m1.swap(m2); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - } - } - + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = 2; + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(*m2 == 2); + + m1.swap(m2); + + UNIT_ASSERT(*m1 == 2); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = Nothing(); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + + m1.swap(m2); + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = Nothing(); + TMaybe<int> m2 = 1; + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + + m1.swap(m2); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + } + } + Y_UNIT_TEST(TestSwappingUsingGlobalSwap) { - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = 2; - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(*m2 == 2); - - ::Swap(m1, m2); - - UNIT_ASSERT(*m1 == 2); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = Nothing(); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - - ::Swap(m1, m2); - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = Nothing(); - TMaybe<int> m2 = 1; - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - - ::Swap(m1, m2); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - } - } - + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = 2; + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(*m2 == 2); + + ::Swap(m1, m2); + + UNIT_ASSERT(*m1 == 2); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = Nothing(); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + + ::Swap(m1, m2); + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = Nothing(); + TMaybe<int> m2 = 1; + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + + ::Swap(m1, m2); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + } + } + Y_UNIT_TEST(TestSwappingUsingGlobalDoSwap) { - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = 2; - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(*m2 == 2); - - ::DoSwap(m1, m2); - - UNIT_ASSERT(*m1 == 2); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = Nothing(); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - - ::DoSwap(m1, m2); - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = Nothing(); - TMaybe<int> m2 = 1; - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - - ::DoSwap(m1, m2); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - } - } - + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = 2; + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(*m2 == 2); + + ::DoSwap(m1, m2); + + UNIT_ASSERT(*m1 == 2); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = Nothing(); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + + ::DoSwap(m1, m2); + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = Nothing(); + TMaybe<int> m2 = 1; + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + + ::DoSwap(m1, m2); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + } + } + Y_UNIT_TEST(TestSwappingUsingStdSwap) { - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = 2; - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(*m2 == 2); - - ::std::swap(m1, m2); - - UNIT_ASSERT(*m1 == 2); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = 1; - TMaybe<int> m2 = Nothing(); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - - ::std::swap(m1, m2); - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - } - - { - TMaybe<int> m1 = Nothing(); - TMaybe<int> m2 = 1; - - UNIT_ASSERT(m1 == Nothing()); - UNIT_ASSERT(*m2 == 1); - - ::std::swap(m1, m2); - - UNIT_ASSERT(*m1 == 1); - UNIT_ASSERT(m2 == Nothing()); - } - } + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = 2; + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(*m2 == 2); + + ::std::swap(m1, m2); + + UNIT_ASSERT(*m1 == 2); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = 1; + TMaybe<int> m2 = Nothing(); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + + ::std::swap(m1, m2); + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + } + + { + TMaybe<int> m1 = Nothing(); + TMaybe<int> m2 = 1; + + UNIT_ASSERT(m1 == Nothing()); + UNIT_ASSERT(*m2 == 1); + + ::std::swap(m1, m2); + + UNIT_ASSERT(*m1 == 1); + UNIT_ASSERT(m2 == Nothing()); + } + } Y_UNIT_TEST(TestOutputStreamEmptyMaybe) { - TString s; + TString s; TStringOutput output(s); output << TMaybe<int>(); UNIT_ASSERT_EQUAL("(empty maybe)", s); @@ -803,7 +803,7 @@ Y_UNIT_TEST_SUITE(TMaybeTest) { } Y_UNIT_TEST(TestOutputStreamDefinedMaybe) { - TString s; + TString s; TStringOutput output(s); output << TMaybe<int>(42); UNIT_ASSERT_EQUAL("42", s); diff --git a/util/generic/mem_copy.h b/util/generic/mem_copy.h index b68c852953a..6f38fdc1ab8 100644 --- a/util/generic/mem_copy.h +++ b/util/generic/mem_copy.h @@ -13,7 +13,7 @@ template <class T> using TIfNotPOD = std::enable_if_t<!TTypeTraits<T>::IsPod, T*>; template <class T> -static inline TIfPOD<T> MemCopy(T* to, const T* from, size_t n) noexcept { +static inline TIfPOD<T> MemCopy(T* to, const T* from, size_t n) noexcept { if (n) { memcpy(to, from, n * sizeof(T)); } @@ -31,7 +31,7 @@ static inline TIfNotPOD<T> MemCopy(T* to, const T* from, size_t n) { } template <class T> -static inline TIfPOD<T> MemMove(T* to, const T* from, size_t n) noexcept { +static inline TIfPOD<T> MemMove(T* to, const T* from, size_t n) noexcept { if (n) { memmove(to, from, n * sizeof(T)); } diff --git a/util/generic/noncopyable.h b/util/generic/noncopyable.h index c007934133b..dca012a738f 100644 --- a/util/generic/noncopyable.h +++ b/util/generic/noncopyable.h @@ -15,11 +15,11 @@ namespace NNonCopyable { // protection from unintended ADL struct TNonCopyable { - TNonCopyable(const TNonCopyable&) = delete; - TNonCopyable& operator=(const TNonCopyable&) = delete; + TNonCopyable(const TNonCopyable&) = delete; + TNonCopyable& operator=(const TNonCopyable&) = delete; - TNonCopyable() = default; - ~TNonCopyable() = default; + TNonCopyable() = default; + ~TNonCopyable() = default; }; struct TMoveOnly { diff --git a/util/generic/object_counter.h b/util/generic/object_counter.h index 5257afa2e60..c69e94c226b 100644 --- a/util/generic/object_counter.h +++ b/util/generic/object_counter.h @@ -19,7 +19,7 @@ template <class T> class TObjectCounter { public: - inline TObjectCounter() noexcept { + inline TObjectCounter() noexcept { AtomicIncrement(Count_); } @@ -27,11 +27,11 @@ public: AtomicIncrement(Count_); } - inline ~TObjectCounter() { + inline ~TObjectCounter() { AtomicDecrement(Count_); } - static inline long ObjectCount() noexcept { + static inline long ObjectCount() noexcept { return AtomicGet(Count_); } diff --git a/util/generic/objects_counter_ut.cpp b/util/generic/objects_counter_ut.cpp index 4d5da37a56f..6f4ae128fd9 100644 --- a/util/generic/objects_counter_ut.cpp +++ b/util/generic/objects_counter_ut.cpp @@ -8,7 +8,7 @@ Y_UNIT_TEST_SUITE(ObjectsCounter) { Y_UNIT_TEST(Test1) { TObject obj; - TVector<TObject> objects; + TVector<TObject> objects; for (ui32 i = 0; i < 100; ++i) { objects.push_back(obj); } diff --git a/util/generic/ptr.cpp b/util/generic/ptr.cpp index b29baebc175..b28755821f1 100644 --- a/util/generic/ptr.cpp +++ b/util/generic/ptr.cpp @@ -6,11 +6,11 @@ #include <new> #include <cstdlib> -void TFree::DoDestroy(void* t) noexcept { +void TFree::DoDestroy(void* t) noexcept { free(t); } -void TDelete::Destroy(void* t) noexcept { +void TDelete::Destroy(void* t) noexcept { ::operator delete(t); } diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 19db0e3ec55..61bd1f89b5c 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -44,33 +44,33 @@ inline void CheckedArrayDelete(T* t) { class TNoAction { public: template <class T> - static inline void Destroy(T*) noexcept { + static inline void Destroy(T*) noexcept { } }; class TDelete { public: template <class T> - static inline void Destroy(T* t) noexcept { + static inline void Destroy(T* t) noexcept { CheckedDelete(t); } /* - * special handling for nullptr - call nothing - */ - static inline void Destroy(std::nullptr_t) noexcept { - } - - /* + * special handling for nullptr - call nothing + */ + static inline void Destroy(std::nullptr_t) noexcept { + } + + /* * special handling for void* - call ::operator delete() */ - static void Destroy(void* t) noexcept; + static void Destroy(void* t) noexcept; }; class TDeleteArray { public: template <class T> - static inline void Destroy(T* t) noexcept { + static inline void Destroy(T* t) noexcept { CheckedArrayDelete(t); } }; @@ -78,7 +78,7 @@ public: class TDestructor { public: template <class T> - static inline void Destroy(T* t) noexcept { + static inline void Destroy(T* t) noexcept { (void)t; t->~T(); } @@ -87,7 +87,7 @@ public: class TFree { public: template <class T> - static inline void Destroy(T* t) noexcept { + static inline void Destroy(T* t) noexcept { DoDestroy((void*)t); } @@ -95,7 +95,7 @@ private: /* * we do not want dependancy on cstdlib here... */ - static void DoDestroy(void* t) noexcept; + static void DoDestroy(void* t) noexcept; }; template <class Base, class T> @@ -103,7 +103,7 @@ class TPointerCommon { public: using TValueType = T; - inline T* operator->() const noexcept { + inline T* operator->() const noexcept { T* ptr = AsT(); Y_ASSERT(ptr); return ptr; @@ -111,26 +111,26 @@ public: #ifndef __cpp_impl_three_way_comparison template <class C> - inline bool operator==(const C& p) const noexcept { + inline bool operator==(const C& p) const noexcept { return (p == AsT()); } template <class C> - inline bool operator!=(const C& p) const noexcept { + inline bool operator!=(const C& p) const noexcept { return (p != AsT()); } #endif - inline explicit operator bool() const noexcept { + inline explicit operator bool() const noexcept { return nullptr != AsT(); } protected: - inline T* AsT() const noexcept { + inline T* AsT() const noexcept { return (static_cast<const Base*>(this))->Get(); } - static inline T* DoRelease(T*& t) noexcept { + static inline T* DoRelease(T*& t) noexcept { T* ret = t; t = nullptr; return ret; @@ -140,13 +140,13 @@ protected: template <class Base, class T> class TPointerBase: public TPointerCommon<Base, T> { public: - inline T& operator*() const noexcept { + inline T& operator*() const noexcept { Y_ASSERT(this->AsT()); return *(this->AsT()); } - inline T& operator[](size_t n) const noexcept { + inline T& operator[](size_t n) const noexcept { Y_ASSERT(this->AsT()); return (this->AsT())[n]; @@ -163,21 +163,21 @@ class TPointerBase<Base, void>: public TPointerCommon<Base, void> { template <class T, class D> class TAutoPtr: public TPointerBase<TAutoPtr<T, D>, T> { public: - inline TAutoPtr(T* t = nullptr) noexcept + inline TAutoPtr(T* t = nullptr) noexcept : T_(t) { } - inline TAutoPtr(const TAutoPtr& t) noexcept + inline TAutoPtr(const TAutoPtr& t) noexcept : T_(t.Release()) { } - inline ~TAutoPtr() { + inline ~TAutoPtr() { DoDestroy(); } - inline TAutoPtr& operator=(const TAutoPtr& t) noexcept { + inline TAutoPtr& operator=(const TAutoPtr& t) noexcept { if (this != &t) { Reset(t.Release()); } @@ -189,26 +189,26 @@ public: return this->DoRelease(T_); } - inline void Reset(T* t) noexcept { + inline void Reset(T* t) noexcept { if (T_ != t) { DoDestroy(); T_ = t; } } - inline void Reset() noexcept { + inline void Reset() noexcept { Destroy(); } - inline void Destroy() noexcept { + inline void Destroy() noexcept { Reset(nullptr); } - inline void Swap(TAutoPtr& r) noexcept { + inline void Swap(TAutoPtr& r) noexcept { DoSwap(T_, r.T_); } - inline T* Get() const noexcept { + inline T* Get() const noexcept { return T_; } @@ -219,7 +219,7 @@ public: } #endif private: - inline void DoDestroy() noexcept { + inline void DoDestroy() noexcept { if (T_) { D::Destroy(T_); } @@ -232,22 +232,22 @@ private: template <class T, class D> class THolder: public TPointerBase<THolder<T, D>, T> { public: - constexpr THolder() noexcept - : T_(nullptr) - { - } - - constexpr THolder(std::nullptr_t) noexcept - : T_(nullptr) - { - } - + constexpr THolder() noexcept + : T_(nullptr) + { + } + + constexpr THolder(std::nullptr_t) noexcept + : T_(nullptr) + { + } + explicit THolder(T* t) noexcept : T_(t) { } - inline THolder(TAutoPtr<T, D> t) noexcept + inline THolder(TAutoPtr<T, D> t) noexcept : T_(t.Release()) { } @@ -272,11 +272,11 @@ public: THolder(const THolder&) = delete; THolder& operator=(const THolder&) = delete; - inline ~THolder() { + inline ~THolder() { DoDestroy(); } - inline void Destroy() noexcept { + inline void Destroy() noexcept { Reset(nullptr); } @@ -284,22 +284,22 @@ public: return this->DoRelease(T_); } - inline void Reset(T* t) noexcept { + inline void Reset(T* t) noexcept { if (T_ != t) { DoDestroy(); T_ = t; } } - inline void Reset(TAutoPtr<T, D> t) noexcept { + inline void Reset(TAutoPtr<T, D> t) noexcept { Reset(t.Release()); } - inline void Reset() noexcept { + inline void Reset() noexcept { Destroy(); } - inline void Swap(THolder& r) noexcept { + inline void Swap(THolder& r) noexcept { DoSwap(T_, r.T_); } @@ -307,15 +307,15 @@ public: return T_; } - inline operator TAutoPtr<T, D>() noexcept { + inline operator TAutoPtr<T, D>() noexcept { return Release(); } - THolder& operator=(std::nullptr_t) noexcept { - this->Reset(nullptr); - return *this; - } - + THolder& operator=(std::nullptr_t) noexcept { + this->Reset(nullptr); + return *this; + } + THolder& operator=(THolder&& that) noexcept { this->Reset(that.Release()); return *this; @@ -334,7 +334,7 @@ public: } #endif private: - inline void DoDestroy() noexcept { + inline void DoDestroy() noexcept { if (T_) { D::Destroy(T_); } @@ -358,26 +358,26 @@ template <typename T, typename... Args> template <class T, class C, class D> class TRefCounted { public: - inline TRefCounted(long initval = 0) noexcept + inline TRefCounted(long initval = 0) noexcept : Counter_(initval) { } inline ~TRefCounted() = default; - inline void Ref(TAtomicBase d) noexcept { + inline void Ref(TAtomicBase d) noexcept { auto resultCount = Counter_.Add(d); Y_ASSERT(resultCount >= d); (void)resultCount; } - inline void Ref() noexcept { + inline void Ref() noexcept { auto resultCount = Counter_.Inc(); Y_ASSERT(resultCount != 0); (void)resultCount; } - inline void UnRef(TAtomicBase d) noexcept { + inline void UnRef(TAtomicBase d) noexcept { auto resultCount = Counter_.Sub(d); Y_ASSERT(resultCount >= 0); if (resultCount == 0) { @@ -385,7 +385,7 @@ public: } } - inline void UnRef() noexcept { + inline void UnRef() noexcept { UnRef(1); } @@ -393,7 +393,7 @@ public: return Counter_.Val(); } - inline void DecRef() noexcept { + inline void DecRef() noexcept { auto resultCount = Counter_.Dec(); Y_ASSERT(resultCount >= 0); (void)resultCount; @@ -448,25 +448,25 @@ using TSimpleRefCount = TRefCounted<T, TSimpleCounter, D>; template <class T> class TDefaultIntrusivePtrOps { public: - static inline void Ref(T* t) noexcept { + static inline void Ref(T* t) noexcept { Y_ASSERT(t); t->Ref(); } - static inline void UnRef(T* t) noexcept { + static inline void UnRef(T* t) noexcept { Y_ASSERT(t); t->UnRef(); } - static inline void DecRef(T* t) noexcept { + static inline void DecRef(T* t) noexcept { Y_ASSERT(t); t->DecRef(); } - static inline long RefCount(const T* t) noexcept { + static inline long RefCount(const T* t) noexcept { Y_ASSERT(t); return t->RefCount(); @@ -485,7 +485,7 @@ public: struct TNoIncrement { }; - inline TIntrusivePtr(T* t = nullptr) noexcept + inline TIntrusivePtr(T* t = nullptr) noexcept : T_(t) { Ops(); @@ -498,11 +498,11 @@ public: Ops(); } - inline ~TIntrusivePtr() { + inline ~TIntrusivePtr() { UnRef(); } - inline TIntrusivePtr(const TIntrusivePtr& p) noexcept + inline TIntrusivePtr(const TIntrusivePtr& p) noexcept : T_(p.T_) { Ref(); @@ -537,7 +537,7 @@ public: Swap(p); } - inline TIntrusivePtr& operator=(TIntrusivePtr p) noexcept { + inline TIntrusivePtr& operator=(TIntrusivePtr p) noexcept { p.Swap(*this); return *this; @@ -550,19 +550,19 @@ public: Swap(t); } - inline void Reset() noexcept { + inline void Reset() noexcept { Drop(); } - inline T* Get() const noexcept { + inline T* Get() const noexcept { return T_; } - inline void Swap(TIntrusivePtr& r) noexcept { + inline void Swap(TIntrusivePtr& r) noexcept { DoSwap(T_, r.T_); } - inline void Drop() noexcept { + inline void Drop() noexcept { TIntrusivePtr(nullptr).Swap(*this); } @@ -575,7 +575,7 @@ public: return res; } - inline long RefCount() const noexcept { + inline long RefCount() const noexcept { return T_ ? Ops::RefCount(T_) : 0; } @@ -586,13 +586,13 @@ public: } #endif private: - inline void Ref() noexcept { + inline void Ref() noexcept { if (T_) { Ops::Ref(T_); } } - inline void UnRef() noexcept { + inline void UnRef() noexcept { if (T_) { Ops::UnRef(T_); } @@ -614,18 +614,18 @@ struct THash<TIntrusivePtr<T, Ops>>: THash<const T*> { template <class T, class Ops> class TIntrusiveConstPtr: public TPointerBase<TIntrusiveConstPtr<T, Ops>, const T> { public: - inline TIntrusiveConstPtr(T* t = nullptr) noexcept // we need a non-const pointer to Ref(), UnRef() and eventually delete it. + inline TIntrusiveConstPtr(T* t = nullptr) noexcept // we need a non-const pointer to Ref(), UnRef() and eventually delete it. : T_(t) { Ops(); Ref(); } - inline ~TIntrusiveConstPtr() { + inline ~TIntrusiveConstPtr() { UnRef(); } - inline TIntrusiveConstPtr(const TIntrusiveConstPtr& p) noexcept + inline TIntrusiveConstPtr(const TIntrusiveConstPtr& p) noexcept : T_(p.T_) { Ref(); @@ -657,7 +657,7 @@ public: p.T_ = nullptr; } - inline TIntrusiveConstPtr& operator=(TIntrusiveConstPtr p) noexcept { + inline TIntrusiveConstPtr& operator=(TIntrusiveConstPtr p) noexcept { p.Swap(*this); return *this; @@ -670,19 +670,19 @@ public: Swap(t); } - inline void Reset() noexcept { + inline void Reset() noexcept { Drop(); } - inline const T* Get() const noexcept { + inline const T* Get() const noexcept { return T_; } - inline void Swap(TIntrusiveConstPtr& r) noexcept { + inline void Swap(TIntrusiveConstPtr& r) noexcept { DoSwap(T_, r.T_); } - inline void Drop() noexcept { + inline void Drop() noexcept { TIntrusiveConstPtr(nullptr).Swap(*this); } @@ -697,13 +697,13 @@ public: } #endif private: - inline void Ref() noexcept { + inline void Ref() noexcept { if (T_ != nullptr) { Ops::Ref(T_); } } - inline void UnRef() noexcept { + inline void UnRef() noexcept { if (T_ != nullptr) { Ops::UnRef(T_); } @@ -732,31 +732,31 @@ class TSimpleIntrusiveOps { #endif ; - static void DoRef(T* t) noexcept { + static void DoRef(T* t) noexcept { Ops::Ref(t); } - static void DoUnRef(T* t) noexcept { + static void DoUnRef(T* t) noexcept { Ops::UnRef(t); } public: - inline TSimpleIntrusiveOps() noexcept { + inline TSimpleIntrusiveOps() noexcept { InitStaticOps(); } inline ~TSimpleIntrusiveOps() = default; - static inline void Ref(T* t) noexcept { + static inline void Ref(T* t) noexcept { Ref_(t); } - static inline void UnRef(T* t) noexcept { + static inline void UnRef(T* t) noexcept { UnRef_(t); } private: - static inline void InitStaticOps() noexcept { + static inline void InitStaticOps() noexcept { struct TInit { inline TInit() noexcept { Ref_ = DoRef; @@ -794,7 +794,7 @@ class TSharedPtr: public TPointerBase<TSharedPtr<T, C, D>, T> { friend class TSharedPtr; public: - inline TSharedPtr() noexcept + inline TSharedPtr() noexcept : T_(nullptr) , C_(nullptr) { @@ -810,7 +810,7 @@ public: Init(t); } - inline TSharedPtr(T* t, C* c) noexcept + inline TSharedPtr(T* t, C* c) noexcept : T_(t) , C_(c) { @@ -825,7 +825,7 @@ public: UnRef(); } - inline TSharedPtr(const TSharedPtr& t) noexcept + inline TSharedPtr(const TSharedPtr& t) noexcept : T_(t.T_) , C_(t.C_) { @@ -840,7 +840,7 @@ public: } template <class TT, class = TGuardConversion<T, TT>> - inline TSharedPtr(const TSharedPtr<TT, C, D>& t) noexcept + inline TSharedPtr(const TSharedPtr<TT, C, D>& t) noexcept : T_(t.T_) , C_(t.C_) { @@ -856,7 +856,7 @@ public: t.C_ = nullptr; } - inline TSharedPtr& operator=(TSharedPtr t) noexcept { + inline TSharedPtr& operator=(TSharedPtr t) noexcept { t.Swap(*this); return *this; @@ -869,28 +869,28 @@ public: Swap(t); } - inline void Reset() noexcept { + inline void Reset() noexcept { Drop(); } - inline void Drop() noexcept { + inline void Drop() noexcept { TSharedPtr().Swap(*this); } - inline T* Get() const noexcept { + inline T* Get() const noexcept { return T_; } - inline C* ReferenceCounter() const noexcept { + inline C* ReferenceCounter() const noexcept { return C_; } - inline void Swap(TSharedPtr& r) noexcept { + inline void Swap(TSharedPtr& r) noexcept { DoSwap(T_, r.T_); DoSwap(C_, r.C_); } - inline long RefCount() const noexcept { + inline long RefCount() const noexcept { return C_ ? C_->Val() : 0; } @@ -907,19 +907,19 @@ private: T_ = t.Release(); } - inline void Ref() noexcept { + inline void Ref() noexcept { if (C_) { C_->Inc(); } } - inline void UnRef() noexcept { + inline void UnRef() noexcept { if (C_ && !C_->Dec()) { DoDestroy(); } } - inline void DoDestroy() noexcept { + inline void DoDestroy() noexcept { if (T_) { D::Destroy(T_); } @@ -985,7 +985,7 @@ public: template <class T, class C, class D> class TCopyPtr: public TPointerBase<TCopyPtr<T, C, D>, T> { public: - inline TCopyPtr(T* t = nullptr) noexcept + inline TCopyPtr(T* t = nullptr) noexcept : T_(t) { } @@ -1001,7 +1001,7 @@ public: Swap(t); } - inline ~TCopyPtr() { + inline ~TCopyPtr() { DoDestroy(); } @@ -1015,26 +1015,26 @@ public: return DoRelease(T_); } - inline void Reset(T* t) noexcept { + inline void Reset(T* t) noexcept { if (T_ != t) { DoDestroy(); T_ = t; } } - inline void Reset() noexcept { + inline void Reset() noexcept { Destroy(); } - inline void Destroy() noexcept { + inline void Destroy() noexcept { Reset(nullptr); } - inline void Swap(TCopyPtr& r) noexcept { + inline void Swap(TCopyPtr& r) noexcept { DoSwap(T_, r.T_); } - inline T* Get() const noexcept { + inline T* Get() const noexcept { return T_; } @@ -1045,7 +1045,7 @@ public: } #endif private: - inline void DoDestroy() noexcept { + inline void DoDestroy() noexcept { if (T_) D::Destroy(T_); } @@ -1072,11 +1072,11 @@ public: { } - inline const T* Get() const noexcept { + inline const T* Get() const noexcept { return Const(); } - inline const T* Const() const noexcept { + inline const T* Const() const noexcept { return T_.Get(); } @@ -1086,11 +1086,11 @@ public: return T_.Get(); } - inline bool Shared() const noexcept { + inline bool Shared() const noexcept { return T_.RefCount() > 1; } - inline void Swap(TCowPtr& r) noexcept { + inline void Swap(TCowPtr& r) noexcept { T_.Swap(r.T_); } diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp index c2dcff23f6b..8dab40aa5e2 100644 --- a/util/generic/ptr_ut.cpp +++ b/util/generic/ptr_ut.cpp @@ -268,10 +268,10 @@ void TPointerTest::TestAutoToHolder() { UNIT_ASSERT_VALUES_EQUAL(cnt, 0); { - class B1: public A { + class B1: public A { }; - TAutoPtr<B1> x(new B1()); + TAutoPtr<B1> x(new B1()); THolder<A> y = x; } @@ -340,9 +340,9 @@ void TPointerTest::TestIntrPtr() { TIntrusivePtr<TOp> p, p2; TOp3 op3; { - TVector<TIntrusivePtr<TOp>> f1; + TVector<TIntrusivePtr<TOp>> f1; { - TVector<TIntrusivePtr<TOp>> f2; + TVector<TIntrusivePtr<TOp>> f2; f2.push_back(new TOp); p = new TOp; f2.push_back(p); @@ -560,7 +560,7 @@ namespace { } void TPointerTest::TestOperatorBool() { - using TVec = TVector<ui32>; + using TVec = TVector<ui32>; // to be sure TImplicitlyCastable works as expected UNIT_ASSERT((TImplicitlyCastable<int, bool>::Result)); diff --git a/util/generic/queue.h b/util/generic/queue.h index f5959f68f28..9f1cd02f17e 100644 --- a/util/generic/queue.h +++ b/util/generic/queue.h @@ -10,7 +10,7 @@ #include <queue> template <class T, class S> -class TQueue: public std::queue<T, S> { +class TQueue: public std::queue<T, S> { using TBase = std::queue<T, S>; public: @@ -34,7 +34,7 @@ public: }; template <class T, class S, class C> -class TPriorityQueue: public std::priority_queue<T, S, C> { +class TPriorityQueue: public std::priority_queue<T, S, C> { using TBase = std::priority_queue<T, S, C>; public: diff --git a/util/generic/queue_ut.cpp b/util/generic/queue_ut.cpp index a33399e1048..afaea028ad9 100644 --- a/util/generic/queue_ut.cpp +++ b/util/generic/queue_ut.cpp @@ -9,7 +9,7 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { Y_UNIT_TEST(ConstructorsAndAssignments) { { - using container = TQueue<int>; + using container = TQueue<int>; container c1; UNIT_ASSERT(!c1); @@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { } { - using container = TPriorityQueue<int>; + using container = TPriorityQueue<int>; container c1; UNIT_ASSERT(!c1); @@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { } Y_UNIT_TEST(pqueue1) { - TPriorityQueue<int, TDeque<int>, TLess<int>> q; + TPriorityQueue<int, TDeque<int>, TLess<int>> q; q.push(42); q.push(101); @@ -92,7 +92,7 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { } Y_UNIT_TEST(pqueue2) { - using TPQueue = TPriorityQueue<int, TDeque<int>, TLess<int>>; + using TPQueue = TPriorityQueue<int, TDeque<int>, TLess<int>>; TPQueue q; { @@ -118,7 +118,7 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { } Y_UNIT_TEST(pqueue3) { - TPriorityQueue<int, TDeque<int>, TLess<int>> q; + TPriorityQueue<int, TDeque<int>, TLess<int>> q; q.push(42); q.push(101); @@ -129,12 +129,12 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { } Y_UNIT_TEST(pqueue4) { - TDeque<int> c; + TDeque<int> c; c.push_back(42); c.push_back(101); c.push_back(69); - TPriorityQueue<int, TDeque<int>, TLess<int>> q(TLess<int>(), std::move(c)); + TPriorityQueue<int, TDeque<int>, TLess<int>> q(TLess<int>(), std::move(c)); UNIT_ASSERT(c.empty()); @@ -153,7 +153,7 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { } Y_UNIT_TEST(queue1) { - TQueue<int, TList<int>> q; + TQueue<int, TList<int>> q; q.push(42); q.push(101); @@ -171,11 +171,11 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { } Y_UNIT_TEST(queue2) { - using TQueueType = TQueue<int>; - TQueueType q; + using TQueueType = TQueue<int>; + TQueueType q; { - TQueueType qq; + TQueueType qq; qq.push(42); qq.push(101); @@ -197,8 +197,8 @@ Y_UNIT_TEST_SUITE(TYQueueTest) { } Y_UNIT_TEST(queue3) { - using TQueueType = TQueue<int>; - TQueueType q; + using TQueueType = TQueue<int>; + TQueueType q; q.push(42); q.push(101); diff --git a/util/generic/refcount.h b/util/generic/refcount.h index 966e853b77f..c21be4f5797 100644 --- a/util/generic/refcount.h +++ b/util/generic/refcount.h @@ -10,12 +10,12 @@ class TSimpleCounterTemplate: public TCounterCheckPolicy { using TCounterCheckPolicy::Check; public: - inline TSimpleCounterTemplate(long initial = 0) noexcept + inline TSimpleCounterTemplate(long initial = 0) noexcept : Counter_(initial) { } - inline ~TSimpleCounterTemplate() { + inline ~TSimpleCounterTemplate() { Check(); } @@ -37,7 +37,7 @@ public: return Sub(1); } - inline bool TryWeakInc() noexcept { + inline bool TryWeakInc() noexcept { if (!Counter_) { return false; } @@ -91,18 +91,18 @@ using TExplicitSimpleCounter = TSimpleCounterTemplate<TNoCheckPolicy>; template <class TCounterCheckPolicy> struct TCommonLockOps<TSimpleCounterTemplate<TCounterCheckPolicy>> { - static inline void Acquire(TSimpleCounterTemplate<TCounterCheckPolicy>* t) noexcept { + static inline void Acquire(TSimpleCounterTemplate<TCounterCheckPolicy>* t) noexcept { t->Inc(); } - static inline void Release(TSimpleCounterTemplate<TCounterCheckPolicy>* t) noexcept { + static inline void Release(TSimpleCounterTemplate<TCounterCheckPolicy>* t) noexcept { t->Dec(); } }; class TAtomicCounter { public: - inline TAtomicCounter(long initial = 0) noexcept + inline TAtomicCounter(long initial = 0) noexcept : Counter_(initial) { } @@ -117,19 +117,19 @@ public: return Add(1); } - inline TAtomicBase Sub(TAtomicBase d) noexcept { + inline TAtomicBase Sub(TAtomicBase d) noexcept { return AtomicSub(Counter_, d); } - inline TAtomicBase Dec() noexcept { + inline TAtomicBase Dec() noexcept { return Sub(1); } - inline TAtomicBase Val() const noexcept { + inline TAtomicBase Val() const noexcept { return AtomicGet(Counter_); } - inline bool TryWeakInc() noexcept { + inline bool TryWeakInc() noexcept { while (true) { intptr_t curValue = Counter_; @@ -152,11 +152,11 @@ private: template <> struct TCommonLockOps<TAtomicCounter> { - static inline void Acquire(TAtomicCounter* t) noexcept { + static inline void Acquire(TAtomicCounter* t) noexcept { t->Inc(); } - static inline void Release(TAtomicCounter* t) noexcept { + static inline void Release(TAtomicCounter* t) noexcept { t->Dec(); } }; diff --git a/util/generic/serialized_enum.h b/util/generic/serialized_enum.h index 79df2bac22b..50eda8a4bfe 100644 --- a/util/generic/serialized_enum.h +++ b/util/generic/serialized_enum.h @@ -1,34 +1,34 @@ -#pragma once - +#pragma once + #include <util/generic/fwd.h> #include <util/generic/vector.h> #include <util/generic/map.h> -#include <cstddef> +#include <cstddef> #include <type_traits> - -/* - + +/* + A file with declarations of enumeration-related functions. It doesn't contains definitions. To generate them you have to add - - GENERATE_ENUM_SERIALIZATION_WITH_HEADER(your_header_with_your_enum.h) + + GENERATE_ENUM_SERIALIZATION_WITH_HEADER(your_header_with_your_enum.h) or GENERATE_ENUM_SERIALIZATION(your_header_with_your_enum.h) - + in your ya.make - -@see https://st.yandex-team.ru/IGNIETFERRO-333 -@see https://wiki.yandex-team.ru/PoiskovajaPlatforma/Build/WritingCmakefiles/#generate-enum-with-header - -*/ - -/** - * Returns number of distinct items in enum or enum class - * - * @tparam EnumT enum type - */ -template <typename EnumT> + +@see https://st.yandex-team.ru/IGNIETFERRO-333 +@see https://wiki.yandex-team.ru/PoiskovajaPlatforma/Build/WritingCmakefiles/#generate-enum-with-header + +*/ + +/** + * Returns number of distinct items in enum or enum class + * + * @tparam EnumT enum type + */ +template <typename EnumT> Y_CONST_FUNCTION constexpr size_t GetEnumItemsCount(); namespace NEnumSerializationRuntime { diff --git a/util/generic/set.h b/util/generic/set.h index 4c437ca26f9..6a5f639e0c4 100644 --- a/util/generic/set.h +++ b/util/generic/set.h @@ -10,7 +10,7 @@ #include <set> template <class K, class L, class A> -class TSet: public std::set<K, L, TReboundAllocator<A, K>> { +class TSet: public std::set<K, L, TReboundAllocator<A, K>> { public: using TBase = std::set<K, L, TReboundAllocator<A, K>>; using TBase::TBase; @@ -26,7 +26,7 @@ public: }; template <class K, class L, class A> -class TMultiSet: public std::multiset<K, L, TReboundAllocator<A, K>> { +class TMultiSet: public std::multiset<K, L, TReboundAllocator<A, K>> { public: using TBase = std::multiset<K, L, TReboundAllocator<A, K>>; using TBase::TBase; diff --git a/util/generic/set_ut.cpp b/util/generic/set_ut.cpp index d2769d327f7..00938e39998 100644 --- a/util/generic/set_ut.cpp +++ b/util/generic/set_ut.cpp @@ -8,7 +8,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { Y_UNIT_TEST(TestSet1) { - TSet<int, TLess<int>> s; + TSet<int, TLess<int>> s; UNIT_ASSERT(!s); UNIT_ASSERT(s.count(42) == 0); s.insert(42); @@ -21,7 +21,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { } Y_UNIT_TEST(TestSet2) { - using int_set = TSet<int, TLess<int>>; + using int_set = TSet<int, TLess<int>>; int_set s; std::pair<int_set::iterator, bool> p = s.insert(42); UNIT_ASSERT(p.second == true); @@ -46,7 +46,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { } Y_UNIT_TEST(TestErase) { - TSet<int, TLess<int>> s; + TSet<int, TLess<int>> s; s.insert(1); s.erase(s.begin()); UNIT_ASSERT(s.empty()); @@ -56,26 +56,26 @@ Y_UNIT_TEST_SUITE(YSetTest) { } Y_UNIT_TEST(TestInsert) { - TSet<int> s; - TSet<int>::iterator i = s.insert(s.end(), 0); + TSet<int> s; + TSet<int>::iterator i = s.insert(s.end(), 0); UNIT_ASSERT(*i == 0); } Y_UNIT_TEST(TestFind) { - TSet<int> s; + TSet<int> s; UNIT_ASSERT(s.find(0) == s.end()); - TSet<int> const& crs = s; + TSet<int> const& crs = s; UNIT_ASSERT(crs.find(0) == crs.end()); } Y_UNIT_TEST(TestHas) { - TSet<int> s; + TSet<int> s; UNIT_ASSERT(!s.contains(0)); - TSet<int> const& crs = s; + TSet<int> const& crs = s; UNIT_ASSERT(!crs.contains(0)); s.insert(1); @@ -91,13 +91,13 @@ Y_UNIT_TEST_SUITE(YSetTest) { Y_UNIT_TEST(TestBounds) { int array1[] = {1, 3, 6, 7}; - TSet<int> s(array1, array1 + sizeof(array1) / sizeof(array1[0])); - TSet<int> const& crs = s; + TSet<int> s(array1, array1 + sizeof(array1) / sizeof(array1[0])); + TSet<int> const& crs = s; - TSet<int>::iterator sit; - TSet<int>::const_iterator scit; - std::pair<TSet<int>::iterator, TSet<int>::iterator> pit; - std::pair<TSet<int>::const_iterator, TSet<int>::const_iterator> pcit; + TSet<int>::iterator sit; + TSet<int>::const_iterator scit; + std::pair<TSet<int>::iterator, TSet<int>::iterator> pit; + std::pair<TSet<int>::const_iterator, TSet<int>::const_iterator> pcit; //Check iterator on mutable set sit = s.lower_bound(2); @@ -156,35 +156,35 @@ Y_UNIT_TEST_SUITE(YSetTest) { } Y_UNIT_TEST(TestImplementationCheck) { - TSet<int> tree; + TSet<int> tree; tree.insert(1); - TSet<int>::iterator it = tree.begin(); + TSet<int>::iterator it = tree.begin(); int const& int_ref = *it++; UNIT_ASSERT(int_ref == 1); UNIT_ASSERT(it == tree.end()); UNIT_ASSERT(it != tree.begin()); - TSet<int>::const_iterator cit = tree.begin(); + TSet<int>::const_iterator cit = tree.begin(); int const& int_cref = *cit++; UNIT_ASSERT(int_cref == 1); } Y_UNIT_TEST(TestReverseIteratorTest) { - TSet<int> tree; + TSet<int> tree; tree.insert(1); tree.insert(2); { - TSet<int>::reverse_iterator rit(tree.rbegin()); + TSet<int>::reverse_iterator rit(tree.rbegin()); UNIT_ASSERT(*(rit++) == 2); UNIT_ASSERT(*(rit++) == 1); UNIT_ASSERT(rit == tree.rend()); } { - TSet<int> const& ctree = tree; - TSet<int>::const_reverse_iterator rit(ctree.rbegin()); + TSet<int> const& ctree = tree; + TSet<int>::const_reverse_iterator rit(ctree.rbegin()); UNIT_ASSERT(*(rit++) == 2); UNIT_ASSERT(*(rit++) == 1); UNIT_ASSERT(rit == ctree.rend()); @@ -193,7 +193,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { Y_UNIT_TEST(TestConstructorsAndAssignments) { { - using container = TSet<int>; + using container = TSet<int>; container c1; c1.insert(100); @@ -228,7 +228,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { } { - using container = TMultiSet<int>; + using container = TMultiSet<int>; container c1; c1.insert(100); @@ -311,7 +311,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { Y_UNIT_TEST(TestTemplateMethods) { { - using KeySet = TSet<TKey, TKeyCmp>; + using KeySet = TSet<TKey, TKeyCmp>; KeySet keySet; keySet.insert(TKey(1)); keySet.insert(TKey(2)); @@ -335,7 +335,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { } { - using KeySet = TSet<TKey*, TKeyCmpPtr>; + using KeySet = TSet<TKey*, TKeyCmpPtr>; KeySet keySet; TKey key1(1), key2(2), key3(3), key4(4); keySet.insert(&key1); @@ -358,7 +358,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { UNIT_ASSERT(ckeySet.equal_range(2) != std::make_pair(ckeySet.begin(), ckeySet.end())); } { - using KeySet = TMultiSet<TKey, TKeyCmp>; + using KeySet = TMultiSet<TKey, TKeyCmp>; KeySet keySet; keySet.insert(TKey(1)); keySet.insert(TKey(2)); @@ -382,7 +382,7 @@ Y_UNIT_TEST_SUITE(YSetTest) { } { - using KeySet = TMultiSet<TKey const volatile*, TKeyCmpPtr>; + using KeySet = TMultiSet<TKey const volatile*, TKeyCmpPtr>; KeySet keySet; TKey key1(1), key2(2), key3(3), key4(4); keySet.insert(&key1); diff --git a/util/generic/singleton.cpp b/util/generic/singleton.cpp index eb5a0662f8d..cec1e997f19 100644 --- a/util/generic/singleton.cpp +++ b/util/generic/singleton.cpp @@ -7,15 +7,15 @@ #include <cstring> namespace { - static inline bool MyAtomicTryLock(TAtomic& a, TAtomicBase v) noexcept { + static inline bool MyAtomicTryLock(TAtomic& a, TAtomicBase v) noexcept { return AtomicCas(&a, v, 0); } - static inline bool MyAtomicTryAndTryLock(TAtomic& a, TAtomicBase v) noexcept { + static inline bool MyAtomicTryAndTryLock(TAtomic& a, TAtomicBase v) noexcept { return (AtomicGet(a) == 0) && MyAtomicTryLock(a, v); } - static inline TAtomicBase MyThreadId() noexcept { + static inline TAtomicBase MyThreadId() noexcept { const TAtomicBase ret = TThread::CurrentThreadId(); if (ret) { @@ -41,7 +41,7 @@ void NPrivate::FillWithTrash(void* ptr, size_t len) { #endif } -void NPrivate::LockRecursive(TAtomic& lock) noexcept { +void NPrivate::LockRecursive(TAtomic& lock) noexcept { const TAtomicBase id = MyThreadId(); Y_VERIFY(AtomicGet(lock) != id, "recursive singleton initialization"); @@ -55,7 +55,7 @@ void NPrivate::LockRecursive(TAtomic& lock) noexcept { } } -void NPrivate::UnlockRecursive(TAtomic& lock) noexcept { +void NPrivate::UnlockRecursive(TAtomic& lock) noexcept { Y_VERIFY(AtomicGet(lock) == MyThreadId(), "unlock from another thread?!?!"); AtomicUnlock(&lock); } diff --git a/util/generic/singleton.h b/util/generic/singleton.h index f5fa047f5c9..5b118b4221f 100644 --- a/util/generic/singleton.h +++ b/util/generic/singleton.h @@ -14,8 +14,8 @@ struct TSingletonTraits { namespace NPrivate { void FillWithTrash(void* ptr, size_t len); - void LockRecursive(TAtomic& lock) noexcept; - void UnlockRecursive(TAtomic& lock) noexcept; + void LockRecursive(TAtomic& lock) noexcept; + void UnlockRecursive(TAtomic& lock) noexcept; template <class T> void Destroyer(void* ptr) { @@ -80,7 +80,7 @@ namespace NPrivate { { } - inline const T* Get() const noexcept { + inline const T* Get() const noexcept { return &T_; } @@ -96,7 +96,7 @@ namespace NPrivate { { } - inline ~THeapStore() { + inline ~THeapStore() { delete D; } diff --git a/util/generic/stack.h b/util/generic/stack.h index dbcbf2b5c93..fd3848b154b 100644 --- a/util/generic/stack.h +++ b/util/generic/stack.h @@ -6,7 +6,7 @@ #include <stack> template <class T, class S> -class TStack: public std::stack<T, S> { +class TStack: public std::stack<T, S> { using TBase = std::stack<T, S>; public: diff --git a/util/generic/stack_ut.cpp b/util/generic/stack_ut.cpp index 248127d3260..68ceda4bdd0 100644 --- a/util/generic/stack_ut.cpp +++ b/util/generic/stack_ut.cpp @@ -4,7 +4,7 @@ Y_UNIT_TEST_SUITE(TYStackTest) { Y_UNIT_TEST(ExplicitBool) { - TStack<int> s; + TStack<int> s; UNIT_ASSERT(!s); UNIT_ASSERT(s.empty()); diff --git a/util/generic/strbase.h b/util/generic/strbase.h index ab39fc7537f..1592afc85d8 100644 --- a/util/generic/strbase.h +++ b/util/generic/strbase.h @@ -127,27 +127,27 @@ public: * @param Pointer to character inside the string, or nullptr. * @return Offset from string beginning (in chars), or npos on nullptr. */ - inline size_t off(const TCharType* ret) const noexcept { + inline size_t off(const TCharType* ret) const noexcept { return ret ? (size_t)(ret - Ptr()) : npos; } - inline size_t IterOff(const_iterator it) const noexcept { + inline size_t IterOff(const_iterator it) const noexcept { return begin() <= it && end() > it ? size_t(it - begin()) : npos; } - inline const_iterator begin() const noexcept { + inline const_iterator begin() const noexcept { return Ptr(); } - inline const_iterator end() const noexcept { + inline const_iterator end() const noexcept { return Ptr() + size(); } - inline const_iterator cbegin() const noexcept { + inline const_iterator cbegin() const noexcept { return begin(); } - inline const_iterator cend() const noexcept { + inline const_iterator cend() const noexcept { return end(); } @@ -167,7 +167,7 @@ public: return rend(); } - inline TCharType back() const noexcept { + inline TCharType back() const noexcept { Y_ASSERT(!this->empty()); return Ptr()[Len() - 1]; } @@ -181,11 +181,11 @@ public: return Ptr(); } - constexpr inline size_t size() const noexcept { + constexpr inline size_t size() const noexcept { return Len(); } - constexpr inline bool is_null() const noexcept { + constexpr inline bool is_null() const noexcept { return *Ptr() == 0; } @@ -193,16 +193,16 @@ public: return Len() == 0; } - constexpr inline explicit operator bool() const noexcept { + constexpr inline explicit operator bool() const noexcept { return !empty(); } public: // style-guide compliant methods - constexpr const TCharType* Data() const noexcept { + constexpr const TCharType* Data() const noexcept { return Ptr(); } - constexpr size_t Size() const noexcept { + constexpr size_t Size() const noexcept { return Len(); } @@ -218,16 +218,16 @@ private: public: // ~~~ Comparison ~~~ : FAMILY0(int, compare) - static int compare(const TSelf& s1, const TSelf& s2) noexcept { + static int compare(const TSelf& s1, const TSelf& s2) noexcept { return s1.AsStringView().compare(s2.AsStringView()); } - static int compare(const TCharType* p, const TSelf& s2) noexcept { + static int compare(const TCharType* p, const TSelf& s2) noexcept { TCharType null{0}; return TStringViewWithTraits(p ? p : &null).compare(s2.AsStringView()); } - static int compare(const TSelf& s1, const TCharType* p) noexcept { + static int compare(const TSelf& s1, const TCharType* p) noexcept { TCharType null{0}; return s1.AsStringView().compare(p ? p : &null); } @@ -237,7 +237,7 @@ public: } template <class T> - inline int compare(const T& t) const noexcept { + inline int compare(const T& t) const noexcept { return compare(*this, t); } @@ -257,7 +257,7 @@ public: return compare(*this, TStringView(p, len)); } - static bool equal(const TSelf& s1, const TSelf& s2) noexcept { + static bool equal(const TSelf& s1, const TSelf& s2) noexcept { return s1.AsStringView() == s2.AsStringView(); } @@ -278,7 +278,7 @@ public: } template <class T> - inline bool equal(const T& t) const noexcept { + inline bool equal(const T& t) const noexcept { return equal(*this, t); } @@ -340,12 +340,12 @@ public: } #ifndef __cpp_impl_three_way_comparison - friend bool operator==(const TCharType* pc, const TSelf& s) noexcept { + friend bool operator==(const TCharType* pc, const TSelf& s) noexcept { return equal(pc, s); } template <typename TDerived2, typename TTraits2> - friend bool operator!=(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { + friend bool operator!=(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { return !(s1 == s2); } @@ -353,17 +353,17 @@ public: return !(s1 == s2); } - friend bool operator!=(const TSelf& s, const TCharType* pc) noexcept { + friend bool operator!=(const TSelf& s, const TCharType* pc) noexcept { return !(s == pc); } - friend bool operator!=(const TCharType* pc, const TSelf& s) noexcept { + friend bool operator!=(const TCharType* pc, const TSelf& s) noexcept { return !(pc == s); } #endif template <typename TDerived2, typename TTraits2> - friend bool operator<(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { + friend bool operator<(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { return compare(s1, s2) < 0; } @@ -371,16 +371,16 @@ public: return compare(s1, s2) < 0; } - friend bool operator<(const TSelf& s, const TCharType* pc) noexcept { + friend bool operator<(const TSelf& s, const TCharType* pc) noexcept { return compare(s, pc) < 0; } - friend bool operator<(const TCharType* pc, const TSelf& s) noexcept { + friend bool operator<(const TCharType* pc, const TSelf& s) noexcept { return compare(pc, s) < 0; } template <typename TDerived2, typename TTraits2> - friend bool operator<=(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { + friend bool operator<=(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { return compare(s1, s2) <= 0; } @@ -388,16 +388,16 @@ public: return compare(s1, s2) <= 0; } - friend bool operator<=(const TSelf& s, const TCharType* pc) noexcept { + friend bool operator<=(const TSelf& s, const TCharType* pc) noexcept { return compare(s, pc) <= 0; } - friend bool operator<=(const TCharType* pc, const TSelf& s) noexcept { + friend bool operator<=(const TCharType* pc, const TSelf& s) noexcept { return compare(pc, s) <= 0; } template <typename TDerived2, typename TTraits2> - friend bool operator>(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { + friend bool operator>(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { return compare(s1, s2) > 0; } @@ -405,16 +405,16 @@ public: return compare(s1, s2) > 0; } - friend bool operator>(const TSelf& s, const TCharType* pc) noexcept { + friend bool operator>(const TSelf& s, const TCharType* pc) noexcept { return compare(s, pc) > 0; } - friend bool operator>(const TCharType* pc, const TSelf& s) noexcept { + friend bool operator>(const TCharType* pc, const TSelf& s) noexcept { return compare(pc, s) > 0; } template <typename TDerived2, typename TTraits2> - friend bool operator>=(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { + friend bool operator>=(const TSelf& s1, const TStringBase<TDerived2, TChar, TTraits2>& s2) noexcept { return compare(s1, s2) >= 0; } @@ -422,23 +422,23 @@ public: return compare(s1, s2) >= 0; } - friend bool operator>=(const TSelf& s, const TCharType* pc) noexcept { + friend bool operator>=(const TSelf& s, const TCharType* pc) noexcept { return compare(s, pc) >= 0; } - friend bool operator>=(const TCharType* pc, const TSelf& s) noexcept { + friend bool operator>=(const TCharType* pc, const TSelf& s) noexcept { return compare(pc, s) >= 0; } // ~~ Read access ~~ - inline TCharType at(size_t pos) const noexcept { + inline TCharType at(size_t pos) const noexcept { if (Y_LIKELY(pos < Len())) { return (Ptr())[pos]; } return 0; } - inline TCharType operator[](size_t pos) const noexcept { + inline TCharType operator[](size_t pos) const noexcept { Y_ASSERT(pos < this->size()); return Ptr()[pos]; @@ -456,15 +456,15 @@ public: return AsStringView().find(s, pos, count); } - inline size_t find(TCharType c, size_t pos = 0) const noexcept { + inline size_t find(TCharType c, size_t pos = 0) const noexcept { return AsStringView().find(c, pos); } - inline size_t rfind(TCharType c) const noexcept { + inline size_t rfind(TCharType c) const noexcept { return AsStringView().rfind(c); } - inline size_t rfind(TCharType c, size_t pos) const noexcept { + inline size_t rfind(TCharType c, size_t pos) const noexcept { if (pos == 0) { return npos; } @@ -492,11 +492,11 @@ public: } //~~~~Character Set Search~~~ - inline size_t find_first_of(TCharType c) const noexcept { + inline size_t find_first_of(TCharType c) const noexcept { return find_first_of(c, 0); } - inline size_t find_first_of(TCharType c, size_t pos) const noexcept { + inline size_t find_first_of(TCharType c, size_t pos) const noexcept { return find(c, pos); } @@ -508,11 +508,11 @@ public: return AsStringView().find_first_of(set.data(), pos, set.size()); } - inline size_t find_first_not_of(TCharType c) const noexcept { + inline size_t find_first_not_of(TCharType c) const noexcept { return find_first_not_of(c, 0); } - inline size_t find_first_not_of(TCharType c, size_t pos) const noexcept { + inline size_t find_first_not_of(TCharType c, size_t pos) const noexcept { return find_first_not_of(TStringView(&c, 1), pos); } @@ -524,7 +524,7 @@ public: return AsStringView().find_first_not_of(set.data(), pos, set.size()); } - inline size_t find_last_of(TCharType c, size_t pos = npos) const noexcept { + inline size_t find_last_of(TCharType c, size_t pos = npos) const noexcept { return find_last_of(&c, pos, 1); } @@ -532,7 +532,7 @@ public: return find_last_of(set.data(), pos, set.length()); } - inline size_t find_last_of(const TCharType* set, size_t pos, size_t n) const noexcept { + inline size_t find_last_of(const TCharType* set, size_t pos, size_t n) const noexcept { return AsStringView().find_last_of(set, pos, n); } @@ -560,7 +560,7 @@ public: return CopyImpl(pc, n, 0); } - inline size_t strcpy(TCharType* pc, size_t n) const noexcept { + inline size_t strcpy(TCharType* pc, size_t n) const noexcept { if (n) { n = copy(pc, n - 1); pc[n] = 0; @@ -585,19 +585,19 @@ private: return static_cast<TStringViewWithTraits>(*this); } - constexpr inline const TCharType* Ptr() const noexcept { + constexpr inline const TCharType* Ptr() const noexcept { return This()->data(); } - constexpr inline size_t Len() const noexcept { + constexpr inline size_t Len() const noexcept { return This()->length(); } - constexpr inline const TDerived* This() const noexcept { + constexpr inline const TDerived* This() const noexcept { return static_cast<const TDerived*>(this); } - inline size_t CopyImpl(TCharType* pc, size_t n, size_t pos) const noexcept { + inline size_t CopyImpl(TCharType* pc, size_t n, size_t pos) const noexcept { const size_t toCopy = Min(Len() - pos, n); TTraits::copy(pc, Ptr() + pos, toCopy); diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h index 70b9360d580..4ec008e2678 100644 --- a/util/generic/strbuf.h +++ b/util/generic/strbuf.h @@ -167,7 +167,7 @@ public: *this = TdSelf(); } - constexpr bool IsInited() const noexcept { + constexpr bool IsInited() const noexcept { return data() != nullptr; } @@ -213,7 +213,7 @@ public: * @param[out] r The second part of split result. * @returns Whether the split was actually performed. */ - inline bool TrySplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept { + inline bool TrySplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept { return TrySplitOn(TBase::find(delim), l, r, delim.size()); } @@ -228,7 +228,7 @@ public: * @param[out] r The second part of split result. * @returns Whether the split was actually performed. */ - inline bool TryRSplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept { + inline bool TryRSplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept { return TrySplitOn(TBase::rfind(delim), l, r, delim.size()); } @@ -240,17 +240,17 @@ public: RSplitTemplate(delim, l, r); } - inline void Split(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept { + inline void Split(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept { SplitTemplate(delim, l, r); } - inline void RSplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept { + inline void RSplit(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept { RSplitTemplate(delim, l, r); } private: // splits on a delimiter at a given position; delimiter is excluded - void DoSplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len) const noexcept { + void DoSplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len) const noexcept { Y_ASSERT(pos != TBase::npos); // make a copy in case one of l/r is really *this @@ -267,7 +267,7 @@ public: // For example, for TStringBuf s("abc"): // s.TrySplitOn(s.find('z'), ...) is false, but s.TrySplitOn(100500, ...) is true. - bool TrySplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len = 1) const noexcept { + bool TrySplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len = 1) const noexcept { if (TBase::npos == pos) return false; @@ -275,25 +275,25 @@ public: return true; } - void SplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len = 1) const noexcept { + void SplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len = 1) const noexcept { if (!TrySplitOn(pos, l, r, len)) { l = *this; r = TdSelf(); } } - bool TrySplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept { + bool TrySplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept { return TrySplitOn(pos, l, r, 0); } - void SplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept { + void SplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept { SplitOn(pos, l, r, 0); } /* // Not implemented intentionally, use TrySplitOn() instead - void RSplitOn(size_t pos, TdSelf& l, TdSelf& r) const noexcept; - void RSplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept; + void RSplitOn(size_t pos, TdSelf& l, TdSelf& r) const noexcept; + void RSplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept; */ public: @@ -318,7 +318,7 @@ public: } public: - inline bool AfterPrefix(const TdSelf& prefix, TdSelf& result) const noexcept { + inline bool AfterPrefix(const TdSelf& prefix, TdSelf& result) const noexcept { if (this->StartsWith(prefix)) { result = Tail(prefix.size()); return true; @@ -326,7 +326,7 @@ public: return false; } - inline bool BeforeSuffix(const TdSelf& suffix, TdSelf& result) const noexcept { + inline bool BeforeSuffix(const TdSelf& suffix, TdSelf& result) const noexcept { if (this->EndsWith(suffix)) { result = Head(size() - suffix.size()); return true; @@ -335,12 +335,12 @@ public: } // returns true if string started with `prefix`, false otherwise - inline bool SkipPrefix(const TdSelf& prefix) noexcept { + inline bool SkipPrefix(const TdSelf& prefix) noexcept { return AfterPrefix(prefix, *this); } // returns true if string ended with `suffix`, false otherwise - inline bool ChopSuffix(const TdSelf& suffix) noexcept { + inline bool ChopSuffix(const TdSelf& suffix) noexcept { return BeforeSuffix(suffix, *this); } @@ -435,13 +435,13 @@ public: public: // string subsequences /// Cut last @c shift characters (or less if length is less than @c shift) - inline TdSelf& Chop(size_t shift) noexcept { + inline TdSelf& Chop(size_t shift) noexcept { this->remove_suffix(std::min(shift, size())); return *this; } /// Cut first @c shift characters (or less if length is less than @c shift) - inline TdSelf& Skip(size_t shift) noexcept { + inline TdSelf& Skip(size_t shift) noexcept { this->remove_prefix(std::min(shift, size())); return *this; } @@ -520,7 +520,7 @@ private: } template <typename TDelimiterType> - inline void SplitTemplate(TDelimiterType delim, TdSelf& l, TdSelf& r) const noexcept { + inline void SplitTemplate(TDelimiterType delim, TdSelf& l, TdSelf& r) const noexcept { if (!TrySplit(delim, l, r)) { l = *this; r = TdSelf(); @@ -528,7 +528,7 @@ private: } template <typename TDelimiterType> - inline void RSplitTemplate(TDelimiterType delim, TdSelf& l, TdSelf& r) const noexcept { + inline void RSplitTemplate(TDelimiterType delim, TdSelf& l, TdSelf& r) const noexcept { if (!TryRSplit(delim, l, r)) { r = *this; l = TdSelf(); diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp index 69cde785af0..4bec3f1ab00 100644 --- a/util/generic/strbuf_ut.cpp +++ b/util/generic/strbuf_ut.cpp @@ -150,7 +150,7 @@ Y_UNIT_TEST_SUITE(TStrBufTest) { str = qw; UNIT_ASSERT_EQUAL(str.SubStr(2), TStringBuf("erty")); - UNIT_ASSERT_EQUAL(str.Skip(3), qw.SubStr(3)); + UNIT_ASSERT_EQUAL(str.Skip(3), qw.SubStr(3)); str.Chop(1); UNIT_ASSERT_EQUAL(str, TStringBuf("rt")); } diff --git a/util/generic/string.cpp b/util/generic/string.cpp index 3c655f1f663..0c949f814ef 100644 --- a/util/generic/string.cpp +++ b/util/generic/string.cpp @@ -1,4 +1,4 @@ -#include "string.h" +#include "string.h" #include <util/string/ascii.h> #include <util/system/sanitizers.h> diff --git a/util/generic/string.h b/util/generic/string.h index 8cd8aa6917f..89fd6cd2fab 100644 --- a/util/generic/string.h +++ b/util/generic/string.h @@ -20,10 +20,10 @@ #include "strbuf.h" #include "string_hash.h" -#if defined(address_sanitizer_enabled) || defined(thread_sanitizer_enabled) +#if defined(address_sanitizer_enabled) || defined(thread_sanitizer_enabled) #include "hide_ptr.h" -#endif - +#endif + template <class TCharType, class TCharTraits, class TAllocator> void ResizeUninitialized(std::basic_string<TCharType, TCharTraits, TAllocator>& s, size_t len) { #if defined(_YNDX_LIBCXX_ENABLE_STRING_RESIZE_UNINITIALIZED) @@ -103,12 +103,12 @@ private: } }; -template <class TStringType> +template <class TStringType> class TBasicCharRef { public: - using TChar = typename TStringType::TChar; + using TChar = typename TStringType::TChar; - TBasicCharRef(TStringType& s, size_t pos) + TBasicCharRef(TStringType& s, size_t pos) : S_(s) , Pos_(pos) { @@ -150,7 +150,7 @@ public: TBasicCharRef(const TBasicCharRef&) = default; private: - TStringType& S_; + TStringType& S_; size_t Pos_; }; #endif @@ -294,11 +294,11 @@ public: #endif } - inline size_t length() const noexcept { + inline size_t length() const noexcept { return ConstRef().length(); } - inline const TCharType* data() const noexcept { + inline const TCharType* data() const noexcept { return ConstRef().data(); } @@ -541,7 +541,7 @@ private: return 1 + SumLength(r...); } - static constexpr size_t SumLength() noexcept { + static constexpr size_t SumLength() noexcept { return 0; } @@ -557,11 +557,11 @@ private: CopyAll(p + 1, r...); } - static void CopyAll(TCharType*) noexcept { + static void CopyAll(TCharType*) noexcept { } public: - inline void clear() noexcept { + inline void clear() noexcept { #ifdef TSTRING_IS_STD_STRING Storage_.clear(); #else @@ -623,7 +623,7 @@ public: } TBasicString& assign(const TCharType* first, const TCharType* last) { - return assign(first, last - first); + return assign(first, last - first); } TBasicString& assign(const TCharType* pc, size_t pos, size_t n) { diff --git a/util/generic/string.pxd b/util/generic/string.pxd index c25f7392a1d..1b3850c0b2f 100644 --- a/util/generic/string.pxd +++ b/util/generic/string.pxd @@ -12,22 +12,22 @@ cdef extern from "<util/generic/strbuf.h>" nogil: size_t Size() -cdef extern from "<util/generic/string.h>" nogil: +cdef extern from "<util/generic/string.h>" nogil: - size_t npos "TString::npos" + size_t npos "TString::npos" # Inheritance is bogus, but it's safe to assume TString is-a TStringBuf via implicit cast cdef cppclass TString(TStringBuf): - TString() except + - TString(TString&) except + - TString(_std_string&) except + - TString(TString&, size_t, size_t) except + - TString(char*) except + - TString(char*, size_t) except + - TString(char*, size_t, size_t) except + - # as a TString formed by a repetition of character c, n times. - TString(size_t, char) except + - TString(char*, char*) except + + TString() except + + TString(TString&) except + + TString(_std_string&) except + + TString(TString&, size_t, size_t) except + + TString(char*) except + + TString(char*, size_t) except + + TString(char*, size_t, size_t) except + + # as a TString formed by a repetition of character c, n times. + TString(size_t, char) except + + TString(char*, char*) except + TString(TStringBuf&) except + TString(TStringBuf&, TStringBuf&) except + TString(TStringBuf&, TStringBuf&, TStringBuf&) except + @@ -48,22 +48,22 @@ cdef extern from "<util/generic/string.h>" nogil: TString& append(TStringBuf&) except + TString& append(TStringBuf&, size_t, size_t) except + - TString& append(char *) except + - TString& append(char *, size_t) except + - TString& append(size_t, char) except + + TString& append(char *) except + + TString& append(char *, size_t) except + + TString& append(size_t, char) except + void push_back(char c) except + TString& assign(TStringBuf&) except + TString& assign(TStringBuf&, size_t, size_t) except + - TString& assign(char *) except + - TString& assign(char *, size_t) except + + TString& assign(char *) except + + TString& assign(char *, size_t) except + - TString& insert(size_t, TString&) except + - TString& insert(size_t, TString&, size_t, size_t) except + - TString& insert(size_t, char* s) except + - TString& insert(size_t, char* s, size_t) except + - TString& insert(size_t, size_t, char c) except + + TString& insert(size_t, TString&) except + + TString& insert(size_t, TString&, size_t, size_t) except + + TString& insert(size_t, char* s) except + + TString& insert(size_t, char* s, size_t) except + + TString& insert(size_t, size_t, char c) except + size_t copy(char *, size_t) except + size_t copy(char *, size_t, size_t) except + @@ -93,11 +93,11 @@ cdef extern from "<util/generic/string.h>" nogil: size_t find_last_of(TStringBuf& set) size_t find_last_of(TStringBuf& set, size_t pos) - TString substr(size_t pos) except + - TString substr(size_t pos, size_t n) except + + TString substr(size_t pos) except + + TString substr(size_t pos, size_t n) except + TString operator+(TStringBuf& rhs) except + - TString operator+(char* rhs) except + + TString operator+(char* rhs) except + bint operator==(TStringBuf&) bint operator==(char*) diff --git a/util/generic/string_transparent_hash_ut.cpp b/util/generic/string_transparent_hash_ut.cpp index b87fa2843e6..99aaeb55c48 100644 --- a/util/generic/string_transparent_hash_ut.cpp +++ b/util/generic/string_transparent_hash_ut.cpp @@ -1,4 +1,4 @@ -#include "string.h" +#include "string.h" #include "vector.h" #include "strbuf.h" diff --git a/util/generic/string_ut.cpp b/util/generic/string_ut.cpp index ac82e9091db..e1ca6d358ea 100644 --- a/util/generic/string_ut.cpp +++ b/util/generic/string_ut.cpp @@ -17,7 +17,7 @@ #ifdef TSTRING_IS_STD_STRING static_assert(sizeof(TString) == sizeof(std::string), "expect sizeof(TString) == sizeof(std::string)"); #else -static_assert(sizeof(TString) == sizeof(const char*), "expect sizeof(TString) == sizeof(const char*)"); +static_assert(sizeof(TString) == sizeof(const char*), "expect sizeof(TString) == sizeof(const char*)"); #endif class TStringTestZero: public TTestBase { @@ -28,7 +28,7 @@ class TStringTestZero: public TTestBase { public: void TestZero() { const char data[] = "abc\0def\0"; - TString s(data, sizeof(data)); + TString s(data, sizeof(data)); UNIT_ASSERT(s.size() == sizeof(data)); UNIT_ASSERT(s.StartsWith(s)); UNIT_ASSERT(s.EndsWith(s)); @@ -36,8 +36,8 @@ public: const char raw_def[] = "def"; const char raw_zero[] = "\0"; - TString def(raw_def, sizeof(raw_def) - 1); - TString zero(raw_zero, sizeof(raw_zero) - 1); + TString def(raw_def, sizeof(raw_def) - 1); + TString zero(raw_zero, sizeof(raw_zero) - 1); UNIT_ASSERT_EQUAL(4, s.find(raw_def)); UNIT_ASSERT_EQUAL(4, s.find(def)); UNIT_ASSERT_EQUAL(4, s.find_first_of(raw_def)); @@ -45,15 +45,15 @@ public: UNIT_ASSERT_EQUAL(7, s.find_first_not_of(def, 4)); const char nonSubstring[] = "def\0ghi"; - UNIT_ASSERT_EQUAL(TString::npos, s.find(TString(nonSubstring, sizeof(nonSubstring)))); + UNIT_ASSERT_EQUAL(TString::npos, s.find(TString(nonSubstring, sizeof(nonSubstring)))); - TString copy = s; + TString copy = s; copy.replace(copy.size() - 1, 1, "z"); UNIT_ASSERT(s != copy); copy.replace(copy.size() - 1, 1, "\0", 0, 1); UNIT_ASSERT(s == copy); - TString prefix(data, 5); + TString prefix(data, 5); UNIT_ASSERT(s.StartsWith(prefix)); UNIT_ASSERT(s != prefix); UNIT_ASSERT(s > prefix); @@ -68,7 +68,7 @@ public: UNIT_TEST_SUITE_REGISTRATION(TStringTestZero); -template <typename TStringType, typename TTestData> +template <typename TStringType, typename TTestData> class TStringStdTestImpl { using TChar = typename TStringType::char_type; using TTraits = typename TStringType::traits_type; @@ -92,7 +92,7 @@ protected: void reserve() { #if 0 - TStringType s; + TStringType s; // @todo use UNIT_TEST_EXCEPTION try { s.reserve(s.max_size() + 1); @@ -129,7 +129,7 @@ protected: #ifndef TSTRING_IS_STD_STRING // Shared behaviour - always reallocate, just as much as requisted - TStringType holder = s; + TStringType holder = s; UNIT_ASSERT(s.capacity() >= 256); @@ -152,22 +152,22 @@ protected: void short_string() { TStringType const ref_short_str1(Data_.str1()), ref_short_str2(Data_.str2()); - TStringType short_str1(ref_short_str1), short_str2(ref_short_str2); + TStringType short_str1(ref_short_str1), short_str2(ref_short_str2); TStringType const ref_long_str1(Data_.str__________________________________________________1()); TStringType const ref_long_str2(Data_.str__________________________________________________2()); - TStringType long_str1(ref_long_str1), long_str2(ref_long_str2); + TStringType long_str1(ref_long_str1), long_str2(ref_long_str2); UNIT_ASSERT(short_str1 == ref_short_str1); UNIT_ASSERT(long_str1 == ref_long_str1); { - TStringType str1(short_str1); + TStringType str1(short_str1); str1 = long_str1; UNIT_ASSERT(str1 == ref_long_str1); } { - TStringType str1(long_str1); + TStringType str1(long_str1); str1 = short_str1; UNIT_ASSERT(str1 == ref_short_str1); } @@ -198,7 +198,7 @@ protected: { //This is to test move constructor - TVector<TStringType> str_vect; + TVector<TStringType> str_vect; str_vect.push_back(short_str1); str_vect.push_back(long_str1); @@ -214,7 +214,7 @@ protected: void erase() { TChar const* c_str = Data_.Hello_World(); - TStringType str(c_str); + TStringType str(c_str); UNIT_ASSERT(str == c_str); str.erase(str.begin() + 1, str.end() - 1); // Erase all but first and last. @@ -266,7 +266,7 @@ protected: } void data() { - TStringType xx; + TStringType xx; // ISO-IEC-14882:1998(E), 21.3.6, paragraph 3 UNIT_ASSERT(xx.data() != nullptr); @@ -274,8 +274,8 @@ protected: void c_str() { TStringType low(Data_._2004_01_01()); - TStringType xx; - TStringType yy; + TStringType xx; + TStringType yy; // ISO-IEC-14882:1998(E), 21.3.6, paragraph 1 UNIT_ASSERT(*(yy.c_str()) == 0); @@ -357,10 +357,10 @@ protected: void insert() { TStringType strorg = Data_.This_is_test_string_for_string_calls(); - TStringType str; + TStringType str; // In case of reallocation there is no auto reference problem - // so we reserve a big enough TStringType to be sure to test this + // so we reserve a big enough TStringType to be sure to test this // particular point. str.reserve(100); @@ -383,9 +383,9 @@ protected: UNIT_ASSERT(str == Data_.ng_for_string_callsThis_is_test_string_for_string_calls()); str = strorg; - typename TStringType::iterator b = str.begin(); - typename TStringType::const_iterator s = str.begin() + str.size() / 2 - 1; - typename TStringType::const_iterator e = str.end(); + typename TStringType::iterator b = str.begin(); + typename TStringType::const_iterator s = str.begin() + str.size() / 2 - 1; + typename TStringType::const_iterator e = str.end(); str.insert(b, s, e); UNIT_ASSERT(str == Data_.ng_for_string_callsThis_is_test_string_for_string_calls()); @@ -396,13 +396,13 @@ protected: UNIT_ASSERT(str == Data.ng_for_string_callsThis_is_test_string_for_string_calls()); #endif - TStringType str0; + TStringType str0; str0.insert(str0.begin(), 5, *Data_._0()); UNIT_ASSERT(str0 == Data_._00000()); - TStringType str1; + TStringType str1; { - typename TStringType::size_type pos = 0, nb = 2; + typename TStringType::size_type pos = 0, nb = 2; str1.insert(pos, nb, *Data_._1()); } UNIT_ASSERT(str1 == Data_._11()); @@ -428,7 +428,7 @@ protected: } void resize() { - TStringType s; + TStringType s; s.resize(0); @@ -472,7 +472,7 @@ protected: } void capacity() { - TStringType s; + TStringType s; UNIT_ASSERT(s.capacity() < s.max_size()); UNIT_ASSERT(s.capacity() >= s.size()); @@ -487,7 +487,7 @@ protected: } void assign() { - TStringType s; + TStringType s; TChar const* cstr = Data_.test_string_for_assign(); s.assign(cstr, cstr + 22); @@ -497,12 +497,12 @@ protected: s.assign(s2); UNIT_ASSERT(s == s2); - static TStringType str1; - static TStringType str2; + static TStringType str1; + static TStringType str2; - // short TStringType optim: + // short TStringType optim: str1 = Data_._123456(); - // longer than short TStringType: + // longer than short TStringType: str2 = Data_._1234567890123456789012345678901234567890(); UNIT_ASSERT(str1[5] == *Data_._6()); @@ -539,7 +539,7 @@ protected: void cbegin_cend() { const char helloThere[] = "Hello there"; - TString s = helloThere; + TString s = helloThere; size_t index = 0; for (auto it = s.cbegin(); s.cend() != it; ++it, ++index) { UNIT_ASSERT_VALUES_EQUAL(helloThere[index], *it); @@ -548,7 +548,7 @@ protected: void compare() { TStringType str1(Data_.abcdef()); - TStringType str2; + TStringType str2; str2 = Data_.abcdef(); UNIT_ASSERT(str1.compare(str2) == 0); @@ -601,14 +601,14 @@ protected: #if 0 void rfind() { // 21.3.6.2 - TStringType s(Data.one_two_three_one_two_three()); + TStringType s(Data.one_two_three_one_two_three()); UNIT_ASSERT(s.rfind(Data.two()) == 18); - UNIT_ASSERT(s.rfind(Data.two(), 0) == TStringType::npos); + UNIT_ASSERT(s.rfind(Data.two(), 0) == TStringType::npos); UNIT_ASSERT(s.rfind(Data.two(), 11) == 4); UNIT_ASSERT(s.rfind(*Data.w()) == 19); - TStringType test(Data.aba()); + TStringType test(Data.aba()); UNIT_ASSERT(test.rfind(Data.a(), 2, 1) == 2); UNIT_ASSERT(test.rfind(Data.a(), 1, 1) == 0); @@ -643,15 +643,15 @@ protected: } #if 0 void replace() { - // This test case is for the non template basic_TString::replace method, + // This test case is for the non template basic_TString::replace method, // this is why we play with the const iterators and reference to guaranty // that the right method is called. - const TStringType v(Data._78()); - TStringType s(Data._123456()); - TStringType const& cs = s; + const TStringType v(Data._78()); + TStringType s(Data._123456()); + TStringType const& cs = s; - typename TStringType::iterator i = s.begin() + 1; + typename TStringType::iterator i = s.begin() + 1; s.replace(i, i + 3, v.begin(), v.end()); UNIT_ASSERT(s == Data._17856()); @@ -662,7 +662,7 @@ protected: s = Data._123456(); i = s.begin() + 1; - typename TStringType::const_iterator ci = s.begin() + 1; + typename TStringType::const_iterator ci = s.begin() + 1; s.replace(i, i + 3, ci + 3, cs.end()); UNIT_ASSERT(s == Data._15656()); @@ -691,10 +691,10 @@ protected: // This is the test for the template replace method. s = Data._123456(); - typename TStringType::iterator b = s.begin() + 4; - typename TStringType::iterator e = s.end(); - typename TStringType::const_iterator rb = s.begin(); - typename TStringType::const_iterator re = s.end(); + typename TStringType::iterator b = s.begin() + 4; + typename TStringType::iterator e = s.end(); + typename TStringType::const_iterator rb = s.begin(); + typename TStringType::const_iterator re = s.end(); s.replace(b, e, rb, re); UNIT_ASSERT(s == Data._1234123456()); @@ -702,8 +702,8 @@ protected: s.replace(s.begin() + 4, s.end(), s.begin(), s.end()); UNIT_ASSERT(s == Data._1234123456()); - TStringType strorg(Data.This_is_test_StringT_for_StringT_calls()); - TStringType str = strorg; + TStringType strorg(Data.This_is_test_StringT_for_StringT_calls()); + TStringType str = strorg; str.replace(5, 15, str.c_str(), 10); UNIT_ASSERT(str == Data.This_This_is_tefor_StringT_calls()); @@ -721,7 +721,7 @@ protected: #endif }; // TStringStdTestImpl -class TStringTest: public TTestBase, private TStringTestImpl<TString, TTestData<char>> { +class TStringTest: public TTestBase, private TStringTestImpl<TString, TTestData<char>> { public: UNIT_TEST_SUITE(TStringTest); UNIT_TEST(TestMaxSize); @@ -783,7 +783,7 @@ public: UNIT_TEST_SUITE_REGISTRATION(TStringTest); -class TWideStringTest: public TTestBase, private TStringTestImpl<TUtf16String, TTestData<wchar16>> { +class TWideStringTest: public TTestBase, private TStringTestImpl<TUtf16String, TTestData<wchar16>> { public: UNIT_TEST_SUITE(TWideStringTest); UNIT_TEST(TestConstructors); @@ -816,21 +816,21 @@ public: private: void TestDecodingMethods() { - UNIT_ASSERT(TUtf16String::FromAscii("").empty()); - UNIT_ASSERT(TUtf16String::FromAscii("abc") == ASCIIToWide("abc")); + UNIT_ASSERT(TUtf16String::FromAscii("").empty()); + UNIT_ASSERT(TUtf16String::FromAscii("abc") == ASCIIToWide("abc")); const char* text = "123kx83abcd ej)#$%ddja&%J&"; - TUtf16String wtext = ASCIIToWide(text); + TUtf16String wtext = ASCIIToWide(text); - UNIT_ASSERT(wtext == TUtf16String::FromAscii(text)); + UNIT_ASSERT(wtext == TUtf16String::FromAscii(text)); - TString strtext(text); - UNIT_ASSERT(wtext == TUtf16String::FromAscii(strtext)); + TString strtext(text); + UNIT_ASSERT(wtext == TUtf16String::FromAscii(strtext)); TStringBuf strbuftext(text); - UNIT_ASSERT(wtext == TUtf16String::FromAscii(strbuftext)); + UNIT_ASSERT(wtext == TUtf16String::FromAscii(strbuftext)); - UNIT_ASSERT(wtext.substr(5) == TUtf16String::FromAscii(text + 5)); + UNIT_ASSERT(wtext.substr(5) == TUtf16String::FromAscii(text + 5)); const wchar16 wideCyrillicAlphabet[] = { 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, @@ -839,16 +839,16 @@ private: 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x00}; - TUtf16String strWide(wideCyrillicAlphabet); - TString strUtf8 = WideToUTF8(strWide); + TUtf16String strWide(wideCyrillicAlphabet); + TString strUtf8 = WideToUTF8(strWide); - UNIT_ASSERT(strWide == TUtf16String::FromUtf8(strUtf8.c_str())); - UNIT_ASSERT(strWide == TUtf16String::FromUtf8(strUtf8)); - UNIT_ASSERT(strWide == TUtf16String::FromUtf8(TStringBuf(strUtf8))); + UNIT_ASSERT(strWide == TUtf16String::FromUtf8(strUtf8.c_str())); + UNIT_ASSERT(strWide == TUtf16String::FromUtf8(strUtf8)); + UNIT_ASSERT(strWide == TUtf16String::FromUtf8(TStringBuf(strUtf8))); // assign - TUtf16String s1; + TUtf16String s1; s1.AssignAscii("1234"); UNIT_ASSERT(s1 == ASCIIToWide("1234")); @@ -860,8 +860,8 @@ private: // append - TUtf16String s2; - TUtf16String testAppend = strWide; + TUtf16String s2; + TUtf16String testAppend = strWide; s2.AppendUtf8(strUtf8); UNIT_ASSERT(testAppend == s2); @@ -883,12 +883,12 @@ private: } void TestLetOperator() { - TUtf16String str; + TUtf16String str; str = wchar16('X'); - UNIT_ASSERT(str == TUtf16String::FromAscii("X")); + UNIT_ASSERT(str == TUtf16String::FromAscii("X")); - const TUtf16String hello = TUtf16String::FromAscii("hello"); + const TUtf16String hello = TUtf16String::FromAscii("hello"); str = hello.data(); UNIT_ASSERT(str == hello); @@ -1105,7 +1105,7 @@ private: UNIT_TEST_SUITE_REGISTRATION(TUtf32StringTest); -class TStringStdTest: public TTestBase, private TStringStdTestImpl<TString, TTestData<char>> { +class TStringStdTest: public TTestBase, private TStringStdTestImpl<TString, TTestData<char>> { public: UNIT_TEST_SUITE(TStringStdTest); UNIT_TEST(Constructor); @@ -1141,7 +1141,7 @@ public: UNIT_TEST_SUITE_REGISTRATION(TStringStdTest); -class TWideStringStdTest: public TTestBase, private TStringStdTestImpl<TUtf16String, TTestData<wchar16>> { +class TWideStringStdTest: public TTestBase, private TStringStdTestImpl<TUtf16String, TTestData<wchar16>> { public: UNIT_TEST_SUITE(TWideStringStdTest); UNIT_TEST(Constructor); diff --git a/util/generic/string_ut.h b/util/generic/string_ut.h index 44bb10bdebe..548b7354536 100644 --- a/util/generic/string_ut.h +++ b/util/generic/string_ut.h @@ -1,6 +1,6 @@ #pragma once -#include "string.h" +#include "string.h" #include <library/cpp/testing/unittest/registar.h> @@ -508,11 +508,11 @@ size_t TTestData<wchar16>::HashOf_0123456() { return 2775195331ul; } -template <class TStringType, typename TTestData> +template <class TStringType, typename TTestData> class TStringTestImpl { protected: - using char_type = typename TStringType::char_type; - using traits_type = typename TStringType::traits_type; + using char_type = typename TStringType::char_type; + using traits_type = typename TStringType::traits_type; TTestData Data; @@ -525,13 +525,13 @@ public: } void TestConstructors() { - TStringType s0(nullptr); + TStringType s0(nullptr); UNIT_ASSERT(s0.size() == 0); - UNIT_ASSERT_EQUAL(s0, TStringType()); + UNIT_ASSERT_EQUAL(s0, TStringType()); - TStringType s; - TStringType s1(*Data._0()); - TStringType s2(Data._0()); + TStringType s; + TStringType s1(*Data._0()); + TStringType s2(Data._0()); UNIT_ASSERT(s1 == s2); TStringType fromZero(0); @@ -542,37 +542,37 @@ public: UNIT_ASSERT_VALUES_EQUAL(fromChar[0], char_type('a')); #ifndef TSTRING_IS_STD_STRING - TStringType s3 = TStringType::Uninitialized(10); + TStringType s3 = TStringType::Uninitialized(10); UNIT_ASSERT(s3.size() == 10); #endif - TStringType s4(Data._0123456(), 1, 3); + TStringType s4(Data._0123456(), 1, 3); UNIT_ASSERT(s4 == Data._123()); - TStringType s5(5, *Data._0()); + TStringType s5(5, *Data._0()); UNIT_ASSERT(s5 == Data._00000()); - TStringType s6(Data._0123456()); + TStringType s6(Data._0123456()); UNIT_ASSERT(s6 == Data._0123456()); - TStringType s7(s6); + TStringType s7(s6); UNIT_ASSERT(s7 == s6); #ifndef TSTRING_IS_STD_STRING UNIT_ASSERT(s7.c_str() == s6.c_str()); #endif - TStringType s8(s7, 1, 3); + TStringType s8(s7, 1, 3); UNIT_ASSERT(s8 == Data._123()); - TStringType s9(*Data._1()); + TStringType s9(*Data._1()); UNIT_ASSERT(s9 == Data._1()); - TStringType s10(Reserve(100)); + TStringType s10(Reserve(100)); UNIT_ASSERT(s10.empty()); UNIT_ASSERT(s10.capacity() >= 100); } void TestReplace() { - TStringType s(Data._0123456()); + TStringType s(Data._0123456()); UNIT_ASSERT(s.copy() == Data._0123456()); // append family @@ -586,10 +586,10 @@ public: #endif UNIT_ASSERT(s == Data._0123456xy()); - s.append(TStringType(Data.z())); + s.append(TStringType(Data.z())); UNIT_ASSERT(s == Data._0123456xyz()); - s.append(TStringType(Data.XYZ()), 2, 1); + s.append(TStringType(Data.XYZ()), 2, 1); UNIT_ASSERT(s == Data._0123456xyzZ()); s.append(*Data._0()); @@ -597,10 +597,10 @@ public: // prepend family s = Data._0123456xyz(); - s.prepend(TStringType(Data.abc())); + s.prepend(TStringType(Data.abc())); UNIT_ASSERT(s == Data.abc0123456xyz()); - s.prepend(TStringType(Data.ABC()), 1, 2); + s.prepend(TStringType(Data.ABC()), 1, 2); UNIT_ASSERT(s == Data.BCabc0123456xyz()); s.prepend(Data.qwe()); @@ -618,10 +618,10 @@ public: s.insert(2, Data.abc()); UNIT_ASSERT(s == Data._01abc23456()); - s.insert(2, TStringType(Data.ABC())); + s.insert(2, TStringType(Data.ABC())); UNIT_ASSERT(s == Data._01ABCabc23456()); - s.insert(0, TStringType(Data.QWE()), 1, 1); + s.insert(0, TStringType(Data.QWE()), 1, 1); UNIT_ASSERT(s == Data.W01ABCabc23456()); // replace family @@ -629,10 +629,10 @@ public: s.replace(0, 7, Data.abcd()); UNIT_ASSERT(s == Data.abcd456()); - s.replace(4, 3, TStringType(Data.ABCD())); + s.replace(4, 3, TStringType(Data.ABCD())); UNIT_ASSERT(s == Data.abcdABCD()); - s.replace(7, 10, TStringType(Data._01234()), 1, 3); + s.replace(7, 10, TStringType(Data._01234()), 1, 3); UNIT_ASSERT(s == Data.abcdABC123()); UNIT_ASSERT(Data.abcdABC123() == s); @@ -677,18 +677,18 @@ public: // Find family void TestFind() { - const TStringType s(Data._0123456_12345()); - const TStringType s2(Data._0123()); + const TStringType s(Data._0123456_12345()); + const TStringType s2(Data._0123()); UNIT_ASSERT(s.find(Data._345()) == 3); UNIT_ASSERT(s.find(Data._345(), 5) == 10); - UNIT_ASSERT(s.find(Data._345(), 20) == TStringType::npos); + UNIT_ASSERT(s.find(Data._345(), 20) == TStringType::npos); UNIT_ASSERT(s.find(*Data._3()) == 3); - UNIT_ASSERT(s.find(TStringType(Data._345())) == 3); - UNIT_ASSERT(s.find(TStringType(Data._345()), 2) == 3); + UNIT_ASSERT(s.find(TStringType(Data._345())) == 3); + UNIT_ASSERT(s.find(TStringType(Data._345()), 2) == 3); - UNIT_ASSERT(s.find_first_of(TStringType(Data._389())) == 3); + UNIT_ASSERT(s.find_first_of(TStringType(Data._389())) == 3); UNIT_ASSERT(s.find_first_of(Data._389()) == 3); UNIT_ASSERT(s.find_first_of(Data._389(), s.size()) == TStringType::npos); UNIT_ASSERT(s.find_first_not_of(Data._123()) == 0); @@ -697,34 +697,34 @@ public: UNIT_ASSERT(s.find_first_not_of('0') == 1); UNIT_ASSERT(s.find_first_not_of('1', 1) == 2); - const TStringType rs = Data._0123401234(); + const TStringType rs = Data._0123401234(); UNIT_ASSERT(rs.rfind(*Data._3()) == 8); - const TStringType empty; + const TStringType empty; UNIT_ASSERT(empty.find(empty) == 0); UNIT_ASSERT(s.find(empty, 0) == 0); UNIT_ASSERT(s.find(empty, 1) == 1); UNIT_ASSERT(s.find(empty, s.length()) == s.length()); - UNIT_ASSERT(s.find(empty, s.length() + 1) == TStringType::npos); + UNIT_ASSERT(s.find(empty, s.length() + 1) == TStringType::npos); UNIT_ASSERT(s.rfind(empty) == s.length()); UNIT_ASSERT(empty.rfind(empty) == 0); - UNIT_ASSERT(empty.rfind(s) == TStringType::npos); + UNIT_ASSERT(empty.rfind(s) == TStringType::npos); - UNIT_ASSERT(s2.rfind(s) == TStringType::npos); + UNIT_ASSERT(s2.rfind(s) == TStringType::npos); UNIT_ASSERT(s.rfind(s2) == 0); - UNIT_ASSERT(s.rfind(TStringType(Data._345())) == 10); - UNIT_ASSERT(s.rfind(TStringType(Data._345()), 13) == 10); - UNIT_ASSERT(s.rfind(TStringType(Data._345()), 10) == 10); - UNIT_ASSERT(s.rfind(TStringType(Data._345()), 9) == 3); - UNIT_ASSERT(s.rfind(TStringType(Data._345()), 6) == 3); - UNIT_ASSERT(s.rfind(TStringType(Data._345()), 3) == 3); - UNIT_ASSERT(s.rfind(TStringType(Data._345()), 2) == TStringType::npos); + UNIT_ASSERT(s.rfind(TStringType(Data._345())) == 10); + UNIT_ASSERT(s.rfind(TStringType(Data._345()), 13) == 10); + UNIT_ASSERT(s.rfind(TStringType(Data._345()), 10) == 10); + UNIT_ASSERT(s.rfind(TStringType(Data._345()), 9) == 3); + UNIT_ASSERT(s.rfind(TStringType(Data._345()), 6) == 3); + UNIT_ASSERT(s.rfind(TStringType(Data._345()), 3) == 3); + UNIT_ASSERT(s.rfind(TStringType(Data._345()), 2) == TStringType::npos); } void TestContains() { - const TStringType s(Data._0123456_12345()); - const TStringType s2(Data._0123()); + const TStringType s(Data._0123456_12345()); + const TStringType s2(Data._0123()); UNIT_ASSERT(s.Contains(Data._345())); UNIT_ASSERT(!s2.Contains(Data._345())); @@ -732,7 +732,7 @@ public: UNIT_ASSERT(s.Contains('1')); UNIT_ASSERT(!s.Contains('*')); - TStringType empty; + TStringType empty; UNIT_ASSERT(s.Contains(empty)); UNIT_ASSERT(!empty.Contains(s)); UNIT_ASSERT(empty.Contains(empty)); @@ -742,10 +742,10 @@ public: // Operators void TestOperators() { - TStringType s(Data._0123456()); + TStringType s(Data._0123456()); // operator += - s += TStringType(Data.x()); + s += TStringType(Data.x()); UNIT_ASSERT(s == Data._0123456x()); s += Data.y(); @@ -756,7 +756,7 @@ public: // operator + s = Data._0123456(); - s = s + TStringType(Data.x()); + s = s + TStringType(Data.x()); UNIT_ASSERT(s == Data._0123456x()); s = s + Data.y(); @@ -767,33 +767,33 @@ public: // operator != s = Data._012345(); - UNIT_ASSERT(s != TStringType(Data.xyz())); + UNIT_ASSERT(s != TStringType(Data.xyz())); UNIT_ASSERT(s != Data.xyz()); UNIT_ASSERT(Data.xyz() != s); // operator < - UNIT_ASSERT_EQUAL(s < TStringType(Data.xyz()), true); + UNIT_ASSERT_EQUAL(s < TStringType(Data.xyz()), true); UNIT_ASSERT_EQUAL(s < Data.xyz(), true); UNIT_ASSERT_EQUAL(Data.xyz() < s, false); // operator <= - UNIT_ASSERT_EQUAL(s <= TStringType(Data.xyz()), true); + UNIT_ASSERT_EQUAL(s <= TStringType(Data.xyz()), true); UNIT_ASSERT_EQUAL(s <= Data.xyz(), true); UNIT_ASSERT_EQUAL(Data.xyz() <= s, false); // operator > - UNIT_ASSERT_EQUAL(s > TStringType(Data.xyz()), false); + UNIT_ASSERT_EQUAL(s > TStringType(Data.xyz()), false); UNIT_ASSERT_EQUAL(s > Data.xyz(), false); UNIT_ASSERT_EQUAL(Data.xyz() > s, true); // operator >= - UNIT_ASSERT_EQUAL(s >= TStringType(Data.xyz()), false); + UNIT_ASSERT_EQUAL(s >= TStringType(Data.xyz()), false); UNIT_ASSERT_EQUAL(s >= Data.xyz(), false); UNIT_ASSERT_EQUAL(Data.xyz() >= s, true); } void TestOperatorsCI() { - TStringType s(Data.ABCD()); + TStringType s(Data.ABCD()); UNIT_ASSERT(s > Data.abc0123456xyz()); UNIT_ASSERT(s == Data.abcd()); @@ -806,20 +806,20 @@ public: void TestMulOperators() { { - TStringType s(Data._0()); + TStringType s(Data._0()); s *= 10; - UNIT_ASSERT_EQUAL(s, TStringType(Data._0000000000())); + UNIT_ASSERT_EQUAL(s, TStringType(Data._0000000000())); } { - TStringType s = TStringType(Data._0()) * 2; - UNIT_ASSERT_EQUAL(s, TStringType(Data._00())); + TStringType s = TStringType(Data._0()) * 2; + UNIT_ASSERT_EQUAL(s, TStringType(Data._00())); } } // Test any other functions void TestFuncs() { - TStringType s(Data._0123456()); + TStringType s(Data._0123456()); UNIT_ASSERT(s.c_str() == s.data()); // length() @@ -827,12 +827,12 @@ public: UNIT_ASSERT(s.length() == traits_type::length(s.data())); // is_null() - TStringType s1(Data.Empty()); + TStringType s1(Data.Empty()); UNIT_ASSERT(s1.is_null() == true); UNIT_ASSERT(s1.is_null() == s1.empty()); UNIT_ASSERT(s1.is_null() == !s1); - TStringType s2(s); + TStringType s2(s); UNIT_ASSERT(s2 == s); // reverse() @@ -859,7 +859,7 @@ public: // Friend functions s2 = Data.asdf1234qwer(); - TStringType s3 = to_upper(s2); + TStringType s3 = to_upper(s2); UNIT_ASSERT(s3 == Data.ASDF1234QWER()); s3 = to_lower(s2); UNIT_ASSERT(s3 == Data.asdf1234qwer()); @@ -892,7 +892,7 @@ public: UNIT_ASSERT(s2 == Data._0123456()); // hash() - TStringType sS = s2; // type 'TStringType' is used as is + TStringType sS = s2; // type 'TStringType' is used as is ComputeHash(sS); /*size_t hash_val = sS.hash(); @@ -908,42 +908,42 @@ public: //s2.reserve(); - TStringType s5(Data.abcde()); + TStringType s5(Data.abcde()); s5.clear(); UNIT_ASSERT(s5 == Data.Empty()); } void TestUtils() { - TStringType s; + TStringType s; s = Data._01230123(); - TStringType from = Data._0(); - TStringType to = Data.z(); + TStringType from = Data._0(); + TStringType to = Data.z(); SubstGlobal(s, from, to); UNIT_ASSERT(s == Data.z123z123()); } void TestEmpty() { - TStringType s; + TStringType s; s = Data._2(); - s = TStringType(Data.fdfdsfds(), (size_t)0, (size_t)0); + s = TStringType(Data.fdfdsfds(), (size_t)0, (size_t)0); UNIT_ASSERT(s.empty()); } void TestJoin() { - UNIT_ASSERT_EQUAL(TStringType::Join(Data._12(), Data._3456()), Data._123456()); - UNIT_ASSERT_EQUAL(TStringType::Join(Data._12(), TStringType(Data._3456())), Data._123456()); - UNIT_ASSERT_EQUAL(TStringType::Join(TStringType(Data._12()), Data._3456()), Data._123456()); - UNIT_ASSERT_EQUAL(TStringType::Join(Data._12(), Data._345(), Data._6()), Data._123456()); - UNIT_ASSERT_EQUAL(TStringType::Join(Data._12(), TStringType(Data._345()), Data._6()), Data._123456()); - UNIT_ASSERT_EQUAL(TStringType::Join(TStringType(Data._12()), TStringType(Data._345()), Data._6()), Data._123456()); - UNIT_ASSERT_EQUAL(TStringType::Join(TStringType(Data.a()), Data.b(), TStringType(Data.cd()), TStringType(Data.e()), Data.fg(), TStringType(Data.h())), Data.abcdefgh()); + UNIT_ASSERT_EQUAL(TStringType::Join(Data._12(), Data._3456()), Data._123456()); + UNIT_ASSERT_EQUAL(TStringType::Join(Data._12(), TStringType(Data._3456())), Data._123456()); + UNIT_ASSERT_EQUAL(TStringType::Join(TStringType(Data._12()), Data._3456()), Data._123456()); + UNIT_ASSERT_EQUAL(TStringType::Join(Data._12(), Data._345(), Data._6()), Data._123456()); + UNIT_ASSERT_EQUAL(TStringType::Join(Data._12(), TStringType(Data._345()), Data._6()), Data._123456()); + UNIT_ASSERT_EQUAL(TStringType::Join(TStringType(Data._12()), TStringType(Data._345()), Data._6()), Data._123456()); + UNIT_ASSERT_EQUAL(TStringType::Join(TStringType(Data.a()), Data.b(), TStringType(Data.cd()), TStringType(Data.e()), Data.fg(), TStringType(Data.h())), Data.abcdefgh()); UNIT_ASSERT_EQUAL(TStringType::Join(TStringType(Data.a()), static_cast<typename TStringType::char_type>('b'), TStringType(Data.cd()), TStringType(Data.e()), Data.fg(), TStringType(Data.h())), Data.abcdefgh()); } void TestCopy() { - TStringType s(Data.abcd()); - TStringType c = s.copy(); + TStringType s(Data.abcd()); + TStringType c = s.copy(); UNIT_ASSERT_EQUAL(s, c); UNIT_ASSERT(s.end() != c.end()); @@ -951,7 +951,7 @@ public: void TestStrCpy() { { - TStringType s(Data.abcd()); + TStringType s(Data.abcd()); char_type data[5]; data[4] = 1; @@ -966,7 +966,7 @@ public: } { - TStringType s(Data.abcd()); + TStringType s(Data.abcd()); char_type data[5]; s.strcpy(data, 5); @@ -980,7 +980,7 @@ public: } void TestPrefixSuffix() { - const TStringType emptyStr; + const TStringType emptyStr; UNIT_ASSERT_EQUAL(emptyStr.StartsWith('x'), false); UNIT_ASSERT_EQUAL(emptyStr.EndsWith('x'), false); UNIT_ASSERT_EQUAL(emptyStr.StartsWith(0), false); @@ -989,7 +989,7 @@ public: UNIT_ASSERT_EQUAL(emptyStr.EndsWith(emptyStr), true); const char_type chars[] = {'h', 'e', 'l', 'l', 'o', 0}; - const TStringType str(chars); + const TStringType str(chars); UNIT_ASSERT_EQUAL(str.StartsWith('h'), true); UNIT_ASSERT_EQUAL(str.StartsWith('o'), false); UNIT_ASSERT_EQUAL(str.EndsWith('o'), true); @@ -1004,8 +1004,8 @@ public: const char_type bbc[] = {'b', 'b', 'c', 0}; const char_type cbc[] = {'c', 'b', 'c', 0}; - TStringType s0 = abc; - TStringType s1 = s0; + TStringType s0 = abc; + TStringType s1 = s0; UNIT_ASSERT(!s0.IsDetached()); UNIT_ASSERT(!s1.IsDetached()); @@ -1017,7 +1017,7 @@ public: /* Writing should detach. */ s1[0] = (ui8)'b'; - TStringType s2 = s0; + TStringType s2 = s0; s0[0] = (ui8)'c'; UNIT_ASSERT_VALUES_EQUAL(s0, cbc); @@ -1050,8 +1050,8 @@ public: void TestBack() { const char_type chars[] = {'f', 'o', 'o', 0}; - TStringType str = chars; - const TStringType constStr = str; + TStringType str = chars; + const TStringType constStr = str; UNIT_ASSERT_VALUES_EQUAL(constStr.back(), (ui8)'o'); UNIT_ASSERT_VALUES_EQUAL(str.back(), (ui8)'o'); diff --git a/util/generic/string_ut.pyx b/util/generic/string_ut.pyx index 5407f5b4c12..2149748e33e 100644 --- a/util/generic/string_ut.pyx +++ b/util/generic/string_ut.pyx @@ -1,7 +1,7 @@ # cython: c_string_type=str, c_string_encoding=utf8 from libcpp.string cimport string as std_string -from util.generic.string cimport TString, npos +from util.generic.string cimport TString, npos import pytest import unittest @@ -16,39 +16,39 @@ class TestStroka(unittest.TestCase): def test_ctor1(self): - cdef TString tmp = TString() - cdef TString tmp2 = TString(tmp) + cdef TString tmp = TString() + cdef TString tmp2 = TString(tmp) self.assertEquals(tmp2, "") def test_ctor2(self): cdef std_string tmp = b"hello" - cdef TString tmp2 = TString(tmp) + cdef TString tmp2 = TString(tmp) self.assertEquals(tmp2, "hello") def test_ctor3(self): cdef TString tmp = b"hello" - cdef TString tmp2 = TString(tmp, 0, 4) + cdef TString tmp2 = TString(tmp, 0, 4) self.assertEquals(tmp2, "hell") def test_ctor4(self): - cdef TString tmp = TString(<char*>b"hello") + cdef TString tmp = TString(<char*>b"hello") self.assertEquals(tmp, "hello") def test_ctor5(self): - cdef TString tmp = TString(<char*>b"hello", 4) + cdef TString tmp = TString(<char*>b"hello", 4) self.assertEquals(tmp, "hell") def test_ctor6(self): - cdef TString tmp = TString(<char*>b"hello", 1, 3) + cdef TString tmp = TString(<char*>b"hello", 1, 3) self.assertEquals(tmp, "ell") def test_ctor7(self): - cdef TString tmp = TString(3, <char>'x') + cdef TString tmp = TString(3, <char>'x') self.assertEquals(tmp, "xxx") def test_ctor8(self): cdef bytes tmp = b"hello" - cdef TString tmp2 = TString(<char*>tmp, <char*>tmp + 4) + cdef TString tmp2 = TString(<char*>tmp, <char*>tmp + 4) self.assertEquals(tmp2, "hell") def test_compare(self): @@ -71,7 +71,7 @@ class TestStroka(unittest.TestCase): def test_operator_assign(self): cdef TString tmp = b"hello" - cdef TString tmp2 = tmp + cdef TString tmp2 = tmp self.assertEquals(tmp2, "hello") def test_operator_plus(self): @@ -98,12 +98,12 @@ class TestStroka(unittest.TestCase): self.assertEquals(<bytes>tmp[4], b'o') self.assertEquals(<bytes>tmp.at(4), b'o') - # Actually, TString::at() is noexcept + # Actually, TString::at() is noexcept # with pytest.raises(IndexError): # tmp.at(100) def test_append(self): - cdef TString tmp + cdef TString tmp cdef TString tmp2 = b"fuu" tmp.append(tmp2) @@ -125,7 +125,7 @@ class TestStroka(unittest.TestCase): self.assertEquals(tmp, "fuuuull of gooz") def test_assign(self): - cdef TString tmp + cdef TString tmp tmp.assign(b"one") self.assertEquals(tmp, "one") @@ -140,7 +140,7 @@ class TestStroka(unittest.TestCase): self.assertEquals(tmp, "three") def test_insert(self): - cdef TString tmp + cdef TString tmp tmp = b"xx" tmp.insert(1, b"foo") diff --git a/util/generic/typelist_ut.cpp b/util/generic/typelist_ut.cpp index eeabfa97b17..18fad0efbfd 100644 --- a/util/generic/typelist_ut.cpp +++ b/util/generic/typelist_ut.cpp @@ -16,24 +16,24 @@ class TTypeListTest: public TTestBase { public: void TestGet() { - using TListType = TTypeList<int, char, float>; + using TListType = TTypeList<int, char, float>; - UNIT_ASSERT_TYPES_EQUAL(TListType::TGet<0>, int); - UNIT_ASSERT_TYPES_EQUAL(TListType::TGet<1>, char); - UNIT_ASSERT_TYPES_EQUAL(TListType::TGet<2>, float); + UNIT_ASSERT_TYPES_EQUAL(TListType::TGet<0>, int); + UNIT_ASSERT_TYPES_EQUAL(TListType::TGet<1>, char); + UNIT_ASSERT_TYPES_EQUAL(TListType::TGet<2>, float); } void TestSimple() { - using TListType = TTypeList<int, char, float>; - UNIT_ASSERT_EQUAL(TListType::Length, 3); - UNIT_ASSERT_TYPES_EQUAL(TListType::THead, int); + using TListType = TTypeList<int, char, float>; + UNIT_ASSERT_EQUAL(TListType::Length, 3); + UNIT_ASSERT_TYPES_EQUAL(TListType::THead, int); } struct TA {}; struct TB {}; struct TC {}; void TestHave() { - using TListType = TTypeList<TA, TB*, const TC&>; + using TListType = TTypeList<TA, TB*, const TC&>; UNIT_ASSERT(TListType::THave<TA>::value); UNIT_ASSERT(TListType::THave<TB*>::value); UNIT_ASSERT(!TListType::THave<TB>::value); @@ -66,7 +66,7 @@ public: struct TMyMap {}; void TestSelectBy() { - using TListType = TTypeList<TA, TB, TMyMap<TA*, TB>, TMyVector<TA>, TC>; + using TListType = TTypeList<TA, TB, TMyMap<TA*, TB>, TMyVector<TA>, TC>; UNIT_ASSERT_TYPES_EQUAL(TListType::TSelectBy<TAnyType>::type, TA); UNIT_ASSERT_TYPES_EQUAL(TListType::TSelectBy<TIs1ArgTemplate>::type, TMyVector<TA>); diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h index d165bd1a068..fc46648080f 100644 --- a/util/generic/typetraits.h +++ b/util/generic/typetraits.h @@ -90,11 +90,11 @@ public: TPodTraits<std::remove_cv_t<std::remove_all_extents_t<T>>>::IsPod); }; -namespace NPrivate { - template <class T> +namespace NPrivate { + template <class T> struct TIsSmall: std::integral_constant<bool, (sizeof(T) <= sizeof(void*))> {}; -} - +} + template <class T> class TTypeTraits: public TTypeTraitsBase<T> { using TBase = TTypeTraitsBase<T>; @@ -102,10 +102,10 @@ class TTypeTraits: public TTypeTraitsBase<T> { /* * can be effectively passed to function as value */ - static constexpr bool IsValueType = std::is_scalar<T>::value || - std::is_array<T>::value || - std::is_reference<T>::value || - (TBase::IsPod && + static constexpr bool IsValueType = std::is_scalar<T>::value || + std::is_array<T>::value || + std::is_reference<T>::value || + (TBase::IsPod && std::conditional_t< std::is_function<T>::value, std::false_type, @@ -222,8 +222,8 @@ class TTypeTraits<void>: public TTypeTraitsBase<void> {}; * std::false_type, * >; * - * static_assert(TIsAssocCont<TVector<int>>::value == false, ""); - * static_assert(TIsAssocCont<THashMap<int>>::value == true, ""); + * static_assert(TIsAssocCont<TVector<int>>::value == false, ""); + * static_assert(TIsAssocCont<THashMap<int>>::value == true, ""); * @endcode */ #define Y_HAS_SUBTYPE(...) Y_PASS_VA_ARGS(Y_MACRO_IMPL_DISPATCHER_2(__VA_ARGS__, Y_HAS_SUBTYPE_IMPL_2, Y_HAS_SUBTYPE_IMPL_1)(__VA_ARGS__)) diff --git a/util/generic/typetraits_ut.cpp b/util/generic/typetraits_ut.cpp index e7571c75ece..8a9a2de1ce5 100644 --- a/util/generic/typetraits_ut.cpp +++ b/util/generic/typetraits_ut.cpp @@ -97,23 +97,23 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) { } Y_UNIT_TEST(TestRemoveConst) { - ASSERT_SAME_TYPE(std::remove_const_t<const int>, int); + ASSERT_SAME_TYPE(std::remove_const_t<const int>, int); } Y_UNIT_TEST(TestRemoveVolatile) { - ASSERT_SAME_TYPE(std::remove_volatile_t<volatile int>, int); + ASSERT_SAME_TYPE(std::remove_volatile_t<volatile int>, int); } Y_UNIT_TEST(TestRemoveCV) { - ASSERT_SAME_TYPE(std::remove_cv_t<const volatile int>, int); + ASSERT_SAME_TYPE(std::remove_cv_t<const volatile int>, int); } Y_UNIT_TEST(TestAddCV) { - ASSERT_SAME_TYPE(std::add_cv_t<int>, const volatile int); + ASSERT_SAME_TYPE(std::add_cv_t<int>, const volatile int); } Y_UNIT_TEST(TestClass) { - UNIT_ASSERT(std::is_class<TString>::value); + UNIT_ASSERT(std::is_class<TString>::value); UNIT_ASSERT(!std::is_class<ETestEnum>::value); UNIT_ASSERT(!std::is_class<int>::value); UNIT_ASSERT(!std::is_class<void*>::value); @@ -197,12 +197,12 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) { } Y_UNIT_TEST(TestAddRValueReference) { - ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int>, int&&); - ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int const&>, int const&); - ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int*>, int*&&); - ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int*&>, int*&); - ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int&&>, int&&); - ASSERT_SAME_TYPE(std::add_rvalue_reference_t<void>, void); + ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int>, int&&); + ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int const&>, int const&); + ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int*>, int*&&); + ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int*&>, int*&); + ASSERT_SAME_TYPE(std::add_rvalue_reference_t<int&&>, int&&); + ASSERT_SAME_TYPE(std::add_rvalue_reference_t<void>, void); } Y_UNIT_TEST(TestIsEmpty) { @@ -228,7 +228,7 @@ Y_UNIT_TEST_SUITE(TTypeTraitsTest) { } template <class T> - using TTrySum = decltype(std::declval<T>() + std::declval<T>()); + using TTrySum = decltype(std::declval<T>() + std::declval<T>()); Y_UNIT_TEST(TestIsTriviallyCopyable) { struct TPod { diff --git a/util/generic/ut/ya.make b/util/generic/ut/ya.make index 6eaf24cc5fe..fed74217f0b 100644 --- a/util/generic/ut/ya.make +++ b/util/generic/ut/ya.make @@ -8,7 +8,7 @@ FORK_TESTS() SRCS( generic/adaptor_ut.cpp generic/algorithm_ut.cpp - generic/array_ref_ut.cpp + generic/array_ref_ut.cpp generic/array_size_ut.cpp generic/bitmap_ut.cpp generic/bitops_ut.cpp @@ -42,7 +42,7 @@ SRCS( generic/stack_ut.cpp generic/store_policy_ut.cpp generic/strbuf_ut.cpp - generic/string_ut.cpp + generic/string_ut.cpp generic/typelist_ut.cpp generic/typetraits_ut.cpp generic/utility_ut.cpp diff --git a/util/generic/utility.cpp b/util/generic/utility.cpp index e1ed101c76f..a4173d06ee0 100644 --- a/util/generic/utility.cpp +++ b/util/generic/utility.cpp @@ -1,21 +1,21 @@ #include "utility.h" - -#ifdef _MSC_VER + +#ifdef _MSC_VER #include <Windows.h> -#endif - -void SecureZero(void* pointer, size_t count) noexcept { -#ifdef _MSC_VER - SecureZeroMemory(pointer, count); -#elif defined(memset_s) - memset_s(pointer, count, 0, count); -#else +#endif + +void SecureZero(void* pointer, size_t count) noexcept { +#ifdef _MSC_VER + SecureZeroMemory(pointer, count); +#elif defined(memset_s) + memset_s(pointer, count, 0, count); +#else volatile char* vPointer = (volatile char*)pointer; - - while (count) { - *vPointer = 0; - vPointer++; - count--; - } -#endif -} + + while (count) { + *vPointer = 0; + vPointer++; + count--; + } +#endif +} diff --git a/util/generic/utility.h b/util/generic/utility.h index 43b98eeafc7..876d67a89f4 100644 --- a/util/generic/utility.h +++ b/util/generic/utility.h @@ -43,28 +43,28 @@ static T Mean(const Args&... other) noexcept { } template <class T> -static inline void Zero(T& t) noexcept { +static inline void Zero(T& t) noexcept { memset((void*)&t, 0, sizeof(t)); } -/** - * Securely zero memory (compiler does not optimize this out) - * - * @param pointer void pointer to start of memory block to be zeroed - * @param count size of memory block to be zeroed (in bytes) - */ -void SecureZero(void* pointer, size_t count) noexcept; - -/** - * Securely zero memory of given object (compiler does not optimize this out) - * - * @param t reference to object, which must be zeroed - */ -template <class T> -static inline void SecureZero(T& t) noexcept { - SecureZero((void*)&t, sizeof(t)); -} - +/** + * Securely zero memory (compiler does not optimize this out) + * + * @param pointer void pointer to start of memory block to be zeroed + * @param count size of memory block to be zeroed (in bytes) + */ +void SecureZero(void* pointer, size_t count) noexcept; + +/** + * Securely zero memory of given object (compiler does not optimize this out) + * + * @param t reference to object, which must be zeroed + */ +template <class T> +static inline void SecureZero(T& t) noexcept { + SecureZero((void*)&t, sizeof(t)); +} + namespace NSwapCheck { Y_HAS_MEMBER(swap); Y_HAS_MEMBER(Swap); @@ -111,18 +111,18 @@ struct TNullTmpl { }; using TNull = TNullTmpl<0>; - -/* - * Class for zero-initialize padding bytes in derived classes - */ -template <typename TDerived> -class TZeroInit { -protected: - TZeroInit() { - // Actually, safe because this as TDerived is not initialized yet. - Zero(*static_cast<TDerived*>(this)); - } -}; + +/* + * Class for zero-initialize padding bytes in derived classes + */ +template <typename TDerived> +class TZeroInit { +protected: + TZeroInit() { + // Actually, safe because this as TDerived is not initialized yet. + Zero(*static_cast<TDerived*>(this)); + } +}; struct TIdentity { template <class T> diff --git a/util/generic/utility_ut.cpp b/util/generic/utility_ut.cpp index 8e9d5afff9b..fab7984aea3 100644 --- a/util/generic/utility_ut.cpp +++ b/util/generic/utility_ut.cpp @@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(TUtilityTest) { UNIT_ASSERT_EQUAL(Mean(1, 2), 1.5); UNIT_ASSERT(Abs(Mean(1., 2., 7.5) - 3.5) < std::numeric_limits<double>::epsilon()); } - + Y_UNIT_TEST(TestZeroInitWithDefaultZeros) { struct TStructWithPaddingBytes: public TZeroInit<TStructWithPaddingBytes> { TStructWithPaddingBytes() @@ -84,17 +84,17 @@ Y_UNIT_TEST_SUITE(TUtilityTest) { // here between Field1_ and Field2_ will be padding bytes i64 Field2_ = 0; }; - + TStructWithPaddingBytes foo{}; - + // all bytes must be zeroes, and MSAN will not complain about reading from padding bytes const char* const fooPtr = (char*)&foo; for (size_t i = 0; i < sizeof(TStructWithPaddingBytes); ++i) { const char byte = fooPtr[i]; UNIT_ASSERT_EQUAL(byte, 0); } - } - + } + Y_UNIT_TEST(TestZeroInitWithDefaultNonZeros) { struct TStructWithPaddingBytes: public TZeroInit<TStructWithPaddingBytes> { TStructWithPaddingBytes() @@ -104,20 +104,20 @@ Y_UNIT_TEST_SUITE(TUtilityTest) { // here between Field1_ and Field2_ will be padding bytes i64 Field2_ = 100500; }; - + TStructWithPaddingBytes foo{}; - + // check that default values are set correctly UNIT_ASSERT_EQUAL(foo.Field1_, true); UNIT_ASSERT_EQUAL(foo.Field2_, 100500); - + const char* const fooPtr = (char*)&foo; // just reading all bytes, and MSAN must not complain about reading padding bytes for (size_t i = 0; i < sizeof(TStructWithPaddingBytes); ++i) { const char byte = fooPtr[i]; UNIT_ASSERT_EQUAL(byte, byte); } - } + } Y_UNIT_TEST(TestClampValNoClamp) { double val = 2; @@ -145,36 +145,36 @@ Y_UNIT_TEST_SUITE(TUtilityTest) { UNIT_ASSERT_EQUAL(clamped, hi); UNIT_ASSERT_EQUAL(&clamped, &hi); } - + Y_UNIT_TEST(TestSecureZero) { constexpr size_t checkSize = 128; char test[checkSize]; - + // fill with garbage for (size_t i = 0; i < checkSize; ++i) { test[i] = i; } - + SecureZero(test, checkSize); - + for (size_t i = 0; i < checkSize; ++i) { UNIT_ASSERT_EQUAL(test[i], 0); } - } - + } + Y_UNIT_TEST(TestSecureZeroTemplate) { constexpr size_t checkSize = 128; char test[checkSize]; - + // fill with garbage for (size_t i = 0; i < checkSize; ++i) { test[i] = i; } - + SecureZero(test); - + for (size_t i = 0; i < checkSize; ++i) { UNIT_ASSERT_EQUAL(test[i], 0); } - } + } }; diff --git a/util/generic/vector.h b/util/generic/vector.h index a5b258955a8..c24bc5b8c55 100644 --- a/util/generic/vector.h +++ b/util/generic/vector.h @@ -9,35 +9,35 @@ #include <initializer_list> template <class T, class A> -class TVector: public std::vector<T, TReboundAllocator<A, T>> { +class TVector: public std::vector<T, TReboundAllocator<A, T>> { public: using TBase = std::vector<T, TReboundAllocator<A, T>>; - using TSelf = TVector<T, A>; + using TSelf = TVector<T, A>; using size_type = typename TBase::size_type; - inline TVector() + inline TVector() : TBase() { } - inline TVector(const typename TBase::allocator_type& a) + inline TVector(const typename TBase::allocator_type& a) : TBase(a) { } - inline explicit TVector(::NDetail::TReserveTag rt) + inline explicit TVector(::NDetail::TReserveTag rt) : TBase() { this->reserve(rt.Capacity); } - inline explicit TVector(::NDetail::TReserveTag rt, const typename TBase::allocator_type& a) + inline explicit TVector(::NDetail::TReserveTag rt, const typename TBase::allocator_type& a) : TBase(a) { this->reserve(rt.Capacity); } - inline explicit TVector(size_type count) + inline explicit TVector(size_type count) : TBase(count) { } @@ -47,38 +47,38 @@ public: { } - inline TVector(size_type count, const T& val) + inline TVector(size_type count, const T& val) : TBase(count, val) { } - inline TVector(size_type count, const T& val, const typename TBase::allocator_type& a) + inline TVector(size_type count, const T& val, const typename TBase::allocator_type& a) : TBase(count, val, a) { } - inline TVector(std::initializer_list<T> il) + inline TVector(std::initializer_list<T> il) : TBase(il) { } - inline TVector(std::initializer_list<T> il, const typename TBase::allocator_type& a) + inline TVector(std::initializer_list<T> il, const typename TBase::allocator_type& a) : TBase(il, a) { } - inline TVector(const TSelf& src) + inline TVector(const TSelf& src) : TBase(src) { } - inline TVector(TSelf&& src) noexcept + inline TVector(TSelf&& src) noexcept : TBase(std::forward<TSelf>(src)) { } template <class TIter> - inline TVector(TIter first, TIter last) + inline TVector(TIter first, TIter last) : TBase(first, last) { } diff --git a/util/generic/vector.pxd b/util/generic/vector.pxd index 99dde95d48f..459da7eb409 100644 --- a/util/generic/vector.pxd +++ b/util/generic/vector.pxd @@ -1,5 +1,5 @@ cdef extern from "<util/generic/vector.h>" nogil: - cdef cppclass TVector[T]: + cdef cppclass TVector[T]: cppclass iterator: T& operator*() iterator operator++() @@ -32,17 +32,17 @@ cdef extern from "<util/generic/vector.h>" nogil: cppclass const_reverse_iterator(reverse_iterator): pass - TVector() except + - TVector(TVector&) except + - TVector(size_t) except + - TVector(size_t, T&) except + + TVector() except + + TVector(TVector&) except + + TVector(size_t) except + + TVector(size_t, T&) except + - bint operator==(TVector&) - bint operator!=(TVector&) - bint operator<(TVector&) - bint operator>(TVector&) - bint operator<=(TVector&) - bint operator>=(TVector&) + bint operator==(TVector&) + bint operator!=(TVector&) + bint operator<(TVector&) + bint operator>(TVector&) + bint operator<=(TVector&) + bint operator>=(TVector&) void assign(size_t, const T&) except + void assign[input_iterator](input_iterator, input_iterator) except + @@ -76,7 +76,7 @@ cdef extern from "<util/generic/vector.h>" nogil: void resize(size_t) except + void resize(size_t, T&) except + size_t size() - void swap(TVector&) except + + void swap(TVector&) except + # C++11 methods T* data() diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp index 0f6b4037a00..59ed6f3b952 100644 --- a/util/generic/vector_ut.cpp +++ b/util/generic/vector_ut.cpp @@ -34,7 +34,7 @@ class TYVectorTest: public TTestBase { private: void TestConstructorsAndAssignments() { - using container = TVector<int>; + using container = TVector<int>; container c1; c1.push_back(100); @@ -69,12 +69,12 @@ private: } inline void TestTildeEmptyToNull() { - TVector<int> v; + TVector<int> v; UNIT_ASSERT_EQUAL(nullptr, v.data()); } inline void TestTilde() { - TVector<int> v; + TVector<int> v; v.push_back(10); v.push_back(20); @@ -94,7 +94,7 @@ private: // Copy-paste of STLPort tests void Test1() { - TVector<int> v1; // Empty vector of integers. + TVector<int> v1; // Empty vector of integers. UNIT_ASSERT(v1.empty() == true); UNIT_ASSERT(v1.size() == 0); @@ -110,8 +110,8 @@ private: UNIT_ASSERT(v1[0] == 42); { - TVector<TVector<int>> vect(10); - TVector<TVector<int>>::iterator it(vect.begin()), end(vect.end()); + TVector<TVector<int>> vect(10); + TVector<TVector<int>>::iterator it(vect.begin()), end(vect.end()); for (; it != end; ++it) { UNIT_ASSERT((*it).empty()); UNIT_ASSERT((*it).size() == 0); @@ -122,10 +122,10 @@ private: } void Test2() { - TVector<double> v1; // Empty vector of doubles. + TVector<double> v1; // Empty vector of doubles. v1.push_back(32.1); v1.push_back(40.5); - TVector<double> v2; // Another empty vector of doubles. + TVector<double> v2; // Another empty vector of doubles. v2.push_back(3.56); UNIT_ASSERT(v1.size() == 2); @@ -150,7 +150,7 @@ private: } void Test3() { - using vec_type = TVector<char>; + using vec_type = TVector<char>; vec_type v1; // Empty vector of characters. v1.push_back('h'); @@ -173,7 +173,7 @@ private: } void Test4() { - TVector<int> v(4); + TVector<int> v(4); v[0] = 1; v[1] = 4; @@ -197,7 +197,7 @@ private: void Test5() { int array[] = {1, 4, 9, 16}; - TVector<int> v(array, array + 4); + TVector<int> v(array, array + 4); UNIT_ASSERT(v.size() == 4); @@ -210,8 +210,8 @@ private: void Test6() { int array[] = {1, 4, 9, 16, 25, 36}; - TVector<int> v(array, array + 6); - TVector<int>::iterator vit; + TVector<int> v(array, array + 6); + TVector<int>::iterator vit; UNIT_ASSERT(v.size() == 6); UNIT_ASSERT(v[0] == 1); @@ -251,8 +251,8 @@ private: int array1[] = {1, 4, 25}; int array2[] = {9, 16}; - TVector<int> v(array1, array1 + 3); - TVector<int>::iterator vit; + TVector<int> v(array1, array1 + 3); + TVector<int>::iterator vit; vit = v.insert(v.begin(), 0); // Insert before first element. UNIT_ASSERT(*vit == 0); @@ -301,7 +301,7 @@ private: void TestCapacity() { { - TVector<int> v; + TVector<int> v; UNIT_ASSERT(v.capacity() == 0); v.push_back(42); @@ -311,7 +311,7 @@ private: } { - TVector<int> v(Reserve(100)); + TVector<int> v(Reserve(100)); UNIT_ASSERT(v.capacity() >= 100); UNIT_ASSERT(v.size() == 0); @@ -319,15 +319,15 @@ private: { //Test that used to generate an assertion when using __debug_alloc. - TVector<TestStruct> va; + TVector<TestStruct> va; va.reserve(1); va.reserve(2); } } void TestAt() { - TVector<int> v; - TVector<int> const& cv = v; + TVector<int> v; + TVector<int> const& cv = v; v.push_back(10); UNIT_ASSERT(v.at(0) == 10); @@ -347,27 +347,27 @@ private: } void TestPointer() { - TVector<int*> v1; - TVector<int*> v2 = v1; - TVector<int*> v3; + TVector<int*> v1; + TVector<int*> v2 = v1; + TVector<int*> v3; v3.insert(v3.end(), v1.begin(), v1.end()); } void TestAutoRef() { - TVector<int> ref; + TVector<int> ref; for (int i = 0; i < 5; ++i) { ref.push_back(i); } - TVector<TVector<int>> v_v_int(1, ref); + TVector<TVector<int>> v_v_int(1, ref); v_v_int.push_back(v_v_int[0]); v_v_int.push_back(ref); v_v_int.push_back(v_v_int[0]); v_v_int.push_back(v_v_int[0]); v_v_int.push_back(ref); - TVector<TVector<int>>::iterator vvit(v_v_int.begin()), vvitEnd(v_v_int.end()); + TVector<TVector<int>>::iterator vvit(v_v_int.begin()), vvitEnd(v_v_int.end()); for (; vvit != vvitEnd; ++vvit) { UNIT_ASSERT(*vvit == ref); } @@ -391,8 +391,8 @@ private: }; void TestIterators() { - TVector<int> vint(10, 0); - TVector<int> const& crvint = vint; + TVector<int> vint(10, 0); + TVector<int> const& crvint = vint; UNIT_ASSERT(vint.begin() == vint.begin()); UNIT_ASSERT(crvint.begin() == vint.begin()); @@ -418,7 +418,7 @@ private: } void TestShrink() { - TVector<int> v; + TVector<int> v; v.resize(1000); v.resize(10); v.shrink_to_fit(); @@ -436,7 +436,7 @@ private: // representation making executable crash on vector destructor invocation. // We prefer a simple memory leak, internal corruption should be reveal // by size or capacity checks. - using V = TVector<int>; + using V = TVector<int>; V* pv1 = new V(1, 1); V* pv2 = new V(10, 2); @@ -459,7 +459,7 @@ private: void TestFillInConstructor() { for (int k = 0; k < 3; ++k) { - TVector<int> v(100); + TVector<int> v(100); UNIT_ASSERT_VALUES_EQUAL(100u, v.size()); for (size_t i = 0; i < v.size(); ++i) { UNIT_ASSERT_VALUES_EQUAL(0, v[i]); @@ -517,7 +517,7 @@ private: constexpr bool ALLOW_UNINITIALIZED = false; #endif - TVector<T, TDebugAlloc<T>> v; + TVector<T, TDebugAlloc<T>> v; v.reserve(5); auto firstBegin = v.begin(); @@ -564,7 +564,7 @@ private: TestYResize<TNonPod>(); } - void CheckInitializeList(const TVector<int>& v) { + void CheckInitializeList(const TVector<int>& v) { for (size_t i = 0; i < v.size(); ++i) { UNIT_ASSERT_EQUAL(v[i], static_cast<int>(i)); } @@ -572,21 +572,21 @@ private: void TestInitializeList() { { - TVector<int> v; + TVector<int> v; v.assign({0, 1, 2}); CheckInitializeList(v); } { - TVector<int> v = {0, 1, 2}; + TVector<int> v = {0, 1, 2}; CheckInitializeList(v); } { - TVector<int> v; + TVector<int> v; v = {0, 1, 2}; CheckInitializeList(v); } { - TVector<int> v = {0, 3}; + TVector<int> v = {0, 3}; v.insert(v.begin() + 1, {1, 2}); CheckInitializeList(v); } diff --git a/util/generic/vector_ut.pyx b/util/generic/vector_ut.pyx index 904e67733b3..631b73fa63a 100644 --- a/util/generic/vector_ut.pyx +++ b/util/generic/vector_ut.pyx @@ -1,44 +1,44 @@ # cython: c_string_type=str, c_string_encoding=utf8 -from util.generic.vector cimport TVector +from util.generic.vector cimport TVector from util.generic.string cimport TString import pytest import unittest -def _check_convert(TVector[TString] x): +def _check_convert(TVector[TString] x): return x class TestVector(unittest.TestCase): def test_ctor1(self): - cdef TVector[int] tmp = TVector[int]() + cdef TVector[int] tmp = TVector[int]() self.assertEqual(tmp.size(), 0) def test_ctor2(self): - cdef TVector[int] tmp = TVector[int](10) + cdef TVector[int] tmp = TVector[int](10) self.assertEqual(tmp.size(), 10) self.assertEqual(tmp[0], 0) def test_ctor3(self): - cdef TVector[int] tmp = TVector[int](10, 42) + cdef TVector[int] tmp = TVector[int](10, 42) self.assertEqual(tmp.size(), 10) self.assertEqual(tmp[0], 42) def test_ctor4(self): - cdef TVector[int] tmp = TVector[int](10, 42) - cdef TVector[int] tmp2 = TVector[int](tmp) + cdef TVector[int] tmp = TVector[int](10, 42) + cdef TVector[int] tmp2 = TVector[int](tmp) self.assertEqual(tmp2.size(), 10) self.assertEqual(tmp2[0], 42) def test_operator_assign(self): - cdef TVector[int] tmp2 + cdef TVector[int] tmp2 tmp2.push_back(1) tmp2.push_back(2) - cdef TVector[int] tmp3 + cdef TVector[int] tmp3 tmp3.push_back(1) tmp3.push_back(3) @@ -51,15 +51,15 @@ class TestVector(unittest.TestCase): self.assertEqual(tmp3[1], 2) def test_compare(self): - cdef TVector[int] tmp1 + cdef TVector[int] tmp1 tmp1.push_back(1) tmp1.push_back(2) - cdef TVector[int] tmp2 + cdef TVector[int] tmp2 tmp2.push_back(1) tmp2.push_back(2) - cdef TVector[int] tmp3 + cdef TVector[int] tmp3 tmp3.push_back(1) tmp3.push_back(3) @@ -73,7 +73,7 @@ class TestVector(unittest.TestCase): self.assertTrue(tmp3 >= tmp1) def test_index(self): - cdef TVector[int] tmp = TVector[int](10, 42) + cdef TVector[int] tmp = TVector[int](10, 42) self.assertEqual(tmp[0], 42) self.assertEqual(tmp[5], 42) @@ -88,7 +88,7 @@ class TestVector(unittest.TestCase): tmp.at(100) def test_push_pop_back(self): - cdef TVector[int] tmp + cdef TVector[int] tmp self.assertEqual(tmp.size(), 0) tmp.push_back(42) @@ -107,22 +107,22 @@ class TestVector(unittest.TestCase): self.assertEqual(tmp.size(), 0) def test_front(self): - cdef TVector[int] tmp + cdef TVector[int] tmp tmp.push_back(42) self.assertEqual(tmp.front(), 42) def test_empty(self): - cdef TVector[int] tmp + cdef TVector[int] tmp self.assertTrue(tmp.empty()) tmp.push_back(42) self.assertFalse(tmp.empty()) def test_max_size(self): - cdef TVector[int] tmp + cdef TVector[int] tmp self.assertTrue(tmp.max_size() > 0) def test_reserve_resize(self): - cdef TVector[int] tmp + cdef TVector[int] tmp tmp.reserve(1000) self.assertEqual(tmp.capacity(), 1000) @@ -140,7 +140,7 @@ class TestVector(unittest.TestCase): self.assertEqual(tmp.back(), 42) def test_iter(self): - cdef TVector[int] tmp + cdef TVector[int] tmp tmp.push_back(1) tmp.push_back(20) tmp.push_back(300) @@ -148,7 +148,7 @@ class TestVector(unittest.TestCase): self.assertEqual([i for i in tmp], [1, 20, 300]) def test_iterator(self): - cdef TVector[int] tmp + cdef TVector[int] tmp self.assertTrue(tmp.begin() == tmp.end()) self.assertTrue(tmp.rbegin() == tmp.rend()) @@ -173,7 +173,7 @@ class TestVector(unittest.TestCase): self.assertTrue(tmp.const_rbegin() + 1 == tmp.const_rend()) def test_assign(self): - cdef TVector[int] tmp + cdef TVector[int] tmp tmp.assign(10, 42) self.assertEqual(tmp.size(), 10) @@ -181,12 +181,12 @@ class TestVector(unittest.TestCase): self.assertEqual(tmp.back(), 42) def test_insert(self): - cdef TVector[int] tmp + cdef TVector[int] tmp tmp.push_back(1) tmp.push_back(2) tmp.push_back(3) - cdef TVector[int] tmp2 + cdef TVector[int] tmp2 tmp2.push_back(7) tmp2.push_back(9) @@ -200,7 +200,7 @@ class TestVector(unittest.TestCase): self.assertEqual([i for i in tmp], [7, 9, 6, 6, 8, 1, 2, 3]) def test_erase(self): - cdef TVector[int] tmp + cdef TVector[int] tmp tmp.push_back(1) tmp.push_back(2) tmp.push_back(3) diff --git a/util/generic/xrange.h b/util/generic/xrange.h index 5fc8c829121..89c773002eb 100644 --- a/util/generic/xrange.h +++ b/util/generic/xrange.h @@ -14,7 +14,7 @@ * DoSomething(i, MyVector[i]); * } * - * TVector<int> arithmeticSeq = xrange(10); // instead: TVector<int> arithmeticSeq; for(size_t i = 0; i < 10; ++i) { arithmeticSeq.push_back(i); } + * TVector<int> arithmeticSeq = xrange(10); // instead: TVector<int> arithmeticSeq; for(size_t i = 0; i < 10; ++i) { arithmeticSeq.push_back(i); } * */ diff --git a/util/generic/xrange_ut.cpp b/util/generic/xrange_ut.cpp index 8106da03e7f..66c8b1d83ab 100644 --- a/util/generic/xrange_ut.cpp +++ b/util/generic/xrange_ut.cpp @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(XRange) { UNIT_ASSERT_VALUES_EQUAL(sum, count * (first + last) / 2); } - void TestSteppedXRangeImpl(int begin, int end, int step, const TVector<int>& expected) { + void TestSteppedXRangeImpl(int begin, int end, int step, const TVector<int>& expected) { size_t expInd = 0; for (auto i : xrange(begin, end, step)) { UNIT_ASSERT(expInd < expected.size()); @@ -65,7 +65,7 @@ Y_UNIT_TEST_SUITE(XRange) { } Y_UNIT_TEST(PointersWorks) { - TVector<size_t> data = {3, 1, 4, 1, 5, 9, 2, 6}; + TVector<size_t> data = {3, 1, 4, 1, 5, 9, 2, 6}; const size_t digSumExpected = Accumulate(data.begin(), data.end(), static_cast<size_t>(0)); size_t digSumByIt = 0; for (auto ptr : xrange(data.begin(), data.end())) { @@ -85,19 +85,19 @@ Y_UNIT_TEST_SUITE(XRange) { UNIT_ASSERT_VALUES_EQUAL(xrange(0, 6, 2).size(), 3); } - class TVectorChild: public TVector<size_t> { + class TVectorChild: public TVector<size_t> { public: template <typename TIterator> TVectorChild(TIterator a, TIterator b) - : TVector<size_t>(a, b) + : TVector<size_t>(a, b) { } }; Y_UNIT_TEST(ConvertionWorks) { - TVector<size_t> data = {0, 1, 2, 3, 4, 5, 6, 7, 8}; + TVector<size_t> data = {0, 1, 2, 3, 4, 5, 6, 7, 8}; - TVector<size_t> convertionResults[] = {xrange<size_t>(9), + TVector<size_t> convertionResults[] = {xrange<size_t>(9), xrange<ui32>(0, 9), xrange(0, 9, 1)}; @@ -124,7 +124,7 @@ Y_UNIT_TEST_SUITE(XRange) { } using TValueType = decltype(*emptyRange.begin()); - const TVector<TValueType> asVector = emptyRange; + const TVector<TValueType> asVector = emptyRange; UNIT_ASSERT(asVector.empty()); } } diff --git a/util/generic/yexception.cpp b/util/generic/yexception.cpp index 2ce6c4369da..5508a63ec6f 100644 --- a/util/generic/yexception.cpp +++ b/util/generic/yexception.cpp @@ -14,31 +14,31 @@ TString FormatExc(const std::exception& exception) { return TString::Join(TStringBuf("("), TypeName(exception), TStringBuf(") "), exception.what()); } -TString CurrentExceptionMessage() { - auto exceptionPtr = std::current_exception(); - if (exceptionPtr) { - try { - std::rethrow_exception(exceptionPtr); - } catch (const yexception& e) { - const TBackTrace* bt = e.BackTrace(); - - if (bt) { +TString CurrentExceptionMessage() { + auto exceptionPtr = std::current_exception(); + if (exceptionPtr) { + try { + std::rethrow_exception(exceptionPtr); + } catch (const yexception& e) { + const TBackTrace* bt = e.BackTrace(); + + if (bt) { return TString::Join(bt->PrintToString(), TStringBuf("\n"), FormatExc(e)); - } - - return FormatExc(e); - } catch (const std::exception& e) { - return FormatExc(e); - } catch (...) { + } + + return FormatExc(e); + } catch (const std::exception& e) { + return FormatExc(e); + } catch (...) { } - return "unknown error"; + return "unknown error"; } - return "(NO EXCEPTION)"; + return "(NO EXCEPTION)"; } -bool UncaughtException() noexcept { +bool UncaughtException() noexcept { // FIXME: use std::uncaught_exceptions() unconditionally after DEVTOOLS-8811 #if defined(__cpp_lib_uncaught_exceptions) && !defined(_LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS) return std::uncaught_exceptions() > 0; @@ -97,11 +97,11 @@ void NPrivateException::yexception::ZeroTerminate() noexcept { *end = 0; } -const char* NPrivateException::yexception::what() const noexcept { +const char* NPrivateException::yexception::what() const noexcept { return Buf_.Data(); } -const TBackTrace* NPrivateException::yexception::BackTrace() const noexcept { +const TBackTrace* NPrivateException::yexception::BackTrace() const noexcept { return nullptr; } diff --git a/util/generic/yexception.h b/util/generic/yexception.h index b0c604e8c45..10fa8c7c70d 100644 --- a/util/generic/yexception.h +++ b/util/generic/yexception.h @@ -2,7 +2,7 @@ #include "bt_exception.h" #include "strbuf.h" -#include "string.h" +#include "string.h" #include "utility.h" #include "va_args.h" #include <utility> @@ -46,8 +46,8 @@ namespace NPrivateException { yexception& operator=(const yexception&) = default; yexception& operator=(yexception&&) = default; - const char* what() const noexcept override; - virtual const TBackTrace* BackTrace() const noexcept; + const char* what() const noexcept override; + virtual const TBackTrace* BackTrace() const noexcept; template <class T> inline void Append(const T& t) { @@ -154,7 +154,7 @@ namespace NPrivate { void fputs(const std::exception& e, FILE* f = stderr); -TString CurrentExceptionMessage(); +TString CurrentExceptionMessage(); /* * A neat method that detects wrether stack unwinding is in progress. @@ -169,7 +169,7 @@ TString CurrentExceptionMessage(); * * DO NOT USE THIS METHOD IN DESTRUCTORS. */ -bool UncaughtException() noexcept; +bool UncaughtException() noexcept; std::string CurrentExceptionTypeName(); diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp index cb3e29fed84..cbdab1740cf 100644 --- a/util/generic/yexception_ut.cpp +++ b/util/generic/yexception_ut.cpp @@ -39,7 +39,7 @@ class TExceptionTest: public TTestBase { UNIT_TEST_SUITE(TExceptionTest); UNIT_TEST_EXCEPTION(TestException, yexception) UNIT_TEST_EXCEPTION(TestLineInfo, yexception) - UNIT_TEST(TestCurrentExceptionMessageWhenThereisNoException) + UNIT_TEST(TestCurrentExceptionMessageWhenThereisNoException) UNIT_TEST(TestFormat1) UNIT_TEST(TestRaise1) UNIT_TEST(TestVirtuality) @@ -70,15 +70,15 @@ private: } } - inline void TestCurrentExceptionMessageWhenThereisNoException() { - UNIT_ASSERT(CurrentExceptionMessage() == "(NO EXCEPTION)"); - } - + inline void TestCurrentExceptionMessageWhenThereisNoException() { + UNIT_ASSERT(CurrentExceptionMessage() == "(NO EXCEPTION)"); + } + inline void TestBackTrace() { try { ythrow TWithBackTrace<TIoSystemError>() << "test"; } catch (...) { - UNIT_ASSERT(CurrentExceptionMessage().find('\n') != TString::npos); + UNIT_ASSERT(CurrentExceptionMessage().find('\n') != TString::npos); return; } @@ -212,14 +212,14 @@ private: throw yexception() << 1 << " qw " << 12.1; UNIT_ASSERT(false); } catch (...) { - const TString err = CurrentExceptionMessage(); + const TString err = CurrentExceptionMessage(); UNIT_ASSERT(err.Contains("1 qw 12.1")); } } static inline void CheckCurrentExceptionContains(const char* message) { - TString err = CurrentExceptionMessage(); + TString err = CurrentExceptionMessage(); SubstGlobal(err, '\\', '/'); // remove backslashes from path in message UNIT_ASSERT(err.Contains(message)); } diff --git a/util/generic/ylimits.h b/util/generic/ylimits.h index fe42b4dfc0e..61a311e43e2 100644 --- a/util/generic/ylimits.h +++ b/util/generic/ylimits.h @@ -7,12 +7,12 @@ #endif template <class T> -static constexpr T Max() noexcept { +static constexpr T Max() noexcept { return std::numeric_limits<T>::max(); } template <class T> -static constexpr T Min() noexcept { +static constexpr T Min() noexcept { return std::numeric_limits<T>::min(); } @@ -32,11 +32,11 @@ namespace NPrivate { }; } -static constexpr ::NPrivate::TMax Max() noexcept { +static constexpr ::NPrivate::TMax Max() noexcept { return {}; } -static constexpr ::NPrivate::TMin Min() noexcept { +static constexpr ::NPrivate::TMin Min() noexcept { return {}; } diff --git a/util/generic/ymath_ut.cpp b/util/generic/ymath_ut.cpp index 29190b55eb4..3e3009540cd 100644 --- a/util/generic/ymath_ut.cpp +++ b/util/generic/ymath_ut.cpp @@ -9,7 +9,7 @@ #include <limits> template <class T> -static inline T SlowClp2(T t) noexcept { +static inline T SlowClp2(T t) noexcept { Y_ASSERT(t > 0); T ret = 1; diff --git a/util/memory/addstorage.h b/util/memory/addstorage.h index 597c73a988e..53b12c68bd6 100644 --- a/util/memory/addstorage.h +++ b/util/memory/addstorage.h @@ -41,15 +41,15 @@ public: return data; } - inline void operator delete(void* ptr) noexcept { + inline void operator delete(void* ptr) noexcept { DoDelete(ptr); } - inline void operator delete(void* ptr, size_t) noexcept { + inline void operator delete(void* ptr, size_t) noexcept { DoDelete(ptr); } - inline void operator delete(void* ptr, size_t, size_t) noexcept { + inline void operator delete(void* ptr, size_t, size_t) noexcept { /* * this delete operator can be called automagically by compiler */ @@ -57,20 +57,20 @@ public: DoDelete(ptr); } - inline void* AdditionalData() const noexcept { + inline void* AdditionalData() const noexcept { return (char*)(static_cast<const T*>(this)) + CombinedSizeOfInstanceWithTInfo(); } - static inline T* ObjectFromData(void* data) noexcept { + static inline T* ObjectFromData(void* data) noexcept { return reinterpret_cast<T*>(static_cast<char*>(data) - CombinedSizeOfInstanceWithTInfo()); } - inline size_t AdditionalDataLength() const noexcept { + inline size_t AdditionalDataLength() const noexcept { return InfoPtr(static_cast<const T*>(this))->Length(); } private: - static inline void DoDelete(void* ptr) noexcept { + static inline void DoDelete(void* ptr) noexcept { TInfo* info = InfoPtr(static_cast<T*>(ptr)); info->~TInfo(); ::operator delete(ptr); diff --git a/util/memory/alloc.cpp b/util/memory/alloc.cpp index 49f012d8575..0ce76855e14 100644 --- a/util/memory/alloc.cpp +++ b/util/memory/alloc.cpp @@ -15,6 +15,6 @@ void TDefaultAllocator::Release(const TBlock& block) { y_deallocate(block.Data); } -IAllocator* TDefaultAllocator::Instance() noexcept { +IAllocator* TDefaultAllocator::Instance() noexcept { return SingletonWithPriority<TDefaultAllocator, 0>(); } diff --git a/util/memory/alloc.h b/util/memory/alloc.h index d59575aef50..bb51a1a6a6d 100644 --- a/util/memory/alloc.h +++ b/util/memory/alloc.h @@ -23,5 +23,5 @@ public: TBlock Allocate(size_t len) override; void Release(const TBlock& block) override; - static IAllocator* Instance() noexcept; + static IAllocator* Instance() noexcept; }; diff --git a/util/memory/blob.cpp b/util/memory/blob.cpp index 91da5cadca3..40b0cab8f41 100644 --- a/util/memory/blob.cpp +++ b/util/memory/blob.cpp @@ -6,7 +6,7 @@ #include <util/system/mlock.h> #include <util/stream/buffer.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/buffer.h> #include <util/generic/ylimits.h> #include <util/generic/singleton.h> @@ -23,19 +23,19 @@ public: ~TDynamicBlobBase() override = default; - void Ref() noexcept override { + void Ref() noexcept override { TRefBase::Ref(); } - void UnRef() noexcept override { + void UnRef() noexcept override { TRefBase::UnRef(); } - inline void* Data() const noexcept { + inline void* Data() const noexcept { return this->AdditionalData(); } - inline size_t Length() const noexcept { + inline size_t Length() const noexcept { return this->AdditionalDataLength(); } }; @@ -51,15 +51,15 @@ public: ~TBufferBlobBase() override = default; - void Ref() noexcept override { + void Ref() noexcept override { TRefBase::Ref(); } - void UnRef() noexcept override { + void UnRef() noexcept override { TRefBase::UnRef(); } - inline const TBuffer& Buffer() const noexcept { + inline const TBuffer& Buffer() const noexcept { return Buf_; } @@ -72,7 +72,7 @@ class TStringBlobBase: public TBlob::TBase, public TRefCounted<TStringBlobBase<T using TRefBase = TRefCounted<TStringBlobBase, TCounter>; public: - inline TStringBlobBase(const TString& s) + inline TStringBlobBase(const TString& s) : S_(s) { } @@ -84,20 +84,20 @@ public: ~TStringBlobBase() override = default; - void Ref() noexcept override { + void Ref() noexcept override { TRefBase::Ref(); } - void UnRef() noexcept override { + void UnRef() noexcept override { TRefBase::UnRef(); } - inline const TString& String() const noexcept { + inline const TString& String() const noexcept { return S_; } private: - const TString S_; + const TString S_; }; template <class TCounter> @@ -128,19 +128,19 @@ public: } } - void Ref() noexcept override { + void Ref() noexcept override { TRefBase::Ref(); } - void UnRef() noexcept override { + void UnRef() noexcept override { TRefBase::UnRef(); } - inline const void* Data() const noexcept { + inline const void* Data() const noexcept { return Map_.Ptr(); } - inline size_t Length() const noexcept { + inline size_t Length() const noexcept { return Map_.MappedSize(); } @@ -324,12 +324,12 @@ static inline TBlob ConstructFromFileContent(const TFile& file, ui64 offset, ui6 return ReadFromFile<TCounter>(file, offset, static_cast<size_t>(length)); } -TBlob TBlob::FromFileContentSingleThreaded(const TString& path) { +TBlob TBlob::FromFileContentSingleThreaded(const TString& path) { TFile file(path, RdOnly); return ConstructFromFileContent<TSimpleCounter>(file, 0, file.GetLength()); } -TBlob TBlob::FromFileContent(const TString& path) { +TBlob TBlob::FromFileContent(const TString& path) { TFile file(path, RdOnly); return ConstructFromFileContent<TAtomicCounter>(file, 0, file.GetLength()); } @@ -401,7 +401,7 @@ TBlob ConstructFromString(S&& s) { return ret; } -TBlob TBlob::FromStringSingleThreaded(const TString& s) { +TBlob TBlob::FromStringSingleThreaded(const TString& s) { return ConstructFromString<TSimpleCounter>(s); } @@ -409,7 +409,7 @@ TBlob TBlob::FromStringSingleThreaded(TString&& s) { return ConstructFromString<TSimpleCounter>(std::move(s)); } -TBlob TBlob::FromString(const TString& s) { +TBlob TBlob::FromString(const TString& s) { return ConstructFromString<TAtomicCounter>(s); } diff --git a/util/memory/blob.h b/util/memory/blob.h index 20c02a68dfb..46a82d51952 100644 --- a/util/memory/blob.h +++ b/util/memory/blob.h @@ -28,8 +28,8 @@ public: inline TBase() noexcept = default; virtual ~TBase() = default; - virtual void Ref() noexcept = 0; - virtual void UnRef() noexcept = 0; + virtual void Ref() noexcept = 0; + virtual void UnRef() noexcept = 0; }; private: @@ -38,7 +38,7 @@ private: size_t Length; TBase* Base; - inline TStorage(const void* data, size_t length, TBase* base) noexcept + inline TStorage(const void* data, size_t length, TBase* base) noexcept : Data(data) , Length(length) , Base(base) @@ -47,7 +47,7 @@ private: inline ~TStorage() = default; - inline void Swap(TStorage& r) noexcept { + inline void Swap(TStorage& r) noexcept { DoSwap(Data, r.Data); DoSwap(Length, r.Length); DoSwap(Base, r.Base); @@ -68,7 +68,7 @@ public: { } - inline TBlob(const TBlob& r) noexcept + inline TBlob(const TBlob& r) noexcept : S_(r.S_) { Ref(); @@ -80,34 +80,34 @@ public: this->Swap(r); } - inline TBlob(const void* data, size_t length, TBase* base) noexcept + inline TBlob(const void* data, size_t length, TBase* base) noexcept : S_(data, length, base) { Ref(); } - inline ~TBlob() { + inline ~TBlob() { UnRef(); } - inline TBlob& operator=(const TBlob& r) noexcept { + inline TBlob& operator=(const TBlob& r) noexcept { TBlob(r).Swap(*this); return *this; } /// Swaps content of two data arrays. - inline void Swap(TBlob& r) noexcept { + inline void Swap(TBlob& r) noexcept { S_.Swap(r.S_); } /// Returns a const reference to the data array. - inline const void* Data() const noexcept { + inline const void* Data() const noexcept { return S_.Data; } /// Returns the size of the data array in bytes. - inline size_t Length() const noexcept { + inline size_t Length() const noexcept { return S_.Length; } @@ -122,17 +122,17 @@ public: } /// Checks if the object has a data array. - inline bool IsNull() const noexcept { + inline bool IsNull() const noexcept { return !Data(); } /// Returns a const pointer of char type to the data array. - inline const char* AsCharPtr() const noexcept { + inline const char* AsCharPtr() const noexcept { return (const char*)Data(); } /// Returns a const pointer of unsigned char type to the data array. - inline const unsigned char* AsUnsignedCharPtr() const noexcept { + inline const unsigned char* AsUnsignedCharPtr() const noexcept { return (const unsigned char*)Data(); } @@ -141,7 +141,7 @@ public: } /// Drops the data array. - inline void Drop() noexcept { + inline void Drop() noexcept { TBlob().Swap(*this); } @@ -163,21 +163,21 @@ public: } /// Returns the size of the data array in bytes. - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return Length(); } /// Standard iterator. - inline const_iterator Begin() const noexcept { + inline const_iterator Begin() const noexcept { return AsUnsignedCharPtr(); } /// Standard iterator. - inline const_iterator End() const noexcept { + inline const_iterator End() const noexcept { return Begin() + Size(); } - inline value_type operator[](size_t n) const noexcept { + inline value_type operator[](size_t n) const noexcept { return *(Begin() + n); } @@ -263,10 +263,10 @@ public: static TBlob FromMemoryMap(const TMemoryMap& map, ui64 offset, size_t length); /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread(). - static TBlob FromFileContentSingleThreaded(const TString& path); + static TBlob FromFileContentSingleThreaded(const TString& path); /// Creates a blob with a multi-threaded (atomic) refcounter. Dynamically allocates memory and copies data from the file on the path using pread(). - static TBlob FromFileContent(const TString& path); + static TBlob FromFileContent(const TString& path); /// Creates a blob with a single-threaded (non atomic) refcounter. Dynamically allocates memory and copies data from the file using pread(). static TBlob FromFileContentSingleThreaded(const TFile& file); @@ -295,25 +295,25 @@ public: static TBlob FromBuffer(TBuffer& in); /// Creates a blob from TString with a single-threaded (non atomic) refcounter. - static TBlob FromStringSingleThreaded(const TString& s); + static TBlob FromStringSingleThreaded(const TString& s); /// Creates a blob from TString with a single-threaded (non atomic) refcounter. Doesn't copy its content. static TBlob FromStringSingleThreaded(TString&& s); /// Creates a blob from TString with a multi-threaded (atomic) refcounter. - static TBlob FromString(const TString& s); + static TBlob FromString(const TString& s); /// Creates a blob from TString with a multi-threaded (atomic) refcounter. Doesn't copy its content. static TBlob FromString(TString&& s); private: - inline void Ref() noexcept { + inline void Ref() noexcept { if (S_.Base) { S_.Base->Ref(); } } - inline void UnRef() noexcept { + inline void UnRef() noexcept { if (S_.Base) { S_.Base->UnRef(); } diff --git a/util/memory/pool.cpp b/util/memory/pool.cpp index 9a011f0e4f6..4addca2fe65 100644 --- a/util/memory/pool.cpp +++ b/util/memory/pool.cpp @@ -1,11 +1,11 @@ #include "pool.h" -TMemoryPool::IGrowPolicy* TMemoryPool::TLinearGrow::Instance() noexcept { +TMemoryPool::IGrowPolicy* TMemoryPool::TLinearGrow::Instance() noexcept { return SingletonWithPriority<TLinearGrow, 0>(); } -TMemoryPool::IGrowPolicy* TMemoryPool::TExpGrow::Instance() noexcept { +TMemoryPool::IGrowPolicy* TMemoryPool::TExpGrow::Instance() noexcept { return SingletonWithPriority<TExpGrow, 0>(); } diff --git a/util/memory/pool.h b/util/memory/pool.h index 13c8b6b9ede..7fe26e81205 100644 --- a/util/memory/pool.h +++ b/util/memory/pool.h @@ -29,14 +29,14 @@ private: class TChunk: public TIntrusiveListItem<TChunk> { public: - inline TChunk(size_t len = 0) noexcept + inline TChunk(size_t len = 0) noexcept : Cur_((char*)(this + 1)) , Left_(len) { Y_ASSERT((((size_t)Cur_) % PLATFORM_DATA_ALIGN) == 0); } - inline void* Allocate(size_t len) noexcept { + inline void* Allocate(size_t len) noexcept { if (Left_ >= len) { char* ret = Cur_; @@ -49,7 +49,7 @@ private: return nullptr; } - inline void* Allocate(size_t len, size_t align) noexcept { + inline void* Allocate(size_t len, size_t align) noexcept { size_t pad = AlignUp(Cur_, align) - Cur_; void* ret = Allocate(pad + len); @@ -60,31 +60,31 @@ private: return nullptr; } - inline size_t BlockLength() const noexcept { + inline size_t BlockLength() const noexcept { return (Cur_ + Left_) - (char*)this; } - inline size_t Used() const noexcept { + inline size_t Used() const noexcept { return Cur_ - (const char*)this; } - inline size_t Left() const noexcept { + inline size_t Left() const noexcept { return Left_; } - inline const char* Data() const noexcept { + inline const char* Data() const noexcept { return (const char*)(this + 1); } - inline char* Data() noexcept { + inline char* Data() noexcept { return (char*)(this + 1); } - inline size_t DataSize() const noexcept { + inline size_t DataSize() const noexcept { return Cur_ - Data(); } - inline void ResetChunk() noexcept { + inline void ResetChunk() noexcept { size_t total = DataSize() + Left(); Cur_ = Data(); Left_ = total; @@ -102,25 +102,25 @@ public: public: virtual ~IGrowPolicy() = default; - virtual size_t Next(size_t prev) const noexcept = 0; + virtual size_t Next(size_t prev) const noexcept = 0; }; class TLinearGrow: public IGrowPolicy { public: - size_t Next(size_t prev) const noexcept override { + size_t Next(size_t prev) const noexcept override { return prev; } - static IGrowPolicy* Instance() noexcept; + static IGrowPolicy* Instance() noexcept; }; class TExpGrow: public IGrowPolicy { public: - size_t Next(size_t prev) const noexcept override { + size_t Next(size_t prev) const noexcept override { return prev * 2; } - static IGrowPolicy* Instance() noexcept; + static IGrowPolicy* Instance() noexcept; }; struct TOptions { @@ -143,7 +143,7 @@ public: { } - inline ~TMemoryPool() { + inline ~TMemoryPool() { Clear(); } @@ -232,28 +232,28 @@ public: return TBasicStringBuf<TChar>(ret, buf.size()); } - inline size_t Available() const noexcept { + inline size_t Available() const noexcept { return Current_->Left(); } - inline void Clear() noexcept { + inline void Clear() noexcept { DoClear(false); } - inline void ClearKeepFirstChunk() noexcept { + inline void ClearKeepFirstChunk() noexcept { DoClear(true); } - inline size_t MemoryAllocated() const noexcept { + inline size_t MemoryAllocated() const noexcept { return MemoryAllocatedBeforeCurrent_ + (Current_ != &Empty_ ? Current_->Used() : 0); } - inline size_t MemoryWaste() const noexcept { + inline size_t MemoryWaste() const noexcept { return MemoryWasteBeforeCurrent_ + (Current_ != &Empty_ ? Current_->Left() : 0); } template <class TOp> - inline void Traverse(TOp& op) const noexcept { + inline void Traverse(TOp& op) const noexcept { for (TChunkList::TConstIterator i = Chunks_.Begin(); i != Chunks_.End(); ++i) { op(i->Data(), i->DataSize()); } @@ -316,10 +316,10 @@ struct TPoolableBase { return pool.Allocate(bytes, (size_t)align); } - inline void operator delete(void*, size_t) noexcept { + inline void operator delete(void*, size_t) noexcept { } - inline void operator delete(void*, TPool&) noexcept { + inline void operator delete(void*, TPool&) noexcept { } private: @@ -384,7 +384,7 @@ public: using other = TPoolAllocBase<T1, TPool>; }; - inline size_type max_size() const noexcept { + inline size_type max_size() const noexcept { return size_type(-1) / sizeof(T); } @@ -393,7 +393,7 @@ public: new (p) T(std::forward<Args>(args)...); } - inline void destroy(pointer p) noexcept { + inline void destroy(pointer p) noexcept { (void)p; /* Make MSVC happy. */ p->~T(); } @@ -421,11 +421,11 @@ using TPoolAlloc = TPoolAllocBase<T, TMemoryPool>; using TPoolAllocator = TPoolAlloc<int>; template <class T> -inline bool operator==(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept { +inline bool operator==(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept { return true; } template <class T> -inline bool operator!=(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept { +inline bool operator!=(const TPoolAlloc<T>&, const TPoolAlloc<T>&) noexcept { return false; } diff --git a/util/memory/pool_ut.cpp b/util/memory/pool_ut.cpp index 1158a8ca423..88812b2310e 100644 --- a/util/memory/pool_ut.cpp +++ b/util/memory/pool_ut.cpp @@ -146,11 +146,11 @@ private: : ConstructorType(2) { } - TConstructorTest(const TString&, const TString&) + TConstructorTest(const TString&, const TString&) : ConstructorType(3) { } - TConstructorTest(TString&&, TString&&) + TConstructorTest(TString&&, TString&&) : ConstructorType(4) { } @@ -228,7 +228,7 @@ private: void CheckMoveAlloc() { TMemoryPool pool(10 * sizeof(T)); - TVector<T, TPoolAllocator> elems(&pool); + TVector<T, TPoolAllocator> elems(&pool); elems.reserve(1); elems.emplace_back(); elems.resize(100); diff --git a/util/memory/segmented_string_pool.h b/util/memory/segmented_string_pool.h index a40aa408f51..1bd06d8dc75 100644 --- a/util/memory/segmented_string_pool.h +++ b/util/memory/segmented_string_pool.h @@ -35,7 +35,7 @@ protected: { } }; - using seg_container = TVector<seg_inf>; + using seg_container = TVector<seg_inf>; using seg_iterator = typename seg_container::iterator; using seg_const_iterator = typename seg_container::const_iterator; const size_t segment_size; // default size of a memory chunk in sizeof(T)-units diff --git a/util/memory/segpool_alloc.h b/util/memory/segpool_alloc.h index 1a83b7a5437..d2a08055a75 100644 --- a/util/memory/segpool_alloc.h +++ b/util/memory/segpool_alloc.h @@ -15,7 +15,7 @@ Use segpool_alloc_vt as allocator template parameter for container. Example: - using TSomething = THashMap<A, B, hash<A>, TEqualTo<A>, segpool_alloc_vt>; + using TSomething = THashMap<A, B, hash<A>, TEqualTo<A>, segpool_alloc_vt>; ... TSomething something; something.GetNodeAllocator().pool = &alloc_pool; @@ -25,7 +25,7 @@ hack them, or fix segpool_alloc so that it would create ref-counted segmented_pool object on it's own - ! Only tested with THashMap + ! Only tested with THashMap */ template <class _Tp> diff --git a/util/memory/smallobj.h b/util/memory/smallobj.h index 63de666bae0..e4d71ddb4f5 100644 --- a/util/memory/smallobj.h +++ b/util/memory/smallobj.h @@ -8,11 +8,11 @@ class TFixedSizeAllocator { struct TAlloc: public TIntrusiveSListItem<TAlloc> { - inline void* ToPointer() noexcept { + inline void* ToPointer() noexcept { return this; } - static inline TAlloc* FromPointer(void* ptr) noexcept { + static inline TAlloc* FromPointer(void* ptr) noexcept { return (TAlloc*)ptr; } @@ -24,7 +24,7 @@ class TFixedSizeAllocator { return Max(alignof(TAlloc), align); } - static inline TAlloc* Construct(void* ptr) noexcept { + static inline TAlloc* Construct(void* ptr) noexcept { return (TAlloc*)ptr; } }; @@ -62,11 +62,11 @@ public: return Free_.PopFront()->ToPointer(); } - inline void Release(void* ptr) noexcept { + inline void Release(void* ptr) noexcept { Free_.PushFront(TAlloc::FromPointer(ptr)); } - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return AllocSize_; } @@ -96,7 +96,7 @@ public: return (T*)Alloc_.Allocate(); } - inline void Release(T* t) noexcept { + inline void Release(T* t) noexcept { Alloc_.Release(t); } @@ -120,11 +120,11 @@ public: return &ret->Obj; } - inline void operator delete(void* ptr, size_t) noexcept { + inline void operator delete(void* ptr, size_t) noexcept { DoDelete(ptr); } - inline void operator delete(void* ptr, TPool*) noexcept { + inline void operator delete(void* ptr, TPool*) noexcept { /* * this delete operator can be called automagically by compiler */ @@ -133,7 +133,7 @@ public: } private: - static inline void DoDelete(void* ptr) noexcept { + static inline void DoDelete(void* ptr) noexcept { static_assert(std::is_standard_layout<THeader>::value, "offsetof is only defined for standard layout types"); THeader* header = (THeader*)((char*)ptr - offsetof(THeader, Obj)); ((TPool*)header->Pool)->Release(header); diff --git a/util/memory/smallobj_ut.cpp b/util/memory/smallobj_ut.cpp index 86003d1d534..78435de9bba 100644 --- a/util/memory/smallobj_ut.cpp +++ b/util/memory/smallobj_ut.cpp @@ -61,7 +61,7 @@ private: inline void TestAllocate() { TClass::TPool pool(TDefaultAllocator::Instance()); - THashSet<TClass*> alloced; + THashSet<TClass*> alloced; for (size_t i = 0; i < 10000; ++i) { TClass* c = new (&pool) TClass; diff --git a/util/memory/tempbuf.cpp b/util/memory/tempbuf.cpp index 09a2d0f140b..f21b1bbc06e 100644 --- a/util/memory/tempbuf.cpp +++ b/util/memory/tempbuf.cpp @@ -16,7 +16,7 @@ class TTempBuf::TImpl: public TRefCounted<TImpl, TSimpleCounter, TImpl> { public: - inline TImpl(void* data, size_t size) noexcept + inline TImpl(void* data, size_t size) noexcept : Data_(data) , Size_(size) , Offset_(0) @@ -29,27 +29,27 @@ public: */ virtual ~TImpl() = default; - inline void* Data() noexcept { + inline void* Data() noexcept { return Data_; } - const void* Data() const noexcept { + const void* Data() const noexcept { return Data_; } - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return Size_; } - inline size_t Filled() const noexcept { + inline size_t Filled() const noexcept { return Offset_; } - inline void Reset() noexcept { + inline void Reset() noexcept { Offset_ = 0; } - inline size_t Left() const noexcept { + inline size_t Left() const noexcept { return Size() - Filled(); } @@ -64,12 +64,12 @@ public: Offset_ += off; } - static inline void Destroy(TImpl* This) noexcept { + static inline void Destroy(TImpl* This) noexcept { This->Dispose(); } protected: - virtual void Dispose() noexcept = 0; + virtual void Dispose() noexcept = 0; private: void* Data_; @@ -90,7 +90,7 @@ namespace { inline ~TAllocedBuf() override = default; private: - void Dispose() noexcept override { + void Dispose() noexcept override { delete this; } }; @@ -99,7 +99,7 @@ namespace { friend class TTempBufManager; public: - inline TPerThreadedBuf(TTempBufManager* manager) noexcept + inline TPerThreadedBuf(TTempBufManager* manager) noexcept : TImpl(Data_, sizeof(Data_)) , Manager_(manager) { @@ -108,7 +108,7 @@ namespace { inline ~TPerThreadedBuf() override = default; private: - void Dispose() noexcept override; + void Dispose() noexcept override; private: char Data_[TMP_BUF_LEN]; @@ -117,16 +117,16 @@ namespace { class TTempBufManager { struct TDelete { - inline void operator()(TPerThreadedBuf* p) noexcept { + inline void operator()(TPerThreadedBuf* p) noexcept { delete p; } }; public: - inline TTempBufManager() noexcept { + inline TTempBufManager() noexcept { } - inline ~TTempBufManager() { + inline ~TTempBufManager() { TDelete deleter; Unused_.ForEach(deleter); @@ -140,7 +140,7 @@ namespace { return new TPerThreadedBuf(this); } - inline void Return(TPerThreadedBuf* buf) noexcept { + inline void Return(TPerThreadedBuf* buf) noexcept { buf->Reset(); Unused_.PushFront(buf); } @@ -163,7 +163,7 @@ static inline TTempBuf::TImpl* AcquireSmallBuffer(size_t size) { #endif } -void TPerThreadedBuf::Dispose() noexcept { +void TPerThreadedBuf::Dispose() noexcept { if (Manager_ == TempBufManager()) { Manager_->Return(this); } else { @@ -196,14 +196,14 @@ TTempBuf::TTempBuf(size_t len) TTempBuf::TTempBuf(const TTempBuf&) noexcept = default; -TTempBuf::TTempBuf(TTempBuf&& b) noexcept +TTempBuf::TTempBuf(TTempBuf&& b) noexcept : Impl_(std::move(b.Impl_)) { } TTempBuf::~TTempBuf() = default; -TTempBuf& TTempBuf::operator=(const TTempBuf& b) noexcept { +TTempBuf& TTempBuf::operator=(const TTempBuf& b) noexcept { if (this != &b) { Impl_ = b.Impl_; } @@ -211,43 +211,43 @@ TTempBuf& TTempBuf::operator=(const TTempBuf& b) noexcept { return *this; } -TTempBuf& TTempBuf::operator=(TTempBuf&& b) noexcept { - if (this != &b) { - Impl_ = std::move(b.Impl_); - } - - return *this; -} - -char* TTempBuf::Data() noexcept { +TTempBuf& TTempBuf::operator=(TTempBuf&& b) noexcept { + if (this != &b) { + Impl_ = std::move(b.Impl_); + } + + return *this; +} + +char* TTempBuf::Data() noexcept { return (char*)Impl_->Data(); } -const char* TTempBuf::Data() const noexcept { +const char* TTempBuf::Data() const noexcept { return static_cast<const char*>(Impl_->Data()); } -size_t TTempBuf::Size() const noexcept { +size_t TTempBuf::Size() const noexcept { return Impl_->Size(); } -char* TTempBuf::Current() noexcept { +char* TTempBuf::Current() noexcept { return Data() + Filled(); } -const char* TTempBuf::Current() const noexcept { +const char* TTempBuf::Current() const noexcept { return Data() + Filled(); } -size_t TTempBuf::Filled() const noexcept { +size_t TTempBuf::Filled() const noexcept { return Impl_->Filled(); } -size_t TTempBuf::Left() const noexcept { +size_t TTempBuf::Left() const noexcept { return Impl_->Left(); } -void TTempBuf::Reset() noexcept { +void TTempBuf::Reset() noexcept { Impl_->Reset(); } @@ -270,7 +270,7 @@ void TTempBuf::Append(const void* data, size_t len) { Proceed(len); } -bool TTempBuf::IsNull() const noexcept { +bool TTempBuf::IsNull() const noexcept { return !Impl_; } diff --git a/util/memory/tempbuf.h b/util/memory/tempbuf.h index 334670eb1e5..15a475680e6 100644 --- a/util/memory/tempbuf.h +++ b/util/memory/tempbuf.h @@ -18,12 +18,12 @@ public: TTempBuf(); TTempBuf(size_t len); - TTempBuf(const TTempBuf& b) noexcept; - TTempBuf(TTempBuf&& b) noexcept; - ~TTempBuf(); + TTempBuf(const TTempBuf& b) noexcept; + TTempBuf(TTempBuf&& b) noexcept; + ~TTempBuf(); - TTempBuf& operator=(const TTempBuf& b) noexcept; - TTempBuf& operator=(TTempBuf&& b) noexcept; + TTempBuf& operator=(const TTempBuf& b) noexcept; + TTempBuf& operator=(TTempBuf&& b) noexcept; Y_PURE_FUNCTION char* Data() noexcept; @@ -39,7 +39,7 @@ public: Y_PURE_FUNCTION size_t Left() const noexcept; - void Reset() noexcept; + void Reset() noexcept; void SetPos(size_t off); char* Proceed(size_t off); void Append(const void* data, size_t len); @@ -53,10 +53,10 @@ private: template <typename T> class TTempArray: private TTempBuf { private: - static T* TypedPointer(char* pointer) noexcept { + static T* TypedPointer(char* pointer) noexcept { return reinterpret_cast<T*>(pointer); } - static const T* TypedPointer(const char* pointer) noexcept { + static const T* TypedPointer(const char* pointer) noexcept { return reinterpret_cast<const T*>(pointer); } static constexpr size_t RawSize(const size_t size) noexcept { @@ -74,26 +74,26 @@ public: { } - T* Data() noexcept { + T* Data() noexcept { return TypedPointer(TTempBuf::Data()); } - const T* Data() const noexcept { + const T* Data() const noexcept { return TypedPointer(TTempBuf::Data()); } - T* Current() noexcept { + T* Current() noexcept { return TypedPointer(TTempBuf::Current()); } - const T* Current() const noexcept { + const T* Current() const noexcept { return TypedPointer(TTempBuf::Current()); } - size_t Size() const noexcept { + size_t Size() const noexcept { return TypedSize(TTempBuf::Size()); } - size_t Filled() const noexcept { + size_t Filled() const noexcept { return TypedSize(TTempBuf::Filled()); } diff --git a/util/memory/tempbuf_ut.cpp b/util/memory/tempbuf_ut.cpp index d6bcf9d5461..8cb5fa86b7c 100644 --- a/util/memory/tempbuf_ut.cpp +++ b/util/memory/tempbuf_ut.cpp @@ -27,7 +27,7 @@ public: tmp.Append("def", 3); UNIT_ASSERT_EQUAL(tmp.Filled(), 6); - UNIT_ASSERT_EQUAL(TString(tmp.Data(), tmp.Filled()), "abcdef"); + UNIT_ASSERT_EQUAL(TString(tmp.Data(), tmp.Filled()), "abcdef"); } }; diff --git a/util/network/address.cpp b/util/network/address.cpp index a81a9e69941..91d26082355 100644 --- a/util/network/address.cpp +++ b/util/network/address.cpp @@ -118,13 +118,13 @@ void NAddr::PrintHost(IOutputStream& out, const IRemoteAddr& addr) { PrintAddr<false>(out, addr); } -TString NAddr::PrintHost(const IRemoteAddr& addr) { +TString NAddr::PrintHost(const IRemoteAddr& addr) { TStringStream ss; PrintAddr<false>(ss, addr); return ss.Str(); } -TString NAddr::PrintHostAndPort(const IRemoteAddr& addr) { +TString NAddr::PrintHostAndPort(const IRemoteAddr& addr) { TStringStream ss; PrintAddr<true>(ss, addr); return ss.Str(); diff --git a/util/network/address.h b/util/network/address.h index 448fcac0c9d..7bbf25331c3 100644 --- a/util/network/address.h +++ b/util/network/address.h @@ -4,7 +4,7 @@ #include "socket.h" #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NAddr { class IRemoteAddr { @@ -22,8 +22,8 @@ namespace NAddr { IRemoteAddrPtr GetPeerAddr(SOCKET s); void PrintHost(IOutputStream& out, const IRemoteAddr& addr); - TString PrintHost(const IRemoteAddr& addr); - TString PrintHostAndPort(const IRemoteAddr& addr); + TString PrintHost(const IRemoteAddr& addr); + TString PrintHostAndPort(const IRemoteAddr& addr); bool IsLoopback(const IRemoteAddr& addr); bool IsSame(const IRemoteAddr& lhs, const IRemoteAddr& rhs); @@ -33,13 +33,13 @@ namespace NAddr { //for accept, recvfrom - see LenPtr() class TOpaqueAddr: public IRemoteAddr { public: - inline TOpaqueAddr() noexcept + inline TOpaqueAddr() noexcept : L_(sizeof(S_)) { Zero(S_); } - inline TOpaqueAddr(const IRemoteAddr* addr) noexcept { + inline TOpaqueAddr(const IRemoteAddr* addr) noexcept { Assign(addr->Addr(), addr->Len()); } @@ -55,16 +55,16 @@ namespace NAddr { return L_; } - inline sockaddr* MutableAddr() const noexcept { + inline sockaddr* MutableAddr() const noexcept { return (sockaddr*)&S_; } - inline socklen_t* LenPtr() noexcept { + inline socklen_t* LenPtr() noexcept { return &L_; } private: - inline void Assign(const sockaddr* addr, socklen_t len) noexcept { + inline void Assign(const sockaddr* addr, socklen_t len) noexcept { L_ = len; memcpy(MutableAddr(), addr, L_); } @@ -77,7 +77,7 @@ namespace NAddr { //for TNetworkAddress class TAddrInfo: public IRemoteAddr { public: - inline TAddrInfo(const addrinfo* ai) noexcept + inline TAddrInfo(const addrinfo* ai) noexcept : AI_(ai) { } @@ -97,7 +97,7 @@ namespace NAddr { //compat, for TIpAddress class TIPv4Addr: public IRemoteAddr { public: - inline TIPv4Addr(const TIpAddress& addr) noexcept + inline TIPv4Addr(const TIpAddress& addr) noexcept : A_(addr) { } @@ -117,7 +117,7 @@ namespace NAddr { //same, for ipv6 addresses class TIPv6Addr: public IRemoteAddr { public: - inline TIPv6Addr(const sockaddr_in6& a) noexcept + inline TIPv6Addr(const sockaddr_in6& a) noexcept : A_(a) { } diff --git a/util/network/address_ut.cpp b/util/network/address_ut.cpp index 28f45172ffe..71d225c6924 100644 --- a/util/network/address_ut.cpp +++ b/util/network/address_ut.cpp @@ -9,12 +9,12 @@ Y_UNIT_TEST_SUITE(IRemoteAddr_ToString) { THolder<TOpaqueAddr> opaque(new TOpaqueAddr); IRemoteAddr* addr = opaque.Get(); - TString s = ToString(*addr); + TString s = ToString(*addr); UNIT_ASSERT_VALUES_EQUAL("(raw all zeros)", s); opaque->MutableAddr()->sa_data[10] = 17; - TString t = ToString(*addr); + TString t = ToString(*addr); UNIT_ASSERT_C(t.StartsWith("(raw 0 0"), t); UNIT_ASSERT_C(t.EndsWith(')'), t); @@ -25,8 +25,8 @@ Y_UNIT_TEST_SUITE(IRemoteAddr_ToString) { TNetworkAddress::TIterator it = address.Begin(); UNIT_ASSERT(it != address.End()); UNIT_ASSERT(it->ai_family == AF_INET6); - TString toString = ToString((const IRemoteAddr&)TAddrInfo(&*it)); - UNIT_ASSERT_VALUES_EQUAL(TString("[::1]:22"), toString); + TString toString = ToString((const IRemoteAddr&)TAddrInfo(&*it)); + UNIT_ASSERT_VALUES_EQUAL(TString("[::1]:22"), toString); } Y_UNIT_TEST(Loopback) { diff --git a/util/network/endpoint.cpp b/util/network/endpoint.cpp index 9acdd069408..3b1ee85c4ab 100644 --- a/util/network/endpoint.cpp +++ b/util/network/endpoint.cpp @@ -32,7 +32,7 @@ void TEndpoint::SetPort(ui16 port) { } } -ui16 TEndpoint::Port() const noexcept { +ui16 TEndpoint::Port() const noexcept { if (Addr_->Addr()->sa_family == AF_UNIX) { return 0; } diff --git a/util/network/endpoint.h b/util/network/endpoint.h index a3e59b49250..abd58c15a0b 100644 --- a/util/network/endpoint.h +++ b/util/network/endpoint.h @@ -12,7 +12,7 @@ public: TEndpoint(const TAddrRef& addr); TEndpoint(); - inline const TAddrRef& Addr() const noexcept { + inline const TAddrRef& Addr() const noexcept { return Addr_; } inline const sockaddr* SockAddr() const { @@ -32,12 +32,12 @@ public: return Addr_->Addr()->sa_family == AF_UNIX; } - inline TString IpToString() const { + inline TString IpToString() const { return NAddr::PrintHost(*Addr_); } void SetPort(ui16 port); - ui16 Port() const noexcept; + ui16 Port() const noexcept; size_t Hash() const; diff --git a/util/network/endpoint_ut.cpp b/util/network/endpoint_ut.cpp index d5e40dd6e1c..69117dd3d33 100644 --- a/util/network/endpoint_ut.cpp +++ b/util/network/endpoint_ut.cpp @@ -7,7 +7,7 @@ Y_UNIT_TEST_SUITE(TEndpointTest) { Y_UNIT_TEST(TestSimple) { - TVector<TNetworkAddress> addrs; + TVector<TNetworkAddress> addrs; TEndpoint ep0; @@ -64,7 +64,7 @@ Y_UNIT_TEST_SUITE(TEndpointTest) { ep3_.SetPort(54321); - THashSet<TEndpoint> he; + THashSet<TEndpoint> he; he.insert(ep0); he.insert(ep1); @@ -87,8 +87,8 @@ Y_UNIT_TEST_SUITE(TEndpointTest) { } Y_UNIT_TEST(TestEqual) { - const TString ip1 = "2a02:6b8:0:1410::5f6c:f3c2"; - const TString ip2 = "2a02:6b8:0:1410::5f6c:f3c3"; + const TString ip1 = "2a02:6b8:0:1410::5f6c:f3c2"; + const TString ip2 = "2a02:6b8:0:1410::5f6c:f3c3"; TNetworkAddress na1(ip1, 24242); TEndpoint ep1(new NAddr::TAddrInfo(&*na1.Begin())); diff --git a/util/network/interface.cpp b/util/network/interface.cpp index 256776c6d3f..c4652c3c288 100644 --- a/util/network/interface.cpp +++ b/util/network/interface.cpp @@ -18,7 +18,7 @@ namespace NAddr { TNetworkInterfaceList result; #ifdef _win_ - TVector<char> buf; + TVector<char> buf; buf.resize(1000000); PIP_ADAPTER_ADDRESSES adapterBuf = (PIP_ADAPTER_ADDRESSES)&buf[0]; ULONG bufSize = buf.ysize(); diff --git a/util/network/interface.h b/util/network/interface.h index dda45550215..c828144b089 100644 --- a/util/network/interface.h +++ b/util/network/interface.h @@ -6,12 +6,12 @@ namespace NAddr { struct TNetworkInterface { - TString Name; + TString Name; IRemoteAddrRef Address; IRemoteAddrRef Mask; }; - using TNetworkInterfaceList = TVector<TNetworkInterface>; + using TNetworkInterfaceList = TVector<TNetworkInterface>; TNetworkInterfaceList GetNetworkInterfaces(); } diff --git a/util/network/iovec.h b/util/network/iovec.h index ac15a41f545..46b753cee8c 100644 --- a/util/network/iovec.h +++ b/util/network/iovec.h @@ -14,7 +14,7 @@ public: { } - inline void Proceed(size_t len) noexcept { + inline void Proceed(size_t len) noexcept { while (Count_) { if (len < Parts_->len) { Parts_->len -= len; @@ -33,15 +33,15 @@ public: } } - inline const TPart* Parts() const noexcept { + inline const TPart* Parts() const noexcept { return Parts_; } - inline size_t Count() const noexcept { + inline size_t Count() const noexcept { return Count_; } - static inline size_t Bytes(const TPart* parts, size_t count) noexcept { + static inline size_t Bytes(const TPart* parts, size_t count) noexcept { size_t ret = 0; for (size_t i = 0; i < count; ++i) { @@ -51,11 +51,11 @@ public: return ret; } - inline size_t Bytes() const noexcept { + inline size_t Bytes() const noexcept { return Bytes(Parts_, Count_); } - inline bool Complete() const noexcept { + inline bool Complete() const noexcept { return !Count(); } diff --git a/util/network/ip.h b/util/network/ip.h index dc7c2d24a06..acaa1a9146b 100644 --- a/util/network/ip.h +++ b/util/network/ip.h @@ -5,7 +5,7 @@ #include <util/system/error.h> #include <util/system/byteorder.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> /// IPv4 address in network format @@ -36,15 +36,15 @@ static inline char* IpToString(TIpHost ip, char* buf, size_t len) { return buf; } -static inline TString IpToString(TIpHost ip) { +static inline TString IpToString(TIpHost ip) { char buf[INET_ADDRSTRLEN]; - return TString(IpToString(ip, buf, sizeof(buf))); + return TString(IpToString(ip, buf, sizeof(buf))); } static inline TIpHost ResolveHost(const char* data, size_t len) { TIpHost ret; - const TString s(data, len); + const TString s(data, len); if (NResolver::GetHostIP(s.data(), &ret) != 0) { ythrow TSystemError(NResolver::GetDnsError()) << "can not resolve(" << s << ")"; @@ -55,17 +55,17 @@ static inline TIpHost ResolveHost(const char* data, size_t len) { /// socket address struct TIpAddress: public sockaddr_in { - inline TIpAddress() noexcept { + inline TIpAddress() noexcept { Clear(); } - inline TIpAddress(const sockaddr_in& addr) noexcept + inline TIpAddress(const sockaddr_in& addr) noexcept : sockaddr_in(addr) , tmp(0) { } - inline TIpAddress(TIpHost ip, TIpPort port) noexcept { + inline TIpAddress(TIpHost ip, TIpPort port) noexcept { Set(ip, port); } @@ -77,27 +77,27 @@ struct TIpAddress: public sockaddr_in { Set(ResolveHost(ip, strlen(ip)), port); } - inline operator sockaddr*() const noexcept { + inline operator sockaddr*() const noexcept { return (sockaddr*)(sockaddr_in*)this; } - inline operator socklen_t*() const noexcept { + inline operator socklen_t*() const noexcept { tmp = sizeof(sockaddr_in); return (socklen_t*)&tmp; } - inline operator socklen_t() const noexcept { + inline operator socklen_t() const noexcept { tmp = sizeof(sockaddr_in); return tmp; } - inline void Clear() noexcept { + inline void Clear() noexcept { Zero((sockaddr_in&)(*this)); } - inline void Set(TIpHost ip, TIpPort port) noexcept { + inline void Set(TIpHost ip, TIpPort port) noexcept { Clear(); sin_family = AF_INET; @@ -105,11 +105,11 @@ struct TIpAddress: public sockaddr_in { sin_port = HostToInet(port); } - inline TIpHost Host() const noexcept { + inline TIpHost Host() const noexcept { return sin_addr.s_addr; } - inline TIpPort Port() const noexcept { + inline TIpPort Port() const noexcept { return InetToHost(sin_port); } diff --git a/util/network/nonblock.cpp b/util/network/nonblock.cpp index e515c27cc51..bee7ec539db 100644 --- a/util/network/nonblock.cpp +++ b/util/network/nonblock.cpp @@ -85,7 +85,7 @@ namespace { return ret; } - static inline const TFeatureCheck* Instance() noexcept { + static inline const TFeatureCheck* Instance() noexcept { return Singleton<TFeatureCheck>(); } diff --git a/util/network/poller.h b/util/network/poller.h index 8dccd731407..28476bffc97 100644 --- a/util/network/poller.h +++ b/util/network/poller.h @@ -8,7 +8,7 @@ class TSocketPoller { public: TSocketPoller(); - ~TSocketPoller(); + ~TSocketPoller(); void WaitRead(SOCKET sock, void* cookie); void WaitWrite(SOCKET sock, void* cookie); diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h index e8c7e40fbaf..196092cecd0 100644 --- a/util/network/pollerimpl.h +++ b/util/network/pollerimpl.h @@ -7,7 +7,7 @@ #include <util/system/defaults.h> #include <util/generic/ylimits.h> #include <util/generic/utility.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/generic/yexception.h> #include <util/datetime/base.h> @@ -40,7 +40,7 @@ enum EContPoll { CONT_POLL_BACKLOG_EMPTY = 64, // Backlog is empty (seen end of request, EAGAIN or truncated read) }; -static inline bool IsSocket(SOCKET fd) noexcept { +static inline bool IsSocket(SOCKET fd) noexcept { int val = 0; socklen_t len = sizeof(val); @@ -51,7 +51,7 @@ static inline bool IsSocket(SOCKET fd) noexcept { return LastSystemError() != ENOTSOCK; } -static inline int MicroToMilli(int timeout) noexcept { +static inline int MicroToMilli(int timeout) noexcept { if (timeout) { /* * 1. API of epoll syscall allows to specify timeout with millisecond @@ -74,7 +74,7 @@ struct TWithoutLocking { #if defined(HAVE_KQUEUE_POLLER) static inline int Kevent(int kq, struct kevent* changelist, int nchanges, - struct kevent* eventlist, int nevents, const struct timespec* timeout) noexcept { + struct kevent* eventlist, int nevents, const struct timespec* timeout) noexcept { int ret; do { @@ -97,11 +97,11 @@ public: } } - inline ~TKqueuePoller() { + inline ~TKqueuePoller() { close(Fd_); } - inline int Fd() const noexcept { + inline int Fd() const noexcept { return Fd_; } @@ -131,7 +131,7 @@ public: } } - inline void Remove(int fd) noexcept { + inline void Remove(int fd) noexcept { TEvent e[2]; Zero(e); @@ -142,7 +142,7 @@ public: Y_VERIFY(!(Kevent(Fd_, e, 2, nullptr, 0, nullptr) == -1 && errno != ENOENT), "kevent remove failed: %s", LastSystemErrorText()); } - inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept { + inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept { struct timespec ts; ts.tv_sec = timeout / 1000000; @@ -155,11 +155,11 @@ public: return (size_t)ret; } - static inline void* ExtractEvent(const TEvent* event) noexcept { + static inline void* ExtractEvent(const TEvent* event) noexcept { return event->udata; } - static inline int ExtractStatus(const TEvent* event) noexcept { + static inline int ExtractStatus(const TEvent* event) noexcept { if (event->flags & EV_ERROR) { return EIO; } @@ -167,7 +167,7 @@ public: return event->fflags; } - static inline int ExtractFilterImpl(const TEvent* event) noexcept { + static inline int ExtractFilterImpl(const TEvent* event) noexcept { if (event->filter == EVFILT_READ) { return CONT_POLL_READ; } @@ -189,7 +189,7 @@ private: #endif #if defined(HAVE_EPOLL_POLLER) -static inline int ContEpollWait(int epfd, struct epoll_event* events, int maxevents, int timeout) noexcept { +static inline int ContEpollWait(int epfd, struct epoll_event* events, int maxevents, int timeout) noexcept { int ret; do { @@ -212,11 +212,11 @@ public: } } - inline ~TEpollPoller() { + inline ~TEpollPoller() { close(Fd_); } - inline int Fd() const noexcept { + inline int Fd() const noexcept { return Fd_; } @@ -258,7 +258,7 @@ public: } } - inline void Remove(int fd) noexcept { + inline void Remove(int fd) noexcept { TEvent e; Zero(e); @@ -266,7 +266,7 @@ public: epoll_ctl(Fd_, EPOLL_CTL_DEL, fd, &e); } - inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept { + inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept { const int ret = ContEpollWait(Fd_, events, len, MicroToMilli(timeout)); Y_VERIFY(ret >= 0, "epoll wait error: %s", LastSystemErrorText()); @@ -274,11 +274,11 @@ public: return (size_t)ret; } - static inline void* ExtractEvent(const TEvent* event) noexcept { + static inline void* ExtractEvent(const TEvent* event) noexcept { return event->data.ptr; } - static inline int ExtractStatus(const TEvent* event) noexcept { + static inline int ExtractStatus(const TEvent* event) noexcept { if (event->events & (EPOLLERR | EPOLLHUP)) { return EIO; } @@ -286,7 +286,7 @@ public: return 0; } - static inline int ExtractFilterImpl(const TEvent* event) noexcept { + static inline int ExtractFilterImpl(const TEvent* event) noexcept { int ret = 0; if (event->events & EPOLLIN) { @@ -315,7 +315,7 @@ private: #include "pair.h" -static inline int ContSelect(int n, fd_set* r, fd_set* w, fd_set* e, struct timeval* t) noexcept { +static inline int ContSelect(int n, fd_set* r, fd_set* w, fd_set* e, struct timeval* t) noexcept { int ret; do { @@ -336,11 +336,11 @@ struct TSelectPollerNoTemplate { { } - inline void* Data() const noexcept { + inline void* Data() const noexcept { return Data_; } - inline void Set(void* d, int s) noexcept { + inline void Set(void* d, int s) noexcept { Data_ = d; Filter_ = s; } @@ -349,12 +349,12 @@ struct TSelectPollerNoTemplate { Filter_ &= ~c; } - inline int Filter() const noexcept { + inline int Filter() const noexcept { return Filter_; } }; - class TFds: public THashMap<SOCKET, THandle> { + class TFds: public THashMap<SOCKET, THandle> { public: inline void Set(SOCKET fd, void* data, int filter) { (*this)[fd].Set(data, filter); @@ -364,7 +364,7 @@ struct TSelectPollerNoTemplate { erase(fd); } - inline SOCKET Build(fd_set* r, fd_set* w, fd_set* e) const noexcept { + inline SOCKET Build(fd_set* r, fd_set* w, fd_set* e) const noexcept { SOCKET ret = 0; for (const auto& it : *this) { @@ -391,15 +391,15 @@ struct TSelectPollerNoTemplate { }; struct TEvent: public THandle { - inline int Status() const noexcept { + inline int Status() const noexcept { return -Min(Filter(), 0); } - inline void Error(void* d, int err) noexcept { + inline void Error(void* d, int err) noexcept { Set(d, -err); } - inline void Success(void* d, int what) noexcept { + inline void Success(void* d, int what) noexcept { Set(d, what); } }; @@ -419,7 +419,7 @@ public: SetNonBlock(SigSock()); } - inline ~TSelectPoller() { + inline ~TSelectPoller() { closesocket(Signal_[0]); closesocket(Signal_[1]); } @@ -432,7 +432,7 @@ public: Signal(); } - inline void Remove(SOCKET fd) noexcept { + inline void Remove(SOCKET fd) noexcept { with_lock (CommandLock_) { Commands_.push_back(TCommand(fd, 0)); } @@ -440,7 +440,7 @@ public: Signal(); } - inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept { + inline size_t Wait(TEvent* events, size_t len, int timeout) noexcept { auto guard = Guard(Lock_); do { @@ -472,7 +472,7 @@ public: return SavedEvents_.Get(); } - inline size_t WaitBase(TEvent* events, size_t len, int timeout) noexcept { + inline size_t WaitBase(TEvent* events, size_t len, int timeout) noexcept { with_lock (CommandLock_) { for (auto command = Commands_.begin(); command != Commands_.end(); ++command) { if (command->Filter_ != 0) { @@ -571,24 +571,24 @@ public: return events - eventsStart; } - inline size_t EventNumberHint() const noexcept { + inline size_t EventNumberHint() const noexcept { return sizeof(fd_set) * 8 * 2; } - static inline void* ExtractEvent(const TEvent* event) noexcept { + static inline void* ExtractEvent(const TEvent* event) noexcept { return event->Data(); } - static inline int ExtractStatus(const TEvent* event) noexcept { + static inline int ExtractStatus(const TEvent* event) noexcept { return event->Status(); } - static inline int ExtractFilterImpl(const TEvent* event) noexcept { + static inline int ExtractFilterImpl(const TEvent* event) noexcept { return event->Filter(); } private: - inline void Signal() noexcept { + inline void Signal() noexcept { char ch = 13; send(SigSock(), &ch, 1, 0); @@ -602,11 +602,11 @@ private: } } - inline SOCKET WaitSock() const noexcept { + inline SOCKET WaitSock() const noexcept { return Signal_[1]; } - inline SOCKET SigSock() const noexcept { + inline SOCKET SigSock() const noexcept { return Signal_[0]; } @@ -638,13 +638,13 @@ private: TEvent* End_; TMyMutex CommandLock_; - TVector<TCommand> Commands_; + TVector<TCommand> Commands_; SOCKET Signal_[2]; }; #endif -static inline TDuration PollStep(const TInstant& deadLine, const TInstant& now) noexcept { +static inline TDuration PollStep(const TInstant& deadLine, const TInstant& now) noexcept { if (deadLine < now) { return TDuration::Zero(); } @@ -667,7 +667,7 @@ public: } } - static inline int ExtractFilter(const TEvent* event) noexcept { + static inline int ExtractFilter(const TEvent* event) noexcept { if (TBase::ExtractStatus(event)) { return CONT_POLL_READ | CONT_POLL_WRITE | CONT_POLL_RDHUP; } @@ -675,7 +675,7 @@ public: return TBase::ExtractFilterImpl(event); } - inline size_t WaitD(TEvent* events, size_t len, TInstant deadLine, TInstant now = TInstant::Now()) noexcept { + inline size_t WaitD(TEvent* events, size_t len, TInstant deadLine, TInstant now = TInstant::Now()) noexcept { if (!len) { return 0; } diff --git a/util/network/sock.h b/util/network/sock.h index b10be2f7156..b651ab62960 100644 --- a/util/network/sock.h +++ b/util/network/sock.h @@ -30,7 +30,7 @@ struct ISockAddr { virtual sockaddr* SockAddr() = 0; virtual const sockaddr* SockAddr() const = 0; // address in human readable form - virtual TString ToString() const = 0; + virtual TString ToString() const = 0; protected: // below are the implemetation methods that can be called by T*Socket classes @@ -64,12 +64,12 @@ struct TSockAddrLocal: public ISockAddr { return Size(); } - inline void Clear() noexcept { + inline void Clear() noexcept { Zero(in); Zero(Path); } - inline void Set(const char* path) noexcept { + inline void Set(const char* path) noexcept { Clear(); in.sin_family = AF_INET; in.sin_addr.s_addr = IpFromString("127.0.0.1"); @@ -85,8 +85,8 @@ struct TSockAddrLocal: public ISockAddr { return (const struct sockaddr*)(&in); } - TString ToString() const { - return TString(Path); + TString ToString() const { + return TString(Path); } TFsPath ToPath() const { @@ -160,11 +160,11 @@ struct TSockAddrLocal: public sockaddr_un, public ISockAddr { return strlen(sun_path) + 2; } - inline void Clear() noexcept { + inline void Clear() noexcept { Zero(*(sockaddr_un*)this); } - inline void Set(const char* path) noexcept { + inline void Set(const char* path) noexcept { Clear(); sun_family = AF_UNIX; strlcpy(sun_path, path, sizeof(sun_path)); @@ -178,8 +178,8 @@ struct TSockAddrLocal: public sockaddr_un, public ISockAddr { return (const struct sockaddr*)(const struct sockaddr_un*)this; } - TString ToString() const override { - return TString(sun_path); + TString ToString() const override { + return TString(sun_path); } TFsPath ToPath() const { @@ -222,11 +222,11 @@ struct TSockAddrInet: public sockaddr_in, public ISockAddr { return Size(); } - inline void Clear() noexcept { + inline void Clear() noexcept { Zero(*(sockaddr_in*)this); } - inline void Set(TIpHost ip, TIpPort port) noexcept { + inline void Set(TIpHost ip, TIpPort port) noexcept { Clear(); sin_family = AF_INET; sin_addr.s_addr = ip; @@ -241,7 +241,7 @@ struct TSockAddrInet: public sockaddr_in, public ISockAddr { return (const struct sockaddr*)(const struct sockaddr_in*)this; } - TString ToString() const override { + TString ToString() const override { return IpToString(sin_addr.s_addr) + ":" + ::ToString(InetToHost(sin_port)); } @@ -258,11 +258,11 @@ struct TSockAddrInet: public sockaddr_in, public ISockAddr { return 0; } - TIpHost GetIp() const noexcept { + TIpHost GetIp() const noexcept { return sin_addr.s_addr; } - TIpPort GetPort() const noexcept { + TIpPort GetPort() const noexcept { return InetToHost(sin_port); } @@ -288,11 +288,11 @@ struct TSockAddrInet6: public sockaddr_in6, public ISockAddr { return Size(); } - inline void Clear() noexcept { + inline void Clear() noexcept { Zero(*(sockaddr_in6*)this); } - inline void Set(const char* ip6, const TIpPort port) noexcept { + inline void Set(const char* ip6, const TIpPort port) noexcept { Clear(); sin6_family = AF_INET6; inet_pton(AF_INET6, ip6, &sin6_addr); @@ -307,7 +307,7 @@ struct TSockAddrInet6: public sockaddr_in6, public ISockAddr { return (const struct sockaddr*)(const struct sockaddr_in6*)this; } - TString ToString() const override { + TString ToString() const override { return "[" + GetIp() + "]:" + ::ToString(InetToHost(sin6_port)); } @@ -324,13 +324,13 @@ struct TSockAddrInet6: public sockaddr_in6, public ISockAddr { return 0; } - TString GetIp() const noexcept { + TString GetIp() const noexcept { char ip6[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, (void*)&sin6_addr, ip6, INET6_ADDRSTRLEN); - return TString(ip6); + return TString(ip6); } - TIpPort GetPort() const noexcept { + TIpPort GetPort() const noexcept { return InetToHost(sin6_port); } @@ -583,9 +583,9 @@ public: Socket = socket; } - TStreamSocketOutput(TStreamSocketOutput&&) noexcept = default; - TStreamSocketOutput& operator=(TStreamSocketOutput&&) noexcept = default; - + TStreamSocketOutput(TStreamSocketOutput&&) noexcept = default; + TStreamSocketOutput& operator=(TStreamSocketOutput&&) noexcept = default; + protected: TStreamSocket* Socket; diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 4f6e8043462..7f117a47b7b 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -103,7 +103,7 @@ static const evpair evpairs_to_unix[] = { static const size_t nevpairs_to_unix = sizeof(evpairs_to_unix) / sizeof(evpairs_to_unix[0]); -static int convert_events(int events, const evpair* evpairs, size_t nevpairs, bool ignoreUnknown) noexcept { +static int convert_events(int events, const evpair* evpairs, size_t nevpairs, bool ignoreUnknown) noexcept { int result = 0; for (size_t i = 0; i < nevpairs; ++i) { int event = evpairs[i].event; @@ -127,21 +127,21 @@ private: HANDLE Event; public: - inline TWSAEventHolder(HANDLE event) noexcept + inline TWSAEventHolder(HANDLE event) noexcept : Event(event) { } - inline ~TWSAEventHolder() { + inline ~TWSAEventHolder() { WSACloseEvent(Event); } - inline HANDLE Get() noexcept { + inline HANDLE Get() noexcept { return Event; } }; -int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept { +int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept { HANDLE rawEvent = WSACreateEvent(); if (rawEvent == WSA_INVALID_EVENT) { errno = EIO; @@ -553,7 +553,7 @@ static ssize_t DoSendMsg(SOCKET sock, const struct iovec* iov, int iovcnt) { } #endif -void TSocketHolder::Close() noexcept { +void TSocketHolder::Close() noexcept { if (Fd_ != INVALID_SOCKET) { bool ok = (closesocket(Fd_) == 0); if (!ok) { @@ -585,7 +585,7 @@ public: inline ~TImpl() = default; - inline SOCKET Fd() const noexcept { + inline SOCKET Fd() const noexcept { return Fd_; } @@ -752,7 +752,7 @@ class TCommonSockOps: public TSocket::TOps { using TPart = TSocket::TPart; public: - inline TCommonSockOps() noexcept { + inline TCommonSockOps() noexcept { } ~TCommonSockOps() override = default; @@ -832,7 +832,7 @@ ssize_t TCommonSockOps::SendVPartial(SOCKET fd, const TPart* constParts, size_t return written; } -static inline TSocket::TOps* GetCommonSockOps() noexcept { +static inline TSocket::TOps* GetCommonSockOps() noexcept { return Singleton<TCommonSockOps>(); } @@ -868,7 +868,7 @@ TSocket::TSocket(const TNetworkAddress& addr, const TInstant& deadLine) TSocket::~TSocket() = default; -SOCKET TSocket::Fd() const noexcept { +SOCKET TSocket::Fd() const noexcept { return Impl_->Fd(); } @@ -888,7 +888,7 @@ void TSocket::Close() { Impl_->Close(); } -TSocketInput::TSocketInput(const TSocket& s) noexcept +TSocketInput::TSocketInput(const TSocket& s) noexcept : S_(s) { } @@ -905,12 +905,12 @@ size_t TSocketInput::DoRead(void* buf, size_t len) { ythrow TSystemError(-(int)ret) << "can not read from socket input stream"; } -TSocketOutput::TSocketOutput(const TSocket& s) noexcept +TSocketOutput::TSocketOutput(const TSocket& s) noexcept : S_(s) { } -TSocketOutput::~TSocketOutput() { +TSocketOutput::~TSocketOutput() { try { Finish(); } catch (...) { @@ -947,7 +947,7 @@ void TSocketOutput::DoWriteV(const TPart* parts, size_t count) { namespace { //https://bugzilla.mozilla.org/attachment.cgi?id=503263&action=diff - struct TLocalNames: public THashSet<TStringBuf> { + struct TLocalNames: public THashSet<TStringBuf> { inline TLocalNames() { insert("localhost"); insert("localhost.localdomain"); @@ -1004,7 +1004,7 @@ public: inline TImpl(const char* host, ui16 port, int flags) : Info_(nullptr, TAddrInfoDeleter{}) { - const TString port_st(ToString(port)); + const TString port_st(ToString(port)); struct addrinfo hints; memset(&hints, 0, sizeof(hints)); @@ -1054,7 +1054,7 @@ public: Info_.reset(hints.release()); } - inline struct addrinfo* Info() const noexcept { + inline struct addrinfo* Info() const noexcept { return Info_.get(); } @@ -1069,12 +1069,12 @@ TNetworkAddress::TNetworkAddress(const TUnixSocketPath& unixSocketPath, int flag { } -TNetworkAddress::TNetworkAddress(const TString& host, ui16 port, int flags) +TNetworkAddress::TNetworkAddress(const TString& host, ui16 port, int flags) : Impl_(new TImpl(host.data(), port, flags)) { } -TNetworkAddress::TNetworkAddress(const TString& host, ui16 port) +TNetworkAddress::TNetworkAddress(const TString& host, ui16 port) : Impl_(new TImpl(host.data(), port, 0)) { } @@ -1086,7 +1086,7 @@ TNetworkAddress::TNetworkAddress(ui16 port) TNetworkAddress::~TNetworkAddress() = default; -struct addrinfo* TNetworkAddress::Info() const noexcept { +struct addrinfo* TNetworkAddress::Info() const noexcept { return Impl_->Info(); } @@ -1227,7 +1227,7 @@ void SetDeferAccept(SOCKET s) { #endif } -ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept { +ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept { TInstant now = TInstant::Now(); do { diff --git a/util/network/socket.h b/util/network/socket.h index 40c8648b409..e19b77a5b69 100644 --- a/util/network/socket.h +++ b/util/network/socket.h @@ -42,7 +42,7 @@ struct pollfd { #define POLLNVAL (1 << 9) const char* inet_ntop(int af, const void* src, char* dst, socklen_t size); -int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept; +int poll(struct pollfd fds[], nfds_t nfds, int timeout) noexcept; #else #define poll(fds, nfds, timeout) WSAPoll(fds, nfds, timeout) #endif @@ -59,12 +59,12 @@ int inet_aton(const char* cp, struct in_addr* inp); #endif template <class T> -static inline int SetSockOpt(SOCKET s, int level, int optname, T opt) noexcept { +static inline int SetSockOpt(SOCKET s, int level, int optname, T opt) noexcept { return setsockopt(s, level, optname, (const char*)&opt, sizeof(opt)); } template <class T> -static inline int GetSockOpt(SOCKET s, int level, int optname, T& opt) noexcept { +static inline int GetSockOpt(SOCKET s, int level, int optname, T& opt) noexcept { socklen_t len = sizeof(opt); return getsockopt(s, level, optname, (char*)&opt, &len); @@ -174,11 +174,11 @@ public: { } - inline void Next() noexcept { + inline void Next() noexcept { C_ = C_->ai_next; } - inline TIterator operator++(int) noexcept { + inline TIterator operator++(int) noexcept { TIterator old(*this); Next(); @@ -186,25 +186,25 @@ public: return old; } - inline TIterator& operator++() noexcept { + inline TIterator& operator++() noexcept { Next(); return *this; } - friend inline bool operator==(const TIterator& l, const TIterator& r) noexcept { + friend inline bool operator==(const TIterator& l, const TIterator& r) noexcept { return l.C_ == r.C_; } - friend inline bool operator!=(const TIterator& l, const TIterator& r) noexcept { + friend inline bool operator!=(const TIterator& l, const TIterator& r) noexcept { return !(l == r); } - inline struct addrinfo& operator*() const noexcept { + inline struct addrinfo& operator*() const noexcept { return *C_; } - inline struct addrinfo* operator->() const noexcept { + inline struct addrinfo* operator->() const noexcept { return C_; } @@ -213,21 +213,21 @@ public: }; TNetworkAddress(ui16 port); - TNetworkAddress(const TString& host, ui16 port); - TNetworkAddress(const TString& host, ui16 port, int flags); + TNetworkAddress(const TString& host, ui16 port); + TNetworkAddress(const TString& host, ui16 port, int flags); TNetworkAddress(const TUnixSocketPath& unixSocketPath, int flags = 0); - ~TNetworkAddress(); + ~TNetworkAddress(); - inline TIterator Begin() const noexcept { + inline TIterator Begin() const noexcept { return TIterator(Info()); } - inline TIterator End() const noexcept { + inline TIterator End() const noexcept { return TIterator(nullptr); } private: - struct addrinfo* Info() const noexcept; + struct addrinfo* Info() const noexcept; private: class TImpl; @@ -260,31 +260,31 @@ public: return *this; } - inline ~TSocketHolder() { + inline ~TSocketHolder() { Close(); } - inline SOCKET Release() noexcept { + inline SOCKET Release() noexcept { SOCKET ret = Fd_; Fd_ = INVALID_SOCKET; return ret; } - void Close() noexcept; + void Close() noexcept; inline void ShutDown(int mode) const { ::ShutDown(Fd_, mode); } - inline void Swap(TSocketHolder& r) noexcept { + inline void Swap(TSocketHolder& r) noexcept { DoSwap(Fd_, r.Fd_); } - inline bool Closed() const noexcept { + inline bool Closed() const noexcept { return Fd_ == INVALID_SOCKET; } - inline operator SOCKET() const noexcept { + inline operator SOCKET() const noexcept { return Fd_; } @@ -316,7 +316,7 @@ public: TSocket(const TNetworkAddress& addr, const TDuration& timeOut); TSocket(const TNetworkAddress& addr, const TInstant& deadLine); - ~TSocket(); + ~TSocket(); template <class T> inline void SetSockOpt(int level, int optname, T opt) { @@ -377,12 +377,12 @@ public: */ ssize_t SendV(const TPart* parts, size_t count); - inline operator SOCKET() const noexcept { + inline operator SOCKET() const noexcept { return Fd(); } private: - SOCKET Fd() const noexcept; + SOCKET Fd() const noexcept; private: class TImpl; @@ -391,13 +391,13 @@ private: class TSocketInput: public IInputStream { public: - TSocketInput(const TSocket& s) noexcept; - ~TSocketInput() override; + TSocketInput(const TSocket& s) noexcept; + ~TSocketInput() override; - TSocketInput(TSocketInput&&) noexcept = default; - TSocketInput& operator=(TSocketInput&&) noexcept = default; - - const TSocket& GetSocket() const noexcept { + TSocketInput(TSocketInput&&) noexcept = default; + TSocketInput& operator=(TSocketInput&&) noexcept = default; + + const TSocket& GetSocket() const noexcept { return S_; } @@ -410,13 +410,13 @@ private: class TSocketOutput: public IOutputStream { public: - TSocketOutput(const TSocket& s) noexcept; - ~TSocketOutput() override; - - TSocketOutput(TSocketOutput&&) noexcept = default; - TSocketOutput& operator=(TSocketOutput&&) noexcept = default; + TSocketOutput(const TSocket& s) noexcept; + ~TSocketOutput() override; - const TSocket& GetSocket() const noexcept { + TSocketOutput(TSocketOutput&&) noexcept = default; + TSocketOutput& operator=(TSocketOutput&&) noexcept = default; + + const TSocket& GetSocket() const noexcept { return S_; } @@ -429,4 +429,4 @@ private: }; //return -(error code) if error occured, or number of ready fds -ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept; +ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept; diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp index 6b20e11f70a..6d700ac8af0 100644 --- a/util/network/socket_ut.cpp +++ b/util/network/socket_ut.cpp @@ -63,7 +63,7 @@ void TSockTest::TestTimeout() { } int realTimeout = (int)(millisec() - startTime); if (realTimeout > timeout + 2000) { - TString err = TStringBuilder() << "Timeout exceeded: " << realTimeout << " ms (expected " << timeout << " ms)"; + TString err = TStringBuilder() << "Timeout exceeded: " << realTimeout << " ms (expected " << timeout << " ms)"; UNIT_FAIL(err); } } @@ -74,7 +74,7 @@ void TSockTest::TestConnectionRefused() { } void TSockTest::TestNetworkResolutionError() { - TString errMsg; + TString errMsg; try { TNetworkAddress addr("", 0); } catch (const TNetworkResolutionError& e) { @@ -86,8 +86,8 @@ void TSockTest::TestNetworkResolutionError() { } int expectedErr = EAI_NONAME; - TString expectedErrMsg = gai_strerror(expectedErr); - if (errMsg.find(expectedErrMsg) == TString::npos) { + TString expectedErrMsg = gai_strerror(expectedErr); + if (errMsg.find(expectedErrMsg) == TString::npos) { UNIT_FAIL("TNetworkResolutionError contains\nInvalid msg: " + errMsg + "\nExpected msg: " + expectedErrMsg + "\n"); } } @@ -289,9 +289,9 @@ void TPollTest::TestPollInOut() { ui32 localIp = ntohl(inet_addr("127.0.0.1")); - TVector<TSimpleSharedPtr<TSocketHolder>> clientSockets; - TVector<TSimpleSharedPtr<TSocketHolder>> connectedSockets; - TVector<pollfd> fds; + TVector<TSimpleSharedPtr<TSocketHolder>> clientSockets; + TVector<TSimpleSharedPtr<TSocketHolder>> connectedSockets; + TVector<pollfd> fds; for (size_t i = 0; i < socketCount; ++i) { TSimpleSharedPtr<TSocketHolder> clientSocket(new TSocketHolder(StartClientSocket(localIp, port))); diff --git a/util/random/common_ops.h b/util/random/common_ops.h index 602eede3511..a88a5aa150b 100644 --- a/util/random/common_ops.h +++ b/util/random/common_ops.h @@ -33,7 +33,7 @@ namespace NPrivate { } template <class T> - static inline ui64 ToRand64(T&& rng, ui32 x) noexcept { + static inline ui64 ToRand64(T&& rng, ui32 x) noexcept { return ((ui64)x) | (((ui64)rng.GenRand()) << 32); } @@ -65,7 +65,7 @@ struct TCommonRNG { using TResult = TRandType; using result_type = TRandType; - inline T& Engine() noexcept { + inline T& Engine() noexcept { return static_cast<T&>(*this); } @@ -81,42 +81,42 @@ struct TCommonRNG { } /* generates uniformly distributed random number on [0, t) interval */ - inline TResult Uniform(TResult t) noexcept { + inline TResult Uniform(TResult t) noexcept { return ::NPrivate::GenUniform(t, Engine()); } /* generates uniformly distributed random number on [f, t) interval */ - inline TResult Uniform(TResult f, TResult t) noexcept { + inline TResult Uniform(TResult f, TResult t) noexcept { return f + Uniform(t - f); } /* generates 64-bit random number for current(may be 32 bit) rng */ - inline ui64 GenRand64() noexcept { + inline ui64 GenRand64() noexcept { return ::NPrivate::ToRand64(Engine(), Engine().GenRand()); } /* generates a random number on [0, 1]-real-interval */ - inline double GenRandReal1() noexcept { + inline double GenRandReal1() noexcept { return ::NPrivate::ToRandReal1(Engine().GenRand()); } /* generates a random number on [0, 1)-real-interval */ - inline double GenRandReal2() noexcept { + inline double GenRandReal2() noexcept { return ::NPrivate::ToRandReal2(Engine().GenRand()); } /* generates a random number on (0, 1)-real-interval */ - inline double GenRandReal3() noexcept { + inline double GenRandReal3() noexcept { return ::NPrivate::ToRandReal3(Engine().GenRand()); } /* generates a random number on [0, 1) with 53-bit resolution */ - inline double GenRandReal4() noexcept { + inline double GenRandReal4() noexcept { return ::NPrivate::ToRandReal4(Engine().GenRand64()); } //compatibility stuff - inline TResult operator()() noexcept { + inline TResult operator()() noexcept { return Engine().GenRand(); } diff --git a/util/random/common_ops_ut.cpp b/util/random/common_ops_ut.cpp index 905912bd1ed..f88a58d8472 100644 --- a/util/random/common_ops_ut.cpp +++ b/util/random/common_ops_ut.cpp @@ -10,7 +10,7 @@ Y_UNIT_TEST_SUITE(TestCommonRNG) { template <class T> struct TRng: public TCommonRNG<T, TRng<T>> { - inline T GenRand() noexcept { + inline T GenRand() noexcept { return IntHash(C_++); } diff --git a/util/random/easy.h b/util/random/easy.h index fd5b826fbe8..275d1607106 100644 --- a/util/random/easy.h +++ b/util/random/easy.h @@ -42,6 +42,6 @@ namespace NPrivate { }; } -static inline ::NPrivate::TRandom Random() noexcept { +static inline ::NPrivate::TRandom Random() noexcept { return {}; } diff --git a/util/random/fast.cpp b/util/random/fast.cpp index 2f98dfc5d35..43cc1f53b60 100644 --- a/util/random/fast.cpp +++ b/util/random/fast.cpp @@ -2,7 +2,7 @@ #include <util/stream/input.h> -static inline ui32 FixSeq(ui32 seq1, ui32 seq2) noexcept { +static inline ui32 FixSeq(ui32 seq1, ui32 seq2) noexcept { const ui32 mask = (~(ui32)(0)) >> 1; if ((seq1 & mask) == (seq2 & mask)) { @@ -12,13 +12,13 @@ static inline ui32 FixSeq(ui32 seq1, ui32 seq2) noexcept { return seq2; } -TFastRng64::TFastRng64(ui64 seed1, ui32 seq1, ui64 seed2, ui32 seq2) noexcept +TFastRng64::TFastRng64(ui64 seed1, ui32 seq1, ui64 seed2, ui32 seq2) noexcept : R1_(seed1, seq1) , R2_(seed2, FixSeq(seq1, seq2)) { } -TFastRng64::TArgs::TArgs(ui64 seed) noexcept { +TFastRng64::TArgs::TArgs(ui64 seed) noexcept { TReallyFastRng32 rng(seed); Seed1 = rng.GenRand64(); diff --git a/util/random/fast.h b/util/random/fast.h index ddc57116416..8aad8a489d7 100644 --- a/util/random/fast.h +++ b/util/random/fast.h @@ -9,7 +9,7 @@ // based on http://www.pcg-random.org/. See T*FastRng* family below. struct TPCGMixer { - static inline ui32 Mix(ui64 x) noexcept { + static inline ui32 Mix(ui64 x) noexcept { const ui32 xorshifted = ((x >> 18u) ^ x) >> 27u; const ui32 rot = x >> 59u; @@ -44,7 +44,7 @@ struct TReallyFastRng32: public TCommonRNG<ui32, TReallyFastRng32>, public TReal class TFastRng64: public TCommonRNG<ui64, TFastRng64> { public: struct TArgs { - TArgs(ui64 seed) noexcept; + TArgs(ui64 seed) noexcept; TArgs(IInputStream& entropy); ui64 Seed1; @@ -53,26 +53,26 @@ public: ui32 Seq2; }; - TFastRng64(ui64 seed1, ui32 seq1, ui64 seed2, ui32 seq2) noexcept; + TFastRng64(ui64 seed1, ui32 seq1, ui64 seed2, ui32 seq2) noexcept; /* * simplify constructions like * TFastRng64 rng(17); * TFastRng64 rng(Seek()); //from any IInputStream */ - inline TFastRng64(const TArgs& args) noexcept + inline TFastRng64(const TArgs& args) noexcept : TFastRng64(args.Seed1, args.Seq1, args.Seed2, args.Seq2) { } - inline ui64 GenRand() noexcept { + inline ui64 GenRand() noexcept { const ui64 x = R1_.GenRand(); const ui64 y = R2_.GenRand(); return (x << 32) | y; } - inline void Advance(ui64 delta) noexcept { + inline void Advance(ui64 delta) noexcept { R1_.Advance(delta); R2_.Advance(delta); } diff --git a/util/random/lcg_engine.cpp b/util/random/lcg_engine.cpp index e1469104fa4..01075e388a7 100644 --- a/util/random/lcg_engine.cpp +++ b/util/random/lcg_engine.cpp @@ -2,7 +2,7 @@ namespace NPrivate { template <typename T> - T LcgAdvance(T seed, T lcgBase, T lcgAddend, T delta) noexcept { + T LcgAdvance(T seed, T lcgBase, T lcgAddend, T delta) noexcept { // seed[n+1] = A * seed[n] + B, A = lcgBase, B = lcgAddend // seed[n] = A**n * seed[0] + (A**n - 1) / (A - 1) * B // (initial value of n) = m * 2**k + (lower bits of n) @@ -25,6 +25,6 @@ namespace NPrivate { return seed * apow + lcgAddend * adiv; } - template ui32 LcgAdvance<ui32>(ui32, ui32, ui32, ui32) noexcept; - template ui64 LcgAdvance<ui64>(ui64, ui64, ui64, ui64) noexcept; + template ui32 LcgAdvance<ui32>(ui32, ui32, ui32, ui32) noexcept; + template ui64 LcgAdvance<ui64>(ui64, ui64, ui64, ui64) noexcept; } diff --git a/util/random/lcg_engine.h b/util/random/lcg_engine.h index 08cc93c8457..a73d7aa7fc3 100644 --- a/util/random/lcg_engine.h +++ b/util/random/lcg_engine.h @@ -8,7 +8,7 @@ namespace NPrivate { template <typename T> - T LcgAdvance(T seed, T lcgBase, T lcgAddend, T delta) noexcept; + T LcgAdvance(T seed, T lcgBase, T lcgAddend, T delta) noexcept; }; template <typename T, T A, T C> @@ -19,23 +19,23 @@ struct TFastLcgIterator { return x * A + C; } - static inline T IterateMultiple(T x, T delta) noexcept { + static inline T IterateMultiple(T x, T delta) noexcept { return ::NPrivate::LcgAdvance(x, A, C, delta); } }; template <typename T, T A> struct TLcgIterator { - inline TLcgIterator(T seq) noexcept + inline TLcgIterator(T seq) noexcept : C((seq << 1u) | (T)1) // C must be odd { } - inline T Iterate(T x) noexcept { + inline T Iterate(T x) noexcept { return x * A + C; } - inline T IterateMultiple(T x, T delta) noexcept { + inline T IterateMultiple(T x, T delta) noexcept { return ::NPrivate::LcgAdvance(x, A, C, delta); } @@ -44,8 +44,8 @@ struct TLcgIterator { template <class TIterator, class TMixer> struct TLcgRngBase: public TIterator, public TMixer { - using TStateType = decltype(std::declval<TIterator>().Iterate(0)); - using TResultType = decltype(std::declval<TMixer>().Mix(TStateType())); + using TStateType = decltype(std::declval<TIterator>().Iterate(0)); + using TResultType = decltype(std::declval<TMixer>().Mix(TStateType())); template <typename... Args> inline TLcgRngBase(TStateType seed, Args&&... args) @@ -54,11 +54,11 @@ struct TLcgRngBase: public TIterator, public TMixer { { } - inline TResultType GenRand() noexcept { + inline TResultType GenRand() noexcept { return this->Mix(X = this->Iterate(X)); } - inline void Advance(TStateType delta) noexcept { + inline void Advance(TStateType delta) noexcept { X = this->IterateMultiple(X, delta); } diff --git a/util/random/mersenne.h b/util/random/mersenne.h index b2044604ac7..9e94c6e2f9e 100644 --- a/util/random/mersenne.h +++ b/util/random/mersenne.h @@ -26,10 +26,10 @@ class TMersenne: public TCommonRNG<T, TMersenne<T>>, public ::NPrivate::TMersenn public: using TBase = typename ::NPrivate::TMersenneTraits<T>::TImpl; - inline TMersenne() noexcept { + inline TMersenne() noexcept { } - inline TMersenne(T seed) noexcept + inline TMersenne(T seed) noexcept : TBase(seed) { } @@ -39,7 +39,7 @@ public: { } - inline TMersenne(const T* keys, size_t len) noexcept + inline TMersenne(const T* keys, size_t len) noexcept : TBase(keys, len) { } diff --git a/util/random/mersenne32.cpp b/util/random/mersenne32.cpp index cb8aad8b039..cc708702cce 100644 --- a/util/random/mersenne32.cpp +++ b/util/random/mersenne32.cpp @@ -10,7 +10,7 @@ using namespace NPrivate; #define UPPER_MASK 0x80000000UL #define LOWER_MASK 0x7fffffffUL -void TMersenne32::InitGenRand(ui32 s) noexcept { +void TMersenne32::InitGenRand(ui32 s) noexcept { mt[0] = s; for (mti = 1; mti < N; ++mti) { @@ -18,7 +18,7 @@ void TMersenne32::InitGenRand(ui32 s) noexcept { } } -void TMersenne32::InitByArray(const ui32 init_key[], size_t key_length) noexcept { +void TMersenne32::InitByArray(const ui32 init_key[], size_t key_length) noexcept { InitGenRand(19650218UL); ui32 i = 1; @@ -55,7 +55,7 @@ void TMersenne32::InitByArray(const ui32 init_key[], size_t key_length) noexcept mt[0] = 0x80000000UL; } -void TMersenne32::InitNext() noexcept { +void TMersenne32::InitNext() noexcept { int kk; ui32 y; ui32 mag01[2] = { diff --git a/util/random/mersenne32.h b/util/random/mersenne32.h index 861f3a3d387..5192f4b9d65 100644 --- a/util/random/mersenne32.h +++ b/util/random/mersenne32.h @@ -9,13 +9,13 @@ namespace NPrivate { static constexpr int N = 624; public: - inline TMersenne32(ui32 s = 19650218UL) noexcept + inline TMersenne32(ui32 s = 19650218UL) noexcept : mti(N + 1) { InitGenRand(s); } - inline TMersenne32(const ui32* init_key, size_t key_length) noexcept + inline TMersenne32(const ui32* init_key, size_t key_length) noexcept : mti(N + 1) { InitByArray(init_key, key_length); @@ -23,7 +23,7 @@ namespace NPrivate { TMersenne32(IInputStream& input); - inline ui32 GenRand() noexcept { + inline ui32 GenRand() noexcept { if (mti >= N) { InitNext(); } @@ -39,9 +39,9 @@ namespace NPrivate { } private: - void InitNext() noexcept; - void InitGenRand(ui32 s) noexcept; - void InitByArray(const ui32* init_key, size_t key_length) noexcept; + void InitNext() noexcept; + void InitGenRand(ui32 s) noexcept; + void InitByArray(const ui32* init_key, size_t key_length) noexcept; private: ui32 mt[N]; diff --git a/util/random/mersenne64.cpp b/util/random/mersenne64.cpp index 4ede2c6dca4..c74d7260207 100644 --- a/util/random/mersenne64.cpp +++ b/util/random/mersenne64.cpp @@ -10,7 +10,7 @@ using namespace NPrivate; -void TMersenne64::InitGenRand(ui64 seed) noexcept { +void TMersenne64::InitGenRand(ui64 seed) noexcept { mt[0] = seed; for (mti = 1; mti < NN; ++mti) { @@ -18,7 +18,7 @@ void TMersenne64::InitGenRand(ui64 seed) noexcept { } } -void TMersenne64::InitByArray(const ui64* init_key, size_t key_length) noexcept { +void TMersenne64::InitByArray(const ui64* init_key, size_t key_length) noexcept { ui64 i = 1; ui64 j = 0; ui64 k; @@ -57,7 +57,7 @@ void TMersenne64::InitByArray(const ui64* init_key, size_t key_length) noexcept mt[0] = ULL(1) << 63; } -void TMersenne64::InitNext() noexcept { +void TMersenne64::InitNext() noexcept { int i; ui64 x; ui64 mag01[2] = { diff --git a/util/random/mersenne64.h b/util/random/mersenne64.h index 12ca43b6afc..b4b03895d29 100644 --- a/util/random/mersenne64.h +++ b/util/random/mersenne64.h @@ -15,7 +15,7 @@ namespace NPrivate { InitGenRand(s); } - inline TMersenne64(const ui64* keys, size_t len) noexcept + inline TMersenne64(const ui64* keys, size_t len) noexcept : mti(NN + 1) { InitByArray(keys, len); @@ -23,7 +23,7 @@ namespace NPrivate { TMersenne64(IInputStream& input); - inline ui64 GenRand() noexcept { + inline ui64 GenRand() noexcept { if (mti >= NN) { InitNext(); } @@ -39,9 +39,9 @@ namespace NPrivate { } private: - void InitNext() noexcept; - void InitGenRand(ui64 seed) noexcept; - void InitByArray(const ui64* init_key, size_t key_length) noexcept; + void InitNext() noexcept; + void InitGenRand(ui64 seed) noexcept; + void InitByArray(const ui64* init_key, size_t key_length) noexcept; private: ui64 mt[NN]; diff --git a/util/random/normal_ut.cpp b/util/random/normal_ut.cpp index 42b6cc4ba2f..77e8050d243 100644 --- a/util/random/normal_ut.cpp +++ b/util/random/normal_ut.cpp @@ -16,7 +16,7 @@ Y_UNIT_TEST_SUITE(TestNormalDistribution) { template <class T> static void TestMD(std::function<T()> f, T m, T d) { - TVector<T> v; + TVector<T> v; v.reserve(20000); diff --git a/util/random/shuffle_ut.cpp b/util/random/shuffle_ut.cpp index 87cbae94c00..45f9baa262b 100644 --- a/util/random/shuffle_ut.cpp +++ b/util/random/shuffle_ut.cpp @@ -9,7 +9,7 @@ Y_UNIT_TEST_SUITE(TRandUtilsTest) { template <typename... A> static void TestRange(A&&... args) { - TString s0, s1; + TString s0, s1; ShuffleRange(s1, args...); s1 = "0"; ShuffleRange(s1, args...); @@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(TRandUtilsTest) { template <typename... A> static void TestIter(A&&... args) { - TString s0, s1; + TString s0, s1; auto f = [&]() { auto b = s1.begin(); diff --git a/util/str_stl.h b/util/str_stl.h index f1e137181d2..4038303dab7 100644 --- a/util/str_stl.h +++ b/util/str_stl.h @@ -2,7 +2,7 @@ #include <util/memory/alloc.h> #include <util/digest/numeric.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/string_hash.h> #include <util/generic/strbuf.h> #include <util/generic/typetraits.h> @@ -33,7 +33,7 @@ namespace std { namespace NHashPrivate { template <class T, bool needNumericHashing> struct THashHelper { - inline size_t operator()(const T& t) const noexcept { + inline size_t operator()(const T& t) const noexcept { return (size_t)t; // If you have a compilation error here, look at explanation below: // Probably error is caused by undefined template specialization of THash<T> // You can find examples of specialization in this file @@ -42,7 +42,7 @@ namespace NHashPrivate { template <class T> struct THashHelper<T, true> { - inline size_t operator()(const T& t) const noexcept { + inline size_t operator()(const T& t) const noexcept { return NumericHash(t); } }; @@ -63,7 +63,7 @@ struct hash: public NHashPrivate::THashHelper<T, std::is_scalar<T>::value && !st template <typename T> struct hash<const T*> { - inline size_t operator()(const T* t) const noexcept { + inline size_t operator()(const T* t) const noexcept { return NumericHash(t); } }; @@ -185,12 +185,12 @@ struct TEqualTo: public std::equal_to<T> { }; template <> -struct TEqualTo<TString>: public TEqualTo<TStringBuf> { +struct TEqualTo<TString>: public TEqualTo<TStringBuf> { using is_transparent = void; }; template <> -struct TEqualTo<TUtf16String>: public TEqualTo<TWtringBuf> { +struct TEqualTo<TUtf16String>: public TEqualTo<TWtringBuf> { using is_transparent = void; }; @@ -227,8 +227,8 @@ struct TCIEqualTo<TStringBuf> { }; template <> -struct TCIEqualTo<TString> { - inline bool operator()(const TString& a, const TString& b) const { +struct TCIEqualTo<TString> { + inline bool operator()(const TString& a, const TString& b) const { return a.size() == b.size() && strnicmp(a.data(), b.data(), a.size()) == 0; } }; @@ -238,12 +238,12 @@ struct TLess: public std::less<T> { }; template <> -struct TLess<TString>: public TLess<TStringBuf> { +struct TLess<TString>: public TLess<TStringBuf> { using is_transparent = void; }; template <> -struct TLess<TUtf16String>: public TLess<TWtringBuf> { +struct TLess<TUtf16String>: public TLess<TWtringBuf> { using is_transparent = void; }; @@ -257,12 +257,12 @@ struct TGreater: public std::greater<T> { }; template <> -struct TGreater<TString>: public TGreater<TStringBuf> { +struct TGreater<TString>: public TGreater<TStringBuf> { using is_transparent = void; }; template <> -struct TGreater<TUtf16String>: public TGreater<TWtringBuf> { +struct TGreater<TUtf16String>: public TGreater<TWtringBuf> { using is_transparent = void; }; diff --git a/util/stream/aligned.cpp b/util/stream/aligned.cpp index 2fd12d15b74..f25d78c7198 100644 --- a/util/stream/aligned.cpp +++ b/util/stream/aligned.cpp @@ -12,7 +12,7 @@ size_t TAlignedInput::DoSkip(size_t len) { return ret; } -size_t TAlignedInput::DoReadTo(TString& st, char ch) { +size_t TAlignedInput::DoReadTo(TString& st, char ch) { size_t ret = Stream_->ReadTo(st, ch); Position_ += ret; return ret; diff --git a/util/stream/aligned.h b/util/stream/aligned.h index 70e7be05a99..48262d80618 100644 --- a/util/stream/aligned.h +++ b/util/stream/aligned.h @@ -44,7 +44,7 @@ public: private: size_t DoRead(void* ptr, size_t len) override; size_t DoSkip(size_t len) override; - size_t DoReadTo(TString& st, char ch) override; + size_t DoReadTo(TString& st, char ch) override; ui64 DoReadAll(IOutputStream& out) override; private: @@ -64,9 +64,9 @@ public: { } - TAlignedOutput(TAlignedOutput&&) noexcept = default; - TAlignedOutput& operator=(TAlignedOutput&&) noexcept = default; - + TAlignedOutput(TAlignedOutput&&) noexcept = default; + TAlignedOutput& operator=(TAlignedOutput&&) noexcept = default; + size_t GetCurrentOffset() const { return Position_; } diff --git a/util/stream/buffer.cpp b/util/stream/buffer.cpp index 2facece4ea0..38c1012738d 100644 --- a/util/stream/buffer.cpp +++ b/util/stream/buffer.cpp @@ -34,7 +34,7 @@ public: Data_.Append(c); } - inline TBuffer& Buffer() const noexcept { + inline TBuffer& Buffer() const noexcept { return Data_; } @@ -71,7 +71,7 @@ TBufferOutput& TBufferOutput::operator=(TBufferOutput&&) noexcept = default; TBufferOutput::~TBufferOutput() = default; -TBuffer& TBufferOutput::Buffer() const noexcept { +TBuffer& TBufferOutput::Buffer() const noexcept { return Impl_->Buffer(); } @@ -99,11 +99,11 @@ TBufferInput::TBufferInput(const TBuffer& buffer) TBufferInput::~TBufferInput() = default; -const TBuffer& TBufferInput::Buffer() const noexcept { +const TBuffer& TBufferInput::Buffer() const noexcept { return Buf_; } -void TBufferInput::Rewind() noexcept { +void TBufferInput::Rewind() noexcept { Readed_ = 0; } diff --git a/util/stream/buffer.h b/util/stream/buffer.h index 9dc99dbe49f..feba91cc215 100644 --- a/util/stream/buffer.h +++ b/util/stream/buffer.h @@ -37,13 +37,13 @@ public: TBufferOutput(TBufferOutput&&) noexcept; TBufferOutput& operator=(TBufferOutput&&) noexcept; - - ~TBufferOutput() override; + + ~TBufferOutput() override; /** * @returns Buffer that this stream writes into. */ - TBuffer& Buffer() const noexcept; + TBuffer& Buffer() const noexcept; private: size_t DoNext(void** ptr) override; @@ -69,11 +69,11 @@ public: */ TBufferInput(const TBuffer& buffer); - ~TBufferInput() override; + ~TBufferInput() override; - const TBuffer& Buffer() const noexcept; + const TBuffer& Buffer() const noexcept; - void Rewind() noexcept; + void Rewind() noexcept; protected: size_t DoNext(const void** ptr, size_t len) override; diff --git a/util/stream/buffer_ut.cpp b/util/stream/buffer_ut.cpp index 34946961907..217af94161c 100644 --- a/util/stream/buffer_ut.cpp +++ b/util/stream/buffer_ut.cpp @@ -25,7 +25,7 @@ Y_UNIT_TEST_SUITE(TBufferTest) { TBuffer buffer("1234567890", 10); TBufferInput input(buffer); - TString tmp; + TString tmp; UNIT_ASSERT_VALUES_EQUAL(input.ReadTo(tmp, '3'), 3); UNIT_ASSERT_VALUES_EQUAL(tmp, "12"); diff --git a/util/stream/buffered.cpp b/util/stream/buffered.cpp index a00e592e1c4..289ff3d1a5f 100644 --- a/util/stream/buffered.cpp +++ b/util/stream/buffered.cpp @@ -62,10 +62,10 @@ public: return MemInput_.Skip(len); } - inline size_t ReadTo(TString& st, char to) { + inline size_t ReadTo(TString& st, char to) { st.clear(); - TString s_tmp; + TString s_tmp; size_t ret = 0; @@ -104,11 +104,11 @@ public: } private: - inline size_t BufLen() const noexcept { + inline size_t BufLen() const noexcept { return AdditionalDataLength(); } - inline void* Buf() const noexcept { + inline void* Buf() const noexcept { return AdditionalData(); } @@ -139,7 +139,7 @@ size_t TBufferedInput::DoNext(const void** ptr, size_t len) { return Impl_->Next(ptr, len); } -size_t TBufferedInput::DoReadTo(TString& st, char ch) { +size_t TBufferedInput::DoReadTo(TString& st, char ch) { return Impl_->ReadTo(st, ch); } @@ -227,11 +227,11 @@ public: MemOut_.Write(c); } - inline void SetFlushPropagateMode(bool mode) noexcept { + inline void SetFlushPropagateMode(bool mode) noexcept { PropagateFlush_ = mode; } - inline void SetFinishPropagateMode(bool mode) noexcept { + inline void SetFinishPropagateMode(bool mode) noexcept { PropagateFinish_ = mode; } @@ -269,17 +269,17 @@ private: } } - inline size_t Stored() const noexcept { + inline size_t Stored() const noexcept { return Len() - MemOut_.Avail(); } - inline size_t DownToBufferGranularity(size_t l) const noexcept { + inline size_t DownToBufferGranularity(size_t l) const noexcept { return l - (l % Len()); } virtual void OnBufferExhausted() = 0; - virtual void* Buf() const noexcept = 0; - virtual size_t Len() const noexcept = 0; + virtual void* Buf() const noexcept = 0; + virtual size_t Len() const noexcept = 0; private: IOutputStream* Slave_; @@ -301,11 +301,11 @@ namespace { void OnBufferExhausted() final { } - void* Buf() const noexcept override { + void* Buf() const noexcept override { return AdditionalData(); } - size_t Len() const noexcept override { + size_t Len() const noexcept override { return AdditionalDataLength(); } }; @@ -333,11 +333,11 @@ namespace { } } - void* Buf() const noexcept override { + void* Buf() const noexcept override { return (void*)B_.Data(); } - size_t Len() const noexcept override { + size_t Len() const noexcept override { return B_.Capacity(); } @@ -359,7 +359,7 @@ TBufferedOutputBase::TBufferedOutputBase(IOutputStream* slave, size_t buflen) TBufferedOutputBase::TBufferedOutputBase(TBufferedOutputBase&&) noexcept = default; TBufferedOutputBase& TBufferedOutputBase::operator=(TBufferedOutputBase&&) noexcept = default; -TBufferedOutputBase::~TBufferedOutputBase() { +TBufferedOutputBase::~TBufferedOutputBase() { try { Finish(); } catch (...) { @@ -401,13 +401,13 @@ void TBufferedOutputBase::DoFinish() { } } -void TBufferedOutputBase::SetFlushPropagateMode(bool propagate) noexcept { +void TBufferedOutputBase::SetFlushPropagateMode(bool propagate) noexcept { if (Impl_.Get()) { Impl_->SetFlushPropagateMode(propagate); } } -void TBufferedOutputBase::SetFinishPropagateMode(bool propagate) noexcept { +void TBufferedOutputBase::SetFinishPropagateMode(bool propagate) noexcept { if (Impl_.Get()) { Impl_->SetFinishPropagateMode(propagate); } diff --git a/util/stream/buffered.h b/util/stream/buffered.h index 0847186141f..93798e5eca5 100644 --- a/util/stream/buffered.h +++ b/util/stream/buffered.h @@ -27,7 +27,7 @@ public: TBufferedInput(TBufferedInput&&) noexcept; TBufferedInput& operator=(TBufferedInput&&) noexcept; - ~TBufferedInput() override; + ~TBufferedInput() override; /** * Switches the underlying stream to the one provided. Does not clear the @@ -39,7 +39,7 @@ public: protected: size_t DoRead(void* buf, size_t len) override; - size_t DoReadTo(TString& st, char ch) override; + size_t DoReadTo(TString& st, char ch) override; size_t DoSkip(size_t len) override; size_t DoNext(const void** ptr, size_t len) override; @@ -81,15 +81,15 @@ public: TBufferedOutputBase(TBufferedOutputBase&&) noexcept; TBufferedOutputBase& operator=(TBufferedOutputBase&&) noexcept; - - ~TBufferedOutputBase() override; + + ~TBufferedOutputBase() override; /** * @param propagate Whether `Flush` and `Finish` calls should * be propagated to the underlying stream. * By default they are not. */ - inline void SetPropagateMode(bool propagate) noexcept { + inline void SetPropagateMode(bool propagate) noexcept { SetFlushPropagateMode(propagate); SetFinishPropagateMode(propagate); } @@ -99,14 +99,14 @@ public: * to the underlying stream. By default they * are not. */ - void SetFlushPropagateMode(bool propagate) noexcept; + void SetFlushPropagateMode(bool propagate) noexcept; /** * @param propagate Whether `Finish` calls should be propagated * to the underlying stream. By default they * are not. */ - void SetFinishPropagateMode(bool propagate) noexcept; + void SetFinishPropagateMode(bool propagate) noexcept; class TImpl; @@ -130,10 +130,10 @@ private: class TBufferedOutput: public TBufferedOutputBase { public: TBufferedOutput(IOutputStream* slave, size_t buflen = 8192); - ~TBufferedOutput() override; - - TBufferedOutput(TBufferedOutput&&) noexcept = default; - TBufferedOutput& operator=(TBufferedOutput&&) noexcept = default; + ~TBufferedOutput() override; + + TBufferedOutput(TBufferedOutput&&) noexcept = default; + TBufferedOutput& operator=(TBufferedOutput&&) noexcept = default; }; /** @@ -145,10 +145,10 @@ public: class TAdaptiveBufferedOutput: public TBufferedOutputBase { public: TAdaptiveBufferedOutput(IOutputStream* slave); - ~TAdaptiveBufferedOutput() override; - - TAdaptiveBufferedOutput(TAdaptiveBufferedOutput&&) noexcept = default; - TAdaptiveBufferedOutput& operator=(TAdaptiveBufferedOutput&&) noexcept = default; + ~TAdaptiveBufferedOutput() override; + + TAdaptiveBufferedOutput(TAdaptiveBufferedOutput&&) noexcept = default; + TAdaptiveBufferedOutput& operator=(TAdaptiveBufferedOutput&&) noexcept = default; }; namespace NPrivate { @@ -170,13 +170,13 @@ namespace NPrivate { * A mixin class that turns unbuffered stream into a buffered one. * * Note that using this mixin with a stream that is already buffered won't - * result in double buffering, e.g. `TBuffered<TBuffered<TUnbufferedFileInput>>` and - * `TBuffered<TUnbufferedFileInput>` are basically the same types. + * result in double buffering, e.g. `TBuffered<TBuffered<TUnbufferedFileInput>>` and + * `TBuffered<TUnbufferedFileInput>` are basically the same types. * * Example usage: * @code - * TBuffered<TUnbufferedFileInput> file_input(1024, "/path/to/file"); - * TBuffered<TUnbufferedFileOutput> file_output(1024, "/path/to/file"); + * TBuffered<TUnbufferedFileInput> file_input(1024, "/path/to/file"); + * TBuffered<TUnbufferedFileOutput> file_output(1024, "/path/to/file"); * @endcode * Here 1024 is the size of the buffer. */ @@ -211,7 +211,7 @@ public: * * Example usage: * @code - * TAdaptivelyBuffered<TUnbufferedFileOutput> file_output("/path/to/file"); + * TAdaptivelyBuffered<TUnbufferedFileOutput> file_output("/path/to/file"); * @endcode */ template <class TSlave> diff --git a/util/stream/buffered_ut.cpp b/util/stream/buffered_ut.cpp index 41d2fc30308..d6e33fc3d7b 100644 --- a/util/stream/buffered_ut.cpp +++ b/util/stream/buffered_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/random/mersenne.h> Y_UNIT_TEST_SUITE(TestBufferedIO) { @@ -12,7 +12,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) { for (size_t i = 0; i < 1000; ++i) { const size_t c = r.GenRand() % 10000; - TString s; + TString s; for (size_t j = 0; j < c; ++j) { s.append('A' + (r.GenRand() % 10)); @@ -23,8 +23,8 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) { } Y_UNIT_TEST(TestEqual) { - TString s1; - TString s2; + TString s1; + TString s2; Run(TBuffered<TStringOutput>(8000, s1)); Run(TAdaptivelyBuffered<TStringOutput>(s2)); @@ -33,7 +33,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) { } Y_UNIT_TEST(Test1) { - TString s; + TString s; TBuffered<TStringOutput>(100, s).Write("1", 1); @@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) { } Y_UNIT_TEST(Test2) { - TString s; + TString s; TBuffered<TStringOutput>(1, s).Write("12", 2); @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) { } Y_UNIT_TEST(Test3) { - TString s; + TString s; auto&& b = TBuffered<TStringOutput>(1, s); @@ -108,7 +108,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) { } Y_UNIT_TEST(TestInput) { - TString s("0123456789abcdefghijklmn"); + TString s("0123456789abcdefghijklmn"); TBuffered<TStringInput> in(5, s); char c; UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); //1 @@ -129,9 +129,9 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) { } Y_UNIT_TEST(TestReadTo) { - TString s("0123456789abc"); + TString s("0123456789abc"); TBuffered<TStringInput> in(2, s); - TString t; + TString t; UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, '7'), 8); UNIT_ASSERT_VALUES_EQUAL(t, "0123456"); UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, '8'), 1); diff --git a/util/stream/debug.cpp b/util/stream/debug.cpp index afd5b3e1c73..b9255b7a85e 100644 --- a/util/stream/debug.cpp +++ b/util/stream/debug.cpp @@ -45,6 +45,6 @@ IOutputStream& StdDbgStream() noexcept { return *(Singleton<TDbgSelector>()->Out); } -int StdDbgLevel() noexcept { +int StdDbgLevel() noexcept { return Singleton<TDbgSelector>()->Level; } diff --git a/util/stream/debug.h b/util/stream/debug.h index 92d6d4b42da..86601ea0ba7 100644 --- a/util/stream/debug.h +++ b/util/stream/debug.h @@ -12,12 +12,12 @@ */ class TDebugOutput: public IOutputStream { public: - inline TDebugOutput() noexcept = default; + inline TDebugOutput() noexcept = default; ~TDebugOutput() override = default; - TDebugOutput(TDebugOutput&&) noexcept = default; - TDebugOutput& operator=(TDebugOutput&&) noexcept = default; - + TDebugOutput(TDebugOutput&&) noexcept = default; + TDebugOutput& operator=(TDebugOutput&&) noexcept = default; + private: void DoWrite(const void* buf, size_t len) override; }; @@ -39,7 +39,7 @@ IOutputStream& StdDbgStream() noexcept; * @see ETraceLevel * @see DBGTRACE */ -int StdDbgLevel() noexcept; +int StdDbgLevel() noexcept; /** * Standard debug stream. diff --git a/util/stream/direct_io.cpp b/util/stream/direct_io.cpp index 649033af341..c759d32b8e3 100644 --- a/util/stream/direct_io.cpp +++ b/util/stream/direct_io.cpp @@ -33,7 +33,7 @@ void TRandomAccessFileOutput::DoFlush() { File->FlushData(); } -TBufferedFileOutputEx::TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen) +TBufferedFileOutputEx::TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen) : TRandomAccessFileOutput(*(new TDirectIOBufferedFile(path, oMode, buflen))) , FileHolder(File) { diff --git a/util/stream/direct_io.h b/util/stream/direct_io.h index 2e1f2e07dd7..f7dc39d4a02 100644 --- a/util/stream/direct_io.h +++ b/util/stream/direct_io.h @@ -21,9 +21,9 @@ class TRandomAccessFileOutput: public IOutputStream { public: TRandomAccessFileOutput(TDirectIOBufferedFile& file); - TRandomAccessFileOutput(TRandomAccessFileOutput&&) noexcept = default; - TRandomAccessFileOutput& operator=(TRandomAccessFileOutput&&) noexcept = default; - + TRandomAccessFileOutput(TRandomAccessFileOutput&&) noexcept = default; + TRandomAccessFileOutput& operator=(TRandomAccessFileOutput&&) noexcept = default; + protected: TDirectIOBufferedFile* File; @@ -34,7 +34,7 @@ private: class TBufferedFileOutputEx: public TRandomAccessFileOutput { public: - TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen = 1 << 17); + TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen = 1 << 17); private: void DoFlush() override; diff --git a/util/stream/direct_io_ut.cpp b/util/stream/direct_io_ut.cpp index 01d09db232c..00567f6ed1d 100644 --- a/util/stream/direct_io_ut.cpp +++ b/util/stream/direct_io_ut.cpp @@ -1,6 +1,6 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/array_size.h> #include <util/system/env.h> @@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TDirectIOTests) { // filling file // TEMPLATE|TEMPLATE|TEMPLATE|... - const auto fileName = TString("test.file"); + const auto fileName = TString("test.file"); auto&& directIOBuffer = TDirectIOBufferedFile{fileName, RdWr | CreateAlways | mode}; { auto&& output = TRandomAccessFileOutput{directIOBuffer}; diff --git a/util/stream/file.cpp b/util/stream/file.cpp index dc5d2f63112..dfce45c0028 100644 --- a/util/stream/file.cpp +++ b/util/stream/file.cpp @@ -3,7 +3,7 @@ #include <util/memory/blob.h> #include <util/generic/yexception.h> -TUnbufferedFileInput::TUnbufferedFileInput(const TString& path) +TUnbufferedFileInput::TUnbufferedFileInput(const TString& path) : File_(path, OpenExisting | RdOnly | Seq) { if (!File_.IsOpen()) { @@ -11,7 +11,7 @@ TUnbufferedFileInput::TUnbufferedFileInput(const TString& path) } } -TUnbufferedFileInput::TUnbufferedFileInput(const TFile& file) +TUnbufferedFileInput::TUnbufferedFileInput(const TFile& file) : File_(file) { if (!File_.IsOpen()) { @@ -19,11 +19,11 @@ TUnbufferedFileInput::TUnbufferedFileInput(const TFile& file) } } -size_t TUnbufferedFileInput::DoRead(void* buf, size_t len) { +size_t TUnbufferedFileInput::DoRead(void* buf, size_t len) { return File_.ReadOrFail(buf, len); } -size_t TUnbufferedFileInput::DoSkip(size_t len) { +size_t TUnbufferedFileInput::DoSkip(size_t len) { if (len < 384) { /* Base implementation calls DoRead, which results in one system call * instead of three as in fair skip implementation. For small sizes @@ -42,7 +42,7 @@ size_t TUnbufferedFileInput::DoSkip(size_t len) { return newPos - oldPos; } -TUnbufferedFileOutput::TUnbufferedFileOutput(const TString& path) +TUnbufferedFileOutput::TUnbufferedFileOutput(const TString& path) : File_(path, CreateAlways | WrOnly | Seq) { if (!File_.IsOpen()) { @@ -50,7 +50,7 @@ TUnbufferedFileOutput::TUnbufferedFileOutput(const TString& path) } } -TUnbufferedFileOutput::TUnbufferedFileOutput(const TFile& file) +TUnbufferedFileOutput::TUnbufferedFileOutput(const TFile& file) : File_(file) { if (!File_.IsOpen()) { @@ -58,13 +58,13 @@ TUnbufferedFileOutput::TUnbufferedFileOutput(const TFile& file) } } -TUnbufferedFileOutput::~TUnbufferedFileOutput() = default; +TUnbufferedFileOutput::~TUnbufferedFileOutput() = default; -void TUnbufferedFileOutput::DoWrite(const void* buf, size_t len) { +void TUnbufferedFileOutput::DoWrite(const void* buf, size_t len) { File_.Write(buf, len); } -void TUnbufferedFileOutput::DoFlush() { +void TUnbufferedFileOutput::DoFlush() { if (File_.IsOpen()) { File_.Flush(); } @@ -87,7 +87,7 @@ TMappedFileInput::TMappedFileInput(const TFile& file) Reset(Impl_->Data(), Impl_->Size()); } -TMappedFileInput::TMappedFileInput(const TString& path) +TMappedFileInput::TMappedFileInput(const TString& path) : TMemoryInput(nullptr, 0) , Impl_(new TImpl(TFile(path, OpenExisting | RdOnly))) { diff --git a/util/stream/file.h b/util/stream/file.h index c1cf4f591d4..11b2ee7ff28 100644 --- a/util/stream/file.h +++ b/util/stream/file.h @@ -15,15 +15,15 @@ */ /** - * Unbuffered file input stream. + * Unbuffered file input stream. * * Note that the input is not buffered, which means that `ReadLine` calls will * be _very_ slow. */ -class TUnbufferedFileInput: public IInputStream { +class TUnbufferedFileInput: public IInputStream { public: - TUnbufferedFileInput(const TFile& file); - TUnbufferedFileInput(const TString& path); + TUnbufferedFileInput(const TFile& file); + TUnbufferedFileInput(const TString& path); private: size_t DoRead(void* buf, size_t len) override; @@ -39,8 +39,8 @@ private: class TMappedFileInput: public TMemoryInput { public: TMappedFileInput(const TFile& file); - TMappedFileInput(const TString& path); - ~TMappedFileInput() override; + TMappedFileInput(const TString& path); + ~TMappedFileInput() override; private: class TImpl; @@ -53,15 +53,15 @@ private: * Note that the output is unbuffered, thus writing in many small chunks is * likely to be quite slow. */ -class TUnbufferedFileOutput: public IOutputStream { +class TUnbufferedFileOutput: public IOutputStream { public: - TUnbufferedFileOutput(const TString& path); - TUnbufferedFileOutput(const TFile& file); - ~TUnbufferedFileOutput() override; - - TUnbufferedFileOutput(TUnbufferedFileOutput&&) noexcept = default; - TUnbufferedFileOutput& operator=(TUnbufferedFileOutput&&) noexcept = default; + TUnbufferedFileOutput(const TString& path); + TUnbufferedFileOutput(const TFile& file); + ~TUnbufferedFileOutput() override; + TUnbufferedFileOutput(TUnbufferedFileOutput&&) noexcept = default; + TUnbufferedFileOutput& operator=(TUnbufferedFileOutput&&) noexcept = default; + private: void DoWrite(const void* buf, size_t len) override; void DoFlush() override; @@ -75,34 +75,34 @@ private: * * @see TBuffered */ -class TFileInput: public TBuffered<TUnbufferedFileInput> { +class TFileInput: public TBuffered<TUnbufferedFileInput> { public: template <class T> - inline TFileInput(T&& t, size_t buf = 1 << 13) - : TBuffered<TUnbufferedFileInput>(buf, std::forward<T>(t)) + inline TFileInput(T&& t, size_t buf = 1 << 13) + : TBuffered<TUnbufferedFileInput>(buf, std::forward<T>(t)) { } - ~TFileInput() override = default; + ~TFileInput() override = default; }; /** * Buffered file output stream. * - * Currently deprecated, please use TFileOutput in new code. + * Currently deprecated, please use TFileOutput in new code. * * @deprecated * @see TBuffered */ -class TFixedBufferFileOutput: public TBuffered<TUnbufferedFileOutput> { +class TFixedBufferFileOutput: public TBuffered<TUnbufferedFileOutput> { public: template <class T> - inline TFixedBufferFileOutput(T&& t, size_t buf = 1 << 13) - : TBuffered<TUnbufferedFileOutput>(buf, std::forward<T>(t)) + inline TFixedBufferFileOutput(T&& t, size_t buf = 1 << 13) + : TBuffered<TUnbufferedFileOutput>(buf, std::forward<T>(t)) { } - ~TFixedBufferFileOutput() override = default; + ~TFixedBufferFileOutput() override = default; }; /** @} */ diff --git a/util/stream/file_ut.cpp b/util/stream/file_ut.cpp index ac0f09796ee..f6d4315564a 100644 --- a/util/stream/file_ut.cpp +++ b/util/stream/file_ut.cpp @@ -13,32 +13,32 @@ Y_UNIT_TEST_SUITE(TFileTest) { TTempFile tmp(TmpFileName); { - TUnbufferedFileOutput output(TmpFileName); + TUnbufferedFileOutput output(TmpFileName); output.Write(TmpFileContents, strlen(TmpFileContents)); } { - TUnbufferedFileInput input(TmpFileName); - TString s = input.ReadAll(); + TUnbufferedFileInput input(TmpFileName); + TString s = input.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(s, TmpFileContents); } { - TUnbufferedFileInput input(TmpFileName); + TUnbufferedFileInput input(TmpFileName); input.Skip(TmpFileSubstring - TmpFileContents); - TString s = input.ReadAll(); + TString s = input.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(s, "chivalrous plan"); } { - TUnbufferedFileOutput output(TFile::ForAppend(TmpFileName)); + TUnbufferedFileOutput output(TFile::ForAppend(TmpFileName)); output.Write(TmpFileContents, strlen(TmpFileContents)); } { - TUnbufferedFileInput input(TmpFileName); - TString s = input.ReadAll(); - UNIT_ASSERT_VALUES_EQUAL(s, TString::Join(TmpFileContents, TmpFileContents)); + TUnbufferedFileInput input(TmpFileName); + TString s = input.ReadAll(); + UNIT_ASSERT_VALUES_EQUAL(s, TString::Join(TmpFileContents, TmpFileContents)); } } @@ -46,13 +46,13 @@ Y_UNIT_TEST_SUITE(TFileTest) { TTempFile tmp(TmpFileName); { - TUnbufferedFileOutput output(TmpFileName); + TUnbufferedFileOutput output(TmpFileName); /* Write nothing. */ } { TMappedFileInput input(TmpFileName); - TString s = input.ReadAll(); + TString s = input.ReadAll(); UNIT_ASSERT(s.empty()); } } diff --git a/util/stream/format.h b/util/stream/format.h index b033208a1b0..830516991f1 100644 --- a/util/stream/format.h +++ b/util/stream/format.h @@ -113,7 +113,7 @@ namespace NFormatPrivate { if (str[0] == '-') { stream << '-'; - str.Skip(1); + str.Skip(1); } if (value.Flags & HF_ADDX) { diff --git a/util/stream/format_ut.cpp b/util/stream/format_ut.cpp index 43245aeb48e..3c83bce4a42 100644 --- a/util/stream/format_ut.cpp +++ b/util/stream/format_ut.cpp @@ -54,7 +54,7 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) { } { TStringStream ss; - TUtf16String w = UTF8ToWide("abcи"); + TUtf16String w = UTF8ToWide("abcи"); ss << HexText<wchar16>(w); UNIT_ASSERT_VALUES_EQUAL("0061 0062 0063 0438", ss.Str()); } diff --git a/util/stream/hex_ut.cpp b/util/stream/hex_ut.cpp index 5074a0b6168..c1b80ef5f7f 100644 --- a/util/stream/hex_ut.cpp +++ b/util/stream/hex_ut.cpp @@ -4,14 +4,14 @@ #include "str.h" Y_UNIT_TEST_SUITE(THexCodingTest) { - void TestImpl(const TString& data) { - TString encoded; + void TestImpl(const TString& data) { + TString encoded; TStringOutput encodedOut(encoded); HexEncode(data.data(), data.size(), encodedOut); UNIT_ASSERT_EQUAL(encoded.size(), data.size() * 2); - TString decoded; + TString decoded; TStringOutput decodedOut(decoded); HexDecode(encoded.data(), encoded.size(), decodedOut); @@ -19,7 +19,7 @@ Y_UNIT_TEST_SUITE(THexCodingTest) { } Y_UNIT_TEST(TestEncodeDecodeToStream) { - TString data = "100ABAcaba500,$%0987123456 \n\t\x01\x02\x03."; + TString data = "100ABAcaba500,$%0987123456 \n\t\x01\x02\x03."; TestImpl(data); } diff --git a/util/stream/input.cpp b/util/stream/input.cpp index 6e8170f2f9f..eb99b108092 100644 --- a/util/stream/input.cpp +++ b/util/stream/input.cpp @@ -4,7 +4,7 @@ #include <util/charset/wide.h> #include <util/memory/tempbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/generic/singleton.h> #include <util/string/cast.h> @@ -89,7 +89,7 @@ size_t IInputStream::ReadLine(TString& st) { } size_t IInputStream::ReadLine(TUtf16String& w) { - TString s; + TString s; size_t result = ReadLine(s); if (result) { @@ -100,7 +100,7 @@ size_t IInputStream::ReadLine(TUtf16String& w) { } TString IInputStream::ReadLine() { - TString ret; + TString ret; if (!ReadLine(ret)) { ythrow yexception() << "can not read line from stream"; @@ -110,7 +110,7 @@ TString IInputStream::ReadLine() { } TString IInputStream::ReadTo(char ch) { - TString ret; + TString ret; if (!ReadTo(ret, ch)) { ythrow yexception() << "can not read from stream"; @@ -146,7 +146,7 @@ size_t IInputStream::DoSkip(size_t sz) { } TString IInputStream::ReadAll() { - TString result; + TString result; TStringOutput stream(result); DoReadAll(stream); @@ -190,7 +190,7 @@ namespace { free(B_); } - size_t DoReadTo(TString& st, char ch) override { + size_t DoReadTo(TString& st, char ch) override { auto&& guard = Guard(M_); (void)guard; @@ -227,7 +227,7 @@ namespace { using TGetLine = TGetLineBase; #else struct TGetLine: public TGetLineBase { - size_t DoReadTo(TString& st, char ch) override { + size_t DoReadTo(TString& st, char ch) override { if (ch == '\n') { size_t len = 0; auto r = fgetln(F_, &len); @@ -285,7 +285,7 @@ void In<TString>(IInputStream& i, TString& s) { template <> void In<TUtf16String>(IInputStream& i, TUtf16String& w) { - TString s; + TString s; ReadUpToDelimiter(i, s); if (s.empty()) { diff --git a/util/stream/input.h b/util/stream/input.h index f0d5807ed27..f4432f7553e 100644 --- a/util/stream/input.h +++ b/util/stream/input.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/fwd.h> -#include <util/generic/noncopyable.h> +#include <util/generic/noncopyable.h> #include <util/system/defaults.h> class IOutputStream; @@ -21,11 +21,11 @@ public: IInputStream(IInputStream&&) noexcept { } - + IInputStream& operator=(IInputStream&&) noexcept { - return *this; + return *this; } - + /** * Reads some data from the stream. Note that this function might read less * data than what was requested. Use `Load` function if you want to read as @@ -66,7 +66,7 @@ public: * @returns Total number of characters read from the stream. * A return value of zero signals end of stream. */ - inline size_t ReadTo(TString& st, char ch) { + inline size_t ReadTo(TString& st, char ch) { return DoReadTo(st, ch); } @@ -98,7 +98,7 @@ public: * * @returns Contents of this stream as a string. */ - TString ReadAll(); + TString ReadAll(); /** * Reads all data from this stream and writes it into a provided output @@ -119,7 +119,7 @@ public: * because end of stream has already been * reached. */ - TString ReadLine(); + TString ReadLine(); /** * Reads all characters from the stream until the given character is @@ -132,7 +132,7 @@ public: * because end of stream has already been * reached. */ - TString ReadTo(char ch); + TString ReadTo(char ch); /** * Reads all data from the stream until the first occurrence of '\n' and @@ -143,7 +143,7 @@ public: * @returns Total number of characters read from the stream. * A return value of zero signals end of stream. */ - size_t ReadLine(TString& st); + size_t ReadLine(TString& st); /** * Reads UTF8 encoded characters from the stream the first occurrence of '\n', @@ -155,7 +155,7 @@ public: * @returns Total number of characters read from the stream. * A return value of zero signals end of stream. */ - size_t ReadLine(TUtf16String& w); + size_t ReadLine(TUtf16String& w); /** * Skips some data from the stream without reading / copying it. Note that @@ -204,7 +204,7 @@ protected: * A return value of zero signals end of stream. * @throws yexception If IO error occurs. */ - virtual size_t DoReadTo(TString& st, char ch); + virtual size_t DoReadTo(TString& st, char ch); /** * Reads all data from this stream and writes it into a provided output diff --git a/util/stream/input_ut.cpp b/util/stream/input_ut.cpp index 4a93f5458e6..dddb657def5 100644 --- a/util/stream/input_ut.cpp +++ b/util/stream/input_ut.cpp @@ -61,7 +61,7 @@ private: class TNoOutput: public IOutputStream { public: - TNoOutput() = default; + TNoOutput() = default; protected: void DoWrite(const void*, size_t) override { @@ -70,7 +70,7 @@ protected: class TSimpleStringInput: public IInputStream { public: - TSimpleStringInput(const TString& string) + TSimpleStringInput(const TString& string) : String_(string) { } @@ -89,7 +89,7 @@ protected: } private: - TString String_; + TString String_; }; Y_UNIT_TEST_SUITE(TInputTest) { @@ -108,7 +108,7 @@ Y_UNIT_TEST_SUITE(TInputTest) { TSimpleStringInput in("0123456789abc"); - TString t; + TString t; UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, '7'), 8); UNIT_ASSERT_VALUES_EQUAL(t, "0123456"); UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, 'z'), 5); @@ -120,7 +120,7 @@ Y_UNIT_TEST_SUITE(TInputTest) { Y_UNIT_TEST(TestReadLine) { TSimpleStringInput in("1\n22\n333"); - TString t; + TString t; UNIT_ASSERT_VALUES_EQUAL(in.ReadLine(t), 2); UNIT_ASSERT_VALUES_EQUAL(t, "1"); UNIT_ASSERT_VALUES_EQUAL(in.ReadLine(t), 3); @@ -148,7 +148,7 @@ Y_UNIT_TEST_SUITE(TInputTest) { stdIn.ForInput(text, [=] { - TString value; + TString value; Cin.ReadTo(value, delim); UNIT_ASSERT_VALUES_EQUAL(value, expectedValue); }); diff --git a/util/stream/ios_ut.cpp b/util/stream/ios_ut.cpp index 139f4296e50..3785c1d7272 100644 --- a/util/stream/ios_ut.cpp +++ b/util/stream/ios_ut.cpp @@ -53,14 +53,14 @@ public: UNIT_TEST_SUITE_REGISTRATION(TStreamsTest); void TStreamsTest::TestIStreamOperators() { - TString data("first line\r\nsecond\t\xd1\x82\xd0\xb5\xd1\x81\xd1\x82 line\r\n 1 -4 59 4320000000009999999 c\n -1.5 1e-110"); + TString data("first line\r\nsecond\t\xd1\x82\xd0\xb5\xd1\x81\xd1\x82 line\r\n 1 -4 59 4320000000009999999 c\n -1.5 1e-110"); TStringInput si(data); - TString l1; - TString l2; - TString l3; - TUtf16String w1; - TString l4; + TString l1; + TString l2; + TString l3; + TUtf16String w1; + TString l4; ui16 i1; i16 i2; i32 i3; @@ -120,7 +120,7 @@ void TStreamsTest::TestStringStream() { } void TStreamsTest::TestGenericRead() { - TString s("1234567890"); + TString s("1234567890"); TStringInput si(s); char buf[1024]; @@ -131,7 +131,7 @@ void TStreamsTest::TestGenericRead() { } void TStreamsTest::TestGenericWrite() { - TString s; + TString s; TStringOutput so(s); so.Write("123456", 6); @@ -141,7 +141,7 @@ void TStreamsTest::TestGenericWrite() { } void TStreamsTest::TestReadLine() { - TString data("1234\r\n5678\nqw"); + TString data("1234\r\n5678\nqw"); TStringInput si(data); UNIT_ASSERT_EQUAL(si.ReadLine(), "1234"); @@ -171,7 +171,7 @@ void TStreamsTest::TestMemoryStream() { class TMyStringOutput: public IOutputStream { public: - inline TMyStringOutput(TString& s, size_t buflen) noexcept + inline TMyStringOutput(TString& s, size_t buflen) noexcept : S_(s) , BufLen_(buflen) { @@ -185,7 +185,7 @@ public: } void DoWriteV(const TPart* p, size_t count) override { - TString s; + TString s; for (size_t i = 0; i < count; ++i) { s.append((const char*)p[i].buf, p[i].len); @@ -200,14 +200,14 @@ private: }; void TStreamsTest::TestBufferedIO() { - TString s; + TString s; { const size_t buflen = 7; TBuffered<TMyStringOutput> bo(buflen, s, buflen); for (size_t i = 0; i < 1000; ++i) { - TString str(" "); + TString str(" "); str += ToString(i % 10); bo.Write(str.data(), str.size()); @@ -223,7 +223,7 @@ void TStreamsTest::TestBufferedIO() { TBuffered<TStringInput> bi(buflen, s); for (size_t i = 0; i < 1000; ++i) { - TString str(" "); + TString str(" "); str += ToString(i % 10); char buf[3]; @@ -241,7 +241,7 @@ void TStreamsTest::TestBufferedIO() { { const size_t buflen = 13; TBuffered<TMyStringOutput> bo(buflen, s, buflen); - TString f = "1234567890"; + TString f = "1234567890"; for (size_t i = 0; i < 10; ++i) { f += f; @@ -257,7 +257,7 @@ void TStreamsTest::TestBufferedIO() { void TStreamsTest::TestBufferStream() { TBufferStream stream; - TString s = "test"; + TString s = "test"; stream.Write(s.data(), s.size()); char buf[5]; @@ -281,7 +281,7 @@ void TStreamsTest::TestBufferStream() { namespace { class TStringListInput: public IWalkInput { public: - TStringListInput(const TVector<TString>& data) + TStringListInput(const TVector<TString>& data) : Data_(data) , Index_(0) { @@ -293,14 +293,14 @@ namespace { return 0; } - const TString& string = Data_[Index_++]; + const TString& string = Data_[Index_++]; *ptr = string.data(); return string.size(); } private: - const TVector<TString>& Data_; + const TVector<TString>& Data_; size_t Index_; }; @@ -332,7 +332,7 @@ namespace { "123", "\t\r "}; void TestStreamReadTo1(IInputStream& input, const char* comment) { - TString tmp; + TString tmp; input.ReadTo(tmp, 'c'); UNIT_ASSERT_VALUES_EQUAL_C(tmp, "111a222b333", comment); @@ -348,7 +348,7 @@ namespace { } void TestStreamReadTo2(IInputStream& input, const char* comment) { - TString s; + TString s; size_t i = 0; while (input.ReadLine(s)) { UNIT_ASSERT_C(i < Y_ARRAY_SIZE(Expected), comment); @@ -368,7 +368,7 @@ namespace { } void TestStrokaInput(IInputStream& input, const char* comment) { - TString line; + TString line; ui32 i = 0; TInstant start = Now(); while (input.ReadLine(line)) { @@ -379,7 +379,7 @@ namespace { } template <class T> - void TestStreamReadTo(const TString& text, T test) { + void TestStreamReadTo(const TString& text, T test) { TStringInput is(text); test(is, "TStringInput"); TMemoryInput mi(text.data(), text.size()); @@ -390,7 +390,7 @@ namespace { TStringInput slave(text); TBufferedInput bdi(&slave); test(bdi, "TBufferedInput"); - TVector<TString> lst(1, text); + TVector<TString> lst(1, text); TStringListInput sli(lst); test(sli, "IWalkInput"); } @@ -400,15 +400,15 @@ void TStreamsTest::TestReadTo() { TestStreamReadTo("111a222b333c444d555e666f", TestStreamReadTo1); TestStreamReadTo(Text, TestStreamReadTo2); TestStreamReadTo("111a222b333c444d555e666f", TestStreamReadTo3); - TString withZero = "one"; + TString withZero = "one"; withZero.append('\0').append("two").append('\0').append("three"); TestStreamReadTo(withZero, TestStreamReadTo4); } void TStreamsTest::TestStrokaInput() { - TString s; + TString s; for (ui32 i = 0; i < 100000; ++i) { - TVector<char> d(i % 1000, 'a'); + TVector<char> d(i % 1000, 'a'); s.append(d.data(), d.size()); s.append('\n'); } @@ -416,9 +416,9 @@ void TStreamsTest::TestStrokaInput() { } void TStreamsTest::TestWtrokaInput() { - const TString s(Text); + const TString s(Text); TStringInput is(s); - TUtf16String w; + TUtf16String w; size_t i = 0; while (is.ReadLine(w)) { @@ -430,12 +430,12 @@ void TStreamsTest::TestWtrokaInput() { } void TStreamsTest::TestWtrokaOutput() { - TString s; + TString s; TStringOutput os(s); const size_t n = sizeof(Expected) / sizeof(Expected[0]); for (size_t i = 0; i < n; ++i) { - TUtf16String w = UTF8ToWide(Expected[i]); + TUtf16String w = UTF8ToWide(Expected[i]); os << w; diff --git a/util/stream/length.cpp b/util/stream/length.cpp index 9907fe2ac94..7358d01c9a7 100644 --- a/util/stream/length.cpp +++ b/util/stream/length.cpp @@ -28,7 +28,7 @@ size_t TCountingInput::DoSkip(size_t len) { return ret; } -size_t TCountingInput::DoReadTo(TString& st, char ch) { +size_t TCountingInput::DoReadTo(TString& st, char ch) { const size_t ret = Slave_->ReadTo(st, ch); Count_ += ret; return ret; diff --git a/util/stream/length.h b/util/stream/length.h index 4d508ae24d2..fd7aa18799a 100644 --- a/util/stream/length.h +++ b/util/stream/length.h @@ -22,7 +22,7 @@ public: ~TLengthLimitedInput() override = default; - inline ui64 Left() const noexcept { + inline ui64 Left() const noexcept { return Length_; } @@ -52,14 +52,14 @@ public: * \returns The total number of characters read from * this stream. */ - inline ui64 Counter() const noexcept { + inline ui64 Counter() const noexcept { return Count_; } private: size_t DoRead(void* buf, size_t len) override; size_t DoSkip(size_t len) override; - size_t DoReadTo(TString& st, char ch) override; + size_t DoReadTo(TString& st, char ch) override; ui64 DoReadAll(IOutputStream& out) override; private: @@ -80,14 +80,14 @@ public: ~TCountingOutput() override = default; - TCountingOutput(TCountingOutput&&) noexcept = default; - TCountingOutput& operator=(TCountingOutput&&) noexcept = default; - + TCountingOutput(TCountingOutput&&) noexcept = default; + TCountingOutput& operator=(TCountingOutput&&) noexcept = default; + /** * \returns The total number of characters written * into this stream. */ - inline ui64 Counter() const noexcept { + inline ui64 Counter() const noexcept { return Count_; } diff --git a/util/stream/length_ut.cpp b/util/stream/length_ut.cpp index 89684489544..3dd7f44abc6 100644 --- a/util/stream/length_ut.cpp +++ b/util/stream/length_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> Y_UNIT_TEST_SUITE(TestLengthIO) { Y_UNIT_TEST(TestLengthLimitedInput) { @@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(TestLengthIO) { TStringStream s1("abc\ndef\n"); TCountingInput l1(&s1); - TString s; + TString s; l1.ReadLine(s); UNIT_ASSERT_VALUES_EQUAL(l1.Counter(), 4); @@ -41,10 +41,10 @@ Y_UNIT_TEST_SUITE(TestLengthIO) { l1.Write('1'); UNIT_ASSERT_VALUES_EQUAL(l1.Counter(), 1); - l1.Write(TString("abcd")); + l1.Write(TString("abcd")); UNIT_ASSERT_VALUES_EQUAL(l1.Counter(), 5); - TString buf("aaa"); + TString buf("aaa"); IOutputStream::TPart parts[] = {{buf.data(), buf.size()}, {buf.data(), buf.size()}, {buf.data(), buf.size()}}; l1.Write(parts, 3); UNIT_ASSERT_VALUES_EQUAL(l1.Counter(), 14); diff --git a/util/stream/mem.cpp b/util/stream/mem.cpp index 22a3339e274..ac6cefd36cf 100644 --- a/util/stream/mem.cpp +++ b/util/stream/mem.cpp @@ -2,13 +2,13 @@ #include <util/generic/yexception.h> -TMemoryInput::TMemoryInput() noexcept +TMemoryInput::TMemoryInput() noexcept : Buf_(nullptr) , Len_(0) { } -TMemoryInput::TMemoryInput(const void* buf, size_t len) noexcept +TMemoryInput::TMemoryInput(const void* buf, size_t len) noexcept : Buf_((const char*)buf) , Len_(len) { diff --git a/util/stream/mem.h b/util/stream/mem.h index 18a5d467729..771d13d0677 100644 --- a/util/stream/mem.h +++ b/util/stream/mem.h @@ -15,7 +15,7 @@ */ class TMemoryInput: public IZeroCopyInputFastReadTo { public: - TMemoryInput() noexcept; + TMemoryInput() noexcept; /** * Constructs a stream that reads from the provided memory block. It's up @@ -25,29 +25,29 @@ public: * @param buf Memory block to use. * @param len Size of the memory block. */ - TMemoryInput(const void* buf, size_t len) noexcept; + TMemoryInput(const void* buf, size_t len) noexcept; explicit TMemoryInput(const TStringBuf buf) noexcept; - ~TMemoryInput() override; + ~TMemoryInput() override; - TMemoryInput(const TMemoryInput& other) noexcept + TMemoryInput(const TMemoryInput& other) noexcept : IZeroCopyInputFastReadTo() - , Buf_(other.Buf_) - , Len_(other.Len_) - { - } - - TMemoryInput& operator=(const TMemoryInput& other) noexcept { - if (this != &other) { - Buf_ = other.Buf_; - Len_ = other.Len_; - } - - return *this; - } - - TMemoryInput(TMemoryInput&&) noexcept = default; - TMemoryInput& operator=(TMemoryInput&&) noexcept = default; - + , Buf_(other.Buf_) + , Len_(other.Len_) + { + } + + TMemoryInput& operator=(const TMemoryInput& other) noexcept { + if (this != &other) { + Buf_ = other.Buf_; + Len_ = other.Len_; + } + + return *this; + } + + TMemoryInput(TMemoryInput&&) noexcept = default; + TMemoryInput& operator=(TMemoryInput&&) noexcept = default; + /** * Initializes this stream with a new memory block. It's up to the * user to make sure that the memory block doesn't get freed while this @@ -56,7 +56,7 @@ public: * @param buf New memory block to use. * @param len Size of the new memory block. */ - void Reset(const void* buf, size_t len) noexcept { + void Reset(const void* buf, size_t len) noexcept { Buf_ = (const char*)buf; Len_ = len; } @@ -64,14 +64,14 @@ public: /** * @returns Whether there is more data in the stream. */ - bool Exhausted() const noexcept { + bool Exhausted() const noexcept { return !Avail(); } /** * @returns Number of bytes available in the stream. */ - size_t Avail() const noexcept { + size_t Avail() const noexcept { return Len_; } @@ -79,7 +79,7 @@ public: * @returns Current read position in the memory block * used by this stream. */ - const char* Buf() const noexcept { + const char* Buf() const noexcept { return Buf_; } @@ -118,16 +118,16 @@ public: * @param buf Memory block to use. * @param len Size of the memory block. */ - TMemoryOutput(void* buf, size_t len) noexcept + TMemoryOutput(void* buf, size_t len) noexcept : Buf_(static_cast<char*>(buf)) , End_(Buf_ + len) { } - ~TMemoryOutput() override; - - TMemoryOutput(TMemoryOutput&&) noexcept = default; - TMemoryOutput& operator=(TMemoryOutput&&) noexcept = default; + ~TMemoryOutput() override; + TMemoryOutput(TMemoryOutput&&) noexcept = default; + TMemoryOutput& operator=(TMemoryOutput&&) noexcept = default; + /** * Initializes this stream with a new memory block. It's up to the * user to make sure that the memory block doesn't get freed while this @@ -136,7 +136,7 @@ public: * @param buf New memory block to use. * @param len Size of the new memory block. */ - inline void Reset(void* buf, size_t len) noexcept { + inline void Reset(void* buf, size_t len) noexcept { Buf_ = static_cast<char*>(buf); End_ = Buf_ + len; } @@ -145,7 +145,7 @@ public: * @returns Whether there is more space in the * stream for writing. */ - inline bool Exhausted() const noexcept { + inline bool Exhausted() const noexcept { return !Avail(); } @@ -153,7 +153,7 @@ public: * @returns Number of bytes available for writing * in the stream. */ - inline size_t Avail() const noexcept { + inline size_t Avail() const noexcept { return End_ - Buf_; } @@ -161,7 +161,7 @@ public: * @returns Current write position in the memory block * used by this stream. */ - inline char* Buf() const noexcept { + inline char* Buf() const noexcept { return Buf_; } diff --git a/util/stream/mem_ut.cpp b/util/stream/mem_ut.cpp index f388ae66acf..5bc35d73bcc 100644 --- a/util/stream/mem_ut.cpp +++ b/util/stream/mem_ut.cpp @@ -4,10 +4,10 @@ Y_UNIT_TEST_SUITE(TestMemIO) { Y_UNIT_TEST(TestReadTo) { - TString s("0123456789abc"); + TString s("0123456789abc"); TMemoryInput in(s); - TString t; + TString t; UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, '7'), 8); UNIT_ASSERT_VALUES_EQUAL(t, "0123456"); UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, 'z'), 5); diff --git a/util/stream/multi.cpp b/util/stream/multi.cpp index b2354298a0c..23ebb23e7f4 100644 --- a/util/stream/multi.cpp +++ b/util/stream/multi.cpp @@ -22,7 +22,7 @@ size_t TMultiInput::DoRead(void* buf, size_t len) { return C_->Read(buf, len); } -size_t TMultiInput::DoReadTo(TString& st, char ch) { +size_t TMultiInput::DoReadTo(TString& st, char ch) { size_t ret = C_->ReadTo(st, ch); if (ret == st.size() + 1) { // found a symbol, not eof return ret; @@ -34,7 +34,7 @@ size_t TMultiInput::DoReadTo(TString& st, char ch) { if (ret == 0) { ret += C_->ReadTo(st, ch); } else { - TString tmp; + TString tmp; ret += C_->ReadTo(tmp, ch); st += tmp; } diff --git a/util/stream/multi.h b/util/stream/multi.h index 8bfd462d99e..2098b2732fb 100644 --- a/util/stream/multi.h +++ b/util/stream/multi.h @@ -13,12 +13,12 @@ class TMultiInput: public IInputStream { public: TMultiInput(IInputStream* f, IInputStream* s) noexcept; - ~TMultiInput() override; + ~TMultiInput() override; private: size_t DoRead(void* buf, size_t len) override; size_t DoSkip(size_t len) override; - size_t DoReadTo(TString& st, char ch) override; + size_t DoReadTo(TString& st, char ch) override; private: IInputStream* C_; diff --git a/util/stream/multi_ut.cpp b/util/stream/multi_ut.cpp index fc2553b5339..46611639bc7 100644 --- a/util/stream/multi_ut.cpp +++ b/util/stream/multi_ut.cpp @@ -15,16 +15,16 @@ Y_UNIT_TEST_SUITE(TestMultiInput) { { } void TestReadToResult(char c, size_t expectedRetval, - const TString& expectedValue, - const TString& initValue = "") { - TString t = initValue; + const TString& expectedValue, + const TString& initValue = "") { + TString t = initValue; UNIT_ASSERT_VALUES_EQUAL(MultiInput.ReadTo(t, c), expectedRetval); UNIT_ASSERT_VALUES_EQUAL(t, expectedValue); } }; Y_UNIT_TEST(TestReadTo) { - TString t; + TString t; TTestCase simpleCase("0123456789abc", "defghijk"); simpleCase.TestReadToResult('7', 8, "0123456"); diff --git a/util/stream/null.cpp b/util/stream/null.cpp index 4e8b298145b..54ae12e8949 100644 --- a/util/stream/null.cpp +++ b/util/stream/null.cpp @@ -2,11 +2,11 @@ #include <util/generic/singleton.h> -TNullIO& NPrivate::StdNullStream() noexcept { +TNullIO& NPrivate::StdNullStream() noexcept { return *SingletonWithPriority<TNullIO, 4>(); } -TNullInput::TNullInput() noexcept { +TNullInput::TNullInput() noexcept { } TNullInput::~TNullInput() = default; @@ -23,14 +23,14 @@ size_t TNullInput::DoNext(const void**, size_t) { return 0; } -TNullOutput::TNullOutput() noexcept = default; +TNullOutput::TNullOutput() noexcept = default; TNullOutput::~TNullOutput() = default; void TNullOutput::DoWrite(const void* /*buf*/, size_t /*len*/) { } -TNullIO::TNullIO() noexcept { +TNullIO::TNullIO() noexcept { } TNullIO::~TNullIO() = default; diff --git a/util/stream/null.h b/util/stream/null.h index 8c335a9a789..efccfaab4c6 100644 --- a/util/stream/null.h +++ b/util/stream/null.h @@ -13,8 +13,8 @@ */ class TNullInput: public IZeroCopyInput { public: - TNullInput() noexcept; - ~TNullInput() override; + TNullInput() noexcept; + ~TNullInput() override; private: size_t DoRead(void* buf, size_t len) override; @@ -27,12 +27,12 @@ private: */ class TNullOutput: public IOutputStream { public: - TNullOutput() noexcept; - ~TNullOutput() override; - - TNullOutput(TNullOutput&&) noexcept = default; - TNullOutput& operator=(TNullOutput&&) noexcept = default; + TNullOutput() noexcept; + ~TNullOutput() override; + TNullOutput(TNullOutput&&) noexcept = default; + TNullOutput& operator=(TNullOutput&&) noexcept = default; + private: void DoWrite(const void* buf, size_t len) override; }; @@ -45,12 +45,12 @@ private: */ class TNullIO: public TNullInput, public TNullOutput { public: - TNullIO() noexcept; - ~TNullIO() override; + TNullIO() noexcept; + ~TNullIO() override; }; namespace NPrivate { - TNullIO& StdNullStream() noexcept; + TNullIO& StdNullStream() noexcept; } /** diff --git a/util/stream/output.cpp b/util/stream/output.cpp index db81b81b701..6ca2952f7fe 100644 --- a/util/stream/output.cpp +++ b/util/stream/output.cpp @@ -23,7 +23,7 @@ #if defined(_win_) #include <io.h> #endif - + constexpr size_t MAX_UTF8_BYTES = 4; // UTF-8-encoded code point takes between 1 and 4 bytes IOutputStream::IOutputStream() noexcept = default; @@ -260,13 +260,13 @@ namespace { class TAndroidStdOutput: public IOutputStream { public: - inline TAndroidStdOutput(TLogFuncPtr logFuncPtr) noexcept + inline TAndroidStdOutput(TLogFuncPtr logFuncPtr) noexcept : Buffer() , LogFuncPtr(logFuncPtr) { } - virtual ~TAndroidStdOutput() { + virtual ~TAndroidStdOutput() { } private: @@ -298,7 +298,7 @@ namespace { { } - virtual ~TStdErr() { + virtual ~TStdErr() { } private: @@ -314,7 +314,7 @@ namespace { { } - virtual ~TStdOut() { + virtual ~TStdOut() { } private: @@ -341,7 +341,7 @@ namespace { namespace { class TStdOutput: public IOutputStream { public: - inline TStdOutput(FILE* f) noexcept + inline TStdOutput(FILE* f) noexcept : F_(f) { } diff --git a/util/stream/output.h b/util/stream/output.h index 00eef50b958..0dc723e6f03 100644 --- a/util/stream/output.h +++ b/util/stream/output.h @@ -3,8 +3,8 @@ #include "fwd.h" #include "labeled.h" -#include <util/generic/noncopyable.h> -#include <util/generic/string.h> +#include <util/generic/noncopyable.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/typetraits.h> @@ -24,7 +24,7 @@ public: * Data block for output. */ struct TPart { - inline TPart(const void* Buf, size_t Len) noexcept + inline TPart(const void* Buf, size_t Len) noexcept : buf(Buf) , len(Len) { @@ -36,7 +36,7 @@ public: { } - inline TPart() noexcept + inline TPart() noexcept : buf(nullptr) , len(0) { @@ -44,7 +44,7 @@ public: inline ~TPart() = default; - static inline TPart CrLf() noexcept { + static inline TPart CrLf() noexcept { return TPart("\r\n", 2); } @@ -57,11 +57,11 @@ public: IOutputStream(IOutputStream&&) noexcept { } - + IOutputStream& operator=(IOutputStream&&) noexcept { - return *this; - }; - + return *this; + }; + /** * Writes into this stream. * diff --git a/util/stream/pipe.cpp b/util/stream/pipe.cpp index 51be1934a75..0fc2d721f48 100644 --- a/util/stream/pipe.cpp +++ b/util/stream/pipe.cpp @@ -7,7 +7,7 @@ class TPipeBase::TImpl { public: - inline TImpl(const TString& command, const char* mode) + inline TImpl(const TString& command, const char* mode) : Pipe_(nullptr) { #ifndef _freebsd_ @@ -21,7 +21,7 @@ public: } } - inline ~TImpl() { + inline ~TImpl() { if (Pipe_ != nullptr) { ::pclose(Pipe_); } @@ -31,14 +31,14 @@ public: FILE* Pipe_; }; -TPipeBase::TPipeBase(const TString& command, const char* mode) +TPipeBase::TPipeBase(const TString& command, const char* mode) : Impl_(new TImpl(command, mode)) { } TPipeBase::~TPipeBase() = default; -TPipeInput::TPipeInput(const TString& command) +TPipeInput::TPipeInput(const TString& command) : TPipeBase(command, "r") { } @@ -61,7 +61,7 @@ size_t TPipeInput::DoRead(void* buf, size_t len) { return bytesRead; } -TPipeOutput::TPipeOutput(const TString& command) +TPipeOutput::TPipeOutput(const TString& command) : TPipeBase(command, "w") { } @@ -87,7 +87,7 @@ TPipedBase::TPipedBase(PIPEHANDLE fd) { } -TPipedBase::~TPipedBase() { +TPipedBase::~TPipedBase() { if (Handle_.IsOpen()) { Handle_.Close(); } diff --git a/util/stream/pipe.h b/util/stream/pipe.h index 18525b9517d..8ffdbd1bdc7 100644 --- a/util/stream/pipe.h +++ b/util/stream/pipe.h @@ -5,7 +5,7 @@ #include <util/system/pipe.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> /** * @addtogroup Streams_Pipes @@ -24,8 +24,8 @@ protected: * @param mode Data transfer mode for the pipe. Use * "r" for reading and "w" for writing. */ - TPipeBase(const TString& command, const char* mode); - virtual ~TPipeBase(); + TPipeBase(const TString& command, const char* mode); + virtual ~TPipeBase(); protected: class TImpl; @@ -45,7 +45,7 @@ public: * * @param command Command line to start a process with. */ - TPipeInput(const TString& command); + TPipeInput(const TString& command); private: size_t DoRead(void* buf, size_t len) override; @@ -64,7 +64,7 @@ public: * * @param command Command line to start a process with. */ - TPipeOutput(const TString& command); + TPipeOutput(const TString& command); /** * Waits for the process to terminate and throws an exception if it ended @@ -79,7 +79,7 @@ private: class TPipedBase { protected: TPipedBase(PIPEHANDLE fd); - virtual ~TPipedBase(); + virtual ~TPipedBase(); protected: TPipeHandle Handle_; @@ -91,7 +91,7 @@ protected: class TPipedInput: public TPipedBase, public IInputStream { public: TPipedInput(PIPEHANDLE fd); - ~TPipedInput() override; + ~TPipedInput() override; private: size_t DoRead(void* buf, size_t len) override; @@ -103,7 +103,7 @@ private: class TPipedOutput: public TPipedBase, public IOutputStream { public: TPipedOutput(PIPEHANDLE fd); - ~TPipedOutput() override; + ~TPipedOutput() override; private: void DoWrite(const void* buf, size_t len) override; diff --git a/util/stream/printf_ut.cpp b/util/stream/printf_ut.cpp index 0eab1670625..d96789e96a3 100644 --- a/util/stream/printf_ut.cpp +++ b/util/stream/printf_ut.cpp @@ -2,7 +2,7 @@ #include "printf.h" #include "str.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <library/cpp/testing/unittest/registar.h> @@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(TStreamPrintfTest) { } Y_UNIT_TEST(TestLargePrintf) { - TString s = NUnitTest::RandomString(1000000); + TString s = NUnitTest::RandomString(1000000); TStringStream ss; Printf(ss, "%s", s.data()); diff --git a/util/stream/str.h b/util/stream/str.h index 028bd572c03..a3695b6840f 100644 --- a/util/stream/str.h +++ b/util/stream/str.h @@ -3,7 +3,7 @@ #include "zerocopy.h" #include "zerocopy_output.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/noncopyable.h> #include <util/generic/store_policy.h> @@ -29,19 +29,19 @@ public: * * @param s String to read from. */ - inline TStringInput(const TString& s) noexcept + inline TStringInput(const TString& s) noexcept : S_(&s) , Pos_(0) { } - TStringInput(const TString&&) = delete; + TStringInput(const TString&&) = delete; - ~TStringInput() override; - - TStringInput(TStringInput&&) noexcept = default; - TStringInput& operator=(TStringInput&&) noexcept = default; + ~TStringInput() override; + TStringInput(TStringInput&&) noexcept = default; + TStringInput& operator=(TStringInput&&) noexcept = default; + inline void Swap(TStringInput& s) noexcept { DoSwap(S_, s.S_); DoSwap(Pos_, s.Pos_); @@ -73,14 +73,14 @@ public: * * @param s String to append to. */ - inline TStringOutput(TString& s) noexcept + inline TStringOutput(TString& s) noexcept : S_(&s) { } TStringOutput(TStringOutput&& s) noexcept = default; - ~TStringOutput() override; + ~TStringOutput() override; /** * @param size Number of additional characters to @@ -107,7 +107,7 @@ private: /** * String input/output stream, similar to `std::stringstream`. */ -class TStringStream: private TEmbedPolicy<TString>, public TStringInput, public TStringOutput { +class TStringStream: private TEmbedPolicy<TString>, public TStringInput, public TStringOutput { using TEmbeddedString = TEmbedPolicy<TString>; public: @@ -118,7 +118,7 @@ public: { } - inline TStringStream(const TString& string) + inline TStringStream(const TString& string) : TEmbeddedString(string) , TStringInput(*TEmbeddedString::Ptr()) , TStringOutput(*TEmbeddedString::Ptr()) @@ -140,7 +140,7 @@ public: return *this; } - ~TStringStream() override; + ~TStringStream() override; /** * @returns Whether @c this contains any data @@ -152,14 +152,14 @@ public: /** * @returns String that this stream is writing into. */ - inline TString& Str() noexcept { + inline TString& Str() noexcept { return *Ptr(); } /** * @returns String that this stream is writing into. */ - inline const TString& Str() const noexcept { + inline const TString& Str() const noexcept { return *Ptr(); } @@ -168,7 +168,7 @@ public: * in this stream. The data is guaranteed * to be null-terminated. */ - inline const char* Data() const noexcept { + inline const char* Data() const noexcept { return Ptr()->data(); } @@ -178,7 +178,7 @@ public: * as the total number of characters * available for reading. */ - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return Ptr()->size(); } diff --git a/util/stream/str_ut.cpp b/util/stream/str_ut.cpp index fc6b46c31a4..416c924b305 100644 --- a/util/stream/str_ut.cpp +++ b/util/stream/str_ut.cpp @@ -8,39 +8,39 @@ const T ReturnConstTemp(); Y_UNIT_TEST_SUITE(TStringInputOutputTest) { Y_UNIT_TEST(Lvalue) { - TString str = "Hello, World!"; + TString str = "Hello, World!"; TStringInput input(str); - TString result = input.ReadAll(); + TString result = input.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(result, str); } Y_UNIT_TEST(ConstRef) { - TString str = "Hello, World!"; - const TString& r = str; + TString str = "Hello, World!"; + const TString& r = str; TStringInput input(r); - TString result = input.ReadAll(); + TString result = input.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(result, str); } Y_UNIT_TEST(NonConstRef) { - TString str = "Hello, World!"; - TString& r = str; + TString str = "Hello, World!"; + TString& r = str; TStringInput input(r); - TString result = input.ReadAll(); + TString result = input.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(result, str); } Y_UNIT_TEST(Transfer) { - TString inputString = "some_string"; + TString inputString = "some_string"; TStringInput input(inputString); - TString outputString; + TString outputString; TStringOutput output(outputString); TransferData(&input, &output); @@ -49,9 +49,9 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) { } Y_UNIT_TEST(SkipReadAll) { - TString string0 = "All animals are equal, but some animals are more equal than others."; + TString string0 = "All animals are equal, but some animals are more equal than others."; - TString string1; + TString string1; for (size_t i = 1; i <= string0.size(); i++) { string1 += string0.substr(0, i); } @@ -63,7 +63,7 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) { left -= input0.Skip(left); } - TString string2 = input0.ReadAll(); + TString string2 = input0.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(string2, string1.substr(5)); } @@ -78,8 +78,8 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) { } Y_UNIT_TEST(TestReadTo) { - TString s("0123456789abc"); - TString t; + TString s("0123456789abc"); + TString t; TStringInput in0(s); UNIT_ASSERT_VALUES_EQUAL(in0.ReadTo(t, '7'), 8); diff --git a/util/stream/tee.h b/util/stream/tee.h index c69e232fb9f..197d242ff5d 100644 --- a/util/stream/tee.h +++ b/util/stream/tee.h @@ -13,7 +13,7 @@ class TTeeOutput: public IOutputStream { public: TTeeOutput(IOutputStream* l, IOutputStream* r) noexcept; - ~TTeeOutput() override; + ~TTeeOutput() override; private: void DoWrite(const void* buf, size_t len) override; diff --git a/util/stream/tempbuf.cpp b/util/stream/tempbuf.cpp index 801a1fabb05..1f00c22dd35 100644 --- a/util/stream/tempbuf.cpp +++ b/util/stream/tempbuf.cpp @@ -1,7 +1,7 @@ #include "tempbuf.h" namespace { - static inline size_t Next(size_t size) noexcept { + static inline size_t Next(size_t size) noexcept { return size * 2; } } diff --git a/util/stream/tempbuf.h b/util/stream/tempbuf.h index a6dc001025a..71a2a08d84e 100644 --- a/util/stream/tempbuf.h +++ b/util/stream/tempbuf.h @@ -5,9 +5,9 @@ #include <util/memory/tempbuf.h> class TTempBufOutput: public IOutputStream, public TTempBuf { -public: +public: inline TTempBufOutput() = default; - + explicit TTempBufOutput(size_t size) : TTempBuf(size) { @@ -15,7 +15,7 @@ public: TTempBufOutput(TTempBufOutput&&) noexcept = default; TTempBufOutput& operator=(TTempBufOutput&&) noexcept = default; - + protected: void DoWrite(const void* data, size_t len) override; }; diff --git a/util/stream/tokenizer.h b/util/stream/tokenizer.h index b2398efdd1a..944aada3a56 100644 --- a/util/stream/tokenizer.h +++ b/util/stream/tokenizer.h @@ -31,7 +31,7 @@ public: { } - inline TIterator() noexcept + inline TIterator() noexcept : Parent_(nullptr) , Data_(nullptr) , Len_(0) @@ -45,11 +45,11 @@ public: Next(); } - inline bool operator==(const TIterator& l) const noexcept { + inline bool operator==(const TIterator& l) const noexcept { return AtEnd_ == l.AtEnd_; } - inline bool operator!=(const TIterator& l) const noexcept { + inline bool operator!=(const TIterator& l) const noexcept { return !(*this == l); } @@ -57,7 +57,7 @@ public: * @return Return null-terminated character array with current token. * The pointer may be invalid after iterator increment. */ - inline const char* Data() const noexcept { + inline const char* Data() const noexcept { Y_ASSERT(!AtEnd_); return Data_; @@ -66,17 +66,17 @@ public: /** * @return Length of current token. */ - inline size_t Length() const noexcept { + inline size_t Length() const noexcept { Y_ASSERT(!AtEnd_); return Len_; } - inline TIterator* operator->() noexcept { + inline TIterator* operator->() noexcept { return this; } - inline TStringBuf operator*() noexcept { + inline TStringBuf operator*() noexcept { return TStringBuf{Data_, Len_}; } @@ -166,7 +166,7 @@ public: return TIterator{this}; } - inline TIterator end() noexcept { + inline TIterator end() noexcept { return {}; } @@ -180,11 +180,11 @@ private: return bytesRead; } - inline char* BufBegin() noexcept { + inline char* BufBegin() noexcept { return Buf_.Data(); } - inline char* BufEnd() noexcept { + inline char* BufEnd() noexcept { return Buf_.Data() + Buf_.Capacity(); } @@ -206,7 +206,7 @@ private: * Predicate for `TStreamTokenizer` that uses '\\n' as a delimiter. */ struct TEol { - inline bool operator()(char ch) const noexcept { + inline bool operator()(char ch) const noexcept { return ch == '\n'; } }; diff --git a/util/stream/tokenizer_ut.cpp b/util/stream/tokenizer_ut.cpp index afc566da86e..957b8cc3e00 100644 --- a/util/stream/tokenizer_ut.cpp +++ b/util/stream/tokenizer_ut.cpp @@ -108,7 +108,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) { Y_UNIT_TEST(CustomPredicateTest) { struct TIsVerticalBar { - inline bool operator()(const char ch) const noexcept { + inline bool operator()(const char ch) const noexcept { return '|' == ch; } }; @@ -132,7 +132,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) { Y_UNIT_TEST(CustomPredicateSecondTest) { struct TIsVerticalBar { - inline bool operator()(const char ch) const noexcept { + inline bool operator()(const char ch) const noexcept { return '|' == ch || ',' == ch; } }; @@ -157,7 +157,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) { Y_UNIT_TEST(FalsePredicateTest) { struct TAlwaysFalse { - inline bool operator()(const char) const noexcept { + inline bool operator()(const char) const noexcept { return false; } }; @@ -178,7 +178,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) { Y_UNIT_TEST(TruePredicateTest) { struct TAlwaysTrue { - inline bool operator()(const char) const noexcept { + inline bool operator()(const char) const noexcept { return true; } }; diff --git a/util/stream/walk.cpp b/util/stream/walk.cpp index 57dc9ab036c..280f7e9f108 100644 --- a/util/stream/walk.cpp +++ b/util/stream/walk.cpp @@ -1,6 +1,6 @@ #include "walk.h" -#include <util/generic/string.h> +#include <util/generic/string.h> void IWalkInput::DoUndo(size_t len) { Len_ += len; diff --git a/util/stream/walk_ut.cpp b/util/stream/walk_ut.cpp index e0a783799f2..ed75b4e2ba0 100644 --- a/util/stream/walk_ut.cpp +++ b/util/stream/walk_ut.cpp @@ -4,7 +4,7 @@ class TStringListInput: public IWalkInput { public: - TStringListInput(const TVector<TString>& data) + TStringListInput(const TVector<TString>& data) : Data_(data) , Index_(0) { @@ -16,20 +16,20 @@ protected: return 0; } - const TString& string = Data_[Index_++]; + const TString& string = Data_[Index_++]; *ptr = string.data(); return string.size(); } private: - const TVector<TString>& Data_; + const TVector<TString>& Data_; size_t Index_; }; Y_UNIT_TEST_SUITE(TWalkTest) { Y_UNIT_TEST(ReadTo) { - TVector<TString> data; + TVector<TString> data; data.push_back("111a"); data.push_back("222b"); data.push_back("333c"); @@ -39,17 +39,17 @@ Y_UNIT_TEST_SUITE(TWalkTest) { TStringListInput input(data); - TString tmp1 = input.ReadTo('c'); + TString tmp1 = input.ReadTo('c'); UNIT_ASSERT_VALUES_EQUAL(tmp1, "111a222b333"); char tmp2; input.Read(&tmp2, 1); UNIT_ASSERT_VALUES_EQUAL(tmp2, '4'); - TString tmp3 = input.ReadTo('6'); + TString tmp3 = input.ReadTo('6'); UNIT_ASSERT_VALUES_EQUAL(tmp3, "44d555e"); - TString tmp4 = input.ReadAll(); + TString tmp4 = input.ReadAll(); UNIT_ASSERT_VALUES_EQUAL(tmp4, "66f"); } } diff --git a/util/stream/zerocopy.h b/util/stream/zerocopy.h index 3315aa3a517..583985f57f8 100644 --- a/util/stream/zerocopy.h +++ b/util/stream/zerocopy.h @@ -25,7 +25,7 @@ public: IZeroCopyInput(IZeroCopyInput&&) noexcept = default; IZeroCopyInput& operator=(IZeroCopyInput&&) noexcept = default; - + /** * Returns the next data chunk from this input stream. * @@ -70,7 +70,7 @@ public: IZeroCopyInputFastReadTo& operator=(IZeroCopyInputFastReadTo&&) noexcept = default; protected: - size_t DoReadTo(TString& st, char ch) override; + size_t DoReadTo(TString& st, char ch) override; private: /** diff --git a/util/stream/zlib.cpp b/util/stream/zlib.cpp index 60f4e9439f0..7e065aab617 100644 --- a/util/stream/zlib.cpp +++ b/util/stream/zlib.cpp @@ -22,17 +22,17 @@ namespace { class TZLibCommon { public: - inline TZLibCommon() noexcept { + inline TZLibCommon() noexcept { memset(Z(), 0, sizeof(*Z())); } inline ~TZLibCommon() = default; - inline const char* GetErrMsg() const noexcept { + inline const char* GetErrMsg() const noexcept { return Z()->msg != nullptr ? Z()->msg : "unknown error"; } - inline z_stream* Z() const noexcept { + inline z_stream* Z() const noexcept { return (z_stream*)(&Z_); } @@ -40,7 +40,7 @@ namespace { z_stream Z_; }; - static inline ui32 MaxPortion(size_t s) noexcept { + static inline ui32 MaxPortion(size_t s) noexcept { return (ui32)Min<size_t>(Max<ui32>(), s); } @@ -225,7 +225,7 @@ public: Z()->avail_out = TmpBufLen(); } - inline ~TImpl() { + inline ~TImpl() { deflateEnd(Z()); } @@ -305,11 +305,11 @@ public: } private: - inline unsigned char* TmpBuf() noexcept { + inline unsigned char* TmpBuf() noexcept { return (unsigned char*)AdditionalData(); } - inline size_t TmpBufLen() const noexcept { + inline size_t TmpBufLen() const noexcept { return AdditionalDataLength(); } @@ -347,7 +347,7 @@ void TZLibCompress::TDestruct::Destroy(TImpl* impl) { delete impl; } -TZLibCompress::~TZLibCompress() { +TZLibCompress::~TZLibCompress() { try { Finish(); } catch (...) { diff --git a/util/stream/zlib.h b/util/stream/zlib.h index e7de7c81b74..c571d98251d 100644 --- a/util/stream/zlib.h +++ b/util/stream/zlib.h @@ -62,7 +62,7 @@ public: */ void SetAllowMultipleStreams(bool allowMultipleStreams); - ~TZLibDecompress() override; + ~TZLibDecompress() override; protected: size_t DoRead(void* buf, size_t size) override; @@ -86,19 +86,19 @@ public: { } - inline TParams& SetType(ZLib::StreamType type) noexcept { + inline TParams& SetType(ZLib::StreamType type) noexcept { Type = type; return *this; } - inline TParams& SetCompressionLevel(size_t level) noexcept { + inline TParams& SetCompressionLevel(size_t level) noexcept { CompressionLevel = level; return *this; } - inline TParams& SetBufLen(size_t buflen) noexcept { + inline TParams& SetBufLen(size_t buflen) noexcept { BufLen = buflen; return *this; @@ -133,7 +133,7 @@ public: Init(TParams(out).SetType(type).SetCompressionLevel(compression_level).SetBufLen(buflen)); } - ~TZLibCompress() override; + ~TZLibCompress() override; private: void Init(const TParams& opts); @@ -167,7 +167,7 @@ public: { } - ~TBufferedZLibDecompress() override; + ~TBufferedZLibDecompress() override; }; /** @} */ diff --git a/util/stream/zlib_ut.cpp b/util/stream/zlib_ut.cpp index 2290b4a9dee..022bca5f3f6 100644 --- a/util/stream/zlib_ut.cpp +++ b/util/stream/zlib_ut.cpp @@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) { static const TString DATA2 = "cn8wk2bd9vb3vdfif83g1ks94bfiovtwv"; Y_UNIT_TEST(Compress) { - TUnbufferedFileOutput o(ZDATA); + TUnbufferedFileOutput o(ZDATA); TZLibCompress c(&o, ZLib::ZLib); c.Write(DATA.data(), DATA.size()); @@ -68,7 +68,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) { TTempFile tmpFile(ZDATA); { - TUnbufferedFileInput i(ZDATA); + TUnbufferedFileInput i(ZDATA); TZLibDecompress d(&i); UNIT_ASSERT_EQUAL(d.ReadAll(), DATA); @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) { // Check that Decompress(Compress(X) + Compress(Y)) == X + Y TTempFile tmpFile(ZDATA); { - TUnbufferedFileOutput o(ZDATA); + TUnbufferedFileOutput o(ZDATA); TZLibCompress c1(&o, ZLib::ZLib); c1.Write(DATA.data(), DATA.size()); c1.Finish(); @@ -104,7 +104,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) { o.Finish(); } { - TUnbufferedFileInput i(ZDATA); + TUnbufferedFileInput i(ZDATA); TZLibDecompress d(&i); UNIT_ASSERT_EQUAL(d.ReadAll(), DATA + DATA2); @@ -130,7 +130,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) { // Check that Decompress(Compress(X) + Compress(Y)) == X when single stream is allowed TTempFile tmpFile(ZDATA); { - TUnbufferedFileOutput o(ZDATA); + TUnbufferedFileOutput o(ZDATA); TZLibCompress c1(&o, ZLib::ZLib); c1.Write(DATA.data(), DATA.size()); c1.Finish(); @@ -140,7 +140,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) { o.Finish(); } { - TUnbufferedFileInput i(ZDATA); + TUnbufferedFileInput i(ZDATA); TZLibDecompress d(&i); d.SetAllowMultipleStreams(false); diff --git a/util/string/ascii.h b/util/string/ascii.h index 10344384d33..67c4e35a71a 100644 --- a/util/string/ascii.h +++ b/util/string/ascii.h @@ -2,7 +2,7 @@ #include <util/system/defaults.h> #include <util/system/compat.h> -#include <util/generic/string.h> +#include <util/generic/string.h> // ctype.h-like functions, locale-independent: // IsAscii{Upper,Lower,Digit,Alpha,Alnum,Space} and diff --git a/util/string/ascii_ut.cpp b/util/string/ascii_ut.cpp index 89069fee50a..5b0617a8b55 100644 --- a/util/string/ascii_ut.cpp +++ b/util/string/ascii_ut.cpp @@ -65,15 +65,15 @@ Y_UNIT_TEST_SUITE(TAsciiTest) { Y_UNIT_TEST(CompareTest) { UNIT_ASSERT(AsciiEqualsIgnoreCase("qqq", "qQq")); UNIT_ASSERT(AsciiEqualsIgnoreCase("qqq", TStringBuf("qQq"))); - TString qq = "qq"; - TString qQ = "qQ"; + TString qq = "qq"; + TString qQ = "qQ"; UNIT_ASSERT(AsciiEqualsIgnoreCase(qq, qQ)); - TString x = "qqqA"; - TString y = "qQqB"; - TString z = "qQnB"; - TString zz = "qQqq"; - TString zzz = "qQqqq"; + TString x = "qqqA"; + TString y = "qQqB"; + TString z = "qQnB"; + TString zz = "qQqq"; + TString zzz = "qQqqq"; TStringBuf xs = TStringBuf(x.data(), 3); TStringBuf ys = TStringBuf(y.data(), 3); TStringBuf zs = TStringBuf(z.data(), 3); diff --git a/util/string/benchmark/float_to_string/main.cpp b/util/string/benchmark/float_to_string/main.cpp index 1c7c0684a31..b52a5e5ab19 100644 --- a/util/string/benchmark/float_to_string/main.cpp +++ b/util/string/benchmark/float_to_string/main.cpp @@ -34,7 +34,7 @@ namespace { template <typename T, size_t N> struct TExamplesHolder { - TVector<TExample<T>> Examples; + TVector<TExample<T>> Examples; TExamplesHolder() : Examples(N) @@ -49,7 +49,7 @@ namespace { template <typename T, size_t N> struct TNearZeroExamplesHolder { - TVector<TExample<T>> Examples; + TVector<TExample<T>> Examples; TNearZeroExamplesHolder() : Examples(N) diff --git a/util/string/benchmark/join/main.cpp b/util/string/benchmark/join/main.cpp index 1a8633d3a8d..cca2331a330 100644 --- a/util/string/benchmark/join/main.cpp +++ b/util/string/benchmark/join/main.cpp @@ -46,7 +46,7 @@ namespace { template <size_t N, typename... T> struct TExamplesHolder { - using TExamples = TVector<std::tuple<T...>>; + using TExamples = TVector<std::tuple<T...>>; TExamples Examples; TExamplesHolder() diff --git a/util/string/benchmark/subst_global/main.cpp b/util/string/benchmark/subst_global/main.cpp index e0decfa042e..0cce508f08f 100644 --- a/util/string/benchmark/subst_global/main.cpp +++ b/util/string/benchmark/subst_global/main.cpp @@ -2,7 +2,7 @@ #include <util/generic/cast.h> #include <util/generic/singleton.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/xrange.h> #include <util/random/fast.h> #include <util/string/cast.h> @@ -15,7 +15,7 @@ namespace { WHAT = What, WITH = With }; - TString Str; + TString Str; TNoMatches() { for (const auto dummy : xrange(N)) { @@ -31,7 +31,7 @@ namespace { WHAT = What, WITH = With }; - TString Str; + TString Str; TOneMatchInTheBeginning() { if (!N) { @@ -54,7 +54,7 @@ namespace { WHAT = What, WITH = With }; - TString Str; + TString Str; TOneMatchInTheEnd() { if (!N) { @@ -77,7 +77,7 @@ namespace { WHAT = What, WITH = With }; - TString Str; + TString Str; TOneMatchInTheMiddle() { if (!N) { @@ -100,7 +100,7 @@ namespace { WHAT = What, WITH = With }; - TString Str; + TString Str; TFirstHalfMatches() { for (size_t i = 0; i < N / 2; ++i) { @@ -118,7 +118,7 @@ namespace { WHAT = What, WITH = With }; - TString Str; + TString Str; TSecondHalfMatches() { for (size_t i = 0; i < N / 2; ++i) { @@ -136,7 +136,7 @@ namespace { WHAT = What, WITH = With }; - TString Str; + TString Str; TEveryKth() { TFastRng<ui64> prng{N * K * 101}; diff --git a/util/string/builder.cpp b/util/string/builder.cpp index a3821d33991..205b4475f93 100644 --- a/util/string/builder.cpp +++ b/util/string/builder.cpp @@ -4,5 +4,5 @@ template <> void Out<TStringBuilder>(IOutputStream& os, const TStringBuilder& sb) { - os << static_cast<const TString&>(sb); + os << static_cast<const TString&>(sb); } diff --git a/util/string/builder.h b/util/string/builder.h index 7b548211513..eb800b807f6 100644 --- a/util/string/builder.h +++ b/util/string/builder.h @@ -2,10 +2,10 @@ #include <util/stream/str.h> #include <utility> -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NPrivateStringBuilder { - class TStringBuilder: public TString { + class TStringBuilder: public TString { public: inline TStringBuilder() : Out(*this) diff --git a/util/string/builder_ut.cpp b/util/string/builder_ut.cpp index 22def683ec2..ff6395ca220 100644 --- a/util/string/builder_ut.cpp +++ b/util/string/builder_ut.cpp @@ -2,15 +2,15 @@ #include <library/cpp/testing/unittest/registar.h> -static void TestEquals(const TString& expected, const TString& actual) { +static void TestEquals(const TString& expected, const TString& actual) { UNIT_ASSERT_VALUES_EQUAL(expected, actual); } struct TClassWithStreamOperator { ui32 Id; - TString Name; + TString Name; - TClassWithStreamOperator(ui32 id, const TString& name) + TClassWithStreamOperator(ui32 id, const TString& name) : Id(id) , Name(name) { @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(TStringBuilderTest) { } Y_UNIT_TEST(TestStringBuilderOut) { - TString s; + TString s; TStringOutput out(s); TStringBuilder sb; sb << "a"; @@ -40,11 +40,11 @@ Y_UNIT_TEST_SUITE(TStringBuilderTest) { Y_UNIT_TEST(TestStringBuilderRValue) { struct TRValueAcceptTester { - static bool IsRValue(const TString&) { + static bool IsRValue(const TString&) { return false; } - static bool IsRValue(TString&&) { + static bool IsRValue(TString&&) { return true; } }; diff --git a/util/string/cast.cpp b/util/string/cast.cpp index aa1e65a8e90..21f4a35157a 100644 --- a/util/string/cast.cpp +++ b/util/string/cast.cpp @@ -14,7 +14,7 @@ #include <contrib/libs/double-conversion/double-conversion.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/yassert.h> #include <util/generic/yexception.h> #include <util/generic/typetraits.h> @@ -517,8 +517,8 @@ bool FromStringImpl<bool>(const char* data, size_t len) { } template <> -TString FromStringImpl<TString>(const char* data, size_t len) { - return TString(data, len); +TString FromStringImpl<TString>(const char* data, size_t len) { + return TString(data, len); } template <> @@ -532,8 +532,8 @@ std::string FromStringImpl<std::string>(const char* data, size_t len) { } template <> -TUtf16String FromStringImpl<TUtf16String>(const wchar16* data, size_t len) { - return TUtf16String(data, len); +TUtf16String FromStringImpl<TUtf16String>(const wchar16* data, size_t len) { + return TUtf16String(data, len); } template <> @@ -549,8 +549,8 @@ bool TryFromStringImpl<TStringBuf>(const char* data, size_t len, TStringBuf& res } template <> -bool TryFromStringImpl<TString>(const char* data, size_t len, TString& result) { - result = TString(data, len); +bool TryFromStringImpl<TString>(const char* data, size_t len, TString& result) { + result = TString(data, len); return true; } @@ -567,8 +567,8 @@ bool TryFromStringImpl<TWtringBuf>(const wchar16* data, size_t len, TWtringBuf& } template <> -bool TryFromStringImpl<TUtf16String>(const wchar16* data, size_t len, TUtf16String& result) { - result = TUtf16String(data, len); +bool TryFromStringImpl<TUtf16String>(const wchar16* data, size_t len, TUtf16String& result) { + result = TUtf16String(data, len); return true; } diff --git a/util/string/cast.h b/util/string/cast.h index 90e925c194c..b6c78b5f480 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -2,7 +2,7 @@ #include <util/system/defaults.h> #include <util/stream/str.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/typetraits.h> #include <util/generic/yexception.h> @@ -40,35 +40,35 @@ enum EFloatToStringMode { /** "%f" mode, writes the given number of digits after decimal point: * 0.1f -> "0.100000", 1.2e-06f -> "0.000001" for ndigits=6 */ PREC_POINT_DIGITS = 3, - - /** same as PREC_POINT_DIGITS, but stripping trailing zeroes: - * 0.1f for ndgigits=6 -> "0.1" */ - PREC_POINT_DIGITS_STRIP_ZEROES = 4 + + /** same as PREC_POINT_DIGITS, but stripping trailing zeroes: + * 0.1f for ndgigits=6 -> "0.1" */ + PREC_POINT_DIGITS_STRIP_ZEROES = 4 }; size_t FloatToString(float t, char* buf, size_t len, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0); size_t FloatToString(double t, char* buf, size_t len, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0); template <typename T> -inline TString FloatToString(const T& t, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0) { +inline TString FloatToString(const T& t, EFloatToStringMode mode = PREC_AUTO, int ndigits = 0) { char buf[512]; // Max<double>() with mode = PREC_POINT_DIGITS has 309 digits before the decimal point size_t count = FloatToString(t, buf, sizeof(buf), mode, ndigits); - return TString(buf, count); + return TString(buf, count); } namespace NPrivate { template <class T, bool isSimple> struct TToString { - static inline TString Cvt(const T& t) { + static inline TString Cvt(const T& t) { char buf[512]; - return TString(buf, ToString<T>(t, buf, sizeof(buf))); + return TString(buf, ToString<T>(t, buf, sizeof(buf))); } }; template <class T> struct TToString<T, false> { - static inline TString Cvt(const T& t) { + static inline TString Cvt(const T& t) { TString s; TStringOutput o(s); o << t; @@ -81,25 +81,25 @@ namespace NPrivate { * some clever implementations... */ template <class T> -inline TString ToString(const T& t) { +inline TString ToString(const T& t) { using TR = std::remove_cv_t<T>; return ::NPrivate::TToString<TR, std::is_arithmetic<TR>::value>::Cvt((const TR&)t); } -inline const TString& ToString(const TString& s) noexcept { +inline const TString& ToString(const TString& s) noexcept { return s; } -inline const TString& ToString(TString& s) noexcept { +inline const TString& ToString(TString& s) noexcept { return s; } -inline TString ToString(const char* s) { +inline TString ToString(const char* s) { return s; } -inline TString ToString(char* s) { +inline TString ToString(char* s) { return s; } @@ -107,15 +107,15 @@ inline TString ToString(char* s) { * Wrapper for wide strings. */ template <class T> -inline TUtf16String ToWtring(const T& t) { - return TUtf16String::FromAscii(ToString(t)); +inline TUtf16String ToWtring(const T& t) { + return TUtf16String::FromAscii(ToString(t)); } -inline const TUtf16String& ToWtring(const TUtf16String& w) { +inline const TUtf16String& ToWtring(const TUtf16String& w) { return w; } -inline const TUtf16String& ToWtring(TUtf16String& w) { +inline const TUtf16String& ToWtring(TUtf16String& w) { return w; } @@ -156,7 +156,7 @@ inline T FromString(const TStringBuf& s) { } template <class T> -inline T FromString(const TString& s) { +inline T FromString(const TString& s) { return ::FromString<T>(s.data(), s.size()); } @@ -166,7 +166,7 @@ inline T FromString(const std::string& s) { } template <> -inline TString FromString<TString>(const TString& s) { +inline TString FromString<TString>(const TString& s) { return s; } @@ -176,7 +176,7 @@ inline T FromString(const TWtringBuf& s) { } template <class T> -inline T FromString(const TUtf16String& s) { +inline T FromString(const TUtf16String& s) { return ::FromString<T, wchar16>(s.data(), s.size()); } @@ -251,7 +251,7 @@ inline bool TryFromString(const TStringBuf& s, T& result) { } template <class T> -inline bool TryFromString(const TString& s, T& result) { +inline bool TryFromString(const TString& s, T& result) { return TryFromString<T>(s.data(), s.size(), result); } @@ -266,12 +266,12 @@ inline bool TryFromString(const TWtringBuf& s, T& result) { } template <class T> -inline bool TryFromString(const TUtf16String& s, T& result) { +inline bool TryFromString(const TUtf16String& s, T& result) { return TryFromString<T>(s.data(), s.size(), result); } -template <class T, class TStringType> -inline bool TryFromStringWithDefault(const TStringType& s, T& result, const T& def) { +template <class T, class TStringType> +inline bool TryFromStringWithDefault(const TStringType& s, T& result, const T& def) { return TryFromString<T>(s.data(), s.size(), result, def); } @@ -280,8 +280,8 @@ inline bool TryFromStringWithDefault(const char* s, T& result, const T& def) { return TryFromStringWithDefault<T>(TStringBuf(s), result, def); } -template <class T, class TStringType> -inline bool TryFromStringWithDefault(const TStringType& s, T& result) { +template <class T, class TStringType> +inline bool TryFromStringWithDefault(const TStringType& s, T& result) { return TryFromStringWithDefault<T>(s, result, T()); } @@ -293,8 +293,8 @@ inline T FromString(const TChar* data, const size_t len, const T& def) { return result; } -template <class T, class TStringType> -inline T FromStringWithDefault(const TStringType& s, const T& def) { +template <class T, class TStringType> +inline T FromStringWithDefault(const TStringType& s, const T& def) { return FromString<T>(s.data(), s.size(), def); } @@ -303,8 +303,8 @@ inline T FromStringWithDefault(const char* s, const T& def) { return FromStringWithDefault<T>(TStringBuf(s), def); } -template <class T, class TStringType> -inline T FromStringWithDefault(const TStringType& s) { +template <class T, class TStringType> +inline T FromStringWithDefault(const TStringType& s) { return FromStringWithDefault<T>(s, T()); } @@ -315,19 +315,19 @@ template <int base, class T> size_t IntToString(T t, char* buf, size_t len); template <int base, class T> -inline TString IntToString(T t) { +inline TString IntToString(T t) { static_assert(std::is_arithmetic<std::remove_cv_t<T>>::value, "expect std::is_arithmetic<std::remove_cv_t<T>>::value"); char buf[256]; - return TString(buf, IntToString<base>(t, buf, sizeof(buf))); + return TString(buf, IntToString<base>(t, buf, sizeof(buf))); } template <int base, class TInt, class TChar> bool TryIntFromString(const TChar* data, size_t len, TInt& result); -template <int base, class TInt, class TStringType> -inline bool TryIntFromString(const TStringType& s, TInt& result) { +template <int base, class TInt, class TStringType> +inline bool TryIntFromString(const TStringType& s, TInt& result) { return TryIntFromString<base>(s.data(), s.size(), result); } diff --git a/util/string/cast_ut.cpp b/util/string/cast_ut.cpp index 033450c38c4..31212fff12e 100644 --- a/util/string/cast_ut.cpp +++ b/util/string/cast_ut.cpp @@ -43,12 +43,12 @@ template <class A> struct TRet { template <int base> - inline A IntFromStringForCheck(const TString& str) { + inline A IntFromStringForCheck(const TString& str) { return IntFromString<A, base>(str); } template <int base> - inline bool TryIntFromStringForCheck(const TString& str, A& result) { + inline bool TryIntFromStringForCheck(const TString& str, A& result) { return TryIntFromString<base>(str, result); } @@ -126,7 +126,7 @@ inline TRet<A> F() { #if 0 template <class T> -inline void CheckConvertToBuffer(const T& value, const size_t size, const TString& canonValue) { +inline void CheckConvertToBuffer(const T& value, const size_t size, const TString& canonValue) { const size_t maxSize = 256; char buffer[maxSize]; const char magic = 0x7F; @@ -262,7 +262,7 @@ Y_UNIT_TEST_SUITE(TCastTest) { UNIT_ASSERT_VALUES_EQUAL(FloatToString(0.12345678f, PREC_POINT_DIGITS, 6), "0.123457"); UNIT_ASSERT_VALUES_EQUAL(FloatToString(1e-20f, PREC_POINT_DIGITS, 6), "0.000000"); UNIT_ASSERT_VALUES_EQUAL(FloatToString(12.34f, PREC_POINT_DIGITS, 0), "12"); // rounding to integers drops '.' - // strip trailing zeroes + // strip trailing zeroes UNIT_ASSERT_VALUES_EQUAL(FloatToString(0.1f, PREC_POINT_DIGITS_STRIP_ZEROES, 6), "0.1"); UNIT_ASSERT_VALUES_EQUAL(FloatToString(0.12345678f, PREC_POINT_DIGITS_STRIP_ZEROES, 6), "0.123457"); UNIT_ASSERT_VALUES_EQUAL(FloatToString(1e-20f, PREC_POINT_DIGITS_STRIP_ZEROES, 6), "0"); @@ -321,7 +321,7 @@ Y_UNIT_TEST_SUITE(TCastTest) { } Y_UNIT_TEST(TestFromStringStringBuf) { - TString a = "xyz"; + TString a = "xyz"; TStringBuf b = FromString<TStringBuf>(a); UNIT_ASSERT_VALUES_EQUAL(a, b); UNIT_ASSERT_VALUES_EQUAL((void*)a.data(), (void*)b.data()); @@ -375,7 +375,7 @@ Y_UNIT_TEST_SUITE(TCastTest) { size_t res = 0; const size_t def1 = 42; - TString s1("100500"); + TString s1("100500"); UNIT_ASSERT_VALUES_EQUAL(TryFromStringWithDefault(s1, res, def1), true); UNIT_ASSERT_VALUES_EQUAL(res, 100500); @@ -390,7 +390,7 @@ Y_UNIT_TEST_SUITE(TCastTest) { UNIT_ASSERT_VALUES_EQUAL(FromStringWithDefault<size_t>(s1), 100500); UNIT_ASSERT_VALUES_EQUAL(FromStringWithDefault("100500", def1), 100500); - TString s2("100q500"); + TString s2("100q500"); UNIT_ASSERT_VALUES_EQUAL(TryFromStringWithDefault(s2, res), false); UNIT_ASSERT_VALUES_EQUAL(res, size_t()); @@ -453,7 +453,7 @@ Y_UNIT_TEST_SUITE(TCastTest) { UNIT_ASSERT_DOUBLES_EQUAL((float)FromString("0.0001"), 0.0001, EPS); UNIT_ASSERT_DOUBLES_EQUAL((double)FromString("0.0015", sizeof("0.0015") - 2), 0.001, EPS); UNIT_ASSERT_DOUBLES_EQUAL((long double)FromString(TStringBuf("0.0001")), 0.0001, EPS); - UNIT_ASSERT_DOUBLES_EQUAL((float)FromString(TString("10E-5")), 10E-5, EPS); + UNIT_ASSERT_DOUBLES_EQUAL((float)FromString(TString("10E-5")), 10E-5, EPS); UNIT_ASSERT_VALUES_EQUAL((bool)FromString("da"), true); UNIT_ASSERT_VALUES_EQUAL((bool)FromString("no"), false); UNIT_ASSERT_VALUES_EQUAL((short)FromString(u"9000"), 9000); @@ -465,7 +465,7 @@ Y_UNIT_TEST_SUITE(TCastTest) { } static void CheckMessage(TFromStringException& exc, const TString& phrase) { - TString message = exc.what(); + TString message = exc.what(); if (!message.Contains(phrase)) { Cerr << message << Endl; UNIT_ASSERT(false); @@ -536,7 +536,7 @@ Y_UNIT_TEST_SUITE(TCastTest) { UNIT_ASSERT_VALUES_EQUAL(hello, out); } { - const TUtf16String empty; + const TUtf16String empty; TWtringBuf out; UNIT_ASSERT(TryFromString(empty, out)); UNIT_ASSERT_VALUES_EQUAL(empty, out); diff --git a/util/string/escape.cpp b/util/string/escape.cpp index cd09a7dbd02..92a28b63ec2 100644 --- a/util/string/escape.cpp +++ b/util/string/escape.cpp @@ -174,8 +174,8 @@ TBasicString<TChar>& EscapeCImpl(const TChar* str, size_t len, TBasicString<TCha return r; } -template TString& EscapeCImpl<TString::TChar>(const TString::TChar* str, size_t len, TString& r); -template TUtf16String& EscapeCImpl<TUtf16String::TChar>(const TUtf16String::TChar* str, size_t len, TUtf16String& r); +template TString& EscapeCImpl<TString::TChar>(const TString::TChar* str, size_t len, TString& r); +template TUtf16String& EscapeCImpl<TUtf16String::TChar>(const TUtf16String::TChar* str, size_t len, TUtf16String& r); namespace { template <class TStr> @@ -358,8 +358,8 @@ TChar* UnescapeC(const TChar* str, size_t len, TChar* buf) { return DoUnescapeC(str, len, bufbuf).P; } -template TString& UnescapeCImpl<TString::TChar>(const TString::TChar* str, size_t len, TString& r); -template TUtf16String& UnescapeCImpl<TUtf16String::TChar>(const TUtf16String::TChar* str, size_t len, TUtf16String& r); +template TString& UnescapeCImpl<TString::TChar>(const TString::TChar* str, size_t len, TString& r); +template TUtf16String& UnescapeCImpl<TUtf16String::TChar>(const TUtf16String::TChar* str, size_t len, TUtf16String& r); template char* UnescapeC<char>(const char* str, size_t len, char* buf); @@ -398,36 +398,36 @@ size_t UnescapeCCharLen(const TChar* begin, const TChar* end) { } template size_t UnescapeCCharLen<char>(const char* begin, const char* end); -template size_t UnescapeCCharLen<TUtf16String::TChar>(const TUtf16String::TChar* begin, const TUtf16String::TChar* end); +template size_t UnescapeCCharLen<TUtf16String::TChar>(const TUtf16String::TChar* begin, const TUtf16String::TChar* end); -TString& EscapeC(const TStringBuf str, TString& s) { +TString& EscapeC(const TStringBuf str, TString& s) { return EscapeC(str.data(), str.size(), s); } -TUtf16String& EscapeC(const TWtringBuf str, TUtf16String& w) { +TUtf16String& EscapeC(const TWtringBuf str, TUtf16String& w) { return EscapeC(str.data(), str.size(), w); } -TString EscapeC(const TString& str) { +TString EscapeC(const TString& str) { return EscapeC(str.data(), str.size()); } -TUtf16String EscapeC(const TUtf16String& str) { +TUtf16String EscapeC(const TUtf16String& str) { return EscapeC(str.data(), str.size()); } -TString& UnescapeC(const TStringBuf str, TString& s) { +TString& UnescapeC(const TStringBuf str, TString& s) { return UnescapeC(str.data(), str.size(), s); } -TUtf16String& UnescapeC(const TWtringBuf str, TUtf16String& w) { +TUtf16String& UnescapeC(const TWtringBuf str, TUtf16String& w) { return UnescapeC(str.data(), str.size(), w); } -TString UnescapeC(const TStringBuf str) { +TString UnescapeC(const TStringBuf str) { return UnescapeC(str.data(), str.size()); } -TUtf16String UnescapeC(const TWtringBuf str) { +TUtf16String UnescapeC(const TWtringBuf str) { return UnescapeC(str.data(), str.size()); } diff --git a/util/string/escape.h b/util/string/escape.h index b01be65b0ee..47f3c7447b3 100644 --- a/util/string/escape.h +++ b/util/string/escape.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> template <class TChar> @@ -49,18 +49,18 @@ static inline TBasicString<TChar> EscapeC(const TChar* str) { return EscapeC(str, std::char_traits<TChar>::length(str)); } -TString& EscapeC(const TStringBuf str, TString& res); -TUtf16String& EscapeC(const TWtringBuf str, TUtf16String& res); +TString& EscapeC(const TStringBuf str, TString& res); +TUtf16String& EscapeC(const TWtringBuf str, TUtf16String& res); // these two need to be methods, because of TBasicString::Quote implementation -TString EscapeC(const TString& str); -TUtf16String EscapeC(const TUtf16String& str); +TString EscapeC(const TString& str); +TUtf16String EscapeC(const TUtf16String& str); -TString& UnescapeC(const TStringBuf str, TString& res); -TUtf16String& UnescapeC(const TWtringBuf str, TUtf16String& res); +TString& UnescapeC(const TStringBuf str, TString& res); +TUtf16String& UnescapeC(const TWtringBuf str, TUtf16String& res); -TString UnescapeC(const TStringBuf str); -TUtf16String UnescapeC(const TWtringBuf wtr); +TString UnescapeC(const TStringBuf str); +TUtf16String UnescapeC(const TWtringBuf wtr); /// Returns number of chars in escape sequence. /// - 0, if begin >= end diff --git a/util/string/escape_ut.cpp b/util/string/escape_ut.cpp index cd38ecffd34..b2a9fdd807d 100644 --- a/util/string/escape_ut.cpp +++ b/util/string/escape_ut.cpp @@ -2,15 +2,15 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/charset/wide.h> using namespace std::string_view_literals; namespace { struct TExample { - TString Expected; - TString Source; + TString Expected; + TString Source; TExample(const TStringBuf expected, const TStringBuf source) : Expected{expected} @@ -49,42 +49,42 @@ static const TExample CommonTestData[] = { Y_UNIT_TEST_SUITE(TEscapeCTest) { Y_UNIT_TEST(TestStrokaEscapeC) { for (const auto& e : CommonTestData) { - TString expected(e.Expected); - TString source(e.Source); - TString actual(EscapeC(e.Source)); - TString actual2(UnescapeC(e.Expected)); + TString expected(e.Expected); + TString source(e.Source); + TString actual(EscapeC(e.Source)); + TString actual2(UnescapeC(e.Expected)); UNIT_ASSERT_VALUES_EQUAL(e.Expected, actual); UNIT_ASSERT_VALUES_EQUAL(e.Source, actual2); } - UNIT_ASSERT_VALUES_EQUAL("http://ya.ru/\\x17\\n\\xAB", EscapeC(TString("http://ya.ru/\x17\n\xab"))); - UNIT_ASSERT_VALUES_EQUAL("http://ya.ru/\x17\n\xab", UnescapeC(TString("http://ya.ru/\\x17\\n\\xAB"))); + UNIT_ASSERT_VALUES_EQUAL("http://ya.ru/\\x17\\n\\xAB", EscapeC(TString("http://ya.ru/\x17\n\xab"))); + UNIT_ASSERT_VALUES_EQUAL("http://ya.ru/\x17\n\xab", UnescapeC(TString("http://ya.ru/\\x17\\n\\xAB"))); UNIT_ASSERT_VALUES_EQUAL("h", EscapeC('h')); - UNIT_ASSERT_VALUES_EQUAL("h", UnescapeC(TString("h"))); + UNIT_ASSERT_VALUES_EQUAL("h", UnescapeC(TString("h"))); UNIT_ASSERT_VALUES_EQUAL("\\xFF", EscapeC('\xFF')); - UNIT_ASSERT_VALUES_EQUAL("\xFF", UnescapeC(TString("\\xFF"))); + UNIT_ASSERT_VALUES_EQUAL("\xFF", UnescapeC(TString("\\xFF"))); - UNIT_ASSERT_VALUES_EQUAL("\\377f", EscapeC(TString("\xff" + UNIT_ASSERT_VALUES_EQUAL("\\377f", EscapeC(TString("\xff" "f"))); UNIT_ASSERT_VALUES_EQUAL("\xff" "f", - UnescapeC(TString("\\377f"))); - UNIT_ASSERT_VALUES_EQUAL("\\xFFg", EscapeC(TString("\xff" + UnescapeC(TString("\\377f"))); + UNIT_ASSERT_VALUES_EQUAL("\\xFFg", EscapeC(TString("\xff" "g"))); UNIT_ASSERT_VALUES_EQUAL("\xff" "g", - UnescapeC(TString("\\xFFg"))); - UNIT_ASSERT_VALUES_EQUAL("\xEA\x9A\x96", UnescapeC(TString("\\uA696"))); - UNIT_ASSERT_VALUES_EQUAL("Странный компроматтест", UnescapeC(TString("\\u0421\\u0442\\u0440\\u0430\\u043d\\u043d\\u044b\\u0439 \\u043a\\u043e\\u043c\\u043f\\u0440\\u043e\\u043c\\u0430\\u0442тест"))); + UnescapeC(TString("\\xFFg"))); + UNIT_ASSERT_VALUES_EQUAL("\xEA\x9A\x96", UnescapeC(TString("\\uA696"))); + UNIT_ASSERT_VALUES_EQUAL("Странный компроматтест", UnescapeC(TString("\\u0421\\u0442\\u0440\\u0430\\u043d\\u043d\\u044b\\u0439 \\u043a\\u043e\\u043c\\u043f\\u0440\\u043e\\u043c\\u0430\\u0442тест"))); } Y_UNIT_TEST(TestWtrokaEscapeC) { for (const auto& e : CommonTestData) { - TUtf16String expected(UTF8ToWide(e.Expected)); - TUtf16String source(UTF8ToWide(e.Source)); - TUtf16String actual(EscapeC(source)); - TUtf16String actual2(UnescapeC(expected)); + TUtf16String expected(UTF8ToWide(e.Expected)); + TUtf16String source(UTF8ToWide(e.Source)); + TUtf16String actual(EscapeC(source)); + TUtf16String actual2(UnescapeC(expected)); UNIT_ASSERT_VALUES_EQUAL(expected, actual); UNIT_ASSERT_VALUES_EQUAL(source, actual2); @@ -96,12 +96,12 @@ Y_UNIT_TEST_SUITE(TEscapeCTest) { } Y_UNIT_TEST(TestEscapeTrigraphs) { - UNIT_ASSERT_VALUES_EQUAL("?", EscapeC(TString("?"))); - UNIT_ASSERT_VALUES_EQUAL("\\x3F?", EscapeC(TString("??"))); - UNIT_ASSERT_VALUES_EQUAL("\\x3F\\x3F?", EscapeC(TString("???"))); + UNIT_ASSERT_VALUES_EQUAL("?", EscapeC(TString("?"))); + UNIT_ASSERT_VALUES_EQUAL("\\x3F?", EscapeC(TString("??"))); + UNIT_ASSERT_VALUES_EQUAL("\\x3F\\x3F?", EscapeC(TString("???"))); // ok but may cause warning about trigraphs - // UNIT_ASSERT_VALUES_EQUAL("[x]?z", EscapeC(TString("??(x??)?z"))); - UNIT_ASSERT_VALUES_EQUAL("\\x3F?x\\x3F\\x3F?z", EscapeC(TString("??x???z"))); + // UNIT_ASSERT_VALUES_EQUAL("[x]?z", EscapeC(TString("??(x??)?z"))); + UNIT_ASSERT_VALUES_EQUAL("\\x3F?x\\x3F\\x3F?z", EscapeC(TString("??x???z"))); } Y_UNIT_TEST(TestUnescapeCCharLen) { diff --git a/util/string/fuzzing/collapse/main.cpp b/util/string/fuzzing/collapse/main.cpp index e7b09f0f55d..f2c2b2d5d65 100644 --- a/util/string/fuzzing/collapse/main.cpp +++ b/util/string/fuzzing/collapse/main.cpp @@ -2,10 +2,10 @@ #include <util/charset/wide.h> extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) { - TUtf16String w((const wchar16*)data, size / 2); + TUtf16String w((const wchar16*)data, size / 2); Collapse(w); - TString s((const char*)data, size); + TString s((const char*)data, size); CollapseInPlace(s); return 0; // Non-zero return values are reserved for future use. diff --git a/util/string/hex.cpp b/util/string/hex.cpp index 667397987fc..71eec149a0c 100644 --- a/util/string/hex.cpp +++ b/util/string/hex.cpp @@ -44,8 +44,8 @@ void* HexDecode(const void* in, size_t len, void* ptr) { return out; } -TString HexEncode(const void* in, size_t len) { - TString ret; +TString HexEncode(const void* in, size_t len) { + TString ret; ret.ReserveAndResize(len << 1); HexEncode(in, len, ret.begin()); @@ -53,8 +53,8 @@ TString HexEncode(const void* in, size_t len) { return ret; } -TString HexDecode(const void* in, size_t len) { - TString ret; +TString HexDecode(const void* in, size_t len) { + TString ret; ret.ReserveAndResize(len >> 1); HexDecode(in, len, ret.begin()); diff --git a/util/string/hex.h b/util/string/hex.h index af3d2d528fa..07d2de85783 100644 --- a/util/string/hex.h +++ b/util/string/hex.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/system/yassert.h> @@ -28,9 +28,9 @@ inline static int String2Byte(const char* s) { char* HexEncode(const void* in, size_t len, char* out); -TString HexEncode(const void* in, size_t len); +TString HexEncode(const void* in, size_t len); -inline TString HexEncode(const TStringBuf h) { +inline TString HexEncode(const TStringBuf h) { return HexEncode(h.data(), h.size()); } @@ -51,9 +51,9 @@ void* HexDecode(const void* in, size_t len, void* ptr); * * @example HexDecode("beef", 4) => {190, 239} */ -TString HexDecode(const void* in, size_t len); +TString HexDecode(const void* in, size_t len); //! Convert an ASCII hex-string (case-insensitive) to the binary form. Note that h.Size() must be even (+h % 2 == 0). -inline TString HexDecode(const TStringBuf h) { +inline TString HexDecode(const TStringBuf h) { return HexDecode(h.data(), h.size()); } diff --git a/util/string/join.h b/util/string/join.h index b166fad1f3b..6cb09a92514 100644 --- a/util/string/join.h +++ b/util/string/join.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/typetraits.h> #include <util/string/cast.h> #include "cast.h" @@ -96,8 +96,8 @@ inline void AppendJoin(TString& dst, const TStringBuf delim, const TValues&... v } template <typename TFirst, typename... TRest> -inline TString Join(const TStringBuf delim, const TFirst& f, const TRest&... r) { - TString ret = ToString(f); +inline TString Join(const TStringBuf delim, const TFirst& f, const TRest&... r) { + TString ret = ToString(f); AppendJoin(ret, delim, r...); return ret; } @@ -106,7 +106,7 @@ inline TString Join(const TStringBuf delim, const TFirst& f, const TRest&... r) // but any char value @v will be printed as corresponding numeric code. // For example, Join('a', 'a', 'a') will print "97a97" (see unit-test). template <typename... TValues> -inline TString Join(char cdelim, const TValues&... v) { +inline TString Join(char cdelim, const TValues&... v) { return Join(TStringBuf(&cdelim, 1), v...); } diff --git a/util/string/join_ut.cpp b/util/string/join_ut.cpp index 3ed2b2459c4..011b5eecbdc 100644 --- a/util/string/join_ut.cpp +++ b/util/string/join_ut.cpp @@ -6,10 +6,10 @@ #include <util/stream/output.h> struct TCustomData { - TVector<int> Ints; + TVector<int> Ints; }; -TString ToString(const TCustomData& d) { +TString ToString(const TCustomData& d) { return JoinSeq("__", d.Ints); } @@ -17,7 +17,7 @@ Y_UNIT_TEST_SUITE(JoinStringTest) { Y_UNIT_TEST(ScalarItems) { UNIT_ASSERT_EQUAL(Join(',', 10, 11.1, "foobar"), "10,11.1,foobar"); UNIT_ASSERT_EQUAL(Join(", ", 10, 11.1, "foobar"), "10, 11.1, foobar"); - UNIT_ASSERT_EQUAL(Join(", ", 10, 11.1, TString("foobar")), "10, 11.1, foobar"); + UNIT_ASSERT_EQUAL(Join(", ", 10, 11.1, TString("foobar")), "10, 11.1, foobar"); UNIT_ASSERT_EQUAL(Join('#', 0, "a", "foobar", -1.4, TStringBuf("aaa")), "0#a#foobar#-1.4#aaa"); UNIT_ASSERT_EQUAL(Join("", "", ""), ""); @@ -28,7 +28,7 @@ Y_UNIT_TEST_SUITE(JoinStringTest) { Y_UNIT_TEST(IntContainerItems) { int v[] = {1, 2, 3}; - TVector<int> vv(v, v + 3); + TVector<int> vv(v, v + 3); UNIT_ASSERT_EQUAL(JoinSeq(" ", vv), "1 2 3"); UNIT_ASSERT_EQUAL(JoinSeq(" ", vv), JoinRange(" ", vv.begin(), vv.end())); UNIT_ASSERT_EQUAL(JoinRange(" ", v, v + 2), "1 2"); @@ -42,9 +42,9 @@ Y_UNIT_TEST_SUITE(JoinStringTest) { // try various overloads and template type arguments static const char* const result = "1 22 333"; static const char* const v[] = {"1", "22", "333"}; - TVector<const char*> vchar(v, v + sizeof(v) / sizeof(v[0])); - TVector<TStringBuf> vbuf(v, v + sizeof(v) / sizeof(v[0])); - TVector<TString> vstring(v, v + sizeof(v) / sizeof(v[0])); + TVector<const char*> vchar(v, v + sizeof(v) / sizeof(v[0])); + TVector<TStringBuf> vbuf(v, v + sizeof(v) / sizeof(v[0])); + TVector<TString> vstring(v, v + sizeof(v) / sizeof(v[0])); // ranges UNIT_ASSERT_EQUAL(JoinRange(" ", v, v + 3), result); diff --git a/util/string/printf.cpp b/util/string/printf.cpp index 5b7c34d4e14..8f903299508 100644 --- a/util/string/printf.cpp +++ b/util/string/printf.cpp @@ -3,13 +3,13 @@ #include <util/stream/printf.h> #include <util/stream/str.h> -int vsprintf(TString& s, const char* c, va_list params) { +int vsprintf(TString& s, const char* c, va_list params) { TStringOutput so(s.remove()); return Printf(so, c, params); } -int sprintf(TString& s, const char* c, ...) { +int sprintf(TString& s, const char* c, ...) { va_list params; va_start(params, c); const int k = vsprintf(s, c, params); @@ -17,8 +17,8 @@ int sprintf(TString& s, const char* c, ...) { return k; } -TString Sprintf(const char* c, ...) { - TString s; +TString Sprintf(const char* c, ...) { + TString s; va_list params; va_start(params, c); vsprintf(s, c, params); @@ -26,7 +26,7 @@ TString Sprintf(const char* c, ...) { return s; } -int fcat(TString& s, const char* c, ...) { +int fcat(TString& s, const char* c, ...) { TStringOutput so(s); va_list params; diff --git a/util/string/printf.h b/util/string/printf.h index 925c6edaff1..1cd482ed2ff 100644 --- a/util/string/printf.h +++ b/util/string/printf.h @@ -6,8 +6,8 @@ #include <cstdarg> /// formatted print. return printed length: -int Y_PRINTF_FORMAT(2, 0) vsprintf(TString& s, const char* c, va_list params); +int Y_PRINTF_FORMAT(2, 0) vsprintf(TString& s, const char* c, va_list params); /// formatted print. return printed length: -int Y_PRINTF_FORMAT(2, 3) sprintf(TString& s, const char* c, ...); -TString Y_PRINTF_FORMAT(1, 2) Sprintf(const char* c, ...); -int Y_PRINTF_FORMAT(2, 3) fcat(TString& s, const char* c, ...); +int Y_PRINTF_FORMAT(2, 3) sprintf(TString& s, const char* c, ...); +TString Y_PRINTF_FORMAT(1, 2) Sprintf(const char* c, ...); +int Y_PRINTF_FORMAT(2, 3) fcat(TString& s, const char* c, ...); diff --git a/util/string/printf_ut.cpp b/util/string/printf_ut.cpp index 2b2f980b70e..49f02b3da13 100644 --- a/util/string/printf_ut.cpp +++ b/util/string/printf_ut.cpp @@ -4,19 +4,19 @@ Y_UNIT_TEST_SUITE(TStringPrintf) { Y_UNIT_TEST(TestSprintf) { - TString s; + TString s; int len = sprintf(s, "Hello %s", "world"); - UNIT_ASSERT_EQUAL(s, TString("Hello world")); + UNIT_ASSERT_EQUAL(s, TString("Hello world")); UNIT_ASSERT_EQUAL(len, 11); } Y_UNIT_TEST(TestFcat) { - TString s; + TString s; int len = sprintf(s, "Hello %s", "world"); - UNIT_ASSERT_EQUAL(s, TString("Hello world")); + UNIT_ASSERT_EQUAL(s, TString("Hello world")); UNIT_ASSERT_EQUAL(len, 11); len = fcat(s, " qwqw%s", "as"); - UNIT_ASSERT_EQUAL(s, TString("Hello world qwqwas")); + UNIT_ASSERT_EQUAL(s, TString("Hello world qwqwas")); UNIT_ASSERT_EQUAL(len, 7); } diff --git a/util/string/split.cpp b/util/string/split.cpp index 7d26857cc7a..50099db18bb 100644 --- a/util/string/split.cpp +++ b/util/string/split.cpp @@ -1,7 +1,7 @@ #include "split.h" template <class TValue> -inline size_t Split(const char* ptr, const char* delim, TVector<TValue>& values) { +inline size_t Split(const char* ptr, const char* delim, TVector<TValue>& values) { values.erase(values.begin(), values.end()); while (ptr && *ptr) { ptr += strspn(ptr, delim); @@ -15,10 +15,10 @@ inline size_t Split(const char* ptr, const char* delim, TVector<TValue>& values) return values.size(); } -size_t Split(const char* ptr, const char* delim, TVector<TString>& values) { - return Split<TString>(ptr, delim, values); +size_t Split(const char* ptr, const char* delim, TVector<TString>& values) { + return Split<TString>(ptr, delim, values); } -size_t Split(const TString& in, const TString& delim, TVector<TString>& res) { +size_t Split(const TString& in, const TString& delim, TVector<TString>& res) { return Split(in.data(), delim.data(), res); } diff --git a/util/string/split.h b/util/string/split.h index bc46d9e64c6..fd516336e12 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -9,7 +9,7 @@ #include <util/generic/iterator_range.h> #include <util/generic/store_policy.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/typetraits.h> #include <util/generic/vector.h> #include <util/generic/ylimits.h> @@ -72,7 +72,7 @@ SplitString(I b, const TDelim& d, TConsumer&& c) { } template <class I1, class I2> -static inline I1* FastStrChr(I1* str, I2 f) noexcept { +static inline I1* FastStrChr(I1* str, I2 f) noexcept { I1* ret = NStringSplitPrivate::Find(str, f); if (!ret) { @@ -83,7 +83,7 @@ static inline I1* FastStrChr(I1* str, I2 f) noexcept { } template <class I> -static inline I* FastStrStr(I* str, I* f, size_t l) noexcept { +static inline I* FastStrStr(I* str, I* f, size_t l) noexcept { std::basic_string_view<I> strView(str); const auto ret = strView.find(*f); @@ -283,7 +283,7 @@ struct TConsumerBackInserter<T, std::enable_if_t<!NSplitTargetHasPushBack::TClas template <class T> struct TContainerConsumer { - inline TContainerConsumer(T* c) noexcept + inline TContainerConsumer(T* c) noexcept : C(c) { } @@ -300,7 +300,7 @@ struct TContainerConsumer { template <class T> struct TContainerConvertingConsumer { - inline TContainerConvertingConsumer(T* c) noexcept + inline TContainerConvertingConsumer(T* c) noexcept : C(c) { } @@ -317,7 +317,7 @@ struct TContainerConvertingConsumer { template <class S, class I> struct TLimitingConsumer { - inline TLimitingConsumer(size_t cnt, S* slave) noexcept + inline TLimitingConsumer(size_t cnt, S* slave) noexcept : Cnt(cnt ? cnt - 1 : Max<size_t>()) , Slave(slave) , Last(nullptr) @@ -343,7 +343,7 @@ struct TLimitingConsumer { template <class S> struct TSkipEmptyTokens { - inline TSkipEmptyTokens(S* slave) noexcept + inline TSkipEmptyTokens(S* slave) noexcept : Slave(slave) { } @@ -362,7 +362,7 @@ struct TSkipEmptyTokens { template <class S> struct TKeepDelimiters { - inline TKeepDelimiters(S* slave) noexcept + inline TKeepDelimiters(S* slave) noexcept : Slave(slave) { } @@ -411,15 +411,15 @@ static inline void Split(char* buf, char ch, T* res) { /// Old good slow split function. /// Field delimter is any number of symbols specified in delim (no empty strings in res vector) /// @return number of elements created -size_t Split(const char* in, const char* delim, TVector<TString>& res); -size_t Split(const TString& in, const TString& delim, TVector<TString>& res); +size_t Split(const char* in, const char* delim, TVector<TString>& res); +size_t Split(const TString& in, const TString& delim, TVector<TString>& res); /// Old split reimplemented for TStringBuf using the new code /// Note that delim can be constructed from char* automatically (it is not cheap though) -inline size_t Split(const TStringBuf s, const TSetDelimiter<const char>& delim, TVector<TStringBuf>& res) { +inline size_t Split(const TStringBuf s, const TSetDelimiter<const char>& delim, TVector<TStringBuf>& res) { res.clear(); - TContainerConsumer<TVector<TStringBuf>> res1(&res); - TSkipEmptyTokens<TContainerConsumer<TVector<TStringBuf>>> consumer(&res1); + TContainerConsumer<TVector<TStringBuf>> res1(&res); + TSkipEmptyTokens<TContainerConsumer<TVector<TStringBuf>>> consumer(&res1); SplitString(s.data(), s.data() + s.size(), delim, consumer); return res.size(); } diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp index 43e59f2d754..01996e621b4 100644 --- a/util/string/split_ut.cpp +++ b/util/string/split_ut.cpp @@ -95,35 +95,35 @@ void TestConsumerOnRange(TResult& good, I* b, I* e, I* d) { UNIT_ASSERT_EQUAL(good, test); } -using TStrokaConsumer = TContainerConsumer<TVector<TString>>; +using TStrokaConsumer = TContainerConsumer<TVector<TString>>; -void TestLimitingConsumerOnString(TVector<TString>& good, const char* str, const char* d, size_t n, const char* last) { - TVector<TString> test; +void TestLimitingConsumerOnString(TVector<TString>& good, const char* str, const char* d, size_t n, const char* last) { + TVector<TString> test; TStrokaConsumer consumer(&test); TLimitingConsumer<TStrokaConsumer, const char> limits(n, &consumer); TCharDelimiter<const char> delim(*d); SplitString(str, delim, limits); Cmp(good, test); UNIT_ASSERT_EQUAL(good, test); - UNIT_ASSERT_EQUAL(TString(limits.Last), TString(last)); // Quite unobvious behaviour. Why the last token is not added to slave consumer? + UNIT_ASSERT_EQUAL(TString(limits.Last), TString(last)); // Quite unobvious behaviour. Why the last token is not added to slave consumer? } -void TestLimitingConsumerOnRange(TVector<TString>& good, const char* b, const char* e, const char* d, size_t n, const char* last) { - TVector<TString> test; +void TestLimitingConsumerOnRange(TVector<TString>& good, const char* b, const char* e, const char* d, size_t n, const char* last) { + TVector<TString> test; TStrokaConsumer consumer(&test); TLimitingConsumer<TStrokaConsumer, const char> limits(n, &consumer); TCharDelimiter<const char> delim(*d); SplitString(b, e, delim, limits); Cmp(good, test); UNIT_ASSERT_EQUAL(good, test); - UNIT_ASSERT_EQUAL(TString(limits.Last), TString(last)); + UNIT_ASSERT_EQUAL(TString(limits.Last), TString(last)); } Y_UNIT_TEST_SUITE(SplitStringTest) { Y_UNIT_TEST(TestCharSingleDelimiter) { - TString data("qw ab qwabcab"); - TString canonic[] = {"qw", "ab", "", "qwabcab"}; - TVector<TString> good(canonic, canonic + 4); + TString data("qw ab qwabcab"); + TString canonic[] = {"qw", "ab", "", "qwabcab"}; + TVector<TString> good(canonic, canonic + 4); TCharDelimiter<const char> delim(' '); TestDelimiterOnString<TContainerConsumer>(good, data.data(), delim); @@ -133,7 +133,7 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { Y_UNIT_TEST(TestWideSingleDelimiter) { TUtf16String data(u"qw ab qwabcab"); TUtf16String canonic[] = {u"qw", u"ab", TUtf16String(), u"qwabcab"}; - TVector<TUtf16String> good(canonic, canonic + 4); + TVector<TUtf16String> good(canonic, canonic + 4); TCharDelimiter<const wchar16> delim(' '); TestDelimiterOnString<TContainerConsumer>(good, data.data(), delim); @@ -141,9 +141,9 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { } Y_UNIT_TEST(TestConvertToIntCharSingleDelimiter) { - TString data("42 4242 -12345 0"); + TString data("42 4242 -12345 0"); i32 canonic[] = {42, 4242, -12345, 0}; - TVector<i32> good(canonic, canonic + 4); + TVector<i32> good(canonic, canonic + 4); TCharDelimiter<const char> delim(' '); TestDelimiterOnString<TContainerConvertingConsumer>(good, data.data(), delim); @@ -151,36 +151,36 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { } Y_UNIT_TEST(TestCharSkipEmpty) { - TString data("qw ab qwabcab "); - TString canonic[] = {"qw", "ab", "qwabcab"}; - TVector<TString> good(canonic, canonic + 3); + TString data("qw ab qwabcab "); + TString canonic[] = {"qw", "ab", "qwabcab"}; + TVector<TString> good(canonic, canonic + 3); TestConsumerOnString<TSkipEmptyTokens<TStrokaConsumer>>(good, data.data(), " "); TestConsumerOnRange<TSkipEmptyTokens<TStrokaConsumer>>(good, data.data(), data.end(), " "); } Y_UNIT_TEST(TestCharKeepDelimiters) { - TString data("qw ab qwabcab "); - TString canonic[] = {"qw", " ", "ab", " ", "", " ", "qwabcab", " ", ""}; - TVector<TString> good(canonic, canonic + 9); + TString data("qw ab qwabcab "); + TString canonic[] = {"qw", " ", "ab", " ", "", " ", "qwabcab", " ", ""}; + TVector<TString> good(canonic, canonic + 9); TestConsumerOnString<TKeepDelimiters<TStrokaConsumer>>(good, data.data(), " "); TestConsumerOnRange<TKeepDelimiters<TStrokaConsumer>>(good, data.data(), data.end(), " "); } Y_UNIT_TEST(TestCharLimit) { - TString data("qw ab qwabcab "); - TString canonic[] = {"qw", "ab"}; - TVector<TString> good(canonic, canonic + 2); + TString data("qw ab qwabcab "); + TString canonic[] = {"qw", "ab"}; + TVector<TString> good(canonic, canonic + 2); TestLimitingConsumerOnString(good, data.data(), " ", 3, " qwabcab "); TestLimitingConsumerOnRange(good, data.data(), data.end(), " ", 3, " qwabcab "); } Y_UNIT_TEST(TestCharStringDelimiter) { - TString data("qw ab qwababcab"); - TString canonic[] = {"qw ", " qw", "", "c", ""}; - TVector<TString> good(canonic, canonic + 5); + TString data("qw ab qwababcab"); + TString canonic[] = {"qw ", " qw", "", "c", ""}; + TVector<TString> good(canonic, canonic + 5); TStringDelimiter<const char> delim("ab"); TestDelimiterOnString<TContainerConsumer>(good, data.data(), delim); @@ -190,7 +190,7 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { Y_UNIT_TEST(TestWideStringDelimiter) { TUtf16String data(u"qw ab qwababcab"); TUtf16String canonic[] = {u"qw ", u" qw", TUtf16String(), u"c", TUtf16String()}; - TVector<TUtf16String> good(canonic, canonic + 5); + TVector<TUtf16String> good(canonic, canonic + 5); TUtf16String wideDelim(u"ab"); TStringDelimiter<const wchar16> delim(wideDelim.data()); @@ -199,9 +199,9 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { } Y_UNIT_TEST(TestCharSetDelimiter) { - TString data("qw ab qwababccab"); - TString canonic[] = {"q", " ab q", "abab", "", "ab"}; - TVector<TString> good(canonic, canonic + 5); + TString data("qw ab qwababccab"); + TString canonic[] = {"q", " ab q", "abab", "", "ab"}; + TVector<TString> good(canonic, canonic + 5); TSetDelimiter<const char> delim("wc"); TestDelimiterOnString<TContainerConsumer>(good, data.data(), delim); @@ -211,7 +211,7 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { Y_UNIT_TEST(TestWideSetDelimiter) { TUtf16String data(u"qw ab qwababccab"); TUtf16String canonic[] = {u"q", u" ab q", u"abab", TUtf16String(), u"ab"}; - TVector<TUtf16String> good(canonic, canonic + 5); + TVector<TUtf16String> good(canonic, canonic + 5); TUtf16String wideDelim(u"wc"); TSetDelimiter<const wchar16> delim(wideDelim.data()); @@ -221,17 +221,17 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { Y_UNIT_TEST(TestWideSetDelimiterRange) { TUtf16String data(u"qw ab qwababccab"); TUtf16String canonic[] = {u"q", u" ab q", u"abab", TUtf16String(), u"ab"}; - TVector<TUtf16String> good(1); + TVector<TUtf16String> good(1); TUtf16String wideDelim(u"wc"); TSetDelimiter<const wchar16> delim(wideDelim.data()); - TVector<TUtf16String> test; - TContainerConsumer<TVector<TUtf16String>> consumer(&test); + TVector<TUtf16String> test; + TContainerConsumer<TVector<TUtf16String>> consumer(&test); SplitString(data.data(), data.data(), delim, consumer); // Empty string is still inserted into consumer Cmp(good, test); good.assign(canonic, canonic + 4); - good.push_back(TUtf16String()); + good.push_back(TUtf16String()); test.clear(); SplitString(data.data(), data.end() - 2, delim, consumer); Cmp(good, test); @@ -239,21 +239,21 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { Y_UNIT_TEST(TestSplit) { TString data("qw ab qwababcba"); - TString canonic[] = {"qw ", " qw", "c"}; - TVector<TString> good(canonic, canonic + 3); - TString delim = "ab"; - TVector<TString> test; + TString canonic[] = {"qw ", " qw", "c"}; + TVector<TString> good(canonic, canonic + 3); + TString delim = "ab"; + TVector<TString> test; Split(data, delim, test); Cmp(good, test); - TVector<TStringBuf> test1; + TVector<TStringBuf> test1; Split(data, delim.data(), test1); Cmp(good, test1); } Y_UNIT_TEST(ConvenientSplitTest) { - TString data("abc 22 33.5 xyz"); - TString str; + TString data("abc 22 33.5 xyz"); + TString str; int num1 = 0; double num2 = 0; TStringBuf strBuf; @@ -265,8 +265,8 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { } Y_UNIT_TEST(ConvenientSplitTestWithMaybe) { - TString data("abc 42"); - TString str; + TString data("abc 42"); + TString str; TMaybe<double> num2 = 1; TMaybe<double> maybe = 1; @@ -278,8 +278,8 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { } Y_UNIT_TEST(ConvenientSplitTestExceptions) { - TString data("abc 22 33"); - TString s1, s2, s3, s4; + TString data("abc 22 33"); + TString s1, s2, s3, s4; UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, s2), yexception); UNIT_ASSERT_NO_EXCEPTION(Split(data, ' ', s1, s2, s3)); @@ -287,9 +287,9 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { } Y_UNIT_TEST(ConvenientSplitTestMaybeExceptions) { - TString data("abc 22 33"); - TString s1, s2; - TMaybe<TString> m1, m2; + TString data("abc 22 33"); + TString s1, s2; + TMaybe<TString> m1, m2; UNIT_ASSERT_EXCEPTION(Split(data, ' ', s1, m1), yexception); UNIT_ASSERT_EXCEPTION(Split(data, ' ', m1, m2), yexception); diff --git a/util/string/strip.cpp b/util/string/strip.cpp index c921571cf06..0765806359c 100644 --- a/util/string/strip.cpp +++ b/util/string/strip.cpp @@ -3,11 +3,11 @@ #include <util/string/reverse.h> -bool Collapse(const TString& from, TString& to, size_t maxLen) { - return CollapseImpl<TString, bool (*)(unsigned char)>(from, to, maxLen, IsAsciiSpace); +bool Collapse(const TString& from, TString& to, size_t maxLen) { + return CollapseImpl<TString, bool (*)(unsigned char)>(from, to, maxLen, IsAsciiSpace); } -void CollapseText(const TString& from, TString& to, size_t maxLen) { +void CollapseText(const TString& from, TString& to, size_t maxLen) { Collapse(from, to, maxLen); StripInPlace(to); if (to.size() >= maxLen) { diff --git a/util/string/strip.h b/util/string/strip.h index d5ef6da96db..6b9e179b70a 100644 --- a/util/string/strip.h +++ b/util/string/strip.h @@ -2,13 +2,13 @@ #include "ascii.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <utility> template <class It> struct TIsAsciiSpaceAdapter { - bool operator()(const It& it) const noexcept { + bool operator()(const It& it) const noexcept { return IsAsciiSpace(*it); } }; @@ -26,7 +26,7 @@ struct TEqualsStripAdapter { } template <class It> - bool operator()(const It& it) const noexcept { + bool operator()(const It& it) const noexcept { return *it == Ch; } @@ -39,33 +39,33 @@ TEqualsStripAdapter<TChar> EqualsStripAdapter(TChar ch) { } template <class It, class TStripCriterion> -inline void StripRangeBegin(It& b, const It& e, TStripCriterion&& criterion) noexcept { +inline void StripRangeBegin(It& b, const It& e, TStripCriterion&& criterion) noexcept { while (b < e && criterion(b)) { ++b; } } template <class It> -inline void StripRangeBegin(It& b, const It& e) noexcept { +inline void StripRangeBegin(It& b, const It& e) noexcept { StripRangeBegin(b, e, IsAsciiSpaceAdapter(b)); } template <class It, class TStripCriterion> -inline void StripRangeEnd(const It& b, It& e, TStripCriterion&& criterion) noexcept { +inline void StripRangeEnd(const It& b, It& e, TStripCriterion&& criterion) noexcept { while (b < e && criterion(e - 1)) { --e; } } template <class It> -inline void StripRangeEnd(const It& b, It& e) noexcept { +inline void StripRangeEnd(const It& b, It& e) noexcept { StripRangeEnd(b, e, IsAsciiSpaceAdapter(b)); } template <bool stripBeg, bool stripEnd> struct TStripImpl { template <class It, class TStripCriterion> - static inline bool StripRange(It& b, It& e, TStripCriterion&& criterion) noexcept { + static inline bool StripRange(It& b, It& e, TStripCriterion&& criterion) noexcept { const size_t oldLen = e - b; if (stripBeg) { @@ -110,17 +110,17 @@ struct TStripImpl { }; template <class It, class TStripCriterion> -inline bool StripRange(It& b, It& e, TStripCriterion&& criterion) noexcept { +inline bool StripRange(It& b, It& e, TStripCriterion&& criterion) noexcept { return TStripImpl<true, true>::StripRange(b, e, criterion); } template <class It> -inline bool StripRange(It& b, It& e) noexcept { +inline bool StripRange(It& b, It& e) noexcept { return StripRange(b, e, IsAsciiSpaceAdapter(b)); } template <class It, class TStripCriterion> -inline bool Strip(It& b, size_t& len, TStripCriterion&& criterion) noexcept { +inline bool Strip(It& b, size_t& len, TStripCriterion&& criterion) noexcept { It e = b + len; if (StripRange(b, e, criterion)) { @@ -133,7 +133,7 @@ inline bool Strip(It& b, size_t& len, TStripCriterion&& criterion) noexcept { } template <class It> -inline bool Strip(It& b, size_t& len) noexcept { +inline bool Strip(It& b, size_t& len) noexcept { return Strip(b, len, IsAsciiSpaceAdapter(b)); } @@ -178,7 +178,7 @@ static inline T StripStringRight(const T& from, TStripCriterion&& criterion) { } /// Copies the given string removing leading and trailing spaces. -static inline bool Strip(const TString& from, TString& to) { +static inline bool Strip(const TString& from, TString& to) { return StripString(from, to); } @@ -189,9 +189,9 @@ inline TString& StripInPlace(TString& s) { } /// Returns a copy of the given string with removed leading and trailing spaces. -inline TString Strip(const TString& s) Y_WARN_UNUSED_RESULT; -inline TString Strip(const TString& s) { - TString ret = s; +inline TString Strip(const TString& s) Y_WARN_UNUSED_RESULT; +inline TString Strip(const TString& s) { + TString ret = s; Strip(ret, ret); return ret; } @@ -215,8 +215,8 @@ size_t CollapseImpl(TChar* s, size_t n, const TWhitespaceFunc& isWhitespace) { return newLen; } -template <class TStringType, class TWhitespaceFunc> -bool CollapseImpl(const TStringType& from, TStringType& to, size_t maxLen, const TWhitespaceFunc& isWhitespace) { +template <class TStringType, class TWhitespaceFunc> +bool CollapseImpl(const TStringType& from, TStringType& to, size_t maxLen, const TWhitespaceFunc& isWhitespace) { to = from; maxLen = maxLen ? Min(maxLen, to.size()) : to.size(); for (size_t i = 0; i < maxLen; ++i) { @@ -230,7 +230,7 @@ bool CollapseImpl(const TStringType& from, TStringType& to, size_t maxLen, const return false; } -bool Collapse(const TString& from, TString& to, size_t maxLen = 0); +bool Collapse(const TString& from, TString& to, size_t maxLen = 0); /// Replaces several consequtive space symbols with one (processing is limited to maxLen bytes) inline TString& CollapseInPlace(TString& s, size_t maxLen = 0) { @@ -241,17 +241,17 @@ inline TString& CollapseInPlace(TString& s, size_t maxLen = 0) { /// Replaces several consequtive space symbols with one (processing is limited to maxLen bytes) inline TString Collapse(const TString& s, size_t maxLen = 0) Y_WARN_UNUSED_RESULT; inline TString Collapse(const TString& s, size_t maxLen) { - TString ret; + TString ret; Collapse(s, ret, maxLen); return ret; } -void CollapseText(const TString& from, TString& to, size_t maxLen); +void CollapseText(const TString& from, TString& to, size_t maxLen); /// The same as Collapse() + truncates the string to maxLen. /// @details An ellipsis is inserted at the end of the truncated line. -inline void CollapseText(TString& s, size_t maxLen) { - TString to; +inline void CollapseText(TString& s, size_t maxLen) { + TString to; CollapseText(s, to, maxLen); s = to; } diff --git a/util/string/strip_ut.cpp b/util/string/strip_ut.cpp index d1029d1498a..83bfe73a87c 100644 --- a/util/string/strip_ut.cpp +++ b/util/string/strip_ut.cpp @@ -27,9 +27,9 @@ Y_UNIT_TEST_SUITE(TStripStringTest) { }; for (const auto& test : tests) { - TString inputStr(test.Str); + TString inputStr(test.Str); - TString s; + TString s; Strip(inputStr, s); UNIT_ASSERT_EQUAL(s, test.StripRes); @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(TStripStringTest) { for (auto test : tests) { UNIT_ASSERT_EQUAL( - StripString(TString(test.Str), EqualsStripAdapter('/')), + StripString(TString(test.Str), EqualsStripAdapter('/')), test.Result); }; } @@ -78,10 +78,10 @@ Y_UNIT_TEST_SUITE(TStripStringTest) { for (const auto& test : tests) { UNIT_ASSERT_EQUAL( - StripStringLeft(TString(test.Str), EqualsStripAdapter('/')), + StripStringLeft(TString(test.Str), EqualsStripAdapter('/')), test.ResultLeft); UNIT_ASSERT_EQUAL( - StripStringRight(TString(test.Str), EqualsStripAdapter('/')), + StripStringRight(TString(test.Str), EqualsStripAdapter('/')), test.ResultRight); }; } @@ -90,7 +90,7 @@ Y_UNIT_TEST_SUITE(TStripStringTest) { TStringBuf nullString(nullptr, nullptr); UNIT_ASSERT_EQUAL( StripString(nullString), - TString()); + TString()); } Y_UNIT_TEST(TestWtrokaStrip) { @@ -108,14 +108,14 @@ Y_UNIT_TEST_SUITE(TStripStringTest) { } Y_UNIT_TEST(TestCollapse) { - TString s; - Collapse(TString(" 123 456 "), s); + TString s; + Collapse(TString(" 123 456 "), s); UNIT_ASSERT(s == " 123 456 "); - Collapse(TString(" 123 456 "), s, 10); + Collapse(TString(" 123 456 "), s, 10); UNIT_ASSERT(s == " 123 456 "); - s = TString(" a b c "); - TString s2 = s; + s = TString(" a b c "); + TString s2 = s; CollapseInPlace(s2); UNIT_ASSERT(s == s2); @@ -125,9 +125,9 @@ Y_UNIT_TEST_SUITE(TStripStringTest) { } Y_UNIT_TEST(TestCollapseText) { - TString abs1("Very long description string written in unknown language."); - TString abs2(abs1); - TString abs3(abs1); + TString abs1("Very long description string written in unknown language."); + TString abs2(abs1); + TString abs3(abs1); CollapseText(abs1, 204); CollapseText(abs2, 54); CollapseText(abs3, 49); diff --git a/util/string/strspn.h b/util/string/strspn.h index 8229e74a9c8..c5bce7be462 100644 --- a/util/string/strspn.h +++ b/util/string/strspn.h @@ -4,7 +4,7 @@ #include <util/generic/bitmap.h> -template <class TSetType> +template <class TSetType> class TStrSpnImpl { public: inline TStrSpnImpl(const char* b, const char* e) { @@ -17,33 +17,33 @@ public: //FirstOf template <class It> - inline It FindFirstOf(It b, const char* e) const noexcept { + inline It FindFirstOf(It b, const char* e) const noexcept { return FindFirst<false>(b, e); } template <class It> - inline It FindFirstOf(It s) const noexcept { + inline It FindFirstOf(It s) const noexcept { return FindFirst<false>(s, TCStringEndIterator()); } //FirstNotOf template <class It> - inline It FindFirstNotOf(It b, const char* e) const noexcept { + inline It FindFirstNotOf(It b, const char* e) const noexcept { return FindFirst<true>(b, e); } template <class It> - inline It FindFirstNotOf(It s) const noexcept { + inline It FindFirstNotOf(It s) const noexcept { return FindFirst<true>(s, TCStringEndIterator()); } - inline void Set(ui8 b) noexcept { + inline void Set(ui8 b) noexcept { S_.Set(b); } private: template <bool Result, class It1, class It2> - inline It1 FindFirst(It1 b, It2 e) const noexcept { + inline It1 FindFirst(It1 b, It2 e) const noexcept { while (b != e && (S_.Get((ui8)*b) == Result)) { ++b; } @@ -59,7 +59,7 @@ private: } private: - TSetType S_; + TSetType S_; }; using TCompactStrSpn = TStrSpnImpl<TBitMap<256>>; diff --git a/util/string/subst.h b/util/string/subst.h index 45b622fbefd..8855e818fac 100644 --- a/util/string/subst.h +++ b/util/string/subst.h @@ -36,21 +36,21 @@ size_t SubstGlobal(TUtf32String& text, wchar32 what, wchar32 with, size_t from = // TODO(yazevnul): // - rename `SubstGlobal` to `ReplaceAll` for convenience -// - add `SubstGlobalCopy(TStringBuf)` for convenience +// - add `SubstGlobalCopy(TStringBuf)` for convenience // - add `RemoveAll(text, what, from)` as a shortcut for `SubstGlobal(text, what, "", from)` // - rename file to `replace.h` - -/* Replace all occurences of substring or character `what` with string or character `with` starting from position `from`, and return result string. - * - * @param text String to modify. - * @param what Substring/character to replace. - * @param with Substring/character to use as replacement. - * @param from Position at with to start replacement. - * - * @return Result string - */ -template <class TStringType, class TPatternType> + +/* Replace all occurences of substring or character `what` with string or character `with` starting from position `from`, and return result string. + * + * @param text String to modify. + * @param what Substring/character to replace. + * @param with Substring/character to use as replacement. + * @param from Position at with to start replacement. + * + * @return Result string + */ +template <class TStringType, class TPatternType> Y_WARN_UNUSED_RESULT TStringType SubstGlobalCopy(TStringType result, TPatternType what, TPatternType with, size_t from = 0) { - SubstGlobal(result, what, with, from); - return result; -} + SubstGlobal(result, what, with, from); + return result; +} diff --git a/util/string/subst_ut.cpp b/util/string/subst_ut.cpp index 21eccef7795..e1e76a82fee 100644 --- a/util/string/subst_ut.cpp +++ b/util/string/subst_ut.cpp @@ -6,11 +6,11 @@ Y_UNIT_TEST_SUITE(TStringSubst) { static const size_t MIN_FROM_CTX = 4; - static const TVector<TString> ALL_FROM{TString("F"), TString("FF")}; - static const TVector<TString> ALL_TO{TString(""), TString("T"), TString("TT"), TString("TTT")}; + static const TVector<TString> ALL_FROM{TString("F"), TString("FF")}; + static const TVector<TString> ALL_TO{TString(""), TString("T"), TString("TT"), TString("TTT")}; - static void AssertSubstGlobal(const TString& sFrom, const TString& sTo, const TString& from, const TString& to, const size_t fromPos, const size_t numSubst) { - TString s = sFrom; + static void AssertSubstGlobal(const TString& sFrom, const TString& sTo, const TString& from, const TString& to, const size_t fromPos, const size_t numSubst) { + TString s = sFrom; size_t res = SubstGlobal(s, from, to, fromPos); UNIT_ASSERT_VALUES_EQUAL_C(res, numSubst, TStringBuilder() << "numSubst=" << numSubst << ", fromPos=" << fromPos << ", " << sFrom << " -> " << sTo); @@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(TStringSubst) { const size_t maxSz = fromSz + MIN_FROM_CTX; for (size_t sz = minSz; sz <= maxSz; ++sz) { for (size_t fromPos = 0; fromPos < sz; ++fromPos) { - TString s{sz, '.'}; + TString s{sz, '.'}; for (const auto& to : ALL_TO) { AssertSubstGlobal(s, s, from, to, fromPos, 0); } @@ -49,9 +49,9 @@ Y_UNIT_TEST_SUITE(TStringSubst) { for (size_t fromPos = 0; fromPos <= sz - fromSz; ++fromPos) { for (size_t fromBeg = 0; fromBeg < fromPos; ++fromBeg) { const auto parts = { - TString{fromBeg, '.'}, - TString{sz - fromSz - fromBeg, '.'}}; - TString s = JoinSeq(from, parts); + TString{fromBeg, '.'}, + TString{sz - fromSz - fromBeg, '.'}}; + TString s = JoinSeq(from, parts); for (const auto& to : ALL_TO) { AssertSubstGlobal(s, s, from, to, fromPos, 0); } @@ -62,7 +62,7 @@ Y_UNIT_TEST_SUITE(TStringSubst) { } static void DoTestSubstGlobal(TVector<TString>& parts, const size_t minBeg, const size_t sz, - const TString& from, const size_t fromPos, const size_t numSubst) { + const TString& from, const size_t fromPos, const size_t numSubst) { const size_t numLeft = numSubst - parts.size(); for (size_t fromBeg = minBeg; fromBeg <= sz - numLeft * from.size(); ++fromBeg) { if (parts.empty()) { @@ -73,10 +73,10 @@ Y_UNIT_TEST_SUITE(TStringSubst) { if (numLeft == 1) { parts.emplace_back(sz - fromBeg - from.size(), '.'); - TString sFrom = JoinSeq(from, parts); + TString sFrom = JoinSeq(from, parts); UNIT_ASSERT_VALUES_EQUAL_C(sFrom.size(), sz, sFrom); for (const auto& to : ALL_TO) { - TString sTo = JoinSeq(to, parts); + TString sTo = JoinSeq(to, parts); AssertSubstGlobal(sFrom, sTo, from, to, fromPos, numSubst); } parts.pop_back(); @@ -89,7 +89,7 @@ Y_UNIT_TEST_SUITE(TStringSubst) { } static void DoTestSubstGlobal(size_t numSubst) { - TVector<TString> parts; + TVector<TString> parts; for (const auto& from : ALL_FROM) { const size_t fromSz = from.size(); const size_t minSz = numSubst * fromSz; @@ -120,132 +120,132 @@ Y_UNIT_TEST_SUITE(TStringSubst) { } Y_UNIT_TEST(TestSubstGlobalOld) { - TString s; + TString s; s = "aaa"; SubstGlobal(s, "a", "bb"); - UNIT_ASSERT_EQUAL(s, TString("bbbbbb")); + UNIT_ASSERT_EQUAL(s, TString("bbbbbb")); s = "aaa"; SubstGlobal(s, "a", "b"); - UNIT_ASSERT_EQUAL(s, TString("bbb")); + UNIT_ASSERT_EQUAL(s, TString("bbb")); s = "aaa"; SubstGlobal(s, "a", ""); - UNIT_ASSERT_EQUAL(s, TString("")); + UNIT_ASSERT_EQUAL(s, TString("")); s = "abcdefbcbcdfb"; SubstGlobal(s, "bc", "bbc", 2); - UNIT_ASSERT_EQUAL(s, TString("abcdefbbcbbcdfb")); + UNIT_ASSERT_EQUAL(s, TString("abcdefbbcbbcdfb")); s = "Москва ~ Париж"; SubstGlobal(s, " ~ ", " "); UNIT_ASSERT_EQUAL(s, TString("Москва Париж")); } - Y_UNIT_TEST(TestSubstGlobalOldRet) { - const TString s1 = "aaa"; - const TString s2 = SubstGlobalCopy(s1, "a", "bb"); - UNIT_ASSERT_EQUAL(s2, TString("bbbbbb")); - - const TString s3 = "aaa"; - const TString s4 = SubstGlobalCopy(s3, "a", "b"); - UNIT_ASSERT_EQUAL(s4, TString("bbb")); - - const TString s5 = "aaa"; - const TString s6 = SubstGlobalCopy(s5, "a", ""); - UNIT_ASSERT_EQUAL(s6, TString("")); - - const TString s7 = "abcdefbcbcdfb"; - const TString s8 = SubstGlobalCopy(s7, "bc", "bbc", 2); - UNIT_ASSERT_EQUAL(s8, TString("abcdefbbcbbcdfb")); - - const TString s9 = "Москва ~ Париж"; - const TString s10 = SubstGlobalCopy(s9, " ~ ", " "); - UNIT_ASSERT_EQUAL(s10, TString("Москва Париж")); - } - + Y_UNIT_TEST(TestSubstGlobalOldRet) { + const TString s1 = "aaa"; + const TString s2 = SubstGlobalCopy(s1, "a", "bb"); + UNIT_ASSERT_EQUAL(s2, TString("bbbbbb")); + + const TString s3 = "aaa"; + const TString s4 = SubstGlobalCopy(s3, "a", "b"); + UNIT_ASSERT_EQUAL(s4, TString("bbb")); + + const TString s5 = "aaa"; + const TString s6 = SubstGlobalCopy(s5, "a", ""); + UNIT_ASSERT_EQUAL(s6, TString("")); + + const TString s7 = "abcdefbcbcdfb"; + const TString s8 = SubstGlobalCopy(s7, "bc", "bbc", 2); + UNIT_ASSERT_EQUAL(s8, TString("abcdefbbcbbcdfb")); + + const TString s9 = "Москва ~ Париж"; + const TString s10 = SubstGlobalCopy(s9, " ~ ", " "); + UNIT_ASSERT_EQUAL(s10, TString("Москва Париж")); + } + Y_UNIT_TEST(TestSubstCharGlobal) { TUtf16String w = u"abcdabcd"; SubstGlobal(w, wchar16('b'), wchar16('B'), 3); UNIT_ASSERT_EQUAL(w, u"abcdaBcd"); - TString s = "aaa"; + TString s = "aaa"; SubstGlobal(s, 'a', 'b', 1); - UNIT_ASSERT_EQUAL(s, TString("abb")); + UNIT_ASSERT_EQUAL(s, TString("abb")); } - Y_UNIT_TEST(TestSubstCharGlobalRet) { + Y_UNIT_TEST(TestSubstCharGlobalRet) { const TUtf16String w1 = u"abcdabcd"; const TUtf16String w2 = SubstGlobalCopy(w1, wchar16('b'), wchar16('B'), 3); UNIT_ASSERT_EQUAL(w2, u"abcdaBcd"); - - const TString s1 = "aaa"; - const TString s2 = SubstGlobalCopy(s1, 'a', 'b', 1); - UNIT_ASSERT_EQUAL(s2, TString("abb")); - } - + + const TString s1 = "aaa"; + const TString s2 = SubstGlobalCopy(s1, 'a', 'b', 1); + UNIT_ASSERT_EQUAL(s2, TString("abb")); + } + Y_UNIT_TEST(TestSubstStdString) { std::string s = "aaa"; SubstGlobal(s, "a", "b", 1); UNIT_ASSERT_EQUAL(s, "abb"); } - Y_UNIT_TEST(TestSubstStdStringRet) { - const std::string s1 = "aaa"; - const std::string s2 = SubstGlobalCopy(s1, "a", "b", 1); - UNIT_ASSERT_EQUAL(s2, "abb"); - } - + Y_UNIT_TEST(TestSubstStdStringRet) { + const std::string s1 = "aaa"; + const std::string s2 = SubstGlobalCopy(s1, "a", "b", 1); + UNIT_ASSERT_EQUAL(s2, "abb"); + } + Y_UNIT_TEST(TestSubstGlobalChar) { { - const TString s = "a"; - const TString st = "b"; - TString ss = s; + const TString s = "a"; + const TString st = "b"; + TString ss = s; UNIT_ASSERT_VALUES_EQUAL(s.size(), SubstGlobal(ss, 'a', 'b')); UNIT_ASSERT_VALUES_EQUAL(st, ss); } { - const TString s = "aa"; - const TString st = "bb"; - TString ss = s; + const TString s = "aa"; + const TString st = "bb"; + TString ss = s; UNIT_ASSERT_VALUES_EQUAL(s.size(), SubstGlobal(ss, 'a', 'b')); UNIT_ASSERT_VALUES_EQUAL(st, ss); } { - const TString s = "aaa"; - const TString st = "bbb"; - TString ss = s; + const TString s = "aaa"; + const TString st = "bbb"; + TString ss = s; UNIT_ASSERT_VALUES_EQUAL(s.size(), SubstGlobal(ss, 'a', 'b')); UNIT_ASSERT_VALUES_EQUAL(st, ss); } { - const TString s = "aaaa"; - const TString st = "bbbb"; - TString ss = s; + const TString s = "aaaa"; + const TString st = "bbbb"; + TString ss = s; UNIT_ASSERT_VALUES_EQUAL(s.size(), SubstGlobal(ss, 'a', 'b')); UNIT_ASSERT_VALUES_EQUAL(st, ss); } { - const TString s = "aaaaa"; - const TString st = "bbbbb"; - TString ss = s; + const TString s = "aaaaa"; + const TString st = "bbbbb"; + TString ss = s; UNIT_ASSERT_VALUES_EQUAL(s.size(), SubstGlobal(ss, 'a', 'b')); UNIT_ASSERT_VALUES_EQUAL(st, ss); } { - const TString s = "aaaaaa"; - const TString st = "bbbbbb"; - TString ss = s; + const TString s = "aaaaaa"; + const TString st = "bbbbbb"; + TString ss = s; UNIT_ASSERT_VALUES_EQUAL(s.size(), SubstGlobal(ss, 'a', 'b')); UNIT_ASSERT_VALUES_EQUAL(st, ss); } { - const TString s = "aaaaaaa"; - const TString st = "bbbbbbb"; - TString ss = s; + const TString s = "aaaaaaa"; + const TString st = "bbbbbbb"; + TString ss = s; UNIT_ASSERT_VALUES_EQUAL(s.size(), SubstGlobal(ss, 'a', 'b')); UNIT_ASSERT_VALUES_EQUAL(st, ss); } { - const TString s = "aaaaaaaa"; - const TString st = "bbbbbbbb"; - TString ss = s; + const TString s = "aaaaaaaa"; + const TString st = "bbbbbbbb"; + TString ss = s; UNIT_ASSERT_VALUES_EQUAL(s.size(), SubstGlobal(ss, 'a', 'b')); UNIT_ASSERT_VALUES_EQUAL(st, ss); } diff --git a/util/string/type.cpp b/util/string/type.cpp index 49671c02c2c..b5a660008b4 100644 --- a/util/string/type.cpp +++ b/util/string/type.cpp @@ -3,7 +3,7 @@ #include <array> -bool IsSpace(const char* s, size_t len) noexcept { +bool IsSpace(const char* s, size_t len) noexcept { if (len == 0) { return false; } diff --git a/util/string/type_ut.cpp b/util/string/type_ut.cpp index 03e7af62bd0..93562821194 100644 --- a/util/string/type_ut.cpp +++ b/util/string/type_ut.cpp @@ -62,7 +62,7 @@ Y_UNIT_TEST_SUITE(TStringClassify) { UNIT_ASSERT(IsHexNumber("1234567890a")); UNIT_ASSERT(!IsHexNumber("12345xx67890a")); UNIT_ASSERT(!IsHexNumber("foobar")); - UNIT_ASSERT(!IsHexNumber(TString())); + UNIT_ASSERT(!IsHexNumber(TString())); UNIT_ASSERT(IsHexNumber(u"0")); UNIT_ASSERT(IsHexNumber(u"aaaadddAAAAA")); @@ -71,6 +71,6 @@ Y_UNIT_TEST_SUITE(TStringClassify) { UNIT_ASSERT(IsHexNumber(u"1234567890a")); UNIT_ASSERT(!IsHexNumber(u"12345xx67890a")); UNIT_ASSERT(!IsHexNumber(u"foobar")); - UNIT_ASSERT(!IsHexNumber(TUtf16String())); + UNIT_ASSERT(!IsHexNumber(TUtf16String())); } } diff --git a/util/string/util.cpp b/util/string/util.cpp index b14f20bf75a..a528489b9b0 100644 --- a/util/string/util.cpp +++ b/util/string/util.cpp @@ -6,7 +6,7 @@ #include <cstdarg> #include <cstdlib> -int a2i(const TString& s) { +int a2i(const TString& s) { return atoi(s.c_str()); } @@ -49,20 +49,20 @@ Tr::Tr(const char* from, const char* to) { } } -size_t Tr::FindFirstChangePosition(const TString& str) const { +size_t Tr::FindFirstChangePosition(const TString& str) const { for (auto it = str.begin(); it != str.end(); ++it) { if (ConvertChar(*it) != *it) { return it - str.begin(); } } - return TString::npos; + return TString::npos; } -void Tr::Do(TString& str) const { +void Tr::Do(TString& str) const { const size_t changePosition = FindFirstChangePosition(str); - if (changePosition == TString::npos) { + if (changePosition == TString::npos) { return; } diff --git a/util/string/util.h b/util/string/util.h index 0d77a5042b8..4108a1389a0 100644 --- a/util/string/util.h +++ b/util/string/util.h @@ -7,12 +7,12 @@ #include <algorithm> #include <util/system/defaults.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> /// @addtogroup Strings_Miscellaneous /// @{ -int a2i(const TString& s); +int a2i(const TString& s); /// Removes the last character if it is equal to c. template <class T> @@ -23,7 +23,7 @@ inline void RemoveIfLast(T& s, int c) { } /// Adds lastCh symbol to the the of the string if it is not already there. -inline void addIfNotLast(TString& s, int lastCh) { +inline void addIfNotLast(TString& s, int lastCh) { size_t len = s.length(); if (!len || s[len - 1] != lastCh) { s.append(char(lastCh)); @@ -33,9 +33,9 @@ inline void addIfNotLast(TString& s, int lastCh) { /// @details Finishes the string with lastCh1 if lastCh2 is not present in the string and lastCh1 is not already at the end of the string. /// Else, if lastCh2 is not equal to the symbol before the last, it finishes the string with lastCh2. /// @todo ?? Define, when to apply the function. Is in use several times for URLs parsing. -inline void addIfAbsent(TString& s, char lastCh1, char lastCh2) { +inline void addIfAbsent(TString& s, char lastCh1, char lastCh2) { size_t pos = s.find(lastCh2); - if (pos == TString::npos) { + if (pos == TString::npos) { //s.append((char)lastCh1); addIfNotLast(s, lastCh1); } else if (pos < s.length() - 1) { @@ -173,18 +173,18 @@ public: for (size_t i = 0; i < l && s[i]; i++) s[i] = ConvertChar(s[i]); } - void Do(TString& str) const; + void Do(TString& str) const; private: char Map[256]; - size_t FindFirstChangePosition(const TString& str) const; + size_t FindFirstChangePosition(const TString& str) const; }; // Removes all occurrences of given character from string template <typename TStringType> void RemoveAll(TStringType& str, typename TStringType::char_type ch) { - size_t pos = str.find(ch); // 'find' to avoid cloning of string in 'TString.begin()' + size_t pos = str.find(ch); // 'find' to avoid cloning of string in 'TString.begin()' if (pos == TStringType::npos) return; diff --git a/util/string/util_ut.cpp b/util/string/util_ut.cpp index 18a2d8e1957..2d9f5f35794 100644 --- a/util/string/util_ut.cpp +++ b/util/string/util_ut.cpp @@ -36,7 +36,7 @@ public: }; for (const T* t = tests; t != std::end(tests); ++t) { - TString str(t->Str); + TString str(t->Str); RemoveAll(str, t->Ch); UNIT_ASSERT_EQUAL(t->Result, str); } diff --git a/util/string/vector.cpp b/util/string/vector.cpp index 9ba401f0a23..eb24bfcf273 100644 --- a/util/string/vector.cpp +++ b/util/string/vector.cpp @@ -22,7 +22,7 @@ static inline void DoSplit1(TConsumer& cc, TDelim& d, const TBasicStringBuf<TChr template <class C, class TDelim, typename TChr> static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d, size_t maxFields, int options) { - using TStringType = std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>; + using TStringType = std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>; res->clear(); if (!str.data()) { @@ -79,13 +79,13 @@ void ::NPrivate::SplitStringImpl(TVector<TUtf16String>* res, const wchar16* ptr, return SplitStringImplT<wchar16>(res, TWtringBuf(ptr, len), delimiter, maxFields, options); } -TUtf16String JoinStrings(const TVector<TUtf16String>& v, const TWtringBuf delim) { - return JoinStrings(v.begin(), v.end(), delim); +TUtf16String JoinStrings(const TVector<TUtf16String>& v, const TWtringBuf delim) { + return JoinStrings(v.begin(), v.end(), delim); } -TUtf16String JoinStrings(const TVector<TUtf16String>& v, size_t index, size_t count, const TWtringBuf delim) { +TUtf16String JoinStrings(const TVector<TUtf16String>& v, size_t index, size_t count, const TWtringBuf delim) { const size_t f = Min(index, v.size()); const size_t l = f + Min(count, v.size() - f); - return JoinStrings(v.begin() + f, v.begin() + l, delim); + return JoinStrings(v.begin() + f, v.begin() + l, delim); } diff --git a/util/string/vector.h b/util/string/vector.h index e36c348bbef..08f2d7e4898 100644 --- a/util/string/vector.h +++ b/util/string/vector.h @@ -5,7 +5,7 @@ #include <util/generic/map.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/string/cast.h> #include <util/system/yassert.h> @@ -67,11 +67,11 @@ SplitString(const typename ::NPrivate::TStringDeducer<C>::type& str, const C* de } template <class TIter> -inline TString JoinStrings(TIter begin, TIter end, const TStringBuf delim) { +inline TString JoinStrings(TIter begin, TIter end, const TStringBuf delim) { if (begin == end) - return TString(); + return TString(); - TString result = ToString(*begin); + TString result = ToString(*begin); for (++begin; begin != end; ++begin) { result.append(delim); @@ -82,11 +82,11 @@ inline TString JoinStrings(TIter begin, TIter end, const TStringBuf delim) { } template <class TIter> -inline TUtf16String JoinStrings(TIter begin, TIter end, const TWtringBuf delim) { +inline TUtf16String JoinStrings(TIter begin, TIter end, const TWtringBuf delim) { if (begin == end) - return TUtf16String(); + return TUtf16String(); - TUtf16String result = ToWtring(*begin); + TUtf16String result = ToWtring(*begin); for (++begin; begin != end; ++begin) { result.append(delim); @@ -96,34 +96,34 @@ inline TUtf16String JoinStrings(TIter begin, TIter end, const TWtringBuf delim) return result; } -/// Concatenates elements of given TVector<TString>. -inline TString JoinStrings(const TVector<TString>& v, const TStringBuf delim) { - return JoinStrings(v.begin(), v.end(), delim); +/// Concatenates elements of given TVector<TString>. +inline TString JoinStrings(const TVector<TString>& v, const TStringBuf delim) { + return JoinStrings(v.begin(), v.end(), delim); } -inline TString JoinStrings(const TVector<TString>& v, size_t index, size_t count, const TStringBuf delim) { - Y_ASSERT(index + count <= v.size() && "JoinStrings(): index or count out of range"); - return JoinStrings(v.begin() + index, v.begin() + index + count, delim); +inline TString JoinStrings(const TVector<TString>& v, size_t index, size_t count, const TStringBuf delim) { + Y_ASSERT(index + count <= v.size() && "JoinStrings(): index or count out of range"); + return JoinStrings(v.begin() + index, v.begin() + index + count, delim); } template <typename T> -inline TString JoinVectorIntoString(const TVector<T>& v, const TStringBuf delim) { - return JoinStrings(v.begin(), v.end(), delim); +inline TString JoinVectorIntoString(const TVector<T>& v, const TStringBuf delim) { + return JoinStrings(v.begin(), v.end(), delim); } template <typename T> -inline TString JoinVectorIntoString(const TVector<T>& v, size_t index, size_t count, const TStringBuf delim) { +inline TString JoinVectorIntoString(const TVector<T>& v, size_t index, size_t count, const TStringBuf delim) { Y_ASSERT(index + count <= v.size() && "JoinVectorIntoString(): index or count out of range"); - return JoinStrings(v.begin() + index, v.begin() + index + count, delim); + return JoinStrings(v.begin() + index, v.begin() + index + count, delim); } -TUtf16String JoinStrings(const TVector<TUtf16String>& v, const TWtringBuf delim); -TUtf16String JoinStrings(const TVector<TUtf16String>& v, size_t index, size_t count, const TWtringBuf delim); +TUtf16String JoinStrings(const TVector<TUtf16String>& v, const TWtringBuf delim); +TUtf16String JoinStrings(const TVector<TUtf16String>& v, size_t index, size_t count, const TWtringBuf delim); //! Converts vector of strings to vector of type T variables template <typename T, typename TStringType> -TVector<T> Scan(const TVector<TStringType>& input) { - TVector<T> output; +TVector<T> Scan(const TVector<TStringType>& input) { + TVector<T> output; output.reserve(input.size()); for (int i = 0; i < input.ysize(); ++i) { output.push_back(FromString<T>(input[i])); diff --git a/util/string/vector_ut.cpp b/util/string/vector_ut.cpp index 817120f2683..b6b22a8cf4e 100644 --- a/util/string/vector_ut.cpp +++ b/util/string/vector_ut.cpp @@ -6,33 +6,33 @@ Y_UNIT_TEST_SUITE(TStringJoinTest) { Y_UNIT_TEST(Test1) { - TVector<TUtf16String> v; + TVector<TUtf16String> v; - UNIT_ASSERT_EQUAL(JoinStrings(v, ToWtring("")), ToWtring("")); + UNIT_ASSERT_EQUAL(JoinStrings(v, ToWtring("")), ToWtring("")); } Y_UNIT_TEST(Test2) { - TVector<TUtf16String> v; + TVector<TUtf16String> v; v.push_back(ToWtring("1")); v.push_back(ToWtring("2")); - UNIT_ASSERT_EQUAL(JoinStrings(v, ToWtring(" ")), ToWtring("1 2")); + UNIT_ASSERT_EQUAL(JoinStrings(v, ToWtring(" ")), ToWtring("1 2")); } Y_UNIT_TEST(Test3) { - TVector<TUtf16String> v; + TVector<TUtf16String> v; v.push_back(ToWtring("1")); v.push_back(ToWtring("2")); - UNIT_ASSERT_EQUAL(JoinStrings(v, 1, 10, ToWtring(" ")), ToWtring("2")); + UNIT_ASSERT_EQUAL(JoinStrings(v, 1, 10, ToWtring(" ")), ToWtring("2")); } Y_UNIT_TEST(TestJoinWStrings) { const TUtf16String str = u"Яндекс"; - const TVector<TUtf16String> v(1, str); + const TVector<TUtf16String> v(1, str); - UNIT_ASSERT_EQUAL(JoinStrings(v, TUtf16String()), str); + UNIT_ASSERT_EQUAL(JoinStrings(v, TUtf16String()), str); } } diff --git a/util/system/align.h b/util/system/align.h index ea0bbc5b466..0261b6848e1 100644 --- a/util/system/align.h +++ b/util/system/align.h @@ -5,45 +5,45 @@ #include <util/generic/bitops.h> template <class T> -static inline T AlignDown(T len, T align) noexcept { +static inline T AlignDown(T len, T align) noexcept { Y_ASSERT(IsPowerOf2(align)); // align should be power of 2 return len & ~(align - 1); } template <class T> -static inline T AlignUp(T len, T align) noexcept { +static inline T AlignUp(T len, T align) noexcept { const T alignedResult = AlignDown(len + (align - 1), align); Y_ASSERT(alignedResult >= len); // check for overflow return alignedResult; } template <class T> -static inline T AlignUpSpace(T len, T align) noexcept { +static inline T AlignUpSpace(T len, T align) noexcept { Y_ASSERT(IsPowerOf2(align)); // align should be power of 2 return ((T)0 - len) & (align - 1); // AlignUp(len, align) - len; } template <class T> -static inline T* AlignUp(T* ptr, size_t align) noexcept { +static inline T* AlignUp(T* ptr, size_t align) noexcept { return (T*)AlignUp((uintptr_t)ptr, align); } template <class T> -static inline T* AlignDown(T* ptr, size_t align) noexcept { +static inline T* AlignDown(T* ptr, size_t align) noexcept { return (T*)AlignDown((uintptr_t)ptr, align); } template <class T> -static inline T AlignUp(T t) noexcept { +static inline T AlignUp(T t) noexcept { return AlignUp(t, (size_t)PLATFORM_DATA_ALIGN); } template <class T> -static inline T AlignDown(T t) noexcept { +static inline T AlignDown(T t) noexcept { return AlignDown(t, (size_t)PLATFORM_DATA_ALIGN); } template <class T> -static inline T Align(T t) noexcept { +static inline T Align(T t) noexcept { return AlignUp(t); } diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp index 74fb10b6b1d..4ae0d9c3e77 100644 --- a/util/system/atexit.cpp +++ b/util/system/atexit.cpp @@ -34,7 +34,7 @@ namespace { { } - inline void Finish() noexcept { + inline void Finish() noexcept { AtomicSet(FinishStarted_, 1); auto guard = Guard(Lock_); @@ -72,8 +72,8 @@ namespace { private: TAdaptiveLock Lock_; TAtomic FinishStarted_; - TDeque<TFunc> Store_; - TPriorityQueue<TFunc*, TVector<TFunc*>, TCmp> Items_; + TDeque<TFunc> Store_; + TPriorityQueue<TFunc*, TVector<TFunc*>, TCmp> Items_; }; static TAtomic atExitLock = 0; diff --git a/util/system/atomic_ut.cpp b/util/system/atomic_ut.cpp index 07211ffba73..0265f57c600 100644 --- a/util/system/atomic_ut.cpp +++ b/util/system/atomic_ut.cpp @@ -213,11 +213,11 @@ using TAltAtomic = volatile TChooser<TAtomicBase, long, long long>::TdType; class TTTest: public TAtomicTest<TAltAtomic> { public: - TString Name() const noexcept override { + TString Name() const noexcept override { return "TAtomicTest<TAltAtomic>"; } - static TString StaticName() noexcept { + static TString StaticName() noexcept { return "TAtomicTest<TAltAtomic>"; } }; diff --git a/util/system/backtrace.cpp b/util/system/backtrace.cpp index b77fe58fb11..3e6e05a61ff 100644 --- a/util/system/backtrace.cpp +++ b/util/system/backtrace.cpp @@ -6,7 +6,7 @@ #include <util/stream/output.h> #include <util/stream/format.h> #include <util/generic/array_ref.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #ifdef _win_ #include "mutex.h" @@ -278,7 +278,7 @@ void TBackTrace::PrintTo(IOutputStream& out) const { FormatBackTraceFn(&out, Data, Size); } -TString TBackTrace::PrintToString() const { +TString TBackTrace::PrintToString() const { TStringStream ss; PrintTo(ss); return ss.Str(); diff --git a/util/system/backtrace.h b/util/system/backtrace.h index 2fce7585c3a..0f91f96951e 100644 --- a/util/system/backtrace.h +++ b/util/system/backtrace.h @@ -35,7 +35,7 @@ public: TBackTrace(); void Capture(); void PrintTo(IOutputStream&) const; - TString PrintToString() const; + TString PrintToString() const; size_t size() const; const void* const* data() const; operator TBackTraceView() const; diff --git a/util/system/backtrace_ut.cpp b/util/system/backtrace_ut.cpp index 9b5ead71bc1..766e6bbfa2d 100644 --- a/util/system/backtrace_ut.cpp +++ b/util/system/backtrace_ut.cpp @@ -31,7 +31,7 @@ void SomeMethod() { return; #endif - UNIT_ASSERT(out.Empty() || out.Str().find("SomeMethod") != TString::npos); + UNIT_ASSERT(out.Empty() || out.Str().find("SomeMethod") != TString::npos); } class TBackTraceTest: public TTestBase { diff --git a/util/system/byteorder.h b/util/system/byteorder.h index 94b9fea5152..56dc3943a7e 100644 --- a/util/system/byteorder.h +++ b/util/system/byteorder.h @@ -33,7 +33,7 @@ #endif #ifndef SwapBytes16 -inline ui16 SwapBytes16(ui16 val) noexcept { +inline ui16 SwapBytes16(ui16 val) noexcept { #define byte_n(__val, __n) ((((unsigned char*)(&__val))[__n])) DoSwap(byte_n(val, 0), byte_n(val, 1)); return val; @@ -42,7 +42,7 @@ inline ui16 SwapBytes16(ui16 val) noexcept { #endif #ifndef SwapBytes32 -inline ui32 SwapBytes32(ui32 val) noexcept { +inline ui32 SwapBytes32(ui32 val) noexcept { #define byte_n(__val, __n) ((((unsigned char*)(&__val))[__n])) DoSwap(byte_n(val, 0), byte_n(val, 3)); DoSwap(byte_n(val, 1), byte_n(val, 2)); @@ -52,7 +52,7 @@ inline ui32 SwapBytes32(ui32 val) noexcept { #endif #ifndef SwapBytes64 -inline ui64 SwapBytes64(ui64 val) noexcept { +inline ui64 SwapBytes64(ui64 val) noexcept { union { ui64 val; ui32 p[2]; @@ -66,8 +66,8 @@ inline ui64 SwapBytes64(ui64 val) noexcept { } #endif -//for convenience -static inline ui8 SwapBytes8(ui8 v) noexcept { +//for convenience +static inline ui8 SwapBytes8(ui8 v) noexcept { return v; } @@ -94,22 +94,22 @@ namespace NSwapBytes { } template <class T> -inline T SwapBytes(T val) noexcept { +inline T SwapBytes(T val) noexcept { return NSwapBytes::TSwapBytesHelper<sizeof(T) * 8>::Swap(val); } template <class T> -inline T LittleToBig(T val) noexcept { +inline T LittleToBig(T val) noexcept { return SwapBytes(val); } template <class T> -inline T BigToLittle(T val) noexcept { +inline T BigToLittle(T val) noexcept { return LittleToBig(val); } template <class T> -inline T HostToInet(T val) noexcept { +inline T HostToInet(T val) noexcept { #if defined(_big_endian_) return val; #elif defined(_little_endian_) @@ -120,12 +120,12 @@ inline T HostToInet(T val) noexcept { } template <class T> -inline T InetToHost(T val) noexcept { +inline T InetToHost(T val) noexcept { return HostToInet(val); } template <class T> -inline T HostToLittle(T val) noexcept { +inline T HostToLittle(T val) noexcept { #if defined(_big_endian_) return BigToLittle(val); #elif defined(_little_endian_) @@ -136,6 +136,6 @@ inline T HostToLittle(T val) noexcept { } template <class T> -inline T LittleToHost(T val) noexcept { +inline T LittleToHost(T val) noexcept { return HostToLittle(val); } diff --git a/util/system/compiler.h b/util/system/compiler.h index b373edcc466..77825642073 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -24,7 +24,7 @@ * int main() { * Hi(); // void Hi() * Do<int>(); // void Do() [T = int] - * Do<TString>(); // void Do() [T = TString] + * Do<TString>(); // void Do() [T = TString] * } * @endcode */ @@ -216,8 +216,8 @@ constexpr Y_FORCE_INLINE int Y_UNUSED(Types&&...) { * * // we know that xs and ys are non-negative from domain knowledge, * // but we can't change the types of xs and ys because of API constrains - * int Foo(const TVector<int>& xs, const TVector<int>& ys) { - * TVector<int> avgs; + * int Foo(const TVector<int>& xs, const TVector<int>& ys) { + * TVector<int> avgs; * avgs.resize(xs.size()); * for (size_t i = 0; i < xs.size(); ++i) { * auto x = xs[i]; @@ -313,12 +313,12 @@ _YandexAbort(); #else #define Y_WEAK #endif - + #if defined(__CUDACC_VER_MAJOR__) #define Y_CUDA_AT_LEAST(x, y) (__CUDACC_VER_MAJOR__ > x || (__CUDACC_VER_MAJOR__ == x && __CUDACC_VER_MINOR__ >= y)) #else #define Y_CUDA_AT_LEAST(x, y) 0 -#endif +#endif // NVidia CUDA C++ Compiler did not know about noexcept keyword until version 9.0 #if !Y_CUDA_AT_LEAST(9, 0) @@ -336,145 +336,145 @@ _YandexAbort(); #define Y_LEAF #define Y_WRAPPER #endif - -/** - * @def Y_PRAGMA - * - * Macro for use in other macros to define compiler pragma - * See below for other usage examples - * - * @code - * #if defined(__clang__) || defined(__GNUC__) - * #define Y_PRAGMA_NO_WSHADOW \ - * Y_PRAGMA("GCC diagnostic ignored \"-Wshadow\"") - * #elif defined(_MSC_VER) - * #define Y_PRAGMA_NO_WSHADOW \ - * Y_PRAGMA("warning(disable:4456 4457") - * #else - * #define Y_PRAGMA_NO_WSHADOW - * #endif - * @endcode - */ -#if defined(__clang__) || defined(__GNUC__) + +/** + * @def Y_PRAGMA + * + * Macro for use in other macros to define compiler pragma + * See below for other usage examples + * + * @code + * #if defined(__clang__) || defined(__GNUC__) + * #define Y_PRAGMA_NO_WSHADOW \ + * Y_PRAGMA("GCC diagnostic ignored \"-Wshadow\"") + * #elif defined(_MSC_VER) + * #define Y_PRAGMA_NO_WSHADOW \ + * Y_PRAGMA("warning(disable:4456 4457") + * #else + * #define Y_PRAGMA_NO_WSHADOW + * #endif + * @endcode + */ +#if defined(__clang__) || defined(__GNUC__) #define Y_PRAGMA(x) _Pragma(x) #elif defined(_MSC_VER) #define Y_PRAGMA(x) __pragma(x) -#else +#else #define Y_PRAGMA(x) -#endif - -/** - * @def Y_PRAGMA_DIAGNOSTIC_PUSH - * - * Cross-compiler pragma to save diagnostic settings - * - * @see - * GCC: https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html - * MSVC: https://msdn.microsoft.com/en-us/library/2c8f766e.aspx - * Clang: https://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas - * - * @code - * Y_PRAGMA_DIAGNOSTIC_PUSH - * @endcode - */ -#if defined(__clang__) || defined(__GNUC__) +#endif + +/** + * @def Y_PRAGMA_DIAGNOSTIC_PUSH + * + * Cross-compiler pragma to save diagnostic settings + * + * @see + * GCC: https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html + * MSVC: https://msdn.microsoft.com/en-us/library/2c8f766e.aspx + * Clang: https://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas + * + * @code + * Y_PRAGMA_DIAGNOSTIC_PUSH + * @endcode + */ +#if defined(__clang__) || defined(__GNUC__) #define Y_PRAGMA_DIAGNOSTIC_PUSH \ Y_PRAGMA("GCC diagnostic push") -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) #define Y_PRAGMA_DIAGNOSTIC_PUSH \ Y_PRAGMA(warning(push)) -#else +#else #define Y_PRAGMA_DIAGNOSTIC_PUSH -#endif - -/** - * @def Y_PRAGMA_DIAGNOSTIC_POP - * - * Cross-compiler pragma to restore diagnostic settings - * - * @see - * GCC: https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html - * MSVC: https://msdn.microsoft.com/en-us/library/2c8f766e.aspx - * Clang: https://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas - * - * @code - * Y_PRAGMA_DIAGNOSTIC_POP - * @endcode - */ -#if defined(__clang__) || defined(__GNUC__) +#endif + +/** + * @def Y_PRAGMA_DIAGNOSTIC_POP + * + * Cross-compiler pragma to restore diagnostic settings + * + * @see + * GCC: https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html + * MSVC: https://msdn.microsoft.com/en-us/library/2c8f766e.aspx + * Clang: https://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas + * + * @code + * Y_PRAGMA_DIAGNOSTIC_POP + * @endcode + */ +#if defined(__clang__) || defined(__GNUC__) #define Y_PRAGMA_DIAGNOSTIC_POP \ Y_PRAGMA("GCC diagnostic pop") -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) #define Y_PRAGMA_DIAGNOSTIC_POP \ Y_PRAGMA(warning(pop)) -#else +#else #define Y_PRAGMA_DIAGNOSTIC_POP -#endif - -/** - * @def Y_PRAGMA_NO_WSHADOW - * - * Cross-compiler pragma to disable warnings about shadowing variables - * - * @code - * Y_PRAGMA_DIAGNOSTIC_PUSH - * Y_PRAGMA_NO_WSHADOW - * - * // some code which use variable shadowing, e.g.: - * - * for (int i = 0; i < 100; ++i) { - * Use(i); - * - * for (int i = 42; i < 100500; ++i) { // this i is shadowing previous i - * AnotherUse(i); - * } - * } - * - * Y_PRAGMA_DIAGNOSTIC_POP - * @endcode - */ -#if defined(__clang__) || defined(__GNUC__) +#endif + +/** + * @def Y_PRAGMA_NO_WSHADOW + * + * Cross-compiler pragma to disable warnings about shadowing variables + * + * @code + * Y_PRAGMA_DIAGNOSTIC_PUSH + * Y_PRAGMA_NO_WSHADOW + * + * // some code which use variable shadowing, e.g.: + * + * for (int i = 0; i < 100; ++i) { + * Use(i); + * + * for (int i = 42; i < 100500; ++i) { // this i is shadowing previous i + * AnotherUse(i); + * } + * } + * + * Y_PRAGMA_DIAGNOSTIC_POP + * @endcode + */ +#if defined(__clang__) || defined(__GNUC__) #define Y_PRAGMA_NO_WSHADOW \ Y_PRAGMA("GCC diagnostic ignored \"-Wshadow\"") -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) #define Y_PRAGMA_NO_WSHADOW \ Y_PRAGMA(warning(disable : 4456 4457)) -#else +#else #define Y_PRAGMA_NO_WSHADOW -#endif - -/** - * @ def Y_PRAGMA_NO_UNUSED_FUNCTION - * - * Cross-compiler pragma to disable warnings about unused functions - * - * @see - * GCC: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html - * Clang: https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-function - * MSVC: there is no such warning - * - * @code - * Y_PRAGMA_DIAGNOSTIC_PUSH - * Y_PRAGMA_NO_UNUSED_FUNCTION - * - * // some code which introduces a function which later will not be used, e.g.: - * - * void Foo() { - * } - * - * int main() { - * return 0; // Foo() never called - * } - * - * Y_PRAGMA_DIAGNOSTIC_POP - * @endcode - */ -#if defined(__clang__) || defined(__GNUC__) +#endif + +/** + * @ def Y_PRAGMA_NO_UNUSED_FUNCTION + * + * Cross-compiler pragma to disable warnings about unused functions + * + * @see + * GCC: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html + * Clang: https://clang.llvm.org/docs/DiagnosticsReference.html#wunused-function + * MSVC: there is no such warning + * + * @code + * Y_PRAGMA_DIAGNOSTIC_PUSH + * Y_PRAGMA_NO_UNUSED_FUNCTION + * + * // some code which introduces a function which later will not be used, e.g.: + * + * void Foo() { + * } + * + * int main() { + * return 0; // Foo() never called + * } + * + * Y_PRAGMA_DIAGNOSTIC_POP + * @endcode + */ +#if defined(__clang__) || defined(__GNUC__) #define Y_PRAGMA_NO_UNUSED_FUNCTION \ Y_PRAGMA("GCC diagnostic ignored \"-Wunused-function\"") -#else +#else #define Y_PRAGMA_NO_UNUSED_FUNCTION -#endif +#endif /** * @ def Y_PRAGMA_NO_UNUSED_PARAMETER @@ -514,42 +514,42 @@ _YandexAbort(); #define Y_PRAGMA_NO_UNUSED_PARAMETER #endif -/** - * @def Y_PRAGMA_NO_DEPRECATED - * - * Cross compiler pragma to disable warnings and errors about deprecated - * - * @see - * GCC: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html - * Clang: https://clang.llvm.org/docs/DiagnosticsReference.html#wdeprecated - * MSVC: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=vs-2017 - * - * @code - * Y_PRAGMA_DIAGNOSTIC_PUSH - * Y_PRAGMA_NO_DEPRECATED - * - * [deprecated] void foo() { - * // ... - * } - * - * int main() { - * foo(); - * return 0; - * } - * - * Y_PRAGMA_DIAGNOSTIC_POP - * @endcode - */ +/** + * @def Y_PRAGMA_NO_DEPRECATED + * + * Cross compiler pragma to disable warnings and errors about deprecated + * + * @see + * GCC: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html + * Clang: https://clang.llvm.org/docs/DiagnosticsReference.html#wdeprecated + * MSVC: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=vs-2017 + * + * @code + * Y_PRAGMA_DIAGNOSTIC_PUSH + * Y_PRAGMA_NO_DEPRECATED + * + * [deprecated] void foo() { + * // ... + * } + * + * int main() { + * foo(); + * return 0; + * } + * + * Y_PRAGMA_DIAGNOSTIC_POP + * @endcode + */ #if defined(__clang__) || defined(__GNUC__) #define Y_PRAGMA_NO_DEPRECATED \ Y_PRAGMA("GCC diagnostic ignored \"-Wdeprecated\"") -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) #define Y_PRAGMA_NO_DEPRECATED \ Y_PRAGMA(warning(disable : 4996)) -#else +#else #define Y_PRAGMA_NO_DEPRECATED -#endif - +#endif + // Memory sanitizer sometimes doesn't correctly set parameter shadow of constant functions. #if (defined(__clang__) || defined(__GNUC__)) && !defined(_msan_enabled_) /** @@ -584,23 +584,23 @@ _YandexAbort(); #if !defined(Y_PURE_FUNCTION) #define Y_PURE_FUNCTION #endif - -/** - * @ def Y_HAVE_INT128 - * - * Defined when the compiler supports __int128 extension - * - * @code - * - * #if defined(Y_HAVE_INT128) - * __int128 myVeryBigInt = 12345678901234567890; - * #endif - * - * @endcode - */ -#if defined(__SIZEOF_INT128__) + +/** + * @ def Y_HAVE_INT128 + * + * Defined when the compiler supports __int128 extension + * + * @code + * + * #if defined(Y_HAVE_INT128) + * __int128 myVeryBigInt = 12345678901234567890; + * #endif + * + * @endcode + */ +#if defined(__SIZEOF_INT128__) #define Y_HAVE_INT128 1 -#endif +#endif /** * XRAY macro must be passed to compiler if XRay is enabled. diff --git a/util/system/compiler_ut.cpp b/util/system/compiler_ut.cpp index f93b1c08507..5b500e9529b 100644 --- a/util/system/compiler_ut.cpp +++ b/util/system/compiler_ut.cpp @@ -1,24 +1,24 @@ -#include "compiler.h" - +#include "compiler.h" + #include <library/cpp/testing/unittest/registar.h> - + Y_UNIT_TEST_SUITE(TCompilerTest) { Y_UNIT_TEST(TestPragmaNoWshadow) { - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_WSHADOW - - // define two variables with similar names, latest must shadow first - // and there will be no warning for this - - for (int i = 0; i < 1; ++i) { - for (int i = 100500; i < 100501; ++i) { - UNIT_ASSERT_EQUAL(i, 100500); - } - } - - Y_PRAGMA_DIAGNOSTIC_POP - } - + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_WSHADOW + + // define two variables with similar names, latest must shadow first + // and there will be no warning for this + + for (int i = 0; i < 1; ++i) { + for (int i = 100500; i < 100501; ++i) { + UNIT_ASSERT_EQUAL(i, 100500); + } + } + + Y_PRAGMA_DIAGNOSTIC_POP + } + Y_PRAGMA_DIAGNOSTIC_PUSH Y_PRAGMA_NO_UNUSED_PARAMETER @@ -35,38 +35,38 @@ Y_UNIT_TEST_SUITE(TCompilerTest) { } Y_UNIT_TEST(TestHaveInt128) { -#ifdef Y_HAVE_INT128 - // will be compiled without errors - unsigned __int128 a = 1; - __int128 b = 1; - UNIT_ASSERT_EQUAL(a, 1); - UNIT_ASSERT_EQUAL(b, 1); - UNIT_ASSERT_EQUAL(sizeof(a), sizeof(b)); - - // and we can set a type alias for __int128 and unsigned __int128 without compiler errors - using TMyInt128 = __int128; - using TMyUnsignedInt128 = unsigned __int128; - - TMyInt128 i128value; - TMyUnsignedInt128 ui128value; - Y_UNUSED(i128value); - Y_UNUSED(ui128value); - -#endif - } - - // define deprecated function +#ifdef Y_HAVE_INT128 + // will be compiled without errors + unsigned __int128 a = 1; + __int128 b = 1; + UNIT_ASSERT_EQUAL(a, 1); + UNIT_ASSERT_EQUAL(b, 1); + UNIT_ASSERT_EQUAL(sizeof(a), sizeof(b)); + + // and we can set a type alias for __int128 and unsigned __int128 without compiler errors + using TMyInt128 = __int128; + using TMyUnsignedInt128 = unsigned __int128; + + TMyInt128 i128value; + TMyUnsignedInt128 ui128value; + Y_UNUSED(i128value); + Y_UNUSED(ui128value); + +#endif + } + + // define deprecated function [[deprecated]] void Bar() { - return; - } - - Y_UNIT_TEST(TestNoDeprecated) { - Y_PRAGMA_DIAGNOSTIC_PUSH - Y_PRAGMA_NO_DEPRECATED - - // will be compiled without errors + return; + } + + Y_UNIT_TEST(TestNoDeprecated) { + Y_PRAGMA_DIAGNOSTIC_PUSH + Y_PRAGMA_NO_DEPRECATED + + // will be compiled without errors Bar(); - - Y_PRAGMA_DIAGNOSTIC_POP - } -} + + Y_PRAGMA_DIAGNOSTIC_POP + } +} diff --git a/util/system/condvar.cpp b/util/system/condvar.cpp index 62f3d22356c..707db52c0ba 100644 --- a/util/system/condvar.cpp +++ b/util/system/condvar.cpp @@ -27,11 +27,11 @@ namespace { using TWaitEvents = TIntrusiveList<TWaitEvent>; public: - inline ~TCondVarImpl() { + inline ~TCondVarImpl() { Y_ASSERT(Events_.Empty()); } - inline void Signal() noexcept { + inline void Signal() noexcept { with_lock (Lock_) { if (!Events_.Empty()) { Events_.PopFront()->Signal(); @@ -39,7 +39,7 @@ namespace { } } - inline void BroadCast() noexcept { + inline void BroadCast() noexcept { with_lock (Lock_) { //TODO while (!Events_.Empty()) { @@ -48,7 +48,7 @@ namespace { } } - inline bool WaitD(TMutex& m, TInstant deadLine) noexcept { + inline bool WaitD(TMutex& m, TInstant deadLine) noexcept { TWaitEvent event; with_lock (Lock_) { @@ -86,17 +86,17 @@ public: } } - inline ~TImpl() { + inline ~TImpl() { int ret = pthread_cond_destroy(&Cond_); Y_VERIFY(ret == 0, "pthread_cond_destroy failed: %s", LastSystemErrorText(ret)); } - inline void Signal() noexcept { + inline void Signal() noexcept { int ret = pthread_cond_signal(&Cond_); Y_VERIFY(ret == 0, "pthread_cond_signal failed: %s", LastSystemErrorText(ret)); } - inline bool WaitD(TMutex& lock, TInstant deadLine) noexcept { + inline bool WaitD(TMutex& lock, TInstant deadLine) noexcept { if (deadLine == TInstant::Max()) { int ret = pthread_cond_wait(&Cond_, (pthread_mutex_t*)lock.Handle()); Y_VERIFY(ret == 0, "pthread_cond_wait failed: %s", LastSystemErrorText(ret)); @@ -117,7 +117,7 @@ public: } } - inline void BroadCast() noexcept { + inline void BroadCast() noexcept { int ret = pthread_cond_broadcast(&Cond_); Y_VERIFY(ret == 0, "pthread_cond_broadcast failed: %s", LastSystemErrorText(ret)); } @@ -134,14 +134,14 @@ TCondVar::TCondVar() TCondVar::~TCondVar() = default; -void TCondVar::BroadCast() noexcept { +void TCondVar::BroadCast() noexcept { Impl_->BroadCast(); } -void TCondVar::Signal() noexcept { +void TCondVar::Signal() noexcept { Impl_->Signal(); } -bool TCondVar::WaitD(TMutex& mutex, TInstant deadLine) noexcept { +bool TCondVar::WaitD(TMutex& mutex, TInstant deadLine) noexcept { return Impl_->WaitD(mutex, deadLine); } diff --git a/util/system/condvar.h b/util/system/condvar.h index 569162717cb..b18e48432b2 100644 --- a/util/system/condvar.h +++ b/util/system/condvar.h @@ -11,10 +11,10 @@ class TCondVar { public: TCondVar(); - ~TCondVar(); + ~TCondVar(); - void BroadCast() noexcept; - void Signal() noexcept; + void BroadCast() noexcept; + void Signal() noexcept; /* * returns false if failed by timeout @@ -46,7 +46,7 @@ public: /* * infinite wait */ - inline void WaitI(TMutex& m) noexcept { + inline void WaitI(TMutex& m) noexcept { WaitD(m, TInstant::Max()); } @@ -56,7 +56,7 @@ public: } //deprecated - inline void Wait(TMutex& m) noexcept { + inline void Wait(TMutex& m) noexcept { WaitI(m); } diff --git a/util/system/context.cpp b/util/system/context.cpp index ad993090884..18684e40546 100644 --- a/util/system/context.cpp +++ b/util/system/context.cpp @@ -52,7 +52,7 @@ extern "C" void __mylongjmp(__myjmp_buf env, int val) __attribute__((__noreturn_ extern "C" int __mysetjmp(__myjmp_buf env) __attribute__((__returns_twice__)); namespace { - class TStackType { + class TStackType { public: inline TStackType(TArrayRef<char> range) noexcept #if defined(STACK_GROW_DOWN) @@ -64,14 +64,14 @@ namespace { ReAlign(); } - inline ~TStackType() = default; + inline ~TStackType() = default; - inline void ReAlign() noexcept { + inline void ReAlign() noexcept { Data_ = AlignStackPtr(Data_); } template <class T> - inline void Push(T t) noexcept { + inline void Push(T t) noexcept { #if defined(STACK_GROW_DOWN) Data_ -= sizeof(T); *((T*)Data_) = t; @@ -81,12 +81,12 @@ namespace { #endif } - inline char* StackPtr() noexcept { + inline char* StackPtr() noexcept { return Data_; } private: - static inline char* AlignStackPtr(char* ptr) noexcept { + static inline char* AlignStackPtr(char* ptr) noexcept { #if defined(STACK_GROW_DOWN) return AlignDown(ptr, STACK_ALIGN); #else @@ -98,15 +98,15 @@ namespace { char* Data_; }; - static inline void*& JmpBufReg(__myjmp_buf& buf, size_t n) noexcept { + static inline void*& JmpBufReg(__myjmp_buf& buf, size_t n) noexcept { return (((void**)(void*)(buf))[n]); } - static inline void*& JmpBufStackReg(__myjmp_buf& buf) noexcept { + static inline void*& JmpBufStackReg(__myjmp_buf& buf) noexcept { return JmpBufReg(buf, STACK_CNT); } - static inline void*& JmpBufProgrReg(__myjmp_buf& buf) noexcept { + static inline void*& JmpBufProgrReg(__myjmp_buf& buf) noexcept { return JmpBufReg(buf, PROGR_CNT); } @@ -156,7 +156,7 @@ TContMachineContext::TContMachineContext(const TContClosure& c) : San_(c) #endif { - TStackType stack(c.Stack); + TStackType stack(c.Stack); /* * arg, and align data @@ -194,7 +194,7 @@ TContMachineContext::TContMachineContext(const TContClosure& c) JmpBufFrameReg(Buf_) = nullptr; } -void TContMachineContext::SwitchTo(TContMachineContext* next) noexcept { +void TContMachineContext::SwitchTo(TContMachineContext* next) noexcept { if (Y_LIKELY(__mysetjmp(Buf_) == 0)) { #if defined(_asan_enabled_) || defined(_tsan_enabled_) next->San_.BeforeSwitch(&San_); @@ -231,7 +231,7 @@ TContMachineContext::TContMachineContext(const TContClosure& c) Y_ENSURE(Fiber_, TStringBuf("fiber error")); } -TContMachineContext::~TContMachineContext() { +TContMachineContext::~TContMachineContext() { if (MainFiber_) { ConvertFiberToThread(); } else { @@ -239,7 +239,7 @@ TContMachineContext::~TContMachineContext() { } } -void TContMachineContext::SwitchTo(TContMachineContext* next) noexcept { +void TContMachineContext::SwitchTo(TContMachineContext* next) noexcept { SwitchToFiber(next->Fiber_); } #endif @@ -262,7 +262,7 @@ struct TContMachineContext::TImpl { Thread->Start(); } - inline ~TImpl() { + inline ~TImpl() { if (Thread) { Finish = true; Signal(); @@ -270,7 +270,7 @@ struct TContMachineContext::TImpl { } } - inline void SwitchTo(TImpl* next) noexcept { + inline void SwitchTo(TImpl* next) noexcept { next->Signal(); Wait(); } @@ -286,11 +286,11 @@ struct TContMachineContext::TImpl { TL->DoRun(); } - inline void Signal() noexcept { + inline void Signal() noexcept { Event.Signal(); } - inline void Wait() noexcept { + inline void Wait() noexcept { Event.Wait(); if (Finish) { @@ -315,10 +315,10 @@ TContMachineContext::TContMachineContext(const TContClosure& c) { } -TContMachineContext::~TContMachineContext() { +TContMachineContext::~TContMachineContext() { } -void TContMachineContext::SwitchTo(TContMachineContext* next) noexcept { +void TContMachineContext::SwitchTo(TContMachineContext* next) noexcept { Impl_->SwitchTo(next->Impl_.Get()); } #endif diff --git a/util/system/context.h b/util/system/context.h index d2a349bfc51..9f16663f66d 100644 --- a/util/system/context.h +++ b/util/system/context.h @@ -78,10 +78,10 @@ public: makecontext(&Ctx_, (ucontext_func_t)ContextTrampoLine, 1, c.TrampoLine); } - inline ~TContMachineContext() { + inline ~TContMachineContext() { } - inline void SwitchTo(TContMachineContext* next) noexcept { + inline void SwitchTo(TContMachineContext* next) noexcept { swapcontext(&Ctx_, &next->Ctx_); } @@ -98,9 +98,9 @@ public: TContMachineContext(); TContMachineContext(const TContClosure& c); - ~TContMachineContext(); + ~TContMachineContext(); - void SwitchTo(TContMachineContext* next) noexcept; + void SwitchTo(TContMachineContext* next) noexcept; private: THolder<TImpl> Impl_; @@ -112,9 +112,9 @@ class TContMachineContext { public: TContMachineContext(); TContMachineContext(const TContClosure& c); - ~TContMachineContext(); + ~TContMachineContext(); - void SwitchTo(TContMachineContext* next) noexcept; + void SwitchTo(TContMachineContext* next) noexcept; private: void* Fiber_; @@ -133,7 +133,7 @@ public: inline ~TContMachineContext() = default; - void SwitchTo(TContMachineContext* next) noexcept; + void SwitchTo(TContMachineContext* next) noexcept; private: __myjmp_buf Buf_; @@ -153,7 +153,7 @@ private: }; #endif -static inline size_t MachineContextSize() noexcept { +static inline size_t MachineContextSize() noexcept { return sizeof(TContMachineContext); } diff --git a/util/system/context_ut.cpp b/util/system/context_ut.cpp index 45cb0249f74..1c757181348 100644 --- a/util/system/context_ut.cpp +++ b/util/system/context_ut.cpp @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TestContext) { char Buf[1000000]; }; - static TDeque<TW> w; + static TDeque<TW> w; auto& tw = w.emplace_back(&f); diff --git a/util/system/direct_io.cpp b/util/system/direct_io.cpp index f59c54b0cbd..532780e8351 100644 --- a/util/system/direct_io.cpp +++ b/util/system/direct_io.cpp @@ -46,7 +46,7 @@ namespace { }; } -TDirectIOBufferedFile::TDirectIOBufferedFile(const TString& path, EOpenMode oMode, size_t buflen /*= 1 << 17*/) +TDirectIOBufferedFile::TDirectIOBufferedFile(const TString& path, EOpenMode oMode, size_t buflen /*= 1 << 17*/) : File(path, oMode) , Alignment(0) , DataLen(0) diff --git a/util/system/direct_io.h b/util/system/direct_io.h index 6a3325a9608..4a9e80f3c7f 100644 --- a/util/system/direct_io.h +++ b/util/system/direct_io.h @@ -11,7 +11,7 @@ // - Supports writing odd sized files by turning off direct IO for the last chunk. class TDirectIOBufferedFile { public: - TDirectIOBufferedFile(const TString& path, EOpenMode oMode, size_t buflen = 1 << 17); + TDirectIOBufferedFile(const TString& path, EOpenMode oMode, size_t buflen = 1 << 17); ~TDirectIOBufferedFile(); void FlushData(); diff --git a/util/system/direct_io_ut.cpp b/util/system/direct_io_ut.cpp index 839c3de7ca4..8293cc3573f 100644 --- a/util/system/direct_io_ut.cpp +++ b/util/system/direct_io_ut.cpp @@ -12,7 +12,7 @@ static const char* FileName_("./test.file"); Y_UNIT_TEST_SUITE(TDirectIoTestSuite) { Y_UNIT_TEST(TestDirectFile) { TDirectIOBufferedFile file(FileName_, RdWr | Direct | Seq | CreateAlways, 1 << 15); - TVector<ui64> data((1 << 15) + 1); + TVector<ui64> data((1 << 15) + 1); TVector<ui64> readResult(data.size()); for (auto& i : data) { i = RandomNumber<ui64>(); diff --git a/util/system/dynlib.cpp b/util/system/dynlib.cpp index 9d2541c25f1..7a3a2d4a298 100644 --- a/util/system/dynlib.cpp +++ b/util/system/dynlib.cpp @@ -25,7 +25,7 @@ using HINSTANCE = void*; #define DLLSYM(hndl, name) dlsym(hndl, name) #endif -inline TString DLLERR() { +inline TString DLLERR() { #ifdef _unix_ return dlerror(); #endif @@ -38,7 +38,7 @@ inline TString DLLERR() { return "DLLERR() unknown error"; while (cnt && isspace(msg[cnt - 1])) --cnt; - TString err(msg, 0, cnt); + TString err(msg, 0, cnt); LocalFree(msg); return err; #endif @@ -67,13 +67,13 @@ public: return new TImpl(path, flags); } - inline ~TImpl() { + inline ~TImpl() { if (Module && Unloadable) { DLLCLOSE(Module); } } - inline void* SymOptional(const char* name) noexcept { + inline void* SymOptional(const char* name) noexcept { return (void*)DLLSYM(Module, name); } @@ -96,10 +96,10 @@ private: bool Unloadable; }; -TDynamicLibrary::TDynamicLibrary() noexcept { +TDynamicLibrary::TDynamicLibrary() noexcept { } -TDynamicLibrary::TDynamicLibrary(const TString& path, int flags) { +TDynamicLibrary::TDynamicLibrary(const TString& path, int flags) { Open(path.data(), flags); } @@ -109,11 +109,11 @@ void TDynamicLibrary::Open(const char* path, int flags) { Impl_.Reset(TImpl::SafeCreate(path, flags)); } -void TDynamicLibrary::Close() noexcept { +void TDynamicLibrary::Close() noexcept { Impl_.Destroy(); } -void* TDynamicLibrary::SymOptional(const char* name) noexcept { +void* TDynamicLibrary::SymOptional(const char* name) noexcept { if (!IsLoaded()) { return nullptr; } @@ -129,7 +129,7 @@ void* TDynamicLibrary::Sym(const char* name) { return Impl_->Sym(name); } -bool TDynamicLibrary::IsLoaded() const noexcept { +bool TDynamicLibrary::IsLoaded() const noexcept { return (bool)Impl_.Get(); } diff --git a/util/system/dynlib.h b/util/system/dynlib.h index 66eaf4a5c1c..6c4a1b0dd51 100644 --- a/util/system/dynlib.h +++ b/util/system/dynlib.h @@ -3,7 +3,7 @@ #include "defaults.h" #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #define Y_GET_FUNC(dll, name) FUNC_##name((dll).Sym(#name)) #define Y_GET_FUNC_OPTIONAL(dll, name) FUNC_##name((dll).SymOptional(#name)) @@ -22,15 +22,15 @@ class TDynamicLibrary { public: - TDynamicLibrary() noexcept; - TDynamicLibrary(const TString& path, int flags = DEFAULT_DLLOPEN_FLAGS); - ~TDynamicLibrary(); + TDynamicLibrary() noexcept; + TDynamicLibrary(const TString& path, int flags = DEFAULT_DLLOPEN_FLAGS); + ~TDynamicLibrary(); void Open(const char* path, int flags = DEFAULT_DLLOPEN_FLAGS); - void Close() noexcept; - void* SymOptional(const char* name) noexcept; + void Close() noexcept; + void* SymOptional(const char* name) noexcept; void* Sym(const char* name); - bool IsLoaded() const noexcept; + bool IsLoaded() const noexcept; void SetUnloadable(bool unloadable); // Set to false to avoid unloading on destructor private: @@ -44,11 +44,11 @@ class TExternalSymbol { private: TLib* PLib; TDynamicLibrary* DLib; - TString lname; - TString vname; + TString lname; + TString vname; public: - TExternalSymbol() noexcept { + TExternalSymbol() noexcept { PLib = nullptr; DLib = nullptr; } @@ -70,7 +70,7 @@ public: } return *this; } - ~TExternalSymbol() { + ~TExternalSymbol() { delete DLib; } // set the symbol from dynamic source @@ -90,30 +90,30 @@ public: vname = vtbl_name; } // set the symbol from static source - void SetSym(TLib* pl) noexcept { + void SetSym(TLib* pl) noexcept { if (DLib == nullptr && PLib == nullptr) PLib = pl; } - void Close() noexcept { + void Close() noexcept { delete DLib; DLib = 0; PLib = 0; lname.remove(); vname.remove(); } - TLib* Symbol() const noexcept { + TLib* Symbol() const noexcept { return PLib; } - const TString& LibName() const noexcept { + const TString& LibName() const noexcept { return lname; } - const TString& VtblName() const noexcept { + const TString& VtblName() const noexcept { return vname; } - bool IsStatic() const noexcept { + bool IsStatic() const noexcept { return DLib == nullptr && PLib != nullptr; } - bool IsDynamic() const noexcept { + bool IsDynamic() const noexcept { return DLib && DLib->IsLoaded() && PLib != nullptr; } }; diff --git a/util/system/env.cpp b/util/system/env.cpp index ead9b566a5f..779aa6e4fbf 100644 --- a/util/system/env.cpp +++ b/util/system/env.cpp @@ -1,19 +1,19 @@ #include "env.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #ifdef _win_ #include <util/generic/vector.h> #include "winint.h" -#else +#else #include <cerrno> #include <cstdlib> #endif /** - * On Windows there may be many copies of enviroment variables, there at least two known, one is - * manipulated by Win32 API, another by C runtime, so we must be consistent in the choice of + * On Windows there may be many copies of enviroment variables, there at least two known, one is + * manipulated by Win32 API, another by C runtime, so we must be consistent in the choice of * functions used to manipulate them. * * Relevant links: @@ -21,35 +21,35 @@ * - https://a.yandex-team.ru/review/108892/details */ -TString GetEnv(const TString& key, const TString& def) { +TString GetEnv(const TString& key, const TString& def) { #ifdef _win_ size_t len = GetEnvironmentVariableA(key.data(), nullptr, 0); - - if (len == 0) { + + if (len == 0) { if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) { return def; } - return TString{}; - } - - TVector<char> buffer(len); - size_t bufferSize; - do { - bufferSize = buffer.size(); + return TString{}; + } + + TVector<char> buffer(len); + size_t bufferSize; + do { + bufferSize = buffer.size(); len = GetEnvironmentVariableA(key.data(), buffer.data(), static_cast<DWORD>(bufferSize)); - if (len > bufferSize) { - buffer.resize(len); - } - } while (len > bufferSize); - - return TString(buffer.data(), len); + if (len > bufferSize) { + buffer.resize(len); + } + } while (len > bufferSize); + + return TString(buffer.data(), len); #else const char* env = getenv(key.data()); - return env ? TString(env) : def; + return env ? TString(env) : def; #endif } -void SetEnv(const TString& key, const TString& value) { +void SetEnv(const TString& key, const TString& value) { bool isOk = false; int errorCode = 0; #ifdef _win_ diff --git a/util/system/env.h b/util/system/env.h index e2ccdd1e954..0b77070ab71 100644 --- a/util/system/env.h +++ b/util/system/env.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> /** * Search the environment list provided by the host environment for associated variable. @@ -16,7 +16,7 @@ * @note Calls to `GetEnv` and `SetEnv` from different threads must be synchronized. * @see SetEnv */ -TString GetEnv(const TString& key, const TString& def = TString()); +TString GetEnv(const TString& key, const TString& def = TString()); /** * Add or change environment variable provided by the host environment. @@ -29,4 +29,4 @@ TString GetEnv(const TString& key, const TString& def = TString()); * @note Calls to `GetEnv` and `SetEnv` from different threads must be synchronized. * @see GetEnv */ -void SetEnv(const TString& key, const TString& value); +void SetEnv(const TString& key, const TString& value); diff --git a/util/system/env_ut.cpp b/util/system/env_ut.cpp index e03cc016589..3139394bc7f 100644 --- a/util/system/env_ut.cpp +++ b/util/system/env_ut.cpp @@ -1,31 +1,31 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include "env.h" Y_UNIT_TEST_SUITE(EnvTest) { Y_UNIT_TEST(GetSetEnvTest) { - TString key = "util_GETENV_TestVar"; - TString value = "Some value for env var"; - TString def = "Some default value for env var"; + TString key = "util_GETENV_TestVar"; + TString value = "Some value for env var"; + TString def = "Some default value for env var"; // first of all, it should be clear - UNIT_ASSERT_VALUES_EQUAL(GetEnv(key), TString()); + UNIT_ASSERT_VALUES_EQUAL(GetEnv(key), TString()); UNIT_ASSERT_VALUES_EQUAL(GetEnv(key, def), def); SetEnv(key, value); // set and see what value we get here UNIT_ASSERT_VALUES_EQUAL(GetEnv(key), value); UNIT_ASSERT_VALUES_EQUAL(GetEnv(key, def), value); // set empty value - SetEnv(key, TString()); - UNIT_ASSERT_VALUES_EQUAL(GetEnv(key), TString()); - - // check for long values, see IGNIETFERRO-214 - TString longKey = "util_GETENV_TestVarLong"; - TString longValue{1500, 't'}; - UNIT_ASSERT_VALUES_EQUAL(GetEnv(longKey), TString()); - SetEnv(longKey, longValue); - UNIT_ASSERT_VALUES_EQUAL(GetEnv(longKey), longValue); - SetEnv(longKey, TString()); - UNIT_ASSERT_VALUES_EQUAL(GetEnv(longKey), TString()); + SetEnv(key, TString()); + UNIT_ASSERT_VALUES_EQUAL(GetEnv(key), TString()); + + // check for long values, see IGNIETFERRO-214 + TString longKey = "util_GETENV_TestVarLong"; + TString longValue{1500, 't'}; + UNIT_ASSERT_VALUES_EQUAL(GetEnv(longKey), TString()); + SetEnv(longKey, longValue); + UNIT_ASSERT_VALUES_EQUAL(GetEnv(longKey), longValue); + SetEnv(longKey, TString()); + UNIT_ASSERT_VALUES_EQUAL(GetEnv(longKey), TString()); } } diff --git a/util/system/error.cpp b/util/system/error.cpp index f778ec42cbe..eb0806fe5d1 100644 --- a/util/system/error.cpp +++ b/util/system/error.cpp @@ -47,7 +47,7 @@ int LastSystemError() { #if defined(_win_) namespace { struct TErrString { - inline TErrString() noexcept { + inline TErrString() noexcept { data[0] = 0; } diff --git a/util/system/event.cpp b/util/system/event.cpp index 79b3cdb2917..6f70a37e055 100644 --- a/util/system/event.cpp +++ b/util/system/event.cpp @@ -19,19 +19,19 @@ public: cond = CreateEvent(nullptr, rmode == rManual ? true : false, false, nullptr); } - inline ~TEvImpl() { + inline ~TEvImpl() { CloseHandle(cond); } - inline void Reset() noexcept { + inline void Reset() noexcept { ResetEvent(cond); } - inline void Signal() noexcept { + inline void Signal() noexcept { SetEvent(cond); } - inline bool WaitD(TInstant deadLine) noexcept { + inline bool WaitD(TInstant deadLine) noexcept { if (deadLine == TInstant::Max()) { return WaitForSingleObject(cond, INFINITE) == WAIT_OBJECT_0; } @@ -51,7 +51,7 @@ public: { } - inline void Signal() noexcept { + inline void Signal() noexcept { if (Manual && AtomicGet(Signaled)) { return; // shortcut } @@ -67,11 +67,11 @@ public: } } - inline void Reset() noexcept { + inline void Reset() noexcept { AtomicSet(Signaled, 0); } - inline bool WaitD(TInstant deadLine) noexcept { + inline bool WaitD(TInstant deadLine) noexcept { if (Manual && AtomicGet(Signaled)) { return true; // shortcut } diff --git a/util/system/event.h b/util/system/event.h index cab2fc478ab..3e9378fbee8 100644 --- a/util/system/event.h +++ b/util/system/event.h @@ -24,34 +24,34 @@ public: ~TSystemEvent(); - void Reset() noexcept; - void Signal() noexcept; + void Reset() noexcept; + void Signal() noexcept; /* * return true if signaled, false if timed out. */ - bool WaitD(TInstant deadLine) noexcept; + bool WaitD(TInstant deadLine) noexcept; /* * return true if signaled, false if timed out. */ - inline bool WaitT(TDuration timeOut) noexcept { + inline bool WaitT(TDuration timeOut) noexcept { return WaitD(timeOut.ToDeadLine()); } /* * wait infinite time */ - inline void WaitI() noexcept { + inline void WaitI() noexcept { WaitD(TInstant::Max()); } //return true if signaled, false if timed out. - inline bool Wait(ui32 timer) noexcept { + inline bool Wait(ui32 timer) noexcept { return WaitT(TDuration::MilliSeconds(timer)); } - inline bool Wait() noexcept { + inline bool Wait() noexcept { WaitI(); return true; diff --git a/util/system/execpath.cpp b/util/system/execpath.cpp index 33198af58b0..3877c912e72 100644 --- a/util/system/execpath.cpp +++ b/util/system/execpath.cpp @@ -32,8 +32,8 @@ #include "fs.h" #if defined(_freebsd_) -static inline bool GoodPath(const TString& path) { - return path.find('/') != TString::npos; +static inline bool GoodPath(const TString& path) { + return path.find('/') != TString::npos; } static inline int FreeBSDSysCtl(int* mib, size_t mibSize, TTempBuf& res) { @@ -51,12 +51,12 @@ static inline int FreeBSDSysCtl(int* mib, size_t mibSize, TTempBuf& res) { return errno; } -static inline TString FreeBSDGetExecPath() { +static inline TString FreeBSDGetExecPath() { int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; TTempBuf buf; int r = FreeBSDSysCtl(mib, Y_ARRAY_SIZE(mib), buf); if (r == 0) { - return TString(buf.Data(), buf.Filled() - 1); + return TString(buf.Data(), buf.Filled() - 1); } else if (r == ENOTSUP) { // older FreeBSD version /* * BSD analogue for /proc/self is /proc/curproc. @@ -66,24 +66,24 @@ static inline TString FreeBSDGetExecPath() { TString path("/proc/curproc/file"); return NFs::ReadLink(path); } else { - return TString(); + return TString(); } } -static inline TString FreeBSDGetArgv0() { +static inline TString FreeBSDGetArgv0() { int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_ARGS, getpid()}; TTempBuf buf; int r = FreeBSDSysCtl(mib, Y_ARRAY_SIZE(mib), buf); if (r == 0) { - return TString(buf.Data()); + return TString(buf.Data()); } else if (r == ENOTSUP) { - return TString(); + return TString(); } else { ythrow yexception() << "FreeBSDGetArgv0() failed: " << LastSystemErrorText(); } } -static inline bool FreeBSDGuessExecPath(const TString& guessPath, TString& execPath) { +static inline bool FreeBSDGuessExecPath(const TString& guessPath, TString& execPath) { if (NFs::Exists(guessPath)) { // now it should work for real execPath = FreeBSDGetExecPath(); @@ -94,13 +94,13 @@ static inline bool FreeBSDGuessExecPath(const TString& guessPath, TString& execP return false; } -static inline bool FreeBSDGuessExecBasePath(const TString& guessBasePath, TString& execPath) { - return FreeBSDGuessExecPath(TString(guessBasePath) + "/" + getprogname(), execPath); +static inline bool FreeBSDGuessExecBasePath(const TString& guessBasePath, TString& execPath) { + return FreeBSDGuessExecPath(TString(guessBasePath) + "/" + getprogname(), execPath); } #endif -static TString GetExecPathImpl() { +static TString GetExecPathImpl() { #if defined(_solaris_) return execname(); #elif defined(_darwin_) @@ -132,7 +132,7 @@ static TString GetExecPathImpl() { return NFs::ReadLink(path); // TODO(yoda): check if the filename ends with " (deleted)" #elif defined(_freebsd_) - TString execPath = FreeBSDGetExecPath(); + TString execPath = FreeBSDGetExecPath(); if (GoodPath(execPath)) { return execPath; } @@ -185,12 +185,12 @@ namespace { return SingletonWithPriority<TExecPathsHolder, 1>(); } - TString ExecPath; + TString ExecPath; TString PersistentExecPath; }; } -const TString& GetExecPath() { +const TString& GetExecPath() { return TExecPathsHolder::Instance()->ExecPath; } diff --git a/util/system/execpath.h b/util/system/execpath.h index 4b914b8e851..451551ac79f 100644 --- a/util/system/execpath.h +++ b/util/system/execpath.h @@ -3,7 +3,7 @@ #include <util/generic/fwd.h> // NOTE: This function has rare sporadic failures (throws exceptions) on FreeBSD. See REVIEW:54297 -const TString& GetExecPath(); +const TString& GetExecPath(); /** * Get openable path to the binary currently being executed. diff --git a/util/system/execpath_ut.cpp b/util/system/execpath_ut.cpp index 16b01466f55..df64d08e2fa 100644 --- a/util/system/execpath_ut.cpp +++ b/util/system/execpath_ut.cpp @@ -7,7 +7,7 @@ Y_UNIT_TEST_SUITE(TExecPathTest) { Y_UNIT_TEST(TestIt) { - TString execPath = GetExecPath(); + TString execPath = GetExecPath(); TString persistentExecPath = GetPersistentExecPath(); try { diff --git a/util/system/fasttime.cpp b/util/system/fasttime.cpp index 057a814f0a4..d885592a818 100644 --- a/util/system/fasttime.cpp +++ b/util/system/fasttime.cpp @@ -130,35 +130,35 @@ namespace { { } - inline void Add(const A& a, const B& b) noexcept { + inline void Add(const A& a, const B& b) noexcept { Add(TSample(a, b)); } - inline void Add(const TSample& s) noexcept { + inline void Add(const TSample& s) noexcept { S_[(C_++) % N] = s; if (C_ > 1) { ReCalc(); } } - inline B Predict(A a) const noexcept { + inline B Predict(A a) const noexcept { return A_ + a * B_; } - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return C_; } - inline bool Enough() const noexcept { + inline bool Enough() const noexcept { return Size() >= N; } - inline A LastX() const noexcept { + inline A LastX() const noexcept { return S_[(C_ - 1) % N].first; } private: - inline void ReCalc() noexcept { + inline void ReCalc() noexcept { const size_t n = Min(N, C_); double sx = 0; diff --git a/util/system/file.cpp b/util/system/file.cpp index 4a261d020cb..e4af4bacde3 100644 --- a/util/system/file.cpp +++ b/util/system/file.cpp @@ -17,7 +17,7 @@ #include <util/random/random.h> #include <util/generic/size_literals.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ylimits.h> #include <util/generic/yexception.h> @@ -63,7 +63,7 @@ static bool IsStupidFlagCombination(EOpenMode oMode) { return (oMode & (CreateAlways | ForAppend)) == (CreateAlways | ForAppend) || (oMode & (TruncExisting | ForAppend)) == (TruncExisting | ForAppend) || (oMode & (CreateNew | ForAppend)) == (CreateNew | ForAppend); } -TFileHandle::TFileHandle(const TString& fName, EOpenMode oMode) noexcept { +TFileHandle::TFileHandle(const TString& fName, EOpenMode oMode) noexcept { ui32 fcMode = 0; EOpenMode createMode = oMode & MaskCreation; Y_VERIFY(!IsStupidFlagCombination(oMode), "oMode %d makes no sense", static_cast<int>(oMode)); @@ -267,7 +267,7 @@ TFileHandle::TFileHandle(const TString& fName, EOpenMode oMode) noexcept { #endif } -bool TFileHandle::Close() noexcept { +bool TFileHandle::Close() noexcept { bool isOk = true; #ifdef _win_ if (Fd_ != INVALID_FHANDLE) { @@ -294,7 +294,7 @@ bool TFileHandle::Close() noexcept { return isOk; } -static inline i64 DoSeek(FHANDLE h, i64 offset, SeekDir origin) noexcept { +static inline i64 DoSeek(FHANDLE h, i64 offset, SeekDir origin) noexcept { if (h == INVALID_FHANDLE) { return -1L; } @@ -319,15 +319,15 @@ static inline i64 DoSeek(FHANDLE h, i64 offset, SeekDir origin) noexcept { #endif } -i64 TFileHandle::GetPosition() const noexcept { +i64 TFileHandle::GetPosition() const noexcept { return DoSeek(Fd_, 0, sCur); } -i64 TFileHandle::Seek(i64 offset, SeekDir origin) noexcept { +i64 TFileHandle::Seek(i64 offset, SeekDir origin) noexcept { return DoSeek(Fd_, offset, origin); } -i64 TFileHandle::GetLength() const noexcept { +i64 TFileHandle::GetLength() const noexcept { // XXX: returns error code, but does not set errno if (!IsOpen()) { return -1L; @@ -335,7 +335,7 @@ i64 TFileHandle::GetLength() const noexcept { return GetFileLength(Fd_); } -bool TFileHandle::Resize(i64 length) noexcept { +bool TFileHandle::Resize(i64 length) noexcept { if (!IsOpen()) { return false; } @@ -363,7 +363,7 @@ bool TFileHandle::Resize(i64 length) noexcept { #endif } -bool TFileHandle::Reserve(i64 length) noexcept { +bool TFileHandle::Reserve(i64 length) noexcept { // FIXME this should reserve disk space with fallocate if (!IsOpen()) { return false; @@ -412,7 +412,7 @@ bool TFileHandle::ShrinkToFit() noexcept { #endif } -bool TFileHandle::Flush() noexcept { +bool TFileHandle::Flush() noexcept { if (!IsOpen()) { return false; } @@ -443,7 +443,7 @@ bool TFileHandle::Flush() noexcept { #endif } -bool TFileHandle::FlushData() noexcept { +bool TFileHandle::FlushData() noexcept { #if defined(_linux_) if (!IsOpen()) { return false; @@ -458,7 +458,7 @@ bool TFileHandle::FlushData() noexcept { #endif } -i32 TFileHandle::Read(void* buffer, ui32 byteCount) noexcept { +i32 TFileHandle::Read(void* buffer, ui32 byteCount) noexcept { // FIXME size and return must be 64-bit if (!IsOpen()) { return -1; @@ -480,7 +480,7 @@ i32 TFileHandle::Read(void* buffer, ui32 byteCount) noexcept { #endif } -i32 TFileHandle::Write(const void* buffer, ui32 byteCount) noexcept { +i32 TFileHandle::Write(const void* buffer, ui32 byteCount) noexcept { if (!IsOpen()) { return -1; } @@ -501,7 +501,7 @@ i32 TFileHandle::Write(const void* buffer, ui32 byteCount) noexcept { #endif } -i32 TFileHandle::Pread(void* buffer, ui32 byteCount, i64 offset) const noexcept { +i32 TFileHandle::Pread(void* buffer, ui32 byteCount, i64 offset) const noexcept { #if defined(_win_) OVERLAPPED io; Zero(io); @@ -526,7 +526,7 @@ i32 TFileHandle::Pread(void* buffer, ui32 byteCount, i64 offset) const noexcept #endif } -i32 TFileHandle::Pwrite(const void* buffer, ui32 byteCount, i64 offset) const noexcept { +i32 TFileHandle::Pwrite(const void* buffer, ui32 byteCount, i64 offset) const noexcept { #if defined(_win_) OVERLAPPED io; Zero(io); @@ -548,7 +548,7 @@ i32 TFileHandle::Pwrite(const void* buffer, ui32 byteCount, i64 offset) const no #endif } -FHANDLE TFileHandle::Duplicate() const noexcept { +FHANDLE TFileHandle::Duplicate() const noexcept { if (!IsOpen()) { return INVALID_FHANDLE; } @@ -597,7 +597,7 @@ int TFileHandle::Duplicate2Posix(int dstHandle) const noexcept { #endif } -bool TFileHandle::LinkTo(const TFileHandle& fh) const noexcept { +bool TFileHandle::LinkTo(const TFileHandle& fh) const noexcept { #if defined(_unix_) while (dup2(fh.Fd_, Fd_) == -1) { if (errno != EINTR) { @@ -621,7 +621,7 @@ bool TFileHandle::LinkTo(const TFileHandle& fh) const noexcept { #endif } -int TFileHandle::Flock(int op) noexcept { +int TFileHandle::Flock(int op) noexcept { return ::Flock(Fd_, op); } @@ -775,7 +775,7 @@ bool TFileHandle::FlushCache(i64 offset, i64 length, bool wait) noexcept { #endif } -TString DecodeOpenMode(ui32 mode0) { +TString DecodeOpenMode(ui32 mode0) { ui32 mode = mode0; TStringBuilder r; @@ -843,13 +843,13 @@ TString DecodeOpenMode(ui32 mode0) { class TFile::TImpl: public TAtomicRefCount<TImpl> { public: - inline TImpl(FHANDLE fd, const TString& fname = TString()) + inline TImpl(FHANDLE fd, const TString& fname = TString()) : Handle_(fd) , FileName_(fname) { } - inline TImpl(const TString& fName, EOpenMode oMode) + inline TImpl(const TString& fName, EOpenMode oMode) : Handle_(fName, oMode) , FileName_(fName) { @@ -866,15 +866,15 @@ public: } } - const TString& GetName() const noexcept { + const TString& GetName() const noexcept { return FileName_; } - void SetName(const TString& newName) { + void SetName(const TString& newName) { FileName_ = newName; } - const TFileHandle& GetHandle() const noexcept { + const TFileHandle& GetHandle() const noexcept { return Handle_; } @@ -1084,7 +1084,7 @@ public: private: TFileHandle Handle_; - TString FileName_; + TString FileName_; }; TFile::TFile() @@ -1097,12 +1097,12 @@ TFile::TFile(FHANDLE fd) { } -TFile::TFile(FHANDLE fd, const TString& name) +TFile::TFile(FHANDLE fd, const TString& name) : Impl_(new TImpl(fd, name)) { } -TFile::TFile(const TString& fName, EOpenMode oMode) +TFile::TFile(const TString& fName, EOpenMode oMode) : Impl_(new TImpl(fName, oMode)) { } @@ -1113,23 +1113,23 @@ void TFile::Close() { Impl_->Close(); } -const TString& TFile::GetName() const noexcept { +const TString& TFile::GetName() const noexcept { return Impl_->GetName(); } -i64 TFile::GetPosition() const noexcept { +i64 TFile::GetPosition() const noexcept { return Impl_->GetHandle().GetPosition(); } -i64 TFile::GetLength() const noexcept { +i64 TFile::GetLength() const noexcept { return Impl_->GetHandle().GetLength(); } -bool TFile::IsOpen() const noexcept { +bool TFile::IsOpen() const noexcept { return Impl_->GetHandle().IsOpen(); } -FHANDLE TFile::GetHandle() const noexcept { +FHANDLE TFile::GetHandle() const noexcept { return Impl_->GetHandle(); } @@ -1237,12 +1237,12 @@ void TFile::LinkTo(const TFile& f) const { } } -TFile TFile::Temporary(const TString& prefix) { +TFile TFile::Temporary(const TString& prefix) { //TODO - handle impossible case of name collision return TFile(prefix + ToString(MicroSeconds()) + "-" + ToString(RandomNumber<ui64>()), CreateNew | RdWr | Seq | Temp | Transient); } -TFile TFile::ForAppend(const TString& path) { +TFile TFile::ForAppend(const TString& path) { return TFile(path, OpenAlways | WrOnly | Seq | ::ForAppend); } @@ -1283,7 +1283,7 @@ TFile Duplicate(int fd) { #endif } -bool PosixDisableReadAhead(FHANDLE fileHandle, void* addr) noexcept { +bool PosixDisableReadAhead(FHANDLE fileHandle, void* addr) noexcept { int ret = -1; #if HAVE_POSIX_FADVISE diff --git a/util/system/file.h b/util/system/file.h index 9502e159b6f..efe1e59b4a0 100644 --- a/util/system/file.h +++ b/util/system/file.h @@ -52,7 +52,7 @@ enum EOpenModeFlag { Y_DECLARE_FLAGS(EOpenMode, EOpenModeFlag) Y_DECLARE_OPERATORS_FOR_FLAGS(EOpenMode) -TString DecodeOpenMode(ui32 openMode); +TString DecodeOpenMode(ui32 openMode); enum SeekDir { sSet = 0, @@ -62,68 +62,68 @@ enum SeekDir { class TFileHandle: public TNonCopyable { public: - constexpr TFileHandle() = default; - + constexpr TFileHandle() = default; + /// Warning: takes ownership of fd, so closes it in destructor. - inline TFileHandle(FHANDLE fd) noexcept + inline TFileHandle(FHANDLE fd) noexcept : Fd_(fd) { } - inline TFileHandle(TFileHandle&& other) noexcept + inline TFileHandle(TFileHandle&& other) noexcept : Fd_(other.Fd_) { other.Fd_ = INVALID_FHANDLE; } - TFileHandle(const TString& fName, EOpenMode oMode) noexcept; + TFileHandle(const TString& fName, EOpenMode oMode) noexcept; - inline ~TFileHandle() { + inline ~TFileHandle() { Close(); } - bool Close() noexcept; + bool Close() noexcept; - inline FHANDLE Release() noexcept { + inline FHANDLE Release() noexcept { FHANDLE ret = Fd_; Fd_ = INVALID_FHANDLE; return ret; } - inline void Swap(TFileHandle& r) noexcept { + inline void Swap(TFileHandle& r) noexcept { DoSwap(Fd_, r.Fd_); } - inline operator FHANDLE() const noexcept { + inline operator FHANDLE() const noexcept { return Fd_; } - inline bool IsOpen() const noexcept { + inline bool IsOpen() const noexcept { return Fd_ != INVALID_FHANDLE; } - i64 GetPosition() const noexcept; - i64 GetLength() const noexcept; + i64 GetPosition() const noexcept; + i64 GetLength() const noexcept; - i64 Seek(i64 offset, SeekDir origin) noexcept; - bool Resize(i64 length) noexcept; - bool Reserve(i64 length) noexcept; + i64 Seek(i64 offset, SeekDir origin) noexcept; + bool Resize(i64 length) noexcept; + bool Reserve(i64 length) noexcept; bool FallocateNoResize(i64 length) noexcept; bool ShrinkToFit() noexcept; - bool Flush() noexcept; + bool Flush() noexcept; //flush data only, without file metadata - bool FlushData() noexcept; - i32 Read(void* buffer, ui32 byteCount) noexcept; - i32 Write(const void* buffer, ui32 byteCount) noexcept; - i32 Pread(void* buffer, ui32 byteCount, i64 offset) const noexcept; - i32 Pwrite(const void* buffer, ui32 byteCount, i64 offset) const noexcept; - int Flock(int op) noexcept; - - FHANDLE Duplicate() const noexcept; + bool FlushData() noexcept; + i32 Read(void* buffer, ui32 byteCount) noexcept; + i32 Write(const void* buffer, ui32 byteCount) noexcept; + i32 Pread(void* buffer, ui32 byteCount, i64 offset) const noexcept; + i32 Pwrite(const void* buffer, ui32 byteCount, i64 offset) const noexcept; + int Flock(int op) noexcept; + + FHANDLE Duplicate() const noexcept; int Duplicate2Posix(int dstHandle) const noexcept; //dup2 - like semantics, return true on success - bool LinkTo(const TFileHandle& fh) const noexcept; + bool LinkTo(const TFileHandle& fh) const noexcept; //very low-level methods bool SetDirect(); @@ -141,7 +141,7 @@ public: bool FlushCache(i64 offset = 0, i64 length = 0, bool wait = true) noexcept; private: - FHANDLE Fd_ = INVALID_FHANDLE; + FHANDLE Fd_ = INVALID_FHANDLE; }; class TFile { @@ -149,17 +149,17 @@ public: TFile(); /// Takes ownership of handle, so closes it when the last holder of descriptor dies. explicit TFile(FHANDLE fd); - TFile(FHANDLE fd, const TString& fname); - TFile(const TString& fName, EOpenMode oMode); - ~TFile(); + TFile(FHANDLE fd, const TString& fname); + TFile(const TString& fName, EOpenMode oMode); + ~TFile(); void Close(); - const TString& GetName() const noexcept; - i64 GetPosition() const noexcept; - i64 GetLength() const noexcept; - bool IsOpen() const noexcept; - FHANDLE GetHandle() const noexcept; + const TString& GetName() const noexcept; + i64 GetPosition() const noexcept; + i64 GetLength() const noexcept; + bool IsOpen() const noexcept; + FHANDLE GetHandle() const noexcept; i64 Seek(i64 offset, SeekDir origin); void Resize(i64 length); @@ -211,8 +211,8 @@ public: //flush unwritten data in this range and optionally wait for completion void FlushCache(i64 offset = 0, i64 length = 0, bool wait = true); - static TFile Temporary(const TString& prefix); - static TFile ForAppend(const TString& path); + static TFile Temporary(const TString& prefix); + static TFile ForAppend(const TString& path); private: class TImpl; @@ -222,4 +222,4 @@ private: TFile Duplicate(FILE*); TFile Duplicate(int); -bool PosixDisableReadAhead(FHANDLE fileHandle, void* addr) noexcept; +bool PosixDisableReadAhead(FHANDLE fileHandle, void* addr) noexcept; diff --git a/util/system/file_ut.cpp b/util/system/file_ut.cpp index 941e6a50f3d..86816115147 100644 --- a/util/system/file_ut.cpp +++ b/util/system/file_ut.cpp @@ -53,7 +53,7 @@ public: f2.Write("67890", 5); } - UNIT_ASSERT_EQUAL(TUnbufferedFileInput(tmp2.Name()).ReadAll(), "1234567890"); + UNIT_ASSERT_EQUAL(TUnbufferedFileInput(tmp2.Name()).ReadAll(), "1234567890"); } inline void TestAppend() { @@ -72,7 +72,7 @@ public: f.Write("89", 2); } - UNIT_ASSERT_EQUAL(TUnbufferedFileInput(tmp.Name()).ReadAll(), "123456786789"); + UNIT_ASSERT_EQUAL(TUnbufferedFileInput(tmp.Name()).ReadAll(), "123456786789"); } inline void TestReWrite() { @@ -90,7 +90,7 @@ public: f.Write("6789", 4); } - UNIT_ASSERT_EQUAL(TUnbufferedFileInput(tmp.Name()).ReadAll(), "67895678"); + UNIT_ASSERT_EQUAL(TUnbufferedFileInput(tmp.Name()).ReadAll(), "67895678"); } inline void TestResize() { @@ -111,7 +111,7 @@ public: UNIT_ASSERT_EQUAL(file.GetPosition(), 3); } - const TString data = TUnbufferedFileInput(tmp.Name()).ReadAll(); + const TString data = TUnbufferedFileInput(tmp.Name()).ReadAll(); UNIT_ASSERT_EQUAL(data.length(), 12); UNIT_ASSERT(data.StartsWith("12345")); } @@ -120,7 +120,7 @@ public: UNIT_TEST_SUITE_REGISTRATION(TFileTest); void TFileTest::TestOpen() { - TString res; + TString res; TFile f1; try { diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index 7454a4cb948..20658681999 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -53,7 +53,7 @@ namespace { return *Singleton<TSysInfo>(); } - static inline size_t CalcGranularity() noexcept { + static inline size_t CalcGranularity() noexcept { #if defined(_win_) SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); @@ -75,7 +75,7 @@ TString TMemoryMapCommon::UnknownFileName() { return "Unknown_file_name"; } -static inline i64 DownToGranularity(i64 offset) noexcept { +static inline i64 DownToGranularity(i64 offset) noexcept { return offset & ~((i64)(GRANULARITY - 1)); } @@ -161,7 +161,7 @@ public: } } - inline TImpl(FILE* f, EOpenMode om, TString dbgName) + inline TImpl(FILE* f, EOpenMode om, TString dbgName) : File_(Duplicate(f)) , DbgName_(std::move(dbgName)) , Length_(File_.GetLength()) @@ -171,7 +171,7 @@ public: CreateMapping(); } - inline TImpl(const TString& name, EOpenMode om) + inline TImpl(const TString& name, EOpenMode om) : File_(name, (om & oRdWr) ? OpenExisting | RdWr : OpenExisting | RdOnly) , DbgName_(name) , Length_(File_.GetLength()) @@ -181,7 +181,7 @@ public: CreateMapping(); } - inline TImpl(const TString& name, i64 length, EOpenMode om) + inline TImpl(const TString& name, i64 length, EOpenMode om) : File_(name, (om & oRdWr) ? OpenExisting | RdWr : OpenExisting | RdOnly) , DbgName_(name) , Length_(length) @@ -196,7 +196,7 @@ public: CreateMapping(); } - inline TImpl(const TFile& file, EOpenMode om, TString dbgName) + inline TImpl(const TFile& file, EOpenMode om, TString dbgName) : File_(file) , DbgName_(File_.GetName() ? File_.GetName() : std::move(dbgName)) , Length_(File_.GetLength()) @@ -206,7 +206,7 @@ public: CreateMapping(); } - inline bool IsOpen() const noexcept { + inline bool IsOpen() const noexcept { return File_.IsOpen() #if defined(_win_) && Mapping_ != nullptr @@ -304,7 +304,7 @@ public: #endif } - inline ~TImpl() { + inline ~TImpl() { #if defined(_win_) if (Mapping_) { ::CloseHandle(Mapping_); // != FALSE @@ -317,15 +317,15 @@ public: #endif } - inline i64 Length() const noexcept { + inline i64 Length() const noexcept { return Length_; } - inline TFile GetFile() const noexcept { + inline TFile GetFile() const noexcept { return File_; } - inline TString GetDbgName() const { + inline TString GetDbgName() const { return DbgName_; } @@ -335,7 +335,7 @@ public: private: TFile File_; - TString DbgName_; // This string is never used to actually open a file, only in exceptions + TString DbgName_; // This string is never used to actually open a file, only in exceptions i64 Length_; EOpenMode Mode_; @@ -346,37 +346,37 @@ private: #endif }; -TMemoryMap::TMemoryMap(const TString& name) +TMemoryMap::TMemoryMap(const TString& name) : Impl_(new TImpl(name, EOpenModeFlag::oRdOnly)) { } -TMemoryMap::TMemoryMap(const TString& name, EOpenMode om) +TMemoryMap::TMemoryMap(const TString& name, EOpenMode om) : Impl_(new TImpl(name, om)) { } -TMemoryMap::TMemoryMap(const TString& name, i64 length, EOpenMode om) +TMemoryMap::TMemoryMap(const TString& name, i64 length, EOpenMode om) : Impl_(new TImpl(name, length, om)) { } -TMemoryMap::TMemoryMap(FILE* f, TString dbgName) +TMemoryMap::TMemoryMap(FILE* f, TString dbgName) : Impl_(new TImpl(f, EOpenModeFlag::oRdOnly, std::move(dbgName))) { } -TMemoryMap::TMemoryMap(FILE* f, EOpenMode om, TString dbgName) +TMemoryMap::TMemoryMap(FILE* f, EOpenMode om, TString dbgName) : Impl_(new TImpl(f, om, std::move(dbgName))) { } -TMemoryMap::TMemoryMap(const TFile& file, TString dbgName) +TMemoryMap::TMemoryMap(const TFile& file, TString dbgName) : Impl_(new TImpl(file, EOpenModeFlag::oRdOnly, std::move(dbgName))) { } -TMemoryMap::TMemoryMap(const TFile& file, EOpenMode om, TString dbgName) +TMemoryMap::TMemoryMap(const TFile& file, EOpenMode om, TString dbgName) : Impl_(new TImpl(file, om, std::move(dbgName))) { } @@ -419,11 +419,11 @@ void TMemoryMap::Evict() { Impl_->Evict(); } -i64 TMemoryMap::Length() const noexcept { +i64 TMemoryMap::Length() const noexcept { return Impl_->Length(); } -bool TMemoryMap::IsOpen() const noexcept { +bool TMemoryMap::IsOpen() const noexcept { return Impl_->IsOpen(); } @@ -435,41 +435,41 @@ TMemoryMap::EOpenMode TMemoryMap::GetMode() const noexcept { return Impl_->GetMode(); } -TFile TMemoryMap::GetFile() const noexcept { +TFile TMemoryMap::GetFile() const noexcept { return Impl_->GetFile(); } -TFileMap::TFileMap(const TMemoryMap& map) noexcept +TFileMap::TFileMap(const TMemoryMap& map) noexcept : Map_(map) { } -TFileMap::TFileMap(const TString& name) +TFileMap::TFileMap(const TString& name) : Map_(name) { } -TFileMap::TFileMap(const TString& name, EOpenMode om) +TFileMap::TFileMap(const TString& name, EOpenMode om) : Map_(name, om) { } -TFileMap::TFileMap(const TString& name, i64 length, EOpenMode om) +TFileMap::TFileMap(const TString& name, i64 length, EOpenMode om) : Map_(name, length, om) { } -TFileMap::TFileMap(FILE* f, EOpenMode om, TString dbgName) +TFileMap::TFileMap(FILE* f, EOpenMode om, TString dbgName) : Map_(f, om, dbgName) { } -TFileMap::TFileMap(const TFile& file, EOpenMode om, TString dbgName) +TFileMap::TFileMap(const TFile& file, EOpenMode om, TString dbgName) : Map_(file, om, dbgName) { } -TFileMap::TFileMap(const TFileMap& fm) noexcept +TFileMap::TFileMap(const TFileMap& fm) noexcept : Map_(fm.Map_) { } @@ -516,7 +516,7 @@ void TFileMap::Unmap() { } } -TFileMap::~TFileMap() { +TFileMap::~TFileMap() { try { // explicit Unmap() is required because in oNotGreedy mode the Map_ object doesn't own the mapped area Unmap(); diff --git a/util/system/filemap.h b/util/system/filemap.h index 11be64bff47..3f80fe1ded0 100644 --- a/util/system/filemap.h +++ b/util/system/filemap.h @@ -9,7 +9,7 @@ #include <util/generic/utility.h> #include <util/generic/yexception.h> #include <util/generic/flags.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <new> #include <cstdio> @@ -21,19 +21,19 @@ namespace NPrivate { struct TMemoryMapCommon { struct TMapResult { - inline size_t MappedSize() const noexcept { + inline size_t MappedSize() const noexcept { return Size - Head; } - inline void* MappedData() const noexcept { + inline void* MappedData() const noexcept { return Ptr ? (void*)((char*)Ptr + Head) : nullptr; } - inline bool IsMapped() const noexcept { + inline bool IsMapped() const noexcept { return Ptr != nullptr; } - inline void Reset() noexcept { + inline void Reset() noexcept { Ptr = nullptr; Size = 0; Head = 0; @@ -43,7 +43,7 @@ struct TMemoryMapCommon { size_t Size; i32 Head; - TMapResult(void) noexcept { + TMapResult(void) noexcept { Reset(); } }; @@ -70,15 +70,15 @@ Y_DECLARE_OPERATORS_FOR_FLAGS(TMemoryMapCommon::EOpenMode) class TMemoryMap: public TMemoryMapCommon { public: - explicit TMemoryMap(const TString& name); - explicit TMemoryMap(const TString& name, EOpenMode om); - TMemoryMap(const TString& name, i64 length, EOpenMode om); + explicit TMemoryMap(const TString& name); + explicit TMemoryMap(const TString& name, EOpenMode om); + TMemoryMap(const TString& name, i64 length, EOpenMode om); TMemoryMap(FILE* f, TString dbgName = UnknownFileName()); TMemoryMap(FILE* f, EOpenMode om, TString dbgName = UnknownFileName()); TMemoryMap(const TFile& file, TString dbgName = UnknownFileName()); TMemoryMap(const TFile& file, EOpenMode om, TString dbgName = UnknownFileName()); - ~TMemoryMap(); + ~TMemoryMap(); TMapResult Map(i64 offset, size_t size); bool Unmap(TMapResult region); @@ -86,11 +86,11 @@ public: void ResizeAndReset(i64 size); TMapResult ResizeAndRemap(i64 offset, size_t size); - i64 Length() const noexcept; - bool IsOpen() const noexcept; + i64 Length() const noexcept; + bool IsOpen() const noexcept; bool IsWritable() const noexcept; EOpenMode GetMode() const noexcept; - TFile GetFile() const noexcept; + TFile GetFile() const noexcept; void SetSequential(); void Evict(void* ptr, size_t len); @@ -108,15 +108,15 @@ private: class TFileMap: public TMemoryMapCommon { public: - TFileMap(const TMemoryMap& map) noexcept; - TFileMap(const TString& name); - TFileMap(const TString& name, EOpenMode om); - TFileMap(const TString& name, i64 length, EOpenMode om); + TFileMap(const TMemoryMap& map) noexcept; + TFileMap(const TString& name); + TFileMap(const TString& name, EOpenMode om); + TFileMap(const TString& name, i64 length, EOpenMode om); TFileMap(FILE* f, EOpenMode om = oRdOnly, TString dbgName = UnknownFileName()); TFileMap(const TFile& file, EOpenMode om = oRdOnly, TString dbgName = UnknownFileName()); - TFileMap(const TFileMap& fm) noexcept; + TFileMap(const TFileMap& fm) noexcept; - ~TFileMap(); + ~TFileMap(); TMapResult Map(i64 offset, size_t size); TMapResult ResizeAndRemap(i64 offset, size_t size); @@ -138,11 +138,11 @@ public: FlushAsync(Ptr(), MappedSize()); } - inline i64 Length() const noexcept { + inline i64 Length() const noexcept { return Map_.Length(); } - inline bool IsOpen() const noexcept { + inline bool IsOpen() const noexcept { return Map_.IsOpen(); } @@ -154,15 +154,15 @@ public: return Map_.GetMode(); } - inline void* Ptr() const noexcept { + inline void* Ptr() const noexcept { return Region_.MappedData(); } - inline size_t MappedSize() const noexcept { + inline size_t MappedSize() const noexcept { return Region_.MappedSize(); } - TFile GetFile() const noexcept { + TFile GetFile() const noexcept { return Map_.GetFile(); } @@ -241,7 +241,7 @@ public: Dummy_.Destroy(); Dummy_.Reset(new (DummyData()) T(n_Dummy)); } - inline char* DummyData() const noexcept { + inline char* DummyData() const noexcept { return AlignUp((char*)DummyData_); } inline const T& Dummy() const { @@ -260,22 +260,22 @@ public: return 0 == Size_; } /// for STL compatibility only, Begin() usage is recommended - const T* begin() const noexcept { + const T* begin() const noexcept { return Begin(); } - const T* Begin() const noexcept { + const T* Begin() const noexcept { return Ptr_; } /// for STL compatibility only, End() usage is recommended - const T* end() const noexcept { + const T* end() const noexcept { return End_; } - const T* End() const noexcept { + const T* End() const noexcept { return End_; } private: - void DoInit(const TString& fileName) { + void DoInit(const TString& fileName) { DataHolder_->Map(0, DataHolder_->Length()); if (DataHolder_->Length() % sizeof(T)) { Term(); @@ -308,10 +308,10 @@ public: char* Data(ui32 pos = 0) const { return (char*)(Ptr_ ? ((char*)Ptr_ + pos) : nullptr); } - char* Begin() const noexcept { + char* Begin() const noexcept { return (char*)Ptr(); } - char* End() const noexcept { + char* End() const noexcept { return Begin() + MappedSize(); } size_t MappedSize() const { diff --git a/util/system/filemap_ut.cpp b/util/system/filemap_ut.cpp index 73f109dc880..158be2bd58e 100644 --- a/util/system/filemap_ut.cpp +++ b/util/system/filemap_ut.cpp @@ -301,7 +301,7 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { mappedMem.Map(mappedMem.Length() / 2, mappedMem.Length() + 100); // overflow UNIT_ASSERT(0); // should not go here } catch (yexception& exc) { - TString text = exc.what(); // exception should contain failed file name + TString text = exc.what(); // exception should contain failed file name UNIT_ASSERT(text.find(TMemoryMapCommon::UnknownFileName()) != TString::npos); fclose(f); } @@ -312,8 +312,8 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { mappedMem.Map(mappedMem.Length() / 2, mappedMem.Length() + 100); // overflow UNIT_ASSERT(0); // should not go here } catch (yexception& exc) { - TString text = exc.what(); // exception should contain failed file name - UNIT_ASSERT(text.find(FileName_) != TString::npos); + TString text = exc.what(); // exception should contain failed file name + UNIT_ASSERT(text.find(FileName_) != TString::npos); } NFs::Remove(FileName_); } diff --git a/util/system/fs.cpp b/util/system/fs.cpp index d2611a8ccc4..33ff9008884 100644 --- a/util/system/fs.cpp +++ b/util/system/fs.cpp @@ -16,7 +16,7 @@ #include <util/system/fstat.h> #include <util/folder/path.h> -bool NFs::Remove(const TString& path) { +bool NFs::Remove(const TString& path) { #if defined(_win_) return NFsPrivate::WinRemove(path); #else @@ -24,7 +24,7 @@ bool NFs::Remove(const TString& path) { #endif } -void NFs::RemoveRecursive(const TString& path) { +void NFs::RemoveRecursive(const TString& path) { static const TStringBuf errStr = "error while removing "; if (!NFs::Exists(path)) { @@ -53,7 +53,7 @@ void NFs::RemoveRecursive(const TString& path) { } } -bool NFs::MakeDirectory(const TString& path, EFilePermissions mode) { +bool NFs::MakeDirectory(const TString& path, EFilePermissions mode) { #if defined(_win_) Y_UNUSED(mode); return NFsPrivate::WinMakeDirectory(path); @@ -62,7 +62,7 @@ bool NFs::MakeDirectory(const TString& path, EFilePermissions mode) { #endif } -bool NFs::MakeDirectoryRecursive(const TString& path, EFilePermissions mode, bool alwaysCreate) { +bool NFs::MakeDirectoryRecursive(const TString& path, EFilePermissions mode, bool alwaysCreate) { if (NFs::Exists(path) && TFileStat(path).IsDir()) { if (alwaysCreate) { ythrow TIoException() << "path " << path << " already exists" @@ -84,7 +84,7 @@ bool NFs::MakeDirectoryRecursive(const TString& path, EFilePermissions mode, boo } } -bool NFs::Rename(const TString& oldPath, const TString& newPath) { +bool NFs::Rename(const TString& oldPath, const TString& newPath) { #if defined(_win_) return NFsPrivate::WinRename(oldPath, newPath); #else @@ -92,13 +92,13 @@ bool NFs::Rename(const TString& oldPath, const TString& newPath) { #endif } -void NFs::HardLinkOrCopy(const TString& existingPath, const TString& newPath) { +void NFs::HardLinkOrCopy(const TString& existingPath, const TString& newPath) { if (!NFs::HardLink(existingPath, newPath)) { Copy(existingPath, newPath); } } -bool NFs::HardLink(const TString& existingPath, const TString& newPath) { +bool NFs::HardLink(const TString& existingPath, const TString& newPath) { #if defined(_win_) return NFsPrivate::WinHardLink(existingPath, newPath); #elif defined(_unix_) @@ -106,7 +106,7 @@ bool NFs::HardLink(const TString& existingPath, const TString& newPath) { #endif } -bool NFs::SymLink(const TString& targetPath, const TString& linkPath) { +bool NFs::SymLink(const TString& targetPath, const TString& linkPath) { #if defined(_win_) return NFsPrivate::WinSymLink(targetPath, linkPath); #elif defined(_unix_) @@ -114,7 +114,7 @@ bool NFs::SymLink(const TString& targetPath, const TString& linkPath) { #endif } -TString NFs::ReadLink(const TString& path) { +TString NFs::ReadLink(const TString& path) { #if defined(_win_) return NFsPrivate::WinReadLink(path); #elif defined(_unix_) @@ -125,28 +125,28 @@ TString NFs::ReadLink(const TString& path) { ythrow yexception() << "can't read link " << path << ", errno = " << errno; } if (r < (ssize_t)buf.Size()) { - return TString(buf.Data(), r); + return TString(buf.Data(), r); } buf = TTempBuf(buf.Size() * 2); } #endif } -void NFs::Cat(const TString& dstPath, const TString& srcPath) { - TUnbufferedFileInput src(srcPath); - TUnbufferedFileOutput dst(TFile(dstPath, ForAppend | WrOnly | Seq)); +void NFs::Cat(const TString& dstPath, const TString& srcPath) { + TUnbufferedFileInput src(srcPath); + TUnbufferedFileOutput dst(TFile(dstPath, ForAppend | WrOnly | Seq)); TransferData(&src, &dst); } -void NFs::Copy(const TString& existingPath, const TString& newPath) { - TUnbufferedFileInput src(existingPath); - TUnbufferedFileOutput dst(TFile(newPath, CreateAlways | WrOnly | Seq)); +void NFs::Copy(const TString& existingPath, const TString& newPath) { + TUnbufferedFileInput src(existingPath); + TUnbufferedFileOutput dst(TFile(newPath, CreateAlways | WrOnly | Seq)); TransferData(&src, &dst); } -bool NFs::Exists(const TString& path) { +bool NFs::Exists(const TString& path) { #if defined(_win_) return NFsPrivate::WinExists(path); #elif defined(_unix_) @@ -154,7 +154,7 @@ bool NFs::Exists(const TString& path) { #endif } -TString NFs::CurrentWorkingDirectory() { +TString NFs::CurrentWorkingDirectory() { #if defined(_win_) return NFsPrivate::WinCurrentWorkingDirectory(); #elif defined(_unix_) @@ -167,7 +167,7 @@ TString NFs::CurrentWorkingDirectory() { #endif } -void NFs::SetCurrentWorkingDirectory(TString path) { +void NFs::SetCurrentWorkingDirectory(TString path) { #ifdef _win_ bool ok = NFsPrivate::WinSetCurrentWorkingDirectory(path); #else diff --git a/util/system/fs.h b/util/system/fs.h index 237daf2d2d7..a412f6cb15a 100644 --- a/util/system/fs.h +++ b/util/system/fs.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/flags.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> namespace NFs { @@ -28,27 +28,27 @@ namespace NFs { /// @param[in] path Path to file or directory /// @returns true on success or false otherwise /// LastSystemError() is set in case of failure - bool Remove(const TString& path); + bool Remove(const TString& path); /// Remove a file or directory with contents /// /// @param[in] path Path to file or directory /// @throws - void RemoveRecursive(const TString& path); + void RemoveRecursive(const TString& path); /// Creates directory /// /// @param[in] path Path to the directory /// @param[in] mode Access permissions field; NOTE: ignored on win /// @returns true on success or false otherwise - bool MakeDirectory(const TString& path, EFilePermissions mode); + bool MakeDirectory(const TString& path, EFilePermissions mode); /// Creates directory /// /// @param[in] path Path to the directory /// @returns true on success or false otherwise /// NOTE: access permissions is set to 0777 - inline bool MakeDirectory(const TString& path) { + inline bool MakeDirectory(const TString& path) { return MakeDirectory(path, FP_COMMON_FILE); } @@ -58,14 +58,14 @@ namespace NFs { /// @param[in] mode Access permissions field; NOTE: ignored on win /// @param[in] alwaysCreate Throw if path already exists or failed to create /// @returns true if target path created or exists (and directory) - bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode, bool alwaysCreate); + bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode, bool alwaysCreate); /// Creates directory and all non-existings parents /// /// @param[in] path Path to be created /// @param[in] mode Access permissions field; NOTE: ignored on win /// @returns true if target path created or exists (and directory) - inline bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode) { + inline bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode) { return MakeDirectoryRecursive(path, mode, false); } @@ -73,7 +73,7 @@ namespace NFs { /// /// @param[in] path Path to be created /// @returns true if target path created or exists (and directory) - inline bool MakeDirectoryRecursive(const TString& path) { + inline bool MakeDirectoryRecursive(const TString& path) { return MakeDirectoryRecursive(path, FP_COMMON_FILE, false); } @@ -84,14 +84,14 @@ namespace NFs { /// @param[in] newPath New path of file or directory /// @returns true on success or false otherwise /// LastSystemError() is set in case of failure - bool Rename(const TString& oldPath, const TString& newPath); + bool Rename(const TString& oldPath, const TString& newPath); /// Creates a new directory entry for a file /// or creates a new one with the same content /// /// @param[in] existingPath Path to an existing file /// @param[in] newPath New path of file - void HardLinkOrCopy(const TString& existingPath, const TString& newPath); + void HardLinkOrCopy(const TString& existingPath, const TString& newPath); /// Creates a new directory entry for a file /// @@ -99,7 +99,7 @@ namespace NFs { /// @param[in] newPath New path of file /// @returns true if new link was created or false otherwise /// LastSystemError() is set in case of failure - bool HardLink(const TString& existingPath, const TString& newPath); + bool HardLink(const TString& existingPath, const TString& newPath); /// Creates a symlink to a file /// @@ -107,47 +107,47 @@ namespace NFs { /// @param[in] linkPath Path of symlink /// @returns true if new link was created or false otherwise /// LastSystemError() is set in case of failure - bool SymLink(const TString& targetPath, const TString& linkPath); + bool SymLink(const TString& targetPath, const TString& linkPath); /// Reads value of a symbolic link /// /// @param[in] path Path to a symlink /// @returns File path that a symlink points to - TString ReadLink(const TString& path); + TString ReadLink(const TString& path); /// Append contents of a file to a new file /// /// @param[in] dstPath Path to a destination file /// @param[in] srcPath Path to a source file - void Cat(const TString& dstPath, const TString& srcPath); + void Cat(const TString& dstPath, const TString& srcPath); /// Copy contents of a file to a new file /// /// @param[in] existingPath Path to an existing file /// @param[in] newPath New path of file - void Copy(const TString& existingPath, const TString& newPath); + void Copy(const TString& existingPath, const TString& newPath); /// Returns path to the current working directory /// /// Note: is not threadsafe - TString CurrentWorkingDirectory(); + TString CurrentWorkingDirectory(); /// Changes current working directory /// /// @param[in] path Path for new cwd /// Note: is not threadsafe - void SetCurrentWorkingDirectory(TString path); + void SetCurrentWorkingDirectory(TString path); /// Checks if file exists /// /// @param[in] path Path to check - bool Exists(const TString& path); + bool Exists(const TString& path); /// Ensures that file exists /// /// @param[in] path Path to check /// @returns input argument - inline const TString& EnsureExists(const TString& path) { + inline const TString& EnsureExists(const TString& path) { Y_ENSURE_EX(Exists(path), TFileError{} << "Path " << path << " does not exists (checked from cwd:" << NFs::CurrentWorkingDirectory() << ")"); return path; } diff --git a/util/system/fs_ut.cpp b/util/system/fs_ut.cpp index de071ebf55b..1b3baff09fa 100644 --- a/util/system/fs_ut.cpp +++ b/util/system/fs_ut.cpp @@ -56,7 +56,7 @@ void TFsTest::TestCreateRemove() { UNIT_ASSERT_EXCEPTION(NFs::MakeDirectoryRecursive(subdir1, NFs::FP_COMMON_FILE, true), TIoException); TFsPath file1 = dir1 / "f1.txt"; - TFsPath file2 = subdir1 + TString("_f2.txt"); + TFsPath file2 = subdir1 + TString("_f2.txt"); TFsPath file3 = subdir1 / "f2.txt"; Touch(file1); Touch(file2); @@ -70,7 +70,7 @@ void TFsTest::TestCreateRemove() { UNIT_ASSERT(!NFs::MakeDirectoryRecursive(file1 / "subdir1" / "subdir2", NFs::FP_COMMON_FILE, false)); UNIT_ASSERT(!NFs::MakeDirectoryRecursive(file1, NFs::FP_COMMON_FILE, false)); - TString longUtf8Name = ""; + TString longUtf8Name = ""; while (longUtf8Name.size() < 255) { longUtf8Name = longUtf8Name + "fф"; } @@ -191,7 +191,7 @@ void TFsTest::TestHardlink() { RunHardlinkTest("tempfile_абвг", "hardlinkfile_абвг"); //utf-8 names } -static void RunSymLinkTest(TString fileLocalName, TString symLinkName) { +static void RunSymLinkTest(TString fileLocalName, TString symLinkName) { // if previous running was failed TFsPath subDir = "tempsubdir"; TFsPath srcFile = subDir / fileLocalName; @@ -222,8 +222,8 @@ static void RunSymLinkTest(TString fileLocalName, TString symLinkName) { UNIT_ASSERT(NFs::SymLink(subDir, linkD1)); UNIT_ASSERT(NFs::SymLink("../dir2", linkD2)); UNIT_ASSERT(NFs::SymLink("../dir3", dangling)); - UNIT_ASSERT_STRINGS_EQUAL(NFs::ReadLink(linkD2), TString("..") + LOCSLASH_S "dir2"); - UNIT_ASSERT_STRINGS_EQUAL(NFs::ReadLink(dangling), TString("..") + LOCSLASH_S "dir3"); + UNIT_ASSERT_STRINGS_EQUAL(NFs::ReadLink(linkD2), TString("..") + LOCSLASH_S "dir2"); + UNIT_ASSERT_STRINGS_EQUAL(NFs::ReadLink(dangling), TString("..") + LOCSLASH_S "dir3"); { TFile file(linkD1 / fileLocalName, OpenExisting | RdOnly); UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 7); @@ -311,7 +311,7 @@ void TFsTest::TestEnsureExists() { UNIT_ASSERT_EXCEPTION(NFs::EnsureExists(nonExists), TFileError); TStringBuilder expected; - TString got; + TString got; try { NFs::EnsureExists(nonExists); expected << __LOCATION__; diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp index a410ccac06d..79f7c43ecd9 100644 --- a/util/system/fs_win.cpp +++ b/util/system/fs_win.cpp @@ -9,7 +9,7 @@ #include <winioctl.h> namespace NFsPrivate { - static LPCWSTR UTF8ToWCHAR(const TStringBuf str, TUtf16String& wstr) { + static LPCWSTR UTF8ToWCHAR(const TStringBuf str, TUtf16String& wstr) { wstr.resize(str.size()); size_t written = 0; if (!UTF8ToWide(str.data(), str.size(), wstr.begin(), written)) @@ -19,14 +19,14 @@ namespace NFsPrivate { return (const WCHAR*)wstr.data(); } - static TString WCHARToUTF8(const LPWSTR wstr, size_t len) { + static TString WCHARToUTF8(const LPWSTR wstr, size_t len) { static_assert(sizeof(WCHAR) == sizeof(wchar16), "expect sizeof(WCHAR) == sizeof(wchar16)"); return WideToUTF8((wchar16*)wstr, len); } HANDLE CreateFileWithUtf8Name(const TStringBuf fName, ui32 accessMode, ui32 shareMode, ui32 createMode, ui32 attributes, bool inheritHandle) { - TUtf16String wstr; + TUtf16String wstr; LPCWSTR wname = UTF8ToWCHAR(fName, wstr); if (!wname) { ::SetLastError(ERROR_INVALID_NAME); @@ -39,8 +39,8 @@ namespace NFsPrivate { return ::CreateFileW(wname, accessMode, shareMode, &secAttrs, createMode, attributes, nullptr); } - bool WinRename(const TString& oldPath, const TString& newPath) { - TUtf16String op, np; + bool WinRename(const TString& oldPath, const TString& newPath) { + TUtf16String op, np; LPCWSTR opPtr = UTF8ToWCHAR(oldPath, op); LPCWSTR npPtr = UTF8ToWCHAR(newPath, np); if (!opPtr || !npPtr) { @@ -51,8 +51,8 @@ namespace NFsPrivate { return MoveFileExW(opPtr, npPtr, MOVEFILE_REPLACE_EXISTING) != 0; } - bool WinRemove(const TString& path) { - TUtf16String wstr; + bool WinRemove(const TString& path) { + TUtf16String wstr; LPCWSTR wname = UTF8ToWCHAR(path, wstr); if (!wname) { ::SetLastError(ERROR_INVALID_NAME); @@ -68,16 +68,16 @@ namespace NFsPrivate { return false; } - bool WinSymLink(const TString& targetName, const TString& linkName) { - TString tName(targetName); + bool WinSymLink(const TString& targetName, const TString& linkName) { + TString tName(targetName); { size_t pos; - while ((pos = tName.find('/')) != TString::npos) + while ((pos = tName.find('/')) != TString::npos) tName.replace(pos, 1, LOCSLASH_S); } - TUtf16String tstr; + TUtf16String tstr; LPCWSTR wname = UTF8ToWCHAR(tName, tstr); - TUtf16String lstr; + TUtf16String lstr; LPCWSTR lname = UTF8ToWCHAR(linkName, lstr); // we can't create a dangling link to a dir in this way @@ -85,14 +85,14 @@ namespace NFsPrivate { if (attr == INVALID_FILE_ATTRIBUTES) { TTempBuf result; if (GetFullPathNameW(lname, result.Size(), (LPWSTR)result.Data(), 0) != 0) { - TString fullPath = WideToUTF8(TWtringBuf((const wchar16*)result.Data())); + TString fullPath = WideToUTF8(TWtringBuf((const wchar16*)result.Data())); TStringBuf linkDir(fullPath); linkDir.RNextTok('\\'); if (linkDir) { - TString fullTarget(tName); + TString fullTarget(tName); resolvepath(fullTarget, TString{linkDir}); - TUtf16String fullTargetW; + TUtf16String fullTargetW; LPCWSTR ptrFullTarget = UTF8ToWCHAR(fullTarget, fullTargetW); attr = ::GetFileAttributesW(ptrFullTarget); } @@ -101,8 +101,8 @@ namespace NFsPrivate { return 0 != CreateSymbolicLinkW(lname, wname, attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0); } - bool WinHardLink(const TString& existingPath, const TString& newPath) { - TUtf16String ep, np; + bool WinHardLink(const TString& existingPath, const TString& newPath) { + TUtf16String ep, np; LPCWSTR epPtr = UTF8ToWCHAR(existingPath, ep); LPCWSTR npPtr = UTF8ToWCHAR(newPath, np); if (!epPtr || !npPtr) { @@ -113,13 +113,13 @@ namespace NFsPrivate { return (CreateHardLinkW(npPtr, epPtr, nullptr) != 0); } - bool WinExists(const TString& path) { - TUtf16String buf; + bool WinExists(const TString& path) { + TUtf16String buf; LPCWSTR ptr = UTF8ToWCHAR(path, buf); return ::GetFileAttributesW(ptr) != INVALID_FILE_ATTRIBUTES; } - TString WinCurrentWorkingDirectory() { + TString WinCurrentWorkingDirectory() { TTempBuf result; LPWSTR buf = reinterpret_cast<LPWSTR>(result.Data()); int r = GetCurrentDirectoryW(result.Size() / sizeof(WCHAR), buf); @@ -128,8 +128,8 @@ namespace NFsPrivate { return WCHARToUTF8(buf, r); } - bool WinSetCurrentWorkingDirectory(const TString& path) { - TUtf16String wstr; + bool WinSetCurrentWorkingDirectory(const TString& path) { + TUtf16String wstr; LPCWSTR wname = UTF8ToWCHAR(path, wstr); if (!wname) { ::SetLastError(ERROR_INVALID_NAME); @@ -138,8 +138,8 @@ namespace NFsPrivate { return SetCurrentDirectoryW(wname); } - bool WinMakeDirectory(const TString path) { - TUtf16String buf; + bool WinMakeDirectory(const TString path) { + TUtf16String buf; LPCWSTR ptr = UTF8ToWCHAR(path, buf); return CreateDirectoryW(ptr, (LPSECURITY_ATTRIBUTES) nullptr); } @@ -180,7 +180,7 @@ namespace NFsPrivate { // the end of edited part of <Ntifs.h> - TString WinReadLink(const TString& name) { + TString WinReadLink(const TString& name) { TFileHandle h = CreateFileWithUtf8Name(name, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, true); TTempBuf buf; @@ -199,7 +199,7 @@ namespace NFsPrivate { return WideToUTF8(str, len); } //this reparse point is unsupported in arcadia - return TString(); + return TString(); } else { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { buf = TTempBuf(buf.Size() * 2); diff --git a/util/system/fs_win.h b/util/system/fs_win.h index 80861298284..b32bb0fefe5 100644 --- a/util/system/fs_win.h +++ b/util/system/fs_win.h @@ -4,26 +4,26 @@ #include "defaults.h" #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NFsPrivate { - bool WinRename(const TString& oldPath, const TString& newPath); + bool WinRename(const TString& oldPath, const TString& newPath); - bool WinSymLink(const TString& targetName, const TString& linkName); + bool WinSymLink(const TString& targetName, const TString& linkName); - bool WinHardLink(const TString& existingPath, const TString& newPath); + bool WinHardLink(const TString& existingPath, const TString& newPath); - TString WinReadLink(const TString& path); + TString WinReadLink(const TString& path); HANDLE CreateFileWithUtf8Name(const TStringBuf fName, ui32 accessMode, ui32 shareMode, ui32 createMode, ui32 attributes, bool inheritHandle); - bool WinRemove(const TString& path); + bool WinRemove(const TString& path); - bool WinExists(const TString& path); + bool WinExists(const TString& path); - TString WinCurrentWorkingDirectory(); + TString WinCurrentWorkingDirectory(); - bool WinSetCurrentWorkingDirectory(const TString& path); + bool WinSetCurrentWorkingDirectory(const TString& path); - bool WinMakeDirectory(const TString path); + bool WinMakeDirectory(const TString path); } diff --git a/util/system/fstat.cpp b/util/system/fstat.cpp index 81e98cbc6bb..1fc66b4f705 100644 --- a/util/system/fstat.cpp +++ b/util/system/fstat.cpp @@ -124,7 +124,7 @@ TFileStat::TFileStat(const TFsPath& fileName, bool nofollow) { MakeFromFileName(fileName.GetPath().data(), nofollow); } -TFileStat::TFileStat(const TString& fileName, bool nofollow) { +TFileStat::TFileStat(const TString& fileName, bool nofollow) { MakeFromFileName(fileName.data(), nofollow); } @@ -210,6 +210,6 @@ i64 GetFileLength(const char* name) { #endif } -i64 GetFileLength(const TString& name) { +i64 GetFileLength(const TString& name) { return GetFileLength(name.data()); } diff --git a/util/system/fstat.h b/util/system/fstat.h index 64e79e1b559..e1505e6041b 100644 --- a/util/system/fstat.h +++ b/util/system/fstat.h @@ -32,7 +32,7 @@ public: explicit TFileStat(const TFile& f); explicit TFileStat(FHANDLE f); TFileStat(const TFsPath& fileName, bool nofollow = false); - TFileStat(const TString& fileName, bool nofollow = false); + TFileStat(const TString& fileName, bool nofollow = false); TFileStat(const char* fileName, bool nofollow = false); friend bool operator==(const TFileStat& l, const TFileStat& r) noexcept; @@ -44,4 +44,4 @@ private: i64 GetFileLength(FHANDLE fd); i64 GetFileLength(const char* name); -i64 GetFileLength(const TString& name); +i64 GetFileLength(const TString& name); diff --git a/util/system/fstat_ut.cpp b/util/system/fstat_ut.cpp index 160ecd936e6..ed126eaead5 100644 --- a/util/system/fstat_ut.cpp +++ b/util/system/fstat_ut.cpp @@ -10,7 +10,7 @@ Y_UNIT_TEST_SUITE(TestFileStat) { Y_UNIT_TEST(FileTest) { - TString fileName = "f1.txt"; + TString fileName = "f1.txt"; TFileStat oFs; { TFile file(fileName.data(), OpenAlways | WrOnly); diff --git a/util/system/guard.h b/util/system/guard.h index efc091d5f8d..19c44914249 100644 --- a/util/system/guard.h +++ b/util/system/guard.h @@ -8,14 +8,14 @@ struct TCommonLockOps { t->Acquire(); } - static inline void Release(T* t) noexcept { + static inline void Release(T* t) noexcept { t->Release(); } }; template <class T> struct TTryLockOps: public TCommonLockOps<T> { - static inline bool TryAcquire(T* t) noexcept { + static inline bool TryAcquire(T* t) noexcept { return t->TryAcquire(); } }; @@ -24,7 +24,7 @@ struct TTryLockOps: public TCommonLockOps<T> { template <class TOps> struct TInverseLockOps: public TOps { template <class T> - static inline void Acquire(T* t) noexcept { + static inline void Acquire(T* t) noexcept { TOps::Release(t); } @@ -45,32 +45,32 @@ public: Init(t); } - inline TGuard(TGuard&& g) noexcept + inline TGuard(TGuard&& g) noexcept : T_(g.T_) { g.T_ = nullptr; } - inline ~TGuard() { + inline ~TGuard() { Release(); } - inline void Release() noexcept { + inline void Release() noexcept { if (WasAcquired()) { TOps::Release(T_); T_ = nullptr; } } - explicit inline operator bool() const noexcept { + explicit inline operator bool() const noexcept { return WasAcquired(); } - inline bool WasAcquired() const noexcept { + inline bool WasAcquired() const noexcept { return T_ != nullptr; } - inline T* GetMutex() const noexcept { + inline T* GetMutex() const noexcept { return T_; } @@ -129,11 +129,11 @@ static inline TInverseGuard<T> Unguard(const T& mutex) { template <class T, class TOps = TTryLockOps<T>> class TTryGuard: public TNonCopyable { public: - inline TTryGuard(const T& t) noexcept { + inline TTryGuard(const T& t) noexcept { Init(&t); } - inline TTryGuard(const T* t) noexcept { + inline TTryGuard(const T* t) noexcept { Init(t); } @@ -143,27 +143,27 @@ public: g.T_ = nullptr; } - inline ~TTryGuard() { + inline ~TTryGuard() { Release(); } - inline void Release() noexcept { + inline void Release() noexcept { if (WasAcquired()) { TOps::Release(T_); T_ = nullptr; } } - inline bool WasAcquired() const noexcept { + inline bool WasAcquired() const noexcept { return T_ != nullptr; } - explicit inline operator bool() const noexcept { + explicit inline operator bool() const noexcept { return WasAcquired(); } private: - inline void Init(const T* t) noexcept { + inline void Init(const T* t) noexcept { T_ = nullptr; T* tMutable = const_cast<T*>(t); if (TOps::TryAcquire(tMutable)) { diff --git a/util/system/hostname.cpp b/util/system/hostname.cpp index 386f646d6bd..397f64bae96 100644 --- a/util/system/hostname.cpp +++ b/util/system/hostname.cpp @@ -29,7 +29,7 @@ namespace { HostName = hostNameBuf.Data(); } - TString HostName; + TString HostName; }; struct TFQDNHostNameHolder { @@ -60,11 +60,11 @@ namespace { FQDNHostName.to_lower(); } - TString FQDNHostName; + TString FQDNHostName; }; } -const TString& HostName() { +const TString& HostName() { return (Singleton<THostNameHolder>())->HostName; } @@ -72,7 +72,7 @@ const char* GetHostName() { return HostName().data(); } -const TString& FQDNHostName() { +const TString& FQDNHostName() { return (Singleton<TFQDNHostNameHolder>())->FQDNHostName; } @@ -80,8 +80,8 @@ const char* GetFQDNHostName() { return FQDNHostName().data(); } -bool IsFQDN(const TString& name) { - TString absName = name; +bool IsFQDN(const TString& name) { + TString absName = name; if (!absName.EndsWith('.')) { absName.append("."); } diff --git a/util/system/hostname.h b/util/system/hostname.h index 0839ee2b594..bf8c90fac8a 100644 --- a/util/system/hostname.h +++ b/util/system/hostname.h @@ -3,8 +3,8 @@ #include <util/generic/fwd.h> const char* GetHostName(); -const TString& HostName(); +const TString& HostName(); const char* GetFQDNHostName(); -const TString& FQDNHostName(); -bool IsFQDN(const TString& name); +const TString& FQDNHostName(); +bool IsFQDN(const TString& name); diff --git a/util/system/info.cpp b/util/system/info.cpp index cf6681e89a9..9d66c38f0c1 100644 --- a/util/system/info.cpp +++ b/util/system/info.cpp @@ -176,7 +176,7 @@ size_t NSystemInfo::CachedNumberOfCpus() { return NCpus; } -size_t NSystemInfo::GetPageSize() noexcept { +size_t NSystemInfo::GetPageSize() noexcept { #if defined(_win_) SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); diff --git a/util/system/info.h b/util/system/info.h index 73ebe48a9ae..8894f8e6bb5 100644 --- a/util/system/info.h +++ b/util/system/info.h @@ -6,7 +6,7 @@ namespace NSystemInfo { size_t NumberOfCpus(); size_t CachedNumberOfCpus(); size_t LoadAverage(double* la, size_t len); - size_t GetPageSize() noexcept; + size_t GetPageSize() noexcept; size_t TotalMemorySize(); size_t MaxOpenFiles(); } diff --git a/util/system/madvise.cpp b/util/system/madvise.cpp index 58c894e3ef7..ababb94f3fb 100644 --- a/util/system/madvise.cpp +++ b/util/system/madvise.cpp @@ -35,7 +35,7 @@ namespace { } #else if (-1 == madvise(begin, size, flag)) { - TString err(LastSystemErrorText()); + TString err(LastSystemErrorText()); ythrow yexception() << "madvise(" << begin << ", " << size << ", " << flag << ")" << " returned error: " << err; } diff --git a/util/system/mem_info.cpp b/util/system/mem_info.cpp index aa51ae3b16d..49e906f0069 100644 --- a/util/system/mem_info.cpp +++ b/util/system/mem_info.cpp @@ -115,7 +115,7 @@ namespace NMemInfo { } else { path = TStringBuilder() << TStringBuf("/proc/") << pid << TStringBuf("/statm"); } - const TString stats = TUnbufferedFileInput(path).ReadAll(); + const TString stats = TUnbufferedFileInput(path).ReadAll(); TStringBuf statsiter(stats); @@ -136,7 +136,7 @@ namespace NMemInfo { errno = 0; if (sysctl((int*)mib, 4, &proc, &size, nullptr, 0) == -1) { int err = errno; - TString errtxt = LastSystemErrorText(err); + TString errtxt = LastSystemErrorText(err); ythrow yexception() << "sysctl({CTL_KERN,KERN_PROC,KERN_PROC_PID,pid},4,proc,&size,NULL,0) returned -1, errno: " << err << " (" << errtxt << ")" << Endl; } @@ -151,7 +151,7 @@ namespace NMemInfo { if (r != sizeof(taskInfo)) { int err = errno; - TString errtxt = LastSystemErrorText(err); + TString errtxt = LastSystemErrorText(err); ythrow yexception() << "proc_pidinfo(pid, PROC_PIDTASKINFO, 0, &taskInfo, sizeof(taskInfo)) returned " << r << ", errno: " << err << " (" << errtxt << ")" << Endl; } result.VMS = taskInfo.pti_virtual_size; diff --git a/util/system/mutex.cpp b/util/system/mutex.cpp index 4041402db9a..4b7096cd125 100644 --- a/util/system/mutex.cpp +++ b/util/system/mutex.cpp @@ -33,7 +33,7 @@ public: } } - inline ~T() { + inline ~T() { int result = pthread_mutexattr_destroy(&Attr); Y_VERIFY(result == 0, "mutexattr destroy(%s)", LastSystemErrorText(result)); } @@ -46,7 +46,7 @@ public: #endif } - inline ~TImpl() { + inline ~TImpl() { #if defined(_win_) DeleteCriticalSection(&Obj); #else @@ -55,7 +55,7 @@ public: #endif } - inline void Acquire() noexcept { + inline void Acquire() noexcept { #if defined(_win_) EnterCriticalSection(&Obj); #else @@ -87,7 +87,7 @@ public: } #endif // _win_ - inline bool TryAcquire() noexcept { + inline bool TryAcquire() noexcept { #if defined(_win_) return TryEnterCriticalSectionInt(&Obj); #else @@ -99,7 +99,7 @@ public: #endif } - inline void Release() noexcept { + inline void Release() noexcept { #if defined(_win_) LeaveCriticalSection(&Obj); #else @@ -108,7 +108,7 @@ public: #endif } - inline void* Handle() const noexcept { + inline void* Handle() const noexcept { return (void*)&Obj; } diff --git a/util/system/mutex.h b/util/system/mutex.h index 032630d134e..02cd05586cd 100644 --- a/util/system/mutex.h +++ b/util/system/mutex.h @@ -8,14 +8,14 @@ class TFakeMutex: public TNonCopyable { public: - inline void Acquire() noexcept { + inline void Acquire() noexcept { } - inline bool TryAcquire() noexcept { + inline bool TryAcquire() noexcept { return true; } - inline void Release() noexcept { + inline void Release() noexcept { } inline void lock() noexcept { @@ -39,9 +39,9 @@ public: TMutex(TMutex&&); ~TMutex(); - void Acquire() noexcept; - bool TryAcquire() noexcept; - void Release() noexcept; + void Acquire() noexcept; + bool TryAcquire() noexcept; + void Release() noexcept; inline void lock() noexcept { Acquire(); @@ -56,7 +56,7 @@ public: } //return opaque pointer to real handler - void* Handle() const noexcept; + void* Handle() const noexcept; private: class TImpl; diff --git a/util/system/pipe.cpp b/util/system/pipe.cpp index a543bd74720..fb3d8229a01 100644 --- a/util/system/pipe.cpp +++ b/util/system/pipe.cpp @@ -3,7 +3,7 @@ #include <util/stream/output.h> #include <util/generic/yexception.h> -ssize_t TPipeHandle::Read(void* buffer, size_t byteCount) const noexcept { +ssize_t TPipeHandle::Read(void* buffer, size_t byteCount) const noexcept { #ifdef _win_ return recv(Fd_, (char*)buffer, byteCount, 0); #else @@ -11,7 +11,7 @@ ssize_t TPipeHandle::Read(void* buffer, size_t byteCount) const noexcept { #endif } -ssize_t TPipeHandle::Write(const void* buffer, size_t byteCount) const noexcept { +ssize_t TPipeHandle::Write(const void* buffer, size_t byteCount) const noexcept { #ifdef _win_ return send(Fd_, (const char*)buffer, byteCount, 0); #else @@ -19,7 +19,7 @@ ssize_t TPipeHandle::Write(const void* buffer, size_t byteCount) const noexcept #endif } -bool TPipeHandle::Close() noexcept { +bool TPipeHandle::Close() noexcept { bool ok = true; if (Fd_ != INVALID_PIPEHANDLE) { #ifdef _win_ @@ -94,7 +94,7 @@ public: } } - TPipeHandle& GetHandle() noexcept { + TPipeHandle& GetHandle() noexcept { return Handle_; } @@ -134,11 +134,11 @@ void TPipe::Close() { Impl_->Close(); } -PIPEHANDLE TPipe::GetHandle() const noexcept { +PIPEHANDLE TPipe::GetHandle() const noexcept { return Impl_->GetHandle(); } -bool TPipe::IsOpen() const noexcept { +bool TPipe::IsOpen() const noexcept { return Impl_->IsOpen(); } diff --git a/util/system/pipe.h b/util/system/pipe.h index 75d03600492..92dd33362f7 100644 --- a/util/system/pipe.h +++ b/util/system/pipe.h @@ -17,42 +17,42 @@ using PIPEHANDLE = SOCKET; /// Pipe-like object: pipe on POSIX and socket on windows class TPipeHandle: public TNonCopyable { public: - inline TPipeHandle() noexcept + inline TPipeHandle() noexcept : Fd_(INVALID_PIPEHANDLE) { } - inline TPipeHandle(PIPEHANDLE fd) noexcept + inline TPipeHandle(PIPEHANDLE fd) noexcept : Fd_(fd) { } - inline ~TPipeHandle() { + inline ~TPipeHandle() { Close(); } - bool Close() noexcept; + bool Close() noexcept; - inline PIPEHANDLE Release() noexcept { + inline PIPEHANDLE Release() noexcept { PIPEHANDLE ret = Fd_; Fd_ = INVALID_PIPEHANDLE; return ret; } - inline void Swap(TPipeHandle& r) noexcept { + inline void Swap(TPipeHandle& r) noexcept { DoSwap(Fd_, r.Fd_); } - inline operator PIPEHANDLE() const noexcept { + inline operator PIPEHANDLE() const noexcept { return Fd_; } - inline bool IsOpen() const noexcept { + inline bool IsOpen() const noexcept { return Fd_ != INVALID_PIPEHANDLE; } - ssize_t Read(void* buffer, size_t byteCount) const noexcept; - ssize_t Write(const void* buffer, size_t byteCount) const noexcept; + ssize_t Read(void* buffer, size_t byteCount) const noexcept; + ssize_t Write(const void* buffer, size_t byteCount) const noexcept; // Only CloseOnExec is supported static void Pipe(TPipeHandle& reader, TPipeHandle& writer, EOpenMode mode = 0); @@ -66,12 +66,12 @@ public: TPipe(); /// Takes ownership of handle, so closes it when the last holder of descriptor dies. explicit TPipe(PIPEHANDLE fd); - ~TPipe(); + ~TPipe(); void Close(); - bool IsOpen() const noexcept; - PIPEHANDLE GetHandle() const noexcept; + bool IsOpen() const noexcept; + PIPEHANDLE GetHandle() const noexcept; size_t Read(void* buf, size_t len) const; size_t Write(const void* buf, size_t len) const; diff --git a/util/system/progname.cpp b/util/system/progname.cpp index 2c291193203..237f7e30822 100644 --- a/util/system/progname.cpp +++ b/util/system/progname.cpp @@ -13,11 +13,11 @@ namespace { { } - TString ProgName; + TString ProgName; }; } -const TString& GetProgramName() { +const TString& GetProgramName() { return Singleton<TProgramNameHolder>()->ProgName; } diff --git a/util/system/progname.h b/util/system/progname.h index e5e2a0eee29..b02cdf230d3 100644 --- a/util/system/progname.h +++ b/util/system/progname.h @@ -9,5 +9,5 @@ void SetProgramName(const char* argv0); SetProgramName(argv[0]); \ } while (0) -/// guaranted return the same immutable instance of TString -const TString& GetProgramName(); +/// guaranted return the same immutable instance of TString +const TString& GetProgramName(); diff --git a/util/system/progname_ut.cpp b/util/system/progname_ut.cpp index 11f3d9308b0..d058647facb 100644 --- a/util/system/progname_ut.cpp +++ b/util/system/progname_ut.cpp @@ -4,11 +4,11 @@ Y_UNIT_TEST_SUITE(TProgramNameTest) { Y_UNIT_TEST(TestIt) { - TString progName = GetProgramName(); + TString progName = GetProgramName(); try { UNIT_ASSERT( - progName.find("ut_util") != TString::npos || progName.find("util-system_ut") != TString::npos || progName.find("util-system-ut") != TString::npos); + progName.find("ut_util") != TString::npos || progName.find("util-system_ut") != TString::npos || progName.find("util-system-ut") != TString::npos); } catch (...) { Cerr << progName << Endl; diff --git a/util/system/protect.cpp b/util/system/protect.cpp index bbb8d410dfb..8786f00eab8 100644 --- a/util/system/protect.cpp +++ b/util/system/protect.cpp @@ -1,7 +1,7 @@ #include "protect.h" #include <util/generic/yexception.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/output.h> #include "yassert.h" @@ -15,7 +15,7 @@ #endif static TString ModeToString(const EProtectMemory mode) { - TString strMode; + TString strMode; if (mode == PM_NONE) { return "PM_NONE"; } diff --git a/util/system/rwlock.cpp b/util/system/rwlock.cpp index bb3dcbf1881..8785f006d6f 100644 --- a/util/system/rwlock.cpp +++ b/util/system/rwlock.cpp @@ -14,17 +14,17 @@ class TRWMutex::TImpl { public: TImpl(); - ~TImpl(); + ~TImpl(); - void AcquireRead() noexcept; - bool TryAcquireRead() noexcept; - void ReleaseRead() noexcept; + void AcquireRead() noexcept; + bool TryAcquireRead() noexcept; + void ReleaseRead() noexcept; - void AcquireWrite() noexcept; - bool TryAcquireWrite() noexcept; - void ReleaseWrite() noexcept; + void AcquireWrite() noexcept; + bool TryAcquireWrite() noexcept; + void ReleaseWrite() noexcept; - void Release() noexcept; + void Release() noexcept; private: TMutex Lock_; @@ -40,12 +40,12 @@ TRWMutex::TImpl::TImpl() { } -TRWMutex::TImpl::~TImpl() { +TRWMutex::TImpl::~TImpl() { Y_VERIFY(State_ == 0, "failure, State_ != 0"); Y_VERIFY(BlockedWriters_ == 0, "failure, BlockedWriters_ != 0"); } -void TRWMutex::TImpl::AcquireRead() noexcept { +void TRWMutex::TImpl::AcquireRead() noexcept { with_lock (Lock_) { while (BlockedWriters_ || State_ < 0) { ReadCond_.Wait(Lock_); @@ -57,7 +57,7 @@ void TRWMutex::TImpl::AcquireRead() noexcept { ReadCond_.Signal(); } -bool TRWMutex::TImpl::TryAcquireRead() noexcept { +bool TRWMutex::TImpl::TryAcquireRead() noexcept { with_lock (Lock_) { if (BlockedWriters_ || State_ < 0) { return false; @@ -69,7 +69,7 @@ bool TRWMutex::TImpl::TryAcquireRead() noexcept { return true; } -void TRWMutex::TImpl::ReleaseRead() noexcept { +void TRWMutex::TImpl::ReleaseRead() noexcept { Lock_.Acquire(); if (--State_ > 0) { @@ -82,7 +82,7 @@ void TRWMutex::TImpl::ReleaseRead() noexcept { } } -void TRWMutex::TImpl::AcquireWrite() noexcept { +void TRWMutex::TImpl::AcquireWrite() noexcept { with_lock (Lock_) { while (State_ != 0) { ++BlockedWriters_; @@ -94,7 +94,7 @@ void TRWMutex::TImpl::AcquireWrite() noexcept { } } -bool TRWMutex::TImpl::TryAcquireWrite() noexcept { +bool TRWMutex::TImpl::TryAcquireWrite() noexcept { with_lock (Lock_) { if (State_ != 0) { return false; @@ -106,7 +106,7 @@ bool TRWMutex::TImpl::TryAcquireWrite() noexcept { return true; } -void TRWMutex::TImpl::ReleaseWrite() noexcept { +void TRWMutex::TImpl::ReleaseWrite() noexcept { Lock_.Acquire(); State_ = 0; @@ -119,7 +119,7 @@ void TRWMutex::TImpl::ReleaseWrite() noexcept { } } -void TRWMutex::TImpl::Release() noexcept { +void TRWMutex::TImpl::Release() noexcept { Lock_.Acquire(); if (State_ > 0) { @@ -147,17 +147,17 @@ void TRWMutex::TImpl::Release() noexcept { class TRWMutex::TImpl { public: TImpl(); - ~TImpl(); + ~TImpl(); - void AcquireRead() noexcept; - bool TryAcquireRead() noexcept; - void ReleaseRead() noexcept; + void AcquireRead() noexcept; + bool TryAcquireRead() noexcept; + void ReleaseRead() noexcept; - void AcquireWrite() noexcept; - bool TryAcquireWrite() noexcept; - void ReleaseWrite() noexcept; + void AcquireWrite() noexcept; + bool TryAcquireWrite() noexcept; + void ReleaseWrite() noexcept; - void Release() noexcept; + void Release() noexcept; private: pthread_rwlock_t Lock_; @@ -170,44 +170,44 @@ TRWMutex::TImpl::TImpl() { } } -TRWMutex::TImpl::~TImpl() { +TRWMutex::TImpl::~TImpl() { const int result = pthread_rwlock_destroy(&Lock_); Y_VERIFY(result == 0, "rwlock destroy failed (%s)", LastSystemErrorText(result)); } -void TRWMutex::TImpl::AcquireRead() noexcept { +void TRWMutex::TImpl::AcquireRead() noexcept { const int result = pthread_rwlock_rdlock(&Lock_); Y_VERIFY(result == 0, "rwlock rdlock failed (%s)", LastSystemErrorText(result)); } -bool TRWMutex::TImpl::TryAcquireRead() noexcept { +bool TRWMutex::TImpl::TryAcquireRead() noexcept { const int result = pthread_rwlock_tryrdlock(&Lock_); Y_VERIFY(result == 0 || result == EBUSY, "rwlock tryrdlock failed (%s)", LastSystemErrorText(result)); return result == 0; } -void TRWMutex::TImpl::ReleaseRead() noexcept { +void TRWMutex::TImpl::ReleaseRead() noexcept { const int result = pthread_rwlock_unlock(&Lock_); Y_VERIFY(result == 0, "rwlock (read) unlock failed (%s)", LastSystemErrorText(result)); } -void TRWMutex::TImpl::AcquireWrite() noexcept { +void TRWMutex::TImpl::AcquireWrite() noexcept { const int result = pthread_rwlock_wrlock(&Lock_); Y_VERIFY(result == 0, "rwlock wrlock failed (%s)", LastSystemErrorText(result)); } -bool TRWMutex::TImpl::TryAcquireWrite() noexcept { +bool TRWMutex::TImpl::TryAcquireWrite() noexcept { const int result = pthread_rwlock_trywrlock(&Lock_); Y_VERIFY(result == 0 || result == EBUSY, "rwlock trywrlock failed (%s)", LastSystemErrorText(result)); return result == 0; } -void TRWMutex::TImpl::ReleaseWrite() noexcept { +void TRWMutex::TImpl::ReleaseWrite() noexcept { const int result = pthread_rwlock_unlock(&Lock_); Y_VERIFY(result == 0, "rwlock (write) unlock failed (%s)", LastSystemErrorText(result)); } -void TRWMutex::TImpl::Release() noexcept { +void TRWMutex::TImpl::Release() noexcept { const int result = pthread_rwlock_unlock(&Lock_); Y_VERIFY(result == 0, "rwlock unlock failed (%s)", LastSystemErrorText(result)); } @@ -221,30 +221,30 @@ TRWMutex::TRWMutex() TRWMutex::~TRWMutex() = default; -void TRWMutex::AcquireRead() noexcept { +void TRWMutex::AcquireRead() noexcept { Impl_->AcquireRead(); } -bool TRWMutex::TryAcquireRead() noexcept { +bool TRWMutex::TryAcquireRead() noexcept { return Impl_->TryAcquireRead(); } -void TRWMutex::ReleaseRead() noexcept { +void TRWMutex::ReleaseRead() noexcept { Impl_->ReleaseRead(); } -void TRWMutex::AcquireWrite() noexcept { +void TRWMutex::AcquireWrite() noexcept { Impl_->AcquireWrite(); } -bool TRWMutex::TryAcquireWrite() noexcept { +bool TRWMutex::TryAcquireWrite() noexcept { return Impl_->TryAcquireWrite(); } -void TRWMutex::ReleaseWrite() noexcept { +void TRWMutex::ReleaseWrite() noexcept { Impl_->ReleaseWrite(); } -void TRWMutex::Release() noexcept { +void TRWMutex::Release() noexcept { Impl_->Release(); } diff --git a/util/system/rwlock.h b/util/system/rwlock.h index 0bb9b3fe1c8..b476837c924 100644 --- a/util/system/rwlock.h +++ b/util/system/rwlock.h @@ -8,17 +8,17 @@ class TRWMutex { public: TRWMutex(); - ~TRWMutex(); + ~TRWMutex(); - void AcquireRead() noexcept; - bool TryAcquireRead() noexcept; - void ReleaseRead() noexcept; + void AcquireRead() noexcept; + bool TryAcquireRead() noexcept; + void ReleaseRead() noexcept; - void AcquireWrite() noexcept; - bool TryAcquireWrite() noexcept; - void ReleaseWrite() noexcept; + void AcquireWrite() noexcept; + bool TryAcquireWrite() noexcept; + void ReleaseWrite() noexcept; - void Release() noexcept; + void Release() noexcept; private: class TImpl; @@ -27,36 +27,36 @@ private: template <class T> struct TReadGuardOps { - static inline void Acquire(T* t) noexcept { + static inline void Acquire(T* t) noexcept { t->AcquireRead(); } - static inline void Release(T* t) noexcept { + static inline void Release(T* t) noexcept { t->ReleaseRead(); } }; template <class T> struct TTryReadGuardOps: public TReadGuardOps<T> { - static inline bool TryAcquire(T* t) noexcept { + static inline bool TryAcquire(T* t) noexcept { return t->TryAcquireRead(); } }; template <class T> struct TWriteGuardOps { - static inline void Acquire(T* t) noexcept { + static inline void Acquire(T* t) noexcept { t->AcquireWrite(); } - static inline void Release(T* t) noexcept { + static inline void Release(T* t) noexcept { t->ReleaseWrite(); } }; template <class T> struct TTryWriteGuardOps: public TWriteGuardOps<T> { - static inline bool TryAcquire(T* t) noexcept { + static inline bool TryAcquire(T* t) noexcept { return t->TryAcquireWrite(); } }; diff --git a/util/system/sem.cpp b/util/system/sem.cpp index 4a93b903b5c..885ad8a2553 100644 --- a/util/system/sem.cpp +++ b/util/system/sem.cpp @@ -104,7 +104,7 @@ namespace { #endif } - inline ~TSemaphoreImpl() { + inline ~TSemaphoreImpl() { #ifdef _win_ ::CloseHandle(Handle); #else @@ -119,7 +119,7 @@ namespace { #endif } - inline void Release() noexcept { + inline void Release() noexcept { #ifdef _win_ ::ReleaseSemaphore(Handle, 1, 0); #else @@ -135,7 +135,7 @@ namespace { //The UNIX semaphore object does not support a timed "wait", and //hence to maintain consistancy, for win32 case we use INFINITE or 0 timeout. - inline void Acquire() noexcept { + inline void Acquire() noexcept { #ifdef _win_ Y_VERIFY(::WaitForSingleObject(Handle, INFINITE) == WAIT_OBJECT_0, "can not acquire semaphore"); #else @@ -149,7 +149,7 @@ namespace { #endif } - inline bool TryAcquire() noexcept { + inline bool TryAcquire() noexcept { #ifdef _win_ // zero-second time-out interval // WAIT_OBJECT_0: current free count > 0 @@ -169,8 +169,8 @@ namespace { #if defined(_unix_) /* - Disable errors/warnings about deprecated sem_* in Darwin -*/ + Disable errors/warnings about deprecated sem_* in Darwin +*/ #ifdef _darwin_ Y_PRAGMA_DIAGNOSTIC_PUSH Y_PRAGMA_NO_DEPRECATED @@ -182,19 +182,19 @@ namespace { } } - inline ~TPosixSemaphore() { + inline ~TPosixSemaphore() { Y_VERIFY(sem_destroy(&S_) == 0, "semaphore destroy failed"); } - inline void Acquire() noexcept { + inline void Acquire() noexcept { Y_VERIFY(sem_wait(&S_) == 0, "semaphore acquire failed"); } - inline void Release() noexcept { + inline void Release() noexcept { Y_VERIFY(sem_post(&S_) == 0, "semaphore release failed"); } - inline bool TryAcquire() noexcept { + inline bool TryAcquire() noexcept { if (sem_trywait(&S_)) { Y_VERIFY(errno == EAGAIN, "semaphore try wait failed"); @@ -227,15 +227,15 @@ TSemaphore::TSemaphore(const char* name, ui32 maxFreeCount) TSemaphore::~TSemaphore() = default; -void TSemaphore::Release() noexcept { +void TSemaphore::Release() noexcept { Impl_->Release(); } -void TSemaphore::Acquire() noexcept { +void TSemaphore::Acquire() noexcept { Impl_->Acquire(); } -bool TSemaphore::TryAcquire() noexcept { +bool TSemaphore::TryAcquire() noexcept { return Impl_->TryAcquire(); } @@ -248,10 +248,10 @@ public: } }; #else -class TFastSemaphore::TImpl: public TString, public TSemaphoreImpl { +class TFastSemaphore::TImpl: public TString, public TSemaphoreImpl { public: inline TImpl(ui32 n) - : TString(ToString(RandomNumber<ui64>())) + : TString(ToString(RandomNumber<ui64>())) , TSemaphoreImpl(c_str(), n) { } @@ -265,14 +265,14 @@ TFastSemaphore::TFastSemaphore(ui32 maxFreeCount) TFastSemaphore::~TFastSemaphore() = default; -void TFastSemaphore::Release() noexcept { +void TFastSemaphore::Release() noexcept { Impl_->Release(); } -void TFastSemaphore::Acquire() noexcept { +void TFastSemaphore::Acquire() noexcept { Impl_->Acquire(); } -bool TFastSemaphore::TryAcquire() noexcept { +bool TFastSemaphore::TryAcquire() noexcept { return Impl_->TryAcquire(); } diff --git a/util/system/sem.h b/util/system/sem.h index 0c964ad6b60..2dbc5e3db95 100644 --- a/util/system/sem.h +++ b/util/system/sem.h @@ -8,17 +8,17 @@ class TSemaphore { public: TSemaphore(const char* name, ui32 maxFreeCount); - ~TSemaphore(); + ~TSemaphore(); //Increase the semaphore counter. - void Release() noexcept; + void Release() noexcept; //Keep a thread held while the semaphore counter is equal 0. - void Acquire() noexcept; + void Acquire() noexcept; //Try to enter the semaphore gate. A non-blocking variant of Acquire. //Returns 'true' if the semaphore counter decreased - bool TryAcquire() noexcept; + bool TryAcquire() noexcept; private: class TImpl; @@ -29,11 +29,11 @@ private: class TFastSemaphore { public: TFastSemaphore(ui32 maxFreeCount); - ~TFastSemaphore(); + ~TFastSemaphore(); - void Release() noexcept; - void Acquire() noexcept; - bool TryAcquire() noexcept; + void Release() noexcept; + void Acquire() noexcept; + bool TryAcquire() noexcept; private: class TImpl; diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp index b1989b5c8c3..e8da24f7ef5 100644 --- a/util/system/shellcommand.cpp +++ b/util/system/shellcommand.cpp @@ -115,21 +115,21 @@ using REALPIPEHANDLE = HANDLE; class TRealPipeHandle : public TNonCopyable { public: - inline TRealPipeHandle() noexcept + inline TRealPipeHandle() noexcept : Fd_(INVALID_REALPIPEHANDLE) { } - inline TRealPipeHandle(REALPIPEHANDLE fd) noexcept + inline TRealPipeHandle(REALPIPEHANDLE fd) noexcept : Fd_(fd) { } - inline ~TRealPipeHandle() { + inline ~TRealPipeHandle() { Close(); } - bool Close() noexcept { + bool Close() noexcept { bool ok = true; if (Fd_ != INVALID_REALPIPEHANDLE) ok = CloseHandle(Fd_); @@ -137,31 +137,31 @@ public: return ok; } - inline REALPIPEHANDLE Release() noexcept { + inline REALPIPEHANDLE Release() noexcept { REALPIPEHANDLE ret = Fd_; Fd_ = INVALID_REALPIPEHANDLE; return ret; } - inline void Swap(TRealPipeHandle& r) noexcept { + inline void Swap(TRealPipeHandle& r) noexcept { DoSwap(Fd_, r.Fd_); } - inline operator REALPIPEHANDLE() const noexcept { + inline operator REALPIPEHANDLE() const noexcept { return Fd_; } - inline bool IsOpen() const noexcept { + inline bool IsOpen() const noexcept { return Fd_ != INVALID_REALPIPEHANDLE; } - ssize_t Read(void* buffer, size_t byteCount) const noexcept { + ssize_t Read(void* buffer, size_t byteCount) const noexcept { DWORD doneBytes; if (!ReadFile(Fd_, buffer, byteCount, &doneBytes, nullptr)) return -1; return doneBytes; } - ssize_t Write(const void* buffer, size_t byteCount) const noexcept { + ssize_t Write(const void* buffer, size_t byteCount) const noexcept { DWORD doneBytes; if (!WriteFile(Fd_, buffer, byteCount, &doneBytes, nullptr)) return -1; @@ -191,17 +191,17 @@ class TShellCommand::TImpl : public TAtomicRefCount<TShellCommand::TImpl> { private: TPid Pid; - TString Command; - TList<TString> Arguments; - TString WorkDir; + TString Command; + TList<TString> Arguments; + TString WorkDir; TAtomic ExecutionStatus; // TShellCommand::ECommandStatus TMaybe<int> ExitCode; IInputStream* InputStream; IOutputStream* OutputStream; IOutputStream* ErrorStream; - TString CollectedOutput; - TString CollectedError; - TString InternalError; + TString CollectedOutput; + TString CollectedError; + TString InternalError; TThread* WatchThread; TMutex TerminateMutex; TFileHandle InputHandle; @@ -224,7 +224,7 @@ private: TShellCommandOptions::EHandleMode ErrorMode = TShellCommandOptions::HANDLE_STREAM; TShellCommandOptions::TUserOptions User; - THashMap<TString, TString> Environment; + THashMap<TString, TString> Environment; int Nice = 0; std::function<void()> FuncAfterFork = {}; @@ -280,7 +280,7 @@ private: #endif public: - inline TImpl(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options, const TString& workdir) + inline TImpl(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options, const TString& workdir) : Pid(0) , Command(ToString(cmd)) , Arguments(args) @@ -337,21 +337,21 @@ public: Arguments.push_back(ToString(argument)); } - inline const TString& GetOutput() const { + inline const TString& GetOutput() const { if (AtomicGet(ExecutionStatus) == SHELL_RUNNING) { ythrow yexception() << "You cannot retrieve output while process is running."; } return CollectedOutput; } - inline const TString& GetError() const { + inline const TString& GetError() const { if (AtomicGet(ExecutionStatus) == SHELL_RUNNING) { ythrow yexception() << "You cannot retrieve output while process is running."; } return CollectedError; } - inline const TString& GetInternalError() const { + inline const TString& GetInternalError() const { if (AtomicGet(ExecutionStatus) != SHELL_INTERNAL_ERROR) { ythrow yexception() << "Internal error hasn't occured so can't be retrieved."; } @@ -555,10 +555,10 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { } PROCESS_INFORMATION process_info; - // TString cmd = "cmd /U" + TUtf16String can be used to read unicode messages from cmd + // TString cmd = "cmd /U" + TUtf16String can be used to read unicode messages from cmd // /A - ansi charset /Q - echo off, /C - command, /Q - special quotes - TString qcmd = GetQuotedCommand(); - TString cmd = UseShell ? "cmd /A /Q /S /C \"" + qcmd + "\"" : qcmd; + TString qcmd = GetQuotedCommand(); + TString cmd = UseShell ? "cmd /A /Q /S /C \"" + qcmd + "\"" : qcmd; // winapi can modify command text, copy it Y_ENSURE_EX(cmd.size() < MAX_COMMAND_LINE, yexception() << "Command is too long (length=" << cmd.size() << ")"); @@ -574,7 +574,7 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { } void* lpEnvironment = nullptr; - TString env; + TString env; if (!Environment.empty()) { for (auto e = Environment.begin(); e != Environment.end(); ++e) { env += e->first + '=' + e->second + '\0'; @@ -627,21 +627,21 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { } #endif -void ShellQuoteArg(TString& dst, TStringBuf argument) { +void ShellQuoteArg(TString& dst, TStringBuf argument) { dst.append("\""); TStringBuf l, r; - while (argument.TrySplit('"', l, r)) { + while (argument.TrySplit('"', l, r)) { dst.append(l); dst.append("\\\""); - argument = r; + argument = r; } - dst.append(argument); + dst.append(argument); dst.append("\""); } -void ShellQuoteArgSp(TString& dst, TStringBuf argument) { +void ShellQuoteArgSp(TString& dst, TStringBuf argument) { dst.append(' '); - ShellQuoteArg(dst, argument); + ShellQuoteArg(dst, argument); } bool ArgNeedsQuotes(TStringBuf arg) noexcept { @@ -651,8 +651,8 @@ bool ArgNeedsQuotes(TStringBuf arg) noexcept { return arg.find_first_of(" \"\'\t&()*<>\\`^|") != TString::npos; } -TString TShellCommand::TImpl::GetQuotedCommand() const { - TString quoted = Command; /// @todo command itself should be quoted too +TString TShellCommand::TImpl::GetQuotedCommand() const { + TString quoted = Command; /// @todo command itself should be quoted too for (const auto& argument : Arguments) { // Don't add unnecessary quotes. It's especially important for the windows with a 32k command line length limit. if (QuoteArguments && ArgNeedsQuotes(argument)) { @@ -783,8 +783,8 @@ void TShellCommand::TImpl::Run() { } /* arguments holders */ - TString shellArg; - TVector<char*> qargv; + TString shellArg; + TVector<char*> qargv; /* Following "const_cast"s are safe: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html @@ -807,8 +807,8 @@ void TShellCommand::TImpl::Run() { qargv.push_back(nullptr); - TVector<TString> envHolder; - TVector<char*> envp; + TVector<TString> envHolder; + TVector<char*> envp; if (!Environment.empty()) { for (auto& env : Environment) { envHolder.emplace_back(env.first + '=' + env.second); @@ -1121,14 +1121,14 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) { TerminateIsRequired(pi); } -TShellCommand::TShellCommand(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options, - const TString& workdir) +TShellCommand::TShellCommand(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options, + const TString& workdir) : Impl(new TImpl(cmd, args, options, workdir)) { } -TShellCommand::TShellCommand(const TStringBuf cmd, const TShellCommandOptions& options, const TString& workdir) - : Impl(new TImpl(cmd, TList<TString>(), options, workdir)) +TShellCommand::TShellCommand(const TStringBuf cmd, const TShellCommandOptions& options, const TString& workdir) + : Impl(new TImpl(cmd, TList<TString>(), options, workdir)) { } @@ -1139,15 +1139,15 @@ TShellCommand& TShellCommand::operator<<(const TStringBuf argument) { return *this; } -const TString& TShellCommand::GetOutput() const { +const TString& TShellCommand::GetOutput() const { return Impl->GetOutput(); } -const TString& TShellCommand::GetError() const { +const TString& TShellCommand::GetError() const { return Impl->GetError(); } -const TString& TShellCommand::GetInternalError() const { +const TString& TShellCommand::GetInternalError() const { return Impl->GetInternalError(); } diff --git a/util/system/shellcommand.h b/util/system/shellcommand.h index 8730627fe5b..c2e7a4701cb 100644 --- a/util/system/shellcommand.h +++ b/util/system/shellcommand.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/noncopyable.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/list.h> #include <util/generic/hash.h> #include <util/generic/strbuf.h> @@ -17,9 +17,9 @@ class TShellCommandOptions { public: struct TUserOptions { - TString Name; + TString Name; #if defined(_win_) - TString Password; + TString Password; #endif #if defined(_unix_) /** @@ -38,7 +38,7 @@ public: }; public: - inline TShellCommandOptions() noexcept + inline TShellCommandOptions() noexcept : ClearSignalMask(false) , CloseAllFdsOnExec(false) , AsyncMode(false) @@ -59,7 +59,7 @@ public: { } - inline TShellCommandOptions& SetNice(int value) noexcept { + inline TShellCommandOptions& SetNice(int value) noexcept { Nice = value; return *this; @@ -318,7 +318,7 @@ public: IOutputStream* OutputStream; IOutputStream* ErrorStream; TUserOptions User; - THashMap<TString, TString> Environment; + THashMap<TString, TString> Environment; int Nice = 0; static const size_t DefaultSyncPollDelay = 1000; // ms @@ -351,10 +351,10 @@ public: * @param options execution options * @todo store entire options structure */ - TShellCommand(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options = TShellCommandOptions(), - const TString& workdir = TString()); - TShellCommand(const TStringBuf cmd, const TShellCommandOptions& options = TShellCommandOptions(), const TString& workdir = TString()); - ~TShellCommand(); + TShellCommand(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options = TShellCommandOptions(), + const TString& workdir = TString()); + TShellCommand(const TStringBuf cmd, const TShellCommandOptions& options = TShellCommandOptions(), const TString& workdir = TString()); + ~TShellCommand(); public: /** @@ -372,7 +372,7 @@ public: * * @return collected output */ - const TString& GetOutput() const; + const TString& GetOutput() const; /** * @brief return the collected error output from the command. @@ -380,7 +380,7 @@ public: * * @return collected error output */ - const TString& GetError() const; + const TString& GetError() const; /** * @brief return the internal error occured while watching @@ -389,7 +389,7 @@ public: * * @return error text */ - const TString& GetInternalError() const; + const TString& GetInternalError() const; /** * @brief get current status of command execution @@ -476,10 +476,10 @@ private: }; /// Appends to dst: quoted arg -void ShellQuoteArg(TString& dst, TStringBuf arg); +void ShellQuoteArg(TString& dst, TStringBuf arg); /// Appends to dst: space, quoted arg -void ShellQuoteArgSp(TString& dst, TStringBuf arg); +void ShellQuoteArgSp(TString& dst, TStringBuf arg); /// Returns true if arg should be quoted bool ArgNeedsQuotes(TStringBuf arg) noexcept; diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp index 9d849279d23..71dd2f2e4d8 100644 --- a/util/system/shellcommand_ut.cpp +++ b/util/system/shellcommand_ut.cpp @@ -33,11 +33,11 @@ public: Stream_.Reserve(100); } - TString Str() const { + TString Str() const { with_lock (Lock_) { return Stream_.Str(); } - return TString(); // line for compiler + return TString(); // line for compiler } protected: @@ -61,7 +61,7 @@ private: Y_UNIT_TEST_SUITE(TShellQuoteTest) { Y_UNIT_TEST(TestQuoteArg) { - TString cmd; + TString cmd; ShellQuoteArg(cmd, "/pr f/krev/prev.exe"); ShellQuoteArgSp(cmd, "-DVal=\"W Quotes\""); ShellQuoteArgSp(cmd, "-DVal=W Space"); @@ -170,8 +170,8 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { } Y_UNIT_TEST(TestQuotes) { TShellCommandOptions options; - TString input = TString("a\"a a"); - TString output; + TString input = TString("a\"a a"); + TString output; TStringOutput outputStream(output); options.SetOutputStream(&outputStream); TShellCommand cmd("echo", options); @@ -202,7 +202,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { // 'type con' and 'copy con con' want real console, not stdin, use sort Y_UNIT_TEST(TestInput) { TShellCommandOptions options; - TString input = (TString("a") * 2000).append(NL) * textSize; + TString input = (TString("a") * 2000).append(NL) * textSize; TStringInput inputStream(input); options.SetInputStream(&inputStream); TShellCommand cmd(catCommand, options); @@ -212,10 +212,10 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { } Y_UNIT_TEST(TestOutput) { TShellCommandOptions options; - TString input = (TString("a") * 2000).append(NL) * textSize; + TString input = (TString("a") * 2000).append(NL) * textSize; TStringInput inputStream(input); options.SetInputStream(&inputStream); - TString output; + TString output; TStringOutput outputStream(output); options.SetOutputStream(&outputStream); TShellCommand cmd(catCommand, options); @@ -297,7 +297,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { #if !defined(_win_) // this ut is unix-only, port to win using %TEMP% Y_UNIT_TEST(TestInterrupt) { - TString tmpfile = TString("shellcommand_ut.interrupt.") + ToString(RandomNumber<ui32>()); + TString tmpfile = TString("shellcommand_ut.interrupt.") + ToString(RandomNumber<ui32>()); TShellCommandOptions options; options.SetAsync(true); @@ -327,7 +327,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { rc = SigProcMask(SIG_SETMASK, &newmask, &oldmask); UNIT_ASSERT(rc == 0); - TString tmpfile = TString("shellcommand_ut.interrupt.") + ToString(RandomNumber<ui32>()); + TString tmpfile = TString("shellcommand_ut.interrupt.") + ToString(RandomNumber<ui32>()); TShellCommandOptions options; options.SetAsync(true); @@ -381,7 +381,7 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { } #endif Y_UNIT_TEST(TestInternalError) { - TString input = (TString("a") * 2000).append("\n"); + TString input = (TString("a") * 2000).append("\n"); TStringInput inputStream(input); TMemoryOutput outputStream(nullptr, 0); TShellCommandOptions options; diff --git a/util/system/spin_wait.cpp b/util/system/spin_wait.cpp index e27045e74f8..c2281a111d8 100644 --- a/util/system/spin_wait.cpp +++ b/util/system/spin_wait.cpp @@ -8,7 +8,7 @@ #include <util/generic/utility.h> template <class T> -static inline T RandomizeSleepTime(T t) noexcept { +static inline T RandomizeSleepTime(T t) noexcept { static TAtomic counter = 0; const T rndNum = IntHash((T)AtomicIncrement(counter)); diff --git a/util/system/spinlock.h b/util/system/spinlock.h index af2630890a5..85d8a281b81 100644 --- a/util/system/spinlock.h +++ b/util/system/spinlock.h @@ -14,7 +14,7 @@ public: return AtomicGet(Val_); } - inline bool TryAcquire() noexcept { + inline bool TryAcquire() noexcept { return AtomicTryLock(&Val_); } @@ -56,11 +56,11 @@ class TSpinLock: public TSpinLockBase { public: using TSpinLockBase::TSpinLockBase; - inline void Release() noexcept { + inline void Release() noexcept { ReleaseSpinLock(&Val_); } - inline void Acquire() noexcept { + inline void Acquire() noexcept { AcquireSpinLock(&Val_); } @@ -91,11 +91,11 @@ class TAdaptiveLock: public TSpinLockBase { public: using TSpinLockBase::TSpinLockBase; - inline void Release() noexcept { + inline void Release() noexcept { ReleaseAdaptiveLock(&Val_); } - inline void Acquire() noexcept { + inline void Acquire() noexcept { AcquireAdaptiveLock(&Val_); } @@ -112,15 +112,15 @@ public: template <> struct TCommonLockOps<TAtomic> { - static inline void Acquire(TAtomic* v) noexcept { + static inline void Acquire(TAtomic* v) noexcept { AcquireAdaptiveLock(v); } - static inline bool TryAcquire(TAtomic* v) noexcept { + static inline bool TryAcquire(TAtomic* v) noexcept { return AtomicTryLock(v); } - static inline void Release(TAtomic* v) noexcept { + static inline void Release(TAtomic* v) noexcept { ReleaseAdaptiveLock(v); } }; diff --git a/util/system/src_location.cpp b/util/system/src_location.cpp index 13ff1f24b37..2d051f7be6a 100644 --- a/util/system/src_location.cpp +++ b/util/system/src_location.cpp @@ -7,7 +7,7 @@ template <> void Out<TSourceLocation>(IOutputStream& o, const TSourceLocation& t) { #if defined(_win_) - TString file(t.File); + TString file(t.File); std::replace(file.begin(), file.vend(), '\\', '/'); o << file; #else diff --git a/util/system/src_location_ut.cpp b/util/system/src_location_ut.cpp index 5b86cb86efc..6924ce35b14 100644 --- a/util/system/src_location_ut.cpp +++ b/util/system/src_location_ut.cpp @@ -4,7 +4,7 @@ #include <library/cpp/testing/unittest/registar.h> -static inline TString GenLoc() { +static inline TString GenLoc() { return TStringBuilder() << __LOCATION__; } diff --git a/util/system/src_root_ut.cpp b/util/system/src_root_ut.cpp index e9a675eb9ab..30f3520eda6 100644 --- a/util/system/src_root_ut.cpp +++ b/util/system/src_root_ut.cpp @@ -6,7 +6,7 @@ Y_UNIT_TEST_SUITE(TestSourceRoot) { Y_UNIT_TEST(TestStrip) { // Reconstruct() converts "\" -> "/" on Windows - const TString path = TPathSplit(__SOURCE_FILE_IMPL__.As<TStringBuf>()).Reconstruct(); + const TString path = TPathSplit(__SOURCE_FILE_IMPL__.As<TStringBuf>()).Reconstruct(); UNIT_ASSERT_EQUAL(path, "util" LOCSLASH_S "system" LOCSLASH_S "src_root_ut.cpp"); } diff --git a/util/system/tempfile.cpp b/util/system/tempfile.cpp index a2e9f49eb12..0e3e4611020 100644 --- a/util/system/tempfile.cpp +++ b/util/system/tempfile.cpp @@ -6,7 +6,7 @@ TTempFileHandle::TTempFileHandle() { } -TTempFileHandle::TTempFileHandle(const TString& fname) +TTempFileHandle::TTempFileHandle(const TString& fname) : TTempFile(fname) , TFile(CreateFile()) { diff --git a/util/system/tempfile.h b/util/system/tempfile.h index de249c129da..e20f7923719 100644 --- a/util/system/tempfile.h +++ b/util/system/tempfile.h @@ -4,31 +4,31 @@ #include "file.h" #include <util/folder/path.h> -#include <util/generic/string.h> +#include <util/generic/string.h> class TTempFile { public: - inline TTempFile(const TString& fname) + inline TTempFile(const TString& fname) : Name_(fname) { } - inline ~TTempFile() { + inline ~TTempFile() { NFs::Remove(Name()); } - inline const TString& Name() const noexcept { + inline const TString& Name() const noexcept { return Name_; } private: - const TString Name_; + const TString Name_; }; class TTempFileHandle: public TTempFile, public TFile { public: TTempFileHandle(); - TTempFileHandle(const TString& fname); + TTempFileHandle(const TString& fname); static TTempFileHandle InCurrentDir(const TString& filePrefix = "yandex", const TString& extension = "tmp"); static TTempFileHandle InDir(const TFsPath& dirPath, const TString& filePrefix = "yandex", const TString& extension = "tmp"); diff --git a/util/system/tempfile_ut.cpp b/util/system/tempfile_ut.cpp index e4a0923d0bc..b5523fa788c 100644 --- a/util/system/tempfile_ut.cpp +++ b/util/system/tempfile_ut.cpp @@ -10,13 +10,13 @@ Y_UNIT_TEST_SUITE(TTempFileHandle) { Y_UNIT_TEST(Create) { - TString path; + TString path; { TTempFileHandle tmp; path = tmp.Name(); tmp.Write("hello world\n", 12); tmp.FlushData(); - UNIT_ASSERT_STRINGS_EQUAL(TUnbufferedFileInput(tmp.Name()).ReadAll(), "hello world\n"); + UNIT_ASSERT_STRINGS_EQUAL(TUnbufferedFileInput(tmp.Name()).ReadAll(), "hello world\n"); } UNIT_ASSERT(!NFs::Exists(path)); } diff --git a/util/system/thread.cpp b/util/system/thread.cpp index 6236746c2d9..e9cb9383023 100644 --- a/util/system/thread.cpp +++ b/util/system/thread.cpp @@ -51,7 +51,7 @@ namespace { } } - inline size_t StackSize(const TParams& p) noexcept { + inline size_t StackSize(const TParams& p) noexcept { if (p.StackSize) { return FastClp2(p.StackSize); } @@ -83,11 +83,11 @@ namespace { { } - inline bool Running() const noexcept { + inline bool Running() const noexcept { return Handle != 0; } - inline TId SystemThreadId() const noexcept { + inline TId SystemThreadId() const noexcept { #if _WIN32_WINNT < 0x0502 return (TId)ThreadId; #else @@ -168,7 +168,7 @@ namespace { static_assert(sizeof(H_) == sizeof(TId), "expect sizeof(H_) == sizeof(TId)"); } - inline TId SystemThreadId() const noexcept { + inline TId SystemThreadId() const noexcept { return (TId)H_; } @@ -183,7 +183,7 @@ namespace { PCHECK(pthread_detach(H_), "can not detach thread"); } - inline bool Running() const noexcept { + inline bool Running() const noexcept { return (bool)H_; } @@ -257,7 +257,7 @@ public: { } - inline TId Id() const noexcept { + inline TId Id() const noexcept { return ThreadIdHashFunction(SystemThreadId()); } @@ -285,7 +285,7 @@ TThread::TThread(TPrivateCtor, THolder<TCallableBase> callable) { } -TThread::~TThread() { +TThread::~TThread() { Join(); } @@ -312,11 +312,11 @@ void TThread::Detach() { } } -bool TThread::Running() const noexcept { +bool TThread::Running() const noexcept { return Impl_ && Impl_->Running(); } -TThread::TId TThread::Id() const noexcept { +TThread::TId TThread::Id() const noexcept { if (Running()) { return Impl_->Id(); } @@ -324,7 +324,7 @@ TThread::TId TThread::Id() const noexcept { return ImpossibleThreadId(); } -TThread::TId TThread::CurrentThreadId() noexcept { +TThread::TId TThread::CurrentThreadId() noexcept { return SystemCurrentThreadId(); } @@ -352,7 +352,7 @@ TThread::TId TThread::CurrentThreadNumericId() noexcept { #endif } -TThread::TId TThread::ImpossibleThreadId() noexcept { +TThread::TId TThread::ImpossibleThreadId() noexcept { return Max<TThread::TId>(); } diff --git a/util/system/thread.h b/util/system/thread.h index a6e8abdb5be..5702b549fa9 100644 --- a/util/system/thread.h +++ b/util/system/thread.h @@ -5,7 +5,7 @@ /// @see SystemThreadFactory() #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include "defaults.h" #include "progname.h" @@ -53,19 +53,19 @@ public: { } - inline TParams& SetName(const TString& name) noexcept { + inline TParams& SetName(const TString& name) noexcept { Name = name; return *this; } - inline TParams& SetStackSize(size_t size) noexcept { + inline TParams& SetStackSize(size_t size) noexcept { StackSize = size; return *this; } - inline TParams& SetStackPointer(void* ptr) noexcept { + inline TParams& SetStackPointer(void* ptr) noexcept { StackPointer = ptr; return *this; @@ -92,17 +92,17 @@ public: { } - ~TThread(); + ~TThread(); void Start(); void* Join(); void Detach(); - bool Running() const noexcept; - TId Id() const noexcept; + bool Running() const noexcept; + TId Id() const noexcept; - static TId ImpossibleThreadId() noexcept; - static TId CurrentThreadId() noexcept; + static TId ImpossibleThreadId() noexcept; + static TId CurrentThreadId() noexcept; /* * Returns numeric thread id, as visible in e. g. htop. diff --git a/util/system/thread.i b/util/system/thread.i index 8cba5054738..086befc2381 100644 --- a/util/system/thread.i +++ b/util/system/thread.i @@ -24,7 +24,7 @@ #include <util/digest/numeric.h> -static inline size_t SystemCurrentThreadIdImpl() noexcept { +static inline size_t SystemCurrentThreadIdImpl() noexcept { #if defined(_unix_) return (size_t)pthread_self(); #elif defined(_win_) @@ -35,7 +35,7 @@ static inline size_t SystemCurrentThreadIdImpl() noexcept { } template <class T> -static inline T ThreadIdHashFunction(T t) noexcept { +static inline T ThreadIdHashFunction(T t) noexcept { /* * we must permute threadid bits, because some strange platforms(such Linux) * have strange threadid numeric properties @@ -47,6 +47,6 @@ static inline T ThreadIdHashFunction(T t) noexcept { return IntHash(t); } -static inline size_t SystemCurrentThreadId() noexcept { +static inline size_t SystemCurrentThreadId() noexcept { return ThreadIdHashFunction(SystemCurrentThreadIdImpl()); } diff --git a/util/system/tls.cpp b/util/system/tls.cpp index c2f1a04a148..9fdafc5b54f 100644 --- a/util/system/tls.cpp +++ b/util/system/tls.cpp @@ -6,7 +6,7 @@ #include <util/generic/hash.h> #include <util/generic/intrlist.h> #include <util/generic/singleton.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #if defined(_unix_) #include <pthread.h> @@ -46,17 +46,17 @@ namespace { { } - inline ~TStoredValue() { + inline ~TStoredValue() { if (Dtor_ && Data_) { Dtor_(Data_); } } - inline void Set(void* ptr) noexcept { + inline void Set(void* ptr) noexcept { Data_ = ptr; } - inline void* Get() const noexcept { + inline void* Get() const noexcept { return Data_; } @@ -92,8 +92,8 @@ namespace { } private: - TVector<TStoredValue*> Values_; - THashMap<size_t, TStoredValue*> FarValues_; + TVector<TStoredValue*> Values_; + THashMap<size_t, TStoredValue*> FarValues_; TIntrusiveListWithAutoDelete<TStoredValue, TDelete> Storage_; }; @@ -126,7 +126,7 @@ namespace { Y_VERIFY(!pthread_key_create(&Key_, Dtor), "pthread_key_create failed"); } - inline ~TMasterTls() override { + inline ~TMasterTls() override { //explicitly call dtor for main thread Dtor(pthread_getspecific(Key_)); @@ -197,7 +197,7 @@ namespace { } } - inline void Cleanup() noexcept { + inline void Cleanup() noexcept { with_lock (Lock_) { Datas_.erase(TThread::CurrentThreadId()); } @@ -210,7 +210,7 @@ namespace { private: using TPTSRef = THolder<TPerThreadStorage>; TMutex Lock_; - THashMap<TThread::TId, TPTSRef> Datas_; + THashMap<TThread::TId, TPTSRef> Datas_; }; } @@ -255,6 +255,6 @@ void TKey::Set(void* ptr) const { Impl_->Set(ptr); } -void TKey::Cleanup() noexcept { +void TKey::Cleanup() noexcept { TImpl::Cleanup(); } diff --git a/util/system/tls.h b/util/system/tls.h index 3c4f56dbeb7..29b5e1994b6 100644 --- a/util/system/tls.h +++ b/util/system/tls.h @@ -158,12 +158,12 @@ namespace NTls { public: TKey(TDtor dtor); TKey(TKey&&) noexcept; - ~TKey(); + ~TKey(); void* Get() const; void Set(void* ptr) const; - static void Cleanup() noexcept; + static void Cleanup() noexcept; private: class TImpl; @@ -171,7 +171,7 @@ namespace NTls { }; struct TCleaner { - inline ~TCleaner() { + inline ~TCleaner() { TKey::Cleanup(); } }; @@ -292,16 +292,16 @@ namespace NTls { } template <class T> -static inline T& TlsRef(NTls::TValue<T>& v) noexcept { +static inline T& TlsRef(NTls::TValue<T>& v) noexcept { return v; } template <class T> -static inline const T& TlsRef(const NTls::TValue<T>& v) noexcept { +static inline const T& TlsRef(const NTls::TValue<T>& v) noexcept { return v; } template <class T> -static inline T& TlsRef(T& v) noexcept { +static inline T& TlsRef(T& v) noexcept { return v; } diff --git a/util/system/tls_ut.cpp b/util/system/tls_ut.cpp index e84d34b42a3..ad3db72a129 100644 --- a/util/system/tls_ut.cpp +++ b/util/system/tls_ut.cpp @@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(TTestTLS) { { } - void* ThreadProc() noexcept override { + void* ThreadProc() noexcept override { for (size_t i = 0; i < 100000; ++i) { P[i].Do(); } diff --git a/util/system/type_name.h b/util/system/type_name.h index b6619aba3fa..76997db26f8 100644 --- a/util/system/type_name.h +++ b/util/system/type_name.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/string/subst.h> #include <typeindex> diff --git a/util/system/user.cpp b/util/system/user.cpp index 83e89ea0a81..ac6772f458e 100644 --- a/util/system/user.cpp +++ b/util/system/user.cpp @@ -13,7 +13,7 @@ #include <unistd.h> #endif -TString GetUsername() { +TString GetUsername() { for (const auto& var : {"LOGNAME", "USER", "LNAME", "USERNAME"}) { TString val = GetEnv(var); if (val) { @@ -32,13 +32,13 @@ TString GetUsername() { else ythrow TSystemError(err) << " GetUserName failed"; } else { - return TString(nameBuf.Data(), (size_t)(len - 1)); + return TString(nameBuf.Data(), (size_t)(len - 1)); } #elif defined(_bionic_) const passwd* pwd = getpwuid(geteuid()); if (pwd) { - return TString(pwd->pw_name); + return TString(pwd->pw_name); } ythrow TSystemError() << TStringBuf(" getpwuid failed"); diff --git a/util/system/user.h b/util/system/user.h index be348d1cee6..6d02d7ca48f 100644 --- a/util/system/user.h +++ b/util/system/user.h @@ -2,4 +2,4 @@ #include <util/generic/fwd.h> -TString GetUsername(); +TString GetUsername(); diff --git a/util/system/ut/ya.make b/util/system/ut/ya.make index 127e7c261e4..dc64badf1b3 100644 --- a/util/system/ut/ya.make +++ b/util/system/ut/ya.make @@ -30,7 +30,7 @@ SRCS( system/backtrace_ut.cpp system/byteorder_ut.cpp system/compat_ut.cpp - system/compiler_ut.cpp + system/compiler_ut.cpp system/context_ut.cpp system/condvar_ut.cpp system/cpu_id_ut.cpp @@ -66,7 +66,7 @@ SRCS( system/spinlock_ut.cpp system/src_root_ut.cpp system/src_location_ut.cpp - system/shmat_ut.cpp + system/shmat_ut.cpp system/tempfile_ut.cpp system/thread_ut.cpp system/tls_ut.cpp diff --git a/util/system/yassert.cpp b/util/system/yassert.cpp index 0f586648b78..cb006eec701 100644 --- a/util/system/yassert.cpp +++ b/util/system/yassert.cpp @@ -8,7 +8,7 @@ #include <util/datetime/base.h> #include <util/generic/singleton.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/stream/output.h> #include <util/stream/str.h> #include <util/string/printf.h> @@ -38,13 +38,13 @@ namespace NPrivate { [[noreturn]] Y_NO_INLINE void InternalPanicImpl(int line, const char* function, const char* expr, int, int, int, const TStringBuf file, const char* errorMessage, size_t errorMessageSize) noexcept; } -void ::NPrivate::Panic(const TStaticBuf& file, int line, const char* function, const char* expr, const char* format, ...) noexcept { +void ::NPrivate::Panic(const TStaticBuf& file, int line, const char* function, const char* expr, const char* format, ...) noexcept { try { // We care of panic of first failed thread only // Otherwise stderr could contain multiple messages and stack traces shuffled auto guard = Guard(*Singleton<TPanicLockHolder>()); - TString errorMsg; + TString errorMsg; va_list args; va_start(args, format); // format has " " prefix to mute GCC warning on empty format @@ -65,7 +65,7 @@ namespace NPrivate { TStringBuf errorMsg{errorMessage, errorMessageSize}; const TString now = TInstant::Now().ToStringLocal(); - TString r; + TString r; TStringOutput o(r); if (expr) { o << "VERIFY failed (" << now << "): " << errorMsg << Endl; diff --git a/util/system/yield.cpp b/util/system/yield.cpp index b327b37b1aa..0da3c2f5735 100644 --- a/util/system/yield.cpp +++ b/util/system/yield.cpp @@ -8,7 +8,7 @@ #include <sched.h> #endif -void SchedYield() noexcept { +void SchedYield() noexcept { #if defined(_unix_) sched_yield(); #else @@ -16,7 +16,7 @@ void SchedYield() noexcept { #endif } -void ThreadYield() noexcept { +void ThreadYield() noexcept { #if defined(_freebsd_) pthread_yield(); #else diff --git a/util/system/yield.h b/util/system/yield.h index 9965fb52b50..7886ac05227 100644 --- a/util/system/yield.h +++ b/util/system/yield.h @@ -1,4 +1,4 @@ #pragma once -void SchedYield() noexcept; -void ThreadYield() noexcept; +void SchedYield() noexcept; +void ThreadYield() noexcept; diff --git a/util/tests/cython/test_generic.py b/util/tests/cython/test_generic.py index a0d61339cc7..fbfa10a4853 100644 --- a/util/tests/cython/test_generic.py +++ b/util/tests/cython/test_generic.py @@ -8,7 +8,7 @@ from util.generic.hash_set_ut import TestHashSet from util.generic.list_ut import TestList from util.generic.maybe_ut import TestMaybe from util.generic.ptr_ut import TestHolder -from util.generic.string_ut import TestStroka +from util.generic.string_ut import TestStroka from util.generic.vector_ut import TestVector from util.string.cast_ut import TestFromString, TestToString diff --git a/util/tests/cython/ya.make b/util/tests/cython/ya.make index b928c19026e..f869f2ad65a 100644 --- a/util/tests/cython/ya.make +++ b/util/tests/cython/ya.make @@ -5,8 +5,8 @@ SUBSCRIBER(g:util-subscribers) SRCDIR(util) -NO_WSHADOW() - +NO_WSHADOW() + PY_SRCS( NAMESPACE util @@ -15,7 +15,7 @@ PY_SRCS( generic/deque_ut.pyx generic/maybe_ut.pyx generic/ptr_ut.pyx - generic/string_ut.pyx + generic/string_ut.pyx generic/vector_ut.pyx generic/list_ut.pyx generic/hash_set_ut.pyx diff --git a/util/thread/factory.cpp b/util/thread/factory.cpp index 48e898f32dc..463acc8b197 100644 --- a/util/thread/factory.cpp +++ b/util/thread/factory.cpp @@ -10,7 +10,7 @@ namespace { public: class TPoolThread: public IThread { public: - ~TPoolThread() override { + ~TPoolThread() override { if (Thr_) { Thr_->Detach(); } @@ -22,7 +22,7 @@ namespace { Thr_->Start(); } - void DoJoin() noexcept override { + void DoJoin() noexcept override { if (!Thr_) { return; } diff --git a/util/thread/factory.h b/util/thread/factory.h index 561fcbac889..452169e9f7e 100644 --- a/util/thread/factory.h +++ b/util/thread/factory.h @@ -27,7 +27,7 @@ public: virtual ~IThread() = default; - inline void Join() noexcept { + inline void Join() noexcept { DoJoin(); } @@ -39,7 +39,7 @@ public: private: // it's actually DoStart virtual void DoRun(IThreadAble* func) = 0; - virtual void DoJoin() noexcept = 0; + virtual void DoJoin() noexcept = 0; }; inline IThreadFactory() noexcept = default; diff --git a/util/thread/lfqueue.h b/util/thread/lfqueue.h index ab523631e4f..170ae134fe3 100644 --- a/util/thread/lfqueue.h +++ b/util/thread/lfqueue.h @@ -364,7 +364,7 @@ class TAutoLockFreeQueue { public: using TRef = THolder<T>; - inline ~TAutoLockFreeQueue() { + inline ~TAutoLockFreeQueue() { TRef tmp; while (Dequeue(&tmp)) { diff --git a/util/thread/lfqueue_ut.cpp b/util/thread/lfqueue_ut.cpp index 83bca100cf9..f68771a8c4b 100644 --- a/util/thread/lfqueue_ut.cpp +++ b/util/thread/lfqueue_ut.cpp @@ -161,7 +161,7 @@ Y_UNIT_TEST_SUITE(TLockFreeQueueTests) { UNIT_ASSERT(!queue.Dequeue(&i)); UNIT_ASSERT_VALUES_EQUAL(i, -1); - TVector<int> v; + TVector<int> v; v.push_back(20); v.push_back(21); diff --git a/util/thread/lfstack.h b/util/thread/lfstack.h index ca3d95f3c39..cdc9f683862 100644 --- a/util/thread/lfstack.h +++ b/util/thread/lfstack.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/noncopyable.h> +#include <util/generic/noncopyable.h> #include <util/system/atomic.h> ////////////////////////////// diff --git a/util/thread/lfstack_ut.cpp b/util/thread/lfstack_ut.cpp index e20a838f95b..61edd3d632e 100644 --- a/util/thread/lfstack_ut.cpp +++ b/util/thread/lfstack_ut.cpp @@ -68,7 +68,7 @@ Y_UNIT_TEST_SUITE(TLockFreeStackTests) { StartLatch.CountDown(); StartLatch.Await(); - TVector<int> temp; + TVector<int> temp; while (AtomicGet(LeftToDequeue) > 0) { size_t dequeued = 0; for (size_t i = 0; i < 100; ++i) { @@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(TLockFreeStackTests) { } void Run() { - TVector<TSimpleSharedPtr<NThreading::TLegacyFuture<>>> futures; + TVector<TSimpleSharedPtr<NThreading::TLegacyFuture<>>> futures; for (size_t i = 0; i < EnqueueThreads; ++i) { futures.push_back(new NThreading::TLegacyFuture<>(std::bind(&TDequeueAllTester<SingleConsumer>::Enqueuer, this))); @@ -100,7 +100,7 @@ Y_UNIT_TEST_SUITE(TLockFreeStackTests) { UNIT_ASSERT_VALUES_EQUAL(0, int(AtomicGet(LeftToDequeue))); - TVector<int> left; + TVector<int> left; Stack.DequeueAll(&left); UNIT_ASSERT(left.empty()); } @@ -117,7 +117,7 @@ Y_UNIT_TEST_SUITE(TLockFreeStackTests) { Y_UNIT_TEST(TestDequeueAllEmptyStack) { TLockFreeStack<int> stack; - TVector<int> r; + TVector<int> r; stack.DequeueAll(&r); UNIT_ASSERT(r.empty()); @@ -130,7 +130,7 @@ Y_UNIT_TEST_SUITE(TLockFreeStackTests) { stack.Enqueue(19); stack.Enqueue(23); - TVector<int> r; + TVector<int> r; stack.DequeueAll(&r); @@ -143,8 +143,8 @@ Y_UNIT_TEST_SUITE(TLockFreeStackTests) { Y_UNIT_TEST(TestEnqueueAll) { TLockFreeStack<int> stack; - TVector<int> v; - TVector<int> expected; + TVector<int> v; + TVector<int> expected; stack.EnqueueAll(v); // add empty @@ -165,7 +165,7 @@ Y_UNIT_TEST_SUITE(TLockFreeStackTests) { expected.insert(expected.end(), v.begin(), v.end()); stack.EnqueueAll(v); - TVector<int> actual; + TVector<int> actual; stack.DequeueAll(&actual); UNIT_ASSERT_VALUES_EQUAL(expected.size(), actual.size()); diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp index 05fad02e9b9..cb87d95e09c 100644 --- a/util/thread/pool.cpp +++ b/util/thread/pool.cpp @@ -86,7 +86,7 @@ public: Start(thrnum, maxqueue); } - inline ~TImpl() override { + inline ~TImpl() override { try { Stop(); } catch (...) { @@ -129,17 +129,17 @@ public: return true; } - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { auto guard = Guard(QueueMutex); return Queue.Size(); } - inline size_t GetMaxQueueSize() const noexcept { + inline size_t GetMaxQueueSize() const noexcept { return MaxQueueSize; } - inline size_t GetThreadCountExpected() const noexcept { + inline size_t GetThreadCountExpected() const noexcept { return ThreadCountExpected; } @@ -151,7 +151,7 @@ public: Forked = true; } - inline bool NeedRestart() const noexcept { + inline bool NeedRestart() const noexcept { return Forked; } @@ -189,7 +189,7 @@ private: MaxQueueSize = 0; } - inline void WaitForComplete() noexcept { + inline void WaitForComplete() noexcept { with_lock (StopMutex) { while (ThreadCountReal) { with_lock (QueueMutex) { @@ -245,7 +245,7 @@ private: FinishOneThread(); } - inline void FinishOneThread() noexcept { + inline void FinishOneThread() noexcept { auto guard = Guard(StopMutex); --ThreadCountReal; @@ -263,7 +263,7 @@ private: TCondVar QueuePopCond; TCondVar StopCond; TJobQueue Queue; - TVector<TThreadRef> Tharr; + TVector<TThreadRef> Tharr; TAtomic ShouldTerminate; size_t MaxQueueSize; size_t ThreadCountExpected; @@ -379,12 +379,12 @@ public: { } - inline ~TThread() override { + inline ~TThread() override { Impl_->DecThreadCount(); } private: - void DoExecute() noexcept override { + void DoExecute() noexcept override { THolder<TThread> This(this); if (Impl_->Namer) { @@ -431,7 +431,7 @@ public: sprintf(Name_, "[mtp queue %ld]", (long)AtomicAdd(mtp_queue_counter, 1)); } - inline ~TImpl() { + inline ~TImpl() { Stop(); } @@ -439,7 +439,7 @@ public: IdleTime_ = idleTime; } - inline const char* Name() const noexcept { + inline const char* Name() const noexcept { return Name_; } @@ -471,16 +471,16 @@ public: } } - inline size_t Size() const noexcept { + inline size_t Size() const noexcept { return (size_t)ThrCount_; } private: - inline void IncThreadCount() noexcept { + inline void IncThreadCount() noexcept { AtomicAdd(ThrCount_, 1); } - inline void DecThreadCount() noexcept { + inline void DecThreadCount() noexcept { AtomicAdd(ThrCount_, -1); } @@ -496,7 +496,7 @@ private: } } - inline void Stop() noexcept { + inline void Stop() noexcept { Mutex_.Acquire(); AllDone_ = true; @@ -510,7 +510,7 @@ private: Mutex_.Release(); } - inline IObjectInQueue* WaitForJob() noexcept { + inline IObjectInQueue* WaitForJob() noexcept { Mutex_.Acquire(); ++Free_; @@ -690,11 +690,11 @@ namespace { ~TThreadImpl() override = default; - inline void WaitForStart() noexcept { + inline void WaitForStart() noexcept { StartEvent_.Wait(); } - inline void WaitForComplete() noexcept { + inline void WaitForComplete() noexcept { CompleteEvent_.Wait(); } @@ -729,7 +729,7 @@ namespace { { } - ~TPoolThread() override { + ~TPoolThread() override { if (Impl_) { Impl_->WaitForStart(); } @@ -743,7 +743,7 @@ namespace { Impl_.Swap(impl); } - void DoJoin() noexcept override { + void DoJoin() noexcept override { if (Impl_) { Impl_->WaitForComplete(); Impl_ = nullptr; diff --git a/util/thread/pool.h b/util/thread/pool.h index d1ea3a67cb6..f19c323bd0d 100644 --- a/util/thread/pool.h +++ b/util/thread/pool.h @@ -176,9 +176,9 @@ public: bool AddAndOwn(THolder<IObjectInQueue> obj) Y_WARN_UNUSED_RESULT; virtual void Start(size_t threadCount, size_t queueSizeLimit = 0) = 0; /** Wait for completion of all scheduled objects, and then exit */ - virtual void Stop() noexcept = 0; + virtual void Stop() noexcept = 0; /** Number of tasks currently in queue */ - virtual size_t Size() const noexcept = 0; + virtual size_t Size() const noexcept = 0; public: /** @@ -193,7 +193,7 @@ public: { } - inline ~TTsr() { + inline ~TTsr() { try { Q_->DestroyThreadSpecificResource(Data_); } catch (...) { @@ -201,7 +201,7 @@ public: } } - inline operator void*() noexcept { + inline operator void*() noexcept { return Data_; } @@ -247,10 +247,10 @@ public: void Start(size_t, size_t = 0) override { } - void Stop() noexcept override { + void Stop() noexcept override { } - size_t Size() const noexcept override { + size_t Size() const noexcept override { return 0; } }; @@ -275,8 +275,8 @@ public: * @param threadCount means "single thread" when = 0 */ void Start(size_t threadCount, size_t queueSizeLimit = 0) override; - void Stop() noexcept override; - size_t Size() const noexcept override; + void Stop() noexcept override; + size_t Size() const noexcept override; size_t GetThreadCountExpected() const noexcept; size_t GetThreadCountReal() const noexcept; size_t GetMaxQueueSize() const noexcept; @@ -305,8 +305,8 @@ public: bool Add(IObjectInQueue* obj) override Y_WARN_UNUSED_RESULT; /** @param thrnum, @param maxque are ignored */ void Start(size_t thrnum = 0, size_t maxque = 0) override; - void Stop() noexcept override; - size_t Size() const noexcept override; + void Stop() noexcept override; + size_t Size() const noexcept override; private: class TImpl; @@ -325,8 +325,8 @@ public: * SetMaxIdleTime interval parameter. if thrnum is not 0, use non-blocking TThreadPool */ void Start(size_t thrnum, size_t maxque = 0) override; - void Stop() noexcept override; - size_t Size() const noexcept override; + void Stop() noexcept override; + size_t Size() const noexcept override; private: THolder<IThreadPool> Slave_; @@ -337,7 +337,7 @@ private: * from IThreadPool and implement them using functions with same name from * pointer to TSlave. */ -template <class TQueueType, class TSlave> +template <class TQueueType, class TSlave> class TThreadPoolBinder: public TQueueType { public: inline TThreadPoolBinder(TSlave* slave) diff --git a/util/thread/pool_ut.cpp b/util/thread/pool_ut.cpp index 893770d0c47..71413f4abc5 100644 --- a/util/thread/pool_ut.cpp +++ b/util/thread/pool_ut.cpp @@ -82,10 +82,10 @@ public: void Start(size_t, size_t) override { } - void Stop() noexcept override { + void Stop() noexcept override { } - size_t Size() const noexcept override { + size_t Size() const noexcept override { return 0; } }; diff --git a/util/ya.make b/util/ya.make index 6ebe7e40cfe..d3051cb2703 100644 --- a/util/ya.make +++ b/util/ya.make @@ -26,7 +26,7 @@ JOIN_SRCS( datetime/constants.cpp datetime/cputimer.cpp datetime/systime.cpp - datetime/uptime.cpp + datetime/uptime.cpp ) SRCS( @@ -85,7 +85,7 @@ JOIN_SRCS( generic/scope.cpp generic/adaptor.cpp generic/algorithm.cpp - generic/array_ref.cpp + generic/array_ref.cpp generic/array_size.cpp generic/bitmap.cpp generic/bitops.cpp @@ -306,7 +306,7 @@ JOIN_SRCS( system/sanitizers.cpp system/sem.cpp system/shellcommand.cpp - system/shmat.cpp + system/shmat.cpp system/sigset.cpp system/spinlock.cpp system/spin_wait.cpp diff --git a/util/ysafeptr.h b/util/ysafeptr.h index af7dfd4bedb..3f5829b8a09 100644 --- a/util/ysafeptr.h +++ b/util/ysafeptr.h @@ -212,8 +212,8 @@ protected: \ private: #define OBJECT_NOCOPY_METHODS(classname) OBJECT_METHODS(classname) #define BASIC_REGISTER_CLASS(classname) \ - Y_PRAGMA_DIAGNOSTIC_PUSH \ - Y_PRAGMA_NO_UNUSED_FUNCTION \ + Y_PRAGMA_DIAGNOSTIC_PUSH \ + Y_PRAGMA_NO_UNUSED_FUNCTION \ template <> \ IObjectBase* CastToObjectBaseImpl<classname>(classname * p, void*) { \ return p; \ @@ -222,7 +222,7 @@ private: classname* CastToUserObjectImpl<classname>(IObjectBase * p, classname*, void*) { \ return dynamic_cast<classname*>(p); \ } \ - Y_PRAGMA_DIAGNOSTIC_POP + Y_PRAGMA_DIAGNOSTIC_POP //////////////////////////////////////////////////////////////////////////////////////////////////// template <class TUserObj> diff --git a/util/ysaveload.h b/util/ysaveload.h index 02efb4049b6..e85fbfdc85c 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -2,7 +2,7 @@ #include <util/generic/fwd.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/generic/typetraits.h> #include <util/generic/algorithm.h> @@ -347,7 +347,7 @@ public: }; template <class T, class A> -class TSerializer<TVector<T, A>>: public TVectorSerializer<TVector<T, A>> { +class TSerializer<TVector<T, A>>: public TVectorSerializer<TVector<T, A>> { }; template <class T, class A> @@ -355,7 +355,7 @@ class TSerializer<std::vector<T, A>>: public TVectorSerializer<std::vector<T, A> }; template <class T, class A> -class TSerializer<TList<T, A>>: public TVectorSerializer<TList<T, A>> { +class TSerializer<TList<T, A>>: public TVectorSerializer<TList<T, A>> { }; template <class T, class A> @@ -363,11 +363,11 @@ class TSerializer<std::list<T, A>>: public TVectorSerializer<std::list<T, A>> { }; template <> -class TSerializer<TString>: public TVectorSerializer<TString> { +class TSerializer<TString>: public TVectorSerializer<TString> { }; template <> -class TSerializer<TUtf16String>: public TVectorSerializer<TUtf16String> { +class TSerializer<TUtf16String>: public TVectorSerializer<TUtf16String> { }; template <class TChar> @@ -375,7 +375,7 @@ class TSerializer<std::basic_string<TChar>>: public TVectorSerializer<std::basic }; template <class T, class A> -class TSerializer<TDeque<T, A>>: public TVectorSerializer<TDeque<T, A>> { +class TSerializer<TDeque<T, A>>: public TVectorSerializer<TDeque<T, A>> { }; template <class T, class A> @@ -482,12 +482,12 @@ public: } }; -template <class TSetType, class TValue> -class TSetSerializerInserter<TSetType, TValue, true>: public TSetSerializerInserterBase<TSetType, TValue> { - using TBase = TSetSerializerInserterBase<TSetType, TValue>; +template <class TSetType, class TValue> +class TSetSerializerInserter<TSetType, TValue, true>: public TSetSerializerInserterBase<TSetType, TValue> { + using TBase = TSetSerializerInserterBase<TSetType, TValue>; public: - inline TSetSerializerInserter(TSetType& s, size_t cnt) + inline TSetSerializerInserter(TSetType& s, size_t cnt) : TBase(s) { Y_UNUSED(cnt); @@ -499,16 +499,16 @@ public: } private: - typename TSetType::iterator P_; + typename TSetType::iterator P_; }; template <class T1, class T2, class T3, class T4, class T5, class TValue> -class TSetSerializerInserter<THashMap<T1, T2, T3, T4, T5>, TValue, false>: public TSetSerializerInserterBase<THashMap<T1, T2, T3, T4, T5>, TValue> { - using TMapType = THashMap<T1, T2, T3, T4, T5>; - using TBase = TSetSerializerInserterBase<TMapType, TValue>; +class TSetSerializerInserter<THashMap<T1, T2, T3, T4, T5>, TValue, false>: public TSetSerializerInserterBase<THashMap<T1, T2, T3, T4, T5>, TValue> { + using TMapType = THashMap<T1, T2, T3, T4, T5>; + using TBase = TSetSerializerInserterBase<TMapType, TValue>; public: - inline TSetSerializerInserter(TMapType& m, size_t cnt) + inline TSetSerializerInserter(TMapType& m, size_t cnt) : TBase(m) { m.reserve(cnt); @@ -516,12 +516,12 @@ public: }; template <class T1, class T2, class T3, class T4, class T5, class TValue> -class TSetSerializerInserter<THashMultiMap<T1, T2, T3, T4, T5>, TValue, false>: public TSetSerializerInserterBase<THashMultiMap<T1, T2, T3, T4, T5>, TValue> { - using TMapType = THashMultiMap<T1, T2, T3, T4, T5>; - using TBase = TSetSerializerInserterBase<TMapType, TValue>; +class TSetSerializerInserter<THashMultiMap<T1, T2, T3, T4, T5>, TValue, false>: public TSetSerializerInserterBase<THashMultiMap<T1, T2, T3, T4, T5>, TValue> { + using TMapType = THashMultiMap<T1, T2, T3, T4, T5>; + using TBase = TSetSerializerInserterBase<TMapType, TValue>; public: - inline TSetSerializerInserter(TMapType& m, size_t cnt) + inline TSetSerializerInserter(TMapType& m, size_t cnt) : TBase(m) { m.reserve(cnt); @@ -529,29 +529,29 @@ public: }; template <class T1, class T2, class T3, class T4, class TValue> -class TSetSerializerInserter<THashSet<T1, T2, T3, T4>, TValue, false>: public TSetSerializerInserterBase<THashSet<T1, T2, T3, T4>, TValue> { - using TSetType = THashSet<T1, T2, T3, T4>; - using TBase = TSetSerializerInserterBase<TSetType, TValue>; +class TSetSerializerInserter<THashSet<T1, T2, T3, T4>, TValue, false>: public TSetSerializerInserterBase<THashSet<T1, T2, T3, T4>, TValue> { + using TSetType = THashSet<T1, T2, T3, T4>; + using TBase = TSetSerializerInserterBase<TSetType, TValue>; public: - inline TSetSerializerInserter(TSetType& s, size_t cnt) + inline TSetSerializerInserter(TSetType& s, size_t cnt) : TBase(s) { s.reserve(cnt); } }; -template <class TSetType, class TValue, bool sorted> +template <class TSetType, class TValue, bool sorted> class TSetSerializerBase { public: - static inline void Save(IOutputStream* rh, const TSetType& s) { + static inline void Save(IOutputStream* rh, const TSetType& s) { ::SaveSize(rh, s.size()); ::SaveRange(rh, s.begin(), s.end()); } - static inline void Load(IInputStream* rh, TSetType& s) { + static inline void Load(IInputStream* rh, TSetType& s) { const size_t cnt = ::LoadSize(rh); - TSetSerializerInserter<TSetType, TValue, sorted> ins(s, cnt); + TSetSerializerInserter<TSetType, TValue, sorted> ins(s, cnt); TValue v; for (size_t i = 0; i != cnt; ++i) { @@ -561,9 +561,9 @@ public: } template <class TStorage> - static inline void Load(IInputStream* rh, TSetType& s, TStorage& pool) { + static inline void Load(IInputStream* rh, TSetType& s, TStorage& pool) { const size_t cnt = ::LoadSize(rh); - TSetSerializerInserter<TSetType, TValue, sorted> ins(s, cnt); + TSetSerializerInserter<TSetType, TValue, sorted> ins(s, cnt); TValue v; for (size_t i = 0; i != cnt; ++i) { @@ -573,16 +573,16 @@ public: } }; -template <class TMapType, bool sorted = false> -struct TMapSerializer: public TSetSerializerBase<TMapType, std::pair<typename TMapType::key_type, typename TMapType::mapped_type>, sorted> { +template <class TMapType, bool sorted = false> +struct TMapSerializer: public TSetSerializerBase<TMapType, std::pair<typename TMapType::key_type, typename TMapType::mapped_type>, sorted> { }; -template <class TSetType, bool sorted = false> -struct TSetSerializer: public TSetSerializerBase<TSetType, typename TSetType::value_type, sorted> { +template <class TSetType, bool sorted = false> +struct TSetSerializer: public TSetSerializerBase<TSetType, typename TSetType::value_type, sorted> { }; template <class T1, class T2, class T3, class T4> -class TSerializer<TMap<T1, T2, T3, T4>>: public TMapSerializer<TMap<T1, T2, T3, T4>, true> { +class TSerializer<TMap<T1, T2, T3, T4>>: public TMapSerializer<TMap<T1, T2, T3, T4>, true> { }; template <class K, class T, class C, class A> @@ -590,7 +590,7 @@ class TSerializer<std::map<K, T, C, A>>: public TMapSerializer<std::map<K, T, C, }; template <class T1, class T2, class T3, class T4> -class TSerializer<TMultiMap<T1, T2, T3, T4>>: public TMapSerializer<TMultiMap<T1, T2, T3, T4>, true> { +class TSerializer<TMultiMap<T1, T2, T3, T4>>: public TMapSerializer<TMultiMap<T1, T2, T3, T4>, true> { }; template <class K, class T, class C, class A> @@ -598,15 +598,15 @@ class TSerializer<std::multimap<K, T, C, A>>: public TMapSerializer<std::multima }; template <class T1, class T2, class T3, class T4, class T5> -class TSerializer<THashMap<T1, T2, T3, T4, T5>>: public TMapSerializer<THashMap<T1, T2, T3, T4, T5>, false> { +class TSerializer<THashMap<T1, T2, T3, T4, T5>>: public TMapSerializer<THashMap<T1, T2, T3, T4, T5>, false> { }; template <class T1, class T2, class T3, class T4, class T5> -class TSerializer<THashMultiMap<T1, T2, T3, T4, T5>>: public TMapSerializer<THashMultiMap<T1, T2, T3, T4, T5>, false> { +class TSerializer<THashMultiMap<T1, T2, T3, T4, T5>>: public TMapSerializer<THashMultiMap<T1, T2, T3, T4, T5>, false> { }; template <class K, class C, class A> -class TSerializer<TSet<K, C, A>>: public TSetSerializer<TSet<K, C, A>, true> { +class TSerializer<TSet<K, C, A>>: public TSetSerializer<TSet<K, C, A>, true> { }; template <class K, class C, class A> @@ -614,27 +614,27 @@ class TSerializer<std::set<K, C, A>>: public TSetSerializer<std::set<K, C, A>, t }; template <class T1, class T2, class T3, class T4> -class TSerializer<THashSet<T1, T2, T3, T4>>: public TSetSerializer<THashSet<T1, T2, T3, T4>, false> { +class TSerializer<THashSet<T1, T2, T3, T4>>: public TSetSerializer<THashSet<T1, T2, T3, T4>, false> { }; template <class T1, class T2> -class TSerializer<TQueue<T1, T2>> { +class TSerializer<TQueue<T1, T2>> { public: - static inline void Save(IOutputStream* rh, const TQueue<T1, T2>& v) { + static inline void Save(IOutputStream* rh, const TQueue<T1, T2>& v) { ::Save(rh, v.Container()); } - static inline void Load(IInputStream* in, TQueue<T1, T2>& t) { + static inline void Load(IInputStream* in, TQueue<T1, T2>& t) { ::Load(in, t.Container()); } }; template <class T1, class T2, class T3> -class TSerializer<TPriorityQueue<T1, T2, T3>> { +class TSerializer<TPriorityQueue<T1, T2, T3>> { public: - static inline void Save(IOutputStream* rh, const TPriorityQueue<T1, T2, T3>& v) { + static inline void Save(IOutputStream* rh, const TPriorityQueue<T1, T2, T3>& v) { ::Save(rh, v.Container()); } - static inline void Load(IInputStream* in, TPriorityQueue<T1, T2, T3>& t) { + static inline void Load(IInputStream* in, TPriorityQueue<T1, T2, T3>& t) { ::Load(in, t.Container()); } }; diff --git a/util/ysaveload_ut.cpp b/util/ysaveload_ut.cpp index 723c68f391e..11f9e665ccf 100644 --- a/util/ysaveload_ut.cpp +++ b/util/ysaveload_ut.cpp @@ -10,7 +10,7 @@ #include <util/generic/set.h> #include <util/generic/hash.h> #include <util/generic/deque.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/buffer.h> #include <util/generic/hash_set.h> @@ -52,11 +52,11 @@ class TSaveLoadTest: public TTestBase { ::SaveLoad(s, Str); } - TString Str; + TString Str; }; struct TNewNewStyleHelper { - TString Str; + TString Str; ui32 Int; Y_SAVELOAD_DEFINE(Str, Int) @@ -64,7 +64,7 @@ class TSaveLoadTest: public TTestBase { private: inline void TestNewNewStyle() { - TString ss; + TString ss; { TNewNewStyleHelper h; @@ -89,7 +89,7 @@ private: } inline void TestNewStyle() { - TString ss; + TString ss; { TNewStyleSaveHelper sh; @@ -119,7 +119,7 @@ private: } { - TVector<ui16> vec; + TVector<ui16> vec; vec.push_back((ui16)1); vec.push_back((ui16)2); @@ -129,7 +129,7 @@ private: } { - TMap<ui16, ui32> map; + TMap<ui16, ui32> map; map[(ui16)1] = 2; map[(ui16)2] = 3; @@ -139,7 +139,7 @@ private: } { - TMultiMap<ui16, ui32> multimap; + TMultiMap<ui16, ui32> multimap; multimap.emplace((ui16)1, 2); multimap.emplace((ui16)2, 3); @@ -157,7 +157,7 @@ private: } { - TString val("123456"); + TString val("123456"); Save(&S_, val); } @@ -170,7 +170,7 @@ private: } { - TVector<const char*> vec; + TVector<const char*> vec; vec.push_back("1"); vec.push_back("123"); @@ -180,7 +180,7 @@ private: } { - TDeque<ui16> deq; + TDeque<ui16> deq; deq.push_back(1); deq.push_back(2); @@ -211,7 +211,7 @@ private: } { - THashMultiMap<TString, int> mm; + THashMultiMap<TString, int> mm; mm.insert({"one", 1}); mm.insert({"two", 2}); @@ -250,7 +250,7 @@ private: } { - TVector<ui16> vec; + TVector<ui16> vec; Load(&S_, vec); UNIT_ASSERT_EQUAL(vec.size(), 3); @@ -260,7 +260,7 @@ private: } { - TMap<ui16, ui32> map; + TMap<ui16, ui32> map; Load(&S_, map); UNIT_ASSERT_EQUAL(map.size(), 3); @@ -270,14 +270,14 @@ private: } { - TMultiMap<ui16, ui32> multimap; + TMultiMap<ui16, ui32> multimap; Load(&S_, multimap); UNIT_ASSERT_EQUAL(multimap.size(), 5); UNIT_ASSERT_EQUAL(multimap.find((ui16)1)->second, 2); UNIT_ASSERT_EQUAL(multimap.find((ui16)3)->second, 6); - THashSet<ui32> values; + THashSet<ui32> values; auto range = multimap.equal_range((ui16)2); for (auto i = range.first; i != range.second; ++i) { values.insert(i->second); @@ -296,7 +296,7 @@ private: } { - TString val; + TString val; Load(&S_, val); UNIT_ASSERT_EQUAL(val, "123456"); @@ -311,19 +311,19 @@ private: } { - TVector<const char*> vec; + TVector<const char*> vec; TMemoryPool pool(1024); Load(&S_, vec, pool); UNIT_ASSERT_EQUAL(vec.size(), 3); - UNIT_ASSERT_EQUAL(vec[0], TString("1")); - UNIT_ASSERT_EQUAL(vec[1], TString("123")); - UNIT_ASSERT_EQUAL(vec[2], TString("4567")); + UNIT_ASSERT_EQUAL(vec[0], TString("1")); + UNIT_ASSERT_EQUAL(vec[1], TString("123")); + UNIT_ASSERT_EQUAL(vec[2], TString("4567")); } { - TDeque<ui16> deq; + TDeque<ui16> deq; Load(&S_, deq); @@ -361,7 +361,7 @@ private: } { - THashMultiMap<TString, int> mm; + THashMultiMap<TString, int> mm; Load(&S_, mm); @@ -379,7 +379,7 @@ private: void TestList() { TBufferStream s; - TList<int> list = {0, 1, 10}; + TList<int> list = {0, 1, 10}; Save(&s, list); list.clear(); @@ -421,7 +421,7 @@ private: TestVariantImpl(v, 42); TestVariantImpl(v, true); TestVariantImpl(v, TString("foo")); - TestVariantImpl(v, TVector<char>{'b', 'a', 'r'}); + TestVariantImpl(v, TVector<char>{'b', 'a', 'r'}); v = TString("baz"); TBufferStream s; diff --git a/ydb/core/actorlib_impl/connect_socket_protocol.cpp b/ydb/core/actorlib_impl/connect_socket_protocol.cpp index c4c6db9f13b..1f08baa21c0 100644 --- a/ydb/core/actorlib_impl/connect_socket_protocol.cpp +++ b/ydb/core/actorlib_impl/connect_socket_protocol.cpp @@ -34,7 +34,7 @@ void TConnectSocketProtocol::ProtocolFunc( void TConnectSocketProtocol::CheckRetry( const TActorContext& ctx, - TString explain) noexcept + TString explain) noexcept { if (++Retries > 5) { CatchConnectError(ctx, std::move(explain)); diff --git a/ydb/core/actorlib_impl/connect_socket_protocol.h b/ydb/core/actorlib_impl/connect_socket_protocol.h index df6e08276a0..d9437fbd267 100644 --- a/ydb/core/actorlib_impl/connect_socket_protocol.h +++ b/ydb/core/actorlib_impl/connect_socket_protocol.h @@ -40,7 +40,7 @@ public: } virtual void CatchConnectError( - const TActorContext& ctx, TString error) noexcept = 0; + const TActorContext& ctx, TString error) noexcept = 0; virtual void CatchConnectedSocket( const TActorContext& ctx, diff --git a/ydb/core/actorlib_impl/http_request_protocol.h b/ydb/core/actorlib_impl/http_request_protocol.h index d5a5b4a0bcb..f2775ed7da1 100644 --- a/ydb/core/actorlib_impl/http_request_protocol.h +++ b/ydb/core/actorlib_impl/http_request_protocol.h @@ -25,9 +25,9 @@ public: void HTTPRequest( TOrigActor* orig, const TActorContext& ctx, - TString host, - TString url, - TString headers = TString(), + TString host, + TString url, + TString headers = TString(), ui16 port = 80) noexcept { OriginalActor = orig; @@ -88,7 +88,7 @@ public: void HTTPExpectReply( TOrigActor* orig, const TActorContext& ctx, - TVector<char> buf = TVector<char>()) noexcept + TVector<char> buf = TVector<char>()) noexcept { ReadHTTPReply<TOrigActor>(orig, ctx, Socket, buf); } @@ -96,7 +96,7 @@ public: virtual void CatchHTTPRequestError(TString error) noexcept = 0; virtual void CatchHTTPContent( - const TActorContext& ctx, TVector<char> buf) noexcept = 0; + const TActorContext& ctx, TVector<char> buf) noexcept = 0; virtual void CatchHTTPWriteComplete(const TActorContext&) noexcept {} @@ -132,7 +132,7 @@ public: void CatchResolveError( - const TActorContext& ctx, TString error) noexcept override + const TActorContext& ctx, TString error) noexcept override { if (NumberOfTriesLeft && --NumberOfTriesLeft > 0) { MemLogPrintF("%s" @@ -161,7 +161,7 @@ public: void CatchConnectError( - const TActorContext& ctx, TString error) noexcept override + const TActorContext& ctx, TString error) noexcept override { if (--NumberOfTriesLeft > 0) { ctx.Schedule(TDuration::Seconds(1), new TEvHTTPProtocolRetry); @@ -248,12 +248,12 @@ private: TOrigActor* OriginalActor; IActor::TReceiveFunc DefaultStateFunc; - TString Host; - TString Url; + TString Host; + TString Url; ui16 Port; - TString HttpRequestMessage; + TString HttpRequestMessage; - TVector<char> ReadBuffer; + TVector<char> ReadBuffer; size_t Filled; bool ReadChunks; diff --git a/ydb/core/actorlib_impl/load_network.cpp b/ydb/core/actorlib_impl/load_network.cpp index ae6f1b248a3..27158ceb6c7 100644 --- a/ydb/core/actorlib_impl/load_network.cpp +++ b/ydb/core/actorlib_impl/load_network.cpp @@ -36,7 +36,7 @@ private: ui32 SelfNodeId; ui32 TotalNodesCount; - static const TString DataToSend; + static const TString DataToSend; static constexpr ui32 PER_NODE_INFLIGHT_COUNT = 20240; @@ -81,7 +81,7 @@ private: } }; -const TString TLoadNetwork::DataToSend = TString(3*1024, '!'); +const TString TLoadNetwork::DataToSend = TString(3*1024, '!'); } diff --git a/ydb/core/actorlib_impl/mad_squirrel.h b/ydb/core/actorlib_impl/mad_squirrel.h index cce45d4aaa8..cb6e3993ab9 100644 --- a/ydb/core/actorlib_impl/mad_squirrel.h +++ b/ydb/core/actorlib_impl/mad_squirrel.h @@ -5,6 +5,6 @@ namespace NActors { IActor* CreateMadSquirrel(); // will send messages to itself in round IActor* CreateMelancholicGopher(double surveyForSeconds, const TActorId &reportTo); // will spin for survey period and then wakeup next in line -IActor* CreateGopherMother(const TVector<std::pair<ui32, double>> &lineProfile, ui32 lines, ui32 shotsInRound); // would spawn gophers according to profile (poolid, period) in lines number +IActor* CreateGopherMother(const TVector<std::pair<ui32, double>> &lineProfile, ui32 lines, ui32 shotsInRound); // would spawn gophers according to profile (poolid, period) in lines number } diff --git a/ydb/core/actorlib_impl/melancholic_gopher.cpp b/ydb/core/actorlib_impl/melancholic_gopher.cpp index 52a895aae4a..bd1b4e87abb 100644 --- a/ydb/core/actorlib_impl/melancholic_gopher.cpp +++ b/ydb/core/actorlib_impl/melancholic_gopher.cpp @@ -41,7 +41,7 @@ public: }; class TGopherMother : public TActorBootstrapped<TGopherMother> { - const TVector<std::pair<ui32, double>> LineProfile; + const TVector<std::pair<ui32, double>> LineProfile; const ui32 Lines; const ui32 ShotsInRound; TVector<TActorId> HeadGophers; @@ -71,7 +71,7 @@ public: return ACTORLIB_COMMON; } - TGopherMother(const TVector<std::pair<ui32, double>> &lineProfile, ui32 lines, ui32 shotsInRound) + TGopherMother(const TVector<std::pair<ui32, double>> &lineProfile, ui32 lines, ui32 shotsInRound) : LineProfile(lineProfile) , Lines(lines) , ShotsInRound(shotsInRound) @@ -106,7 +106,7 @@ IActor* CreateMelancholicGopher(double surveyForSeconds, const TActorId &reportT } -IActor* CreateGopherMother(const TVector<std::pair<ui32, double>> &lineProfile, ui32 lines, ui32 shotsInRound) { +IActor* CreateGopherMother(const TVector<std::pair<ui32, double>> &lineProfile, ui32 lines, ui32 shotsInRound) { return new TGopherMother(lineProfile, lines, shotsInRound); } diff --git a/ydb/core/actorlib_impl/name_service_client_protocol.h b/ydb/core/actorlib_impl/name_service_client_protocol.h index c46ffe9b030..81ce0261226 100644 --- a/ydb/core/actorlib_impl/name_service_client_protocol.h +++ b/ydb/core/actorlib_impl/name_service_client_protocol.h @@ -12,7 +12,7 @@ public: void SendResolveMessage( TOrigActor* orig, const TActorContext& ctx, - TString address, + TString address, ui16 port) noexcept { auto msg = new TEvResolveAddress; @@ -41,7 +41,7 @@ public: const TActorContext& ctx, NAddr::IRemoteAddrPtr address) noexcept = 0; virtual void CatchResolveError( - const TActorContext& ctx, TString error) noexcept = 0; + const TActorContext& ctx, TString error) noexcept = 0; virtual ~TResolveClientProtocol() = default; diff --git a/ydb/core/actorlib_impl/proto_ready_actor.h b/ydb/core/actorlib_impl/proto_ready_actor.h index f0b29ec65fd..0c67632ec44 100644 --- a/ydb/core/actorlib_impl/proto_ready_actor.h +++ b/ydb/core/actorlib_impl/proto_ready_actor.h @@ -32,7 +32,7 @@ public: } protected: - TMap<ui32, IActor::TReceiveFunc> ProtocolFunctions; + TMap<ui32, IActor::TReceiveFunc> ProtocolFunctions; }; diff --git a/ydb/core/actorlib_impl/read_http_reply_protocol.h b/ydb/core/actorlib_impl/read_http_reply_protocol.h index 6050a3edfed..8751c73bb9b 100644 --- a/ydb/core/actorlib_impl/read_http_reply_protocol.h +++ b/ydb/core/actorlib_impl/read_http_reply_protocol.h @@ -13,7 +13,7 @@ public: TOrigActor* orig, const TActorContext& ctx, TIntrusivePtr<NInterconnect::TStreamSocket> socket, - TVector<char> readyBuf = TVector<char>() + TVector<char> readyBuf = TVector<char>() ) noexcept { Socket = socket; @@ -36,7 +36,7 @@ public: virtual void CatchHTTPReply( const TActorContext& ctx, - TVector<char> buf, + TVector<char> buf, size_t httpMessageSize) noexcept = 0; size_t HTTPReplySizeLimit = DEFAULT_MAXIMUM_HTTP_REPLY_SIZE; @@ -53,7 +53,7 @@ private: TIntrusivePtr<NInterconnect::TStreamSocket> Socket; - TVector<char> Buf; + TVector<char> Buf; size_t Filled = 0; static constexpr size_t FREE_SPACE_LOW_WATER_MARK = 1024; diff --git a/ydb/core/actorlib_impl/test_protocols_ut.cpp b/ydb/core/actorlib_impl/test_protocols_ut.cpp index 2e622406a05..aee6750544a 100644 --- a/ydb/core/actorlib_impl/test_protocols_ut.cpp +++ b/ydb/core/actorlib_impl/test_protocols_ut.cpp @@ -61,7 +61,7 @@ namespace { } if (strncmp(RequestString.data(), "GET /hosts HTTP/1.", 18) == 0) { - TString list = Sprintf("[\"localhost\"]"); + TString list = Sprintf("[\"localhost\"]"); Output() << "HTTP/1.1 200 Ok\r\n"; Output() << "Connection: close\r\n"; Output() << "Content-Length: " << list.size() << "\r\n"; @@ -89,7 +89,7 @@ namespace { }; public: - inline THTTP200OkServer(TString res) + inline THTTP200OkServer(TString res) : Res_(std::move(res)) { } @@ -99,7 +99,7 @@ namespace { } private: - TString Res_; + TString Res_; }; } @@ -128,14 +128,14 @@ Y_UNIT_TEST_SUITE(TestProtocols) { } void CatchResolveError( - const TActorContext& ctx, TString error) noexcept override + const TActorContext& ctx, TString error) noexcept override { Error = std::move(error); ctx.Send(Edge, new TEvents::TEvWakeup); } NAddr::IRemoteAddrPtr Address; - TString Error; + TString Error; TActorId Edge; }; @@ -186,14 +186,14 @@ Y_UNIT_TEST_SUITE(TestProtocols) { } void CatchResolveError( - const TActorContext& ctx, TString error) noexcept override + const TActorContext& ctx, TString error) noexcept override { Error = std::move(error); ctx.Send(Edge, new TEvents::TEvWakeup); } void CatchConnectError( - const TActorContext& ctx, TString error) noexcept override + const TActorContext& ctx, TString error) noexcept override { Error = std::move(error); ctx.Send(Edge, new TEvents::TEvWakeup); @@ -210,7 +210,7 @@ Y_UNIT_TEST_SUITE(TestProtocols) { NAddr::IRemoteAddrRef Address; - TString Error; + TString Error; TActorId Edge; TIntrusivePtr<NInterconnect::TStreamSocket> Socket; ui64 Port; @@ -281,14 +281,14 @@ Y_UNIT_TEST_SUITE(TestProtocols) { } void CatchResolveError( - const TActorContext& ctx, TString error) noexcept override + const TActorContext& ctx, TString error) noexcept override { Error = std::move(error); ctx.Send(Edge, new TEvents::TEvWakeup); } void CatchConnectError( - const TActorContext& ctx, TString error) noexcept override + const TActorContext& ctx, TString error) noexcept override { Error = std::move(error); ctx.Send(Edge, new TEvents::TEvWakeup); @@ -327,7 +327,7 @@ Y_UNIT_TEST_SUITE(TestProtocols) { void CatchHTTPReply( const TActorContext& ctx, - TVector<char> buf, + TVector<char> buf, size_t httpMessageSize) noexcept override { Y_UNUSED(httpMessageSize); @@ -336,8 +336,8 @@ Y_UNIT_TEST_SUITE(TestProtocols) { } public: - TString Error; - TString Data; + TString Error; + TString Data; TActorId Edge; ui16 Port; @@ -499,7 +499,7 @@ Y_UNIT_TEST_SUITE(TestProtocols) { void CatchHTTPReply( const TActorContext& ctx, - TVector<char> buf, + TVector<char> buf, size_t httpMessageSize) noexcept override { Ctest << "HTTP message size: " << httpMessageSize << Endl; @@ -523,7 +523,7 @@ Y_UNIT_TEST_SUITE(TestProtocols) { void CatchProxyList( const TActorContext& ctx, - TVector<char> buf, + TVector<char> buf, size_t httpMessageSize, THttpInput& httpMsg) noexcept { @@ -549,7 +549,7 @@ Y_UNIT_TEST_SUITE(TestProtocols) { Buf.erase(Buf.begin(), Buf.begin() + httpMessageSize); Buf.pop_back(); if (value == 0) { - CatchHTTPContent(ctx, TVector<char>()); + CatchHTTPContent(ctx, TVector<char>()); return; } HTTPReadContent(this, ctx, value); @@ -593,12 +593,12 @@ Y_UNIT_TEST_SUITE(TestProtocols) { } void CatchHTTPContent( - const TActorContext& ctx, TVector<char> buf) noexcept override + const TActorContext& ctx, TVector<char> buf) noexcept override { Buf.insert(Buf.end(), buf.begin(), buf.end()); buf.clear(); Ctest << "Content complete" << Endl; - Ctest << TString(Buf.data(), Buf.size()) << Endl; + Ctest << TString(Buf.data(), Buf.size()) << Endl; do { TMemoryInput input(Buf.data(), Buf.size()); @@ -614,7 +614,7 @@ Y_UNIT_TEST_SUITE(TestProtocols) { Ctest << "First proxy is: " << result.front() << Endl; - TString headers = + TString headers = "Accept: application/json\r\n" "Content-Type: text/tab-separated-values\r\n" "Transfer-Encoding: chunked\r\n" @@ -672,12 +672,12 @@ Y_UNIT_TEST_SUITE(TestProtocols) { } public: - TString Error; + TString Error; TActorId Edge; ui16 Port; private: - TVector<char> Buf; + TVector<char> Buf; }; diff --git a/ydb/core/base/appdata.cpp b/ydb/core/base/appdata.cpp index f9e517fc424..9f00e66f1bf 100644 --- a/ydb/core/base/appdata.cpp +++ b/ydb/core/base/appdata.cpp @@ -5,7 +5,7 @@ namespace NKikimr { TAppData::TAppData( ui32 sysPoolId, ui32 userPoolId, ui32 ioPoolId, ui32 batchPoolId, - TMap<TString, ui32> servicePools, + TMap<TString, ui32> servicePools, const NScheme::TTypeRegistry* typeRegistry, const NMiniKQL::IFunctionRegistry* functionRegistry, const TFormatFactory* formatFactory, diff --git a/ydb/core/base/appdata.h b/ydb/core/base/appdata.h index c666f7468c0..a1031568c23 100644 --- a/ydb/core/base/appdata.h +++ b/ydb/core/base/appdata.h @@ -71,7 +71,7 @@ struct TAppData { const ui32 UserPoolId; const ui32 IOPoolId; const ui32 BatchPoolId; - TMap<TString, ui32> ServicePools; + TMap<TString, ui32> ServicePools; const NScheme::TTypeRegistry* TypeRegistry = nullptr; const NMiniKQL::IFunctionRegistry* FunctionRegistry = nullptr; @@ -173,7 +173,7 @@ struct TAppData { TAppData( ui32 sysPoolId, ui32 userPoolId, ui32 ioPoolId, ui32 batchPoolId, - TMap<TString, ui32> servicePools, + TMap<TString, ui32> servicePools, const NScheme::TTypeRegistry* typeRegistry, const NMiniKQL::IFunctionRegistry* functionRegistry, const TFormatFactory* formatFactory, diff --git a/ydb/core/base/blobstorage.h b/ydb/core/base/blobstorage.h index a2faee326e5..8c192f5c43b 100644 --- a/ydb/core/base/blobstorage.h +++ b/ydb/core/base/blobstorage.h @@ -64,7 +64,7 @@ struct TStorageStatusFlags { return (Raw & ui32(NKikimrBlobStorage::StatusIsValid)) && (Raw & ui32(statusToCheck)); } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); @@ -117,7 +117,7 @@ struct TGroupID { return old; } - TString ToString() const; + TString ToString() const; private: union { struct { @@ -165,7 +165,7 @@ struct TPDiskID { ui32 GetRaw() const { return Raw.X; } bool operator==(const TPDiskID &x) const { return GetRaw() == x.GetRaw(); } - TString ToString() const; + TString ToString() const; private: union { struct { @@ -212,7 +212,7 @@ struct TTabletChannelInfo { } }; - TString ToString() const { + TString ToString() const { TStringStream str; str << "{FromGeneration# " << FromGeneration; str << " GroupID# " << GroupID; @@ -292,7 +292,7 @@ struct TTabletChannelInfo { return nullptr; } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Channel# " << Channel; str << " Type# " << Type.ToString(); @@ -343,7 +343,7 @@ public: return Max<ui32>(); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Version# " << Version; str << " TabletID# " << TabletID; @@ -385,7 +385,7 @@ public: // ui64 TabletID; - TVector<TTabletChannelInfo> Channels; + TVector<TTabletChannelInfo> Channels; TTabletTypes::EType TabletType; ui32 Version; TPathId TenantPathId; @@ -879,14 +879,14 @@ struct TEvBlobStorage { }; const TLogoBlobID Id; - const TString Buffer; + const TString Buffer; const TInstant Deadline; const NKikimrBlobStorage::EPutHandleClass HandleClass; const ETactic Tactic; mutable NLWTrace::TOrbit Orbit; ui32 RestartCounter = 0; - TEvPut(const TLogoBlobID &id, const TString &buffer, TInstant deadline, + TEvPut(const TLogoBlobID &id, const TString &buffer, TInstant deadline, NKikimrBlobStorage::EPutHandleClass handleClass = NKikimrBlobStorage::TabletLog, ETactic tactic = TacticDefault) : Id(id) @@ -909,7 +909,7 @@ struct TEvBlobStorage { REQUEST_VALGRIND_CHECK_MEM_IS_DEFINED(&tactic, sizeof(tactic)); } - TString Print(bool isFull) const { + TString Print(bool isFull) const { TStringStream str; str << "TEvPut {Id# " << Id.ToString(); str << " Size# " << Buffer.size(); @@ -923,7 +923,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } @@ -953,7 +953,7 @@ struct TEvBlobStorage { , ApproximateFreeSpaceShare(approximateFreeSpaceShare) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvPutResult {Id# " << Id.ToString(); @@ -967,7 +967,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } }; @@ -994,7 +994,7 @@ struct TEvBlobStorage { (ui32)id.BlobSize(), (ui32)sh); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "TQuery {Id# " << Id.ToString(); str << " Shift# " << Shift; @@ -1066,7 +1066,7 @@ struct TEvBlobStorage { id.ToString().c_str(), (ui32)id.BlobSize(), (ui32)shift); } - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvGet {MustRestoreFirst# " << (MustRestoreFirst ? "true" : "false"); @@ -1091,7 +1091,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } @@ -1126,7 +1126,7 @@ struct TEvBlobStorage { TLogoBlobID Id; ui32 Shift; ui32 RequestedSize; - TString Buffer; + TString Buffer; TVector<TPartMapItem> PartMap; TResponse() @@ -1157,7 +1157,7 @@ struct TEvBlobStorage { , GroupId(groupId) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { TStringStream str; str << "TEvGetResult {Status# " << NKikimrProto::EReplyStatus_Name(Status).data(); str << " ResponseSz# " << ResponseSz; @@ -1187,7 +1187,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } @@ -1221,7 +1221,7 @@ struct TEvBlobStorage { , IssuerGuid(issuerGuid) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvBlock {TabletId# " << TabletId @@ -1232,7 +1232,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } @@ -1252,7 +1252,7 @@ struct TEvBlobStorage { : Status(status) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvBlockResult {Status# " << NKikimrProto::EReplyStatus_Name(Status).data(); @@ -1263,7 +1263,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } }; @@ -1575,7 +1575,7 @@ struct TEvBlobStorage { , ForceBlockedGeneration(forceBlockedGeneration) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvDiscover {TabletId# " << TabletId; @@ -1587,7 +1587,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } @@ -1604,7 +1604,7 @@ struct TEvBlobStorage { TLogoBlobID Id; ui32 MinGeneration; - TString Buffer; + TString Buffer; ui32 BlockedGeneration; TString ErrorReason; @@ -1616,7 +1616,7 @@ struct TEvBlobStorage { Y_VERIFY_DEBUG(status != NKikimrProto::OK); } - TEvDiscoverResult(const TLogoBlobID &id, ui32 minGeneration, const TString &buffer) + TEvDiscoverResult(const TLogoBlobID &id, ui32 minGeneration, const TString &buffer) : Status(NKikimrProto::OK) , Id(id) , MinGeneration(minGeneration) @@ -1624,7 +1624,7 @@ struct TEvBlobStorage { , BlockedGeneration(0) {} - TEvDiscoverResult(const TLogoBlobID &id, ui32 minGeneration, const TString &buffer, ui32 blockedGeneration) + TEvDiscoverResult(const TLogoBlobID &id, ui32 minGeneration, const TString &buffer, ui32 blockedGeneration) : Status(NKikimrProto::OK) , Id(id) , MinGeneration(minGeneration) @@ -1632,7 +1632,7 @@ struct TEvBlobStorage { , BlockedGeneration(blockedGeneration) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { TStringStream str; str << "TEvDiscoverResult {Status# " << NKikimrProto::EReplyStatus_Name(Status).data(); str << " BlockedGeneration# " << BlockedGeneration; @@ -1649,7 +1649,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } }; @@ -1675,7 +1675,7 @@ struct TEvBlobStorage { , ForceBlockedGeneration(forceBlockedGeneration) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvRange {TabletId# " << TabletId; @@ -1689,7 +1689,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } @@ -1704,12 +1704,12 @@ struct TEvBlobStorage { struct TEvRangeResult : public TEventLocal<TEvRangeResult, EvRangeResult> { struct TResponse { TLogoBlobID Id; - TString Buffer; + TString Buffer; TResponse() {} - TResponse(const TLogoBlobID &id, const TString &x) + TResponse(const TLogoBlobID &id, const TString &x) : Id(id) , Buffer(x) {} @@ -1719,7 +1719,7 @@ struct TEvBlobStorage { TLogoBlobID From; TLogoBlobID To; - TVector<TResponse> Responses; + TVector<TResponse> Responses; const ui32 GroupId; TString ErrorReason; @@ -1730,7 +1730,7 @@ struct TEvBlobStorage { , GroupId(groupId) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { TStringStream str; str << "TEvRangeResult {Status# " << NKikimrProto::EReplyStatus_Name(Status).data(); str << " From# " << From.ToString(); @@ -1752,7 +1752,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } }; @@ -1763,8 +1763,8 @@ struct TEvBlobStorage { ui32 PerGenerationCounter; // monotone increasing cmd counter for RecordGeneration ui32 Channel; - THolder<TVector<TLogoBlobID> > Keep; - THolder<TVector<TLogoBlobID> > DoNotKeep; + THolder<TVector<TLogoBlobID> > Keep; + THolder<TVector<TLogoBlobID> > DoNotKeep; TInstant Deadline; ui32 CollectGeneration; @@ -1783,7 +1783,7 @@ struct TEvBlobStorage { TEvCollectGarbage(ui64 tabletId, ui32 recordGeneration, ui32 perGenerationCounter, ui32 channel, bool collect, ui32 collectGeneration, - ui32 collectStep, TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep, TInstant deadline, + ui32 collectStep, TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep, TInstant deadline, bool isMultiCollectAllowed, bool hard = false) : TabletId(tabletId) , RecordGeneration(recordGeneration) @@ -1800,7 +1800,7 @@ struct TEvBlobStorage { {} TEvCollectGarbage(ui64 tabletId, ui32 recordGeneration, ui32 channel, bool collect, ui32 collectGeneration, - ui32 collectStep, TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep, TInstant deadline) + ui32 collectStep, TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep, TInstant deadline) : TabletId(tabletId) , RecordGeneration(recordGeneration) , PerGenerationCounter(0) @@ -1822,7 +1822,7 @@ struct TEvBlobStorage { deadline, false /*isMultiCollectAllowed*/, true /*hard*/); } - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvCollectGarbage {TabletId# " << TabletId; @@ -1856,11 +1856,11 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } - static ui64 PerGenerationCounterStepSize(TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep) { + static ui64 PerGenerationCounterStepSize(TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep) { ui64 keepCount = keep ? keep->size() : 0; ui64 doNotKeepCount = doNotKeep ? doNotKeep->size() : 0; ui64 totalFlags = keepCount + doNotKeepCount; @@ -1899,7 +1899,7 @@ struct TEvBlobStorage { , Channel(channel) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvCollectGarbageResult {TabletId# " << TabletId; @@ -1914,7 +1914,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } }; @@ -1927,7 +1927,7 @@ struct TEvBlobStorage { : Deadline(deadline) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvStatus {Deadline# " << Deadline.MilliSeconds() @@ -1935,7 +1935,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } @@ -1957,7 +1957,7 @@ struct TEvBlobStorage { , StatusFlags(statusFlags) {} - TString Print(bool isFull) const { + TString Print(bool isFull) const { Y_UNUSED(isFull); TStringStream str; str << "TEvStatusResult {Status# " << NKikimrProto::EReplyStatus_Name(Status).data(); @@ -1970,7 +1970,7 @@ struct TEvBlobStorage { return str.Str(); } - TString ToString() const { + TString ToString() const { return Print(false); } }; diff --git a/ydb/core/base/blobstorage_grouptype.cpp b/ydb/core/base/blobstorage_grouptype.cpp index 66c79ba42cb..be8fa4f950e 100644 --- a/ydb/core/base/blobstorage_grouptype.cpp +++ b/ydb/core/base/blobstorage_grouptype.cpp @@ -12,7 +12,7 @@ # define VERBOSE_COUT(a) \ Cerr << a -static TString DebugFormatBits(ui64 value) { +static TString DebugFormatBits(ui64 value) { TStringStream s; for (size_t i = 7; i >=4; --i) { s << ((value >> i) & 1); diff --git a/ydb/core/base/blobstorage_grouptype.h b/ydb/core/base/blobstorage_grouptype.h index cd38dfcfa86..5be17dff0c8 100644 --- a/ydb/core/base/blobstorage_grouptype.h +++ b/ydb/core/base/blobstorage_grouptype.h @@ -3,7 +3,7 @@ #include <ydb/core/erasure/erasure.h> #include <ydb/core/base/logoblob.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/generic/list.h> @@ -32,7 +32,7 @@ struct TBlobStorageGroupType : public TErasureType { , SlowVDiskMask(0) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TPartLayout "; str << " Sessions {"; @@ -82,7 +82,7 @@ struct TBlobStorageGroupType : public TErasureType { , PartIdx(partIdx) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TVDiskPart VDiskIdx# " << (ui32)VDiskIdx; str << " PartIdx# " << (ui32)PartIdx; @@ -93,7 +93,7 @@ struct TBlobStorageGroupType : public TErasureType { TStackVec<TVDiskPart, 8> Records; - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TPartPlacement Size# " << Records.size(); str << "{"; @@ -107,13 +107,13 @@ struct TBlobStorageGroupType : public TErasureType { struct TResult { const ui32 PartCount = 0; - const TString Error; + const TString Error; TResult(ui32 partCount) : PartCount(partCount) {} - TResult(const TString &error) + TResult(const TString &error) : Error(error) {} @@ -121,7 +121,7 @@ struct TBlobStorageGroupType : public TErasureType { return Error.empty(); } - TString ToString() const { + TString ToString() const { TStringStream str; if (Good()) { str << PartCount; diff --git a/ydb/core/base/channel_profiles.h b/ydb/core/base/channel_profiles.h index e10d6a3f91e..a14ac5db3e5 100644 --- a/ydb/core/base/channel_profiles.h +++ b/ydb/core/base/channel_profiles.h @@ -36,7 +36,7 @@ struct TChannelProfiles : public TThrRefBase { } }; - TVector<TChannel> Channels; + TVector<TChannel> Channels; template<typename T> TProfile(const T &channels) @@ -47,7 +47,7 @@ struct TChannelProfiles : public TThrRefBase { {} }; - TVector<TProfile> Profiles; + TVector<TProfile> Profiles; template<typename T> TChannelProfiles(const T &profiles) diff --git a/ydb/core/base/defs.h b/ydb/core/base/defs.h index bb4eb556895..f6f0b5fd463 100644 --- a/ydb/core/base/defs.h +++ b/ydb/core/base/defs.h @@ -6,8 +6,8 @@ #include <library/cpp/actors/core/actorid.h> #include <ydb/core/protos/services.pb.h> #include <ydb/core/debug/valgrind_check.h> -#include <util/generic/array_ref.h> -#include <util/generic/string.h> +#include <util/generic/array_ref.h> +#include <util/generic/string.h> namespace NKikimr { // actorlib is organic part of kikimr so we emulate global import by this directive diff --git a/ydb/core/base/domain.h b/ydb/core/base/domain.h index 05346e474aa..81e4fc72a61 100644 --- a/ydb/core/base/domain.h +++ b/ydb/core/base/domain.h @@ -68,7 +68,7 @@ struct TDomainsInfo : public TThrRefBase { return "UserTableDefault"; } - typedef THashMap<TString, TIntrusiveConstPtr<NLocalDb::TCompactionPolicy>> TNamedCompactionPolicies; + typedef THashMap<TString, TIntrusiveConstPtr<NLocalDb::TCompactionPolicy>> TNamedCompactionPolicies; struct TDomain : public TThrRefBase { using TPtr = TIntrusivePtr<TDomain>; @@ -81,13 +81,13 @@ struct TDomainsInfo : public TThrRefBase { const ui32 DefaultStateStorageGroup; const ui32 DefaultSchemeBoardGroup; const ui64 SchemeRoot; - const TString Name; - const TVector<ui64> Coordinators; - const TVector<ui64> Mediators; - const TVector<ui64> TxAllocators; - const TVector<ui32> StateStorageGroups; + const TString Name; + const TVector<ui64> Coordinators; + const TVector<ui64> Mediators; + const TVector<ui64> TxAllocators; + const TVector<ui32> StateStorageGroups; const ui32 DefaultHiveUid; - const TVector<ui32> HiveUids; + const TVector<ui32> HiveUids; const ui64 DomainPlanResolution; const TStoragePoolKinds StoragePoolTypes; @@ -181,16 +181,16 @@ struct TDomainsInfo : public TThrRefBase { return DomainUid + FirstUserTag; } - static TVector<ui64> TransformUids(TVector<ui64> &&uids, std::function<ui64 (ui32)> func) { - TVector<ui64> result(std::move(uids)); + static TVector<ui64> TransformUids(TVector<ui64> &&uids, std::function<ui64 (ui32)> func) { + TVector<ui64> result(std::move(uids)); for (ui32 i = 0; i < result.size(); ++i) { result[i] = func(result[i]); } return result; } - static TVector<ui64> TransformIntoVectorUids(ui32 count) { - TVector<ui64> result; + static TVector<ui64> TransformIntoVectorUids(ui32 count) { + TVector<ui64> result; result.reserve(count); for (ui32 i = 1; i <= count; ++i) { result.push_back(i); @@ -198,27 +198,27 @@ struct TDomainsInfo : public TThrRefBase { return result; } - static TVector<ui64> MakeCoordinatorsIds(TVector<ui64> &&uids, ui32 domainUid) { + static TVector<ui64> MakeCoordinatorsIds(TVector<ui64> &&uids, ui32 domainUid) { return TransformUids(std::move(uids), [&domainUid](ui32 uid) { return MakeTxCoordinatorID(domainUid, uid); }); } - static TVector<ui64> MakeCoordinatorsIds(ui32 count, ui32 domainUid) { + static TVector<ui64> MakeCoordinatorsIds(ui32 count, ui32 domainUid) { return MakeCoordinatorsIds(TransformIntoVectorUids(count), domainUid); } - static TVector<ui64> MakeMediatrosIds(TVector<ui64> &&uids, ui32 domainUid) { + static TVector<ui64> MakeMediatrosIds(TVector<ui64> &&uids, ui32 domainUid) { return TransformUids(std::move(uids), [&domainUid](ui32 uid) { return MakeTxMediatorID(domainUid, uid); }); } - static TVector<ui64> MakeMediatrosIds(ui32 count, ui32 domainUid) { + static TVector<ui64> MakeMediatrosIds(ui32 count, ui32 domainUid) { return MakeMediatrosIds(TransformIntoVectorUids(count), domainUid); } - static TVector<ui64> MakeAllocatorsIds(TVector<ui64> &&uids, ui32 domainUid) { + static TVector<ui64> MakeAllocatorsIds(TVector<ui64> &&uids, ui32 domainUid) { return TransformUids(std::move(uids), [&domainUid](ui32 uid) { return MakeTxAllocatorID(domainUid, uid); }); } - static TVector<ui64> MakeAllocatorsIds(ui32 count, ui32 domainUid) { + static TVector<ui64> MakeAllocatorsIds(ui32 count, ui32 domainUid) { return MakeAllocatorsIds(TransformIntoVectorUids(count), domainUid); } @@ -231,11 +231,11 @@ struct TDomainsInfo : public TThrRefBase { } }; - TMap<ui32, TIntrusivePtr<TDomain>> Domains; - THashMap<TString, TIntrusivePtr<TDomain>> DomainByName; - TMap<ui32, TIntrusivePtr<TDomain>> DomainByStateStorageGroup; - TMap<ui32, TIntrusivePtr<TDomain>> DomainByHiveUid; - TMap<ui32, ui64> HivesByHiveUid; + TMap<ui32, TIntrusivePtr<TDomain>> Domains; + THashMap<TString, TIntrusivePtr<TDomain>> DomainByName; + TMap<ui32, TIntrusivePtr<TDomain>> DomainByStateStorageGroup; + TMap<ui32, TIntrusivePtr<TDomain>> DomainByHiveUid; + TMap<ui32, ui64> HivesByHiveUid; TNamedCompactionPolicies NamedCompactionPolicies; TDomainsInfo() { @@ -252,7 +252,7 @@ struct TDomainsInfo : public TThrRefBase { return *NamedCompactionPolicies.FindPtr(UserTableDefaultPoicyName()); } - void AddCompactionPolicy(TString name, TIntrusiveConstPtr<NLocalDb::TCompactionPolicy> policy) { + void AddCompactionPolicy(TString name, TIntrusiveConstPtr<NLocalDb::TCompactionPolicy> policy) { NamedCompactionPolicies[name] = policy; } diff --git a/ydb/core/base/hive.h b/ydb/core/base/hive.h index 7464c76699d..a33cc5eccc4 100644 --- a/ydb/core/base/hive.h +++ b/ydb/core/base/hive.h @@ -89,7 +89,7 @@ namespace NKikimr { Record.SetTabletID(tabletId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvBootTablet TabletID: " << Record.GetTabletID(); str << "}"; @@ -108,7 +108,7 @@ namespace NKikimr { Record.SetStatusMsg(msg); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvBootTabletReply Status: " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); str << " Msg: " << Record.GetStatusMsg(); @@ -157,7 +157,7 @@ namespace NKikimr { } } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvCreateTablet Owner: " << Record.GetOwner(); str << " OwnerIdx: " << Record.GetOwnerIdx(); @@ -222,7 +222,7 @@ namespace NKikimr { } } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvCreateTabletReply Status: " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); str << " Owner: " << Record.GetOwner(); @@ -250,7 +250,7 @@ namespace NKikimr { } } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvTabletCreationResult Status: " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); if (Record.HasTabletID()) { @@ -274,7 +274,7 @@ namespace NKikimr { ActorIdToProto(actorToNotify, Record.MutableActorToNotify()); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvStopTablet TabletID: " << Record.GetTabletID(); if (Record.HasActorToNotify()) { @@ -293,7 +293,7 @@ namespace NKikimr { Record.SetTabletID(tabletId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvStopTabletResult Status: " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()); str << " TabletID: " << Record.GetTabletID(); @@ -376,7 +376,7 @@ namespace NKikimr { Record.SetTabletID(tabletId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvReconfigureTablet TabletID: " << Record.GetTabletID(); str << "}"; @@ -394,7 +394,7 @@ namespace NKikimr { Record.SetTabletID(tabletId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvReconfigureTabletReply Status: " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); str << " TabletID: " << Record.GetTabletID(); @@ -468,7 +468,7 @@ namespace NKikimr { Record.SetTabletID(tabletId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvLookupChannelInfo TabletID: " << Record.GetTabletID(); str << "}"; @@ -484,7 +484,7 @@ namespace NKikimr { Record.SetTabletID(tabletId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvChannelInfo Status: " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); str << " TabletID: " << Record.GetTabletID(); diff --git a/ydb/core/base/localdb.cpp b/ydb/core/base/localdb.cpp index d07ee26fc1f..f308f6d11de 100644 --- a/ydb/core/base/localdb.cpp +++ b/ydb/core/base/localdb.cpp @@ -218,7 +218,7 @@ TCompactionPolicyPtr CreateDefaultUserTablePolicy() { return userPolicy; } -bool ValidateCompactionPolicyChange(const TCompactionPolicy& oldPolicy, const TCompactionPolicy& newPolicy, TString& err) { +bool ValidateCompactionPolicyChange(const TCompactionPolicy& oldPolicy, const TCompactionPolicy& newPolicy, TString& err) { if (newPolicy.Generations.size() < oldPolicy.Generations.size()) { err = Sprintf("Decreasing number of levels in compaction policy in not supported, old level count %u, new level count %u", (ui32)oldPolicy.Generations.size(), (ui32)newPolicy.Generations.size()); diff --git a/ydb/core/base/localdb.h b/ydb/core/base/localdb.h index 8679cb286fc..52b28c60823 100644 --- a/ydb/core/base/localdb.h +++ b/ydb/core/base/localdb.h @@ -93,7 +93,7 @@ struct TCompactionPolicy : public TThrRefBase { NKikimrSchemeOp::TCompactionPolicy::TShardPolicy ShardPolicy; bool KeepEraseMarkers; - TVector<TGenerationPolicy> Generations; + TVector<TGenerationPolicy> Generations; TCompactionPolicy(); explicit TCompactionPolicy(const NKikimrSchemeOp::TCompactionPolicy& policyPb); @@ -131,7 +131,7 @@ typedef TIntrusivePtr<TCompactionPolicy> TCompactionPolicyPtr; TCompactionPolicyPtr CreateDefaultTablePolicy(); TCompactionPolicyPtr CreateDefaultUserTablePolicy(); -bool ValidateCompactionPolicyChange(const TCompactionPolicy& oldPolicy, const TCompactionPolicy& newPolicy, TString& err); +bool ValidateCompactionPolicyChange(const TCompactionPolicy& oldPolicy, const TCompactionPolicy& newPolicy, TString& err); // Get Resource Broker task type name by Compaction Broker queue ID. TString LegacyQueueIdToTaskName(ui32 id); diff --git a/ydb/core/base/logoblob.cpp b/ydb/core/base/logoblob.cpp index 4bea376f60a..ce20ccd916e 100644 --- a/ydb/core/base/logoblob.cpp +++ b/ydb/core/base/logoblob.cpp @@ -4,7 +4,7 @@ namespace NKikimr { -TString TLogoBlobID::ToString() const { +TString TLogoBlobID::ToString() const { return Sprintf( "[%" PRIu64 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 "]", TabletID(), @@ -32,7 +32,7 @@ void TLogoBlobID::Out(IOutputStream &o) const { o << buf; } -void TLogoBlobID::Out(IOutputStream &o, const TVector<TLogoBlobID> &vec) { +void TLogoBlobID::Out(IOutputStream &o, const TVector<TLogoBlobID> &vec) { o << "[ "; for (const auto &x : vec) o << x << ' '; @@ -55,7 +55,7 @@ static const char *SkipSpaces(const char *str) { str = endptr + 1; -bool TLogoBlobID::Parse(TLogoBlobID &out, const TString &buf, TString &errorExplanation) { +bool TLogoBlobID::Parse(TLogoBlobID &out, const TString &buf, TString &errorExplanation) { const char *str = buf.data(); char *endptr = nullptr; @@ -105,7 +105,7 @@ void LogoBlobIDFromLogoBlobID(const TLogoBlobID &id, NKikimrProto::TLogoBlobID * } void LogoBlobIDVectorFromLogoBlobIDRepeated( - TVector<TLogoBlobID> *to, + TVector<TLogoBlobID> *to, const ::google::protobuf::RepeatedPtrField<NKikimrProto::TLogoBlobID> &proto) { to->reserve(proto.size()); to->clear(); diff --git a/ydb/core/base/logoblob.h b/ydb/core/base/logoblob.h index 36eea54393a..99676658e45 100644 --- a/ydb/core/base/logoblob.h +++ b/ydb/core/base/logoblob.h @@ -100,10 +100,10 @@ namespace NKikimr { const ui64* GetRaw() const { return Raw.X; } - TString ToString() const; + TString ToString() const; void Out(IOutputStream &o) const; - static bool Parse(TLogoBlobID &out, const TString &buf, TString &errorExplanation); - static void Out(IOutputStream &o, const TVector<TLogoBlobID> &vec); + static bool Parse(TLogoBlobID &out, const TString &buf, TString &errorExplanation); + static void Out(IOutputStream &o, const TVector<TLogoBlobID> &vec); // Returns -1 if *this < x, 0 if *this == x, 1 if *this > x int Compare(const TLogoBlobID &x) const { @@ -232,12 +232,12 @@ namespace NKikimr { struct TLogoBlob { TLogoBlobID Id; - TString Buffer; + TString Buffer; TLogoBlob() {} - TLogoBlob(const TLogoBlobID &id, const TString &buffer) + TLogoBlob(const TLogoBlobID &id, const TString &buffer) : Id(id) , Buffer(buffer) {} @@ -247,9 +247,9 @@ namespace NKikimr { TLogoBlobID Id; ui32 Status; ui32 Shift; - TString Buffer; + TString Buffer; - explicit TLogoBlobRef(const TLogoBlobID &id, ui32 status, ui32 shift, const TString &buffer) + explicit TLogoBlobRef(const TLogoBlobID &id, ui32 status, ui32 shift, const TString &buffer) : Id(id) , Status(status) , Shift(shift) @@ -272,7 +272,7 @@ namespace NKikimr { TLogoBlobID LogoBlobIDFromLogoBlobID(const NKikimrProto::TLogoBlobID &proto); void LogoBlobIDFromLogoBlobID(const TLogoBlobID &id, NKikimrProto::TLogoBlobID *proto); void LogoBlobIDVectorFromLogoBlobIDRepeated( - TVector<TLogoBlobID> *to, + TVector<TLogoBlobID> *to, const ::google::protobuf::RepeatedPtrField<NKikimrProto::TLogoBlobID> &proto); template<typename TIterator> @@ -310,7 +310,7 @@ inline void Out<NKikimr::TLogoBlobID>(IOutputStream& o, const NKikimr::TLogoBlob } template<> -inline void Out<TVector<NKikimr::TLogoBlobID>>(IOutputStream& out, const TVector<NKikimr::TLogoBlobID> &xvec) { +inline void Out<TVector<NKikimr::TLogoBlobID>>(IOutputStream& out, const TVector<NKikimr::TLogoBlobID> &xvec) { return NKikimr::TLogoBlobID::Out(out, xvec); } diff --git a/ydb/core/base/logoblob_ut.cpp b/ydb/core/base/logoblob_ut.cpp index 75d9d2b833b..769fe3dd12a 100644 --- a/ydb/core/base/logoblob_ut.cpp +++ b/ydb/core/base/logoblob_ut.cpp @@ -8,7 +8,7 @@ namespace NKikimr { Y_UNIT_TEST(LogoBlobParse) { TLogoBlobID id; - TString explanation; + TString explanation; bool res = false; res = TLogoBlobID::Parse(id, "[ 0:1:2:0:0:0:0]", explanation); @@ -74,7 +74,7 @@ namespace NKikimr { } Y_UNIT_TEST(LogoBlobSort) { - TVector<TLogoBlobID> vec; + TVector<TLogoBlobID> vec; vec.emplace_back(TLogoBlobID(66, 1, 0, 0, 110, 20)); vec.emplace_back(TLogoBlobID(66, 1, 0, 0, 109, 21)); vec.emplace_back(TLogoBlobID(66, 1, 0, 0, 108, 22)); @@ -96,7 +96,7 @@ namespace NKikimr { } // sorted by: TabletId, Channel, Generation, Step, Cookie, BlobSize - TString result = + TString result = "[42:1:1:0:15:100:0]\n" "[42:1:2:0:19:100:0]\n" "[42:1:3:0:16:100:0]\n" diff --git a/ydb/core/base/path.cpp b/ydb/core/base/path.cpp index 0cfb16f99dc..588c533fa79 100644 --- a/ydb/core/base/path.cpp +++ b/ydb/core/base/path.cpp @@ -5,8 +5,8 @@ namespace NKikimr { -TVector<TString> SplitPath(TString path) { - TVector<TString> res; +TVector<TString> SplitPath(TString path) { + TVector<TString> res; if (path.empty()) return res; // xenoxeno: don't do it unless you want YQL to complain about paths... @@ -30,7 +30,7 @@ TVector<TString> SplitPath(TString path) { return res; } -TString JoinPath(const TVector<TString>& path) { +TString JoinPath(const TVector<TString>& path) { TString result; size_t size = 0; for (const TString& s : path) { diff --git a/ydb/core/base/path.h b/ydb/core/base/path.h index c2b93d2bafd..06399e55314 100644 --- a/ydb/core/base/path.h +++ b/ydb/core/base/path.h @@ -6,8 +6,8 @@ namespace NKikimr { -TVector<TString> SplitPath(TString path); -TString JoinPath(const TVector<TString>& path); +TVector<TString> SplitPath(TString path); +TString JoinPath(const TVector<TString>& path); TString CanonizePath(const TString &path); TString CanonizePath(const TVector<TString>& path); ui32 CanonizedPathLen(const TVector<TString>& path); diff --git a/ydb/core/base/statestorage.h b/ydb/core/base/statestorage.h index 9b3e3b6b1b7..16ba19cb27d 100644 --- a/ydb/core/base/statestorage.h +++ b/ydb/core/base/statestorage.h @@ -79,7 +79,7 @@ struct TEvStateStorage { : SigWaitMode(sigWaitMode) {} - TString ToString() const { + TString ToString() const { switch (SigWaitMode) { case SigNone: return "SigNone"; case SigAsync: return "SigAsync"; @@ -100,7 +100,7 @@ struct TEvStateStorage { , ProxyOptions(proxyOptions) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvLookup TabletID: " << TabletID; str << " Cookie: " << Cookie; @@ -135,7 +135,7 @@ struct TEvStateStorage { Copy(sig, sig + sigsz, Signature.Get()); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvUpdate TabletID: " << TabletID; str << " Cookie: " << Cookie; @@ -166,7 +166,7 @@ struct TEvStateStorage { , Cookie(cookie) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvDelete TabletID: " << TabletID; str << " Cookie: " << Cookie; @@ -194,7 +194,7 @@ struct TEvStateStorage { , Status(status) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvDeleteResult TabletID: " << TabletID; str << " Status: " << (ui32)Status; @@ -224,7 +224,7 @@ struct TEvStateStorage { Copy(sig, sig + sigsz, Signature.Get()); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvLock TabletID: " << TabletID; str << " Cookie: " << Cookie; @@ -284,7 +284,7 @@ struct TEvStateStorage { MakeFilteredSignatureCopy(sig, sigsz, Signature.Get()); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvInfo Status: " << (ui32)Status; str << " TabletID: " << TabletID; @@ -331,7 +331,7 @@ struct TEvStateStorage { MakeFilteredSignatureCopy(sig, sigsz, Signature.Get()); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvUpdateSignature TabletID: " << TabletID; str << " Sz: " << Sz; diff --git a/ydb/core/base/statestorage_impl.h b/ydb/core/base/statestorage_impl.h index 2a2aa22f6a7..2f05ddc1731 100644 --- a/ydb/core/base/statestorage_impl.h +++ b/ydb/core/base/statestorage_impl.h @@ -36,7 +36,7 @@ struct TEvStateStorage::TEvReplicaInfo : public TEventPB<TEvStateStorage::TEvRep } } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvReplicaInfo Status: " << (ui32)Record.GetStatus(); str << " TabletID: " << Record.GetTabletID(); @@ -186,7 +186,7 @@ struct TEvStateStorage::TEvReplicaLookup : public TEventPB<TEvStateStorage::TEvR Record.SetCookie(cookie); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvReplicaLookup TabletID: " << Record.GetTabletID(); str << " Cookie: " << Record.GetCookie(); @@ -206,7 +206,7 @@ struct TEvStateStorage::TEvReplicaUpdate : public TEventPB<TEvStateStorage::TEvR Record.SetProposedStep(proposedStep); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvReplicaUpdate TabletID: " << Record.GetTabletID(); str << " ProposedGeneration: " << Record.GetProposedGeneration(); @@ -225,7 +225,7 @@ struct TEvStateStorage::TEvReplicaDelete : public TEventPB<TEvStateStorage::TEvR Record.SetTabletID(tabletId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvReplicaUpdate TabletID: " << Record.GetTabletID(); str << "}"; @@ -254,7 +254,7 @@ struct TEvStateStorage::TEvReplicaLock : public TEventPB<TEvStateStorage::TEvRep Record.SetProposedGeneration(proposedGeneration); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvReplicaLock TabletID: " << Record.GetTabletID(); str << " ProposedGeneration: " << Record.GetProposedGeneration(); diff --git a/ydb/core/base/statestorage_monitoring.cpp b/ydb/core/base/statestorage_monitoring.cpp index 5bcc3ec67fa..fae2d3e3a82 100644 --- a/ydb/core/base/statestorage_monitoring.cpp +++ b/ydb/core/base/statestorage_monitoring.cpp @@ -24,7 +24,7 @@ class TStateStorageMonitoringActor : public TActorBootstrapped<TStateStorageMoni TReplicaInfo(const TActorId &x) : ActorID(x) - , ReplyTime(TInstant::MicroSeconds(Max<ui64>())) + , ReplyTime(TInstant::MicroSeconds(Max<ui64>())) , CurrentLeader() , CurrentLeaderTablet() , CurrentGeneration(Max<ui32>()) @@ -36,17 +36,17 @@ class TStateStorageMonitoringActor : public TActorBootstrapped<TStateStorageMoni const ui64 TabletID; const TActorId Sender; - const TString Query; + const TString Query; TInstant BeginMoment; TInstant ReplicasRequestMoment; TDuration ProxyReplyTime; - TVector<TReplicaInfo> ReplicasInfo; + TVector<TReplicaInfo> ReplicasInfo; ui64 WaitingForReplicas; ui64 SelfConfigContentHash; - void Reply(const TString &response, const TActorContext &ctx) { + void Reply(const TString &response, const TActorContext &ctx) { TStringStream str; HTML(str) { @@ -206,7 +206,7 @@ public: : TabletID(tabletId) , Sender(sender) , Query(query) - , ProxyReplyTime(TDuration::MicroSeconds(Max<ui64>())) + , ProxyReplyTime(TDuration::MicroSeconds(Max<ui64>())) , WaitingForReplicas(0) {} diff --git a/ydb/core/base/statestorage_replica.cpp b/ydb/core/base/statestorage_replica.cpp index aca41acb16a..9a665386552 100644 --- a/ydb/core/base/statestorage_replica.cpp +++ b/ydb/core/base/statestorage_replica.cpp @@ -66,7 +66,7 @@ class TStateStorageReplica : public TActor<TStateStorageReplica> { {} }; - typedef TMap<ui64, TEntry> TTablets; + typedef TMap<ui64, TEntry> TTablets; TTablets Tablets; TMap<ui32, std::map<ui64, ui64>> FollowerIndex; // node, tablet, refcounter diff --git a/ydb/core/base/tablet.h b/ydb/core/base/tablet.h index 602e39c6000..5d93286eaae 100644 --- a/ydb/core/base/tablet.h +++ b/ydb/core/base/tablet.h @@ -105,18 +105,18 @@ struct TEvTablet { struct TEntry { std::pair<ui32, ui32> Id; bool IsSnapshot; - TVector<TLogoBlobID> References; + TVector<TLogoBlobID> References; - TVector<TLogoBlobID> GcDiscovered; - TVector<TLogoBlobID> GcLeft; + TVector<TLogoBlobID> GcDiscovered; + TVector<TLogoBlobID> GcLeft; - TString EmbeddedLogBody; + TString EmbeddedLogBody; TEntry() : IsSnapshot(false) {} - void Set(const std::pair<ui32, ui32> &id, TVector<TLogoBlobID> &refs, bool isSnapshot, TVector<TLogoBlobID> &gcDiscovered, TVector<TLogoBlobID> &gcLeft) { + void Set(const std::pair<ui32, ui32> &id, TVector<TLogoBlobID> &refs, bool isSnapshot, TVector<TLogoBlobID> &gcDiscovered, TVector<TLogoBlobID> &gcLeft) { Id = id; References.swap(refs); IsSnapshot = isSnapshot; @@ -125,7 +125,7 @@ struct TEvTablet { EmbeddedLogBody.clear(); } - void Set(const std::pair<ui32, ui32> &id, const TString &embeddedLogBody, TVector<TLogoBlobID> &gcDiscovered, TVector<TLogoBlobID> &gcLeft) { + void Set(const std::pair<ui32, ui32> &id, const TString &embeddedLogBody, TVector<TLogoBlobID> &gcDiscovered, TVector<TLogoBlobID> &gcLeft) { Id = id; References.clear(); IsSnapshot = false; @@ -136,7 +136,7 @@ struct TEvTablet { }; std::pair<ui32, ui32> Snapshot; - TDeque<TEntry> Entries; + TDeque<TEntry> Entries; TDependencyGraph(const std::pair<ui32, ui32> &snap) : Snapshot(snap) @@ -148,7 +148,7 @@ struct TEvTablet { << " entries " << Entries.size() << "}"; } - void AddEntry(const std::pair<ui32, ui32> &id, TVector<TLogoBlobID> &references, bool isSnapshot, TVector<TLogoBlobID> &gcDiscovered, TVector<TLogoBlobID> &gcLeft) { + void AddEntry(const std::pair<ui32, ui32> &id, TVector<TLogoBlobID> &references, bool isSnapshot, TVector<TLogoBlobID> &gcDiscovered, TVector<TLogoBlobID> &gcLeft) { if (isSnapshot) { Snapshot = id; Entries.clear(); @@ -158,7 +158,7 @@ struct TEvTablet { Entries.back().Set(id, references, isSnapshot, gcDiscovered, gcLeft); } - void AddEntry(const std::pair<ui32, ui32> &id, const TString &embeddedLogBody, TVector<TLogoBlobID> &gcDiscovered, TVector<TLogoBlobID> &gcLeft) { + void AddEntry(const std::pair<ui32, ui32> &id, const TString &embeddedLogBody, TVector<TLogoBlobID> &gcDiscovered, TVector<TLogoBlobID> &gcLeft) { Entries.push_back(TEntry()); Entries.back().Set(id, embeddedLogBody, gcDiscovered, gcLeft); } @@ -240,12 +240,12 @@ struct TEvTablet { const ui64 TabletID; const ui32 Generation; const ui32 Step; - const TVector<ui32> DependsOn; + const TVector<ui32> DependsOn; const bool IsSnapshot; bool IsTotalSnapshot; bool WaitFollowerGcAck; - TCommitInfo(ui64 tabletId, ui32 gen, ui32 step, const TVector<ui32> &dependsOn, bool isSnapshot) + TCommitInfo(ui64 tabletId, ui32 gen, ui32 step, const TVector<ui32> &dependsOn, bool isSnapshot) : TabletID(tabletId) , Generation(gen) , Step(step) @@ -260,13 +260,13 @@ struct TEvTablet { const bool PreCommited; TEvBlobStorage::TEvPut::ETactic CommitTactic; - TVector<TLogoBlobID> ExternalReferences; - TVector<TLogEntryReference> References; + TVector<TLogoBlobID> ExternalReferences; + TVector<TLogEntryReference> References; - TVector<TLogoBlobID> GcDiscovered; - TVector<TLogoBlobID> GcLeft; + TVector<TLogoBlobID> GcDiscovered; + TVector<TLogoBlobID> GcLeft; - TString EmbeddedLogBody; + TString EmbeddedLogBody; TString FollowerAux; TEvCommit(ui64 tabletId, ui32 gen, ui32 step, const TVector<ui32> &dependsOn, bool isSnapshot @@ -287,7 +287,7 @@ struct TEvTablet { }; struct TEvPreCommit : public TEventLocal<TEvPreCommit, EvPreCommit>, public TCommitInfo { - TEvPreCommit(ui64 tabletId, ui32 gen, ui32 step, const TVector<ui32> &dependsOn, bool isSnapshot) + TEvPreCommit(ui64 tabletId, ui32 gen, ui32 step, const TVector<ui32> &dependsOn, bool isSnapshot) : TCommitInfo(tabletId, gen, step, dependsOn, isSnapshot) {} }; @@ -434,7 +434,7 @@ struct TEvTablet { TEvReadLocalBase() {} - TEvReadLocalBase(const TString& rootKey, bool saveScheme) + TEvReadLocalBase(const TString& rootKey, bool saveScheme) { if (!rootKey.empty()) Record.SetRootKey(rootKey); @@ -452,7 +452,7 @@ struct TEvTablet { TEvReadLocalBaseResult() {} - TEvReadLocalBaseResult(ui64 origin, const TString& rootKey, bool isError, const TString& docBuffer, const TString* schemeBuffer) + TEvReadLocalBaseResult(ui64 origin, const TString& rootKey, bool isError, const TString& docBuffer, const TString* schemeBuffer) { Record.SetOrigin(origin); Record.SetRootKey(rootKey); @@ -584,9 +584,9 @@ struct TEvTablet { struct TFUpdateBody { const bool IsSnapshot; const ui32 Step; - TString EmbeddedBody; - TVector<std::pair<TLogoBlobID, TString>> References; - TString AuxPayload; + TString EmbeddedBody; + TVector<std::pair<TLogoBlobID, TString>> References; + TString AuxPayload; bool NeedFollowerGcAck; @@ -669,7 +669,7 @@ struct TEvTablet { }; struct TEvFAuxUpdate : public TEventLocal<TEvFAuxUpdate, EvFAuxUpdate> { - const TString AuxUpdate; + const TString AuxUpdate; TEvFAuxUpdate(const TString &auxUpdate) : AuxUpdate(auxUpdate) @@ -790,6 +790,6 @@ inline void Out<NKikimr::TEvTablet::TEvTabletDead::EReason>(IOutputStream& o, NK return NKikimr::TEvTablet::TEvTabletDead::Out(o, x); } -inline TString ToString(NKikimr::TEvTablet::TEvTabletDead::EReason x) { +inline TString ToString(NKikimr::TEvTablet::TEvTabletDead::EReason x) { return NKikimr::TEvTablet::TEvTabletDead::Str(x); } diff --git a/ydb/core/base/tablet_resolver.h b/ydb/core/base/tablet_resolver.h index 24744cef478..ea702cd335b 100644 --- a/ydb/core/base/tablet_resolver.h +++ b/ydb/core/base/tablet_resolver.h @@ -116,7 +116,7 @@ struct TEvTabletResolver { , Actor(actor) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvForward TabletID: " << TabletID; str << " Ev: " << (Ev ? Ev->GetBase()->ToString().data() : "nullptr"); @@ -144,7 +144,7 @@ struct TEvTabletResolver { , TabletActor(tabletActor) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvTabletProblem TabletID: " << TabletID; str << " TabletActor: " << TabletActor.ToString(); @@ -192,7 +192,7 @@ struct TEvTabletResolver { , CacheEpoch(cacheEpoch) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvForwardResult Status: " << (ui32)Status; str << " TabletID: " << TabletID; diff --git a/ydb/core/base/ticket_parser.h b/ydb/core/base/ticket_parser.h index 62004b3a89d..f1a015c2f90 100644 --- a/ydb/core/base/ticket_parser.h +++ b/ydb/core/base/ticket_parser.h @@ -31,7 +31,7 @@ namespace NKikimr { }; const TString Database; - const TString Ticket; + const TString Ticket; const TString PeerName; // if two identical permissions with different attributies are specified, @@ -112,7 +112,7 @@ namespace NKikimr { TString Ticket; TError Error; TIntrusivePtr<NACLib::TUserToken> Token; - TString SerializedToken; + TString SerializedToken; TEvAuthorizeTicketResult(const TString& ticket, const TIntrusivePtr<NACLib::TUserToken>& token, const TString& serializedToken) : Ticket(ticket) diff --git a/ydb/core/base/tx_processing.cpp b/ydb/core/base/tx_processing.cpp index a017f670188..a80e3d71180 100644 --- a/ydb/core/base/tx_processing.cpp +++ b/ydb/core/base/tx_processing.cpp @@ -10,11 +10,11 @@ NKikimr::TCoordinators::TCoordinators(const NKikimr::TDomainsInfo::TDomain &doma : Coordinators(domain.Coordinators) {} -NKikimr::TCoordinators::TCoordinators(const TVector<ui64> &coordinators) +NKikimr::TCoordinators::TCoordinators(const TVector<ui64> &coordinators) : Coordinators(coordinators) {} -NKikimr::TCoordinators::TCoordinators(TVector<ui64> &&coordinators) +NKikimr::TCoordinators::TCoordinators(TVector<ui64> &&coordinators) : Coordinators(std::move(coordinators)) {} @@ -26,7 +26,7 @@ ui64 NKikimr::TCoordinators::Select(ui64 txId) const { return 0; } -const TVector<ui64> &NKikimr::TCoordinators::List() const { +const TVector<ui64> &NKikimr::TCoordinators::List() const { return Coordinators; } @@ -38,11 +38,11 @@ NKikimr::TMediators::TMediators(const NKikimr::TDomainsInfo::TDomain &domain) : Mediators(domain.Mediators) {} -NKikimr::TMediators::TMediators(const TVector<ui64> &mediators) +NKikimr::TMediators::TMediators(const TVector<ui64> &mediators) : Mediators(mediators) {} -NKikimr::TMediators::TMediators(TVector<ui64> &&mediators) +NKikimr::TMediators::TMediators(TVector<ui64> &&mediators) : Mediators(std::move(mediators)) {} @@ -50,7 +50,7 @@ ui64 NKikimr::TMediators::Select(ui64 tabletId) const { return Mediators[Hash64to32(tabletId) % Mediators.size()]; } -const TVector<ui64> &NKikimr::TMediators::List() const { +const TVector<ui64> &NKikimr::TMediators::List() const { return Mediators; } diff --git a/ydb/core/base/tx_processing.h b/ydb/core/base/tx_processing.h index 17e5e7062cf..8a4fdb369b1 100644 --- a/ydb/core/base/tx_processing.h +++ b/ydb/core/base/tx_processing.h @@ -13,31 +13,31 @@ namespace NKikimr { struct TCoordinators: TAtomicRefCount<TCoordinators> { using TPtr = TIntrusiveConstPtr<TCoordinators>; - const TVector<ui64> Coordinators; + const TVector<ui64> Coordinators; TCoordinators(const NKikimrSubDomains::TProcessingParams &processing); TCoordinators(const TDomainsInfo::TDomain &domain); - TCoordinators(const TVector<ui64> &coordinators); - TCoordinators(TVector<ui64> &&coordinators); + TCoordinators(const TVector<ui64> &coordinators); + TCoordinators(TVector<ui64> &&coordinators); ui64 Select(ui64 txId) const; - const TVector<ui64>& List() const; + const TVector<ui64>& List() const; }; struct TMediators: TAtomicRefCount<TMediators> { using TPtr = TIntrusiveConstPtr<TMediators>; - const TVector<ui64> Mediators; + const TVector<ui64> Mediators; TMediators(const NKikimrSubDomains::TProcessingParams &processing); TMediators(const TDomainsInfo::TDomain &domain); - TMediators(const TVector<ui64> &mediators); - TMediators(TVector<ui64> &&mediators); + TMediators(const TVector<ui64> &mediators); + TMediators(TVector<ui64> &&mediators); ui64 Select(ui64 tabletId) const; - const TVector<ui64>& List() const; + const TVector<ui64>& List() const; }; struct TTimeCastBuckets: TAtomicRefCount<TTimeCastBuckets> { diff --git a/ydb/core/blobstorage/backpressure/queue_backpressure_client.cpp b/ydb/core/blobstorage/backpressure/queue_backpressure_client.cpp index 200b85f616d..670c0329bb4 100644 --- a/ydb/core/blobstorage/backpressure/queue_backpressure_client.cpp +++ b/ydb/core/blobstorage/backpressure/queue_backpressure_client.cpp @@ -28,8 +28,8 @@ class TVDiskBackpressureClientActor : public TActorBootstrapped<TVDiskBackpressu }; TBSProxyContextPtr BSProxyCtx; - TString LogPrefix; - const TString QueueName; + TString LogPrefix; + const TString QueueName; const NMonitoring::TDynamicCounterPtr Counters; TBlobStorageQueue Queue; TActorId BlobStorageProxy; diff --git a/ydb/core/blobstorage/backpressure/queue_backpressure_client.h b/ydb/core/blobstorage/backpressure/queue_backpressure_client.h index e6cc006a7a9..e193911642a 100644 --- a/ydb/core/blobstorage/backpressure/queue_backpressure_client.h +++ b/ydb/core/blobstorage/backpressure/queue_backpressure_client.h @@ -23,7 +23,7 @@ namespace NKikimr { , IsConnected(isConnected) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{VDiskId# " << VDiskId.ToString(); str << " QueueId# " << static_cast<ui32>(QueueId); diff --git a/ydb/core/blobstorage/backpressure/queue_backpressure_client_ut.cpp b/ydb/core/blobstorage/backpressure/queue_backpressure_client_ut.cpp index af14a13f2d0..1044d61c005 100644 --- a/ydb/core/blobstorage/backpressure/queue_backpressure_client_ut.cpp +++ b/ydb/core/blobstorage/backpressure/queue_backpressure_client_ut.cpp @@ -124,7 +124,7 @@ class TQueueTestRuntime { TIntrusivePtr<NMonitoring::TDynamicCounters> Counters; TIntrusivePtr<TBlobStorageGroupInfo> Info; std::unique_ptr<TActorSystem> ActorSystem; - TString Path; + TString Path; ui64 DiskSize; ui32 ChunkSize; ui64 PDiskGuid; @@ -231,7 +231,7 @@ public: NKikimrServices::EServiceKikimr_Name ); - TString explanation; + TString explanation; logSettings->SetLevel(NLog::PRI_DEBUG, NKikimrServices::BS_QUEUE, explanation); NActors::TLoggerActor *loggerActor = new NActors::TLoggerActor{logSettings, NActors::CreateStderrBackend(), @@ -288,7 +288,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageQueueTest) { // without proper interconnect notification; local messages can't be just lost while VDisk is operational return; // TODO(alexvru) - TVector<std::pair<ui64, ui64>> sequence; + TVector<std::pair<ui64, ui64>> sequence; auto filterFunc = [&](IEventHandle& ev, const TActorContext& /*ctx*/) { if (ev.GetTypeRewrite() == TEvBlobStorage::TEvVGet::EventType) { TEventHandle<TEvBlobStorage::TEvVGet>& evv = reinterpret_cast<TEventHandle<TEvBlobStorage::TEvVGet>&>(ev); @@ -319,7 +319,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageQueueTest) { } runtime.WaitCompleted(); runtime.Stop(); - UNIT_ASSERT_VALUES_EQUAL(sequence, (TVector<std::pair<ui64, ui64>>{{1, 0}, {1, 1}, {1, 2}, {2, 1}, {2, 2}})); + UNIT_ASSERT_VALUES_EQUAL(sequence, (TVector<std::pair<ui64, ui64>>{{1, 0}, {1, 1}, {1, 2}, {2, 1}, {2, 2}})); } } diff --git a/ydb/core/blobstorage/backpressure/queue_backpressure_server.h b/ydb/core/blobstorage/backpressure/queue_backpressure_server.h index c1f8a7e3952..2ea28b3045f 100644 --- a/ydb/core/blobstorage/backpressure/queue_backpressure_server.h +++ b/ydb/core/blobstorage/backpressure/queue_backpressure_server.h @@ -16,10 +16,10 @@ namespace NKikimr { // second -- updates to all windows as result of global recalculation (TWindowStatusVec) //////////////////////////////////////////////////////////////////////////// template <class TClientId> - struct TFeedback : public std::pair<const TWindowStatus<TClientId>&, const TVector<TWindowStatus<TClientId>> &> { - using TBase = std::pair<const TWindowStatus<TClientId>&, const TVector<TWindowStatus<TClientId>> &>; + struct TFeedback : public std::pair<const TWindowStatus<TClientId>&, const TVector<TWindowStatus<TClientId>> &> { + using TBase = std::pair<const TWindowStatus<TClientId>&, const TVector<TWindowStatus<TClientId>> &>; - TFeedback(const TWindowStatus<TClientId> &op, const TVector<TWindowStatus<TClientId>> &other) + TFeedback(const TWindowStatus<TClientId> &op, const TVector<TWindowStatus<TClientId>> &other) : TBase(op, other) {} @@ -276,7 +276,7 @@ namespace NKikimr { typedef TIntrusivePtr<TWindow> TWindowPtr; typedef THashMap<TActorId, TWindowPtr> TAllWindows; - typedef TVector<TWindowPtr> TWindowPtrVec; + typedef TVector<TWindowPtr> TWindowPtrVec; const bool CheckMsgId; const ui64 MaxCost; @@ -291,7 +291,7 @@ namespace NKikimr { TWindowPtrVec ActiveWindowsCache; TWindowStatus StatusCache; TWindowStatus RecalculateStatusCache; - TVector<TWindowStatus> OtherWindowsStatusVecCache; + TVector<TWindowStatus> OtherWindowsStatusVecCache; TStatPtr GlobalStatPtr; TDuration WindowTimeout; diff --git a/ydb/core/blobstorage/backpressure/queue_backpressure_server_ut.cpp b/ydb/core/blobstorage/backpressure/queue_backpressure_server_ut.cpp index 4c6e357de6b..8ef57a11632 100644 --- a/ydb/core/blobstorage/backpressure/queue_backpressure_server_ut.cpp +++ b/ydb/core/blobstorage/backpressure/queue_backpressure_server_ut.cpp @@ -41,7 +41,7 @@ namespace NKikimr { qb.Push(5, actorId, TMessageId(0, 0), 1, now); qb.Push(5, actorId, TMessageId(0, 1), 1, now); auto feedback = qb.Push(5, actorId, TMessageId(0, 1), 1, now); - TString res = "{Status# 4 Notify# 1 ActualWindowSize# 2 MaxWindowSize# 20 " + TString res = "{Status# 4 Notify# 1 ActualWindowSize# 2 MaxWindowSize# 20 " "ExpectedMsgId# [1 2] FailedMsgId# [0 1]}"; TStringStream str; feedback.Output(str); @@ -144,7 +144,7 @@ namespace NKikimr { Y_UNIT_TEST(PerfTrivial) { TQueueBackpressure<ui64> qb(true, 100u, 10u); - TVector<IClientPtr> clients; + TVector<IClientPtr> clients; ui32 i = 0; for (i = 0; i < 5; i++) { clients.emplace_back(new TTrivialClient(i)); @@ -167,7 +167,7 @@ namespace NKikimr { TStringStream s; s << "{Status# 1 Notify# 0 " << "ActualWindowSize# 1 MaxWindowSize# 20 ExpectedMsgId# [0 500001] FailedMsgId# [0 0]}"; - TString res = feedback.first.ToString(); + TString res = feedback.first.ToString(); STR << res << "\n"; UNIT_ASSERT(res == s.Str()); } @@ -178,7 +178,7 @@ namespace NKikimr { TInstant now = Now(); - TVector<IClientPtr> clients; + TVector<IClientPtr> clients; clients.emplace_back(new TInFlightClient(0, 30)); clients.emplace_back(new TInFlightClient(1, 10)); @@ -195,7 +195,7 @@ namespace NKikimr { TStringStream s; qb.Output(s, now); - TString res = "MaxCost# 100 ActualCost# 38 activeWindows# 2 fadingWindows# 0 " + TString res = "MaxCost# 100 ActualCost# 38 activeWindows# 2 fadingWindows# 0 " "frozenWindows# 0 deadWindows# 0\n" "GlobalStat: NSuccess# 1000038 NWindowUpdate# 400005 NProcessed# 1000000 " "NIncorrectMsgId# 0 NHighWatermarkOverflow# 0\n" diff --git a/ydb/core/blobstorage/base/blobstorage_syncstate.h b/ydb/core/blobstorage/base/blobstorage_syncstate.h index 52c21a94504..3ac96cc07d4 100644 --- a/ydb/core/blobstorage/base/blobstorage_syncstate.h +++ b/ydb/core/blobstorage/base/blobstorage_syncstate.h @@ -54,7 +54,7 @@ namespace NKikimr { str << "[" << Guid << " " << SyncedLsn << "]"; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/base/blobstorage_vdiskid.cpp b/ydb/core/blobstorage/base/blobstorage_vdiskid.cpp index e5a6cb7d42f..4dc94bdc31f 100644 --- a/ydb/core/blobstorage/base/blobstorage_vdiskid.cpp +++ b/ydb/core/blobstorage/base/blobstorage_vdiskid.cpp @@ -26,12 +26,12 @@ namespace NKikimr { return *this == vdisk; } - TString TVDiskID::ToString() const { + TString TVDiskID::ToString() const { return Sprintf("[%" PRIx32 ":%" PRIu32 ":%" PRIu8 ":%" PRIu8 ":%" PRIu8 "]", GroupID, GroupGeneration, FailRealm, FailDomain, VDisk).data(); } - TString TVDiskID::ToStringWOGeneration() const { + TString TVDiskID::ToStringWOGeneration() const { return Sprintf("[%" PRIx32 ":_:%" PRIu8 ":%" PRIu8 ":%" PRIu8 "]", GroupID, FailRealm, FailDomain, VDisk).data(); } diff --git a/ydb/core/blobstorage/base/blobstorage_vdiskid.h b/ydb/core/blobstorage/base/blobstorage_vdiskid.h index c8d5a818b15..5c8f94011ee 100644 --- a/ydb/core/blobstorage/base/blobstorage_vdiskid.h +++ b/ydb/core/blobstorage/base/blobstorage_vdiskid.h @@ -62,8 +62,8 @@ struct TVDiskID { friend bool operator !=(const TVDiskID& x, const TVDiskID& y) { return x.ConvertToTuple() != y.ConvertToTuple(); } friend bool operator < (const TVDiskID& x, const TVDiskID& y) { return x.ConvertToTuple() < y.ConvertToTuple(); } - TString ToString() const; - TString ToStringWOGeneration() const; + TString ToString() const; + TString ToStringWOGeneration() const; void Serialize(IOutputStream &s) const; bool Deserialize(IInputStream &s); @@ -133,7 +133,7 @@ struct TVDiskIdShort { return !((*this)==x); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{FailRealm# " << (ui32)FailRealm; str << " FailDomain# " << (ui32)FailDomain; diff --git a/ydb/core/blobstorage/base/bufferwithgaps.h b/ydb/core/blobstorage/base/bufferwithgaps.h index 28fc2f78ed9..050ca8abbe2 100644 --- a/ydb/core/blobstorage/base/bufferwithgaps.h +++ b/ydb/core/blobstorage/base/bufferwithgaps.h @@ -1,7 +1,7 @@ #pragma once #include "defs.h" -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/set.h> #include <util/generic/map.h> #include <util/generic/vector.h> @@ -19,7 +19,7 @@ namespace NKikimr { * through replication, or do something else. */ class TBufferWithGaps { - TString Data; + TString Data; // <begin, size> TMap<ui32, ui32> Gaps; ui32 Offset; // Data's offset in Gaps space @@ -60,17 +60,17 @@ namespace NKikimr { Gaps.emplace(begin, size); } - void SetData(TString&& data) { + void SetData(TString&& data) { Data = std::move(data); IsCommited = true; } - TString ToString() const { + TString ToString() const { Y_VERIFY(IsReadable(), "returned data is corrupt (or was never written) and therefore could not be used safely"); return Data; } - TString Substr(ui32 offset, ui32 len) const { + TString Substr(ui32 offset, ui32 len) const { Y_VERIFY(IsReadable(offset, len), "returned data is corrupt (or was never written) at offset# %" PRIu32 " len# %" PRIu32 " and therefore could not be used safely", offset, len); return Data.substr(offset, len); diff --git a/ydb/core/blobstorage/base/bufferwithgaps_ut.cpp b/ydb/core/blobstorage/base/bufferwithgaps_ut.cpp index 71e1e1a5eb3..29319f14d3a 100644 --- a/ydb/core/blobstorage/base/bufferwithgaps_ut.cpp +++ b/ydb/core/blobstorage/base/bufferwithgaps_ut.cpp @@ -7,16 +7,16 @@ Y_UNIT_TEST_SUITE(BufferWithGaps) { Y_UNIT_TEST(Basic) { TBufferWithGaps buffer(0); - TString data = "Hello!"; - buffer.SetData(TString(data)); + TString data = "Hello!"; + buffer.SetData(TString(data)); UNIT_ASSERT_STRINGS_EQUAL(data, buffer.Substr(0, buffer.Size())); } Y_UNIT_TEST(IsReadable) { TBufferWithGaps buffer(0); - TString data = "Hello! How are you? I'm fine, and you? Me too, thanks!"; - TString gaps = "G GGGG GG GGG G G"; - buffer.SetData(TString(data)); + TString data = "Hello! How are you? I'm fine, and you? Me too, thanks!"; + TString gaps = "G GGGG GG GGG G G"; + buffer.SetData(TString(data)); for (size_t k = 0; k < gaps.size(); ++k) { if (gaps[k] != ' ') { buffer.AddGap(k, k + 1); diff --git a/ydb/core/blobstorage/base/html.h b/ydb/core/blobstorage/base/html.h index c592112f307..bf6d720a6f6 100644 --- a/ydb/core/blobstorage/base/html.h +++ b/ydb/core/blobstorage/base/html.h @@ -14,7 +14,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class THtmlLightSignalRenderer { public: - THtmlLightSignalRenderer(NKikimrWhiteboard::EFlag light, const TString &value) + THtmlLightSignalRenderer(NKikimrWhiteboard::EFlag light, const TString &value) : Light(light) , Value(value) {} @@ -23,7 +23,7 @@ namespace NKikimr { private: NKikimrWhiteboard::EFlag Light; - const TString Value; + const TString Value; static const std::pair<TStringBuf, TStringBuf> Lights[NKikimrWhiteboard::EFlag_ARRAYSIZE]; // {class, style} }; diff --git a/ydb/core/blobstorage/base/utility.h b/ydb/core/blobstorage/base/utility.h index afb519dcb86..186a0da46f7 100644 --- a/ydb/core/blobstorage/base/utility.h +++ b/ydb/core/blobstorage/base/utility.h @@ -21,7 +21,7 @@ namespace NKikimr { } template<typename T, typename A> - inline void AppendToVector(TVector<T, A>& to, TVector<T, A>&& from) { + inline void AppendToVector(TVector<T, A>& to, TVector<T, A>&& from) { if (to) { to.insert(to.end(), from.begin(), from.end()); } else { @@ -30,13 +30,13 @@ namespace NKikimr { } template<typename T, typename A> - inline void AppendToVector(TVector<T, A>& to, const TVector<T, A>& from) { + inline void AppendToVector(TVector<T, A>& to, const TVector<T, A>& from) { to.insert(to.end(), from.begin(), from.end()); } template<typename TContainer> - inline TString FormatList(const TContainer& cont) { + inline TString FormatList(const TContainer& cont) { TStringStream str; str << "["; bool first = true; diff --git a/ydb/core/blobstorage/base/vdisk_lsn.h b/ydb/core/blobstorage/base/vdisk_lsn.h index 1960ed08ebd..620ee55392c 100644 --- a/ydb/core/blobstorage/base/vdisk_lsn.h +++ b/ydb/core/blobstorage/base/vdisk_lsn.h @@ -27,7 +27,7 @@ namespace NKikimr { return Last; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.cpp index eb6d8394f02..5a46a0774b5 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.cpp @@ -6,7 +6,7 @@ namespace NKikimr { // TBlobState // -void TBlobState::TState::AddResponseData(ui32 fullSize, ui32 shift, TString &data) { +void TBlobState::TState::AddResponseData(ui32 fullSize, ui32 shift, TString &data) { // Add the data to the Data buffer Y_VERIFY(data.size()); Y_VERIFY(shift + data.size() <= fullSize); @@ -92,7 +92,7 @@ bool TBlobState::Restore(const TBlobStorageGroupInfo &info) { } partSet.FullDataSize = Id.BlobSize(); - TString whole; + TString whole; info.Type.RestoreData((TErasureType::ECrcMode)Id.CrcMode(), partSet, whole, false, true, false); Whole.Data.Write(0, whole.data(), Id.BlobSize()); Whole.Here.Add(fullBlobInterval); @@ -242,7 +242,7 @@ void TBlobState::GetWorstPredictedDelaysNs(const TBlobStorageGroupInfo &info, TG } } -TString TBlobState::ToString() const { +TString TBlobState::ToString() const { TStringStream str; str << "{Id# " << Id.ToString(); str << Endl; @@ -266,7 +266,7 @@ TString TBlobState::ToString() const { return str.Str(); } -TString TBlobState::SituationToString(ESituation situation) { +TString TBlobState::SituationToString(ESituation situation) { switch (situation) { case ESituation::Unknown: return "ESituation::Unknown"; @@ -285,7 +285,7 @@ TString TBlobState::SituationToString(ESituation situation) { return ""; } -TString TBlobState::TDisk::ToString() const { +TString TBlobState::TDisk::ToString() const { TStringStream str; str << "{OrderNumber# " << OrderNumber; str << " IsSlow# " << IsSlow; @@ -297,7 +297,7 @@ TString TBlobState::TDisk::ToString() const { return str.Str(); } -TString TBlobState::TDiskPart::ToString() const { +TString TBlobState::TDiskPart::ToString() const { TStringStream str; str << "{Requested# " << Requested.ToString(); str << " Situation# " << SituationToString(Situation); @@ -305,7 +305,7 @@ TString TBlobState::TDiskPart::ToString() const { return str.Str(); } -TString TBlobState::TState::ToString() const { +TString TBlobState::TState::ToString() const { TStringStream str; str << "{Data# " << Data.Print(); str << " Here# " << Here.ToString(); @@ -428,7 +428,7 @@ void TBlackboard::AddPutOkResponse(const TLogoBlobID &id, ui32 orderNumber) { state.AddPutOkResponse(*Info, id, orderNumber); } -void TBlackboard::AddResponseData(const TLogoBlobID &id, ui32 orderNumber, ui32 shift, TString &data) { +void TBlackboard::AddResponseData(const TLogoBlobID &id, ui32 orderNumber, ui32 shift, TString &data) { Y_VERIFY(bool(id)); Y_VERIFY(id.PartId() != 0); TBlobState &state = GetState(id); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.h b/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.h index fe926648a83..dd12ee1296e 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_blackboard.h @@ -50,9 +50,9 @@ struct TBlobState { TFragmentedBuffer Data; TIntervalSet<i32> Here; // Present in the Data buffer - void AddResponseData(ui32 fullSize, ui32 shift, TString &data); + void AddResponseData(ui32 fullSize, ui32 shift, TString &data); void AddPartToPut(TString &data); - TString ToString() const; + TString ToString() const; }; struct TWholeState : TState { TIntervalSet<i32> Needed; // Requested by the external user @@ -62,13 +62,13 @@ struct TBlobState { struct TDiskPart { TIntervalSet<i32> Requested; ESituation Situation = ESituation::Unknown; - TString ToString() const; + TString ToString() const; }; struct TDisk { ui32 OrderNumber; bool IsSlow = false; TStackVec<TDiskPart, TypicalPartsInBlob> DiskParts; - TString ToString() const; + TString ToString() const; }; TLogoBlobID Id; @@ -98,8 +98,8 @@ struct TBlobState { void GetWorstPredictedDelaysNs(const TBlobStorageGroupInfo &info, TGroupQueues &groupQueues, NKikimrBlobStorage::EVDiskQueueId queueId, ui64 *outWorstNs, ui64 *outNextToWorstNs, i32 *outWorstSubgroupIdx) const; - TString ToString() const; - static TString SituationToString(ESituation situation); + TString ToString() const; + static TString SituationToString(ESituation situation); }; struct TDiskGetRequest { @@ -123,7 +123,7 @@ struct TDiskPutRequest { ReasonAccelerate }; const TLogoBlobID Id; - TString Buffer; + TString Buffer; EPutReason Reason; bool IsHandoff; ui8 BlobIdx; @@ -138,7 +138,7 @@ struct TDiskPutRequest { }; struct TDiskRequests { - TDeque<TDiskGetRequest> GetsToSend; + TDeque<TDiskGetRequest> GetsToSend; TStackVec<TDiskPutRequest, TypicalPartsInBlob> PutsToSend; ui32 FirstUnsentRequestIdx = 0; ui32 FirstUnsentPutIdx = 0; @@ -197,7 +197,7 @@ struct TBlackboard { void AddPartToPut(const TLogoBlobID &id, ui32 partIdx, TString &partData); void MarkBlobReadyToPut(const TLogoBlobID &id, ui8 blobIdx = 0); void MoveBlobStateToDone(const TLogoBlobID &id); - void AddResponseData(const TLogoBlobID &id, ui32 orderNumber, ui32 shift, TString &data); + void AddResponseData(const TLogoBlobID &id, ui32 orderNumber, ui32 shift, TString &data); void AddPutOkResponse(const TLogoBlobID &id, ui32 orderNumber); void AddNoDataResponse(const TLogoBlobID &id, ui32 orderNumber); void AddErrorResponse(const TLogoBlobID &id, ui32 orderNumber); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp index 2605a19a2e9..725352226a9 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_discover.cpp @@ -248,7 +248,7 @@ class TBlobStorageGroupDiscoverRequest : public TBlobStorageGroupRequestActor<TB }; struct TVDiskInfo { - TVector<TBlobInfo> Blobs; + TVector<TBlobInfo> Blobs; TLogoBlobID nextLogoBlobId; ui32 LastRequestSize; bool IsMoreRequested; @@ -265,7 +265,7 @@ class TBlobStorageGroupDiscoverRequest : public TBlobStorageGroupRequestActor<TB {} }; - typedef TMap<ui64, TVDiskInfo> TVDiskInfoContainer; + typedef TMap<ui64, TVDiskInfo> TVDiskInfoContainer; TVDiskInfoContainer VDiskInfo; @@ -619,14 +619,14 @@ class TBlobStorageGroupDiscoverRequest : public TBlobStorageGroupRequestActor<TB return true; } else if (IsGetBlockDone) { std::unique_ptr<TEvBlobStorage::TEvDiscoverResult> result( - new TEvBlobStorage::TEvDiscoverResult(logoBlobId, MinGeneration, TString(), BlockedGen)); + new TEvBlobStorage::TEvDiscoverResult(logoBlobId, MinGeneration, TString(), BlockedGen)); A_LOG_LOG_S(true, PriorityForStatusOutbound(result->Status), "BSD11", "Die. Result# " << result->Print(false)); SendResult(result); return false; } else { PendingResult.reset(new TEvBlobStorage::TEvDiscoverResult( - logoBlobId, MinGeneration, TString(), BlockedGen)); + logoBlobId, MinGeneration, TString(), BlockedGen)); A_LOG_DEBUG_S("BSD12", "Pending result is set, Result# " << PendingResult->ToString()); Become(&TThis::StateWait); return false; diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp index a4e48dba76c..1e3e5fa8399 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_discover_m3dc.cpp @@ -54,7 +54,7 @@ class TDiscoverVDiskWorker { }; // queue of blobs in descending order - TDeque<TBlobQueueItem> BlobQueue; + TDeque<TBlobQueueItem> BlobQueue; public: TDiscoverVDiskWorker(const TVDiskID& vdiskId, ui64 tabletId, ui32 minGeneration, ui32 forceBlockedGeneration) @@ -255,9 +255,9 @@ public: private: const TIntrusivePtr<TBlobStorageGroupInfo> Info; - TVector<TDiscoverVDiskWorker> VDiskWorkers; + TVector<TDiscoverVDiskWorker> VDiskWorkers; ui32 NumReadyWorkers = 0; - TQueue<TDiscoveryState> StateQ; + TQueue<TDiscoveryState> StateQ; public: TDiscoverWorker(TIntrusivePtr<TBlobStorageGroupInfo> info, ui64 tabletId, ui32 minGeneration, @@ -432,7 +432,7 @@ class TBlobStorageGroupMirror3dcDiscoverRequest : public TBlobStorageGroupReques TVector<std::unique_ptr<TEvBlobStorage::TEvVGet>> Msgs; ui32 BlockedGeneration = 0; - TString Buffer; + TString Buffer; bool GetFinished = false; bool GetInFlight = false; TLogoBlobID ResultBlobId; @@ -645,7 +645,7 @@ public: std::unique_ptr<TEvBlobStorage::TEvDiscoverResult> response; if (ResultBlobId) { response.reset(new TEvBlobStorage::TEvDiscoverResult(ResultBlobId, MinGeneration, - ReadBody ? Buffer : TString(), BlockedGeneration)); + ReadBody ? Buffer : TString(), BlockedGeneration)); } else { response.reset(new TEvBlobStorage::TEvDiscoverResult(NKikimrProto::NODATA, MinGeneration, BlockedGeneration)); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h b/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h index 4908ae9bda4..791d10a70c1 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h @@ -115,7 +115,7 @@ public: return bytesToReport; } - TString DumpQuery() const { + TString DumpQuery() const { TStringStream str; str << "{"; for (ui32 i = 0; i < QuerySize; ++i) { diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_indexrestoreget.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_indexrestoreget.cpp index e1a634e5591..01fb9b11192 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_indexrestoreget.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_indexrestoreget.cpp @@ -20,7 +20,7 @@ class TBlobStorageGroupIndexRestoreGetRequest const bool IsInternal; THashMap<ui64, TGroupQuorumTracker> QuorumTracker; - TVector<TBlobStatusTracker> BlobStatus; + TVector<TBlobStatusTracker> BlobStatus; ui32 VGetsInFlight; TInstant StartTime; @@ -54,7 +54,7 @@ class TBlobStorageGroupIndexRestoreGetRequest friend class TBlobStorageGroupRequestActor<TBlobStorageGroupIndexRestoreGetRequest>; - TString DumpBlobStatus() const { + TString DumpBlobStatus() const { TStringStream str("{"); for (ui32 i = 0; i < BlobStatus.size(); ++i) { @@ -68,7 +68,7 @@ class TBlobStorageGroupIndexRestoreGetRequest return str.Str(); } - TString DumpBlobStatus(ui32 i) const { + TString DumpBlobStatus(ui32 i) const { TStringStream str; BlobStatus[i].Output(str, Info.Get()); return str.Str(); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_monactor.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_monactor.cpp index 96b492c415a..5dde3351e25 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_monactor.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_monactor.cpp @@ -72,7 +72,7 @@ public: } #define UPDATE_WILSON(NAME) \ if (cgi.Has(#NAME "SamplingRate")) { \ - const TString& item = cgi.Get(#NAME "SamplingRate"); \ + const TString& item = cgi.Get(#NAME "SamplingRate"); \ ui64 value; \ if (TryFromString(item, value) && value <= 1000000) { \ AtomicSet(Mon->NAME ## SamplePPM, value); \ @@ -88,7 +88,7 @@ public: str << #NAME; \ } \ TABLED() { \ - TString value = ToString(Mon->NAME ## SamplePPM); \ + TString value = ToString(Mon->NAME ## SamplePPM); \ str << "<input name=\"" #NAME "SamplingRate\" type=\"number\"" \ " value=\"" << value << "\" min=\"0\" max=\"1000000\"/>ppm"; \ } \ diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_range.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_range.cpp index e234f8c18e1..fb65a1f9909 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_range.cpp +++ b/ydb/core/blobstorage/dsproxy/dsproxy_range.cpp @@ -28,7 +28,7 @@ class TBlobStorageGroupRangeRequest : public TBlobStorageGroupRequestActor<TBlob TAutoPtr<TEvBlobStorage::TEvRangeResult> Reply; - TMap<TLogoBlobID, TBlobStatusTracker> BlobStatus; + TMap<TLogoBlobID, TBlobStatusTracker> BlobStatus; TBlobStorageGroupInfo::TGroupVDisks FailedDisks; ui32 NumVGetsPending = 0; @@ -42,7 +42,7 @@ class TBlobStorageGroupRangeRequest : public TBlobStorageGroupRequestActor<TBlob , RequiredToBePresent(requiredToBePresent) {} }; - TVector<TBlobQueryItem> BlobsToGet; + TVector<TBlobQueryItem> BlobsToGet; template<typename TPtr> void SendReply(TPtr& reply) { @@ -259,7 +259,7 @@ class TBlobStorageGroupRangeRequest : public TBlobStorageGroupRequestActor<TBlob Become(&TThis::StateGet); } - TString DumpBlobsToGet() const { + TString DumpBlobsToGet() const { TStringStream str("["); for (ui32 i = 0; i < BlobsToGet.size(); ++i) { str << (i ? " " : "") diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_responsiveness.h b/ydb/core/blobstorage/dsproxy/dsproxy_responsiveness.h index c0b01b06d17..ac57f689cbf 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_responsiveness.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_responsiveness.h @@ -23,7 +23,7 @@ namespace NKikimr { until.ToString().data()); } }; - THashMap<TDiskId, TInfo> DiskData; + THashMap<TDiskId, TInfo> DiskData; }; using TPerDiskStatsPtr = TIntrusivePtr<TPerDiskStats>; @@ -41,7 +41,7 @@ namespace NKikimr { const ui32 MaxItems; const TDuration Window; - THashMap<TDiskId, TDeque<TItem>> PerDiskQ; + THashMap<TDiskId, TDeque<TItem>> PerDiskQ; public: TDiskResponsivenessTracker(ui32 maxItems, TDuration window) @@ -69,7 +69,7 @@ namespace NKikimr { auto &q = diskIt->second; // find the 90-th percentile for this disk - TVector<TDuration> values; + TVector<TDuration> values; values.reserve(q.size()); for (const TItem &item : q) { values.push_back(item.Value); diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_timestats.h b/ydb/core/blobstorage/dsproxy/dsproxy_timestats.h index 943b93858df..11bb1ab6959 100644 --- a/ydb/core/blobstorage/dsproxy/dsproxy_timestats.h +++ b/ydb/core/blobstorage/dsproxy/dsproxy_timestats.h @@ -24,7 +24,7 @@ class TBlobStorageGroupProxyTimeStats { }; TDuration& AggrTime; - TDeque<TQueueItem> Queue; + TDeque<TQueueItem> Queue; public: TTimeSeries(TDuration& aggrTime) @@ -44,14 +44,14 @@ class TBlobStorageGroupProxyTimeStats { void MergeIn(TTimeSeries&& other) { if (!other.Queue.empty()) { - TDeque<TQueueItem> res; + TDeque<TQueueItem> res; std::set_union(Queue.begin(), Queue.end(), other.Queue.begin(), other.Queue.end(), std::back_inserter(res), TCompare()); Queue.swap(res); } } - const TDeque<TQueueItem>& GetVector() const { + const TDeque<TQueueItem>& GetVector() const { return Queue; } }; @@ -79,8 +79,8 @@ private: TDuration AggrTime; double Percentile; bool Enabled; - TVector<std::pair<ui32, TTimeSeries<TPutInfo>>> Puts; - TVector<std::pair<ui32, TTimeSeries<THugePutInfo>>> HugePuts; + TVector<std::pair<ui32, TTimeSeries<TPutInfo>>> Puts; + TVector<std::pair<ui32, TTimeSeries<THugePutInfo>>> HugePuts; public: TBlobStorageGroupProxyTimeStats(TDuration aggrTime = TDuration::Seconds(5)) @@ -97,17 +97,17 @@ public: } void ApplyPut(ui32 size, const NKikimrBlobStorage::TExecTimeStats& execTimeStats) { - TInstant submitTimestamp = TInstant::MicroSeconds(execTimeStats.GetSubmitTimestamp()); + TInstant submitTimestamp = TInstant::MicroSeconds(execTimeStats.GetSubmitTimestamp()); TInstant now = TAppData::TimeProvider->Now(); TDuration rtt = now - submitTimestamp; THugePutInfo info; - info.InSenderQueue = TDuration::MicroSeconds(execTimeStats.GetInSenderQueue()); - info.Total = TDuration::MicroSeconds(execTimeStats.GetTotal()); - info.InQueue = TDuration::MicroSeconds(execTimeStats.GetInQueue()); - info.Execution = TDuration::MicroSeconds(execTimeStats.GetExecution()); + info.InSenderQueue = TDuration::MicroSeconds(execTimeStats.GetInSenderQueue()); + info.Total = TDuration::MicroSeconds(execTimeStats.GetTotal()); + info.InQueue = TDuration::MicroSeconds(execTimeStats.GetInQueue()); + info.Execution = TDuration::MicroSeconds(execTimeStats.GetExecution()); info.RTT = rtt; - info.HugeWriteTime = TDuration::MicroSeconds(execTimeStats.GetHugeWriteTime()); + info.HugeWriteTime = TDuration::MicroSeconds(execTimeStats.GetHugeWriteTime()); if (execTimeStats.HasHugeWriteTime()) { auto it = std::upper_bound(HugePuts.begin(), HugePuts.end(), size, TCompareTimeSeries<TTimeSeries<THugePutInfo>>()); @@ -145,7 +145,7 @@ public: series.Update(now); \ const auto& v = series.GetVector(); \ using T = decltype(std::declval<std::decay<decltype(v)>::type::value_type::second_type>().NAME); \ - TVector<T> values; \ + TVector<T> values; \ values.reserve(v.size()); \ for (const auto& item : v) { \ values.push_back(item.second.NAME); \ @@ -265,7 +265,7 @@ public: void Submit(const TCgiParameters& cgi) { Enabled = cgi.Has("enabled"); if (cgi.Has("aggrTime")) { - TString param = cgi.Get("aggrTime"); + TString param = cgi.Get("aggrTime"); TDurationParser parser; if (parser.ParsePart(param.data(), param.size())) { AggrTime = parser.GetResult(AggrTime); diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_base.h b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_base.h index c4b5c76f39b..2b2744a5a46 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_base.h +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_base.h @@ -19,10 +19,10 @@ protected: const TIntrusivePtr<TBlobStorageGroupInfo>& Info; // a set of sets of failed disks that fit the fail model - TSet<TBlobStorageGroupInfo::TGroupVDisks> FaultsFittingFailModel; + TSet<TBlobStorageGroupInfo::TGroupVDisks> FaultsFittingFailModel; // a set of sets of failed disks that exceed the fail model - TSet<TBlobStorageGroupInfo::TGroupVDisks> FaultsExceedingFailModel; + TSet<TBlobStorageGroupInfo::TGroupVDisks> FaultsExceedingFailModel; const ui32 TestPartCount; const ui32 TestPartIdx; @@ -147,7 +147,7 @@ public: UNIT_ASSERT_VALUES_EQUAL(PutWithResult(id, buffer, tactic), expectedStatus); } - void CheckBlob(const TLogoBlobID& id, bool mustRestoreFirst, NKikimrProto::EReplyStatus status, const TString& buffer) { + void CheckBlob(const TLogoBlobID& id, bool mustRestoreFirst, NKikimrProto::EReplyStatus status, const TString& buffer) { TString data; NKikimrProto::EReplyStatus res = GetBlob(id, mustRestoreFirst, buffer ? &data : nullptr); UNIT_ASSERT_VALUES_EQUAL(res, status); diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h index 2e8df42324c..fcd932205b7 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_discover.h @@ -18,7 +18,7 @@ public: const ui32 numStepsPerGeneration = 3; for (ui32 i = 0; i < numGenerations; ++i) { for (ui32 j = 0; j < numStepsPerGeneration; ++j) { - TString data = Sprintf("%" PRIu32 "/%" PRIu32, i + 1, j + 1); + TString data = Sprintf("%" PRIu32 "/%" PRIu32, i + 1, j + 1); TLogoBlobID id(tabletId, i + 1, j + 1, 0, data.size(), 0); Put(id, data); lastBlobId = id; @@ -26,7 +26,7 @@ public: } // find the location of last blob - THashSet<TVDiskID> vdisksWithLastBlob; + THashSet<TVDiskID> vdisksWithLastBlob; for (const auto& pair : Runtime.VDisks) { auto ev = TEvBlobStorage::TEvVGet::CreateExtremeDataQuery(pair.first, TInstant::Max(), NKikimrBlobStorage::FastRead, TEvBlobStorage::TEvVGet::EFlags::None, {}, {lastBlobId}); diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_range.h b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_range.h index c055d68eabb..6a818ea40d7 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_range.h +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_range.h @@ -18,14 +18,14 @@ public: // Cerr << (TStringBuilder() << "]] " << disks.ToString() << Endl); for (ui32 generation = 1; generation <= 4; ++generation) { NKikimrProto::EReplyStatus expectedStatus = defaultExpectedStatus; - TVector<TEvBlobStorage::TEvRangeResult::TResponse> expectedResponse; + TVector<TEvBlobStorage::TEvRangeResult::TResponse> expectedResponse; ui32 statusMap = generation - 1; CTEST << "tabletId# " << tabletId << " generation# " << generation << " statusMap#"; for (ui32 step = 1; step <= 2; ++step) { - TString buffer = Sprintf("%256s/%" PRIu64 "/%" PRIu32 "/%" PRIu32, "kikimr", tabletId, generation, step); + TString buffer = Sprintf("%256s/%" PRIu64 "/%" PRIu32 "/%" PRIu32, "kikimr", tabletId, generation, step); TStringBuilder b; for (int i = 0; i < 1024; ++i) { b << 'a'; diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_runtime.h b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_runtime.h index bc33af4b86c..da718e5b1b6 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_runtime.h +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_fault_tolerance_ut_runtime.h @@ -51,7 +51,7 @@ public: NKikimrServices::EServiceKikimr_MAX, NKikimrServices::EServiceKikimr_Name ); -// TString explanation; +// TString explanation; // logSettings->SetLevel(NLog::PRI_DEBUG, NKikimrServices::BS_PROXY_GET, explanation); // logSettings->SetLevel(NLog::PRI_DEBUG, NActorsServices::TEST, explanation); diff --git a/ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp b/ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp index fdd7a92ea30..abb27623986 100644 --- a/ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp +++ b/ydb/core/blobstorage/dsproxy/ut/dsproxy_sequence_ut.cpp @@ -87,8 +87,8 @@ struct TGetRangeQuery { }; struct TGetRequest { - TVector<TGetQuery> Queries; - TVector<TGetRangeQuery> RangeQueries; + TVector<TGetQuery> Queries; + TVector<TGetRangeQuery> RangeQueries; TActorId Sender; TActorId ActorId; TVDiskID VDiskId; @@ -142,8 +142,8 @@ struct TVDiskState { TVDiskID VDiskId; ui64 LastCookie; ui64 InnerCookie; - TString Data; - TVector<ui64> QueryCookies; + TString Data; + TVector<ui64> QueryCookies; ui64 MsgId; ui64 SequenceId; bool IsValid; @@ -242,7 +242,7 @@ void SetPredictedDelaysForAllQueues(const THashMap<TVDiskID, ui32> &latencies) { } void SendVGetResult(ui32 vDiskIdx, NKikimrProto::EReplyStatus status, ui32 partId, - TVector<TVDiskState> &subgroup, TTestActorRuntime &runtime) { + TVector<TVDiskState> &subgroup, TTestActorRuntime &runtime) { TVDiskState *from = &subgroup[vDiskIdx]; @@ -275,7 +275,7 @@ void SendVGetResult(ui32 vDiskIdx, NKikimrProto::EReplyStatus status, ui32 partI } void SendVGetResult(ui32 blobIdx, ui32 vDiskIdx, NKikimrProto::EReplyStatus status, - TVector<TVector<TVDiskState>> &blobSubgroups, + TVector<TVector<TVDiskState>> &blobSubgroups, TMap<TActorId, TGetRequest> &lastRequest, TTestActorRuntime &runtime) { TGetRequest &request = lastRequest[blobSubgroups[blobIdx][vDiskIdx].ActorId]; if (!request.IsValid) { @@ -316,7 +316,7 @@ void SendVGetResult(ui32 blobIdx, ui32 vDiskIdx, NKikimrProto::EReplyStatus stat NKikimrProto::OK, request.VDiskId, TAppData::TimeProvider->Now(), 0, nullptr, nullptr, nullptr, nullptr, NWilson::TTraceId(), {}, 0U, 0U)); for (auto it = request.Queries.begin(); it != request.Queries.end(); ++it) { - TString data; + TString data; ui32 partIdx = 0; for (ui32 bIdx = 0; bIdx < blobSubgroups.size(); ++bIdx) { if (blobSubgroups[bIdx][0].LogoBlobId.IsSameBlob(it->LogoBlobId)) { @@ -373,7 +373,7 @@ void SendVPutResultEvent(TTestActorRuntime &runtime, TVDiskState &vdisk, NKikimr runtime.Send(new IEventHandle(vdisk.Sender, vdisk.ActorId, vPutResult.release(), 0, vdisk.LastCookie)); } -void PrepareBlobSubgroup(TLogoBlobID logoblobid, TString data, TVector<TVDiskState> &subgroup, +void PrepareBlobSubgroup(TLogoBlobID logoblobid, TString data, TVector<TVDiskState> &subgroup, TTestActorRuntime &runtime, TBlobStorageGroupType type) { TActorId proxy = MakeBlobStorageProxyID(GROUP_ID); TActorId sender = runtime.AllocateEdgeActor(0); @@ -754,10 +754,10 @@ Y_UNIT_TEST(TestGivenBlock42GetThenVGetResponseParts2523Nodata4ThenGetOk) { TActorId proxy = MakeBlobStorageProxyID(GROUP_ID); TActorId sender = runtime.AllocateEdgeActor(0); - TString data("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + TString data("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); TLogoBlobID logoblobid(1, 0, 0, 0, (ui32)data.size(), 0); - TVector<TVDiskState> subgroup; + TVector<TVDiskState> subgroup; PrepareBlobSubgroup(logoblobid, data, subgroup, runtime, type); runtime.Send(new IEventHandle(proxy, sender, new TEvBlobStorage::TEvGet(logoblobid, 0, 0, TInstant::Max(), @@ -982,11 +982,11 @@ Y_UNIT_TEST(TestGivenStripe42GetThenVGetResponsePartsNodata263451ThenGetOk) { TActorId proxy = MakeBlobStorageProxyID(GROUP_ID); TActorId sender = runtime.AllocateEdgeActor(0); - TString data; + TString data; data.resize(1209816, 'x'); TLogoBlobID logoblobid(0x10010000001000Bull, 5, 58949, 1, 1209816, 10); - TVector<TVDiskState> subgroup; + TVector<TVDiskState> subgroup; PrepareBlobSubgroup(logoblobid, data, subgroup, runtime, type); runtime.Send(new IEventHandle(proxy, sender, new TEvBlobStorage::TEvGet(logoblobid, 0, 0, TInstant::Max(), @@ -1028,11 +1028,11 @@ Y_UNIT_TEST(TestGivenStripe42WhenGet2PartsOfBlobThenGetOk) { TActorId proxy = MakeBlobStorageProxyID(GROUP_ID); TActorId sender = runtime.AllocateEdgeActor(0); - TString data; + TString data; data.resize(1209816, 'x'); - TVector<TLogoBlobID> logoblobids; - TVector<ui32> offsets; - TVector<ui32> sizes; + TVector<TLogoBlobID> logoblobids; + TVector<ui32> offsets; + TVector<ui32> sizes; logoblobids.push_back(TLogoBlobID(0x10010000001000Bull, 5, 58949, 1, 1209816, 10)); offsets.push_back(0); @@ -1042,7 +1042,7 @@ Y_UNIT_TEST(TestGivenStripe42WhenGet2PartsOfBlobThenGetOk) { offsets.push_back(1179648); sizes.push_back(100); - TVector<TVector<TVDiskState>> blobSubgroups; + TVector<TVector<TVDiskState>> blobSubgroups; blobSubgroups.resize(logoblobids.size()); TMap<TActorId, TGetRequest> lastRequest; @@ -1093,17 +1093,17 @@ Y_UNIT_TEST(TestGivenBlock42IntersectingPutWhenNodataOkThenOk) { TActorId proxy = MakeBlobStorageProxyID(GROUP_ID); TActorId sender = runtime.AllocateEdgeActor(0); - TString data; + TString data; data.resize(1000, 'x'); - TVector<TLogoBlobID> logoblobids; - TVector<ui32> offsets; - TVector<ui32> sizes; + TVector<TLogoBlobID> logoblobids; + TVector<ui32> offsets; + TVector<ui32> sizes; for (ui32 i = 0; i < 4; ++i) { logoblobids.push_back(TLogoBlobID(1, 1, 0, 0, (ui32)data.size(), 0)); offsets.push_back(100 + i); sizes.push_back(200); } - TVector<TVector<TVDiskState>> blobSubgroups; + TVector<TVector<TVDiskState>> blobSubgroups; blobSubgroups.resize(logoblobids.size()); TMap<TActorId, TGetRequest> lastRequest; @@ -1153,13 +1153,13 @@ Y_UNIT_TEST(TestGivenBlock42PutWhenPartialGetThenSingleDiskRequestOk) { TActorId proxy = MakeBlobStorageProxyID(GROUP_ID); TActorId sender = runtime.AllocateEdgeActor(0); - TString data; + TString data; data.resize(400 << 10); for (ui64 i = 0; i < data.size(); ++i) { *const_cast<char *>(data.data() + i) = (char)(i % 251); } TLogoBlobID logoblobid(1, 2, 3, 4, (ui32)data.size(), 5); - TVector<TVDiskState> blobSubgroup; + TVector<TVDiskState> blobSubgroup; PrepareBlobSubgroup(logoblobid, data, blobSubgroup, runtime, type); for (ui32 step = 0; step < 32; ++step) { @@ -1208,7 +1208,7 @@ Y_UNIT_TEST(TestGivenBlock42PutWhenPartialGetThenSingleDiskRequestOk) { // Send VGetResult TLogoBlobID id(query.LogoBlobId, query.LogoBlobId.PartId()); - TString resultData = blobSubgroup[query.LogoBlobId.PartId() - 1].Data.substr(query.Shift, query.Size); + TString resultData = blobSubgroup[query.LogoBlobId.PartId() - 1].Data.substr(query.Shift, query.Size); std::unique_ptr<TEvBlobStorage::TEvVGetResult> result( new TEvBlobStorage::TEvVGetResult( NKikimrProto::OK, theRequest.VDiskId, TAppData::TimeProvider->Now(), 0, nullptr, @@ -1229,8 +1229,8 @@ Y_UNIT_TEST(TestGivenBlock42PutWhenPartialGetThenSingleDiskRequestOk) { UNIT_ASSERT(getResult->ResponseSz == 1); UNIT_ASSERT_C(getResult->Responses[0].Status == NKikimrProto::OK, "Status# " << NKikimrProto::EReplyStatus_Name(getResult->Responses[0].Status)); - TString expectedData = data.substr(shift, size); - TString actualData = getResult->Responses[0].Buffer; + TString expectedData = data.substr(shift, size); + TString actualData = getResult->Responses[0].Buffer; UNIT_ASSERT_STRINGS_EQUAL_C(expectedData, actualData, "ExpectedSize# " << expectedData.size() << " resultSize$ " << actualData.size() << " part# " << part << " disk# " << disk << " expectedFirst# " << (ui32) (ui8) expectedData[0] << " actualFirst# " << @@ -1262,13 +1262,13 @@ Y_UNIT_TEST(TestGivenBlock42Put6PartsOnOneVDiskWhenDiscoverThenRecoverFirst) { TActorId proxy = MakeBlobStorageProxyID(GROUP_ID); TActorId sender = runtime.AllocateEdgeActor(0); - TString data; + TString data; data.resize(400 << 10); for (ui64 i = 0; i < data.size(); ++i) { *const_cast<char *>(data.data() + i) = (char)(i / 1024); } TLogoBlobID logoblobid(1, 2, 3, 4, (ui32)data.size(), 5); - TVector<TVector<TVDiskState>> blobSubgroups; + TVector<TVector<TVDiskState>> blobSubgroups; blobSubgroups.resize(1); PrepareBlobSubgroup(logoblobid, data, blobSubgroups[0], runtime, type); diff --git a/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp b/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp index 13b1bec3563..1c4d98e230d 100644 --- a/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp +++ b/ydb/core/blobstorage/dsproxy/ut_fat/dsproxy_ut.cpp @@ -43,7 +43,7 @@ #include <util/folder/tempdir.h> #include <util/generic/algorithm.h> #include <util/generic/hash.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/random/mersenne.h> #include <util/random/random.h> @@ -110,7 +110,7 @@ static bool IsProfilerEnabled = true; TString TestData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); -static TString StatusToString(const NKikimrProto::EReplyStatus status) { +static TString StatusToString(const NKikimrProto::EReplyStatus status) { return NKikimrProto::EReplyStatus_Name(status); } @@ -230,10 +230,10 @@ protected: }; EMessage Message; NKikimrProto::EReplyStatus Status; - TVector<TString> Data; - TVector<NKikimrProto::EReplyStatus> ItemStatus; + TVector<TString> Data; + TVector<NKikimrProto::EReplyStatus> ItemStatus; TVector<TLogoBlobID> ItemIds; - TString Profile; + TString Profile; ui32 BlockedGeneration; bool LogoBlobsCompacted; TStorageStatusFlags StatusFlags; @@ -934,7 +934,7 @@ class TTestBlobStorageProxyBlock : public TTestBlobStorageProxy { TEST_RESPONSE(MessagePutResult, BLOCKED, 0, ""); VERBOSE_COUT(" Sending TEvPut"); - TString data = "aaa"; + TString data = "aaa"; TLogoBlobID logoblobid(1, 1, 0, 0, data.size(), 0); ctx.Send(Proxy, new TEvBlobStorage::TEvPut(logoblobid, data, TInstant::Max())); break; @@ -971,7 +971,7 @@ class TTestBlobStorageProxyBlock : public TTestBlobStorageProxy { break; case 80: { - TString data = "aaa"; + TString data = "aaa"; UNIT_ASSERT_EQUAL_C(LastResponse.Message, TResponseData::MessageDiscoverResult, "Unexpected message " << (int)LastResponse.Message); UNIT_ASSERT_EQUAL_C(LastResponse.Status, NKikimrProto::OK, "Unexpected status " @@ -1008,7 +1008,7 @@ public: class TTestBlobStorageProxyPut : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); switch (TestStep) { case 0: @@ -1083,7 +1083,7 @@ public: class TTestBlobStorageProxyPutFail : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); switch (TestStep) { case 0: @@ -1118,7 +1118,7 @@ public: class TTestBlobStorageProxyGet : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); switch (TestStep) { case 0: @@ -1223,8 +1223,8 @@ public: }; class TTestBlobStorageProxyPutGetMany: public TTestBlobStorageProxy { - TString Prepare(ui64 idx, ui64 size) { - TString data; + TString Prepare(ui64 idx, ui64 size) { + TString data; data.resize(size); ui8 *d = (ui8*)const_cast<char*>(data.data()); for (ui64 i = 0; i < size; ++i) { @@ -1256,7 +1256,7 @@ class TTestBlobStorageProxyPutGetMany: public TTestBlobStorageProxy { if (TestStep < int(count)) { VERBOSE_COUT(" Sending TEvPut"); ui64 idx = TestStep; - TString data = Prepare(idx, size); + TString data = Prepare(idx, size); TLogoBlobID id(1, 2, 3, 4, size, idx); ctx.Send(Proxy, new TEvBlobStorage::TEvPut(id, data, TInstant::Max())); } else { @@ -1278,8 +1278,8 @@ public: }; class TTestBlobStorageProxyPutGetStatus: public TTestBlobStorageProxy { - TString Prepare(ui64 idx, ui64 size) { - TString data; + TString Prepare(ui64 idx, ui64 size) { + TString data; data.resize(size); ui8 *d = (ui8*)const_cast<char*>(data.data()); for (ui64 i = 0; i < size; ++i) { @@ -1354,7 +1354,7 @@ class TTestBlobStorageProxyPutGetStatus: public TTestBlobStorageProxy { if (TestStep < int(count)) { VERBOSE_COUT(" Sending TEvPut"); ui64 idx = TestStep; - TString data = Prepare(idx, size); + TString data = Prepare(idx, size); TLogoBlobID id(1, 2, 3, 4, size, idx); ctx.Send(Proxy, new TEvBlobStorage::TEvPut(id, data, TInstant::Max())); } else { @@ -1374,7 +1374,7 @@ template <int vDiskIdx> class TTestBlobStorageProxyVPutVGet : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); TLogoBlobID blobId(1, 0, 0, 0, testData2.size(), 0); TString encryptedTestData2; @@ -1444,7 +1444,7 @@ class TTestBlobStorageProxyVPutVGetLimit : public TTestBlobStorageProxy { int Iteration; void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); switch (TestStep) { case 0: @@ -1654,7 +1654,7 @@ template <int vDiskIdx, int partId, bool &isNoData> class TTestBlobStorageProxyVGet : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); TLogoBlobID id(1, 0, 0, 0, testData2.size(), 0, partId); @@ -1824,7 +1824,7 @@ public: class TTestBlobStorageProxyVBlockVPutVGet : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); - TString testData("xxx"); + TString testData("xxx"); TVDiskID vDiskId(0, 1, 0, 0, 0); switch (TestStep) { @@ -2238,8 +2238,8 @@ public: }; class TTestBlobStorageProxyGarbageCollectAfterLargeData : public TTestBlobStorageProxy { - TString Prepare(ui64 idx, ui64 size) { - TString data; + TString Prepare(ui64 idx, ui64 size) { + TString data; data.resize(size); ui8 *d = (ui8*)const_cast<char*>(data.data()); for (ui64 i = 0; i < size; ++i) { @@ -2260,7 +2260,7 @@ class TTestBlobStorageProxyGarbageCollectAfterLargeData : public TTestBlobStorag case 10: { TEST_RESPONSE(MessagePutResult, OK, 0, ""); - TString largeData = Prepare(0, 32 << 20); + TString largeData = Prepare(0, 32 << 20); VERBOSE_COUT(" Sending TEvPut"); TLogoBlobID logoblobid(1, 0, 1, 0, largeData.size(), 0); @@ -2308,9 +2308,9 @@ public: class TTestBlobStorageProxySimpleDiscover : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { - TString testData( + TString testData( "Server is a man with drinks, a click is a sound produced with fingers, a notebook is made of paper."); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); switch (TestStep) { @@ -2366,7 +2366,7 @@ public: class TTestBlobStorageProxyDiscover : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); switch (TestStep) { @@ -2551,11 +2551,11 @@ class TTestBlobStorageProxyLongTailDiscoverPut : public TTestBlobStorageProxy { } void TestFSM(const TActorContext &ctx) { - TString testData( + TString testData( "Server is a man with drinks, a click is a sound produced with fingers, a notebook is made of paper."); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); - TString testData3( + TString testData3( "Test data for direct VDisk put operations 1234567890."); VERBOSE_COUT("Test step# " << TestStep << " Iteration# " << Iteration << " Line " << __LINE__); bool isFirstFallthrough = false; @@ -2685,11 +2685,11 @@ public: class TTestBlobStorageProxyLongTailDiscover : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { - TString testData( + TString testData( "Server is a man with drinks, a click is a sound produced with fingers, a notebook is made of paper."); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); - TString testData3( + TString testData3( "Test data for direct VDisk put operations 1234567890."); VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); switch (TestStep) { @@ -2728,7 +2728,7 @@ public: class TTestBlobStorageProxyPartialGet : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { - TString testData( + TString testData( "Server is a man with drinks, a click is a sound produced with fingers, a notebook is made of paper."); TLogoBlobID logoblobid(1, 0, 0, 0, testData.size(), 0); VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); @@ -2748,21 +2748,21 @@ class TTestBlobStorageProxyPartialGet : public TTestBlobStorageProxy { NKikimrBlobStorage::EGetHandleClass::FastRead)); break; case 20: - TEST_RESPONSE(MessageGetResult, OK, 1, TString(testData, 7, 11)); + TEST_RESPONSE(MessageGetResult, OK, 1, TString(testData, 7, 11)); VERBOSE_COUT(" Sending TEvGet shift 0 size 11"); ctx.Send(Proxy, new TEvBlobStorage::TEvGet(logoblobid, 0, 11, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::FastRead)); break; case 30: - TEST_RESPONSE(MessageGetResult, OK, 1, TString(testData, 0, 11)); + TEST_RESPONSE(MessageGetResult, OK, 1, TString(testData, 0, 11)); VERBOSE_COUT(" Sending TEvGet shift 7 size 0"); ctx.Send(Proxy, new TEvBlobStorage::TEvGet(logoblobid, 7, 0, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::FastRead)); break; case 40: - TEST_RESPONSE(MessageGetResult, OK, 1, TString(testData, 7, testData.size() - 7)); + TEST_RESPONSE(MessageGetResult, OK, 1, TString(testData, 7, testData.size() - 7)); VERBOSE_COUT("Done"); Env->DoneEvent.Signal(); @@ -2817,9 +2817,9 @@ public: class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { - TString testData( + TString testData( "Server is a man with drinks, a click is a sound produced with fingers, a notebook is made of paper."); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); bool isFirstFallthrough = false; @@ -3050,7 +3050,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { case 210: { if (!Env->ShouldBeUnwritable) { - TEST_RESPONSE(MessageGetResult, OK, 1, TString(testData, 7, 11)); + TEST_RESPONSE(MessageGetResult, OK, 1, TString(testData, 7, 11)); } // Put. TLogoBlobID logoblobid(1, 10/*generation*/, 0, 0, testData2.size(), 0); @@ -3120,7 +3120,7 @@ class TTestBlobStorageProxyBasic1 : public TTestBlobStorageProxy { TEST_RESPONSE(MessageDiscoverResult, NODATA, 0, ""); } VERBOSE_COUT(" Sending TEvPut"); - TString putData = TString::Uninitialized(1 << 18); + TString putData = TString::Uninitialized(1 << 18); memset(const_cast<char*>(putData.data()), 1, putData.size()); TLogoBlobID logoblobid(1, 11, 0, 0, putData.size(), 0); @@ -3164,7 +3164,7 @@ public: class TTestGetMultipart : public TTestBlobStorageProxy { void TestFSM(const TActorContext &ctx) { VERBOSE_COUT("Test step " << TestStep << " Line " << __LINE__); - TString testData2( + TString testData2( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born.."); switch (TestStep) { case 0: @@ -3805,8 +3805,8 @@ public: SectorMapByPath.clear(); } - void RemoveVDiskData(ui32 vDiskIdx, TString directory) { - TString databaseDirectory = Sprintf("%s/vdisk_%d", directory.c_str(), vDiskIdx); + void RemoveVDiskData(ui32 vDiskIdx, TString directory) { + TString databaseDirectory = Sprintf("%s/vdisk_%d", directory.c_str(), vDiskIdx); auto it = SectorMapByPath.begin(); while (it != SectorMapByPath.end()) { auto next = it; @@ -4166,8 +4166,8 @@ public: TIntrusivePtr<TTableNameserverSetup> nameserverTable(new TTableNameserverSetup()); TPortManager pm; - nameserverTable->StaticNodeTable[1] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12001)); - nameserverTable->StaticNodeTable[2] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12002)); + nameserverTable->StaticNodeTable[1] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12001)); + nameserverTable->StaticNodeTable[2] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12002)); TIntrusivePtr<TBlobStorageGroupInfo> bsInfo(new TBlobStorageGroupInfo(args.ErasureSpecies, env->DrivesPerFailDomain, env->FailDomainCount, 1, &env->VDisks)); @@ -4203,7 +4203,7 @@ public: if (!args.StartBadDisks && isBad) { continue; } - TString databaseDirectory = Sprintf(isBad ? "%s/vdisk_bad_%d" : "%s/vdisk_%d", + TString databaseDirectory = Sprintf(isBad ? "%s/vdisk_bad_%d" : "%s/vdisk_%d", (dir ? dir : tempDir().c_str()), i); MakeDirIfNotExist(databaseDirectory.c_str()); @@ -4213,7 +4213,7 @@ public: ui64 diskSizeBytes = 32ull << 30ull; ui64 pDiskCategory = 0; TActorId pdiskId = env->PDisks[i]; - TString filePath = databaseDirectory + "/pdisk.dat"; + TString filePath = databaseDirectory + "/pdisk.dat"; if (!SectorMapByPath[filePath]) { SectorMapByPath[filePath].Reset(new NPDisk::TSectorMap(diskSizeBytes)); FormatPDisk(filePath, diskSizeBytes, 4 << 10, chunkSize, pDiskGuid, diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp index 054d5be6653..e509a5ee5c7 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.cpp @@ -513,7 +513,7 @@ TBlobStorageGroupInfo::IQuorumChecker *TBlobStorageGroupInfo::TTopology::CreateQ Y_FAIL(); } -TString TBlobStorageGroupInfo::TTopology::ToString() const { +TString TBlobStorageGroupInfo::TTopology::ToString() const { TStringStream str; str << "{GType# " << GType.ToString(); str << " FailRealms# {"; @@ -752,7 +752,7 @@ TVDiskID TBlobStorageGroupInfo::CreateVDiskID(const TVDiskIdShort &id) const { return TVDiskID(GroupID, GroupGeneration, id.FailRealm, id.FailDomain, id.VDisk); } -TString TBlobStorageGroupInfo::BlobStateToString(EBlobState state) { +TString TBlobStorageGroupInfo::BlobStateToString(EBlobState state) { switch (state) { case EBS_DISINTEGRATED: return "EBS_DISINTEGRATED"; @@ -869,7 +869,7 @@ const TBlobStorageGroupInfo::TFailDomain& TBlobStorageGroupInfo::GetFailDomain(u return Topology->GetFailDomain(failDomainOrderNumber); } -TString TBlobStorageGroupInfo::ToString() const { +TString TBlobStorageGroupInfo::ToString() const { TStringStream str; str << "{GroupID# " << GroupID; str << " GroupGeneration# " << GroupGeneration; @@ -930,8 +930,8 @@ bool TFailDomain::TLevelIds::operator==(const TLevelIds& other) const { } bool TFailDomain::TLevelIds::operator<(const TLevelIds& other) const { - TVector<ui8>::const_iterator a = Ids.begin(); - TVector<ui8>::const_iterator b = other.Ids.begin(); + TVector<ui8>::const_iterator a = Ids.begin(); + TVector<ui8>::const_iterator b = other.Ids.begin(); while (true) { if (a == Ids.end()) { if (b == other.Ids.end()) { @@ -956,15 +956,15 @@ bool TFailDomain::TLevelIds::operator<(const TLevelIds& other) const { TFailDomain::TFailDomain() { } -TFailDomain::TFailDomain(const TString &data) { +TFailDomain::TFailDomain(const TString &data) { ui8 *end = (ui8*)const_cast<char*>(data.data()) + (data.size() / RecordSize) * RecordSize; for (ui8 *cursor = (ui8*)const_cast<char*>(data.data()); cursor < end; cursor += RecordSize) { Levels[*cursor] = ReadUnaligned<ui32>((ui32*)(cursor + 1)); } } -TString TFailDomain::SerializeFailDomain() const { - TString data = TString::Uninitialized(RecordSize * Levels.size()); +TString TFailDomain::SerializeFailDomain() const { + TString data = TString::Uninitialized(RecordSize * Levels.size()); TLevels::const_iterator a = Levels.begin(); size_t offset = 0; while (a != Levels.end()) { @@ -988,7 +988,7 @@ TFailDomain::TLevelIds TFailDomain::MakeIds() const { TFailDomain::TLevelIds TFailDomain::Intersect(const TLevelIds &id) const { TLevelIds result; - TVector<ui8>::const_iterator a = id.Ids.begin(); + TVector<ui8>::const_iterator a = id.Ids.begin(); TLevels::const_iterator b = Levels.begin(); while (a != id.Ids.end() && b != Levels.end()) { if (*a == b->first) { @@ -1059,7 +1059,7 @@ bool TFailDomain::IsEqual(const TFailDomain &other) const { } bool TFailDomain::IsDifferentAt(const TLevelIds &id, const TFailDomain &other) const { - TVector<ui8>::const_iterator key = id.Ids.begin(); + TVector<ui8>::const_iterator key = id.Ids.begin(); TLevels::const_iterator a = Levels.begin(); TLevels::const_iterator b = other.Levels.begin(); @@ -1123,7 +1123,7 @@ bool TFailDomain::operator<(const TFailDomain &other) const { return false; } -TString TFailDomain::ToString() const { +TString TFailDomain::ToString() const { TStringBuilder builder; builder << "["; for (TLevels::const_iterator a = Levels.begin(); a != Levels.end(); ++a) { diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h index e2d1445be4e..667accec1bd 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo.h @@ -163,7 +163,7 @@ public: struct TFailDomain { // VDisks composing this fail domain - TVector<TVDiskInfo> VDisks; + TVector<TVDiskInfo> VDisks; // fail domain order number; domains are numbered continuously through all fail realms ui32 FailDomainOrderNumber = 0; @@ -171,14 +171,14 @@ public: struct TFailRealm { // fail domains contained in this fail realm - TVector<TFailDomain> FailDomains; + TVector<TFailDomain> FailDomains; }; struct TTopology { // group type (i.e. erasure) const TBlobStorageGroupType GType; // fail realms in this group - TVector<TFailRealm> FailRealms; + TVector<TFailRealm> FailRealms; // total number of fail domains in this group ui32 TotalFailDomains = 0; // total number of vdisks @@ -188,7 +188,7 @@ public: // quorum checker std::unique_ptr<IQuorumChecker> QuorumChecker; // map to quickly get (Short)VDisk id from its order number inside the group - TVector<TVDiskIdShort> VDiskIdForOrderNumber; + TVector<TVDiskIdShort> VDiskIdForOrderNumber; TTopology(TBlobStorageGroupType gtype); TTopology(TBlobStorageGroupType gtype, ui32 numFailRealms, ui32 numFailDomainsPerFailRealm, ui32 numVDisksPerFailDomain); @@ -258,7 +258,7 @@ public: TVDiskRange GetVDisks() const; EBlobState BlobState(ui32 effectiveReplicas, ui32 errorDomains) const; - TString ToString() const; + TString ToString() const; private: static IBlobToDiskMapper *CreateMapper(TBlobStorageGroupType gtype, const TTopology *topology); @@ -330,7 +330,7 @@ public: TVDiskID CreateVDiskID(const TVDiskIdShort &id) const; - static TString BlobStateToString(EBlobState); + static TString BlobStateToString(EBlobState); EBlobState BlobState(ui32 effectiveReplicas, ui32 errorDomains) const; void PickSubgroup(ui32 hash, TVDiskIds *outVDisk, TServiceIds *outServiceIds) const; bool BelongsToSubgroup(const TVDiskID &vdisk, ui32 hash) const; @@ -361,7 +361,7 @@ public: // get number of VDisks per fail domain ui32 GetNumVDisksPerFailDomain() const; - TString ToString() const; + TString ToString() const; TFailRealmIterator FailRealmsBegin() const; TFailRealmIterator FailRealmsEnd() const; @@ -434,7 +434,7 @@ private: // physical fail domain description struct TFailDomain { struct TLevelIds { - TVector<ui8> Ids; + TVector<ui8> Ids; TLevelIds(); bool IsEmpty() const; @@ -444,12 +444,12 @@ struct TFailDomain { static constexpr size_t RecordSize = sizeof(ui32) + sizeof(ui8); - typedef TMap<ui8, ui32> TLevels; + typedef TMap<ui8, ui32> TLevels; TLevels Levels; TFailDomain(); - TFailDomain(const TString &data); - TString SerializeFailDomain() const; + TFailDomain(const TString &data); + TString SerializeFailDomain() const; TLevelIds MakeIds() const; TLevelIds Intersect(const TLevelIds &id) const; bool IsColliding(const TFailDomain &other) const; @@ -457,7 +457,7 @@ struct TFailDomain { bool IsEqual(const TFailDomain &other) const; bool IsDifferentAt(const TLevelIds &id, const TFailDomain &other) const; bool operator<(const TFailDomain &other) const; - TString ToString() const; + TString ToString() const; TFailDomain Slice(ui32 level) const; }; diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_blobmap_ut.cpp b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_blobmap_ut.cpp index 9147c6a8715..86bc5c9b244 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_blobmap_ut.cpp +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_blobmap_ut.cpp @@ -9,7 +9,7 @@ namespace { struct TOriginalBlobStorageGroupInfo { ui32 BlobSubgroupSize; - TVector<TBlobStorageGroupInfo::TFailRealm> Realms; + TVector<TBlobStorageGroupInfo::TFailRealm> Realms; const ui32 GroupID; const ui32 GroupGeneration; TBlobStorageGroupInfo::TDynamicInfo DynamicInfo; @@ -103,7 +103,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoBlobMapTest) { const ui32 blobSubgroupSize = groupInfo->Type.BlobSubgroupSize(); TOriginalBlobStorageGroupInfo orig(blobSubgroupSize, *groupInfo); - TVector<TLogoBlobID> ids; + TVector<TLogoBlobID> ids; for (ui32 i = 0; i < 10000; ++i) { for (ui32 j = 0; j < 1000; ++j) { ids.emplace_back(i, 1, j, 1, 1000, 1); @@ -238,10 +238,10 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoBlobMapTest) { std::unique_ptr<IBlobToDiskMapper> mapper{IBlobToDiskMapper::CreateMirror3dcMapper(&groupInfo->GetTopology())}; - THashMap<TVDiskID, TVector<ui32>> usageMap; + THashMap<TVDiskID, TVector<ui32>> usageMap; for (const auto& vdisk : groupInfo->GetVDisks()) { auto vd = groupInfo->GetVDiskId(vdisk.OrderNumber); - usageMap.emplace(vd, TVector<ui32>(9)); + usageMap.emplace(vd, TVector<ui32>(9)); } TReallyFastRng32 rng(1); @@ -272,7 +272,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoBlobMapTest) { UNIT_ASSERT(vdisks[0].FailRealm != vdisks[2].FailRealm); UNIT_ASSERT(vdisks[1].FailRealm != vdisks[2].FailRealm); - THashMap<TVDiskID, ui32> disk2index; + THashMap<TVDiskID, ui32> disk2index; for (ui32 i = 0; i < vdisks.size(); ++i) { disk2index[vdisks[i]] = i; } @@ -290,7 +290,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoBlobMapTest) { } } - TVector<double> xv; + TVector<double> xv; for (const auto& kv : usageMap) { Cerr << kv.first.ToString() << "#"; for (ui32 i : kv.second) { diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter.h b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter.h index ecfdadffebd..ab4e09b57fb 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter.h +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter.h @@ -145,7 +145,7 @@ namespace NKikimr { }; class TBlobStorageGroupInfo::TFailRealmIterator - : public TBlobStorageGroupInfo::TIteratorBase<TVector<TFailRealm>::const_iterator, TRootIteratorBase, TFailRealmIterator> + : public TBlobStorageGroupInfo::TIteratorBase<TVector<TFailRealm>::const_iterator, TRootIteratorBase, TFailRealmIterator> , public std::iterator<std::bidirectional_iterator_tag, TFailRealm> { public: @@ -181,7 +181,7 @@ namespace NKikimr { }; class TBlobStorageGroupInfo::TFailDomainIterator - : public TBlobStorageGroupInfo::TIteratorBase<TVector<TFailDomain>::const_iterator, TFailRealmIterator, TFailDomainIterator> + : public TBlobStorageGroupInfo::TIteratorBase<TVector<TFailDomain>::const_iterator, TFailRealmIterator, TFailDomainIterator> , public std::iterator<std::bidirectional_iterator_tag, TFailDomain> { public: @@ -217,7 +217,7 @@ namespace NKikimr { }; class TBlobStorageGroupInfo::TVDiskIterator - : public TBlobStorageGroupInfo::TIteratorBase<TVector<TVDiskInfo>::const_iterator, TFailDomainIterator, TVDiskIterator> + : public TBlobStorageGroupInfo::TIteratorBase<TVector<TVDiskInfo>::const_iterator, TFailDomainIterator, TVDiskIterator> , public std::iterator<std::bidirectional_iterator_tag, TVDiskInfo> { public: diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter_ut.cpp b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter_ut.cpp index 3810d6ef988..a79ae6afc10 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter_ut.cpp +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_iter_ut.cpp @@ -3,7 +3,7 @@ using namespace NKikimr; -TIntrusivePtr<TBlobStorageGroupInfo> CreateTestGroupInfo(TVector<TVDiskID>& vdisks) { +TIntrusivePtr<TBlobStorageGroupInfo> CreateTestGroupInfo(TVector<TVDiskID>& vdisks) { TIntrusivePtr<TBlobStorageGroupInfo> info = new TBlobStorageGroupInfo(TBlobStorageGroupType::ErasureNone, 5, 10, 5); for (const TBlobStorageGroupInfo::TVDiskInfo& vdiskInfo : info->GetVDisks()) { vdisks.push_back(info->GetVDiskId(vdiskInfo.OrderNumber)); @@ -13,7 +13,7 @@ TIntrusivePtr<TBlobStorageGroupInfo> CreateTestGroupInfo(TVector<TVDiskID>& vdis Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoIterTest) { Y_UNIT_TEST(IteratorForward) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> vdisks; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroupInfo(vdisks); ui32 pos = 0; for (auto it = info->VDisksBegin(), end = info->VDisksEnd(); it != end; ++it, ++pos) { @@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoIterTest) { } Y_UNIT_TEST(IteratorBackward) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> vdisks; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroupInfo(vdisks); auto end = info->VDisksEnd(); auto it = end; @@ -35,7 +35,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoIterTest) { } Y_UNIT_TEST(IteratorForwardAndBackward) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> vdisks; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroupInfo(vdisks); ui32 pos = 0; for (auto it = info->VDisksBegin(), end = info->VDisksEnd(); it != end; ++it, ++pos) { @@ -53,10 +53,10 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoIterTest) { } Y_UNIT_TEST(PerRealmIterator) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> vdisks; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroupInfo(vdisks); for (auto realmIt = info->FailRealmsBegin(); realmIt != info->FailRealmsEnd(); ++realmIt) { - TVector<TVDiskID> vdisksInFailRealm; + TVector<TVDiskID> vdisksInFailRealm; for (const TVDiskID& vdisk : vdisks) { if (vdisk.FailRealm == realmIt.GetFailRealmIdx()) { vdisksInFailRealm.push_back(vdisk); @@ -80,11 +80,11 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoIterTest) { } Y_UNIT_TEST(PerFailDomainRange) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> vdisks; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroupInfo(vdisks); for (auto it = info->FailRealmsBegin(); it != info->FailRealmsEnd(); ++it) { for (auto domIt = it.FailRealmFailDomainsBegin(); domIt != it.FailRealmFailDomainsEnd(); ++domIt) { - TVector<TVDiskID> vdisksInDomain; + TVector<TVDiskID> vdisksInDomain; for (const TVDiskID& vdisk : vdisks) { if (vdisk.FailRealm == domIt.GetFailRealmIdx() && vdisk.FailDomain == domIt.GetFailDomainIdx()) { vdisksInDomain.push_back(vdisk); @@ -103,9 +103,9 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoIterTest) { } Y_UNIT_TEST(Domains) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> vdisks; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroupInfo(vdisks); - TVector<std::pair<ui32, ui32>> x1, x2; + TVector<std::pair<ui32, ui32>> x1, x2; for (auto it = info->FailRealmsBegin(); it != info->FailRealmsEnd(); ++it) { for (auto domIt = it.FailRealmFailDomainsBegin(); domIt != it.FailRealmFailDomainsEnd(); ++domIt) { x1.emplace_back(it.GetFailRealmIdx(), domIt.GetFailDomainIdx()); @@ -118,7 +118,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoIterTest) { } Y_UNIT_TEST(Indexes) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> vdisks; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroupInfo(vdisks); for (auto it = info->VDisksBegin(); it != info->VDisksEnd(); ++it) { UNIT_ASSERT_EQUAL(it->VDiskIdShort.FailRealm, it.GetFailRealmIdx()); @@ -128,7 +128,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoIterTest) { } Y_UNIT_TEST(WalkFailRealms) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> vdisks; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroupInfo(vdisks); ui32 num = 0; for (auto it = info->FailRealmsBegin(); it != info->FailRealmsEnd(); ++it) { diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_sets.h b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_sets.h index 132e0cce852..11761f05b72 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_sets.h +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_sets.h @@ -233,7 +233,7 @@ namespace NKikimr { } } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_ut.cpp b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_ut.cpp index e93d36aaa2c..a31e38f4e41 100644 --- a/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_ut.cpp +++ b/ydb/core/blobstorage/groupinfo/blobstorage_groupinfo_ut.cpp @@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoTest) { ui32 hash = 640480 + 13 * hashIdx; TBlobStorageGroupInfo::TVDiskIds vdiskIds; info.PickSubgroup(hash, &vdiskIds, nullptr); - TVector<bool> isMissingDomain; + TVector<bool> isMissingDomain; auto realm0 = info.FailRealmsBegin(); isMissingDomain.resize(realm0.GetNumFailDomainsPerFailRealm()); for (const auto& domain : realm0.GetFailRealmFailDomains()) { @@ -145,7 +145,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoTest) { const ui32 numMasks = 1U << numFailDomains; // calculate sets of disks - TVector<ui32> goodMask, badMask; + TVector<ui32> goodMask, badMask; for (ui32 mask = 0; mask < numMasks; ++mask) { (PopCount(mask) <= numHandoff ? goodMask : badMask).push_back(mask); } @@ -182,7 +182,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoTest) { return 1U << (realm * numFailDomains + domain); }; - TVector<ui32> goodMask; + TVector<ui32> goodMask; goodMask.push_back(0); @@ -216,12 +216,12 @@ Y_UNIT_TEST_SUITE(TBlobStorageGroupInfoTest) { std::sort(goodMask.begin(), goodMask.end()); // create bad mask - TVector<ui32> allMasks; + TVector<ui32> allMasks; for (ui32 i = 0; i < (1U << (numFailRealms * numFailDomains)); ++i) { allMasks.push_back(i); } - TVector<ui32> badMask; + TVector<ui32> badMask; std::set_difference(allMasks.begin(), allMasks.end(), goodMask.begin(), goodMask.end(), std::back_inserter(badMask)); auto createGroupVDisks = [&](ui32 domainMask) { diff --git a/ydb/core/blobstorage/incrhuge/defs.h b/ydb/core/blobstorage/incrhuge/defs.h index 9af83856597..81f713ac615 100644 --- a/ydb/core/blobstorage/incrhuge/defs.h +++ b/ydb/core/blobstorage/incrhuge/defs.h @@ -36,7 +36,7 @@ namespace NKikimr { return TChunkSerNum(Value + shift); } - TString ToString() const { + TString ToString() const { return Sprintf("%" PRIu64, Value); } diff --git a/ydb/core/blobstorage/incrhuge/incrhuge.h b/ydb/core/blobstorage/incrhuge/incrhuge.h index c2f5848e72e..b424ece48ba 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge.h @@ -44,9 +44,9 @@ namespace NKikimr { }; NKikimrProto::EReplyStatus Status; // operation status - TVector<TItem> Items; // a vector of items with matching LSN's + TVector<TItem> Items; // a vector of items with matching LSN's - TEvIncrHugeInitResult(NKikimrProto::EReplyStatus status, TVector<TItem>&& items) + TEvIncrHugeInitResult(NKikimrProto::EReplyStatus status, TVector<TItem>&& items) : Status(status) , Items(std::move(items)) {} @@ -72,10 +72,10 @@ namespace NKikimr { ui8 Owner; // the VDisk who writes the data ui64 Lsn; // non-transparent number from owner; compared to FirstLsn on init TBlobMetadata Meta; // non-transparent blob metadata - TString Data; // buffer with payload; should not be less that minimal blob size + TString Data; // buffer with payload; should not be less that minimal blob size TWritePayloadPtr Payload; // structure that is moved from request to response - TEvIncrHugeWrite(ui8 owner, ui64 lsn, const TBlobMetadata& meta, TString&& data, TWritePayloadPtr&& payload) + TEvIncrHugeWrite(ui8 owner, ui64 lsn, const TBlobMetadata& meta, TString&& data, TWritePayloadPtr&& payload) : Owner(owner) , Lsn(lsn) , Meta(meta) @@ -120,9 +120,9 @@ namespace NKikimr { // contains only requested part of blob. struct TEvIncrHugeReadResult : public NActors::TEventLocal<TEvIncrHugeReadResult, TEvBlobStorage::EvIncrHugeReadResult> { NKikimrProto::EReplyStatus Status; // operation status - TString Data; // requested blob data range + TString Data; // requested blob data range - TEvIncrHugeReadResult(NKikimrProto::EReplyStatus status, TString&& data) + TEvIncrHugeReadResult(NKikimrProto::EReplyStatus status, TString&& data) : Status(status) , Data(std::move(data)) {} @@ -140,9 +140,9 @@ namespace NKikimr { struct TEvIncrHugeDelete : public NActors::TEventLocal<TEvIncrHugeDelete, TEvBlobStorage::EvIncrHugeDelete> { ui8 Owner; // owner who wants to delete the data ui64 SeqNo; // sequence number; should increase for each query from the same client - TVector<TIncrHugeBlobId> Ids; // a vector of blobs user wants to delete + TVector<TIncrHugeBlobId> Ids; // a vector of blobs user wants to delete - TEvIncrHugeDelete(ui8 owner, ui64 seqNo, TVector<TIncrHugeBlobId>&& ids) + TEvIncrHugeDelete(ui8 owner, ui64 seqNo, TVector<TIncrHugeBlobId>&& ids) : Owner(owner) , SeqNo(seqNo) , Ids(std::move(ids)) diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_data.h b/ydb/core/blobstorage/incrhuge/incrhuge_data.h index d1a1318bce6..fd68827fd2b 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_data.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_data.h @@ -17,7 +17,7 @@ namespace NKikimr { return memcmp(&left, &right, sizeof(TBlobIndexRecord)) == 0; } - TString ToString() const { + TString ToString() const { return Sprintf("{Id# %016" PRIx64 " Lsn# %" PRIu64 " PayloadSize# %" PRIu32 " Owner# %" PRIu32 "}", Id, Lsn, PayloadSize, Owner); } @@ -42,10 +42,10 @@ namespace NKikimr { TBlobIndexRecord IndexRecord; // index record for this blob TChunkSerNum ChunkSerNum; // unique serial number of chunk this blob was written to - TString ExtractInplacePayload() const { + TString ExtractInplacePayload() const { const char *begin = reinterpret_cast<const char *>(this + 1); const char *end = begin + IndexRecord.PayloadSize; - return TString(begin, end); + return TString(begin, end); } }; #pragma pack(pop) diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_alloc.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_alloc.cpp index caaf0c7ca56..9b019c49f5e 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_alloc.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_alloc.cpp @@ -37,7 +37,7 @@ namespace NKikimr { } } - void TAllocator::ApplyAllocate(NKikimrProto::EReplyStatus status, TVector<TChunkIdx>&& chunks, + void TAllocator::ApplyAllocate(NKikimrProto::EReplyStatus status, TVector<TChunkIdx>&& chunks, const TActorContext& ctx) { if (status == NKikimrProto::OK) { // count these chunks as reserved, but not yet committed diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_alloc.h b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_alloc.h index ecef2a6c2ea..23b6a743ee5 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_alloc.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_alloc.h @@ -25,7 +25,7 @@ namespace NKikimr { // callback function that is invoked on chunk reservation success/failure; this function is called by keeper // on TEvChunkWriteResult event reception - void ApplyAllocate(NKikimrProto::EReplyStatus status, TVector<TChunkIdx>&& chunks, const TActorContext& ctx); + void ApplyAllocate(NKikimrProto::EReplyStatus status, TVector<TChunkIdx>&& chunks, const TActorContext& ctx); }; } // NIncrHuge diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_common.h b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_common.h index bc9f706f26b..59e0889fd1c 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_common.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_common.h @@ -92,7 +92,7 @@ namespace NKikimr { return left.AsTuple() < right.AsTuple(); } - TString ToString() const { + TString ToString() const { return Sprintf("{ChunkIdx# %" PRIu32 " OffsetInBlocks# %" PRIu32 " PayloadSize# %" PRIu32 " IndexInsideChunk# %" PRIu32 " Owner# %" PRIu32 " DeleteInProgress# %" PRIu32 "}", ChunkIdx, OffsetInBlocks, PayloadSize, IndexInsideChunk, Owner, DeleteInProgress); @@ -119,7 +119,7 @@ namespace NKikimr { return left.AsTuple() < right.AsTuple(); } - TString ToString() const { + TString ToString() const { return Sprintf("{ChunkIdx# %" PRIu32 " ChunkSerNum# %s Id# %016" PRIx64 " IndexInsideChunk# %" PRIu32 " SizeInBlocks# %" PRIu32 "}", ChunkIdx, ChunkSerNum.ToString().data(), Id, IndexInsideChunk, SizeInBlocks); @@ -162,7 +162,7 @@ namespace NKikimr { /////////////// // list of all chunks (including current one) - THashMap<TChunkIdx, TChunkInfo> Chunks; + THashMap<TChunkIdx, TChunkInfo> Chunks; ///////////////////////// // Writer shared state // @@ -174,7 +174,7 @@ namespace NKikimr { // write intent queue; contains a list of chunks we are going to fill in the near future; these all chunks // are confirmed, that is they have correspoding TCommitRecord successfully logged; each entry has // corresponding item in Chunks - TQueue<TChunkIdx> WriteIntentQueue; + TQueue<TChunkIdx> WriteIntentQueue; // is blob keeper ready? bool Ready = false; @@ -183,7 +183,7 @@ namespace NKikimr { ui32 InFlightWrites = 0; // set of defragmenter items being written right now - THashMap<TIncrHugeBlobId, bool> DefragWriteInProgress; + THashMap<TIncrHugeBlobId, bool> DefragWriteInProgress; // set of spawned children actors THashSet<TActorId> ChildActors; @@ -269,7 +269,7 @@ namespace NKikimr { TKeeper& Keeper; // log prefix - TString LogPrefix; + TString LogPrefix; public: TKeeperComponentBase(TKeeper& keeper, const char *name); @@ -298,7 +298,7 @@ namespace NKikimr { : public TEventLocal<TEvIncrHugeScanResult, TEvBlobStorage::EvIncrHugeScanResult> { NKikimrProto::EReplyStatus Status; - TVector<TBlobIndexRecord> Index; + TVector<TBlobIndexRecord> Index; TChunkIdx ChunkIdx; bool IndexOnly; TChunkSerNum ChunkSerNum; diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_defrag.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_defrag.cpp index 0cb43beb2ad..a125a7c9083 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_defrag.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_defrag.cpp @@ -235,7 +235,7 @@ namespace NKikimr { Y_VERIFY(Crc32c(&header.IndexRecord, totalSize - sizeof(ui32)) == header.Checksum); Y_VERIFY(header.IndexRecord == record); Y_VERIFY(header.ChunkSerNum == ChunkInProgressSerNum); - TString data = header.ExtractInplacePayload(); + TString data = header.ExtractInplacePayload(); // fill in delete locator with provided values TBlobDeleteLocator deleteLocator{chunkIdx, chunkSerNum, {}, index, sizeInBlocks}; diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_defrag.h b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_defrag.h index e6bb8355a4f..5ba1bda393c 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_defrag.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_defrag.h @@ -19,7 +19,7 @@ namespace NKikimr { TChunkSerNum ChunkInProgressSerNum; // index of current chunk - TVector<TBlobIndexRecord> Index; + TVector<TBlobIndexRecord> Index; ui32 IndexPos = 0; ui32 OffsetInBlocks = 0; diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_delete.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_delete.cpp index 141aa8f0b97..1058b9c7f91 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_delete.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_delete.cpp @@ -18,10 +18,10 @@ namespace NKikimr { const ui64 Cookie; const ui8 Owner; const ui64 SeqNo; - const TVector<TIncrHugeBlobId> Ids; + const TVector<TIncrHugeBlobId> Ids; ui32 NumDefragItems; // number of items being defragmented right now - TVector<TBlobDeleteLocator> DeleteLocators; + TVector<TBlobDeleteLocator> DeleteLocators; EItemState State; }; @@ -222,18 +222,18 @@ namespace NKikimr { }; // send request to logger - Keeper.Logger.LogBlobDeletes(item.Owner, item.SeqNo, TVector<TBlobDeleteLocator>(item.DeleteLocators), + Keeper.Logger.LogBlobDeletes(item.Owner, item.SeqNo, TVector<TBlobDeleteLocator>(item.DeleteLocators), MakeSimpleCallback(std::move(callback)), ctx); } // this function is called for items that were defragmented; a vector of delete locators contains metadata for // these items, but TIncrHugeBlobId's are zero to BadId as these items are not deleted from index -- they were // just moved - void TDeleter::DeleteDefrag(TVector<TBlobDeleteLocator>&& deleteLocators, const TActorContext& ctx) { + void TDeleter::DeleteDefrag(TVector<TBlobDeleteLocator>&& deleteLocators, const TActorContext& ctx) { // sort items std::sort(deleteLocators.begin(), deleteLocators.end()); // issue virtual log record to keep internal and log state consistent if delete chunk message is generated - Keeper.Logger.LogVirtualBlobDeletes(TVector<TBlobDeleteLocator>(deleteLocators), ctx); + Keeper.Logger.LogVirtualBlobDeletes(TVector<TBlobDeleteLocator>(deleteLocators), ctx); // execute actual deletion; this must be called after logging virtual delete record, because this function // may issue chunk deletions and they must be consistent with deletions -- chunks may only be dropped after // _ALL_ their blobs are marked deleted @@ -242,7 +242,7 @@ namespace NKikimr { // this function actually applies delete operations; it deletes items from index (if requested) and marks items // in chunks as deleted ones; this should be called only after successfully logging changes - void TDeleter::ProcessDeletedLocators(const TVector<TBlobDeleteLocator>& deleteLocators, bool deleteFromLookup, + void TDeleter::ProcessDeletedLocators(const TVector<TBlobDeleteLocator>& deleteLocators, bool deleteFromLookup, const TActorContext& ctx) { if (deleteFromLookup) { for (const TBlobDeleteLocator& deleteLocator : deleteLocators) { diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_delete.h b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_delete.h index ecc415f4bcb..78ffa74349e 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_delete.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_delete.h @@ -16,9 +16,9 @@ namespace NKikimr { std::array<ui64, 256> OwnerToSeqNo; struct TDeleteQueueItem; - using TDeleteQueue = TList<TDeleteQueueItem>; + using TDeleteQueue = TList<TDeleteQueueItem>; TDeleteQueue DeleteQueue; - THashMap<TIncrHugeBlobId, TDeleteQueue::iterator> WriteInProgress; + THashMap<TIncrHugeBlobId, TDeleteQueue::iterator> WriteInProgress; public: TDeleter(TKeeper& keeper); @@ -28,7 +28,7 @@ namespace NKikimr { void HandleDelete(TEvIncrHugeDelete::TPtr& ev, const TActorContext& ctx); // delete some locators generated while defragmenting - void DeleteDefrag(TVector<TBlobDeleteLocator>&& deleteLocators, const TActorContext& ctx); + void DeleteDefrag(TVector<TBlobDeleteLocator>&& deleteLocators, const TActorContext& ctx); // issue chunk deletion request after it is completely freed void IssueLogChunkDelete(TChunkIdx chunkIdx, const TActorContext& ctx); @@ -42,7 +42,7 @@ namespace NKikimr { void ProcessDeleteItem(TDeleteQueue::iterator it, const TActorContext& ctx); // post-log part of delete process (when log finished successfully) - void ProcessDeletedLocators(const TVector<TBlobDeleteLocator>& deleteLocators, bool deleteFromLookup, + void ProcessDeletedLocators(const TVector<TBlobDeleteLocator>& deleteLocators, bool deleteFromLookup, const TActorContext& ctx); }; diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.cpp index 62da8c0f7ef..1ff0552a584 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.cpp @@ -79,14 +79,14 @@ namespace NKikimr { return record; } - TString TChunkRecordMerger::Serialize(const NKikimrVDiskData::TIncrHugeChunks& record) { - TString data; + TString TChunkRecordMerger::Serialize(const NKikimrVDiskData::TIncrHugeChunks& record) { + TString data; bool status = record.SerializeToString(&data); Y_VERIFY(status); return data; } - TString TChunkRecordMerger::Serialize(const TChunkAllocation& record) { + TString TChunkRecordMerger::Serialize(const TChunkAllocation& record) { NKikimrVDiskData::TIncrHugeChunks protobuf; for (size_t i = 0; i < record.NewChunkIds.size(); ++i) { auto *c = protobuf.AddChunks(); @@ -98,13 +98,13 @@ namespace NKikimr { return Serialize(protobuf); } - TString TChunkRecordMerger::Serialize(const TChunkDeletion& record) { + TString TChunkRecordMerger::Serialize(const TChunkDeletion& record) { NKikimrVDiskData::TIncrHugeChunks protobuf; protobuf.AddDeletedChunks(record.ChunkIdx); return Serialize(protobuf); } - TString TChunkRecordMerger::Serialize(const TCompleteChunk& record) { + TString TChunkRecordMerger::Serialize(const TCompleteChunk& record) { NKikimrVDiskData::TIncrHugeChunks protobuf; auto *c = protobuf.AddChunks(); c->SetChunkIdx(record.ChunkIdx); @@ -145,7 +145,7 @@ namespace NKikimr { // second, serialize into string TStringStream stream; deletedItems.Save(&stream); - TString bits = stream.Str(); + TString bits = stream.Str(); // choose the best if (bits.size() < (size_t)items.ByteSize()) { @@ -269,14 +269,14 @@ namespace NKikimr { return record; } - TString TDeleteRecordMerger::Serialize(const NKikimrVDiskData::TIncrHugeDelete& record) { - TString data; + TString TDeleteRecordMerger::Serialize(const NKikimrVDiskData::TIncrHugeDelete& record) { + TString data; bool status = record.SerializeToString(&data); Y_VERIFY(status); return data; } - TString TDeleteRecordMerger::Serialize(const TBlobDeletes& record) { + TString TDeleteRecordMerger::Serialize(const TBlobDeletes& record) { NKikimrVDiskData::TIncrHugeDelete protobuf; if (record.Owner) { auto *owner = protobuf.AddOwners(); @@ -301,7 +301,7 @@ namespace NKikimr { return Serialize(protobuf); } - TString TDeleteRecordMerger::Serialize(const TDeleteChunk& /*record*/) { + TString TDeleteRecordMerger::Serialize(const TDeleteChunk& /*record*/) { Y_FAIL("this function should never be called"); } @@ -329,10 +329,10 @@ namespace NKikimr { TChunkRecordMerger::TCompleteChunk, NKikimrVDiskData::TIncrHugeChunks> Content; // commit chunks - TVector<TChunkIdx> CommitChunks; + TVector<TChunkIdx> CommitChunks; // delete chunks - TVector<TChunkIdx> DeleteChunks; + TVector<TChunkIdx> DeleteChunks; // callback to invoke upon completion std::unique_ptr<IEventCallback> Callback; @@ -371,9 +371,9 @@ namespace NKikimr { // CHUNKS HANDLING LOGIC //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void TLogger::LogChunkAllocation(TVector<TChunkIdx>&& newChunkIds, TChunkSerNum baseSerNum, + void TLogger::LogChunkAllocation(TVector<TChunkIdx>&& newChunkIds, TChunkSerNum baseSerNum, std::unique_ptr<IEventCallback>&& callback, const TActorContext& ctx) { - TVector<TChunkIdx> commitChunks(newChunkIds); + TVector<TChunkIdx> commitChunks(newChunkIds); ProcessChunkQueueItem(TChunkQueueItem{ TChunkRecordMerger::TChunkAllocation{std::move(newChunkIds), baseSerNum, Keeper.State.CurrentSerNum}, std::move(commitChunks), @@ -390,7 +390,7 @@ namespace NKikimr { ProcessChunkQueueItem(TChunkQueueItem{ TChunkRecordMerger::TChunkDeletion{chunkIdx, chunkSerNum, numItems}, {}, - TVector<TChunkIdx>{chunkIdx}, + TVector<TChunkIdx>{chunkIdx}, std::move(callback), IssueChunksStartingPoint, {}, @@ -530,7 +530,7 @@ namespace NKikimr { // DELETE RECORDS PROCESSING LOGIC //////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void TLogger::LogBlobDeletes(ui8 owner, ui64 seqNo, TVector<TBlobDeleteLocator>&& deleteLocators, + void TLogger::LogBlobDeletes(ui8 owner, ui64 seqNo, TVector<TBlobDeleteLocator>&& deleteLocators, std::unique_ptr<IEventCallback>&& callback, const TActorContext& ctx) { // check that locators are sorted and do not repeat Y_VERIFY(std::is_sorted(deleteLocators.begin(), deleteLocators.end())); @@ -568,7 +568,7 @@ namespace NKikimr { } } - void TLogger::LogVirtualBlobDeletes(TVector<TBlobDeleteLocator>&& deleteLocators, const TActorContext& ctx) { + void TLogger::LogVirtualBlobDeletes(TVector<TBlobDeleteLocator>&& deleteLocators, const TActorContext& ctx) { // check that locators are sorted and do not repeat Y_VERIFY(std::is_sorted(deleteLocators.begin(), deleteLocators.end())); Y_VERIFY(std::adjacent_find(deleteLocators.begin(), deleteLocators.end()) == deleteLocators.end()); diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.h b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.h index bbb566f634e..d302343b27a 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_log.h @@ -19,12 +19,12 @@ namespace NKikimr { NKikimrVDiskData::TIncrHugeChunks::EChunkState State; }; - THashMap<TChunkIdx, TChunkInfo> Chunks; + THashMap<TChunkIdx, TChunkInfo> Chunks; TMaybe<TChunkSerNum> CurrentSerNum; public: struct TChunkAllocation { - TVector<TChunkIdx> NewChunkIds; + TVector<TChunkIdx> NewChunkIds; TChunkSerNum BaseSerNum; TChunkSerNum CurrentSerNum; }; @@ -47,21 +47,21 @@ namespace NKikimr { void operator ()(const TCompleteChunk& record); NKikimrVDiskData::TIncrHugeChunks GetCurrentState() const; - static TString Serialize(const NKikimrVDiskData::TIncrHugeChunks& record); - static TString Serialize(const TChunkAllocation& record); - static TString Serialize(const TChunkDeletion& record); - static TString Serialize(const TCompleteChunk& record); + static TString Serialize(const NKikimrVDiskData::TIncrHugeChunks& record); + static TString Serialize(const TChunkAllocation& record); + static TString Serialize(const TChunkDeletion& record); + static TString Serialize(const TCompleteChunk& record); }; class TDeleteRecordMerger { - THashMap<ui8, ui64> OwnerToSeqNo; - THashMap<TChunkSerNum, TDynBitMap> SerNumToChunk; + THashMap<ui8, ui64> OwnerToSeqNo; + THashMap<TChunkSerNum, TDynBitMap> SerNumToChunk; public: struct TBlobDeletes { ui8 Owner; ui64 SeqNo; - TVector<TBlobDeleteLocator> DeleteLocators; + TVector<TBlobDeleteLocator> DeleteLocators; }; // delete chunk -- a pure virtual record that is never written to real log @@ -76,9 +76,9 @@ namespace NKikimr { void operator ()(const TDeleteChunk& record); NKikimrVDiskData::TIncrHugeDelete GetCurrentState() const; - static TString Serialize(const NKikimrVDiskData::TIncrHugeDelete& record); - static TString Serialize(const TBlobDeletes& record); - static TString Serialize(const TDeleteChunk& record); + static TString Serialize(const NKikimrVDiskData::TIncrHugeDelete& record); + static TString Serialize(const TBlobDeletes& record); + static TString Serialize(const TDeleteChunk& record); }; class TLogger @@ -97,14 +97,14 @@ namespace NKikimr { bool IssueChunksStartingPoint = false; // accumulated list of allocated chunks waiting for commit - TVector<TChunkIdx> PendingCleanChunks; + TVector<TChunkIdx> PendingCleanChunks; ///////////////////////////// // Chunk record operations // ///////////////////////////// struct TChunkQueueItem; - using TChunkQueue = TList<TChunkQueueItem>; + using TChunkQueue = TList<TChunkQueueItem>; TChunkQueue ChunkQueue; TChunkQueue PendingChunkQueue; @@ -120,7 +120,7 @@ namespace NKikimr { ////////////////////////////// struct TDeleteQueueItem; - using TDeleteQueue = TList<TDeleteQueueItem>; + using TDeleteQueue = TList<TDeleteQueueItem>; TDeleteQueue DeleteQueue; // this merger contains confirmed state of deletes -- that is it includes all successfully completed delete @@ -156,7 +156,7 @@ namespace NKikimr { // Chunks // //////////// - void LogChunkAllocation(TVector<TChunkIdx>&& newChunkIds, TChunkSerNum baseSerNum, + void LogChunkAllocation(TVector<TChunkIdx>&& newChunkIds, TChunkSerNum baseSerNum, std::unique_ptr<IEventCallback>&& callback, const TActorContext& ctx); // log deletion of chunk @@ -182,10 +182,10 @@ namespace NKikimr { // log deletion of some blobs; requests are executed one by one in FIFO order; locators should come in // sorted order - void LogBlobDeletes(ui8 owner, ui64 seqNo, TVector<TBlobDeleteLocator>&& deleteLocators, + void LogBlobDeletes(ui8 owner, ui64 seqNo, TVector<TBlobDeleteLocator>&& deleteLocators, std::unique_ptr<IEventCallback>&& callback, const TActorContext& ctx); - void LogVirtualBlobDeletes(TVector<TBlobDeleteLocator>&& deleteLocators, const TActorContext& ctx); + void LogVirtualBlobDeletes(TVector<TBlobDeleteLocator>&& deleteLocators, const TActorContext& ctx); // set initial state void SetInitialDeletesState(const NKikimrVDiskData::TIncrHugeDelete& record); diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_read.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_read.cpp index 62927ca8fe8..d3a4f83923a 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_read.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_read.cpp @@ -53,7 +53,7 @@ namespace NKikimr { Keeper.Deleter.IssueLogChunkDelete(chunkIdx, ctx); } - TString data; + TString data; NPDisk::TEvChunkReadResult& result = *static_cast<NPDisk::TEvChunkReadResult*>(msg); if (result.Data.IsReadable()) { data = result.Data.ToString(); diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_read.h b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_read.h index d6e104d7d79..ee3c45929c4 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_read.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_read.h @@ -20,7 +20,7 @@ namespace NKikimr { TActorId Sender; ui64 Cookie; }; - using TReadQueue = TQueue<TReadQueueItem>; + using TReadQueue = TQueue<TReadQueueItem>; TReadQueue ReadQueue; public: diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery.cpp index afdf92e80d7..3b3c48b8f5e 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery.cpp @@ -209,8 +209,8 @@ namespace NKikimr { } // parse filled chunks list - TMap<TChunkSerNum, TScanQueueItem> scanQueue; - THashMap<TChunkSerNum, TChunkInfo *> serNumToChunk; + TMap<TChunkSerNum, TScanQueueItem> scanQueue; + THashMap<TChunkSerNum, TChunkInfo *> serNumToChunk; for (const auto& chunk : msg.Chunks.GetChunks()) { Y_VERIFY(chunk.HasChunkIdx() && chunk.HasChunkSerNum() && chunk.HasState()); @@ -357,7 +357,7 @@ namespace NKikimr { // chunk with some data; calculate number of used blocks ui32 numUsedBlocks = 0; ui32 offsetInBlocks = 0; - TVector<TBlobDeleteLocator> deleteLocators; + TVector<TBlobDeleteLocator> deleteLocators; for (ui32 index = 0; index < scanResult.Index.size(); ++index) { const TBlobIndexRecord& record = scanResult.Index[index]; diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery.h b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery.h index 53463b80c90..db3f880c167 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery.h @@ -18,11 +18,11 @@ namespace NKikimr { ui64 FirstLsn; TActorId Sender; ui64 Cookie; - TQueue<std::pair<TChunkIdx, TChunkInfo *>> ScanQueue; - THashMap<TChunkIdx, TDynBitMap> DeletedItemsMap; - TVector<TEvIncrHugeInitResult::TItem> Items; + TQueue<std::pair<TChunkIdx, TChunkInfo *>> ScanQueue; + THashMap<TChunkIdx, TDynBitMap> DeletedItemsMap; + TVector<TEvIncrHugeInitResult::TItem> Items; }; - using TInitQueue = TList<TInitQueueItem>; + using TInitQueue = TList<TInitQueueItem>; TInitQueue InitQueue; struct TScanQueueItem { @@ -34,27 +34,27 @@ namespace NKikimr { return left.ChunkIdx < right.ChunkIdx; } }; - using TScanQueue = TQueue<TScanQueueItem>; + using TScanQueue = TQueue<TScanQueueItem>; TScanQueue ScanQueue; ui32 ScanBytesInFlight = 0; - THashMap<TChunkIdx, TDynBitMap> IntentChunksDeletedItems; + THashMap<TChunkIdx, TDynBitMap> IntentChunksDeletedItems; struct TScanResult { NKikimrProto::EReplyStatus Status; TChunkIdx ChunkIdx; bool IndexOnly; bool IndexValid; - TVector<TBlobIndexRecord> Index; + TVector<TBlobIndexRecord> Index; }; - TQueue<TChunkSerNum> ChunkSerNumQueue; - THashMap<TChunkSerNum, TScanResult> PendingResults; + TQueue<TChunkSerNum> ChunkSerNumQueue; + THashMap<TChunkSerNum, TScanResult> PendingResults; struct TIncompleteChunk { TChunkIdx ChunkIdx; ui32 OffsetInBlocks; - TVector<TBlobIndexRecord> Index; + TVector<TBlobIndexRecord> Index; }; - TMap<TChunkSerNum, TIncompleteChunk> IncompleteChunks; + TMap<TChunkSerNum, TIncompleteChunk> IncompleteChunks; struct TScanInfo { TInitQueue::iterator It; diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery_scan.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery_scan.cpp index eb60105861b..925f00468a5 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery_scan.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_recovery_scan.cpp @@ -42,7 +42,7 @@ namespace NKikimr { State.PDiskParams->OwnerRound, ChunkIdx, offset, size, NPriRead::HullLoad, nullptr)); } - void SendReplyAndDie(NKikimrProto::EReplyStatus status, TVector<TBlobIndexRecord>&& index, bool indexValid, + void SendReplyAndDie(NKikimrProto::EReplyStatus status, TVector<TBlobIndexRecord>&& index, bool indexValid, const TActorContext& ctx) { auto result = std::make_unique<TEvIncrHugeScanResult>(); result->Status = status; @@ -73,7 +73,7 @@ namespace NKikimr { bool ParseIndex(NPDisk::TEvChunkReadResult& msg, const TActorContext& ctx) { // try to get index - TVector<TBlobIndexRecord> index; + TVector<TBlobIndexRecord> index; if (!GetIndex(msg.Data, 0, index)) { return false; } @@ -83,7 +83,7 @@ namespace NKikimr { return true; } - bool GetIndex(TBufferWithGaps& data, ui32 offset, TVector<TBlobIndexRecord>& index) { + bool GetIndex(TBufferWithGaps& data, ui32 offset, TVector<TBlobIndexRecord>& index) { // check that we can read header if (!data.IsReadable(offset, sizeof(TBlobIndexHeader))) { return false; @@ -112,7 +112,7 @@ namespace NKikimr { } bool ParseWholeChunk(NPDisk::TEvChunkReadResult& msg, const TActorContext& ctx) { - TVector<TBlobIndexRecord> index; + TVector<TBlobIndexRecord> index; for (ui32 block = 0; block < State.BlocksInDataSection; ) { ui32 offset = block * State.BlockSize; @@ -146,7 +146,7 @@ namespace NKikimr { } // try to get stored index and check if it the same as computed one - TVector<TBlobIndexRecord> storedIndex; + TVector<TBlobIndexRecord> storedIndex; const bool indexValid = GetIndex(msg.Data, State.BlocksInDataSection * State.BlockSize, storedIndex) && index == storedIndex; diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_write.cpp b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_write.cpp index ca6cedf5d8f..93ad734eda0 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_write.cpp +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_write.cpp @@ -34,7 +34,7 @@ namespace NKikimr { TBlobMetadata Meta; // data to write - TString Data; + TString Data; // event payload which will be moved to response TWritePayloadPtr Payload; @@ -406,7 +406,7 @@ namespace NKikimr { return obsolete; } - void TWriter::SetUpCurrentChunk(ui32 offsetInBlocks, TVector<TBlobIndexRecord>&& index) { + void TWriter::SetUpCurrentChunk(ui32 offsetInBlocks, TVector<TBlobIndexRecord>&& index) { CurrentChunkOffsetInBlocks = offsetInBlocks; CurrentChunkIndex = std::move(index); } @@ -589,9 +589,9 @@ namespace NKikimr { return false; } - TVector<TEvIncrHugeInitResult::TItem> TWriter::EnumerateItems(ui8 owner, ui64 firstLsn) { - TVector<TEvIncrHugeInitResult::TItem> res; - auto scanChunk = [&](TChunkIdx chunkIdx, const TVector<TBlobIndexRecord>& index) { + TVector<TEvIncrHugeInitResult::TItem> TWriter::EnumerateItems(ui8 owner, ui64 firstLsn) { + TVector<TEvIncrHugeInitResult::TItem> res; + auto scanChunk = [&](TChunkIdx chunkIdx, const TVector<TBlobIndexRecord>& index) { auto it = Keeper.State.Chunks.find(chunkIdx); Y_VERIFY(it != Keeper.State.Chunks.end()); TChunkInfo& chunk = it->second; diff --git a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_write.h b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_write.h index 4563da6d542..55c76056a10 100644 --- a/ydb/core/blobstorage/incrhuge/incrhuge_keeper_write.h +++ b/ydb/core/blobstorage/incrhuge/incrhuge_keeper_write.h @@ -20,20 +20,20 @@ namespace NKikimr { ui32 CurrentChunkOffsetInBlocks = 0; // index of current chunk - TVector<TBlobIndexRecord> CurrentChunkIndex; + TVector<TBlobIndexRecord> CurrentChunkIndex; // number of in-flight blob write requests to current chunk ui32 CurrentChunkWritesInFlight = 0; // write queue struct TWriteQueueItem; - using TWriteQueue = TList<TWriteQueueItem>; + using TWriteQueue = TList<TWriteQueueItem>; TWriteQueue WriteQueue; // pending items TWriteQueue WriteInProgressItems; // items in work; they all are executed concurrently and may finish out-of-order // index write queue struct TIndexWriteQueueItem; - using TIndexWriteQueue = TList<TIndexWriteQueueItem>; + using TIndexWriteQueue = TList<TIndexWriteQueueItem>; TIndexWriteQueue IndexWriteQueue; // finalization chunk queue @@ -45,10 +45,10 @@ namespace NKikimr { bool IndexWritten = false; // index of chunk being finalized - TVector<TBlobIndexRecord> Index; + TVector<TBlobIndexRecord> Index; }; - THashMap<TChunkIdx, TFinalizingChunk> FinalizingChunks; + THashMap<TChunkIdx, TFinalizingChunk> FinalizingChunks; ui64 NextQueryId = 0; @@ -80,7 +80,7 @@ namespace NKikimr { const TActorContext& ctx); // reset writer to specified position (used in recovery) - void SetUpCurrentChunk(ui32 offsetInBlocks, TVector<TBlobIndexRecord>&& index); + void SetUpCurrentChunk(ui32 offsetInBlocks, TVector<TBlobIndexRecord>&& index); // check if item is obsolete bool IsObsolete(const TWriteQueueItem& item, const TActorContext& ctx); @@ -116,7 +116,7 @@ namespace NKikimr { // Client init // ///////////////// - TVector<TEvIncrHugeInitResult::TItem> EnumerateItems(ui8 owner, ui64 firstLsn); + TVector<TEvIncrHugeInitResult::TItem> EnumerateItems(ui8 owner, ui64 firstLsn); }; } // NIncrHuge diff --git a/ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp b/ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp index 59d3cb999cf..d782d445016 100644 --- a/ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp +++ b/ydb/core/blobstorage/incrhuge/ut/incrhuge_basic_ut.cpp @@ -24,7 +24,7 @@ using namespace NKikimr::NIncrHuge; class TTestEnv { public: TIntrusivePtr<NMonitoring::TDynamicCounters> Counters = new NMonitoring::TDynamicCounters; - TString Path; + TString Path; ui32 ChunkSize; ui64 DiskSize; ui64 PDiskGuid; @@ -50,7 +50,7 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // PDisk if (format) { - TString dir = TempDir(); + TString dir = TempDir(); Path = dir + "/incrhuge.bin"; TFsPath(Path).DeleteIfExists(); ChunkSize = chunkSize; @@ -106,7 +106,7 @@ public: NKikimrServices::EServiceKikimr_MAX, NKikimrServices::EServiceKikimr_Name ); - TString explanation; + TString explanation; logSettings->SetLevel(NLog::PRI_DEBUG, NKikimrServices::BS_INCRHUGE, explanation); logSettings->SetLevel(NLog::PRI_DEBUG, NActorsServices::TEST, explanation); diff --git a/ydb/core/blobstorage/incrhuge/ut/incrhuge_id_dict_ut.cpp b/ydb/core/blobstorage/incrhuge/ut/incrhuge_id_dict_ut.cpp index 0d66d7f13a5..69c5eff9f3b 100644 --- a/ydb/core/blobstorage/incrhuge/ut/incrhuge_id_dict_ut.cpp +++ b/ydb/core/blobstorage/incrhuge/ut/incrhuge_id_dict_ut.cpp @@ -5,7 +5,7 @@ using namespace NKikimr::NIncrHuge; Y_UNIT_TEST_SUITE(TIncrHugeBlobIdDict) { Y_UNIT_TEST(Basic) { - TVector<std::pair<TIncrHugeBlobId, ui8>> values; + TVector<std::pair<TIncrHugeBlobId, ui8>> values; auto callback = [&](TIncrHugeBlobId id, ui8 value) { values.emplace_back(id, value); }; diff --git a/ydb/core/blobstorage/incrhuge/ut/test_actor_concurrent.h b/ydb/core/blobstorage/incrhuge/ut/test_actor_concurrent.h index d7f370706fe..d14fcd38e3a 100644 --- a/ydb/core/blobstorage/incrhuge/ut/test_actor_concurrent.h +++ b/ydb/core/blobstorage/incrhuge/ut/test_actor_concurrent.h @@ -13,7 +13,7 @@ public: struct TWriteInfo { ui64 Lsn; TLogoBlobID LogoBlobId; - TString Data; + TString Data; friend bool operator <(const TWriteInfo& left, const TWriteInfo& right) { return left.Lsn < right.Lsn || (left.Lsn == right.Lsn && left.LogoBlobId < right.LogoBlobId); @@ -29,10 +29,10 @@ public: }; struct TTestActorState { - TMap<TIncrHugeBlobId, TBlobInfo> ConfirmedState; - TMap<std::pair<ui64, TLogoBlobID>, TBlobInfo> InFlightWrites; - TMap<TIncrHugeBlobId, TBlobInfo> InFlightDeletes; - THashMap<ui64, TBlobInfo> InFlightReads; + TMap<TIncrHugeBlobId, TBlobInfo> ConfirmedState; + TMap<std::pair<ui64, TLogoBlobID>, TBlobInfo> InFlightWrites; + TMap<TIncrHugeBlobId, TBlobInfo> InFlightDeletes; + THashMap<ui64, TBlobInfo> InFlightReads; ui64 Lsn = 0; ui64 BytesWritten = 0; TInstant StartTime = Now(); @@ -93,7 +93,7 @@ public: TEvIncrHugeInitResult *msg = ev->Get(); Y_VERIFY(msg->Status == NKikimrProto::OK); - TVector<TEvIncrHugeInitResult::TItem> referenceItems; + TVector<TEvIncrHugeInitResult::TItem> referenceItems; for (const auto& pair : State.ConfirmedState) { TBlobMetadata meta; memset(&meta, 0, sizeof(meta)); @@ -277,7 +277,7 @@ public: temp[pos] = Rng(); } - TString data(temp, len); + TString data(temp, len); // allocate LSN for new record ui64 lsn = State.Lsn++; diff --git a/ydb/core/blobstorage/incrhuge/ut/test_actor_seq.h b/ydb/core/blobstorage/incrhuge/ut/test_actor_seq.h index 9bf87cbd1b7..a5f2f6da44a 100644 --- a/ydb/core/blobstorage/incrhuge/ut/test_actor_seq.h +++ b/ydb/core/blobstorage/incrhuge/ut/test_actor_seq.h @@ -5,13 +5,13 @@ public: struct TBlobInfo { TLogoBlobID LogoBlobId; ui64 Lsn; - TString Data; + TString Data; TIncrHugeBlobId Id; }; struct TTestActorState { // a set of blobs that were written and confirmed - TMap<ui64, TBlobInfo> ConfirmedState; + TMap<ui64, TBlobInfo> ConfirmedState; TMaybe<TIncrHugeBlobId> DeleteRequest; TMaybe<TBlobInfo> WriteRequest; ui64 Lsn = 0; @@ -146,7 +146,7 @@ public: } if (option < writeScore) { ui32 len = Rng() % (MaxLen - MinLen + 1) + MinLen; - TString data; + TString data; data.resize(len); ui32 pattern = Rng(); ui32 i; diff --git a/ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.cpp b/ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.cpp index 0f6a440f57f..910a976ff38 100644 --- a/ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.cpp +++ b/ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.cpp @@ -8,7 +8,7 @@ LWTRACE_DEFINE_PROVIDER(FAIL_INJECTION_PROVIDER); namespace NKikimr { namespace NPDisk { -void TRequestTypeField::ToString(ui32 value, TString *out) { +void TRequestTypeField::ToString(ui32 value, TString *out) { switch(ERequestType(value)) { case ERequestType::RequestLogRead: *out = "LogRead"; break; case ERequestType::RequestLogWrite: *out = "LogWrite"; break; diff --git a/ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.h b/ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.h index 7e20a7bd81a..9d7ce843f44 100644 --- a/ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.h +++ b/ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.h @@ -9,7 +9,7 @@ struct TPDiskIdField { typedef ui32 TStoreType; typedef ui32 TFuncParam; - static void ToString(ui32 value, TString* out) { + static void ToString(ui32 value, TString* out) { *out = Sprintf("%09" PRIu32, value); } static ui32 ToStoreType(ui32 value) { @@ -23,7 +23,7 @@ struct TRequestTypeField { typedef ui32 TStoreType; typedef ui32 TFuncParam; - static void ToString(ui32 value, TString* out); + static void ToString(ui32 value, TString* out); static ui32 ToStoreType(ui32 value) { return value; } @@ -129,10 +129,10 @@ struct TEventTypeField { TYPES(TPDiskIdField, ui64, double, double, bool, bool, ui64, ui64, NKikimr::NPDisk::TRequestTypeField), \ NAMES("pdisk", "reqId", "creationTimeSec", "costMs", "isSensitive", "isFast", "owner", "priorityClass", "type")) \ PROBE(PDiskFairSchedulerPush, GROUPS("PDisk", "PDiskRequest"), \ - TYPES(TPDiskIdField, ui64, TString, ui64, ui64, NKikimr::NPDisk::TRequestTypeField, ui64, double), \ + TYPES(TPDiskIdField, ui64, TString, ui64, ui64, NKikimr::NPDisk::TRequestTypeField, ui64, double), \ NAMES("pdisk", "reqId", "queueType", "owner", "priorityClass", "type", "fairQLA", "fairQCA")) \ PROBE(PDiskFairSchedulerPop, GROUPS("PDisk", "PDiskRequest"), \ - TYPES(TPDiskIdField, ui64, TString, ui64, ui64, NKikimr::NPDisk::TRequestTypeField, ui64, double, bool), \ + TYPES(TPDiskIdField, ui64, TString, ui64, ui64, NKikimr::NPDisk::TRequestTypeField, ui64, double, bool), \ NAMES("pdisk", "reqId", "queueType", "owner", "priorityClass", "type", "fairQLD", "fairQCD", "guarantyLost")) \ PROBE(PDiskInputRequestTimeout, GROUPS("PDisk", "PDiskRequest"), \ TYPES(TPDiskIdField, ui64, double), \ diff --git a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp index e3c74cce7b4..54e86413998 100644 --- a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp +++ b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp @@ -194,7 +194,7 @@ void SetupServices(TTestActorRuntime &runtime, TString extraPath, TIntrusivePtr< str << " }" << Endl; str << " }" << Endl; str << "}"; - TString staticConfig(str.Str()); + TString staticConfig(str.Str()); SubstGlobal(staticConfig, "$Node1", Sprintf("%" PRIu32, runtime.GetNodeId(0))); diff --git a/ydb/core/blobstorage/other/mon_get_blob_page.cpp b/ydb/core/blobstorage/other/mon_get_blob_page.cpp index 95308879a33..7f6e3ee367a 100644 --- a/ydb/core/blobstorage/other/mon_get_blob_page.cpp +++ b/ydb/core/blobstorage/other/mon_get_blob_page.cpp @@ -13,7 +13,7 @@ namespace { struct TRequestResult { TLogoBlobID LogoBlobId; NKikimrProto::EReplyStatus Status; - TString Buffer; + TString Buffer; TString DebugInfo; TVector<TEvBlobStorage::TEvGetResult::TPartMapItem> PartMap; }; @@ -77,7 +77,7 @@ namespace { TActorSystem *ActorSystem; public: - TMonGetBlobPage(const TString& path, TActorSystem *actorSystem) + TMonGetBlobPage(const TString& path, TActorSystem *actorSystem) : IMonPage(path) , ActorSystem(actorSystem) {} @@ -88,7 +88,7 @@ namespace { // parse HTTP request const TCgiParameters& params = request.GetParams(); - auto generateError = [&](const TString& msg) { + auto generateError = [&](const TString& msg) { out << "HTTP/1.1 400 Bad Request\r\n" << "Content-Type: text/plain\r\n" << "Connection: close\r\n" @@ -104,7 +104,7 @@ namespace { } TLogoBlobID logoBlobId; - TString errorExplanation; + TString errorExplanation; if (!params.Has("blob")) { return generateError("Missing blob parameter"); } else if (!TLogoBlobID::Parse(logoBlobId, params.Get("blob"), errorExplanation)) { @@ -324,7 +324,7 @@ namespace { } // anon -NMonitoring::IMonPage *CreateMonGetBlobPage(const TString& path, TActorSystem *actorSystem) { +NMonitoring::IMonPage *CreateMonGetBlobPage(const TString& path, TActorSystem *actorSystem) { return new TMonGetBlobPage(path, actorSystem); } diff --git a/ydb/core/blobstorage/other/mon_get_blob_page.h b/ydb/core/blobstorage/other/mon_get_blob_page.h index d822023ab78..4e888cadd49 100644 --- a/ydb/core/blobstorage/other/mon_get_blob_page.h +++ b/ydb/core/blobstorage/other/mon_get_blob_page.h @@ -6,6 +6,6 @@ namespace NKikimr { - NMonitoring::IMonPage *CreateMonGetBlobPage(const TString& path, TActorSystem *actorSystem); + NMonitoring::IMonPage *CreateMonGetBlobPage(const TString& path, TActorSystem *actorSystem); } // NKikimr diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp index d92b19c6cca..fce3394295d 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp @@ -69,7 +69,7 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> { TString StateErrorReason; TIntrusivePtr<TPDiskConfig> Cfg; TKey MainKey; - TList<TInitQueueItem> InitQueue; + TList<TInitQueueItem> InitQueue; const TIntrusivePtr<NMonitoring::TDynamicCounters> PDiskCounters; TIntrusivePtr<TPDisk> PDisk; bool IsMagicAlreadyChecked = false; @@ -143,7 +143,7 @@ class TPDiskActor : public TActorBootstrapped<TPDiskActor> { } }; private: - TVector<TSource> Sources; + TVector<TSource> Sources; NKikimrWhiteboard::EFlag LastFlag = NKikimrWhiteboard::Grey; public: void AddSource(const TLightBase& light) { @@ -260,7 +260,7 @@ public: // Init state void InitError(const TString &errorReason) { Become(&TThis::StateError); - for (TList<TInitQueueItem>::iterator it = InitQueue.begin(); it != InitQueue.end(); ++it) { + for (TList<TInitQueueItem>::iterator it = InitQueue.begin(); it != InitQueue.end(); ++it) { Send(it->Sender, new NPDisk::TEvYardInitResult(NKikimrProto::CORRUPTED, errorReason)); if (PDisk) { PDisk->Mon.YardInit.CountResponse(); @@ -457,7 +457,7 @@ public: void InitSuccess() { Become(&TThis::StateOnline); - for (TList<TInitQueueItem>::iterator it = InitQueue.begin(); it != InitQueue.end(); ++it) { + for (TList<TInitQueueItem>::iterator it = InitQueue.begin(); it != InitQueue.end(); ++it) { NPDisk::TEvYardInit evInit(it->OwnerRound, it->VDisk, it->PDiskGuid, it->CutLogId, it->WhiteboardProxyId, it->SlotId); auto* request = PDisk->ReqCreator.CreateFromEv<TYardInit>(evInit, it->Sender); diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp index 90816f5a22f..a81c3fc8f19 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_blockdevice_ut.cpp @@ -111,20 +111,20 @@ public: } }; -static TString MakeDatabasePath(const char *dir) { - TString databaseDirectory = Sprintf("%s/yard", dir); +static TString MakeDatabasePath(const char *dir) { + TString databaseDirectory = Sprintf("%s/yard", dir); return databaseDirectory; } -static TString MakePDiskPath(const char *dir) { - TString databaseDirectory = MakeDatabasePath(dir); +static TString MakePDiskPath(const char *dir) { + TString databaseDirectory = MakeDatabasePath(dir); return databaseDirectory + "/pdisk.dat"; } -TString CreateFile(const char *baseDir, ui32 dataSize) { - TString databaseDirectory = MakeDatabasePath(baseDir); +TString CreateFile(const char *baseDir, ui32 dataSize) { + TString databaseDirectory = MakeDatabasePath(baseDir); MakeDirIfNotExist(databaseDirectory.c_str()); - TString path = MakePDiskPath(baseDir); + TString path = MakePDiskPath(baseDir); { TFile file(path.c_str(), OpenAlways | RdWr | Seq | Direct); file.Resize(dataSize); @@ -252,7 +252,7 @@ Y_UNIT_TEST_SUITE(TBlockDeviceTest) { TAtomic counter = 0; TTempDir tempDir; - TString path = CreateFile(tempDir().c_str(), dataSize); + TString path = CreateFile(tempDir().c_str(), dataSize); { NPDisk::TAlignedData alignedBuffer; alignedBuffer.Resize(dataSize); diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_completion_impl.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_completion_impl.h index 2baba160c50..36b406ba943 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_completion_impl.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_completion_impl.h @@ -124,19 +124,19 @@ public: class TCompletionLogWrite : public TCompletionAction { TPDisk *PDisk; - TVector<TLogWrite*> LogWriteQueue; - TVector<TLogWrite*> Commits; - TVector<ui32> CommitedLogChunks; + TVector<TLogWrite*> LogWriteQueue; + TVector<TLogWrite*> Commits; + TVector<ui32> CommitedLogChunks; public: - TCompletionLogWrite(TPDisk *pDisk, TVector<TLogWrite*>&& logWriteQueue, TVector<TLogWrite*>&& commits, - TVector<ui32>&& commitedLogChunks) + TCompletionLogWrite(TPDisk *pDisk, TVector<TLogWrite*>&& logWriteQueue, TVector<TLogWrite*>&& commits, + TVector<ui32>&& commitedLogChunks) : PDisk(pDisk) , LogWriteQueue(std::move(logWriteQueue)) , Commits(std::move(commits)) , CommitedLogChunks(std::move(commitedLogChunks)) {} - TVector<ui32>* GetCommitedLogChunksPtr() { + TVector<ui32>* GetCommitedLogChunksPtr() { return &CommitedLogChunks; } diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_config.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_config.h index a3d764aa7e1..ab55aeacb51 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_config.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_config.h @@ -80,7 +80,7 @@ struct TPDiskSchedulerConfig { }; struct TPDiskConfig : public TThrRefBase { - TString Path; // set only by constructor + TString Path; // set only by constructor TString ExpectedPath; TString ExpectedSerial; NKikimrBlobStorage::TSerialManagementStage::E SerialManagementStage @@ -151,7 +151,7 @@ struct TPDiskConfig : public TThrRefBase { : TPDiskConfig({}, pDiskGuid, pdiskId, pDiskCategory) {} - TPDiskConfig(TString path, ui64 pDiskGuid, ui32 pdiskId, ui64 pDiskCategory) + TPDiskConfig(TString path, ui64 pDiskGuid, ui32 pdiskId, ui64 pDiskCategory) : Path(path) , PDiskGuid(pDiskGuid) , PDiskId(pdiskId) diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_data.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_data.h index 2b1350bff79..148b2b1380a 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_data.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_data.h @@ -96,7 +96,7 @@ struct TLogPageHeader { , Size(size) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Version# " << (ui32)Version << " Flags# "; @@ -236,7 +236,7 @@ struct TNonceJumpLogPageHeader2 { } } - TString ToString(bool isMultiline) { + TString ToString(bool isMultiline) { const char *x = isMultiline ? "\n" : ""; TStringStream str; str << "{TNonceJumpLogPageHeader2 Version# " << (ui32)Version << x; @@ -250,7 +250,7 @@ struct TNonceJumpLogPageHeader2 { for (ui32 r = 0; r < NONCE_JUMP_DLOG_RECORDS; ++r) { str << "r" << r; str << " pn" << PreviousNonces[r]; - str << " pi" << TInstant::MicroSeconds(PreviousInstants[r]).ToString(); + str << " pi" << TInstant::MicroSeconds(PreviousInstants[r]).ToString(); str << " {c"; for (ui32 c = 0; c < NONCE_JUMP_DLOG_CHUNKS; ++c) { if (c) { @@ -300,11 +300,11 @@ struct TNonceSet { : Version(PDISK_DATA_VERSION) {} - TString ToString() const { + TString ToString() const { return ToString(false); } - TString ToString(bool isMultiline) const { + TString ToString(bool isMultiline) const { TStringStream str; const char *x = isMultiline ? "\n" : ""; str << "{TNonceSet" << x; @@ -338,11 +338,11 @@ struct TSysLogRecord { } } - TString ToString() const { + TString ToString() const { return ToString(false); } - TString ToString(bool isMultiline) const { + TString ToString(bool isMultiline) const { TStringStream str; const char *x = isMultiline ? "\n" : ""; str << "{TSysLogRecord" << x; @@ -373,11 +373,11 @@ struct TSysLogFirstNoncesToKeep { } } - TString ToString() const { + TString ToString() const { return ToString(false); } - TString ToString(bool isMultiline) const { + TString ToString(bool isMultiline) const { TStringStream str; const char *x = isMultiline ? "\n" : ""; str << "{TSysLogFirstNoncesToKeep" << x; @@ -513,7 +513,7 @@ struct TDiskFormat { THash Hash; - TString FormatFlagsToString(ui64 flags) const { + TString FormatFlagsToString(ui64 flags) const { TStringStream str; bool isFirst = true; isFirst = NText::OutFlag(isFirst, flags == 0, "None", str); @@ -530,11 +530,11 @@ struct TDiskFormat { return str.Str(); } - TString ToString() const { + TString ToString() const { return ToString(false); } - TString ToString(bool isMultiline) const { + TString ToString(bool isMultiline) const { TStringStream str; const char *x = isMultiline ? "\n" : ""; str << "{TDiskFormat" << x; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_drivemodel.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_drivemodel.h index 2a0678dbd29..8525dff7001 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_drivemodel.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_drivemodel.h @@ -208,11 +208,11 @@ public: return 1000000000ULL / SeekTimeNsec; } - TString ToString() const { + TString ToString() const { return ToString(false); } - TString ToString(bool isMultiline) const { + TString ToString(bool isMultiline) const { TStringStream str; const char *x = isMultiline ? "\n" : ""; str << "{TDriveModel" << x; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp index d00fc0f2203..ec7641dd247 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp @@ -87,7 +87,7 @@ TPDisk::TPDisk(const TIntrusivePtr<TPDiskConfig> cfg, const TIntrusivePtr<NMonit JointCommits.reserve(16 << 10); } -TString TPDisk::DynamicStateToString(bool isMultiline) { +TString TPDisk::DynamicStateToString(bool isMultiline) { TStringStream str; const char *x = isMultiline ? "\n" : ""; str << "{PDiskDynamicState" << x; @@ -221,7 +221,7 @@ void TPDisk::InitFreeChunks() { } -TString TPDisk::StartupOwnerInfo() { +TString TPDisk::StartupOwnerInfo() { TStringStream str; str << "{"; TGuard<TMutex> guard(StateMutex); @@ -665,7 +665,7 @@ void TPDisk::AskVDisksToCutLogs(TOwner ownerFilter, bool doForce) { } else { InsaneLogChunks = 0; } - TMap<TOwner, ui64> lsnForOwner; + TMap<TOwner, ui64> lsnForOwner; TMap<TOwner, size_t> countForOwner; { size_t logChunkNumber = 0; @@ -989,9 +989,9 @@ TPDisk::EChunkReadPieceResult TPDisk::ChunkReadPiece(TIntrusivePtr<TChunkRead> & //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Chunk locking //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void TPDisk::ChunksLockByRange(TFreeChunks &freeChunks, ui32 begin, ui32 end, TVector<ui32> &lockedChunks) { +void TPDisk::ChunksLockByRange(TFreeChunks &freeChunks, ui32 begin, ui32 end, TVector<ui32> &lockedChunks) { ui32 freeChunksCount = freeChunks.Size(); - TVector<ui32> tmpChunks; + TVector<ui32> tmpChunks; tmpChunks.reserve(freeChunksCount); for (ui32 i = 0; i < freeChunksCount; ++i) { ui32 idx = freeChunks.Pop(); @@ -1011,9 +1011,9 @@ void TPDisk::ChunksLockByRange(TFreeChunks &freeChunks, ui32 begin, ui32 end, TV } } -void TPDisk::ChunksLockByNumber(ui32 begin, ui32 count, TVector<ui32> &lockedChunks) { +void TPDisk::ChunksLockByNumber(ui32 begin, ui32 count, TVector<ui32> &lockedChunks) { begin = begin > 0 ? begin : 1; - TVector<ui32> tmpChunks; + TVector<ui32> tmpChunks; tmpChunks.reserve(Keeper.GetFreeChunkCount()); TString errorReason; while (ui32 idx = Keeper.PopFreeChunkHack(errorReason)) { @@ -1034,7 +1034,7 @@ void TPDisk::ChunksLockByNumber(ui32 begin, ui32 count, TVector<ui32> &lockedChu } void TPDisk::ChunksLock(TChunksLock &evChunksLock) { - TVector<ui32> lockedChunks; + TVector<ui32> lockedChunks; if (evChunksLock.LockByRange) { if (evChunksLock.Begin < evChunksLock.End) { lockedChunks.reserve(evChunksLock.End - evChunksLock.Begin); @@ -1405,7 +1405,7 @@ void TPDisk::WriteDiskFormat(ui64 diskSizeBytes, ui32 sectorSizeBytes, ui32 user // Owner initialization //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void TPDisk::ReplyErrorYardInitResult(TYardInit &evYardInit, const TString &str) { +void TPDisk::ReplyErrorYardInitResult(TYardInit &evYardInit, const TString &str) { TStringStream error; error << "PDiskId# " << PDiskId << " YardInit error for VDiskId# " << evYardInit.VDisk.ToStringWOGeneration() << " reason# " << str; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h index a9b910cb0c1..c44e1045a85 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.h @@ -71,12 +71,12 @@ public: TVector<TRequestBase*> JointLogReads; TVector<TIntrusivePtr<TRequestBase>> JointChunkReads; TVector<TRequestBase*> JointChunkWrites; - TVector<TLogWrite*> JointLogWrites; - TVector<TLogWrite*> JointCommits; - TVector<TChunkTrim*> JointChunkTrims; + TVector<TLogWrite*> JointLogWrites; + TVector<TLogWrite*> JointCommits; + TVector<TChunkTrim*> JointChunkTrims; TVector<std::unique_ptr<TRequestBase>> FastOperationsQueue; - TDeque<TRequestBase*> PausedQueue; + TDeque<TRequestBase*> PausedQueue; std::set<std::unique_ptr<TYardInit>> PendingYardInits; ui64 LastFlushId = 0; bool IsQueuePaused = false; @@ -117,9 +117,9 @@ public: TMutex StateMutex; // The state is modified mainly by the PDisk thread, but can be accessed by other threads. const TOwnerRound NextOwnerRound; // Next unique-id to use for owner creation TOwner LastOwnerId = OwnerBeginUser; - TVector<TOwnerData> OwnerData; // Per-owner information + TVector<TOwnerData> OwnerData; // Per-owner information TMap<TVDiskID, TOwner> VDiskOwners; // For fast VDisk -> OwnerID mapping - TVector<TChunkState> ChunkState; // Per-chunk information + TVector<TChunkState> ChunkState; // Per-chunk information TKeeper Keeper; // Chunk data manager bool TrimInFly = false; // TChunkTrim request is present somewhere in pdisk TAtomic ChunkBeingTrimmed = 0; @@ -177,7 +177,7 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Initialization TPDisk(const TIntrusivePtr<TPDiskConfig> cfg, const TIntrusivePtr<NMonitoring::TDynamicCounters>& counters); - TString DynamicStateToString(bool isMultiline); + TString DynamicStateToString(bool isMultiline); bool ReadChunk0Format(ui8* formatSectors, const TKey& mainKey); // Called by actor bool IsFormatMagicValid(ui8 *magicData, ui32 magicDataSize); // Called by actor bool CheckGuid(TString *outReason); // Called by actor @@ -188,7 +188,7 @@ public: TString ProcessReadSysLogResult(ui64 &outWritePosition, ui64 &outLsn, const TEvReadLogResult &readLogResult); void ReadAndParseMainLog(const TActorId &pDiskActor); // Called by the log reader on success with the current chunkOwnerMap. - void ProcessChunkOwnerMap(TMap<ui32, TChunkState> &chunkOwnerMap); + void ProcessChunkOwnerMap(TMap<ui32, TChunkState> &chunkOwnerMap); void InitLogChunksInfo(); void PrintLogChunksInfo(const TString& msg); void InitFreeChunks(); @@ -196,7 +196,7 @@ public: bool InitCommonLogger(); bool LogNonceJump(ui64 previousNonce); void GetStartingPoints(TOwner owner, TMap<TLogSignature, TLogRecord> &outStartingPoints); - TString StartupOwnerInfo(); + TString StartupOwnerInfo(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Destruction virtual ~TPDisk(); @@ -234,7 +234,7 @@ public: bool isAllowedForSpaceRed); bool AllocateLogChunks(ui32 chunksNeeded, ui32 chunksContainingPayload, TOwner owner, ui64 lsn, EOwnerGroupType ownerGroupType, bool isAllowedForSpaceRed); - void LogWrite(TLogWrite &evLog, TVector<ui32> &logChunksToCommit); + void LogWrite(TLogWrite &evLog, TVector<ui32> &logChunksToCommit); void CommitLogChunks(TCommitLogChunks &req); void OnLogCommitDone(TLogCommitDone &req); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -267,8 +267,8 @@ public: ui64 *reallyReadBytes); void SplitChunkJobSize(ui32 totalSize, ui32 *outSmallJobSize, ui32 *outLargeJObSize, ui32 *outSmallJobCount); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void ChunksLockByRange(TFreeChunks &freeChunks, ui32 begin, ui32 end, TVector<ui32> &lockedChunks); - void ChunksLockByNumber(ui32 begin, ui32 number, TVector<ui32> &lockedChunks); + void ChunksLockByRange(TFreeChunks &freeChunks, ui32 begin, ui32 end, TVector<ui32> &lockedChunks); + void ChunksLockByNumber(ui32 begin, ui32 number, TVector<ui32> &lockedChunks); void ChunksLock(TChunksLock &evChunksLock); void ChunksUnlock(TChunksUnlock &evChunksUnlock); // Chunk reservation @@ -291,7 +291,7 @@ public: TString textMessage, const bool isErasureEncodeUserLog, const bool trimEntireDevice); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Owner initialization - void ReplyErrorYardInitResult(TYardInit &evYardInit, const TString &str); + void ReplyErrorYardInitResult(TYardInit &evYardInit, const TString &str); TOwner FindNextOwnerId(); bool YardInitStart(TYardInit &evYardInit); void YardInitFinish(TYardInit &evYardInit); diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_logreader.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_logreader.h index a95ff19be13..f30952ce9f3 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_logreader.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_logreader.h @@ -60,7 +60,7 @@ class TLogReader : public TLogReaderBase { THolder<TDoubleBuffer> Sector; - THolder<TMap<ui32, TChunkState>> ChunkOwnerMap; + THolder<TMap<ui32, TChunkState>> ChunkOwnerMap; ELogReaderState State; std::atomic<bool> IsReplied; @@ -82,7 +82,7 @@ class TLogReader : public TLogReaderBase { ui64 ResultSize; TLogRecordHeader LastRecordHeader; ui64 LastRecordHeaderNonce; - TString LastRecordData; + TString LastRecordData; ui32 LastRecordDataWritePosition; ui64 MaxCompleteLsnCyclic; ui64 EndSectorIdx; @@ -93,7 +93,7 @@ class TLogReader : public TLogReaderBase { TReqId ReqId; TVector<TChunkIdx> ChunksToRead; TVector<TChunkIdx>::iterator CurrentChunkToRead; - TVector<ui64> BadOffsets; + TVector<ui64> BadOffsets; TMutex ExecMutex; ui32 ErasurePartCount; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_mon.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_mon.cpp index a514e261ab7..9e873c171f3 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_mon.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_mon.cpp @@ -100,7 +100,7 @@ TPDiskMon::TPDiskMon(const TIntrusivePtr<NMonitoring::TDynamicCounters>& counter // scheduler subgroup ForsetiCbsNotFound = SchedulerGroup->GetCounter("ForsetiCbsNotFound"); - TVector<float> percentiles; + TVector<float> percentiles; percentiles.push_back(0.50f); percentiles.push_back(0.90f); percentiles.push_back(0.99f); @@ -218,7 +218,7 @@ TPDiskMon::TPDiskMon(const TIntrusivePtr<NMonitoring::TDynamicCounters>& counter CompletionThreadCPU = PDiskGroup->GetCounter("CompletionThreadCPU", true); } -NMonitoring::TDynamicCounters::TCounterPtr TPDiskMon::GetBusyPeriod(const TString& owner, const TString& queue) { +NMonitoring::TDynamicCounters::TCounterPtr TPDiskMon::GetBusyPeriod(const TString& owner, const TString& queue) { return SchedulerGroup->GetCounter("SchedulerBusyPeriod_" + owner + "_" + queue, true); } diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_mon.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_mon.h index 38a0f73b7c8..8d3e3837e01 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_mon.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_mon.h @@ -74,7 +74,7 @@ inline ui64 HPCyclesMs(ui64 ms) { class TLightBase { protected: - TString Name; + TString Name; NMonitoring::TDynamicCounters::TCounterPtr State; // Current state (0=OFF=green, 1=ON=red) NMonitoring::TDynamicCounters::TCounterPtr Count; // Number of switches to ON state NMonitoring::TDynamicCounters::TCounterPtr RedMs; // Time elapsed in ON state @@ -86,7 +86,7 @@ private: NHPTimer::STime LastNow = 0; ui64 UpdateThreshold = 0; public: - void Initialize(TIntrusivePtr<NMonitoring::TDynamicCounters>& counters, const TString& name) { + void Initialize(TIntrusivePtr<NMonitoring::TDynamicCounters>& counters, const TString& name) { Name = name; State = counters->GetCounter(name + "_state"); Count = counters->GetCounter(name + "_count", true); @@ -288,8 +288,8 @@ public: {} void Initialize(const TIntrusivePtr<NMonitoring::TDynamicCounters> &counters, - const TString& group, const TString& subgroup, const TString& name, - const TVector<float> &thresholds) { + const TString& group, const TString& subgroup, const TString& name, + const TVector<float> &thresholds) { Tracker.Initialize(counters, group, subgroup, name, thresholds); } @@ -655,7 +655,7 @@ struct TPDiskMon { NMonitoring::TDynamicCounters::TCounterPtr Bytes; NMonitoring::TDynamicCounters::TCounterPtr Results; - void Setup(const TIntrusivePtr<NMonitoring::TDynamicCounters>& group, TString name) { + void Setup(const TIntrusivePtr<NMonitoring::TDynamicCounters>& group, TString name) { TIntrusivePtr<NMonitoring::TDynamicCounters> subgroup = group->GetSubgroup("req", name); Requests = subgroup->GetCounter("Requests", true); Bytes = subgroup->GetCounter("Bytes", true); @@ -745,7 +745,7 @@ struct TPDiskMon { TPDiskMon(const TIntrusivePtr<NMonitoring::TDynamicCounters>& counters, ui32 pdiskId, TPDiskConfig *cfg); - NMonitoring::TDynamicCounters::TCounterPtr GetBusyPeriod(const TString& owner, const TString& queue); + NMonitoring::TDynamicCounters::TCounterPtr GetBusyPeriod(const TString& owner, const TString& queue); void IncrementQueueTime(ui8 priorityClass, size_t timeMs); void IncrementResponseTime(ui8 priorityClass, double timeMs, size_t sizeBytes); void UpdatePercentileTrackers(); diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_requestimpl.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_requestimpl.h index 61c0996e081..4804e08c529 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_requestimpl.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_requestimpl.h @@ -255,7 +255,7 @@ public: TLogSignature Signature; ui32 EstimatedChunkIdx; - TString Data; + TString Data; ui64 LsnSegmentStart; // Additional data, for sanity checks only. ui64 Lsn; // Log sequence number void *Cookie; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_tools.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_tools.h index 89b8f6418e9..60ab4af73ee 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_tools.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_tools.h @@ -15,14 +15,14 @@ struct TPDiskInfo { ui32 SectorSizeBytes; ui32 UserAccessibleChunkSizeBytes; ui64 DiskGuid; - TString TextMessage; + TString TextMessage; ui32 RawChunkSizeBytes; ui32 SysLogSectorCount; ui32 SystemChunkCount; TInstant Timestamp; - TString FormatFlags; + TString FormatFlags; - TString ErrorReason; // Actually not a part of the format info, contains human-readable error description + TString ErrorReason; // Actually not a part of the format info, contains human-readable error description struct TSectorInfo { ui64 Nonce; @@ -34,13 +34,13 @@ struct TPDiskInfo { , IsCrcOk(isCrcOk) {} }; - TVector<TSectorInfo> SectorInfo; + TVector<TSectorInfo> SectorInfo; }; // Throws TFileError in case of errors void ObliterateDisk(TString path); -void FormatPDisk(TString path, ui64 diskSizeBytes, ui32 sectorSizeBytes, ui32 userAccessibleChunkSizeBytes, +void FormatPDisk(TString path, ui64 diskSizeBytes, ui32 sectorSizeBytes, ui32 userAccessibleChunkSizeBytes, const ui64 &diskGuid, const NPDisk::TKey &chunkKey, const NPDisk::TKey &logKey, const NPDisk::TKey &sysLogKey, const NPDisk::TKey &mainKey, TString textMessage, const bool isErasureEncodeUserLog = false, const bool trimEntireDevice = false, diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_flightcontrol.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_flightcontrol.h index 97ff532062f..f8e1cbdfe12 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_flightcontrol.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_flightcontrol.h @@ -16,7 +16,7 @@ class TFlightControl { ui64 EndIdx; ui64 MaxSize; ui64 Mask; - TVector<bool> IsCompleteLoop; + TVector<bool> IsCompleteLoop; TMutex ScheduleMutex; TCondVar ScheduleCondVar; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_wcache.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_wcache.cpp index f613c70bee8..3fd50118088 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_wcache.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_wcache.cpp @@ -729,7 +729,7 @@ EWriteCacheResult SetWriteCache(FHANDLE file, const TString &path, bool isEnable #endif /* -bool GetWriteCache(TFileHandle *file, TActorSystem *actorSystem, const TString &path, bool *outIsEnabled) { +bool GetWriteCache(TFileHandle *file, TActorSystem *actorSystem, const TString &path, bool *outIsEnabled) { *outIsEnabled = false; #ifdef _linux_ int val = 0; @@ -780,7 +780,7 @@ bool GetWriteCache(TFileHandle *file, TActorSystem *actorSystem, const TString & #endif } -bool SetWriteCache(TFileHandle *file, bool isWriteCacheEnable, TActorSystem *actorSystem, const TString &path) { +bool SetWriteCache(TFileHandle *file, bool isWriteCacheEnable, TActorSystem *actorSystem, const TString &path) { #ifdef _linux_ // TODO: Consider flushing the cache before disabling it errno = 0; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_wcache.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_wcache.h index 86129e68f25..a869734bfe9 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_wcache.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_util_wcache.h @@ -9,7 +9,7 @@ namespace NKikimr { namespace NPDisk { // FHANDLE file is used for the operation. -// const TString &path is used for debugging and messages in outDetails. +// const TString &path is used for debugging and messages in outDetails. // TStringSteram *outDetails can be nullptr or a pointer to a TStringStream that will receive error details. // Return value is true in case of success. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/ydb/core/blobstorage/testload/test_load_actor.cpp b/ydb/core/blobstorage/testload/test_load_actor.cpp index c8788b13104..5cc6da1b5f5 100644 --- a/ydb/core/blobstorage/testload/test_load_actor.cpp +++ b/ydb/core/blobstorage/testload/test_load_actor.cpp @@ -16,7 +16,7 @@ class TLoadActor : public TActorBootstrapped<TLoadActor> { // per-actor HTTP info struct TActorInfo { ui64 Tag; // load tag - TString Data; // HTML response + TString Data; // HTML response }; // per-request info @@ -44,7 +44,7 @@ class TLoadActor : public TActorBootstrapped<TLoadActor> { ui32 NextRequestId; // HTTP info requests being currently executed - THashMap<ui32, THttpInfoRequest> InfoRequests; + THashMap<ui32, THttpInfoRequest> InfoRequests; TIntrusivePtr<NMonitoring::TDynamicCounters> Counters; @@ -64,7 +64,7 @@ public: void Handle(TEvBlobStorage::TEvTestLoadRequest::TPtr& ev, const TActorContext& ctx) { ui32 status = NMsgBusProxy::MSTATUS_OK; - TString error; + TString error; const auto& record = ev->Get()->Record; try { ProcessCmd(record, ctx); diff --git a/ydb/core/blobstorage/testload/test_load_gen.h b/ydb/core/blobstorage/testload/test_load_gen.h index 823ce9daf78..2c32120cf4b 100644 --- a/ydb/core/blobstorage/testload/test_load_gen.h +++ b/ydb/core/blobstorage/testload/test_load_gen.h @@ -11,7 +11,7 @@ namespace NKikimr { using TResult = decltype(std::declval<TItem>().Generate()); // a sef of items; key is the accumulated weight for this item (including the one for the item itself) - TMap<double, TItem> Items; + TMap<double, TItem> Items; // accumulated weight double AccumWeight = 0; diff --git a/ydb/core/blobstorage/testload/test_load_interval_gen.h b/ydb/core/blobstorage/testload/test_load_interval_gen.h index 1d5c093db0a..b4a0adcab68 100644 --- a/ydb/core/blobstorage/testload/test_load_interval_gen.h +++ b/ydb/core/blobstorage/testload/test_load_interval_gen.h @@ -24,7 +24,7 @@ namespace NKikimr { TDuration Generate() const { TDuration range = Max - Min; - return Min + TDuration::MicroSeconds(TAppData::RandomProvider->GenRand64() % (range.GetValue() + 1)); + return Min + TDuration::MicroSeconds(TAppData::RandomProvider->GenRand64() % (range.GetValue() + 1)); } }; diff --git a/ydb/core/blobstorage/testload/test_load_pdisk_read.cpp b/ydb/core/blobstorage/testload/test_load_pdisk_read.cpp index 3b446a74c2d..e258a52c507 100644 --- a/ydb/core/blobstorage/testload/test_load_pdisk_read.cpp +++ b/ydb/core/blobstorage/testload/test_load_pdisk_read.cpp @@ -87,12 +87,12 @@ class TPDiskReaderTestLoadActor : public TActorBootstrapped<TPDiskReaderTestLoad NPDisk::TOwnerRound OwnerRound; ui64 PDiskGuid; TIntrusivePtr<TPDiskParams> PDiskParams; - TVector<TChunkInfo> Chunks; + TVector<TChunkInfo> Chunks; TReallyFastRng32 Rng; TString DataBuffer; ui64 Lsn = 1; - TMultiMap<TInstant, TRequestStat> TimeSeries; - TVector<TChunkIdx> DeleteChunks; + TMultiMap<TInstant, TRequestStat> TimeSeries; + TVector<TChunkIdx> DeleteChunks; bool Sequential; bool Harakiri = false; bool IsWardenlessTest; @@ -497,7 +497,7 @@ public: TABLED() { str << NAME; } \ TABLED() { str << VALUE; } \ } - TMap<ui32, TVector<TDuration>> latmap; + TMap<ui32, TVector<TDuration>> latmap; for (const auto& pair : TimeSeries) { const TRequestStat& stat = pair.second; latmap[stat.Size].push_back(stat.Latency); @@ -544,7 +544,7 @@ public: for (auto& pair : latmap) { str << "<br/>"; - TVector<TDuration>& latencies = pair.second; + TVector<TDuration>& latencies = pair.second; std::sort(latencies.begin(), latencies.end()); for (double percentile : {0.5, 0.9, 0.95, 0.99, 0.999, 1.0}) { TDuration value = latencies[size_t(percentile * (latencies.size() - 1))]; diff --git a/ydb/core/blobstorage/testload/test_load_pdisk_write.cpp b/ydb/core/blobstorage/testload/test_load_pdisk_write.cpp index 8ea16e014cb..ed50eca8908 100644 --- a/ydb/core/blobstorage/testload/test_load_pdisk_write.cpp +++ b/ydb/core/blobstorage/testload/test_load_pdisk_write.cpp @@ -11,7 +11,7 @@ namespace NKikimr { class TPDiskWriterTestLoadActor : public TActorBootstrapped<TPDiskWriterTestLoadActor> { struct TChunkInfo { - TDeque<std::pair<TChunkIdx, ui32>> WriteQueue; + TDeque<std::pair<TChunkIdx, ui32>> WriteQueue; ui32 NumSlots; ui32 SlotSizeBlocks; ui32 Weight; @@ -90,16 +90,16 @@ class TPDiskWriterTestLoadActor : public TActorBootstrapped<TPDiskWriterTestLoad NPDisk::TOwnerRound OwnerRound; ui64 PDiskGuid; TIntrusivePtr<TPDiskParams> PDiskParams; - TVector<TChunkInfo> Chunks; + TVector<TChunkInfo> Chunks; TReallyFastRng32 Rng; TBuffer DataBuffer; ui64 Lsn = 1; TChunkInfo *ReservePending = nullptr; NKikimrBlobStorage::TEvTestLoadRequest::ELogMode LogMode; - THashMap<TChunkIdx, ui32> ChunkUsageCount; - TQueue<TChunkIdx> AllocationQueue; - TMultiMap<TInstant, TRequestStat> TimeSeries; - TVector<TChunkIdx> DeleteChunks; + THashMap<TChunkIdx, ui32> ChunkUsageCount; + TQueue<TChunkIdx> AllocationQueue; + TMultiMap<TInstant, TRequestStat> TimeSeries; + TVector<TChunkIdx> DeleteChunks; bool Sequential; bool Reuse; bool IsWardenlessTest; @@ -473,7 +473,7 @@ public: void SendLogRequest(const TActorContext& ctx, ui64 requestIdx, TChunkIdx chunkIdx) { RequestInfo[requestIdx].LogStartTime = TAppData::TimeProvider->Now(); - TString logRecord = "Hello, my dear log! I've just written a chunk!"; + TString logRecord = "Hello, my dear log! I've just written a chunk!"; NPDisk::TCommitRecord record; record.CommitChunks.push_back(chunkIdx); record.DeleteChunks.swap(DeleteChunks); @@ -556,7 +556,7 @@ public: TABLED() { str << NAME; } \ TABLED() { str << VALUE; } \ } - TMap<ui32, TVector<TDuration>> latmap; + TMap<ui32, TVector<TDuration>> latmap; for (const auto& pair : TimeSeries) { const TRequestStat& stat = pair.second; latmap[stat.Size].push_back(stat.Latency); @@ -604,7 +604,7 @@ public: for (auto& pair : latmap) { str << "<br/>"; - TVector<TDuration>& latencies = pair.second; + TVector<TDuration>& latencies = pair.second; std::sort(latencies.begin(), latencies.end()); for (double percentile : {0.5, 0.9, 0.95, 0.99, 0.999, 1.0}) { TDuration value = latencies[size_t(percentile * (latencies.size() - 1))]; diff --git a/ydb/core/blobstorage/testload/test_load_quantile.h b/ydb/core/blobstorage/testload/test_load_quantile.h index 0d0f0207c6f..70c9f52dc8f 100644 --- a/ydb/core/blobstorage/testload/test_load_quantile.h +++ b/ydb/core/blobstorage/testload/test_load_quantile.h @@ -80,7 +80,7 @@ namespace NKikimr { } // create a vector of values matching time criterion - TVector<T> values; + TVector<T> values; values.reserve(Items.size()); for (const TItem &item : Items) { values.push_back(item.Value); diff --git a/ydb/core/blobstorage/testload/test_load_time_series.h b/ydb/core/blobstorage/testload/test_load_time_series.h index b1ccfd037ad..3676a36f7d5 100644 --- a/ydb/core/blobstorage/testload/test_load_time_series.h +++ b/ydb/core/blobstorage/testload/test_load_time_series.h @@ -18,7 +18,7 @@ namespace NKikimr { , Value(value) {} }; - TDeque<TItem> Items; + TDeque<TItem> Items; public: using TValue = T; diff --git a/ydb/core/blobstorage/testload/test_load_vdisk_write.cpp b/ydb/core/blobstorage/testload/test_load_vdisk_write.cpp index 39ecca9dbda..5ff4066f722 100644 --- a/ydb/core/blobstorage/testload/test_load_vdisk_write.cpp +++ b/ydb/core/blobstorage/testload/test_load_vdisk_write.cpp @@ -64,11 +64,11 @@ namespace NKikimr { ui32 TEvVPutsSent = 0; ui64 InFlightPutBytes = 0; ui64 BytesWritten = 0; - TMap<ui64, ui32> InFlightRequests; + TMap<ui64, ui32> InFlightRequests; ui64 PutCookie = 1; bool EvTryToIssuePutsScheduled = false; - TDeque<TLogoBlobID> WrittenBlobs; + TDeque<TLogoBlobID> WrittenBlobs; public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { @@ -184,7 +184,7 @@ namespace NKikimr { } void IssuePutRequest(const TLogoBlobID& logoBlobId, ui64 cookie, const TActorContext& ctx) { - TString whole(logoBlobId.BlobSize(), 'X'); + TString whole(logoBlobId.BlobSize(), 'X'); TDataPartSet parts; GType.SplitData((TErasureType::ECrcMode)logoBlobId.CrcMode(), whole, parts); auto ev = std::make_unique<TEvBlobStorage::TEvVPut>(logoBlobId, diff --git a/ydb/core/blobstorage/testload/test_load_write.cpp b/ydb/core/blobstorage/testload/test_load_write.cpp index 3169c1609ed..650fa73ac57 100644 --- a/ydb/core/blobstorage/testload/test_load_write.cpp +++ b/ydb/core/blobstorage/testload/test_load_write.cpp @@ -37,7 +37,7 @@ class TLogWriterTestLoadActor : public TActorBootstrapped<TLogWriterTestLoadActo } }; - TPriorityQueue<TEvent> Events; + TPriorityQueue<TEvent> Events; public: void Wakeup(const TActorContext& ctx) { @@ -61,7 +61,7 @@ class TLogWriterTestLoadActor : public TActorBootstrapped<TLogWriterTestLoadActo using TCallback = std::function<void(IEventBase*, const TActorContext&)>; ui64 NextCookie = 1; - THashMap<ui64, TCallback> Callbacks; + THashMap<ui64, TCallback> Callbacks; public: ui64 ObtainCookie(TCallback callback) { @@ -752,7 +752,7 @@ class TLogWriterTestLoadActor : public TActorBootstrapped<TLogWriterTestLoadActo TMaybe<TDuration> TestDuration; - TVector<TTabletWriter> TabletWriters; + TVector<TTabletWriter> TabletWriters; TWakeupQueue WakeupQueue; TDeque<TInstant> WakeupScheduledAt; @@ -902,7 +902,7 @@ public: if (const ui64 delta = value % WakeupRounding.GetValue()) { value += WakeupRounding.GetValue() - delta; } - nextWakeupTime = TInstant::MicroSeconds(value); + nextWakeupTime = TInstant::MicroSeconds(value); } const TInstant scheduledWakeupTime = WakeupScheduledAt ? WakeupScheduledAt.front() : TInstant::Max(); if (nextWakeupTime && *nextWakeupTime < scheduledWakeupTime) { diff --git a/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.cpp b/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.cpp index 94eae0767aa..22552c96ad7 100644 --- a/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.cpp +++ b/ydb/core/blobstorage/ut_pdiskfit/lib/basic_test.cpp @@ -26,8 +26,8 @@ class TFakeVDisk TLogSignature Signature; ui32 DataLen; ui32 Checksum; - TVector<TChunkIdx> CommitChunks; - TVector<TChunkIdx> DeleteChunks; + TVector<TChunkIdx> CommitChunks; + TVector<TChunkIdx> DeleteChunks; friend bool operator <(const TLogRecord& x, const TLogRecord& y) { return x.Lsn < y.Lsn; @@ -38,7 +38,7 @@ class TFakeVDisk TChunkIdx ChunkIdx; ui32 OffsetInBlocks; ui32 SizeInBlocks; - TVector<ui32> Checksums; + TVector<ui32> Checksums; void *Cookie; }; @@ -53,7 +53,7 @@ class TFakeVDisk struct TState { class TChunkInfo { TDynBitMap UsedBlocks; - TVector<ui32> Checksums; + TVector<ui32> Checksums; ECommitState CommitState = ECommitState::RESERVED; public: @@ -84,7 +84,7 @@ class TFakeVDisk CommitState = static_cast<ECommitState>(pb.GetCommitState()); } - void SetChecksums(ui32 index, const TVector<ui32>& checksums) { + void SetChecksums(ui32 index, const TVector<ui32>& checksums) { const ui32 num = checksums.size(); Y_VERIFY(index + num <= Checksums.size() && index + num <= UsedBlocks.Size()); UsedBlocks.Set(index, index + num); @@ -125,14 +125,14 @@ class TFakeVDisk } }; - TSet<TLogRecord> Confirmed; - TSet<TLogRecord> InFlight; + TSet<TLogRecord> Confirmed; + TSet<TLogRecord> InFlight; ui64 FirstLsnToKeep = 0; - TMap<TChunkIdx, TChunkInfo> Chunks; - TList<TWriteRecord> WritesInFlight; + TMap<TChunkIdx, TChunkInfo> Chunks; + TList<TWriteRecord> WritesInFlight; ui32 BlocksInChunk = 0; - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Confirmed# ["; bool first = true; @@ -299,7 +299,7 @@ public: TState DeserializeRecoveredState() { TState recovered; - if (TString state = GetState()) { + if (TString state = GetState()) { NPDiskFIT::TFakeVDiskState pb; bool status = pb.ParseFromString(state); Y_VERIFY(status); @@ -499,7 +499,7 @@ public: void IssueLogMessage(TLogSignature signature, const TActorContext& ctx) { ui32 size = Params.SizeMin + RandomNumber<ui32>(Params.SizeMax - Params.SizeMin + 1); - TString data = GenerateRandomDataBuffer(size); + TString data = GenerateRandomDataBuffer(size); auto *info = new TLogRecord; info->Signature = signature; @@ -659,7 +659,7 @@ public: void IssueWriteRequest(const TActorContext& ctx) { // generate list of possible ranges we can select - TMap<TChunkIdx, TDynBitMap> maps; + TMap<TChunkIdx, TDynBitMap> maps; for (const auto& pair : State.Chunks) { if (pair.second.GetCommitState() != ECommitState::DELETE_IN_PROGRESS) { TDynBitMap bm; @@ -681,7 +681,7 @@ public: } // generate set of ranges suitable for writing - TMultiMap<TChunkIdx, std::pair<ui32, ui32>> ranges; + TMultiMap<TChunkIdx, std::pair<ui32, ui32>> ranges; for (const auto& p : maps) { bool valid = false; for (ui32 i = 0, begin; i <= State.BlocksInChunk; ++i) { @@ -718,10 +718,10 @@ public: const ui32 offsetInBlocks = rangeOffset + RandomNumber(rangeSize - numBlocks + 1); // create data buffer - TString data = GenerateRandomDataBuffer(numBlocks * PDiskParams->AppendBlockSize); + TString data = GenerateRandomDataBuffer(numBlocks * PDiskParams->AppendBlockSize); // calculate checksums for written blocks - TVector<ui32> checksums; + TVector<ui32> checksums; for (ui32 i = 0; i < numBlocks; ++i) { const char *ptr = data.data() + i * PDiskParams->AppendBlockSize; checksums.push_back(Crc32c(ptr, PDiskParams->AppendBlockSize)); @@ -856,21 +856,21 @@ public: CheckReadMsgPending(ctx); } - TString SerializeState() override { + TString SerializeState() override { NPDiskFIT::TFakeVDiskState pb; // TStringStream str; // str << "VDiskId# " << VDiskId.ToString() << " Owner# " << (PDiskParams ? (int)PDiskParams->Owner : 0) // << " StateVerified# " << (StateVerified ? "true" : "false") << Endl; // Cerr << str.Str(); (StateVerified ? State : Recovered).SerializeToProto(pb); - TString data; + TString data; bool status = pb.SerializeToString(&data); Y_VERIFY(status); return data; } - TString GenerateRandomDataBuffer(size_t len) { - TString data(len, ' '); + TString GenerateRandomDataBuffer(size_t len) { + TString data(len, ' '); char *mutableData = data.Detach(); ui64 pattern = RandomNumber<ui64>(); if (!pattern) { diff --git a/ydb/core/blobstorage/ut_pdiskfit/lib/fail_injection_test.h b/ydb/core/blobstorage/ut_pdiskfit/lib/fail_injection_test.h index 7e0bfa05e06..e06701158d8 100644 --- a/ydb/core/blobstorage/ut_pdiskfit/lib/fail_injection_test.h +++ b/ydb/core/blobstorage/ut_pdiskfit/lib/fail_injection_test.h @@ -102,7 +102,7 @@ struct TPDiskFailureInjectionTest { ui32 NumIterations = 10; // 0 = unlimited ui32 NumFailsInIteration = 1000; // 0 = unlimited TTempDir TempDir; - TString PDiskFilePath; + TString PDiskFilePath; ui64 DiskSize = 16ULL << 30; // 10 GB ui32 ChunkSize = 16 << 20; // 16 MB ui32 SectorSize = 4 << 10; // 4 KB @@ -216,7 +216,7 @@ struct TPDiskFailureInjectionTest { } template<typename TTest> - void Run(TTest *test, TStateManager *stateManager, const TString& data = {}) { + void Run(TTest *test, TStateManager *stateManager, const TString& data = {}) { TObjectWithState::DeserializeCommonState(data); InitActorSystem(); ActorSystem->Start(); @@ -236,7 +236,7 @@ struct TPDiskFailureInjectionTest { Setup(); // stored common state - TString state; + TString state; for (ui32 fail = 0; NumFailsInIteration == 0 || fail < NumFailsInIteration; ++fail) { if (TestDuration && TInstant::Now() >= startTime + *TestDuration) { diff --git a/ydb/core/blobstorage/ut_pdiskfit/lib/objectwithstate.cpp b/ydb/core/blobstorage/ut_pdiskfit/lib/objectwithstate.cpp index e6759d60b29..87402ea13c0 100644 --- a/ydb/core/blobstorage/ut_pdiskfit/lib/objectwithstate.cpp +++ b/ydb/core/blobstorage/ut_pdiskfit/lib/objectwithstate.cpp @@ -3,9 +3,9 @@ TMutex TObjectWithState::Mutex; TIntrusiveList<TObjectWithState> TObjectWithState::ObjectsWithState; -THashMap<TString, TString> TObjectWithState::States; +THashMap<TString, TString> TObjectWithState::States; -TObjectWithState::TObjectWithState(TString name) +TObjectWithState::TObjectWithState(TString name) : Name(std::move(name)) {} @@ -19,7 +19,7 @@ void TObjectWithState::Register() { ObjectsWithState.PushBack(this); } -TString TObjectWithState::SerializeCommonState() { +TString TObjectWithState::SerializeCommonState() { TGuard<TMutex> lock(Mutex); for (TObjectWithState& object : ObjectsWithState) { States[object.Name] = object.SerializeState(); @@ -31,13 +31,13 @@ TString TObjectWithState::SerializeCommonState() { item->SetValue(kv.second); } - TString data; + TString data; bool status = dict.SerializeToString(&data); Y_VERIFY(status); return data; } -void TObjectWithState::DeserializeCommonState(const TString& data) { +void TObjectWithState::DeserializeCommonState(const TString& data) { NPDiskFIT::TObjectWithStateDict dict; bool status = dict.ParseFromString(data); Y_VERIFY(status); @@ -48,7 +48,7 @@ void TObjectWithState::DeserializeCommonState(const TString& data) { } } -TString TObjectWithState::GetState() { +TString TObjectWithState::GetState() { auto it = States.find(Name); - return it != States.end() ? it->second : TString(); + return it != States.end() ? it->second : TString(); } diff --git a/ydb/core/blobstorage/ut_pdiskfit/lib/objectwithstate.h b/ydb/core/blobstorage/ut_pdiskfit/lib/objectwithstate.h index 3ce790ce1e9..66c62bb592e 100644 --- a/ydb/core/blobstorage/ut_pdiskfit/lib/objectwithstate.h +++ b/ydb/core/blobstorage/ut_pdiskfit/lib/objectwithstate.h @@ -1,30 +1,30 @@ #pragma once #include <util/generic/hash.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/mutex.h> #include <util/generic/intrlist.h> class TObjectWithState : public TIntrusiveListItem<TObjectWithState> { - TString Name; + TString Name; public: - TObjectWithState(TString name); + TObjectWithState(TString name); virtual ~TObjectWithState(); - virtual TString SerializeState() = 0; + virtual TString SerializeState() = 0; // call register after full initialization of derived class void Register(); - TString GetState(); + TString GetState(); - static TString SerializeCommonState(); - static void DeserializeCommonState(const TString& data); + static TString SerializeCommonState(); + static void DeserializeCommonState(const TString& data); private: static TMutex Mutex; static TIntrusiveList<TObjectWithState> ObjectsWithState; - static THashMap<TString, TString> States; + static THashMap<TString, TString> States; }; diff --git a/ydb/core/blobstorage/ut_pdiskfit/pdiskfit/pdiskfit.cpp b/ydb/core/blobstorage/ut_pdiskfit/pdiskfit/pdiskfit.cpp index cb4ec086f9a..7ce0dceaec4 100644 --- a/ydb/core/blobstorage/ut_pdiskfit/pdiskfit/pdiskfit.cpp +++ b/ydb/core/blobstorage/ut_pdiskfit/pdiskfit/pdiskfit.cpp @@ -6,14 +6,14 @@ using namespace NLastGetopt; int main(int argc, char *argv[]) { - TString device; + TString device; NSize::TSize size; ui32 numIterations = 100; ui32 numFailsPerIteration = 100; NSize::TSize chunkSize = 16 << 20; NSize::TSize sectorSize = 4 << 10; bool erasureEncode = false; - TString test; + TString test; ui32 numVDisks = 4; TOpts opts = TOpts::Default(); diff --git a/ydb/core/blobstorage/ut_vdisk/lib/astest.h b/ydb/core/blobstorage/ut_vdisk/lib/astest.h index 2cf254eff2c..d02f440f44d 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/astest.h +++ b/ydb/core/blobstorage/ut_vdisk/lib/astest.h @@ -48,8 +48,8 @@ inline void TTestWithActorSystem::Run(NActors::IActor *testActor) { Counters = TIntrusivePtr<NMonitoring::TDynamicCounters>(new NMonitoring::TDynamicCounters()); TIntrusivePtr<TTableNameserverSetup> nameserverTable(new TTableNameserverSetup()); TPortManager pm; - nameserverTable->StaticNodeTable[1] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12001)); - nameserverTable->StaticNodeTable[2] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12002)); + nameserverTable->StaticNodeTable[1] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12001)); + nameserverTable->StaticNodeTable[2] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12002)); auto setup1 = MakeHolder<TActorSystemSetup>(); setup1->NodeId = 1; @@ -81,7 +81,7 @@ inline void TTestWithActorSystem::Run(NActors::IActor *testActor) { NKikimrServices::EServiceKikimr_MAX, NKikimrServices::EServiceKikimr_Name ); - TString explanation; + TString explanation; //logSettings->SetLevel(NLog::PRI_INFO, NKikimrServices::BS_SKELETON, explanation); //logSettings->SetLevel(NLog::PRI_INFO, NKikimrServices::BS_HULLCOMP, explan NActors::TLoggerActor *loggerActor = new NActors::TLoggerActor(logSettings, diff --git a/ydb/core/blobstorage/ut_vdisk/lib/dataset.cpp b/ydb/core/blobstorage/ut_vdisk/lib/dataset.cpp index 89e383aea55..97af733c205 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/dataset.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/dataset.cpp @@ -6,9 +6,9 @@ using namespace NKikimr; -TString CreateData(const TString &orig, ui32 minHugeBlobSize, bool huge) { +TString CreateData(const TString &orig, ui32 minHugeBlobSize, bool huge) { if (huge) { - TString res; + TString res; res.reserve(minHugeBlobSize + orig.size()); while (res.size() < minHugeBlobSize) { res += orig; @@ -22,7 +22,7 @@ TString CreateData(const TString &orig, ui32 minHugeBlobSize, bool huge) { // TSmallCommonDataSet //////////////////////////////////////////////////////////////////////////////////////////////////////////////// TSmallCommonDataSet::TSmallCommonDataSet() { - auto put = [&] (ui32 step, TString data) { + auto put = [&] (ui32 step, TString data) { Items.push_back(TDataItem{NKikimr::TLogoBlobID(0, 1, step, 0, data.size(), 0), std::move(data), NKikimrBlobStorage::EPutHandleClass::TabletLog}); }; @@ -41,7 +41,7 @@ TSmallCommonDataSet::TSmallCommonDataSet() { TCustomDataSet::TCustomDataSet(ui64 tabletId, ui32 gen, ui32 channel, ui32 step, ui32 num, ui32 blobSize, NKikimrBlobStorage::EPutHandleClass cls, ui32 minHugeBlobSize, bool huge) { Y_UNUSED(blobSize); // FIXME: incorrect data size for small blobs - TString data(CreateData("abcdefghkj", minHugeBlobSize, huge)); + TString data(CreateData("abcdefghkj", minHugeBlobSize, huge)); for (ui32 i = 0; i < num; i++) { NKikimr::TLogoBlobID id(tabletId, gen, step + i, channel, data.size(), 0); Items.push_back(TDataItem{id, data, cls}); @@ -53,15 +53,15 @@ TCustomDataSet::TCustomDataSet(ui64 tabletId, ui32 gen, ui32 channel, ui32 step, // T3PutDataSet //////////////////////////////////////////////////////////////////////////////////////////////////////////////// T3PutDataSet::T3PutDataSet(NKikimrBlobStorage::EPutHandleClass cls, ui32 minHugeBlobSize, bool huge) { - TString abcdefghkj(CreateData("abcdefghkj", minHugeBlobSize, huge)); + TString abcdefghkj(CreateData("abcdefghkj", minHugeBlobSize, huge)); TLogoBlobID id1(0, 1, 10, 0, abcdefghkj.size(), 0, 1); Items.push_back(TDataItem(id1, abcdefghkj, cls)); - TString pqr(CreateData("pqr", minHugeBlobSize, huge)); + TString pqr(CreateData("pqr", minHugeBlobSize, huge)); TLogoBlobID id2(0, 1, 30, 0, pqr.size(), 0, 1); Items.push_back(TDataItem(id2, pqr, cls)); - TString xyz(CreateData("xyz", minHugeBlobSize, huge)); + TString xyz(CreateData("xyz", minHugeBlobSize, huge)); TLogoBlobID id3(0, 1, 34, 0, xyz.size(), 0, 1); Items.push_back(TDataItem(id3, xyz, cls)); } @@ -71,7 +71,7 @@ T3PutDataSet::T3PutDataSet(NKikimrBlobStorage::EPutHandleClass cls, ui32 minHuge // T1PutHandoff2DataSet //////////////////////////////////////////////////////////////////////////////////////////////////////////////// T1PutHandoff2DataSet::T1PutHandoff2DataSet(NKikimrBlobStorage::EPutHandleClass cls, ui32 minHugeBlobSize, bool huge) { - TString abc(CreateData("abc", minHugeBlobSize, huge)); + TString abc(CreateData("abc", minHugeBlobSize, huge)); TLogoBlobID id1Part1(0, 1, 10, 0, abc.size(), 0, 1); TLogoBlobID id1Part2(0, 1, 10, 0, abc.size(), 0, 2); @@ -83,9 +83,9 @@ T1PutHandoff2DataSet::T1PutHandoff2DataSet(NKikimrBlobStorage::EPutHandleClass c // T3PutHandoff2DataSet //////////////////////////////////////////////////////////////////////////////////////////////////////////////// T3PutHandoff2DataSet::T3PutHandoff2DataSet(NKikimrBlobStorage::EPutHandleClass cls, ui32 minHugeBlobSize, bool huge) { - TString abcdefghkj(CreateData("abcdefghkj", minHugeBlobSize, huge)); - TString pqr(CreateData("pqr", minHugeBlobSize, huge)); - TString xyz(CreateData("xyz", minHugeBlobSize, huge)); + TString abcdefghkj(CreateData("abcdefghkj", minHugeBlobSize, huge)); + TString pqr(CreateData("pqr", minHugeBlobSize, huge)); + TString xyz(CreateData("xyz", minHugeBlobSize, huge)); TLogoBlobID id1Part1(0, 1, 10, 0, abcdefghkj.size(), 0, 1); TLogoBlobID id1Part2(0, 1, 10, 0, abcdefghkj.size(), 0, 2); TLogoBlobID id2Part1(0, 1, 30, 0, pqr.size(), 0, 1); @@ -136,7 +136,7 @@ IDataGenerator* CreateBlobGenerator(ui64 maxCumSize, ui32 maxNumBlobs, ui32 minB const ui32 size = MinBlobSize + Rng() % (MaxBlobSize - MinBlobSize + 1); // generate pseudorandom data with step and size seed - TString data = GenerateData(size); + TString data = GenerateData(size); ui32 numDisks = Info->Type.BlobSubgroupSize(); ui32 handoff = Info->Type.Handoff(); @@ -176,14 +176,14 @@ IDataGenerator* CreateBlobGenerator(ui64 maxCumSize, ui32 maxNumBlobs, ui32 minB return new Generator(*this); } - TString GenerateData(ui32 size) { + TString GenerateData(ui32 size) { if (ReuseData) { if (size > ReusedDataBuf.size()) ReusedDataBuf.resize(size); return ReusedDataBuf; } else { // generate pseudorandom data with step and size seed - TString data; + TString data; data.reserve(size); for (ui32 i = 0; i < size; ++i) data.push_back(0x20 + Rng() % 0x7f); @@ -210,9 +210,9 @@ IDataGenerator* CreateBlobGenerator(ui64 maxCumSize, ui32 maxNumBlobs, ui32 minB ui64 CumSize; ui32 NumBlobs; TIntrusivePtr<NKikimr::TBlobStorageGroupInfo> Info; - TVector<TVDiskID> MatchingVDisks; + TVector<TVDiskID> MatchingVDisks; bool ReuseData; - TString ReusedDataBuf; + TString ReusedDataBuf; }; return new Generator(maxCumSize, maxNumBlobs, minBlobSize, maxBlobSize, differentTablets, startingStep, info, diff --git a/ydb/core/blobstorage/ut_vdisk/lib/dataset.h b/ydb/core/blobstorage/ut_vdisk/lib/dataset.h index 58a84b1f8a1..d513b919225 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/dataset.h +++ b/ydb/core/blobstorage/ut_vdisk/lib/dataset.h @@ -4,7 +4,7 @@ #include <util/generic/ptr.h> -TString CreateData(const TString &orig, ui32 minHugeBlobSize, bool huge); +TString CreateData(const TString &orig, ui32 minHugeBlobSize, bool huge); //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ABOUT DATA GENERATION FOR TESTS @@ -19,7 +19,7 @@ TString CreateData(const TString &orig, ui32 minHugeBlobSize, bool huge); // // TVectorDataSet // ~~~~~~~~~~~~~~ -// This class is good for small functional tests, we have a TVector under. +// This class is good for small functional tests, we have a TVector under. // // TGeneratedDataSet // ~~~~~~~~~~~~~~~~~ @@ -30,10 +30,10 @@ TString CreateData(const TString &orig, ui32 minHugeBlobSize, bool huge); //////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct TDataItem { NKikimr::TLogoBlobID Id; - TString Data; + TString Data; NKikimrBlobStorage::EPutHandleClass HandleClass; - TDataItem(const NKikimr::TLogoBlobID &id, const TString &data, NKikimrBlobStorage::EPutHandleClass cls) + TDataItem(const NKikimr::TLogoBlobID &id, const TString &data, NKikimrBlobStorage::EPutHandleClass cls) : Id(id) , Data(std::move(data)) , HandleClass(cls) @@ -62,7 +62,7 @@ public: virtual TAutoPtr<TIterator> First() const = 0; // sometimes it's usefull to convert a dataset to a vector to have random access to elements - virtual const TVector<TDataItem> &ToVector() const = 0; + virtual const TVector<TDataItem> &ToVector() const = 0; IDataSet() = default; virtual ~IDataSet() {} @@ -79,15 +79,15 @@ public: return new TMyIterator(Items); } - virtual const TVector<TDataItem> &ToVector() const override { + virtual const TVector<TDataItem> &ToVector() const override { return Items; } protected: - TVector<TDataItem> Items; + TVector<TDataItem> Items; struct TMyIterator : public IDataSet::TIterator { - TMyIterator(const TVector<TDataItem> &items) + TMyIterator(const TVector<TDataItem> &items) : Cur(items.begin()) , End(items.end()) {} @@ -106,8 +106,8 @@ protected: ++Cur; } - TVector<TDataItem>::const_iterator Cur; - TVector<TDataItem>::const_iterator End; + TVector<TDataItem>::const_iterator Cur; + TVector<TDataItem>::const_iterator End; }; }; @@ -138,7 +138,7 @@ public: return new TMyIterator(Generator.Get()); } - virtual const TVector<TDataItem> &ToVector() const override { + virtual const TVector<TDataItem> &ToVector() const override { if (Items.empty()) { TMyIterator it(Generator.Get()); while (it.IsValid()) { @@ -151,7 +151,7 @@ public: private: TAutoPtr<IDataGenerator> Generator; - mutable TVector<TDataItem> Items; + mutable TVector<TDataItem> Items; struct TMyIterator : public IDataSet::TIterator { TMyIterator(IDataGenerator *generator) diff --git a/ydb/core/blobstorage/ut_vdisk/lib/helpers.cpp b/ydb/core/blobstorage/ut_vdisk/lib/helpers.cpp index b73da3df8db..ef705f5d7af 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/helpers.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/helpers.cpp @@ -10,7 +10,7 @@ using namespace NKikimr; -static inline TString LimitData(const TString &data) { +static inline TString LimitData(const TString &data) { return data.size() <= 16 ? data : (data.substr(0, 16) + "..."); } @@ -561,7 +561,7 @@ class TManyGets : public TActorBootstrapped<TManyGets> { const ui32 Gen; std::shared_ptr<TSet<ui32>> BadSteps; ui32 Step; - TString MsgData; + TString MsgData; friend class TActorBootstrapped<TManyGets>; @@ -806,8 +806,8 @@ class TPutGC : public TActorBootstrapped<TPutGC> { ui32 Collect; ui32 CollectGen; ui32 CollectStep; - TAutoPtr<TVector<TLogoBlobID>> Keep; - TAutoPtr<TVector<TLogoBlobID>> DoNotKeep; + TAutoPtr<TVector<TLogoBlobID>> Keep; + TAutoPtr<TVector<TLogoBlobID>> DoNotKeep; friend class TActorBootstrapped<TPutGC>; @@ -834,7 +834,7 @@ class TPutGC : public TActorBootstrapped<TPutGC> { public: TPutGC(const NActors::TActorId ¬ifyID, const TAllVDisks::TVDiskInstance &vdiskInfo, ui64 tabletID, ui32 recGen, ui32 recGenCounter, ui32 channel, bool collect, ui32 collectGen, - ui32 collectStep, TAutoPtr<TVector<TLogoBlobID>> keep, TAutoPtr<TVector<TLogoBlobID>> doNotKeep) + ui32 collectStep, TAutoPtr<TVector<TLogoBlobID>> keep, TAutoPtr<TVector<TLogoBlobID>> doNotKeep) : TActorBootstrapped<TPutGC>() , NotifyID(notifyID) , VDiskInfo(vdiskInfo) @@ -852,8 +852,8 @@ public: NActors::IActor *CreatePutGC(const NActors::TActorId ¬ifyID, const TAllVDisks::TVDiskInstance &vdiskInfo, ui64 tabletID, ui32 recGen, ui32 recGenCounter, ui32 channel, bool collect, - ui32 collectGen, ui32 collectStep, TAutoPtr<TVector<TLogoBlobID>> keep, - TAutoPtr<TVector<TLogoBlobID>> doNotKeep) { + ui32 collectGen, ui32 collectStep, TAutoPtr<TVector<TLogoBlobID>> keep, + TAutoPtr<TVector<TLogoBlobID>> doNotKeep) { return new TPutGC(notifyID, vdiskInfo, tabletID, recGen, recGenCounter, channel, collect, collectGen, collectStep, keep, doNotKeep); } @@ -1083,7 +1083,7 @@ class TWaitForSync : public TActorBootstrapped<TWaitForSync> { const TVDiskID VDiskId; bool SetUp = false; - TVector<TSyncState> SyncStates; + TVector<TSyncState> SyncStates; NSyncLog::TLogEssence SyncLogEssence; TInfo(const TActorId &id, const TVDiskID &vd) @@ -1175,9 +1175,9 @@ class TWaitForSync : public TActorBootstrapped<TWaitForSync> { private: // seq number of vdisks we exclude - TSet<ui32> PuncturedPoints; + TSet<ui32> PuncturedPoints; // vector of working VDisks with their info data - TVector<TInfo> InfoVec; + TVector<TInfo> InfoVec; ui32 FindIdx(const TVDiskID &vd) { // found InfoVec element idx this vdisk @@ -1308,8 +1308,8 @@ class TPutGCToCorrespondingVDisksActor : public TActorBootstrapped<TPutGCToCorre ui32 Collect; ui32 CollectGen; ui32 CollectStep; - TAutoPtr<TVector<NKikimr::TLogoBlobID>> Keep; - TAutoPtr<TVector<NKikimr::TLogoBlobID>> DoNotKeep; + TAutoPtr<TVector<NKikimr::TLogoBlobID>> Keep; + TAutoPtr<TVector<NKikimr::TLogoBlobID>> DoNotKeep; friend class TActorBootstrapped<TPutGCToCorrespondingVDisksActor>; @@ -1349,8 +1349,8 @@ class TPutGCToCorrespondingVDisksActor : public TActorBootstrapped<TPutGCToCorre public: TPutGCToCorrespondingVDisksActor(const NActors::TActorId ¬ifyID, TConfiguration *conf, ui64 tabletID, ui32 recGen, ui32 recGenCounter, ui32 channel, bool collect, ui32 collectGen, - ui32 collectStep, TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep) + ui32 collectStep, TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, + TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep) : TActorBootstrapped<TPutGCToCorrespondingVDisksActor>() , NotifyID(notifyID) , Conf(conf) @@ -1370,16 +1370,16 @@ public: IActor *PutGCToCorrespondingVDisks(const NActors::TActorId ¬ifyID, TConfiguration *conf, ui64 tabletID, ui32 recGen, ui32 recGenCounter, ui32 channel, bool collect, ui32 collectGen, - ui32 collectStep, TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep) { + ui32 collectStep, TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, + TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep) { return new TPutGCToCorrespondingVDisksActor(notifyID, conf, tabletID, recGen, recGenCounter, channel, collect, collectGen, collectStep, keep, doNotKeep); } NActors::IActor *PutGCToCorrespondingVDisks(const NActors::TActorId ¬ifyID, TConfiguration *conf, const TGCSettings &settings, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep) { + TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, + TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep) { return new TPutGCToCorrespondingVDisksActor(notifyID, conf, settings.TabletID, settings.RecGen, settings.RecGenCounter, settings.Channel, settings.Collect, settings.CollectGen, settings.CollectStep, keep, doNotKeep); @@ -1391,14 +1391,14 @@ NActors::IActor *PutGCToCorrespondingVDisks(const NActors::TActorId ¬ifyID, T /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void PutLogoBlobToVDisk(const TActorContext &ctx, const TActorId &actorID, const TVDiskID &vdiskID, - const TLogoBlobID &id, const TString &data, NKikimrBlobStorage::EPutHandleClass cls) { + const TLogoBlobID &id, const TString &data, NKikimrBlobStorage::EPutHandleClass cls) { LOG_DEBUG(ctx, NActorsServices::TEST, " Sending TEvPut: id=%s data='%s'", id.ToString().data(), LimitData(data).data()); ctx.Send(actorID, new TEvBlobStorage::TEvVPut(id, data, vdiskID, false, nullptr, TInstant::Max(), cls)); } // returns number of messages sent ui32 PutLogoBlobToCorrespondingVDisks(const TActorContext &ctx, NKikimr::TBlobStorageGroupInfo *info, - const TLogoBlobID &id, const TString &data, NKikimrBlobStorage::EPutHandleClass cls) { + const TLogoBlobID &id, const TString &data, NKikimrBlobStorage::EPutHandleClass cls) { Y_ASSERT(id.PartId() == 0); ui32 msgsSent = 0; TBlobStorageGroupInfo::TVDiskIds outVDisks; @@ -1441,7 +1441,7 @@ ui32 GetLogoBlobFromCorrespondingVDisks(const NActors::TActorContext &ctx, NKiki /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// TDataSnapshot::TItem::TItem(const TVDiskID &vdisk, const TActorId &service, const NKikimr::TLogoBlobID &id, - const TString &data, const TIngress &ingress) + const TString &data, const TIngress &ingress) : VDiskID(vdisk) , ServiceID(service) , Id(id) @@ -1460,12 +1460,12 @@ TDataSnapshot::TDataSnapshot(TIntrusivePtr<NKikimr::TBlobStorageGroupInfo> info) {} void TDataSnapshot::PutExact(const TVDiskID &vdisk, const TActorId &service, const NKikimr::TLogoBlobID &id, - const TString &data, const TIngress &ingress) { + const TString &data, const TIngress &ingress) { Y_ASSERT(id.PartId() != 0); Data.push_back(TItem(vdisk, service, id, data, ingress)); } -void TDataSnapshot::PutCorresponding(const NKikimr::TLogoBlobID &id, const TString &data) { +void TDataSnapshot::PutCorresponding(const NKikimr::TLogoBlobID &id, const TString &data) { Y_ASSERT(id.PartId() == 0); TBlobStorageGroupInfo::TVDiskIds outVDisks; @@ -1737,7 +1737,7 @@ void PrintDebug(NKikimr::TEvBlobStorage::TEvVGetResult::TPtr &ev, const NActors: for (int i = 0; i < size; i++) { const NKikimrBlobStorage::TQueryResult &q = rec.GetResult(i); const TLogoBlobID id = LogoBlobIDFromLogoBlobID(q.GetBlobID()); - TString ingressStr; + TString ingressStr; ui64 ingressRaw = 0; if (q.HasIngress()) { TIngress ingress(q.GetIngress()); @@ -1752,17 +1752,17 @@ void PrintDebug(NKikimr::TEvBlobStorage::TEvVGetResult::TPtr &ev, const NActors: /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -TExpectedSet::TExpectedResult::TExpectedResult(NKikimrProto::EReplyStatus status, const TString &data) +TExpectedSet::TExpectedResult::TExpectedResult(NKikimrProto::EReplyStatus status, const TString &data) : Status(status) , Data(data) {} -void TExpectedSet::Put(const TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data) { - bool res = Map.insert(TMapType::value_type(id, TExpectedResult(status, data))).second; +void TExpectedSet::Put(const TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data) { + bool res = Map.insert(TMapType::value_type(id, TExpectedResult(status, data))).second; Y_VERIFY(res); } -TString TExpectedSet::ToString() const { +TString TExpectedSet::ToString() const { TStringStream str; str << "Map State:\n"; for (const auto &x : Map) { @@ -1771,9 +1771,9 @@ TString TExpectedSet::ToString() const { return str.Str(); } -void TExpectedSet::Check(const TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data) { +void TExpectedSet::Check(const TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data) { //fprintf(stderr, "Check: id=%s status=%s data=%s\n", ~id.ToString(), ~NKikimrProto::EReplyStatus_Name(status), ~data); - TMapType::iterator it = Map.find(id); + TMapType::iterator it = Map.find(id); Y_VERIFY(it != Map.end(), "TExpectedSet::Check: can't find id=%s; data# '%s' map# %s", id.ToString().data(), data.data(), ToString().data()); Y_VERIFY(it->second.Status == status, "TExpectedSet::Check: incorrect status %s instead of %s for %s", diff --git a/ydb/core/blobstorage/ut_vdisk/lib/helpers.h b/ydb/core/blobstorage/ut_vdisk/lib/helpers.h index ed8792b838d..34c013e5d11 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/helpers.h +++ b/ydb/core/blobstorage/ut_vdisk/lib/helpers.h @@ -122,8 +122,8 @@ NActors::IActor *CreateGet(const NActors::TActorId ¬ifyID, const TAllVDisks:: NActors::IActor *CreatePutGC(const NActors::TActorId ¬ifyID, const TAllVDisks::TVDiskInstance &vdiskInfo, ui64 tabletID, ui32 recGen, ui32 recGenCounter, ui32 channel, bool collect, ui32 collectGen, - ui32 collectStep, TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep); + ui32 collectStep, TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, + TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep); NActors::IActor *CreateWaitForCompaction(const NActors::TActorId ¬ifyID, const TAllVDisks::TVDiskInstance &vdiskInfo); NActors::IActor *CreateWaitForCompaction(const NActors::TActorId ¬ifyID, TConfiguration *conf); @@ -161,12 +161,12 @@ struct TGCSettings { NActors::IActor *PutGCToCorrespondingVDisks(const NActors::TActorId ¬ifyID, TConfiguration *conf, ui64 tabletID, ui32 recGen, ui32 recGenCounter, ui32 channel, bool collect, ui32 collectGen, ui32 collectStep, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep); + TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, + TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep); NActors::IActor *PutGCToCorrespondingVDisks(const NActors::TActorId ¬ifyID, TConfiguration *conf, const TGCSettings &settings, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, - TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep); + TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep, + TAutoPtr<TVector<NKikimr::TLogoBlobID>> doNotKeep); @@ -175,13 +175,13 @@ NActors::IActor *PutGCToCorrespondingVDisks(const NActors::TActorId ¬ifyID, T //////////////////////////////////////////////////////////////////////////////////////////////////////////////// void PutLogoBlobToVDisk(const NActors::TActorContext &ctx, const NActors::TActorId &actorID, - const NKikimr::TVDiskID &vdiskID, const NKikimr::TLogoBlobID &id, const TString &data, + const NKikimr::TVDiskID &vdiskID, const NKikimr::TLogoBlobID &id, const TString &data, NKikimrBlobStorage::EPutHandleClass cls); // Generate a series of put messages of logoblob id to the corresponding VDisks // Returns number of messages sent ui32 PutLogoBlobToCorrespondingVDisks(const NActors::TActorContext &ctx, NKikimr::TBlobStorageGroupInfo *info, - const NKikimr::TLogoBlobID &id, const TString &data, + const NKikimr::TLogoBlobID &id, const TString &data, NKikimrBlobStorage::EPutHandleClass cls); // Generate a series of get messages of logoblob id to the corresponding VDisks @@ -197,22 +197,22 @@ public: NKikimr::TVDiskID VDiskID; NKikimr::TActorId ServiceID; NKikimr::TLogoBlobID Id; // exact part - TString Data; + TString Data; NKikimr::TIngress Ingress; TItem(const NKikimr::TVDiskID &vdisk, const NKikimr::TActorId &service, const NKikimr::TLogoBlobID &id, - const TString &data, const NKikimr::TIngress &ingress); + const TString &data, const NKikimr::TIngress &ingress); }; struct TLess; - typedef TVector<TItem> TData; + typedef TVector<TItem> TData; typedef TData::iterator TIterator; TDataSnapshot(TIntrusivePtr<NKikimr::TBlobStorageGroupInfo> info); void PutExact(const NKikimr::TVDiskID &vdisk, const NKikimr::TActorId &service, const NKikimr::TLogoBlobID &id, - const TString &data, const NKikimr::TIngress &ingress = NKikimr::TIngress(0)); // must provide exact partId - void PutCorresponding(const NKikimr::TLogoBlobID &id, const TString &data); + const TString &data, const NKikimr::TIngress &ingress = NKikimr::TIngress(0)); // must provide exact partId + void PutCorresponding(const NKikimr::TLogoBlobID &id, const TString &data); void SortAndCheck(); TIterator begin(); @@ -239,10 +239,10 @@ void PrintDebug(NKikimr::TEvBlobStorage::TEvVGetResult::TPtr &ev, const NActors: //////////////////////////////////////////////////////////////////////////////////////////////////////////////// class TExpectedSet { public: - void Put(const NKikimr::TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data); - void Check(const NKikimr::TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data); + void Put(const NKikimr::TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data); + void Check(const NKikimr::TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data); void Finish(); - TString ToString() const; + TString ToString() const; void Print() const { fprintf(stderr, "TExpectedSet:\n"); @@ -254,14 +254,14 @@ public: struct TExpectedResult { NKikimrProto::EReplyStatus Status; - TString Data; + TString Data; - TExpectedResult(NKikimrProto::EReplyStatus status, const TString &data); + TExpectedResult(NKikimrProto::EReplyStatus status, const TString &data); }; private: - typedef TMap<NKikimr::TLogoBlobID, TExpectedResult> TMapType; - TMapType Map; + typedef TMap<NKikimr::TLogoBlobID, TExpectedResult> TMapType; + TMapType Map; }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/ydb/core/blobstorage/ut_vdisk/lib/http_client.cpp b/ydb/core/blobstorage/ut_vdisk/lib/http_client.cpp index abde48cedfa..75cf8ad89ef 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/http_client.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/http_client.cpp @@ -19,7 +19,7 @@ int THttpRequestException::GetStatusCode() const { //----------------------------------------------------------------------------------------------------------- -THttpClient::THttpClient(const TString& host, ui32 port, TDuration socketTimeout, TDuration connectTimeout) +THttpClient::THttpClient(const TString& host, ui32 port, TDuration socketTimeout, TDuration connectTimeout) : Host(CutHttpPrefix(host)) , Port(port) , SocketTimeout(socketTimeout) @@ -31,17 +31,17 @@ THttpClient::THttpClient(const TString& host, ui32 port, TDuration socketTimeout THttpClient::~THttpClient() = default; void THttpClient::SendHttpRequest(const TStringBuf relativeUrl, - const TString& body, - const TString& method, + const TString& body, + const TString& method, IOutputStream* output, const THeaders& headers) const { auto addr = Resolve(); auto socket = Connect(*addr); - TVector<IOutputStream::TPart> parts; + TVector<IOutputStream::TPart> parts; - TString contentLength; + TString contentLength; parts.reserve(16); parts.push_back(IOutputStream::TPart(method)); parts.push_back(TStringBuf(" ")); @@ -116,7 +116,7 @@ void THttpClient::ProcessResponse(const TStringBuf relativeUrl, THttpInput& inpu } if (!(statusCode >= 200 && statusCode < 300)) { - TString rest = input.ReadAll(); + TString rest = input.ReadAll(); ythrow THttpRequestException(statusCode) << "Got " << statusCode << " at " << Host << relativeUrl << "\nFull http response:\n" << rest; } } @@ -126,7 +126,7 @@ void THttpClient::ReadAndTransferHttp(const TStringBuf relativeUrl, THttpInput& try { statusCode = ParseHttpRetCode(input.FirstLine()); } catch (TFromStringException& e) { - TString rest = input.ReadAll(); + TString rest = input.ReadAll(); ythrow THttpRequestException() << "Failed parse status code in response of " << Host << ": " << e.what() << " (" << input.FirstLine() << ")" << "\nFull http response:\n" << rest; } diff --git a/ydb/core/blobstorage/ut_vdisk/lib/http_client.h b/ydb/core/blobstorage/ut_vdisk/lib/http_client.h index 3370f0eb00b..06ec025c06a 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/http_client.h +++ b/ydb/core/blobstorage/ut_vdisk/lib/http_client.h @@ -25,10 +25,10 @@ public: class THttpClient { public: - using THeaders = THashMap<TString, TString>; + using THeaders = THashMap<TString, TString>; public: - THttpClient(const TString& host, + THttpClient(const TString& host, ui32 port, TDuration socketTimeout = TDuration::Seconds(5), TDuration connectTimeout = TDuration::Seconds(30)); @@ -36,8 +36,8 @@ public: virtual ~THttpClient(); void SendHttpRequest(const TStringBuf relativeUrl, - const TString& body, - const TString& method, + const TString& body, + const TString& method, IOutputStream* output, const THeaders& headers = THeaders()) const; @@ -50,7 +50,7 @@ private: const unsigned statusCode) const; private: - const TString Host; + const TString Host; const ui32 Port; const TDuration SocketTimeout; const TDuration ConnectTimeout; diff --git a/ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp b/ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp index b2c020c3d21..31bb62a1944 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/prepare.cpp @@ -22,7 +22,7 @@ using namespace NKikimr; ////////////////////////////////////////////////////////////////////////////////////// // TAllPDisksConfiguration ////////////////////////////////////////////////////////////////////////////////////// -TAllPDisksConfiguration TAllPDisksConfiguration::MkDevice(const TString &devicePath, +TAllPDisksConfiguration TAllPDisksConfiguration::MkDevice(const TString &devicePath, ui32 chunkSize, TString deviceType) { return TAllPDisksConfiguration(1, chunkSize, 0, TString(), devicePath, deviceType); @@ -43,7 +43,7 @@ TAllPDisksConfiguration TAllPDisksConfiguration::MkManyTmp(ui32 pDisksNum, } TAllPDisksConfiguration::TAllPDisksConfiguration(ui32 num, ui32 chunkSize, ui64 diskSize, - const TString &dir, const TString &device, + const TString &dir, const TString &device, TString deviceType) : PDisksNum(num) , ChunkSize(chunkSize) @@ -57,7 +57,7 @@ TAllPDisksConfiguration::TAllPDisksConfiguration(ui32 num, ui32 chunkSize, ui64 ////////////////////////////////////////////////////////////////////////////////////// // TOnePDisk ////////////////////////////////////////////////////////////////////////////////////// -TOnePDisk::TOnePDisk(ui32 pDiskId, ui64 pDiskGuid, const TString &filename, +TOnePDisk::TOnePDisk(ui32 pDiskId, ui64 pDiskGuid, const TString &filename, ui32 chunkSize, ui64 diskSize) : PDiskActorID() , PDiskID(pDiskId) @@ -103,7 +103,7 @@ TAllPDisks::TAllPDisks(const TAllPDisksConfiguration &cfg) { if (cfg.Device.empty()) { // using filesystem - TString entryDir; + TString entryDir; if (cfg.Dir.empty()) { TempDir = std::make_shared<TTempDir>(); entryDir = (*TempDir)(); @@ -281,8 +281,8 @@ void TConfiguration::Prepare(IVDiskSetup *vdiskSetup, bool newPDisks, bool runRe TIntrusivePtr<TTableNameserverSetup> nameserverTable(new TTableNameserverSetup()); TPortManager pm; - nameserverTable->StaticNodeTable[1] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12001)); - nameserverTable->StaticNodeTable[2] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12002)); + nameserverTable->StaticNodeTable[1] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12001)); + nameserverTable->StaticNodeTable[2] = std::pair<TString, ui32>("127.0.0.1", pm.GetPort(12002)); THolder<TActorSystemSetup> setup1(new TActorSystemSetup()); setup1->NodeId = 1; @@ -329,7 +329,7 @@ void TConfiguration::Prepare(IVDiskSetup *vdiskSetup, bool newPDisks, bool runRe NKikimrServices::EServiceKikimr_MAX, NKikimrServices::EServiceKikimr_Name ); - TString explanation; + TString explanation; //logSettings->SetLevel(NLog::PRI_INFO, NKikimrServices::BS_SKELETON, explanation); //logSettings->SetLevel(NLog::PRI_INFO, NKikimrServices::BS_HULLCOMP, explanation); //logSettings->SetLevel(NLog::PRI_DEBUG, NKikimrServices::BS_HULLQUERY, explanation); diff --git a/ydb/core/blobstorage/ut_vdisk/lib/prepare.h b/ydb/core/blobstorage/ut_vdisk/lib/prepare.h index fc5da8d3421..808c1634cc5 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/prepare.h +++ b/ydb/core/blobstorage/ut_vdisk/lib/prepare.h @@ -22,11 +22,11 @@ struct TAllPDisksConfiguration { const ui32 PDisksNum; const ui32 ChunkSize; const ui64 DiskSize; - const TString Dir; - const TString Device; + const TString Dir; + const TString Device; const TString DeviceType; - static TAllPDisksConfiguration MkDevice(const TString &devicePath, ui32 chunkSize, + static TAllPDisksConfiguration MkDevice(const TString &devicePath, ui32 chunkSize, TString deviceType); static TAllPDisksConfiguration MkOneTmp(ui32 chunkSize, ui64 diskSize, TString deviceType); @@ -48,11 +48,11 @@ struct TOnePDisk { NActors::TActorId PDiskActorID; const ui32 PDiskID = 0; ui64 PDiskGuid = 0; - const TString Filename; + const TString Filename; const ui32 ChunkSize; const ui64 DiskSize; - TOnePDisk(ui32 pDiskId, ui64 pDiskGuid, const TString &filename, + TOnePDisk(ui32 pDiskId, ui64 pDiskGuid, const TString &filename, ui32 chunkSize, ui64 diskSize); void FormatDisk(bool force = false); void EraseDisk(ui64 newGuid); @@ -75,7 +75,7 @@ public: private: TAllPDisksConfiguration Cfg; - TVector<TOnePDisk> PDisks; + TVector<TOnePDisk> PDisks; std::shared_ptr<TTempDir> TempDir; }; @@ -105,8 +105,8 @@ public: return VDisks.size(); } - TVector<NKikimr::TVDiskID> GetVDiskIds() const { - TVector<NKikimr::TVDiskID> vdisks; + TVector<NKikimr::TVDiskID> GetVDiskIds() const { + TVector<NKikimr::TVDiskID> vdisks; for (const auto &x : VDisks) { vdisks.push_back(x.VDiskID); } @@ -116,7 +116,7 @@ public: private: ui32 DomainsNum; ui32 DisksInDomain; - TVector<TVDiskInstance> VDisks; + TVector<TVDiskInstance> VDisks; }; struct IVDiskSetup { @@ -166,7 +166,7 @@ struct TConfiguration { TSystemEvent DoneEvent { TSystemEvent::rAuto }; TSystemEvent DbInitEvent { TSystemEvent::rAuto }; - using TTimeoutCallbackList = TList<std::function<void ()>>; + using TTimeoutCallbackList = TList<std::function<void ()>>; using TTimeoutCallbackId = TTimeoutCallbackList::iterator; TTimeoutCallbackList TimeoutCallbacks; TMutex TimeoutCallbacksLock; diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_gc.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_gc.cpp index eb602a0b46f..44401751cf4 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/test_gc.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/test_gc.cpp @@ -12,7 +12,7 @@ virtual void Scenario(const TActorContext &ctx) { TAllVDisks::TVDiskInstance &instance = Conf->VDisks->Get(0); // prepare gc command - TAutoPtr<TVector<TLogoBlobID>> Keep(new TVector<TLogoBlobID>); + TAutoPtr<TVector<TLogoBlobID>> Keep(new TVector<TLogoBlobID>); Keep->push_back(generic); ui64 tabletID = 0; ui32 recGen = 1; @@ -94,8 +94,8 @@ virtual void Scenario(const TActorContext &ctx) { 10); ctx.Send(instance.ActorID, req.release()); - TString pppp("pppp"); - TString qqqqq("qqqqq"); + TString pppp("pppp"); + TString qqqqq("qqqqq"); ExpectedSet.Put(TLogoBlobID(0, 1, 471, 0, pppp.size(), 0), NKikimrProto::OK, {}); ExpectedSet.Put(TLogoBlobID(0, 1, 909, 0, qqqqq.size(), 0), NKikimrProto::OK, {}); }; @@ -162,8 +162,8 @@ SYNC_TEST_BEGIN(TGCPutBarrier, TSyncTestWithSmallCommonDataset) 10); ctx.Send(instance.ActorID, req.release()); - TString pppp("pppp"); - TString qqqqq("qqqqq"); + TString pppp("pppp"); + TString qqqqq("qqqqq"); ExpectedSet.Put(TLogoBlobID(0, 1, 471, 0, pppp.size(), 0), NKikimrProto::OK, {}); ExpectedSet.Put(TLogoBlobID(0, 1, 909, 0, qqqqq.size(), 0), NKikimrProto::OK, {}); }; @@ -187,8 +187,8 @@ virtual void Scenario(const TActorContext &ctx) { bool collect = true; ui32 collectGen = 1; ui32 collectStep = 1000; - TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep(new TVector<NKikimr::TLogoBlobID>()); - TString qqqqq("qqqqq"); + TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep(new TVector<NKikimr::TLogoBlobID>()); + TString qqqqq("qqqqq"); keep->push_back(TLogoBlobID(0, 1, 909, 0, qqqqq.size(), 0)); TAutoPtr<IActor> gcCommand(PutGCToCorrespondingVDisks(SyncRunner->NotifyID(), Conf, tabletID, recGen, recGenCounter, channel, collect, collectGen, collectStep, keep, nullptr)); diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_huge.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_huge.cpp index 7364483b0c5..955e6ef3612 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/test_huge.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/test_huge.cpp @@ -54,7 +54,7 @@ public: switch (State) { case 0: { const ui32 minHugeBlobSize = 65 << 10; - TString abcdefghkj(CreateData("abcdefghkj", minHugeBlobSize, true)); + TString abcdefghkj(CreateData("abcdefghkj", minHugeBlobSize, true)); const TLogoBlobID logoBlobId(0, 1, 10, 0, abcdefghkj.size(), 0, 1); ctx.Send(HugeKeeperId, new TEvHullWriteHugeBlob(TActorId(), 0, logoBlobId, TIngress(), diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_load.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_load.cpp index 4222ef4d85a..fd838ea55e8 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/test_load.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/test_load.cpp @@ -18,7 +18,7 @@ protected: const ui32 maxBlobSize = 1u << 20u; TIntrusivePtr<TBlobStorageGroupInfo> ginfo = Conf->GroupInfo; - TVector<TVDiskID> vdisks = Conf->VDisks->GetVDiskIds(); + TVector<TVDiskID> vdisks = Conf->VDisks->GetVDiskIds(); TAutoPtr<IDataGenerator> generator; generator.Reset(CreateBlobGenerator(maxDataSize, maxBlobs, minBlobSize, maxBlobSize, 1, 1, ginfo, vdisks, true)); diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp index 43c0a68e4b9..686495aff5e 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/test_outofspace.cpp @@ -18,7 +18,7 @@ protected: const ui32 maxBlobSize = 4096; TIntrusivePtr<TBlobStorageGroupInfo> ginfo = Conf->GroupInfo; - TVector<TVDiskID> vdisks = Conf->VDisks->GetVDiskIds(); + TVector<TVDiskID> vdisks = Conf->VDisks->GetVDiskIds(); TAutoPtr<IDataGenerator> generator; generator.Reset(CreateBlobGenerator(maxDataSize, maxBlobs, minBlobSize, maxBlobSize, 0, 1, ginfo, vdisks)); TGeneratedDataSet dataSet(generator); @@ -55,7 +55,7 @@ protected: const ui32 maxBlobSize = 4096; TIntrusivePtr<TBlobStorageGroupInfo> ginfo = Conf->GroupInfo; - TVector<TVDiskID> vdisks = Conf->VDisks->GetVDiskIds(); + TVector<TVDiskID> vdisks = Conf->VDisks->GetVDiskIds(); TAutoPtr<IDataGenerator> generator; generator.Reset(CreateBlobGenerator(maxDataSize, maxBlobs, minBlobSize, maxBlobSize, 0, 1, ginfo, vdisks)); TGeneratedDataSet dataSet(generator); diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_repl.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_repl.cpp index ae4288ab25b..d303ba5f0fe 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/test_repl.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/test_repl.cpp @@ -16,10 +16,10 @@ class TReadUntilSuccessActor : public TActorBootstrapped<TReadUntilSuccessActor> bool Multipart; struct TVal { - TString Data; + TString Data; ui32 PartMask; - TVal(const TString &data) + TVal(const TString &data) : Data(data) , PartMask(0) {} @@ -33,9 +33,9 @@ class TReadUntilSuccessActor : public TActorBootstrapped<TReadUntilSuccessActor> return PartMask == 7; } }; - typedef TMap<TLogoBlobID, TVal> TReadSet; + typedef TMap<TLogoBlobID, TVal> TReadSet; TReadSet ReadSet; - typedef TSet<TLogoBlobID> TPendingReads; + typedef TSet<TLogoBlobID> TPendingReads; TPendingReads PendingReads; bool HaveNoData; @@ -186,8 +186,8 @@ private: TActorId QueueId; bool Running = false; /* - void Put(const NKikimr::TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data); - void Check(const NKikimr::TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data); + void Put(const NKikimr::TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data); + void Check(const NKikimr::TLogoBlobID &id, NKikimrProto::EReplyStatus status, const TString &data); void Finish(); */ @@ -360,7 +360,7 @@ virtual void Scenario(const TActorContext &ctx) { bool collect = true; ui32 collectGen = 1; ui32 collectStep = 40; - TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep(new TVector<NKikimr::TLogoBlobID>()); + TAutoPtr<TVector<NKikimr::TLogoBlobID>> keep(new TVector<NKikimr::TLogoBlobID>()); keep->push_back(TLogoBlobID(0, 1, 37, 0, 0, 0)); TAutoPtr<IActor> gcCommand(PutGCToCorrespondingVDisks(SyncRunner->NotifyID(), Conf, tabletID, recGen, recGenCounter, channel, collect, collectGen, collectStep, keep, nullptr)); @@ -390,7 +390,7 @@ SYNC_TEST_END(TTestReplProxyKeepBits, TSyncTestWithSmallCommonDataset) SYNC_TEST_BEGIN(TTestHandoffMoveDel, TSyncTestBase) virtual void Scenario(const TActorContext &ctx) { TDataSnapshotPtr data(new TDataSnapshot(Conf->GroupInfo.Get())); - TString aaaa("aaaa"); + TString aaaa("aaaa"); TLogoBlobID id0(0, 1, 321, 0, aaaa.size(), 0); // [0:0:0:0:0] - main // [0:0:0:1:1] - main diff --git a/ydb/core/blobstorage/ut_vdisk/lib/test_simplebs.cpp b/ydb/core/blobstorage/ut_vdisk/lib/test_simplebs.cpp index 583b2beb1b1..ce8d7870141 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/test_simplebs.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/test_simplebs.cpp @@ -145,7 +145,7 @@ void name::operator ()(TConfiguration *conf) { \ SIMPLE_TEST_BEGIN(TSimple3Put3Get, TBasePutAllFromDataSet) void SendReadRequests(const TActorContext &ctx) { // read logoblobs - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); for (ui32 i = 0; i < 3; ++i) { auto req = TEvBlobStorage::TEvVGet::CreateExtremeDataQuery(VDiskInfo.VDiskID, TInstant::Max(), @@ -165,7 +165,7 @@ SIMPLE_TEST_END(TSimple3Put3Get, TBasePutAllFromDataSet) SIMPLE_TEST_BEGIN(TSimple3Put1SeqGetAll, TBasePutAllFromDataSet) void SendReadRequests(const TActorContext &ctx) { // read logoblobs - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); auto req = TEvBlobStorage::TEvVGet::CreateExtremeDataQuery(VDiskInfo.VDiskID, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::AsyncRead, TEvBlobStorage::TEvVGet::EFlags::None, {}, @@ -184,7 +184,7 @@ SIMPLE_TEST_END(TSimple3Put1SeqGetAll, TBasePutAllFromDataSet) SIMPLE_TEST_BEGIN(TSimple3Put1SeqGet2, TBasePutAllFromDataSet) void SendReadRequests(const TActorContext &ctx) { // read logoblobs - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); auto req = TEvBlobStorage::TEvVGet::CreateExtremeDataQuery(VDiskInfo.VDiskID, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::AsyncRead, TEvBlobStorage::TEvVGet::EFlags::None, {}, @@ -202,7 +202,7 @@ SIMPLE_TEST_END(TSimple3Put1SeqGet2, TBasePutAllFromDataSet) SIMPLE_TEST_BEGIN(TSimple3Put1SeqSubsOk, TBasePutAllFromDataSet) void SendReadRequests(const TActorContext &ctx) { // use shift/size to read parts of logoblobs - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); auto req = TEvBlobStorage::TEvVGet::CreateExtremeDataQuery(VDiskInfo.VDiskID, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::AsyncRead, TEvBlobStorage::TEvVGet::EFlags::None, {}, @@ -223,7 +223,7 @@ SIMPLE_TEST_END(TSimple3Put1SeqSubsOk, TBasePutAllFromDataSet) SIMPLE_TEST_BEGIN(TSimple3Put1SeqSubsError, TBasePutAllFromDataSet) void SendReadRequests(const TActorContext &ctx) { // use shift/size to read parts of logoblobs - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); auto req = TEvBlobStorage::TEvVGet::CreateExtremeDataQuery(VDiskInfo.VDiskID, TInstant::Max(), NKikimrBlobStorage::EGetHandleClass::AsyncRead, TEvBlobStorage::TEvVGet::EFlags::None, {}, @@ -258,7 +258,7 @@ SIMPLE_TEST_END(TSimple3Put1GetMissingKey, TBasePutAllFromDataSet) SIMPLE_TEST_BEGIN(TSimple3Put1GetMissingPart, TBasePutAllFromDataSet) void SendReadRequests(const TActorContext &ctx) { // use shift/size to read parts of logoblobs - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); TLogoBlobID key(ds.at(0).Id, 2); @@ -276,7 +276,7 @@ SIMPLE_TEST_END(TSimple3Put1GetMissingPart, TBasePutAllFromDataSet) SIMPLE_TEST_BEGIN(TSimpleHnd6Put1SeqGet, TBasePutAllFromDataSet) void SendReadRequests(const TActorContext &ctx) { // read logoblobs - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); ui64 cookie1 = 1; ui64 cookie2 = 2; @@ -305,7 +305,7 @@ SIMPLE_TEST_END(TSimpleHnd6Put1SeqGet, TBasePutAllFromDataSet) SIMPLE_TEST_BEGIN(TSimpleHnd2Put1Get, TBasePutAllFromDataSet) void SendReadRequests(const TActorContext &ctx) { // read logoblobs - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); ui64 cookie = 386; @@ -335,7 +335,7 @@ protected: } virtual void ExpectedSetAll() { - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); ExpectedSet.Put(ds.at(0).Id.FullID(), NKikimrProto::OK, {}); ExpectedSet.Put(ds.at(1).Id.FullID(), NKikimrProto::OK, {}); ExpectedSet.Put(ds.at(2).Id.FullID(), NKikimrProto::OK, {}); @@ -348,7 +348,7 @@ protected: } virtual void ExpectedSetMiddle() { - const TVector<TDataItem> &ds = DataSetPtr->ToVector(); + const TVector<TDataItem> &ds = DataSetPtr->ToVector(); ExpectedSet.Put(ds.at(1).Id.FullID(), NKikimrProto::OK, {}); Counter = 1; diff --git a/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.cpp b/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.cpp index 0d68629c647..83efcc4fa4d 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.cpp +++ b/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.cpp @@ -14,8 +14,8 @@ class TVDiskMockActor : public TActorBootstrapped<TVDiskMockActor> { const std::shared_ptr<TBlobStorageGroupInfo::TTopology> Top; TVDiskContextPtr VCtx; TMap<TLogoBlobID, std::optional<TString>> LogoBlobs; - TMap<std::tuple<ui64, ui8, ui32, ui32, bool>, std::tuple<ui32, ui32>> Barriers; - TMap<ui64, ui32> Blocks; + TMap<std::tuple<ui64, ui8, ui32, ui32, bool>, std::tuple<ui32, ui32>> Barriers; + TMap<ui64, ui32> Blocks; bool ErrorMode = false; bool LostMode = false; diff --git a/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h b/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h index 7330ae908ab..92ffe94b00e 100644 --- a/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h +++ b/ydb/core/blobstorage/ut_vdisk/lib/vdisk_mock.h @@ -54,7 +54,7 @@ struct TEvVMockCtlResponse : public TEventLocal<TEvVMockCtlResponse, TEvBlobStor struct TVDiskMockSharedState : public TThrRefBase { const TIntrusivePtr<TBlobStorageGroupInfo> GroupInfo; TMutex Mutex; - THashMap<TLogoBlobID, TIngress> BlobToIngressMap; + THashMap<TLogoBlobID, TIngress> BlobToIngressMap; TVDiskMockSharedState(TIntrusivePtr<TBlobStorageGroupInfo> groupInfo) : GroupInfo(std::move(groupInfo)) diff --git a/ydb/core/blobstorage/ut_vdisk/mon_reregister_ut.cpp b/ydb/core/blobstorage/ut_vdisk/mon_reregister_ut.cpp index 36a2eca81f8..26f2c43e0d0 100644 --- a/ydb/core/blobstorage/ut_vdisk/mon_reregister_ut.cpp +++ b/ydb/core/blobstorage/ut_vdisk/mon_reregister_ut.cpp @@ -42,8 +42,8 @@ Y_UNIT_TEST_SUITE(TMonitoring) { NMonitoring::TIndexMonPage *actorsMonPage = mon->RegisterIndexPage("actors", "Actors"); - TString path = "myworker"; - TString name = "myworker"; + TString path = "myworker"; + TString name = "myworker"; mon->RegisterActorPage(actorsMonPage, path, name, false, ctx.ExecutorThread.ActorSystem, ctx.SelfID); STR << "MyWorker Bootstrap: Incarnation: " << Incarnation << "\n"; @@ -119,9 +119,9 @@ Y_UNIT_TEST_SUITE(TMonitoring) { client.SendHttpRequest("/actors/myworker", "", "GET", &str); STR << str.Str() << "\n"; - const TString resp = str.Str(); + const TString resp = str.Str(); // we MUST get response from "Incarnation: 2" - Y_VERIFY(resp.find("Incarnation: 2") != TString::npos); + Y_VERIFY(resp.find("Incarnation: 2") != TString::npos); Env->Signal(); Die(ctx); diff --git a/ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp b/ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp index 694828c9f8c..d7c8467caf7 100644 --- a/ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp +++ b/ydb/core/blobstorage/ut_vdisk/vdisk_test.cpp @@ -794,7 +794,7 @@ Y_UNIT_TEST_SUITE(TBsVDiskRepl3) { const ui32 erasedPDiskID = 4; - TVector<NKikimr::TVDiskID> vdisks; + TVector<NKikimr::TVDiskID> vdisks; for (ui32 i = 0; i < Conf.VDisks->GetSize(); ++i) { auto& vDisk = Conf.VDisks->Get(i); if (vDisk.Cfg->BaseInfo.PDiskId == erasedPDiskID) { diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis.cpp b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis.cpp index 2ea94df9a89..b6fca0e1f5f 100644 --- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis.cpp +++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis.cpp @@ -92,7 +92,7 @@ namespace NKikimr { for (const auto &x : HullCtx->VCtx->Top->GetVDisks()) { if (HullCtx->VCtx->ShortSelfVDisk != x.VDiskIdShort) { // not self - TVector<TLogoBlobID> checkIds; + TVector<TLogoBlobID> checkIds; // find out candidates belongs to this x.VDiskIdShort checkIds = BlobsStatusMngr.GetLogoBlobIdsToCheck(x.VDiskIdShort); @@ -136,7 +136,7 @@ namespace NKikimr { // check have we finished if (MessagesSentToPeers == 0) { - TVector<TLogoBlobID> forRemoval = BlobsStatusMngr.BlobsToRemove(); + TVector<TLogoBlobID> forRemoval = BlobsStatusMngr.BlobsToRemove(); if (forRemoval.empty()) { Finish(ctx); } else { @@ -155,7 +155,7 @@ namespace NKikimr { HFunc(TEvents::TEvPoisonPill, HandlePoison) ) - void RemoveBlobs(const TActorContext &ctx, TVector<TLogoBlobID> &&forRemoval) { + void RemoveBlobs(const TActorContext &ctx, TVector<TLogoBlobID> &&forRemoval) { Y_VERIFY(!forRemoval.empty()); Become(&TThis::WaitWriteCompletion); diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo.cpp b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo.cpp index 4a7b49bb747..07bae58c27f 100644 --- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo.cpp +++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo.cpp @@ -10,12 +10,12 @@ namespace NKikimr { : Top(top) {} - void TBlobsStatusMngr::SetupCandidates(TVector<TLogoBlobID> &&candidates) { + void TBlobsStatusMngr::SetupCandidates(TVector<TLogoBlobID> &&candidates) { Candidates = std::move(candidates); } - TVector<TLogoBlobID> TBlobsStatusMngr::GetLogoBlobIdsToCheck(const TVDiskIdShort &vd) const { - TVector<TLogoBlobID> checkIds; + TVector<TLogoBlobID> TBlobsStatusMngr::GetLogoBlobIdsToCheck(const TVDiskIdShort &vd) const { + TVector<TLogoBlobID> checkIds; // find out candidates that belong to this 'vd' for (const auto &c : Candidates) { if (Top->BelongsToSubgroup(vd, c.Hash())) { @@ -54,11 +54,11 @@ namespace NKikimr { } // returns LogoBlobIDs to remove - TVector<TLogoBlobID> TBlobsStatusMngr::BlobsToRemove() const { + TVector<TLogoBlobID> TBlobsStatusMngr::BlobsToRemove() const { // get a reference to quorum checker helper class instance const auto& checker = Top->GetQuorumChecker(); // filling in this vector - TVector<TLogoBlobID> forRemoval; + TVector<TLogoBlobID> forRemoval; for (const auto &x : BlobsStatus) { const TBlobStorageGroupInfo::TSubgroupVDisks &subgroupDisks = x.second; const TBlobStorageGroupInfo::TSubgroupVDisks noneNodata = ~subgroupDisks; diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo.h b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo.h index 46b4a9f8207..4daabd9fca5 100644 --- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo.h +++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo.h @@ -16,7 +16,7 @@ namespace NKikimr { TBlobsToRemove(TBlobsToRemove &&) = default; TBlobsToRemove &operator =(TBlobsToRemove &&) = default; - TBlobsToRemove(TVector<TLogoBlobID> &&blobs) + TBlobsToRemove(TVector<TLogoBlobID> &&blobs) : Blobs(std::move(blobs)) , It(Blobs.end()) {} @@ -38,8 +38,8 @@ namespace NKikimr { } private: - TVector<TLogoBlobID> Blobs; - TVector<TLogoBlobID>::const_iterator It; + TVector<TLogoBlobID> Blobs; + TVector<TLogoBlobID>::const_iterator It; }; //////////////////////////////////////////////////////////////////////////// @@ -48,22 +48,22 @@ namespace NKikimr { class TBlobsStatusMngr { public: TBlobsStatusMngr(const TBlobStorageGroupInfo::TTopology *top); - void SetupCandidates(TVector<TLogoBlobID> &&candidates); - TVector<TLogoBlobID> GetLogoBlobIdsToCheck(const TVDiskIdShort &vd) const; + void SetupCandidates(TVector<TLogoBlobID> &&candidates); + TVector<TLogoBlobID> GetLogoBlobIdsToCheck(const TVDiskIdShort &vd) const; void UpdateStatusForVDisk(const TVDiskIdShort &vd, const NKikimrBlobStorage::TEvVGetResult &record); // returns LogoBlobIDs to remove - TVector<TLogoBlobID> BlobsToRemove() const; + TVector<TLogoBlobID> BlobsToRemove() const; private: const TBlobStorageGroupInfo::TTopology *Top = nullptr; // LogoBlobIDs we got from Finder; we check these ones for removing - TVector<TLogoBlobID> Candidates; + TVector<TLogoBlobID> Candidates; // This structure maps every TLogoBlobID from Candidates field to // TSubgroupVDisks object. TSubgroupVDisks contains bit mask of // VDisks that definitely have NODATA for this TLogoBlobID. We set // this object via communication with peers. - THashMap<TLogoBlobID, TBlobStorageGroupInfo::TSubgroupVDisks> BlobsStatus; + THashMap<TLogoBlobID, TBlobStorageGroupInfo::TSubgroupVDisks> BlobsStatus; }; } // NKikimr diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo_ut.cpp b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo_ut.cpp index 9cbe02a2e96..d2b5fa76959 100644 --- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo_ut.cpp +++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubis_algo_ut.cpp @@ -12,7 +12,7 @@ namespace NKikimr { Y_UNIT_TEST_SUITE(TBlobStorageAnubisAlgo) { - void OutputVector(const TVector<TLogoBlobID> &vec, IOutputStream &str) { + void OutputVector(const TVector<TLogoBlobID> &vec, IOutputStream &str) { str << "{"; bool first = true; for (const auto &x : vec) { @@ -26,9 +26,9 @@ namespace NKikimr { } NKikimrBlobStorage::TEvVGetResult BuildResult(const TVDiskID &vd, - const TVector<TLogoBlobID> &blobs, + const TVector<TLogoBlobID> &blobs, NKikimrProto::EReplyStatus globalStatus, - const TVector<NKikimrProto::EReplyStatus> &blobsStatus) { + const TVector<NKikimrProto::EReplyStatus> &blobsStatus) { NKikimrBlobStorage::TEvVGetResult res; res.SetStatus(globalStatus); VDiskIDFromVDiskID(vd, res.MutableVDiskID()); @@ -46,11 +46,11 @@ namespace NKikimr { TBlobStorageGroupInfo info(TErasureType::ErasureMirror3, 1, 4); TBlobsStatusMngr mngr(&info.GetTopology()); - TVector<TLogoBlobID> candidates = { + TVector<TLogoBlobID> candidates = { TLogoBlobID(1, 4, 256, 1, 100, 0), TLogoBlobID(1, 4, 257, 1, 100, 0) }; - mngr.SetupCandidates(TVector<TLogoBlobID>(candidates)); + mngr.SetupCandidates(TVector<TLogoBlobID>(candidates)); // TVDiskRange for (const auto &x : info.GetTopology().GetVDisks()) { @@ -85,7 +85,7 @@ namespace NKikimr { mngr.UpdateStatusForVDisk(TVDiskIdShort(vd), r); } - TVector<TLogoBlobID> res = {TLogoBlobID(1, 4, 257, 1, 100, 0)}; + TVector<TLogoBlobID> res = {TLogoBlobID(1, 4, 257, 1, 100, 0)}; auto blobsToRemove = mngr.BlobsToRemove(); STR << "blobs to remove: "; OutputVector(blobsToRemove, STR); diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisfinder.h b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisfinder.h index b09fd9d50e8..fdbc958961e 100644 --- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisfinder.h +++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisfinder.h @@ -17,7 +17,7 @@ namespace NKikimr { static constexpr unsigned MaxCandidates = 1000u; TLogoBlobID Pos; // we stopped at this position - TVector<TLogoBlobID> Candidates; // suspected logoblobs + TVector<TLogoBlobID> Candidates; // suspected logoblobs // Statistics TInstant StartTime; diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h index 8d53c580b0c..7788a669691 100644 --- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h +++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisproxy.h @@ -15,9 +15,9 @@ namespace NKikimr { struct TEvAnubisVGet : public TEventLocal<TEvAnubisVGet, TEvBlobStorage::EvAnubisVGet> { - TVector<TLogoBlobID> Candidates; + TVector<TLogoBlobID> Candidates; - TEvAnubisVGet(TVector<TLogoBlobID> &&c) + TEvAnubisVGet(TVector<TLogoBlobID> &&c) : Candidates(std::move(c)) {} }; diff --git a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.cpp b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.cpp index f1bbfa34c64..67820fe8207 100644 --- a/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.cpp +++ b/ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisrunner.cpp @@ -164,7 +164,7 @@ namespace NKikimr { ui64 rawVal = setting.GetValue(); ui64 randomNum = TAppData::RandomProvider->GenRand64(); ui64 randomOffset = randomNum % rawVal; - TDuration timeout = setting + TDuration::MicroSeconds(randomOffset); + TDuration timeout = setting + TDuration::MicroSeconds(randomOffset); ctx.Schedule(timeout, new TEvents::TEvWakeup()); AnubisScheduled = true; } diff --git a/ydb/core/blobstorage/vdisk/common/align.h b/ydb/core/blobstorage/vdisk/common/align.h index 4039e3c93ba..647fd16317e 100644 --- a/ydb/core/blobstorage/vdisk/common/align.h +++ b/ydb/core/blobstorage/vdisk/common/align.h @@ -30,7 +30,7 @@ namespace NKikimr { buf.Append(zero, len); } - static void Append(TString &buf, const char *zero, size_t len) { + static void Append(TString &buf, const char *zero, size_t len) { buf.append(zero, len); } diff --git a/ydb/core/blobstorage/vdisk/common/blobstorage_dblogcutter.cpp b/ydb/core/blobstorage/vdisk/common/blobstorage_dblogcutter.cpp index 5f176b61b75..1d9aa26493b 100644 --- a/ydb/core/blobstorage/vdisk/common/blobstorage_dblogcutter.cpp +++ b/ydb/core/blobstorage/vdisk/common/blobstorage_dblogcutter.cpp @@ -31,7 +31,7 @@ namespace NKikimr { TInstant ScrubLastTime; TInstant LastCutTime; - TDeque<ui64> FreeUpToLsn; + TDeque<ui64> FreeUpToLsn; ui64 FreeUpToLsnLastWritten = 0; const TDuration FirstDuration; diff --git a/ydb/core/blobstorage/vdisk/common/blobstorage_vdisk_guids.h b/ydb/core/blobstorage/vdisk/common/blobstorage_vdisk_guids.h index ece3e32dfd1..94d4c7a06ad 100644 --- a/ydb/core/blobstorage/vdisk/common/blobstorage_vdisk_guids.h +++ b/ydb/core/blobstorage/vdisk/common/blobstorage_vdisk_guids.h @@ -30,7 +30,7 @@ namespace NKikimr { str << Guid; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); @@ -71,7 +71,7 @@ namespace NKikimr { str << Guid; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/common/circlebuf.h b/ydb/core/blobstorage/vdisk/common/circlebuf.h index ace4a4372d7..f39e4ef5e0c 100644 --- a/ydb/core/blobstorage/vdisk/common/circlebuf.h +++ b/ydb/core/blobstorage/vdisk/common/circlebuf.h @@ -6,7 +6,7 @@ template <class T> class TCircleBuf { public: - typedef TVector<T> TVec; + typedef TVector<T> TVec; struct TIterator { TIterator(TVec &vec, size_t pos) diff --git a/ydb/core/blobstorage/vdisk/common/disk_part.h b/ydb/core/blobstorage/vdisk/common/disk_part.h index f8916ba6ee8..b0f893cea6d 100644 --- a/ydb/core/blobstorage/vdisk/common/disk_part.h +++ b/ydb/core/blobstorage/vdisk/common/disk_part.h @@ -105,7 +105,7 @@ namespace NKikimr { s.Write(&Size, sizeof(ui32)); } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); @@ -159,7 +159,7 @@ namespace NKikimr { // TDiskPartVec /////////////////////////////////////////////////////////////////////////////////////// struct TDiskPartVec { - using TVec = TVector<TDiskPart>; + using TVec = TVector<TDiskPart>; TVec Vec; TDiskPartVec() = default; @@ -198,14 +198,14 @@ namespace NKikimr { } } - static void ConvertToProto(NKikimrVDiskData::TDiskPartVec &pb, const TString &source) { + static void ConvertToProto(NKikimrVDiskData::TDiskPartVec &pb, const TString &source) { TDiskPartVec v; TStringInput str(source); Load(&str, v.Vec); v.SerializeToProto(pb); } - static bool Check(const TString &data) { + static bool Check(const TString &data) { Y_UNUSED(data); return true; } @@ -226,7 +226,7 @@ namespace NKikimr { return Vec.size(); } - TString ToString() const { + TString ToString() const { TStringStream str; if (Vec.empty()) { str << "empty"; diff --git a/ydb/core/blobstorage/vdisk/common/memusage.h b/ydb/core/blobstorage/vdisk/common/memusage.h index b045c1e3d50..37186cc66a7 100644 --- a/ydb/core/blobstorage/vdisk/common/memusage.h +++ b/ydb/core/blobstorage/vdisk/common/memusage.h @@ -5,7 +5,7 @@ #include <library/cpp/monlib/dynamic_counters/counters.h> #include <util/generic/buffer.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/list.h> #include <util/generic/vector.h> @@ -249,7 +249,7 @@ namespace NKikimr { struct TTrackerWrapper<TVector<T, A>, TDerived> : protected TTrackerWrapperBase<TVector<T, A>, TDerived> { - using TBase = TVector<T, A>; + using TBase = TVector<T, A>; using TWrapperBase = TTrackerWrapperBase<TVector<T, A>, TDerived>; using TWrapperBase::TWrapperBase; @@ -257,7 +257,7 @@ namespace NKikimr { return TBase::capacity() * sizeof(T); } - // ya-specific TVector methods + // ya-specific TVector methods TRACKABLE_WRAP_METHOD(crop) // std::vector methods @@ -291,7 +291,7 @@ namespace NKikimr { struct TTrackerWrapper<TList<T, A>, TDerived> : protected TTrackerWrapperBase<TList<T, A>, TDerived> { - using TBase = TList<T, A>; + using TBase = TList<T, A>; using TWrapperBase = TTrackerWrapperBase<TList<T, A>, TDerived>; using TWrapperBase::TWrapperBase; @@ -397,7 +397,7 @@ namespace NKikimr { struct TTrackerWrapper<TString, TDerived> : protected TTrackerWrapperBase<TString, TDerived> { - using TBase = TString; + using TBase = TString; using TWrapperBase = TTrackerWrapperBase<TString, TDerived>; using TWrapperBase::TWrapperBase; @@ -524,10 +524,10 @@ namespace NKikimr { template<typename T, typename A = typename TDeque<T>::allocator_type> using TTrackableDeque = TTrackable<TDeque<T, A>>; - template<typename T, typename A = typename TVector<T>::allocator_type> - using TTrackableVector = TTrackable<TVector<T, A>>; - template<typename T, typename A = typename TList<T>::allocator_type> - using TTrackableList = TTrackable<TList<T, A>>; + template<typename T, typename A = typename TVector<T>::allocator_type> + using TTrackableVector = TTrackable<TVector<T, A>>; + template<typename T, typename A = typename TList<T>::allocator_type> + using TTrackableList = TTrackable<TList<T, A>>; using TTrackableBuffer = TTrackable<TBuffer>; using TTrackableString = TTrackable<TString>; diff --git a/ydb/core/blobstorage/vdisk/common/sublog.h b/ydb/core/blobstorage/vdisk/common/sublog.h index d9d5310682e..1b1518f9e68 100644 --- a/ydb/core/blobstorage/vdisk/common/sublog.h +++ b/ydb/core/blobstorage/vdisk/common/sublog.h @@ -32,13 +32,13 @@ namespace NKikimr { return Out; } - TString Get() const { + TString Get() const { return Out.Str(); } private: const bool PrefixWithTime; - const TString Prefix; + const TString Prefix; mutable TStream Out; mutable size_t Recs = 0; }; @@ -59,7 +59,7 @@ namespace NKikimr { { TStringStream Stream; - const TString &GetLine() const { + const TString &GetLine() const { return Stream.Str(); } }; diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_config.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_config.cpp index 312fb3961ff..7f52070e87b 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_config.cpp +++ b/ydb/core/blobstorage/vdisk/common/vdisk_config.cpp @@ -168,7 +168,7 @@ namespace NKikimr { // 1. All vdisk kinds config parsing // 2. Creates a corresponding VDisk config given its kind and specific parameters //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - TAllVDiskKinds::TAllVDiskKinds(const TString &prototext) + TAllVDiskKinds::TAllVDiskKinds(const TString &prototext) : AllKindsConfig() , VDiskMegaBaseConfig(TVDiskConfig::TBaseInfo()) , KindsMap() @@ -181,7 +181,7 @@ namespace NKikimr { TIntrusivePtr<TVDiskConfig> TAllVDiskKinds::MakeVDiskConfig(const TVDiskConfig::TBaseInfo &baseInfo) { EKind k = baseInfo.Kind; - TVector<const TKind *> merge; + TVector<const TKind *> merge; int levels = 0; while (k != NKikimrBlobStorage::TVDiskKind::Default) { const auto it = KindsMap.find(k); diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_config.h b/ydb/core/blobstorage/vdisk/common/vdisk_config.h index ff4bb4f0d61..c9e1efb8ad8 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_config.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_config.h @@ -217,14 +217,14 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class TAllVDiskKinds : public TThrRefBase { public: - TAllVDiskKinds(const TString &prototext = TString()); + TAllVDiskKinds(const TString &prototext = TString()); TIntrusivePtr<TVDiskConfig> MakeVDiskConfig(const TVDiskConfig::TBaseInfo &baseInfo); void Merge(const NKikimrBlobStorage::TAllVDiskKinds &allVDiskKinds); private: using EKind = NKikimrBlobStorage::TVDiskKind::EVDiskKind; using TKind = NKikimrBlobStorage::TVDiskKind; - using TKindsMap = THashMap<EKind, const TKind *>; + using TKindsMap = THashMap<EKind, const TKind *>; NKikimrBlobStorage::TAllVDiskKinds AllKindsConfig; TVDiskConfig VDiskMegaBaseConfig; diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_config_ut.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_config_ut.cpp index 941df64a10b..8f65ed53706 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_config_ut.cpp +++ b/ydb/core/blobstorage/vdisk/common/vdisk_config_ut.cpp @@ -19,7 +19,7 @@ namespace NKikimr { } Y_UNIT_TEST(Basic) { - TString prototext = R"___( + TString prototext = R"___( VDiskKinds { Kind: Test1 BaseKind: Default @@ -43,7 +43,7 @@ namespace NKikimr { } Y_UNIT_TEST(RtmrProblem1) { - TString prototext = R"___( + TString prototext = R"___( VDiskKinds { Kind: Log Config { @@ -61,7 +61,7 @@ namespace NKikimr { } Y_UNIT_TEST(RtmrProblem2) { - TString prototext = R"___( + TString prototext = R"___( VDiskKinds { Kind: Log Config { @@ -87,7 +87,7 @@ namespace NKikimr { } Y_UNIT_TEST(ThreeLevels) { - TString prototext = R"___( + TString prototext = R"___( VDiskKinds { Kind: Test1 BaseKind: Default @@ -119,7 +119,7 @@ namespace NKikimr { } Y_UNIT_TEST(NoMoneyNoHoney) { - TString prototext; + TString prototext; TAllVDiskKinds kinds(prototext); TIntrusivePtr<TVDiskConfig> cfg; cfg = kinds.MakeVDiskConfig(GetDefaultBaseInfo(NKikimrBlobStorage::TVDiskKind::Default)); diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_context.h b/ydb/core/blobstorage/vdisk/common/vdisk_context.h index 7bb7dfd6704..1aa5961bbba 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_context.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_context.h @@ -41,7 +41,7 @@ namespace NKikimr { // Self VDisk related info const ui32 GroupId; const TVDiskIdShort ShortSelfVDisk; - const TString VDiskLogPrefix; + const TString VDiskLogPrefix; const ui32 NodeId; // Memory consumption TMemoryConsumer FreshIndex; diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_events.h b/ydb/core/blobstorage/vdisk/common/vdisk_events.h index 47fbd959c96..9a64f69d957 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_events.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_events.h @@ -465,7 +465,7 @@ namespace NKikimr { TDuration execution = TDuration::Seconds(ExecutionTimer.Passed()); stats->SetExecution(execution.GetValue()); if (stats->HasReceivedTimestamp()) { - TInstant started = TInstant::MicroSeconds(stats->GetReceivedTimestamp()); + TInstant started = TInstant::MicroSeconds(stats->GetReceivedTimestamp()); TInstant now = TAppData::TimeProvider->Now(); TDuration total = now - started; stats->SetTotal(total.GetValue()); @@ -592,7 +592,7 @@ namespace NKikimr { return false; } - TString ToString() const override { + TString ToString() const override { return ToString(Record); } @@ -663,10 +663,10 @@ namespace NKikimr { str << "}"; } - static TString ToString(const NKikimrBlobStorage::TEvVPut &record) { + static TString ToString(const NKikimrBlobStorage::TEvVPut &record) { TStringStream str; TLogoBlobID id = LogoBlobIDFromLogoBlobID(record.GetBlobID()); - const TString &data = record.GetBuffer(); + const TString &data = record.GetBuffer(); str << "{ID# " << id.ToString() << " FDS# " << record.GetFullDataSize(); if (record.GetIgnoreBlock()) { str << " IgnoreBlock"; @@ -682,7 +682,7 @@ namespace NKikimr { if (data.size() > 16) { str << " Data# <too_large>"; } else { - TString encoded; + TString encoded; Base64Encode(data, encoded); str << " Data# " << encoded; } @@ -708,7 +708,7 @@ namespace NKikimr { const ui64 bufferSizeBytes, NWilson::TTraceId traceId, ui64 incarnationGuid, const TString& errorReason); - TString ToString() const override { + TString ToString() const override { return ToString(Record); } @@ -716,7 +716,7 @@ namespace NKikimr { Record.SetStatus(status); } - static TString ToString(const NKikimrBlobStorage::TEvVPutResult &record) { + static TString ToString(const NKikimrBlobStorage::TEvVPutResult &record) { TStringStream str; TLogoBlobID id = LogoBlobIDFromLogoBlobID(record.GetBlobID()); str << "{EvVPutResult Status# " << NKikimrProto::EReplyStatus_Name(record.GetStatus()).data(); @@ -1134,11 +1134,11 @@ namespace NKikimr { return false; } - TString ToString() const override { + TString ToString() const override { return ToString(Record); } - static TString ToString(const NKikimrBlobStorage::TEvVGet &record) { + static TString ToString(const NKikimrBlobStorage::TEvVGet &record) { TStringStream str; if (record.HasRangeQuery()) { const NKikimrBlobStorage::TRangeQuery &query = record.GetRangeQuery(); @@ -1303,7 +1303,7 @@ namespace NKikimr { } } - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{EvVGetResult QueryResult Status# " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); for (const auto& result : Record.GetResult()) { @@ -1325,7 +1325,7 @@ namespace NKikimr { if (data.size() > 16) { str << " Data# <too_large>"; } else { - TString encoded; + TString encoded; Base64Encode(data, encoded); str << " Data# " << encoded; } @@ -1733,7 +1733,7 @@ namespace NKikimr { Record.SetGeneration(actualGen); } - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{EvVBlockResult Status# " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); if (Record.HasTabletId()) { @@ -2108,7 +2108,7 @@ namespace NKikimr { VDiskIDFromVDiskID(vdisk, Record.MutableVDiskID()); } - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{EvVGetBlockResult Status# " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); if (Record.HasTabletId()) { @@ -2147,7 +2147,7 @@ namespace NKikimr { explicit TEvVCollectGarbage(ui64 tabletId, ui32 recordGeneration, ui32 perGenerationCounter, ui32 channel, bool collect, ui32 collectGeneration, ui32 collectStep, bool hard, - const TVector<TLogoBlobID> *keep, const TVector<TLogoBlobID> *doNotKeep, + const TVector<TLogoBlobID> *keep, const TVector<TLogoBlobID> *doNotKeep, const TVDiskID &vdisk, TInstant deadline) { Record.SetTabletId(tabletId); @@ -2176,7 +2176,7 @@ namespace NKikimr { Record.MutableMsgQoS()->SetExtQueueId(NKikimrBlobStorage::EVDiskQueueId::PutTabletLog); } - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{TEvVCollectGarbage for [tablet:gen:cnt:channel]=[" << Record.GetTabletId() << ":" << Record.GetRecordGeneration() << ":" << Record.GetPerGenerationCounter() << ":" @@ -2229,7 +2229,7 @@ namespace NKikimr { Record.SetStatus(status); } - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{EvVCollectGarbageResult Status# " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data(); if (Record.HasTabletId()) { @@ -2283,7 +2283,7 @@ namespace NKikimr { Record.MutableMsgQoS()->SetExtQueueId(NKikimrBlobStorage::EVDiskQueueId::GetFastRead); } - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{From# " << TKeyBarrier(Record.GetFrom()).ToString() << " To# " << TKeyBarrier(Record.GetTo()).ToString(); @@ -2489,7 +2489,7 @@ namespace NKikimr { Record.SetStatus(NKikimrProto::ERROR); } - void SetResult(const TString &data) { + void SetResult(const TString &data) { Record.SetData(data); } }; @@ -2570,7 +2570,7 @@ namespace NKikimr { str << " VDiskId# " << vd.ToString() << "}"; } - TString ToString() const override { + TString ToString() const override { TStringStream str; Output(str); return str.Str(); @@ -2623,7 +2623,7 @@ namespace NKikimr { Record.SetStatusFlags(flags); } - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{Status:" << Record.GetStatus() << " NewSyncState# " << SyncStateFromSyncState(Record.GetNewSyncState()) @@ -2688,7 +2688,7 @@ namespace NKikimr { Record.SetCookie(cookie); } - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{Status:" << Record.GetStatus() << " SyncState# " << SyncStateFromSyncState(Record.GetSyncState()) @@ -2741,7 +2741,7 @@ namespace NKikimr { return new TEvVGenerationChange(NewVDiskId, NewInfo); } - TString ToString() const override { + TString ToString() const override { return TStringBuilder() << "{TEvVGenerationChange NewVDiskId# " << NewVDiskId << " NewInfo# " << NewInfo->ToString() << "}" ; } @@ -2758,7 +2758,7 @@ namespace NKikimr { , StoragePoolCounters(std::move(storagePoolCounters)) {} - TString ToString() const override { + TString ToString() const override { TStringStream str; str << "{TEvConfigureProxy Info# "; if (Info) { diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_log.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_log.cpp index e7a3e8cc279..c90503df877 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_log.cpp +++ b/ydb/core/blobstorage/vdisk/common/vdisk_log.cpp @@ -8,7 +8,7 @@ namespace NKikimr { // Log Prefix //////////////////////////////////////////////////////////////////////////// TString AppendVDiskLogPrefix(const TIntrusivePtr<TVDiskContext> &vctx, const char *c, ...) { - TString formatted; + TString formatted; va_list params; va_start(params, c); vsprintf(formatted, c, params); @@ -16,8 +16,8 @@ namespace NKikimr { return vctx->VDiskLogPrefix + formatted; } - TString AppendVDiskLogPrefix(const TString &prefix, const char *c, ...) { - TString formatted; + TString AppendVDiskLogPrefix(const TString &prefix, const char *c, ...) { + TString formatted; va_list params; va_start(params, c); vsprintf(formatted, c, params); diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_log.h b/ydb/core/blobstorage/vdisk/common/vdisk_log.h index c308e9a7a0d..499c15f1835 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_log.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_log.h @@ -1,7 +1,7 @@ #pragma once #include "defs.h" -#include <util/generic/string.h> +#include <util/generic/string.h> // VDisk prefix for log records #define VDISK(...) ::NKikimr::AppendVDiskLogPrefix((Db->VCtx), __VA_ARGS__) @@ -17,7 +17,7 @@ namespace NKikimr { Y_PRINTF_FORMAT(2, 3) TString AppendVDiskLogPrefix(const TIntrusivePtr<TVDiskContext> &vctx, const char *c, ...); Y_PRINTF_FORMAT(2, 3) - TString AppendVDiskLogPrefix(const TString &prefix, const char *c, ...); + TString AppendVDiskLogPrefix(const TString &prefix, const char *c, ...); struct TVDiskID; TString GenerateVDiskLogPrefix(const TVDiskID &vdisk, bool donorMode); diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_lsnmngr.h b/ydb/core/blobstorage/vdisk/common/vdisk_lsnmngr.h index dde57d68b2e..0e41a93800a 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_lsnmngr.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_lsnmngr.h @@ -59,7 +59,7 @@ namespace NKikimr { str << "}"; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_recoverylogwriter.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_recoverylogwriter.cpp index f0ec9c15e40..eece6c89b38 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_recoverylogwriter.cpp +++ b/ydb/core/blobstorage/vdisk/common/vdisk_recoverylogwriter.cpp @@ -37,12 +37,12 @@ LWTRACE_USING(BLOBSTORAGE_PROVIDER); } }; - TVector<TItem> Counters; + TVector<TItem> Counters; TCounters(TIntrusivePtr<NMonitoring::TDynamicCounters> mon) { auto group = mon->GetSubgroup("subsystem", "logrecs"); Counters.reserve(static_cast<size_t>(TLogSignature::Max)); - TString prefix("Log"); + TString prefix("Log"); for (int i = static_cast<int>(TLogSignature::First); i < static_cast<int>(TLogSignature::Max); i++) { @@ -83,14 +83,14 @@ LWTRACE_USING(BLOBSTORAGE_PROVIDER); }; }; - typedef TPriorityQueue<TQueueItem, TVector<TQueueItem>, TQueueItem::TGreater> TQueueType; + typedef TPriorityQueue<TQueueItem, TVector<TQueueItem>, TQueueItem::TGreater> TQueueType; const TActorId YardID; const TActorId SkeletonID; const NPDisk::TOwner Owner; const NPDisk::TOwnerRound OwnerRound; ui64 CurSentLsn = 0; - TQueueType Queue; + TQueueType Queue; NMonitoring::TDynamicCounters::TCounterPtr LsmLogBytesWritten; TCounters Counters; diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_syncneighbors.h b/ydb/core/blobstorage/vdisk/common/vdisk_syncneighbors.h index b014da97b04..1b29cb8e980 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_syncneighbors.h +++ b/ydb/core/blobstorage/vdisk/common/vdisk_syncneighbors.h @@ -47,7 +47,7 @@ namespace NKikimr { , DomainOrderNumber(domainOrderNumber) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{" << "VDiskIdShort: " << VDiskIdShort << " " << Payload.ToString() @@ -72,7 +72,7 @@ namespace NKikimr { // TNeighbors contains nested vectors of FailRealms, FailDomains and VDisks inside them; e.g. // [ FailRealm0:[ FailDomain0:[ VDisk_0_0_0 VDisk_0_0_1 ] FailDomain1:[ VDisk_0_1_0 ... ] ] ] // that is TNeighbors[vdisk.FailRealm][vdisk.FailDomain][vdisk.VDisk] contains per-VDisk metadata - using TNeighbors = TVector<TVector<TVector<TValue>>>; + using TNeighbors = TVector<TVector<TVector<TValue>>>; template<bool Const> class TFailDomainIteratorImpl; @@ -327,7 +327,7 @@ namespace NKikimr { return End(); } - TString ToString(char sep = '\0') const { + TString ToString(char sep = '\0') const { TStringStream s; s << "{"; for (TConstIterator it = Begin(), e = End(); it != e; ++it) { @@ -357,7 +357,7 @@ namespace NKikimr { template <class TPrinter> void OutputHtmlTable(IOutputStream &str, TPrinter &printer) const { - TVector<TConstIterator> its; + TVector<TConstIterator> its; HTML(str) { TABLE_CLASS ("table table-condensed") { TABLEHEAD() { @@ -417,13 +417,13 @@ namespace NKikimr { } template <class TPrinter> - void OutputHtmlTableBody(IOutputStream &str, TPrinter &printer, TVector<TConstIterator> &its) const { + void OutputHtmlTableBody(IOutputStream &str, TPrinter &printer, TVector<TConstIterator> &its) const { HTML(str) { TABLEBODY() { for (ui32 row = 0; row < DisksInDomain; ++row) { TABLER() { // column iterator -- one entry for each domain in "its" - typename TVector<TConstIterator>::iterator colIt = its.begin(); + typename TVector<TConstIterator>::iterator colIt = its.begin(); for (const auto& vdisks : GetFailDomains()) { TABLED() { diff --git a/ydb/core/blobstorage/vdisk/common/vdisk_syncneighbors_ut.cpp b/ydb/core/blobstorage/vdisk/common/vdisk_syncneighbors_ut.cpp index e03e6a461c8..1a6a7397cb5 100644 --- a/ydb/core/blobstorage/vdisk/common/vdisk_syncneighbors_ut.cpp +++ b/ydb/core/blobstorage/vdisk/common/vdisk_syncneighbors_ut.cpp @@ -9,8 +9,8 @@ namespace { return new TBlobStorageGroupInfo(TBlobStorageGroupType::Erasure4Plus2Block, 5, numDomains, numFailRealms); } - TVector<TVDiskID> GetVDisks(const TIntrusivePtr<TBlobStorageGroupInfo>& info) { - TVector<TVDiskID> ret; + TVector<TVDiskID> GetVDisks(const TIntrusivePtr<TBlobStorageGroupInfo>& info) { + TVector<TVDiskID> ret; for (const auto& x : info->GetVDisks()) { auto vd = info->GetVDiskId(x.OrderNumber); ret.push_back(vd); @@ -75,11 +75,11 @@ Y_UNIT_TEST_SUITE(TBlobStorageSyncNeighborsTest) { Y_UNIT_TEST(IterateOverAllDisks) { const ui32 numDomains = 8; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroup(numDomains, 2); - TVector<TVDiskID> vdisks = GetVDisks(info); + TVector<TVDiskID> vdisks = GetVDisks(info); const TVDiskID& self = vdisks[0]; TVDiskNeighbors<TPayload> neighbors(self, info->PickTopology()); - THashSet<TVDiskID> temp(vdisks.begin(), vdisks.end()); + THashSet<TVDiskID> temp(vdisks.begin(), vdisks.end()); for (const auto& item : neighbors) { const size_t count = temp.erase(TVDiskID(info->GroupID, info->GroupGeneration, item.VDiskIdShort)); UNIT_ASSERT_VALUES_EQUAL(count, 1); @@ -90,7 +90,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageSyncNeighborsTest) { Y_UNIT_TEST(CheckRevLookup) { const ui32 numDomains = 8; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroup(numDomains, 2); - TVector<TVDiskID> vdisks = GetVDisks(info); + TVector<TVDiskID> vdisks = GetVDisks(info); const TVDiskID& self = vdisks[0]; TVDiskNeighbors<TPayload> neighbors(self, info->PickTopology()); @@ -102,7 +102,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageSyncNeighborsTest) { Y_UNIT_TEST(CheckIsMyDomain) { const ui32 numDomains = 8; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroup(numDomains, 2); - TVector<TVDiskID> vdisks = GetVDisks(info); + TVector<TVDiskID> vdisks = GetVDisks(info); const TVDiskID& self = vdisks[0]; TVDiskNeighbors<TPayload> neighbors(self, info->PickTopology()); @@ -119,7 +119,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageSyncNeighborsTest) { Y_UNIT_TEST(SerDes) { const ui32 numDomains = 8; TIntrusivePtr<TBlobStorageGroupInfo> info = CreateTestGroup(numDomains, 2); - TVector<TVDiskID> vdisks = GetVDisks(info); + TVector<TVDiskID> vdisks = GetVDisks(info); const TVDiskID& self = vdisks[0]; TVDiskNeighborsSerializable<TPayload> neighbors(self, info->PickTopology()); diff --git a/ydb/core/blobstorage/vdisk/handoff/handoff_basic.cpp b/ydb/core/blobstorage/vdisk/handoff/handoff_basic.cpp index da29a8822b2..d936b08116a 100644 --- a/ydb/core/blobstorage/vdisk/handoff/handoff_basic.cpp +++ b/ydb/core/blobstorage/vdisk/handoff/handoff_basic.cpp @@ -134,7 +134,7 @@ namespace NKikimr { } } - TString TProxyState::ToString() const { + TString TProxyState::ToString() const { return Sprintf("MaxBytes# %" PRIu32 " Initialized# %s", MaxBytes, (Initialized ? "true" : "false")); } diff --git a/ydb/core/blobstorage/vdisk/handoff/handoff_map.h b/ydb/core/blobstorage/vdisk/handoff/handoff_map.h index 9e7480f60fe..032d3080665 100644 --- a/ydb/core/blobstorage/vdisk/handoff/handoff_map.h +++ b/ydb/core/blobstorage/vdisk/handoff/handoff_map.h @@ -32,14 +32,14 @@ namespace NKikimr { ui64 SuccessfulMoveSend = 0; ui64 FailedMoveSend = 0; - TString ToStringBuildPlanStat() const { + TString ToStringBuildPlanStat() const { return Sprintf("Total# %" PRIu64 " MarkedMoveOnly# %" PRIu64 " MarkedDeleteOnly# %" PRIu64 " MarkedMoveAndDelete# %" PRIu64 " SkippedLevelItems# %" PRIu64, ItemsTotal, ItemsMarkedMoveOnly, ItemsMarkedDeleteOnly, ItemsMarkedMoveAndDelete, SkippedLevelItems); } - TString ToStringRuntimeStat() const { + TString ToStringRuntimeStat() const { return Sprintf("SuccessfulMoveSend# %" PRIu64 " FailedMoveSend# %" PRIu64, SuccessfulMoveSend, FailedMoveSend); } @@ -125,8 +125,8 @@ namespace NKikimr { // TODO: we can store MoveMap and DelMap in a more compact way // Hints: 1. most of values are zero (we don't want to move or delete) // 2. we can store only 2 bit for every local part, not 8 bits for the whole logoblob key - TDeque<ui8> MoveMap; - TDeque<ui8> DelMap; + TDeque<ui8> MoveMap; + TDeque<ui8> DelMap; unsigned Counter; TTransformedItem TrRes; TStat Stat; diff --git a/ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp b/ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp index 9a2d1676e0e..f98ae87e8c5 100644 --- a/ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp +++ b/ydb/core/blobstorage/vdisk/handoff/handoff_proxy.cpp @@ -20,17 +20,17 @@ namespace NKikimr { } }; - typedef TIntrusiveListWithAutoDelete<TEvLocalHandoff, TDestroy> TListType; + typedef TIntrusiveListWithAutoDelete<TEvLocalHandoff, TDestroy> TListType; TIntrusivePtr<TBlobStorageGroupInfo> Info; TProxiesPtr ProxiesPtr; TVDiskInfo *VDiskInfoPtr; NHandoff::TCounters Counters; - const TString VDiskLogPrefix; + const TString VDiskLogPrefix; const THandoffParams Params; - TListType WaitQueue; - TListType InFlightQueue; + TListType WaitQueue; + TListType InFlightQueue; TPrivateProxyState State; TDuration BadStateTimeouts[TPrivateProxyState::BADNESS_MAX]; diff --git a/ydb/core/blobstorage/vdisk/handoff/handoff_synclogproxy.cpp b/ydb/core/blobstorage/vdisk/handoff/handoff_synclogproxy.cpp index 4d4f55b88bf..ae95936fc09 100644 --- a/ydb/core/blobstorage/vdisk/handoff/handoff_synclogproxy.cpp +++ b/ydb/core/blobstorage/vdisk/handoff/handoff_synclogproxy.cpp @@ -12,7 +12,7 @@ namespace NKikimr { struct TItem { ui64 OrderId; }; - typedef TDeque<TItem> TQueueType; + typedef TDeque<TItem> TQueueType; const TActorId SkeletonId; const TActorId NotifyId; diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp index 30d2aeece40..19f18318e06 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.cpp @@ -63,11 +63,11 @@ namespace NKikimr { static constexpr size_t NodeCacheMaxSize = 64; ui64 SeqWriteId = 0; - TString ErrorReport(ui64 wId, ui64 lsn) const { + TString ErrorReport(ui64 wId, ui64 lsn) const { return TStringBuilder() << "wId# " << wId << " lsn# " << lsn << " Fifo# " << FifoToString(); } - TString FifoToString() const { + TString FifoToString() const { TStringStream str; str << "{SeqWriteId# " << SeqWriteId << " data# "; if (Fifo.empty()) @@ -95,7 +95,7 @@ namespace NKikimr { : ChunkId(chunkId) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{ChunkId# " << ChunkId << "}"; return str.Str(); @@ -118,7 +118,7 @@ namespace NKikimr { : EntryPointLsn(entryPointLsn) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EntryPointLsn# " << EntryPointLsn << "}"; return str.Str(); @@ -136,7 +136,7 @@ namespace NKikimr { : HugeSlot(hugeSlot) {} - TString ToString() const { + TString ToString() const { return HugeSlot.ToString(); } }; @@ -279,7 +279,7 @@ namespace NKikimr { // prepare log record NHuge::TAllocChunkRecoveryLogRec logRec(ChunkId); - TString data = logRec.Serialize(); + TString data = logRec.Serialize(); LOG_INFO(ctx, NKikimrServices::BS_SKELETON, VDISKP(HugeKeeperCtx->VCtx->VDiskLogPrefix, @@ -337,7 +337,7 @@ namespace NKikimr { class THullHugeBlobChunkDestroyer : public TActorBootstrapped<THullHugeBlobChunkDestroyer> { std::shared_ptr<THugeKeeperCtx> HugeKeeperCtx; const TActorId NotifyID; - TVector<ui32> ChunksToFree; + TVector<ui32> ChunksToFree; const ui64 Lsn; friend class TActorBootstrapped<THullHugeBlobChunkDestroyer>; @@ -346,7 +346,7 @@ namespace NKikimr { // prepare log record Y_VERIFY_DEBUG(!ChunksToFree.empty()); NHuge::TFreeChunkRecoveryLogRec logRec(ChunksToFree); - TString data = logRec.Serialize(); + TString data = logRec.Serialize(); LOG_DEBUG(ctx, BS_HULLHUGE, VDISKP(HugeKeeperCtx->VCtx->VDiskLogPrefix, "ChunkDestroyer: bootstrap:" " chunks# %s Lsn# %" PRIu64, FormatList(ChunksToFree).data(), Lsn)); @@ -412,7 +412,7 @@ namespace NKikimr { std::shared_ptr<THugeKeeperCtx> HugeKeeperCtx; const TActorId NotifyID; const ui64 EntryPointLsn; - const TString Serialized; + const TString Serialized; friend class TActorBootstrapped<THullHugeBlobEntryPointSaver>; @@ -722,7 +722,7 @@ namespace NKikimr { State.Pers->InitiateNewEntryPointCommit(lsn, inFlightWrites); State.Committing = true; // serialize log record into string - TString serialized = State.Pers->Serialize(); + TString serialized = State.Pers->Serialize(); // run committer LOG_DEBUG(ctx, BS_HULLHUGE, diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.h b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.h index 66f3c049594..0059ceab9af 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.h +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge.h @@ -44,7 +44,7 @@ namespace NKikimr { return Data.GetSize(); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{id# " << LogoBlobId.ToString() << "}"; return str.Str(); @@ -103,7 +103,7 @@ namespace NKikimr { , SlotIsUsed(slotIsUsed) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{WId# " << WriteId << " HugeBlob# " << HugeBlob.ToString() << " Lsn# " << RecLsn << " Used# " << SlotIsUsed << "}"; @@ -127,7 +127,7 @@ namespace NKikimr { , Signature(signature) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{" << Signature.ToString() << " DelLsn# " << DeletionLsn << " Slots# " diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge_ut.cpp b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge_ut.cpp index ed64a07678e..38fa9bb78bf 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge_ut.cpp +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhuge_ut.cpp @@ -24,7 +24,7 @@ namespace NKikimr { ui32 freeChunksReservation = 2; bool oldMapCompatible = false; - auto logf = [] (const TString &state) { STR << state; }; + auto logf = [] (const TString &state) { STR << state; }; auto counters = MakeIntrusive<NMonitoring::TDynamicCounters>(); auto info = MakeIntrusive<TBlobStorageGroupInfo>(TBlobStorageGroupType::Erasure4Plus2Block); auto vctx = MakeIntrusive<TVDiskContext>(TActorId(), info->PickTopology(), counters, TVDiskID(0, 1, 0, 0, 0), @@ -38,7 +38,7 @@ namespace NKikimr { NHuge::THugeSlot hugeSlot(453, 0, 234); state->AllocatedSlots.insert(hugeSlot); - TString serialized(state->Serialize()); + TString serialized(state->Serialize()); UNIT_ASSERT(THullHugeKeeperPersState::CheckEntryPoint(serialized)); } } diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedefs.cpp b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedefs.cpp index 03c05488f61..414ece637de 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedefs.cpp +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedefs.cpp @@ -21,7 +21,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TAllocChunkRecoveryLogRec //////////////////////////////////////////////////////////////////////////// - TString TAllocChunkRecoveryLogRec::Serialize() const { + TString TAllocChunkRecoveryLogRec::Serialize() const { TStringStream str; str.Write(&ChunkId, sizeof(ui32)); // refPointLsn (for backward compatibility, can be removed) @@ -30,7 +30,7 @@ namespace NKikimr { return str.Str(); } - bool TAllocChunkRecoveryLogRec::ParseFromString(const TString &data) { + bool TAllocChunkRecoveryLogRec::ParseFromString(const TString &data) { if (data.size() != sizeof(ui32) + sizeof(ui64)) // refPointLsn(ui64) (for backward compatibility, can be removed) return false; const char *cur = data.data(); @@ -39,7 +39,7 @@ namespace NKikimr { return true; } - TString TAllocChunkRecoveryLogRec::ToString() const { + TString TAllocChunkRecoveryLogRec::ToString() const { TStringStream str; str << "{ChunkId# " << ChunkId << "}"; return str.Str(); @@ -48,7 +48,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TFreeChunkRecoveryLogRec //////////////////////////////////////////////////////////////////////////// - TString TFreeChunkRecoveryLogRec::Serialize() const { + TString TFreeChunkRecoveryLogRec::Serialize() const { TStringStream str; // refPointLsn (for backward compatibility, can be removed) ui64 refPointLsn = 0; @@ -60,7 +60,7 @@ namespace NKikimr { return str.Str(); } - bool TFreeChunkRecoveryLogRec::ParseFromString(const TString &data) { + bool TFreeChunkRecoveryLogRec::ParseFromString(const TString &data) { ChunkIds.clear(); const char *cur = data.data(); const char *end = cur + data.size(); @@ -82,7 +82,7 @@ namespace NKikimr { return true; } - TString TFreeChunkRecoveryLogRec::ToString() const { + TString TFreeChunkRecoveryLogRec::ToString() const { TStringStream str; str << "{ChunkIds# "; if (ChunkIds.empty()) @@ -106,13 +106,13 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TPutRecoveryLogRec //////////////////////////////////////////////////////////////////////////// - TString TPutRecoveryLogRec::Serialize() const { + TString TPutRecoveryLogRec::Serialize() const { TStringStream str; // LogoBlobID NKikimrProto::TLogoBlobID proto; LogoBlobIDFromLogoBlobID(LogoBlobID, &proto); - TString lbSerialized; + TString lbSerialized; bool res = proto.SerializeToString(&lbSerialized); Y_VERIFY(res); ui16 lbSerializedSize = lbSerialized.size(); @@ -133,7 +133,7 @@ namespace NKikimr { return str.Str(); } - bool TPutRecoveryLogRec::ParseFromString(const TString &data) { + bool TPutRecoveryLogRec::ParseFromString(const TString &data) { const char *cur = data.data(); const char *end = cur + data.size(); @@ -172,7 +172,7 @@ namespace NKikimr { return true; } - TString TPutRecoveryLogRec::ToString() const { + TString TPutRecoveryLogRec::ToString() const { TStringStream str; str << "{LogoBlobID# " << LogoBlobID.ToString() << " DiskAddr# " << DiskAddr.ToString() << "}"; return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedefs.h b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedefs.h index 9bb8e64c080..c64ce0b01bb 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedefs.h +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedefs.h @@ -114,7 +114,7 @@ namespace NKikimr { return TDiskPart(ChunkId, Offset, Size); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "[" << ChunkId << " " << Offset << " " << Size << "]"; return str.Str(); @@ -166,24 +166,24 @@ namespace NKikimr { : ChunkId(chunkId) {} - TString Serialize() const; - bool ParseFromString(const TString &data); - TString ToString() const; + TString Serialize() const; + bool ParseFromString(const TString &data); + TString ToString() const; }; //////////////////////////////////////////////////////////////////////////// // TFreeChunkRecoveryLogRec //////////////////////////////////////////////////////////////////////////// struct TFreeChunkRecoveryLogRec { - TVector<ui32> ChunkIds; + TVector<ui32> ChunkIds; - TFreeChunkRecoveryLogRec(const TVector<ui32> &ids) + TFreeChunkRecoveryLogRec(const TVector<ui32> &ids) : ChunkIds(ids) {} - TString Serialize() const; - bool ParseFromString(const TString &data); - TString ToString() const; + TString Serialize() const; + bool ParseFromString(const TString &data); + TString ToString() const; }; //////////////////////////////////////////////////////////////////////////// @@ -201,9 +201,9 @@ namespace NKikimr { , DiskAddr(diskAddr) {} - TString Serialize() const; - bool ParseFromString(const TString &data); - TString ToString() const; + TString Serialize() const; + bool ParseFromString(const TString &data); + TString ToString() const; }; @@ -289,11 +289,11 @@ namespace NKikimr { return str.Str(); } - const TVector<TDiskPart> &SavedData() const { + const TVector<TDiskPart> &SavedData() const { return DiskPtrs; } - const TVector<TDiskPart> &DeletedData() const { + const TVector<TDiskPart> &DeletedData() const { return Deleted; } @@ -302,11 +302,11 @@ namespace NKikimr { } private: - typedef TVector<TDiskPart> TDiskPtrs; + typedef TVector<TDiskPart> TDiskPtrs; TDiskPtrs DiskPtrs; TDiskPtrs Deleted; - NMatrix::TVectorType Parts; + NMatrix::TVectorType Parts; TCircaLsns CircaLsns; void Merge(const TDiskPart *begin, const TDiskPart *end, const NMatrix::TVectorType &parts, ui64 circaLsn) diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedelete.h b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedelete.h index f0f6ebc326e..e2d6e2ab560 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedelete.h +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugedelete.h @@ -41,7 +41,7 @@ namespace NKikimr { class TDelayedHugeBlobDeleterInfo : public TThrRefBase { // map <LastDeletionLsn> -> <number of snapshots that were taken during the time LastDeletionLsn was equal // to key>; when snapshot counter reaches zero, the key is deleted from map - TMap<ui64, ui32> CurrentSnapshots; + TMap<ui64, ui32> CurrentSnapshots; // last deletion LSN is set every time to LSN of log record containing FreeHugeBlobs vector; it is used as key // to CurrentSnapshots map; every shapshot taken when LastDeletionLsn has the specific value must be freed before @@ -64,7 +64,7 @@ namespace NKikimr { , Signature(signature) {} }; - TDeque<TRemovedHugeBlobsQueueItem> RemovedHugeBlobsQueue; + TDeque<TRemovedHugeBlobsQueueItem> RemovedHugeBlobsQueue; public: void SetActorId(const TActorId& actorId) { @@ -137,7 +137,7 @@ namespace NKikimr { ui32 index = 1; for (const auto &record : RemovedHugeBlobsQueue) { - TMap<TChunkIdx, ui32> slots; + TMap<TChunkIdx, ui32> slots; for (const TDiskPart &part : record.RemovedHugeBlobs) { ++slots[part.ChunkIdx]; } diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.cpp b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.cpp index e60200de987..264c349ce88 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.cpp +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.cpp @@ -268,7 +268,7 @@ namespace NKikimr { return AllocatedSlots != 0 || !FreeSpace.empty(); } - TString TChain::ToString() const { + TString TChain::ToString() const { TStringStream str; auto output = [&str] (const TFreeSpace &c) { for (const auto &x : c) { @@ -548,7 +548,7 @@ namespace NKikimr { } } - TString TAllChains::ToString() const { + TString TAllChains::ToString() const { TStringStream str; str << "{ChunkSize# " << ChunkSize << " AppendBlockSize# " << AppendBlockSize << " MinHugeBlobInBytes# " << MinHugeBlobInBytes << " MaxBlobInBytes# " << MaxBlobInBytes; @@ -875,7 +875,7 @@ namespace NKikimr { str << "\n"; } - TString THeap::ToString() const { + TString THeap::ToString() const { TStringStream str; str << "FreeChunks: "; str << FormatList(FreeChunks); diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.h b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.h index 651117f2b94..c4c831006d7 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.h +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.h @@ -39,7 +39,7 @@ namespace NKikimr { return SlotId; } - TString ToString() const { + TString ToString() const { TStringStream str; str << "[" << ChunkId << " " << SlotId << "]"; return str.Str(); @@ -92,10 +92,10 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class TChain : public TThrRefBase { using TChunkID = ui32; - using TFreeSpace = TMap<TChunkID, TMask>; + using TFreeSpace = TMap<TChunkID, TMask>; static constexpr ui32 MaxNumberOfSlots = 10240; // it's not a good idea to have more slots than this - const TString VDiskLogPrefix; + const TString VDiskLogPrefix; const ui32 SlotsInChunk; const TMask ConstMask; // mask of 'all slots are free' TFreeSpace FreeSpace; @@ -107,7 +107,7 @@ namespace NKikimr { static TMask BuildConstMask(const TString &prefix, ui32 slotsInChunk); public: - TChain(const TString &vdiskLogPrefix, const ui32 slotsInChunk) + TChain(const TString &vdiskLogPrefix, const ui32 slotsInChunk) : VDiskLogPrefix(vdiskLogPrefix) , SlotsInChunk(slotsInChunk) , ConstMask(BuildConstMask(vdiskLogPrefix, slotsInChunk)) @@ -127,7 +127,7 @@ namespace NKikimr { void Save(IOutputStream *s) const; void Load(IInputStream *s); bool HaveBeenUsed() const; - TString ToString() const; + TString ToString() const; void RenderHtml(IOutputStream &str) const; ui32 GetAllocatedSlots() const; void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; @@ -224,7 +224,7 @@ namespace NKikimr { Migrated = 3, }; - const TString VDiskLogPrefix; + const TString VDiskLogPrefix; const ui32 ChunkSize; const ui32 AppendBlockSize; const ui32 MinHugeBlobInBytes; @@ -248,7 +248,7 @@ namespace NKikimr { using TFreeChunks = TSet<TChunkID>; static const ui32 Signature; - const TString VDiskLogPrefix; + const TString VDiskLogPrefix; const ui32 FreeChunksReservation; TFreeChunks FreeChunks; TAllChains Chains; @@ -319,7 +319,7 @@ namespace NKikimr { // Output ////////////////////////////////////////////////////////////////////////////////////////// void RenderHtml(IOutputStream &str) const; - TString ToString() const; + TString ToString() const; void PrintOutSearchTable(IOutputStream &str) { Chains.PrintOutSearchTable(str); diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap_ut.cpp b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap_ut.cpp index 638269fdfd2..11d9ba367ae 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap_ut.cpp +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap_ut.cpp @@ -41,7 +41,7 @@ namespace NKikimr { Y_UNIT_TEST_SUITE(TBlobStorageHullHugeChain) { ///////////////////////////////////////////////////////////////////////////////////////////////////////// - void AllocateScenaryOneChunk(TChain &chain, TVector<NPrivate::TChunkSlot> &arr, ui32 slotsInChunk) { + void AllocateScenaryOneChunk(TChain &chain, TVector<NPrivate::TChunkSlot> &arr, ui32 slotsInChunk) { NPrivate::TChunkSlot id; bool res = false; res = chain.Allocate(&id); @@ -63,7 +63,7 @@ namespace NKikimr { STR << "All allocated\n"; } - void FreeScenaryOneChunk(TChain &chain, TVector<NPrivate::TChunkSlot> &arr, ui32 slotsInChunk) { + void FreeScenaryOneChunk(TChain &chain, TVector<NPrivate::TChunkSlot> &arr, ui32 slotsInChunk) { ui32 count = 0; for (const auto &x : arr) { STR << "Free: " << x.ToString() << "\n"; @@ -80,7 +80,7 @@ namespace NKikimr { void AllocFreeOneChunk(ui32 slotsInChunk) { TChain chain("vdisk", slotsInChunk); - TVector<NPrivate::TChunkSlot> arr; + TVector<NPrivate::TChunkSlot> arr; AllocateScenaryOneChunk(chain, arr, slotsInChunk); FreeScenaryOneChunk(chain, arr, slotsInChunk); } @@ -99,8 +99,8 @@ namespace NKikimr { ///////////////////////////////////////////////////////////////////////////////////////////////////////// - void PreliminaryAllocate(ui32 num, TChain &chain, TVector<NPrivate::TChunkSlot> &arr) { - TVector<ui32> chunks = {27, 9, 6, 3}; + void PreliminaryAllocate(ui32 num, TChain &chain, TVector<NPrivate::TChunkSlot> &arr) { + TVector<ui32> chunks = {27, 9, 6, 3}; for (ui32 i = 0; i < num; i++) { NPrivate::TChunkSlot id; bool res = chain.Allocate(&id); @@ -113,7 +113,7 @@ namespace NKikimr { } } - void FreeChunksScenary(TChain &chain, TVector<NPrivate::TChunkSlot> &arr, TVector<ui32> &chunks) { + void FreeChunksScenary(TChain &chain, TVector<NPrivate::TChunkSlot> &arr, TVector<ui32> &chunks) { for (const auto &x : arr) { STR << "Free " << x.ToString() << "\n"; ui32 chunkId = chain.Free(x).ChunkId; @@ -123,13 +123,13 @@ namespace NKikimr { STR << "Freeing done\n"; } - void PrintOutVec(const TVector<NPrivate::TChunkSlot> &arr) { + void PrintOutVec(const TVector<NPrivate::TChunkSlot> &arr) { for (const auto &x : arr) STR << " " << x.ToString(); } - void AllocateChunksScenary(TChain &chain, TVector<NPrivate::TChunkSlot> &arr, TVector<ui32> &chunks) { - TVector<NPrivate::TChunkSlot> tmp; + void AllocateChunksScenary(TChain &chain, TVector<NPrivate::TChunkSlot> &arr, TVector<ui32> &chunks) { + TVector<NPrivate::TChunkSlot> tmp; NPrivate::TChunkSlot id; bool res = false; for (ui32 i = 0; i < arr.size(); i++) { @@ -143,7 +143,7 @@ namespace NKikimr { } Sort(tmp.begin(), tmp.end()); - TVector<NPrivate::TChunkSlot> arr2(arr); + TVector<NPrivate::TChunkSlot> arr2(arr); Sort(arr2.begin(), arr2.end()); STR << "tmp: "; PrintOutVec(tmp); @@ -157,8 +157,8 @@ namespace NKikimr { void AllocFreeAlloc(ui32 slotsInChunk) { TChain chain("vdisk", slotsInChunk); - TVector<NPrivate::TChunkSlot> arr; - TVector<ui32> chunks; + TVector<NPrivate::TChunkSlot> arr; + TVector<ui32> chunks; PreliminaryAllocate(24, chain, arr); FreeChunksScenary(chain, arr, chunks); @@ -166,8 +166,8 @@ namespace NKikimr { } void AllocFreeRestartAlloc(ui32 slotsInChunk) { - TVector<NPrivate::TChunkSlot> arr; - TVector<ui32> chunks; + TVector<NPrivate::TChunkSlot> arr; + TVector<ui32> chunks; TStringStream serialized; @@ -311,13 +311,13 @@ namespace NKikimr { STR << "Allocated: " << slot.ToString() << "\n"; // just serialize/deserialize - TString serialized = heap.Serialize(); + TString serialized = heap.Serialize(); THeap newHeap("vdisk", chunkSize, appendBlockSize, minHugeBlobInBytes, minHugeBlobInBytes, maxBlobInBytes, overhead, freeChunksReservation, false); newHeap.ParseFromString(serialized); } - void AllocateScenary(THeap &heap, ui32 hugeBlobSize, TVector<THugeSlot> &arr) { + void AllocateScenary(THeap &heap, ui32 hugeBlobSize, TVector<THugeSlot> &arr) { heap.AddChunk(5); heap.AddChunk(3); @@ -334,7 +334,7 @@ namespace NKikimr { UNIT_ASSERT_EQUAL(heap.Allocate(hugeBlobSize, &slot, &slotSize), false); } - void FreeScenary(THeap &heap, TVector<THugeSlot> &arr) { + void FreeScenary(THeap &heap, TVector<THugeSlot> &arr) { for (const auto &x : arr) { STR << "Free: " << x.ToString() << "\n"; heap.Free(x.GetDiskPart()); @@ -357,7 +357,7 @@ namespace NKikimr { ui32 freeChunksReservation = 0; THeap heap("vdisk", chunkSize, appendBlockSize, minHugeBlobInBytes, minHugeBlobInBytes, maxBlobInBytes, overhead, freeChunksReservation, false); - TVector<THugeSlot> arr; + TVector<THugeSlot> arr; AllocateScenary(heap, 6u << 20u, arr); FreeScenary(heap, arr); @@ -372,10 +372,10 @@ namespace NKikimr { ui32 freeChunksReservation = 0; THeap heap("vdisk", chunkSize, appendBlockSize, minHugeBlobInBytes, minHugeBlobInBytes, maxBlobInBytes, overhead, freeChunksReservation, false); - TVector<THugeSlot> arr; + TVector<THugeSlot> arr; AllocateScenary(heap, 6u << 20u, arr); - TString serialized = heap.Serialize(); + TString serialized = heap.Serialize(); UNIT_ASSERT(THeap::CheckEntryPoint(serialized)); THeap newHeap("vdisk", chunkSize, appendBlockSize, minHugeBlobInBytes, minHugeBlobInBytes, maxBlobInBytes, overhead, freeChunksReservation, false); @@ -395,7 +395,7 @@ namespace NKikimr { heap.RecoveryModeAddChunk(2); heap.RecoveryModeAddChunk(34); - TVector<ui32> rmChunks; + TVector<ui32> rmChunks; rmChunks.push_back(2); rmChunks.push_back(34); heap.RecoveryModeRemoveChunks(rmChunks); diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.cpp b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.cpp index 77572ecfb6b..dd92af3b794 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.cpp +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.cpp @@ -34,7 +34,7 @@ namespace NKikimr { return str.Str(); } - TString THullHugeRecoveryLogPos::ToString() const { + TString THullHugeRecoveryLogPos::ToString() const { TStringStream str; str << "{ChunkAllocationLsn# " << ChunkAllocationLsn << " ChunkFreeingLsn# " << ChunkFreeingLsn @@ -46,7 +46,7 @@ namespace NKikimr { return str.Str(); } - TString THullHugeRecoveryLogPos::Serialize() const { + TString THullHugeRecoveryLogPos::Serialize() const { TStringStream str; str.Write(&ChunkAllocationLsn, sizeof(ui64)); str.Write(&ChunkFreeingLsn, sizeof(ui64)); @@ -58,7 +58,7 @@ namespace NKikimr { return str.Str(); } - void THullHugeRecoveryLogPos::ParseFromString(const TString &serialized) { + void THullHugeRecoveryLogPos::ParseFromString(const TString &serialized) { const char *cur = serialized.data(); ChunkAllocationLsn = *(const ui64 *)cur; cur += sizeof(ui64); @@ -76,7 +76,7 @@ namespace NKikimr { cur += sizeof(ui64); } - bool THullHugeRecoveryLogPos::CheckEntryPoint(const TString &serialized) { + bool THullHugeRecoveryLogPos::CheckEntryPoint(const TString &serialized) { return serialized.size() == SerializedSize; } @@ -164,7 +164,7 @@ namespace NKikimr { const ui32 overhead, const ui32 freeChunksReservation, const bool oldMapCompatible, - std::function<void(const TString&)> logFunc) + std::function<void(const TString&)> logFunc) : VCtx(std::move(vctx)) , LogPos(THullHugeRecoveryLogPos::Default()) , CommittedLogPos(LogPos) @@ -190,8 +190,8 @@ namespace NKikimr { const ui32 freeChunksReservation, const bool oldMapCompatible, const ui64 entryPointLsn, - const TString &entryPointData, - std::function<void(const TString&)> logFunc) + const TString &entryPointData, + std::function<void(const TString&)> logFunc) : VCtx(std::move(vctx)) , LogPos(THullHugeRecoveryLogPos::Default()) , CommittedLogPos(LogPos) @@ -213,18 +213,18 @@ namespace NKikimr { THullHugeKeeperPersState::~THullHugeKeeperPersState() { } - TString THullHugeKeeperPersState::Serialize() const { + TString THullHugeKeeperPersState::Serialize() const { TStringStream str; // signature str.Write(&Signature, sizeof(ui32)); // log pos - TString serializedLogPos = LogPos.Serialize(); + TString serializedLogPos = LogPos.Serialize(); Y_VERIFY_DEBUG(serializedLogPos.size() == THullHugeRecoveryLogPos::SerializedSize); str.Write(serializedLogPos.data(), THullHugeRecoveryLogPos::SerializedSize); // heap - TString serializedHeap = Heap->Serialize(); + TString serializedHeap = Heap->Serialize(); ui32 heapSize = serializedHeap.size(); str.Write(&heapSize, sizeof(ui32)); str.Write(serializedHeap.data(), heapSize); @@ -246,20 +246,20 @@ namespace NKikimr { return str.Str(); } - void THullHugeKeeperPersState::ParseFromString(const TString &data) { + void THullHugeKeeperPersState::ParseFromString(const TString &data) { AllocatedSlots.clear(); const char *cur = data.data(); cur += sizeof(ui32); // signature // log pos - LogPos.ParseFromString(TString(cur, cur + THullHugeRecoveryLogPos::SerializedSize)); + LogPos.ParseFromString(TString(cur, cur + THullHugeRecoveryLogPos::SerializedSize)); cur += THullHugeRecoveryLogPos::SerializedSize; // log pos // heap ui32 heapSize = ReadUnaligned<ui32>(cur); cur += sizeof(ui32); // heap size - Heap->ParseFromString(TString(cur, cur + heapSize)); + Heap->ParseFromString(TString(cur, cur + heapSize)); cur += heapSize; // chunks to free @@ -286,7 +286,7 @@ namespace NKikimr { return TString(cur, cur + THullHugeRecoveryLogPos::SerializedSize); } - bool THullHugeKeeperPersState::CheckEntryPoint(const TString &data) { + bool THullHugeKeeperPersState::CheckEntryPoint(const TString &data) { const char *cur = data.data(); const char *end = cur + data.size(); @@ -300,7 +300,7 @@ namespace NKikimr { return false; // log pos - if (!THullHugeRecoveryLogPos::CheckEntryPoint(TString(cur, cur + THullHugeRecoveryLogPos::SerializedSize))) + if (!THullHugeRecoveryLogPos::CheckEntryPoint(TString(cur, cur + THullHugeRecoveryLogPos::SerializedSize))) return false; cur += THullHugeRecoveryLogPos::SerializedSize; // log pos @@ -309,7 +309,7 @@ namespace NKikimr { cur += sizeof(ui32); // heap size if (size_t(end - cur) < heapSize) return false; - if (!NHuge::THeap::CheckEntryPoint(TString(cur, cur + heapSize))) + if (!NHuge::THeap::CheckEntryPoint(TString(cur, cur + heapSize))) return false; cur += heapSize; @@ -333,7 +333,7 @@ namespace NKikimr { return true; } - TString THullHugeKeeperPersState::ToString() const { + TString THullHugeKeeperPersState::ToString() const { TStringStream str; str << "LogPos: " << LogPos.ToString(); str << " AllocatedSlots:"; @@ -594,7 +594,7 @@ namespace NKikimr { VDISKP(VCtx->VDiskLogPrefix, "Recovery(guid# %" PRIu64 ") finished", Guid)); } - void THullHugeKeeperPersState::GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void THullHugeKeeperPersState::GetOwnedChunks(TSet<TChunkIdx>& chunks) const { Heap->GetOwnedChunks(chunks); } diff --git a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h index 7d6bbca7937..3e265cf1e6f 100644 --- a/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h +++ b/ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugerecovery.h @@ -44,10 +44,10 @@ namespace NKikimr { ui64 FirstLsnToKeep() const; TString FirstLsnToKeepDecomposed() const; - TString ToString() const; - TString Serialize() const; - void ParseFromString(const TString &serialized); - static bool CheckEntryPoint(const TString &serialized); + TString ToString() const; + TString Serialize() const; + void ParseFromString(const TString &serialized); + static bool CheckEntryPoint(const TString &serialized); }; //////////////////////////////////////////////////////////////////////////// @@ -110,7 +110,7 @@ namespace NKikimr { class THeap; struct THullHugeKeeperPersState { - typedef THashSet<NHuge::THugeSlot> TAllocatedSlots; + typedef THashSet<NHuge::THugeSlot> TAllocatedSlots; static const ui32 Signature; static const ui32 MilestoneHugeBlobInBytes; @@ -138,7 +138,7 @@ namespace NKikimr { const ui32 overhead, const ui32 freeChunksReservation, const bool oldMapCompatible, - std::function<void(const TString&)> logFunc); + std::function<void(const TString&)> logFunc); THullHugeKeeperPersState(TIntrusivePtr<TVDiskContext> vctx, const ui32 chunkSize, const ui32 appendBlockSize, @@ -149,15 +149,15 @@ namespace NKikimr { const ui32 freeChunksReservation, const bool oldMapCompatible, const ui64 entryPointLsn, - const TString &entryPointData, - std::function<void(const TString&)> logFunc); + const TString &entryPointData, + std::function<void(const TString&)> logFunc); ~THullHugeKeeperPersState(); - TString Serialize() const; - void ParseFromString(const TString &data); + TString Serialize() const; + void ParseFromString(const TString &data); static TString ExtractLogPosition(const TString &data); - static bool CheckEntryPoint(const TString &data); - TString ToString() const; + static bool CheckEntryPoint(const TString &data); + TString ToString() const; void RenderHtml(IOutputStream &str) const; ui32 GetMinREALHugeBlobInBytes() const; ui64 FirstLsnToKeep() const; @@ -203,7 +203,7 @@ namespace NKikimr { const TString &data); void FinishRecovery(const TActorContext &ctx); - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; }; } // NHuge diff --git a/ydb/core/blobstorage/vdisk/huge/booltt.h b/ydb/core/blobstorage/vdisk/huge/booltt.h index 13a29604491..6b3d6a6f65c 100644 --- a/ydb/core/blobstorage/vdisk/huge/booltt.h +++ b/ydb/core/blobstorage/vdisk/huge/booltt.h @@ -24,7 +24,7 @@ public: } }; - using TContainer = TVector<TRec>; + using TContainer = TVector<TRec>; using TTop = ::TTop<TRec, 8, TContainer, TLess>; TInstant Start; diff --git a/ydb/core/blobstorage/vdisk/hulldb/barriers/hullds_cache_barrier.h b/ydb/core/blobstorage/vdisk/hulldb/barriers/hullds_cache_barrier.h index 7983b97a947..6acb5126cfe 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/barriers/hullds_cache_barrier.h +++ b/ydb/core/blobstorage/vdisk/hulldb/barriers/hullds_cache_barrier.h @@ -24,7 +24,7 @@ namespace NKikimr { return std::make_tuple(Gen, Step); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Gen# " << Gen << " Step# " << Step << "}"; return str.Str(); @@ -35,7 +35,7 @@ namespace NKikimr { TMaybe<TCollectBarrier> Soft; TMaybe<TCollectBarrier> Hard; - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Soft# " << (Soft ? Soft->ToString() : "<not set>") << " Hard# " << (Hard ? Hard->ToString() : "<not set>") @@ -44,7 +44,7 @@ namespace NKikimr { } }; - THashMap<TKey, TValue> Cache; + THashMap<TKey, TValue> Cache; public: void Build(const THullDs *hullDs) { @@ -82,7 +82,7 @@ namespace NKikimr { } } - bool Keep(const TLogoBlobID& id, bool keepByIngress, TString *explanation = nullptr) const { + bool Keep(const TLogoBlobID& id, bool keepByIngress, TString *explanation = nullptr) const { const TKey key(id.TabletID(), id.Channel()); auto it = Cache.find(key); if (it == Cache.end()) { diff --git a/ydb/core/blobstorage/vdisk/hulldb/barriers/hullds_gcessence_defs.h b/ydb/core/blobstorage/vdisk/hulldb/barriers/hullds_gcessence_defs.h index 40132629ced..adfbb96199c 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/barriers/hullds_gcessence_defs.h +++ b/ydb/core/blobstorage/vdisk/hulldb/barriers/hullds_gcessence_defs.h @@ -90,7 +90,7 @@ namespace NKikimr { str << TabletId << ":" << Channel; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); @@ -138,7 +138,7 @@ namespace NKikimr { str << "Issued:[" << BarrierGen << ":" << BarrierGenCounter << "]" << " -> Collect:[" << CollectGen << ":" << CollectStep << "]"; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h index 56fcf7a9e8c..bb4fb3c53c4 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h +++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob.h @@ -108,7 +108,7 @@ namespace NKikimr { return PartOffs[part + 1] - PartOffs[part]; } - NMatrix::TVectorType GetParts() const { + NMatrix::TVectorType GetParts() const { return Parts; } @@ -327,7 +327,7 @@ namespace NKikimr { std::swap(Blob, m.Blob); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{FullDataSize# " << Blob.GetFullDataSize() << " Parts# " << Blob.GetParts().ToString() << "}"; return str.Str(); @@ -338,7 +338,7 @@ namespace NKikimr { } protected: - void AddImpl(const TDiskBlob &addBlob, NMatrix::TVectorType addParts) { + void AddImpl(const TDiskBlob &addBlob, NMatrix::TVectorType addParts) { for (auto it = addBlob.begin(); it != addBlob.end(); ++it) { const ui8 part = it.GetPartId() - 1; if (addParts.Get(part)) { @@ -372,14 +372,14 @@ namespace NKikimr { AddFilterMask.Clear(); } - void SetFilterMask(NMatrix::TVectorType mask) { + void SetFilterMask(NMatrix::TVectorType mask) { Y_VERIFY(!AddFilterMask); AddFilterMask = mask; } void Add(const TDiskBlob &addBlob) { Y_VERIFY(AddFilterMask); - NMatrix::TVectorType addParts = addBlob.GetParts() & *AddFilterMask; + NMatrix::TVectorType addParts = addBlob.GetParts() & *AddFilterMask; if (!addParts.Empty()) { TDiskBlobMerger::AddImpl(addBlob, addParts); } @@ -398,7 +398,7 @@ namespace NKikimr { } private: - TMaybe<NMatrix::TVectorType> AddFilterMask; + TMaybe<NMatrix::TVectorType> AddFilterMask; }; } // NKikimr diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob_ut.cpp b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob_ut.cpp index 5774a53a39d..a3de9453a31 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob_ut.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_blob_ut.cpp @@ -30,7 +30,7 @@ namespace NKikimr { for (ui32 mask = 1; mask < (1 << totalParts); ++mask) { std::array<TRope, MaxTotalPartCount> partsData; ui32 numParts = 0; - NMatrix::TVectorType parts(0, totalParts); + NMatrix::TVectorType parts(0, totalParts); for (ui8 i = 0; i < totalParts; ++i) { if (mask >> i & 1) { partsData[numParts++] = TRope(TString(data[i], partSize)); @@ -56,9 +56,9 @@ namespace NKikimr { Y_UNIT_TEST(CreateIterate) { ui8 partId = 2; - TString data("abcdefgh"); + TString data("abcdefgh"); TRope buf = TDiskBlob::Create(16, partId, 3, TRope(data), Arena); - NMatrix::TVectorType localParts(0, 3); + NMatrix::TVectorType localParts(0, 3); localParts.Set(partId - 1); TDiskBlob blob(&buf, localParts, GType, TLogoBlobID(0, 0, 0, 0, data.size(), 0)); for (TDiskBlob::TPartIterator it = blob.begin(), e = blob.end(); it != e; ++it) { @@ -68,29 +68,29 @@ namespace NKikimr { } Y_UNIT_TEST(Merge) { - TString data("abcdefgh"); + TString data("abcdefgh"); // blob1 ui8 partId1 = 1; TRope buf1 = TDiskBlob::Create(16, partId1, 8, TRope(data), Arena); - NMatrix::TVectorType localParts1(0, 3); + NMatrix::TVectorType localParts1(0, 3); localParts1.Set(partId1 - 1); TDiskBlob blob1(&buf1, localParts1, GType, TLogoBlobID(0, 0, 0, 0, data.size(), 0)); // blob2 ui8 partId2 = 3; TRope buf2 = TDiskBlob::Create(16, partId2, 8, TRope(data), Arena); - NMatrix::TVectorType localParts2(0, 3); + NMatrix::TVectorType localParts2(0, 3); localParts2.Set(partId2 - 1); TDiskBlob blob2(&buf2, localParts2, GType, TLogoBlobID(0, 0, 0, 0, data.size(), 0)); // merge vars TDiskBlobMerger merger; - TVector<ui8> ppp; - TVector<ui8> resPpp; + TVector<ui8> ppp; + TVector<ui8> resPpp; resPpp.push_back(1); resPpp.push_back(3); - NMatrix::TVectorType resParts(0, 3); + NMatrix::TVectorType resParts(0, 3); resParts.Set(partId1 - 1); resParts.Set(partId2 - 1); @@ -141,7 +141,7 @@ namespace NKikimr { continue; } - NMatrix::TVectorType partsToStore(0, numParts); + NMatrix::TVectorType partsToStore(0, numParts); for (ui8 i = 0; i < numParts; ++i) { if (mask2 >> i & 1) { partsToStore.Set(i); @@ -152,7 +152,7 @@ namespace NKikimr { m.SetFilterMask(partsToStore); for (ui8 i = 0; i < numParts; ++i) { if (mask1 >> i & 1) { - NMatrix::TVectorType v(0, numParts); + NMatrix::TVectorType v(0, numParts); v.Set(i); TRope buffer = TDiskBlob::Create(100, i + 1, numParts, TRope(Sprintf("%08x", i)), Arena); m.Add(TDiskBlob(&buffer, v, GType, TLogoBlobID(0, 0, 0, 0, 8, 0))); @@ -162,7 +162,7 @@ namespace NKikimr { TDiskBlobMerger m2; for (ui8 i = 0; i < numParts; ++i) { if ((mask1 & mask2) >> i & 1) { - NMatrix::TVectorType v(0, numParts); + NMatrix::TVectorType v(0, numParts); v.Set(i); TRope buffer = TDiskBlob::Create(100, i + 1, numParts, TRope(Sprintf("%08x", i)), Arena); m2.Add(TDiskBlob(&buffer, v, GType, TLogoBlobID(0, 0, 0, 0, 8, 0))); diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp index a603cc28c20..aeff48e422e 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.cpp @@ -33,7 +33,7 @@ namespace NKikimr { } bool TPutRecoveryLogRecOpt::ParseFromString(const TBlobStorageGroupType >ype, - const TString &data) { + const TString &data) { const char *pos = data.data(); const char *end = data.data() + data.size(); if (size_t(end - pos) < 24) @@ -48,11 +48,11 @@ namespace NKikimr { if (size_t(end - pos) != partSize) return false; - Data = TString(pos, partSize); + Data = TString(pos, partSize); return true; } - TString TPutRecoveryLogRecOpt::ToString() const { + TString TPutRecoveryLogRecOpt::ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h index 4719a39e728..dccfc2d00ac 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h +++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hulldefs.h @@ -56,7 +56,7 @@ namespace NKikimr { return *Begin; } - TString ToString() const { + TString ToString() const { if (Begin == End) return "empty"; else { @@ -185,11 +185,11 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// struct TPutRecoveryLogRecOpt { TLogoBlobID Id; - TString Data; + TString Data; static TString Serialize(const TBlobStorageGroupType >ype, const TLogoBlobID &id, const TRope &rope); - bool ParseFromString(const TBlobStorageGroupType >ype, const TString &data); - TString ToString() const; + bool ParseFromString(const TBlobStorageGroupType >ype, const TString &data); + TString ToString() const; void Output(IOutputStream &str) const; }; diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullsatisfactionrank.h b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullsatisfactionrank.h index faefa8ac859..7b8266d325d 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullsatisfactionrank.h +++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullsatisfactionrank.h @@ -207,7 +207,7 @@ namespace NKikimr { str << "[" << (Changed ? "true" : "false") << ", " << Weight << "]"; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h index 5d8f3fa51d1..0634927876f 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h +++ b/ydb/core/blobstorage/vdisk/hulldb/base/blobstorage_hullstorageratio.h @@ -68,13 +68,13 @@ namespace NKikimr { << "}"; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); } - TString MonSummary() const { + TString MonSummary() const { TStringStream str; str << Fraction(IndexItemsKeep, IndexItemsTotal) << " / " << Fraction(IndexBytesKeep, IndexBytesTotal) << " / " @@ -87,7 +87,7 @@ namespace NKikimr { return "Idx% / IdxB% / InplB% / HugeB%"; } - static TString Fraction(ui64 keep, ui64 total) { + static TString Fraction(ui64 keep, ui64 total) { Y_VERIFY(keep <= total); if (total == 0) return "NA"; @@ -123,7 +123,7 @@ namespace NKikimr { return Ratio; } - TString MonSummary() const { + TString MonSummary() const { TSstRatioPtr ratio = Get(); return ratio ? ratio->MonSummary() : "UNK"; } diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.cpp b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.cpp index b88dc277c2b..95a6a14041a 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.cpp @@ -19,7 +19,7 @@ return false; \ str = endptr + 1; - bool TKeyBarrier::Parse(TKeyBarrier &out, const TString &buf, TString &errorExplanation) { + bool TKeyBarrier::Parse(TKeyBarrier &out, const TString &buf, TString &errorExplanation) { const char *str = buf.data(); char *endptr = nullptr; diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.h b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.h index 4afce21c055..54cf1ac77af 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.h +++ b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier.h @@ -66,7 +66,7 @@ namespace NKikimr { , GenCounter(proto.GetPerGenerationCounter()) {} - TString ToString() const { + TString ToString() const { return Sprintf("[%16" PRIu64 " %" PRIu32 " %" PRIu32 " %" PRIu32 " %s]", TabletId, Channel, Gen, GenCounter, Hard ? "hard" : "soft"); } @@ -100,7 +100,7 @@ namespace NKikimr { return TKeyBarrier(Max<ui64>(), Max<ui32>(), Max<ui32>(), Max<ui32>(), true); } - static bool Parse(TKeyBarrier &out, const TString &buf, TString &errorExplanation); + static bool Parse(TKeyBarrier &out, const TString &buf, TString &errorExplanation); auto ConvertToTuple() const { return std::make_tuple(TabletId, Channel, Hard, Gen, GenCounter); @@ -189,7 +189,7 @@ namespace NKikimr { } NMatrix::TVectorType GetLocalParts(TBlobStorageGroupType) const { - return NMatrix::TVectorType(); + return NMatrix::TVectorType(); } void ClearLocalParts(TBlobStorageGroupType) @@ -199,7 +199,7 @@ namespace NKikimr { return TBlobType::DiskBlob; } - TString ToString(const TIngressCache *cache, const TDiskPart *outbound = nullptr) const { + TString ToString(const TIngressCache *cache, const TDiskPart *outbound = nullptr) const { Y_UNUSED(outbound); return Sprintf("{CollectGen: %" PRIu32 " CollectStep: %" PRIu32 " Ingress: %s}", diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier_ut.cpp b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier_ut.cpp index 644c9290a86..a6e270e7138 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier_ut.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_barrier_ut.cpp @@ -8,7 +8,7 @@ namespace NKikimr { Y_UNIT_TEST(ParseTest) { TKeyBarrier id; TKeyBarrier expected; - TString explanation; + TString explanation; bool res = false; res = TKeyBarrier::Parse(id, "[ 0:0:34:15]", explanation); diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_block.h b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_block.h index 72e38257f2a..a18d99c6b4a 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_block.h +++ b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_block.h @@ -30,7 +30,7 @@ namespace NKikimr { : TabletId(tabletId) {} - TString ToString() const { + TString ToString() const { return Sprintf("[%16" PRIu64 "]", TabletId); } @@ -138,7 +138,7 @@ namespace NKikimr { } NMatrix::TVectorType GetLocalParts(TBlobStorageGroupType) const { - return NMatrix::TVectorType(); + return NMatrix::TVectorType(); } void ClearLocalParts(TBlobStorageGroupType) @@ -148,7 +148,7 @@ namespace NKikimr { return TBlobType::DiskBlob; } - TString ToString(const TIngressCache *cache, const TDiskPart *outbound = nullptr) const { + TString ToString(const TIngressCache *cache, const TDiskPart *outbound = nullptr) const { Y_UNUSED(cache); Y_UNUSED(outbound); return Sprintf("{BlockedGen: %" PRIu32 "}", BlockedGeneration); diff --git a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_logoblob.h b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_logoblob.h index 95d32d80f4c..9dc21306fff 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_logoblob.h +++ b/ydb/core/blobstorage/vdisk/hulldb/base/hullbase_logoblob.h @@ -37,7 +37,7 @@ namespace NKikimr { return TLogoBlobID(Raw); } - TString ToString() const { + TString ToString() const { return LogoBlobID().ToString(); } @@ -196,7 +196,7 @@ namespace NKikimr { return TBlobType::EType(Type); } - NMatrix::TVectorType GetLocalParts(const TBlobStorageGroupType >ype) const { + NMatrix::TVectorType GetLocalParts(const TBlobStorageGroupType >ype) const { return Ingress.LocalParts(gtype); } @@ -204,7 +204,7 @@ namespace NKikimr { Ingress = Ingress.CopyWithoutLocal(gtype); } - TString ToString(const TIngressCache *cache, const TDiskPart *outbound) const { + TString ToString(const TIngressCache *cache, const TDiskPart *outbound) const { Y_UNUSED(cache); TStringStream str; TBlobType::EType t = GetType(); diff --git a/ydb/core/blobstorage/vdisk/hulldb/blobstorage_hullgcmap.h b/ydb/core/blobstorage/vdisk/hulldb/blobstorage_hullgcmap.h index 5161a503f7b..452fb0a6000 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/blobstorage_hullgcmap.h +++ b/ydb/core/blobstorage/vdisk/hulldb/blobstorage_hullgcmap.h @@ -42,7 +42,7 @@ namespace NKikimr { KeepItemsDbgStream << "}"; } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Total# " << ItemsTotal << " IndexKeep# " << ItemsKeepIndex << " DataKeep# " << ItemsKeepData; str << " " << KeepItemsDbgStream.Str() << "}"; diff --git a/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_defs.h b/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_defs.h index 8d5bd560293..7cc730de5c7 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_defs.h +++ b/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_defs.h @@ -324,7 +324,7 @@ namespace NKikimr { return GetPtr()->CollectDeletedSsts(); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{" << ActionToStr(Action); if (auto *ptr = GetPtr()) { @@ -367,7 +367,7 @@ namespace NKikimr { } private: - TVector<ui32> BoundaryPerLevel; + TVector<ui32> BoundaryPerLevel; }; using TBoundariesConstPtr = TIntrusiveConstPtr<TBoundaries>; diff --git a/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_ratio.h b/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_ratio.h index fe2a48fc9ef..25fd2bd219c 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_ratio.h +++ b/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_ratio.h @@ -59,7 +59,7 @@ namespace NKikimr { bool BreakedActualRatio = false; bool BreakedTimeout = false; - TString ToString() const { + TString ToString() const { auto bool2str = [] (bool v) { return v ? "true" : "false"; }; return Sprintf("{SstsChecked# %" PRIu32 " BreakedActualRatio# %s " "BreakedTimeout# %s}", SstsChecked, bool2str(BreakedActualRatio), @@ -81,7 +81,7 @@ namespace NKikimr { } }; - void OrderSstByStorageRatioTime(TVector<TTimeSst> &vec) { + void OrderSstByStorageRatioTime(TVector<TTimeSst> &vec) { vec.clear(); TSstIterator it(&LevelSnap.SliceSnap); it.SeekToFirst(); @@ -99,7 +99,7 @@ namespace NKikimr { const TDuration &calcDuration = HullCtx->HullCompStorageRatioMaxCalcDuration; // order all ssts (including level 0) by storage ratio calculation time - TVector<TTimeSst> vec; + TVector<TTimeSst> vec; vec.reserve(1000u); OrderSstByStorageRatioTime(vec); diff --git a/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_space.h b/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_space.h index 6014216174e..a69b699658c 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_space.h +++ b/ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_space.h @@ -89,7 +89,7 @@ namespace NKikimr { return Present && Rank > FreeSpaceThreshold; } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Rank# " << Rank << " Level# " << LevelSstPtr.Level << "}"; return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment.h b/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment.h index 70f91fee69a..17e68959b36 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment.h +++ b/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment.h @@ -85,8 +85,8 @@ namespace NKikimr { void PutLogoBlobWithData(ui64 lsn, const TKey &key, ui8 partId, const TIngress &ingress, TRope buffer); const TRope& GetLogoBlobData(const TMemPart& memPart) const; void Put(ui64 lsn, const TKey &key, const TMemRec &memRec); - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; - void GetHugeBlobs(TSet<TDiskPart> &hugeBlobs) const; + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; + void GetHugeBlobs(TSet<TDiskPart> &hugeBlobs) const; class TBaseIterator; class TForwardIterator; diff --git a/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h b/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h index 3ebf8e8bea3..fd6f9d6ce61 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h +++ b/ydb/core/blobstorage/vdisk/hulldb/fresh/fresh_segment_impl.h @@ -56,7 +56,7 @@ namespace NKikimr { } }; - TString ToString() const { + TString ToString() const { TStringStream str; str << "[Key# " << Key.ToString() << " Lsn# " << Lsn << "]"; return str.Str(); @@ -343,7 +343,7 @@ namespace NKikimr { } // append chunk ids to the vector - void FillInChunkIds(TVector<ui32> &vec) const { + void FillInChunkIds(TVector<ui32> &vec) const { // fresh doesn't have chunks Y_UNUSED(vec); } diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hulldatamerger.h b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hulldatamerger.h index d079669cc3d..0d8e0e4dc82 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hulldatamerger.h +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hulldatamerger.h @@ -89,7 +89,7 @@ namespace NKikimr { return HugeBlobMerger; } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{DiskBlobMerger# " << DiskBlobMerger.ToString(); str << " HugeBlobMerger# " << HugeBlobMerger.ToString() << "}"; diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullmergeits.h b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullmergeits.h index a80bf7f3034..c17a3297cec 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullmergeits.h +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullmergeits.h @@ -6,7 +6,7 @@ namespace NKikimr { template <class TSubsIterator, class TDbIterator> - TString MergeIteratorWithWholeDbDefaultCrashReport(const TString &logPrefix, const TSubsIterator &subsIt, const TDbIterator &dbIt) { + TString MergeIteratorWithWholeDbDefaultCrashReport(const TString &logPrefix, const TSubsIterator &subsIt, const TDbIterator &dbIt) { TStringStream str; str << logPrefix << "SubsIt: "; if (subsIt.Valid()) diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hulloptlsn.h b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hulloptlsn.h index bfa5df36289..f156f7b8a62 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hulloptlsn.h +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hulloptlsn.h @@ -54,7 +54,7 @@ namespace NKikimr { out << "Set(" << Lsn << ")"; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullrecmerger.h b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullrecmerger.h index 76654ea7aa9..364fa392c25 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullrecmerger.h +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullrecmerger.h @@ -186,7 +186,7 @@ namespace NKikimr { Y_VERIFY(memRec.GetType() == TBlobType::HugeBlob); TDiskDataExtractor extr; memRec.GetDiskData(&extr, nullptr); - const NMatrix::TVectorType v = memRec.GetLocalParts(GType); + const NMatrix::TVectorType v = memRec.GetLocalParts(GType); DataMerger.AddHugeBlob(extr.Begin, extr.End, v, lsn); } } @@ -327,7 +327,7 @@ namespace NKikimr { } // add read small blob content; they should come in order as returned from GetSmallBlobDiskParts by index merger - void AddReadSmallBlob(TString data) { + void AddReadSmallBlob(TString data) { Y_VERIFY(ProducingSmallBlob); ReadSmallBlobs.push_back(std::move(data)); } @@ -341,7 +341,7 @@ namespace NKikimr { Y_VERIFY(count == +MemRecs, "count# %zu +MemRecs# %zu", count, +MemRecs); for (size_t i = 0; i < count; ++i) { const TMemRec& memRec = MemRecs[i]->GetMemRec(); - const TString& buffer = ReadSmallBlobs[i]; + const TString& buffer = ReadSmallBlobs[i]; Y_VERIFY(buffer.size() == memRec.DataSize()); DataMerger.AddBlob(TDiskBlob(buffer.data(), buffer.size(), memRec.GetLocalParts(GType))); } @@ -360,7 +360,7 @@ namespace NKikimr { } private: - TVector<TString> ReadSmallBlobs; + TVector<TString> ReadSmallBlobs; }; @@ -421,7 +421,7 @@ namespace NKikimr { const TDiskPart *dataPtr = extr.Begin; ui8 i = v.FirstPosition(); while (i != v.GetSize() && dataPtr != extr.End) { - NMatrix::TVectorType onePart(0, v.GetSize()); + NMatrix::TVectorType onePart(0, v.GetSize()); onePart.Set(i); // deduplicate every huge blob LastWriteWinsMerger.Add(*dataPtr, onePart, circaLsn); diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullwritesst.h b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullwritesst.h index 930fce08e65..0865620809c 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullwritesst.h +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullwritesst.h @@ -155,7 +155,7 @@ namespace NKikimr { public: TBaseWriter(TMemoryConsumer&& consumer, ui8 owner, ui64 ownerRound, ui8 priority, ui32 chunkSize, ui32 appendBlockSize, ui32 writeBlockSize, TQueue<std::unique_ptr<NPDisk::TEvChunkWrite>>& msgQueue, - TDeque<TChunkIdx>& rchunks) + TDeque<TChunkIdx>& rchunks) : Consumer(std::move(consumer)) , Owner(owner) , OwnerRound(ownerRound) @@ -168,7 +168,7 @@ namespace NKikimr { , UsedChunks() {} - const TVector<ui32> &GetUsedChunks() const { + const TVector<ui32> &GetUsedChunks() const { return UsedChunks; } @@ -254,8 +254,8 @@ namespace NKikimr { const ui32 AppendBlockSize; const ui32 WriteBlockSize; TQueue<std::unique_ptr<NPDisk::TEvChunkWrite>>& MsgQueue; - TDeque<ui32>& RChunks; - TVector<ui32> UsedChunks; + TDeque<ui32>& RChunks; + TVector<ui32> UsedChunks; std::unique_ptr<TBufferedChunkWriter> ChunkWriter; }; @@ -264,7 +264,7 @@ namespace NKikimr { /////////////////////////////////////////////////////////////////////////////////////////////////////////// struct TDataWriterConclusion { std::unique_ptr<TBufferedChunkWriter> Writer; - TVector<ui32> UsedChunks; + TVector<ui32> UsedChunks; TDataWriterConclusion(std::unique_ptr<TBufferedChunkWriter>&& writer, TVector<ui32>&& usedChunks) : Writer(std::move(writer)) @@ -277,13 +277,13 @@ namespace NKikimr { /////////////////////////////////////////////////////////////////////////////////////////////////////////// template<typename TKey, typename TMemRec> struct TIndexWriterConclusion { - TVector<ui32> UsedChunks; + TVector<ui32> UsedChunks; TDiskPart Addr; // entry point ui32 IndexParts = 0; ui32 OutboundItems = 0; TIntrusivePtr<TLevelSegment<TKey, TMemRec>> LevelSegment; - TString ToString() const { + TString ToString() const { TStringStream s; s << "{Addr: " << Addr.ToString() << " IndexParts: " << IndexParts; if (OutboundItems) @@ -314,7 +314,7 @@ namespace NKikimr { public: TDataWriter(TVDiskContextPtr vctx, EWriterDataType type, ui8 owner, ui64 ownerRound, ui32 chunkSize, ui32 appendBlockSize, ui32 writeBlockSize, TQueue<std::unique_ptr<NPDisk::TEvChunkWrite>>& msgQueue, - TDeque<TChunkIdx>& rchunks) + TDeque<TChunkIdx>& rchunks) : TBase(TMemoryConsumer(WriterDataTypeToMemConsumer(vctx, type, true)), owner, ownerRound, @@ -515,7 +515,7 @@ namespace NKikimr { break; } case TBlobType::HugeBlob: { - const TVector<TDiskPart> &saved = dataMerger->GetHugeBlobMerger().SavedData(); + const TVector<TDiskPart> &saved = dataMerger->GetHugeBlobMerger().SavedData(); Y_VERIFY(saved.size() == 1); TMemRec memRecTmp(memRec); @@ -613,7 +613,7 @@ namespace NKikimr { const ui32 AppendBlockSize; const ui32 WriteBlockSize; TQueue<std::unique_ptr<NPDisk::TEvChunkWrite>>& MsgQueue; - TDeque<TChunkIdx>& RChunks; + TDeque<TChunkIdx>& RChunks; ui32 RecsPos; ui32 OutboundPos; ui64 InplaceDataTotalSize; diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullwritesst_ut.cpp b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullwritesst_ut.cpp index 2bd6de3d43c..fb456ab9f24 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullwritesst_ut.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/blobstorage_hullwritesst_ut.cpp @@ -41,18 +41,18 @@ namespace NKikimr { , Step(step) {} - TString ToString() const { + TString ToString() const { return Sprintf("%s step: %u", WriterConclusion.ToString().data(), Step); } }; struct TAllStat { - TVector<TSstStat> Stat; + TVector<TSstStat> Stat; void Push(const TIndexWriterConclusion<TKey, TMemRec> &writerStat, ui32 step) { Stat.push_back(TSstStat(writerStat, step)); } - TString ToString() const { + TString ToString() const { TStringStream s; bool space = false; for (const auto &stat : Stat) { @@ -82,7 +82,7 @@ namespace NKikimr { ReservedChunks.push_back(i); } - void Test(ui32 maxStep, const TString &data); + void Test(ui32 maxStep, const TString &data); void TestOutbound(ui32 maxStep); void Test(ui32 maxGen); @@ -107,7 +107,7 @@ namespace NKikimr { const ui32 WriteBlockSize; std::unique_ptr<TWriter> WriterPtr; - TDeque<ui32> ReservedChunks; + TDeque<ui32> ReservedChunks; TAllStat Stat; THashMap<ui32, TMap<ui32, ui32>> WriteSpan; @@ -152,7 +152,7 @@ namespace NKikimr { template <> - void TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob>::Test(ui32 maxStep, const TString &data) { + void TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob>::Test(ui32 maxStep, const TString &data) { TTLogoBlobCompactRecordMerger merger(TBlobStorageGroupType::ErasureMirror3); for (ui32 step = 0; step < maxStep; step++) { @@ -163,7 +163,7 @@ namespace NKikimr { TIngress ingress(ingressMagic); TMemRecLogoBlob memRec(ingress); - TString blobBuf; + TString blobBuf; TDiskBlob::Create(blobBuf, data.size(), 1, data); memRec.SetDiskBlob(TDiskPart(0, 0, blobBuf.size())); merger.Clear(); @@ -271,11 +271,11 @@ namespace NKikimr { ui32 chunkSize = 1u << 20u; ui32 appendBlockSize = 4u << 10u; ui32 writeBlockSize = 16u << 10u; - TString data("Hello, world!"); + TString data("Hello, world!"); TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.Test(10000, data); - TString res("{SST {Addr: {ChunkIdx: 1 Offset: 200000 Size: 440096} " + TString res("{SST {Addr: {ChunkIdx: 1 Offset: 200000 Size: 440096} " "IndexParts: 1 {UsedChunks: 1}} step: 10000}"); STR << res << "\n"; STR << test.GetStat().ToString() << "\n"; @@ -319,11 +319,11 @@ namespace NKikimr { ui32 chunkSize = 1u << 20u; ui32 appendBlockSize = 4u << 10u; ui32 writeBlockSize = 16u << 10u; - TString data("X"); + TString data("X"); TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.Test(50000, data); - TString res("{SST {Addr: {ChunkIdx: 3 Offset: 0 Size: 502972} " + TString res("{SST {Addr: {ChunkIdx: 3 Offset: 0 Size: 502972} " "IndexParts: 3 {UsedChunks: 1 2 3}} step: 50000}"); STR << res << "\n"; STR << test.GetStat().ToString() << "\n"; @@ -337,10 +337,10 @@ namespace NKikimr { ui32 chunkSize = 1u << 20u; ui32 appendBlockSize = 4u << 10u; ui32 writeBlockSize = 16u << 10u; - TString data("Hello, world!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + TString data("Hello, world!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.Test(50000, data); - TString res("{SST {Addr: {ChunkIdx: 2 Offset: 125776 Size: 922776} " + TString res("{SST {Addr: {ChunkIdx: 2 Offset: 125776 Size: 922776} " "IndexParts: 1 {UsedChunks: 1 2}} step: 20970} " "{SST {Addr: {ChunkIdx: 4 Offset: 125776 Size: 922776} " "IndexParts: 1 {UsedChunks: 3 4}} step: 41940} " @@ -358,10 +358,10 @@ namespace NKikimr { ui32 chunkSize = 1u << 20u; ui32 appendBlockSize = 4u << 10u; ui32 writeBlockSize = 16u << 10u; - TString data("X"); + TString data("X"); TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.Test(1000000, data); - TString res("{SST {Addr: {ChunkIdx: 4 Offset: 0 Size: 1048572} " + TString res("{SST {Addr: {ChunkIdx: 4 Offset: 0 Size: 1048572} " "IndexParts: 4 {UsedChunks: 1 2 3 4}} step: 80657} " "{SST {Addr: {ChunkIdx: 8 Offset: 0 Size: 1048572} " "IndexParts: 4 {UsedChunks: 5 6 7 8}} step: 161314} " @@ -405,7 +405,7 @@ namespace NKikimr { TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.TestOutbound(10000); - TString res("{SST {Addr: {ChunkIdx: 1 Offset: 0 Size: 680096} " + TString res("{SST {Addr: {ChunkIdx: 1 Offset: 0 Size: 680096} " "IndexParts: 1 OutboundItems: 20000 {UsedChunks: 1}} step: 10000}"); STR << res << "\n"; STR << test.GetStat().ToString() << "\n"; @@ -422,7 +422,7 @@ namespace NKikimr { TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.TestOutbound(50000); - TString res("{SST {Addr: {ChunkIdx: 4 Offset: 0 Size: 254412} " + TString res("{SST {Addr: {ChunkIdx: 4 Offset: 0 Size: 254412} " "IndexParts: 4 OutboundItems: 100000 {UsedChunks: 1 2 3 4}} step: 50000}"); STR << res << "\n"; STR << test.GetStat().ToString() << "\n"; @@ -439,7 +439,7 @@ namespace NKikimr { ui32 writeBlockSize = 16u << 10u; TTest<TKeyLogoBlob, TMemRecLogoBlob, TWriterLogoBlob> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.TestOutbound(20000); - TString res("{SST {Addr: {ChunkIdx: 1 Offset: 0 Size: 1048520} " + TString res("{SST {Addr: {ChunkIdx: 1 Offset: 0 Size: 1048520} " "IndexParts: 1 OutboundItems: 30836 {UsedChunks: 1}} step: 15418} " "{SST {Addr: {ChunkIdx: 2 Offset: 0 Size: 311672} " "IndexParts: 1 OutboundItems: 9164 {UsedChunks: 2}} step: 20000}"); @@ -462,7 +462,7 @@ namespace NKikimr { TTest<TKeyBlock, TMemRecBlock, TWriterBlock> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.Test(5000); - TString res("{SST {Addr: {ChunkIdx: 1 Offset: 0 Size: 60096} " + TString res("{SST {Addr: {ChunkIdx: 1 Offset: 0 Size: 60096} " "IndexParts: 1 {UsedChunks: 1}} step: 5000}"); STR << res << "\n"; STR << test.GetStat().ToString() << "\n"; @@ -479,7 +479,7 @@ namespace NKikimr { TTest<TKeyBlock, TMemRecBlock, TWriterBlock> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.Test(150000); - TString res("{SST {Addr: {ChunkIdx: 2 Offset: 0 Size: 751536} " + TString res("{SST {Addr: {ChunkIdx: 2 Offset: 0 Size: 751536} " "IndexParts: 2 {UsedChunks: 1 2}} step: 150000}"); STR << res << "\n"; STR << test.GetStat().ToString() << "\n"; @@ -496,7 +496,7 @@ namespace NKikimr { TTest<TKeyBlock, TMemRecBlock, TWriterBlock> test(chunksToUse, owner, ownerRound, chunkSize, appendBlockSize, writeBlockSize); test.Test(150000); - TString res("{SST {Addr: {ChunkIdx: 1 Offset: 0 Size: 1048572} " + TString res("{SST {Addr: {ChunkIdx: 1 Offset: 0 Size: 1048572} " "IndexParts: 1 {UsedChunks: 1}} step: 87373} " "{SST {Addr: {ChunkIdx: 2 Offset: 0 Size: 751620} " "IndexParts: 1 {UsedChunks: 2}} step: 150000}"); diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_idx.cpp b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_idx.cpp index d35b282732f..28b84ebeeb1 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_idx.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_idx.cpp @@ -38,7 +38,7 @@ namespace NKikimr { } bool TLevelIndexBase::CheckEntryPoint(const char *begin, const char *end, size_t keySizeOf, ui32 signature, - TString &explanation) { + TString &explanation) { // OLD Data Format // data ::= [signature=4b] [nextSstId=8b] deleted_chunks level0 otherLevels; // deleted_chunks ::= [size=4b] [chunkIdx=4b]* diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_leveledssts.h b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_leveledssts.h index b7de273a482..4ce6244fec3 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_leveledssts.h +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_leveledssts.h @@ -14,8 +14,8 @@ namespace NKikimr { typedef ::NKikimr::TOrderedLevelSegments<TKey, TMemRec> TOrderedLevelSegments; - typedef TVector<TLevelSstPtr> TVectorType; - TVectorType Vec; + typedef TVector<TLevelSstPtr> TVectorType; + TVectorType Vec; public: TLeveledSsts() diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst_it_all_ut.cpp b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst_it_all_ut.cpp index f965e75f61f..0e0f5a7676a 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst_it_all_ut.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sst_it_all_ut.cpp @@ -11,7 +11,7 @@ namespace NKikimr { using TLogoBlobSstPtr = TIntrusivePtr<TLogoBlobSst>; using TLogoBlobOrderedSsts = TOrderedLevelSegments<TKeyLogoBlob, TMemRecLogoBlob>; using TLogoBlobOrderedSstsPtr = TIntrusivePtr<TLogoBlobOrderedSsts>; - using TSegments = TVector<TLogoBlobSstPtr>; + using TSegments = TVector<TLogoBlobSstPtr>; static const ui32 ChunkSize = 8u << 20u; static const ui32 CompWorthReadSize = 2u << 20u; @@ -58,7 +58,7 @@ namespace NKikimr { str << it.GetCurKey().ToString(); it.Next(); } - TString result("[0:0:10:0:0:0:0][0:0:11:0:0:0:0]" + TString result("[0:0:10:0:0:0:0][0:0:11:0:0:0:0]" "[0:0:12:0:0:0:0][0:0:13:0:0:0:0]" "[0:0:14:0:0:0:0][0:0:15:0:0:0:0]" "[0:0:16:0:0:0:0][0:0:17:0:0:0:0]" @@ -76,7 +76,7 @@ namespace NKikimr { str << it.GetCurKey().ToString(); it.Prev(); } - TString result("[0:0:19:0:0:0:0][0:0:18:0:0:0:0]" + TString result("[0:0:19:0:0:0:0][0:0:18:0:0:0:0]" "[0:0:17:0:0:0:0][0:0:16:0:0:0:0]" "[0:0:15:0:0:0:0][0:0:14:0:0:0:0]" "[0:0:13:0:0:0:0][0:0:12:0:0:0:0]" @@ -91,14 +91,14 @@ namespace NKikimr { TLogoBlobID id; id = TLogoBlobID(0, 0, 15, 0, 0, 0); it.Seek(id); - UNIT_ASSERT(it.GetCurKey().ToString() == TString("[0:0:15:0:0:0:0]")); + UNIT_ASSERT(it.GetCurKey().ToString() == TString("[0:0:15:0:0:0:0]")); TStringStream str; while (it.Valid()) { str << it.GetCurKey().ToString(); it.Next(); } - TString result("[0:0:15:0:0:0:0][0:0:16:0:0:0:0]" + TString result("[0:0:15:0:0:0:0][0:0:16:0:0:0:0]" "[0:0:17:0:0:0:0][0:0:18:0:0:0:0]" "[0:0:19:0:0:0:0]"); UNIT_ASSERT(str.Str() == result); @@ -111,14 +111,14 @@ namespace NKikimr { TLogoBlobID id; id = TLogoBlobID(0, 0, 15, 0, 0, 0); it.Seek(id); - UNIT_ASSERT(it.GetCurKey().ToString() == TString("[0:0:15:0:0:0:0]")); + UNIT_ASSERT(it.GetCurKey().ToString() == TString("[0:0:15:0:0:0:0]")); TStringStream str; while (it.Valid()) { str << it.GetCurKey().ToString(); it.Prev(); } - TString result("[0:0:15:0:0:0:0][0:0:14:0:0:0:0]" + TString result("[0:0:15:0:0:0:0][0:0:14:0:0:0:0]" "[0:0:13:0:0:0:0][0:0:12:0:0:0:0]" "[0:0:11:0:0:0:0][0:0:10:0:0:0:0]"); UNIT_ASSERT(str.Str() == result); @@ -175,7 +175,7 @@ namespace NKikimr { str << it.GetCurKey().ToString(); it.Next(); } - TString result("[0:0:10:0:0:0:0][0:0:11:0:0:0:0]" + TString result("[0:0:10:0:0:0:0][0:0:11:0:0:0:0]" "[0:0:12:0:0:0:0][0:0:13:0:0:0:0]" "[0:0:14:0:0:0:0][0:0:15:0:0:0:0]" "[0:0:16:0:0:0:0][0:0:17:0:0:0:0]" @@ -197,7 +197,7 @@ namespace NKikimr { str << it.GetCurKey().ToString(); it.Prev(); } - TString result("[0:0:24:0:0:0:0][0:0:23:0:0:0:0]" + TString result("[0:0:24:0:0:0:0][0:0:23:0:0:0:0]" "[0:0:22:0:0:0:0][0:0:21:0:0:0:0]" "[0:0:20:0:0:0:0][0:0:19:0:0:0:0]" "[0:0:18:0:0:0:0][0:0:17:0:0:0:0]" diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h index 83d7253d3bf..a456cf83af1 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstslice.h @@ -106,7 +106,7 @@ namespace NKikimr { return TSatisfactionRank::MkRatio(Segs->CurSstsNum(), MaxSstsAtOnce); } - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { Segs->GetOwnedChunks(chunks); } }; @@ -159,7 +159,7 @@ namespace NKikimr { return Segs->ObsoleteLastCompactedLsn(); } - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { Segs->GetOwnedChunks(chunks); } @@ -181,7 +181,7 @@ namespace NKikimr { typedef typename TLevelSegment::TLevelSstPtr TLevelSstPtr; typedef ::NKikimr::TLevel0<TKey, TMemRec> TLevel0; typedef ::NKikimr::TSortedLevel<TKey, TMemRec> TSortedLevel; - typedef TVector<TSortedLevel> TSortedLevels; + typedef TVector<TSortedLevel> TSortedLevels; TLevel0 Level0; TSortedLevels SortedLevels; @@ -192,7 +192,7 @@ namespace NKikimr { TActorId CommitterId; // In ChunksToDelete we store chunks that are old and subject for deletion, // but previous snapshot can still use them - TVector<ui32> ChunksToDelete; + TVector<ui32> ChunksToDelete; // Bulk-formed segments description; they contain only these bulk-formed SST references, which are required // to recover SyncLog in case of failure TBulkFormedSstInfoSet BulkFormedSegments; @@ -310,7 +310,7 @@ namespace NKikimr { return true; } - TString ToString(const TString &prefix = "") const { + TString ToString(const TString &prefix = "") const { TStringStream str; TSstIterator it(this, Level0CurSstsNum()); it.SeekToFirst(); @@ -357,7 +357,7 @@ namespace NKikimr { return Level0.GetSatisfactionRank(); } - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { // we include deleted chunks for (TChunkIdx chunkIdx : ChunksToDelete) { const bool inserted = chunks.insert(chunkIdx).second; diff --git a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h index 0a30c1e20b0..0d0c8342a42 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h +++ b/ydb/core/blobstorage/vdisk/hulldb/generic/hullds_sstvec.h @@ -15,7 +15,7 @@ namespace NKikimr { typedef TIntrusivePtr<TLevelSegment> TLevelSegmentPtr; typedef typename TLevelSegment::TLevelSstPtr TLevelSstPtr; typedef TOrderedLevelSegments<TKey, TMemRec> TThis; - typedef TVector<TLevelSegmentPtr> TSegments; + typedef TVector<TLevelSegmentPtr> TSegments; TSegments Segments; @@ -83,7 +83,7 @@ namespace NKikimr { x->FillInChunkIds(vec); } - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { for (const TLevelSegmentPtr& seg : Segments) { seg->GetOwnedChunks(chunks); } @@ -108,8 +108,8 @@ namespace NKikimr { return num; } - TString ChunksToString() const { - TString str; + TString ChunksToString() const { + TString str; for (const auto &x : Segments) { str += x->ChunksToString(); } @@ -180,7 +180,7 @@ namespace NKikimr { typedef ::NKikimr::TOrderedLevelSegments<TKey, TMemRec> TOrderedLevelSegments; typedef TIntrusivePtr<TOrderedLevelSegments> TOrderedLevelSegmentsPtr; typedef ::NKikimr::TUnorderedLevelSegments<TKey, TMemRec> TThis; - typedef TList<TLevelSegmentPtr> TSegments; + typedef TList<TLevelSegmentPtr> TSegments; TSegments Segments; ui32 Num; @@ -256,7 +256,7 @@ namespace NKikimr { } } - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { for (const TLevelSegmentPtr& seg : Segments) { seg->GetOwnedChunks(chunks); } diff --git a/ydb/core/blobstorage/vdisk/hulldb/hulldb_bulksstmngr.cpp b/ydb/core/blobstorage/vdisk/hulldb/hulldb_bulksstmngr.cpp index 3cc7d07a196..28e1c58bb70 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/hulldb_bulksstmngr.cpp +++ b/ydb/core/blobstorage/vdisk/hulldb/hulldb_bulksstmngr.cpp @@ -26,9 +26,9 @@ namespace NKikimr { TVDiskContextPtr VCtx; TPDiskCtxPtr PDiskCtx; const TActorId LocalRecoveryActorId; - TQueue<TBulkSegmentLoadQueueItem> BulkSegmentLoadQueue; + TQueue<TBulkSegmentLoadQueueItem> BulkSegmentLoadQueue; THashMap<TActorId, TBulkSegmentLoadQueueItem> BulkSegmentLoadInFlight; - TVector<TLevelSegmentPtr> Segments; + TVector<TLevelSegmentPtr> Segments; TActiveActors ActiveActors; public: @@ -198,7 +198,7 @@ namespace NKikimr { Y_FAIL("bulk-formed SSTable not found"); } - void TBulkFormedSstInfoSet::GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void TBulkFormedSstInfoSet::GetOwnedChunks(TSet<TChunkIdx>& chunks) const { for (const TBulkFormedSstInfo& seg : BulkFormedSsts) { seg.GetOwnedChunks(chunks); } diff --git a/ydb/core/blobstorage/vdisk/hulldb/hulldb_bulksstmngr.h b/ydb/core/blobstorage/vdisk/hulldb/hulldb_bulksstmngr.h index 22038ef95ca..b7b2b88ae03 100644 --- a/ydb/core/blobstorage/vdisk/hulldb/hulldb_bulksstmngr.h +++ b/ydb/core/blobstorage/vdisk/hulldb/hulldb_bulksstmngr.h @@ -49,7 +49,7 @@ namespace NKikimr { TDiskPart EntryPoint; // IDs of chunks composing this SSTable (stored only when SSTable is dropped from index, otherwise empty) - TVector<ui32> ChunkIds; + TVector<ui32> ChunkIds; // is this record removed from index? bool RemovedFromIndex; @@ -99,7 +99,7 @@ namespace NKikimr { } } - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { for (TChunkIdx chunkIdx : ChunkIds) { const bool inserted = chunks.insert(chunkIdx).second; Y_VERIFY(inserted); @@ -143,7 +143,7 @@ namespace NKikimr { const TBulkFormedSstInfo& FindIntactBulkFormedSst(const TDiskPart& entryPoint) const; TBulkFormedSstInfo& FindIntactBulkFormedSst(const TDiskPart& entryPoint); - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; private: TVector<TBulkFormedSstInfo> BulkFormedSsts; diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcommit.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcommit.h index 8b094e893bc..d4206d9c5a2 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcommit.h +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcommit.h @@ -57,15 +57,15 @@ namespace NKikimr { using TThis = TBaseHullDbCommitter<TKey, TMemRec, NotifyType, DerivedActivityType>; struct THullCommitMeta { - TVector<ui32> CommitChunks; // chunks to commit within this log entry - TVector<ui32> DeleteChunks; // chunks to delete + TVector<ui32> CommitChunks; // chunks to commit within this log entry + TVector<ui32> DeleteChunks; // chunks to delete TDiskPartVec RemovedHugeBlobs; // freed huge blobs TLevelSegmentPtr ReplSst; // pointer to replicated SST ui32 NumRecoveredBlobs; // number of blobs in this SST (valid only for replicated tables) // constructor for ordinary committer (advance, fresh, level) - THullCommitMeta(TVector<ui32>&& chunksAdded, - TVector<ui32>&& chunksDeleted, + THullCommitMeta(TVector<ui32>&& chunksAdded, + TVector<ui32>&& chunksDeleted, TDiskPartVec&& removedHugeBlobs) : CommitChunks(std::move(chunksAdded)) , DeleteChunks(std::move(chunksDeleted)) @@ -74,8 +74,8 @@ namespace NKikimr { {} // constructor for repl sst committer - THullCommitMeta(TVector<ui32>&& chunksAdded, - TVector<ui32>&& chunksDeleted, + THullCommitMeta(TVector<ui32>&& chunksAdded, + TVector<ui32>&& chunksDeleted, TLevelSegmentPtr replSst, ui32 numRecoveredBlobs) : CommitChunks(std::move(chunksAdded)) @@ -185,7 +185,7 @@ namespace NKikimr { commitRecord.DeleteChunks.end()); // ensure that there are no intersections between chunks being committed and deleted - TVector<TChunkIdx> isect; + TVector<TChunkIdx> isect; std::set_intersection(commitRecord.CommitChunks.begin(), commitRecord.CommitChunks.end(), commitRecord.DeleteChunks.begin(), commitRecord.DeleteChunks.end(), std::back_inserter(isect)); diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactdeferredqueue.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactdeferredqueue.h index bc28f0a3779..d031dc251cc 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactdeferredqueue.h +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactdeferredqueue.h @@ -16,7 +16,7 @@ namespace NKikimr { ui32 NumReads; TDiskPart PreallocatedLocation; TDiskBlobMergerWithMask Merger; - NMatrix::TVectorType PartsToStore; + NMatrix::TVectorType PartsToStore; TLogoBlobID BlobId; TItem(ui64 id, ui32 numReads, const TDiskPart& preallocatedLocation, const TDiskBlobMerger& merger, @@ -30,7 +30,7 @@ namespace NKikimr { {} }; - TQueue<TItem> ItemQueue; + TQueue<TItem> ItemQueue; bool Started = false; TRopeArena& Arena; const TBlobStorageGroupType GType; diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactdeferredqueue_ut.cpp b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactdeferredqueue_ut.cpp index 682e9f21c1c..8bd506575a6 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactdeferredqueue_ut.cpp +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactdeferredqueue_ut.cpp @@ -63,11 +63,11 @@ Y_UNIT_TEST_SUITE(TBlobStorageHullCompactDeferredQueueTest) { struct TItem { ssize_t BlobId; NMatrix::TVectorType BlobParts; - NMatrix::TVectorType PartsToStore; + NMatrix::TVectorType PartsToStore; TVector<std::pair<size_t, NMatrix::TVectorType>> DiskData; size_t Expected; }; - TVector<TItem> items; + TVector<TItem> items; TRopeArena arena(&TRopeArenaBackend::Allocate); diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h index 7355d2c464b..3af8945a297 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullcompactworker.h @@ -125,7 +125,7 @@ namespace NKikimr { ui32 ChunksToUse; // chunks currently reserved and not used - TDeque<TChunkIdx> ReservedChunks; + TDeque<TChunkIdx> ReservedChunks; // all reserved chunks during the compaction TDeque<TChunkIdx> AllocatedChunks; @@ -161,10 +161,10 @@ namespace NKikimr { TDiskPartVec FreedHugeBlobs; // generated level segments - TVector<TIntrusivePtr<TLevelSegment>> LevelSegments; + TVector<TIntrusivePtr<TLevelSegment>> LevelSegments; // generated chunks - TVector<TChunkIdx> CommitChunks; + TVector<TChunkIdx> CommitChunks; // pointer to an atomic variable contaning number of in flight reads TAtomic *ReadsInFlight; @@ -174,7 +174,7 @@ namespace NKikimr { struct TBatcherPayload { ui64 Id = 0; - NMatrix::TVectorType LocalParts; // a bit vector of local parts we are going to read from this disk blob + NMatrix::TVectorType LocalParts; // a bit vector of local parts we are going to read from this disk blob TLogoBlobID BlobId; TDiskPart Location; @@ -225,7 +225,7 @@ namespace NKikimr { , FinishTime() {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{WaitTime# " << (StartTime - CreationTime).ToString() << " GetNextItemTime# " << (FinishTime - StartTime).ToString() @@ -486,7 +486,7 @@ namespace NKikimr { ui64 serial; TBatcherPayload payload; NKikimrProto::EReplyStatus status; - TString buffer; + TString buffer; while (ReadBatcher.GetResultItem(&serial, &payload, &status, &buffer)) { if (status == NKikimrProto::CORRUPTED) { ExpectingBlobRestoration = true; @@ -516,14 +516,14 @@ namespace NKikimr { AllocatedChunks.insert(AllocatedChunks.end(), msg->ChunkIds.begin(), msg->ChunkIds.end()); } - const TVector<TIntrusivePtr<TLevelSegment>>& GetLevelSegments() { return LevelSegments; } - const TVector<TChunkIdx>& GetCommitChunks() const { return CommitChunks; } + const TVector<TIntrusivePtr<TLevelSegment>>& GetLevelSegments() { return LevelSegments; } + const TVector<TChunkIdx>& GetCommitChunks() const { return CommitChunks; } const TDiskPartVec& GetFreedHugeBlobs() const { return FreedHugeBlobs; } - const TDeque<TChunkIdx>& GetReservedChunks() const { return ReservedChunks; } + const TDeque<TChunkIdx>& GetReservedChunks() const { return ReservedChunks; } const TDeque<TChunkIdx>& GetAllocatedChunks() const { return AllocatedChunks; } private: - void CollectRemovedHugeBlobs(const TVector<TDiskPart> &hugeBlobs) { + void CollectRemovedHugeBlobs(const TVector<TDiskPart> &hugeBlobs) { for (const TDiskPart& p : hugeBlobs) { if (!p.Empty()) { FreedHugeBlobs.PushBack(p); @@ -599,7 +599,7 @@ namespace NKikimr { // parts stored in this record; if inplacedDataSize is zero, then we do not store any data inside SSTable, // otherwise we store DiskBlob and have to assemble it at data pass ui32 inplacedDataSize = 0; - const NMatrix::TVectorType partsToStore = TransformedItem->MemRec->GetLocalParts(GType); + const NMatrix::TVectorType partsToStore = TransformedItem->MemRec->GetLocalParts(GType); if (TransformedItem->DataMerger->GetType() == TBlobType::DiskBlob && !partsToStore.Empty()) { inplacedDataSize = TDiskBlob::CalculateBlobSize(GType, TransformedItem->Key.LogoBlobID(), partsToStore); } @@ -624,7 +624,7 @@ namespace NKikimr { TDiskPart location = extr.SwearOne(); // get its vector of local parts stored in that location - NMatrix::TVectorType parts = memRec.GetLocalParts(GType); + NMatrix::TVectorType parts = memRec.GetLocalParts(GType); // enqueue read ReadBatcher.AddReadItem(location.ChunkIdx, location.Offset, location.Size, diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullload.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullload.h index d08b3a04d77..8a9e1516802 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullload.h +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hullload.h @@ -63,14 +63,14 @@ namespace NKikimr { } } - void FillInVector(TVector<ui32> &vec) { + void FillInVector(TVector<ui32> &vec) { Y_VERIFY_DEBUG(vec.empty()); vec.reserve(AllChunks.size()); for (const auto &x : AllChunks) vec.push_back(x); } - TString ToString() const { + TString ToString() const { TStringStream str; if (AllChunks.empty()) { return "<empty>"; @@ -90,7 +90,7 @@ namespace NKikimr { } private: - THashSet<ui32> AllChunks; + THashSet<ui32> AllChunks; ui32 LastChunkIdx; }; @@ -107,7 +107,7 @@ namespace NKikimr { const TPDiskCtxPtr PDiskCtx; TLevelSegment *LevelSegment; TActorId Recipient; - TString Origin; + TString Origin; bool FirstRead; ui32 RestToReadIndex; ui32 RestToReadOutbound; @@ -127,7 +127,7 @@ namespace NKikimr { } // loaded index to string - TString ToString() const { + TString ToString() const { TStringStream str; { typedef typename TLevelSegment::TRec TRec; @@ -220,7 +220,7 @@ namespace NKikimr { void Handle(NPDisk::TEvChunkReadResult::TPtr &ev, const TActorContext &ctx) { auto *msg = ev->Get(); - TString message; + TString message; if (msg->Status != NKikimrProto::OK) { TStringStream str; str << "{Origin# '" << Origin << "'}"; @@ -303,7 +303,7 @@ namespace NKikimr { const TPDiskCtxPtr &pdiskCtx, TLevelSegment *levelSegment, const TActorId &recipient, - const TString &origin) + const TString &origin) : TActorBootstrapped<TThis>() , VCtx(vctx) , PDiskCtx(pdiskCtx) diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.cpp b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.cpp index bbdf962ce56..518bf974857 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.cpp +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.cpp @@ -44,7 +44,7 @@ namespace NKikimr { std::unique_ptr<NPDisk::TEvLog> CreateHullUpdate(const std::shared_ptr<THullLogCtx> &hullLogCtx, TLogSignature signature, - const TString &data, + const TString &data, TLsnSeg seg, void *cookie, std::unique_ptr<IEventBase> syncLogMsg, @@ -67,7 +67,7 @@ namespace NKikimr { std::unique_ptr<NPDisk::TEvLog> CreateHullUpdate(const std::shared_ptr<THullLogCtx> &hullLogCtx, TLogSignature signature, const NPDisk::TCommitRecord &commitRecord, - const TString &data, + const TString &data, TLsnSeg seg, void *cookie, std::unique_ptr<IEventBase> syncLogMsg) diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h index 6e6416b8309..c4c0052c3f1 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hulllog.h @@ -14,7 +14,7 @@ namespace NKikimr { ///////////////////////////////////////////////////////////////////////////////////////// std::unique_ptr<NPDisk::TEvLog> CreateHullUpdate(const std::shared_ptr<THullLogCtx> &hullLogCtx, TLogSignature signature, - const TString &data, + const TString &data, TLsnSeg seg, void *cookie, std::unique_ptr<IEventBase> syncLogMsg, @@ -23,7 +23,7 @@ namespace NKikimr { std::unique_ptr<NPDisk::TEvLog> CreateHullUpdate(const std::shared_ptr<THullLogCtx> &hullLogCtx, TLogSignature signature, const NPDisk::TCommitRecord &commitRecord, - const TString &data, + const TString &data, TLsnSeg seg, void *cookie, std::unique_ptr<IEventBase> syncLogMsg); diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_readbatch.h b/ydb/core/blobstorage/vdisk/hullop/blobstorage_readbatch.h index 50c2c1e0d42..e83ff0f5a89 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_readbatch.h +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_readbatch.h @@ -11,7 +11,7 @@ namespace NKikimr { class TRangeSet { using TRange = std::pair<TValue, TValue>; - TVector<TRange> Ranges; + TVector<TRange> Ranges; TValue Count = TValue(); public: @@ -80,15 +80,15 @@ namespace NKikimr { TPayload Payload; ui64 Serial; NKikimrProto::EReplyStatus Status; - TString Content; + TString Content; }; - using TReadQueue = TDeque<TReadItem>; + using TReadQueue = TDeque<TReadItem>; TReadQueue ReadQueue; ui64 NextSerial = 0; typename TReadQueue::iterator Iterator; - TMap<void *, std::pair<typename TReadQueue::iterator, typename TReadQueue::iterator>> ActiveRequests; + TMap<void *, std::pair<typename TReadQueue::iterator, typename TReadQueue::iterator>> ActiveRequests; ui64 NextRequestCookie = 1; struct TCompareReadItem { @@ -96,7 +96,7 @@ namespace NKikimr { return x->Serial > y->Serial; } }; - TPriorityQueue<typename TReadQueue::iterator, TVector<typename TReadQueue::iterator>, TCompareReadItem> ReadyItemQueue; + TPriorityQueue<typename TReadQueue::iterator, TVector<typename TReadQueue::iterator>, TCompareReadItem> ReadyItemQueue; ui64 NextReadySerial = 0; bool Started = false; @@ -142,7 +142,7 @@ namespace NKikimr { TRangeSet<ui32> range; // vector of items we are _NOT_ going to read now - TVector<TReadItem> otherItems; + TVector<TReadItem> otherItems; // iterator where we store enqueued items typename TReadQueue::iterator outIt = Iterator; @@ -247,7 +247,7 @@ namespace NKikimr { } // try to get result item - bool GetResultItem(ui64 *serial, TPayload *payload, NKikimrProto::EReplyStatus *status, TString *content) { + bool GetResultItem(ui64 *serial, TPayload *payload, NKikimrProto::EReplyStatus *status, TString *content) { if (!ReadyItemQueue) { return false; } diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_readbatch_ut.cpp b/ydb/core/blobstorage/vdisk/hullop/blobstorage_readbatch_ut.cpp index 2ec3c228f07..6728b739596 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_readbatch_ut.cpp +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_readbatch_ut.cpp @@ -10,7 +10,7 @@ using namespace NKikimr; Y_UNIT_TEST_SUITE(ReadBatcher) { Y_UNIT_TEST(Range) { - TVector<std::pair<ui32, ui32>> ranges; + TVector<std::pair<ui32, ui32>> ranges; const ui32 len = 8; for (ui32 start = 0; start <= len; ++start) { for (ui32 end = start; end <= len; ++end) { @@ -45,9 +45,9 @@ Y_UNIT_TEST_SUITE(ReadBatcher) { }; const ui32 chunkSize = 16 << 20; - TMap<TChunkIdx, TString> chunks; + TMap<TChunkIdx, TString> chunks; for (TChunkIdx chunkIdx = 1; chunkIdx <= 10; ++chunkIdx) { - TString data(chunkSize, ' '); + TString data(chunkSize, ' '); ui64 pattern = RandomNumber<ui64>(); for (ui32 pos = 0; pos + sizeof(ui64) <= chunkSize; pos += sizeof(ui64)) { *reinterpret_cast<ui64 *>(const_cast<char *>(data.data()) + pos) = pattern; @@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(ReadBatcher) { ui64 serial; TPayload payload; NKikimrProto::EReplyStatus status; - TString data; + TString data; while (batcher.GetResultItem(&serial, &payload, &status, &data)) { STR << serial << Endl; UNIT_ASSERT_VALUES_EQUAL(serial, expectedSerial); diff --git a/ydb/core/blobstorage/vdisk/hullop/hullop_entryserialize.cpp b/ydb/core/blobstorage/vdisk/hullop/hullop_entryserialize.cpp index 2f0a28d6c55..3999e8663bb 100644 --- a/ydb/core/blobstorage/vdisk/hullop/hullop_entryserialize.cpp +++ b/ydb/core/blobstorage/vdisk/hullop/hullop_entryserialize.cpp @@ -7,7 +7,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// const ui32 THullDbSignatureRoutines::CurSignature = 0x93F7ADD5; - TString THullDbSignatureRoutines::Serialize(const NKikimrVDiskData::THullDbEntryPoint &pb) { + TString THullDbSignatureRoutines::Serialize(const NKikimrVDiskData::THullDbEntryPoint &pb) { // signature TStringStream str; str.Write(&CurSignature, sizeof(ui32)); @@ -18,8 +18,8 @@ namespace NKikimr { } bool THullDbSignatureRoutines::Parse(NKikimrVDiskData::THullDbEntryPoint &pb, - const TString &source, - TString &explanation) { + const TString &source, + TString &explanation) { TStringStream str; if (source.size() < sizeof(ui32)) { str << "Can't check signature because serialized data size is less than sizeof(ui32)"; diff --git a/ydb/core/blobstorage/vdisk/hullop/hullop_entryserialize.h b/ydb/core/blobstorage/vdisk/hullop/hullop_entryserialize.h index 5bd72c5b2a0..fa1ab855aca 100644 --- a/ydb/core/blobstorage/vdisk/hullop/hullop_entryserialize.h +++ b/ydb/core/blobstorage/vdisk/hullop/hullop_entryserialize.h @@ -11,10 +11,10 @@ namespace NKikimr { struct THullDbSignatureRoutines { static const ui32 CurSignature; - static TString Serialize(const NKikimrVDiskData::THullDbEntryPoint &pb); + static TString Serialize(const NKikimrVDiskData::THullDbEntryPoint &pb); static bool Parse(NKikimrVDiskData::THullDbEntryPoint &pb, - const TString &source, - TString &explanation); + const TString &source, + TString &explanation); }; } // NKikimr diff --git a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress.cpp b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress.cpp index 4e9f1f03c3a..fd0d4cf3438 100644 --- a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress.cpp +++ b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress.cpp @@ -207,7 +207,7 @@ namespace NKikimr { return res; } - TVectorType TIngress::PartsWeMustHaveLocally(const TBlobStorageGroupInfo::TTopology *top, + TVectorType TIngress::PartsWeMustHaveLocally(const TBlobStorageGroupInfo::TTopology *top, const TVDiskIdShort &vdisk, const TLogoBlobID &id) const { return KnownParts(top->GType, top->GetIdxInSubgroup(vdisk, id.Hash())); @@ -224,16 +224,16 @@ namespace NKikimr { ui8 nodeId = top->GetIdxInSubgroup(vdisk, id.Hash()); if (nodeId < totalParts) { - TVectorType emptyVec(0, totalParts); + TVectorType emptyVec(0, totalParts); return TPairOfVectors(emptyVec, emptyVec); } else { ui8 handoffNodeId = nodeId - totalParts; Y_VERIFY_DEBUG(handoffNodeId < handoffNum); - TVectorType m = handoff[handoffNodeId].ToVector(); // map of handoff replicas on this node - TVectorType mainVec = main.ToVector(); - TVectorType toMove = m - mainVec; // what we can send to main replicas - TVectorType toDel = m & mainVec; // what we can delete + TVectorType m = handoff[handoffNodeId].ToVector(); // map of handoff replicas on this node + TVectorType mainVec = main.ToVector(); + TVectorType toMove = m - mainVec; // what we can send to main replicas + TVectorType toDel = m & mainVec; // what we can delete return TPairOfVectors(toMove, toDel); } } @@ -317,7 +317,7 @@ namespace NKikimr { } } - TString TIngress::ToString(const TBlobStorageGroupInfo::TTopology *top, + TString TIngress::ToString(const TBlobStorageGroupInfo::TTopology *top, const TVDiskIdShort &vdisk, const TLogoBlobID &id) const { switch (IngressMode(top->GType)) { @@ -383,7 +383,7 @@ namespace NKikimr { } } - TString TIngress::PrintVDisksForLogoBlob(const TBlobStorageGroupInfo *info, const TLogoBlobID &id) { + TString TIngress::PrintVDisksForLogoBlob(const TBlobStorageGroupInfo *info, const TLogoBlobID &id) { Y_VERIFY_DEBUG(id.PartId() == 0); TBlobStorageGroupInfo::TVDiskIds outVDisks; info->PickSubgroup(id.Hash(), &outVDisks, nullptr); @@ -403,7 +403,7 @@ namespace NKikimr { TIngress TIngress::CreateFromRepl(const TBlobStorageGroupInfo::TTopology *top, const TVDiskIdShort& vdisk, const TLogoBlobID& id, - NMatrix::TVectorType recoveredParts) { + NMatrix::TVectorType recoveredParts) { TIngress res; Y_VERIFY(id.PartId() == 0); for (ui8 i = recoveredParts.FirstPosition(); i != recoveredParts.GetSize(); i = recoveredParts.NextPosition(i)) { @@ -465,7 +465,7 @@ namespace NKikimr { return topology.GetQuorumChecker().CheckQuorumForGroup(synced); } - TString TBarrierIngress::ToString(const TIngressCache *cache) const { + TString TBarrierIngress::ToString(const TIngressCache *cache) const { /* BlobStorage Group fd -- fail domain, i.e. rack diff --git a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress.h b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress.h index 05901ef275c..3bc286687d9 100644 --- a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress.h +++ b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress.h @@ -66,7 +66,7 @@ namespace NKikimr { #pragma pack(push, 4) class TIngress { public: - typedef std::pair<NMatrix::TVectorType, NMatrix::TVectorType> TPairOfVectors; + typedef std::pair<NMatrix::TVectorType, NMatrix::TVectorType> TPairOfVectors; enum class EMode { GENERIC, @@ -85,7 +85,7 @@ namespace NKikimr { NMatrix::TVectorType PartsWeKnowAbout(TBlobStorageGroupType gtype) const; // Returns vector of parts we MUST have locally according to Ingress, i.e. parts we have // written locally or recovered after crash - NMatrix::TVectorType PartsWeMustHaveLocally(const TBlobStorageGroupInfo::TTopology *top, + NMatrix::TVectorType PartsWeMustHaveLocally(const TBlobStorageGroupInfo::TTopology *top, const TVDiskIdShort &vdisk, const TLogoBlobID &id) const; // returns a pair <VectorOfPartsToMove, VectorOfPartsToDelete> @@ -101,7 +101,7 @@ namespace NKikimr { void DeleteHandoff(const TBlobStorageGroupInfo::TTopology *top, const TVDiskIdShort &vdisk, const TLogoBlobID &id); - TString ToString(const TBlobStorageGroupInfo::TTopology *top, + TString ToString(const TBlobStorageGroupInfo::TTopology *top, const TVDiskIdShort &vdisk, const TLogoBlobID &id) const; @@ -112,7 +112,7 @@ namespace NKikimr { Merge(*this, n); } - static TString PrintVDisksForLogoBlob(const TBlobStorageGroupInfo *info, const TLogoBlobID &id); + static TString PrintVDisksForLogoBlob(const TBlobStorageGroupInfo *info, const TLogoBlobID &id); static void Merge(TIngress &myIngress, const TIngress &newIngress); static bool MustKnowAboutLogoBlob(const TBlobStorageGroupInfo::TTopology *top, const TVDiskIdShort &vdisk, @@ -120,11 +120,11 @@ namespace NKikimr { static TIngress CreateFromRepl(const TBlobStorageGroupInfo::TTopology *top, const TVDiskIdShort& vdisk, const TLogoBlobID& id, - NMatrix::TVectorType recoveredParts); + NMatrix::TVectorType recoveredParts); // NOTE: take into account that partId in logoblob is from 1 to SomeMax when // we are talking about a concrete part; method of this class usually return - // NMatrix::TVectorType mask of parts starting from 0. + // NMatrix::TVectorType mask of parts starting from 0. // create ingress from LogoBlobID id with main or handoff ingress bits // AND local bits (i.e. data is present) @@ -173,7 +173,7 @@ namespace NKikimr { TBarrierIngress(const TIngressCache *cache); bool IsQuorum(const TIngressCache *cache) const; - TString ToString(const TIngressCache *cache) const; + TString ToString(const TIngressCache *cache) const; static TBarrierIngress CreateFromRaw(ui32 raw); static void Merge(TBarrierIngress &myIngress, const TBarrierIngress &newIngress); diff --git a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.cpp b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.cpp index 657bc68df0a..d6fd307564f 100644 --- a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.cpp +++ b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.cpp @@ -4,7 +4,7 @@ namespace NKikimr { namespace NMatrix { - const ui8 TVectorType::EmptyMask[] = {0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}; + const ui8 TVectorType::EmptyMask[] = {0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF}; } // NMatrix diff --git a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.h b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.h index 29ef0150327..603dd43b8d0 100644 --- a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.h +++ b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix.h @@ -34,23 +34,23 @@ namespace NKikimr { ////////////////////////////////////////////////////////////////////////////////// - // TVectorType + // TVectorType ////////////////////////////////////////////////////////////////////////////////// - class TVectorType { + class TVectorType { public: - TVectorType() + TVectorType() : Vec(0) , Size(0) {} - TVectorType(ui8 vec, ui8 size) + TVectorType(ui8 vec, ui8 size) : Vec(vec & EmptyMask[size]) , Size(size) { Y_VERIFY_DEBUG(size <= 8); } - TVectorType(const TVectorType &v) + TVectorType(const TVectorType &v) : Vec(v.Vec) , Size(v.Size) {} @@ -109,45 +109,45 @@ namespace NKikimr { return Vec == 0; } - bool IsSupersetOf(NMatrix::TVectorType v) const { + bool IsSupersetOf(NMatrix::TVectorType v) const { Y_VERIFY_DEBUG(Size == v.Size); return (Vec & v.Vec) == v.Vec; } - TVectorType &operator =(const TVectorType &v) { + TVectorType &operator =(const TVectorType &v) { Y_VERIFY_DEBUG(Size == 0 || Size == v.Size || v.Size == 0); Size = v.Size; Vec = v.Vec; return *this; } - TVectorType &operator |=(const TVectorType &v) { + TVectorType &operator |=(const TVectorType &v) { Y_VERIFY_DEBUG(Size == v.Size); Vec |= v.Vec; return *this; } - TVectorType &operator &=(const TVectorType &v) { + TVectorType &operator &=(const TVectorType &v) { Y_VERIFY_DEBUG(Size == v.Size); Vec &= v.Vec; return *this; } - TVectorType operator ~() const { + TVectorType operator ~() const { ui8 v = ~Vec; - return TVectorType(v, Size); + return TVectorType(v, Size); } - bool operator ==(const TVectorType &v) const { + bool operator ==(const TVectorType &v) const { Y_VERIFY_DEBUG(v.Size == Size); return Vec == v.Vec; } - bool operator !=(const TVectorType &v) const { + bool operator !=(const TVectorType &v) const { return !operator ==(v); } - TString ToString() const { + TString ToString() const { TStringStream s; s << (Get(0) ? "1" : "0"); for (ui8 i = 1; i < Size; i++) @@ -163,13 +163,13 @@ namespace NKikimr { return Size; } - void Swap(TVectorType &v) { + void Swap(TVectorType &v) { DoSwap(Vec, v.Vec); DoSwap(Size, v.Size); } - static TVectorType MakeOneHot(ui8 pos, ui8 size) { - TVectorType res(0, size); + static TVectorType MakeOneHot(ui8 pos, ui8 size) { + TVectorType res(0, size); res.Set(pos); return res; } @@ -180,9 +180,9 @@ namespace NKikimr { const static ui8 EmptyMask[]; - friend TVectorType operator -(const TVectorType &v1, const TVectorType &v2); - friend TVectorType operator &(const TVectorType &v1, const TVectorType &v2); - friend TVectorType operator |(const TVectorType &v1, const TVectorType &v2); + friend TVectorType operator -(const TVectorType &v1, const TVectorType &v2); + friend TVectorType operator &(const TVectorType &v1, const TVectorType &v2); + friend TVectorType operator |(const TVectorType &v1, const TVectorType &v2); ui8 FirstSetBit(ui8 vec) const { const static unsigned shift = std::numeric_limits<unsigned int>::digits - std::numeric_limits<ui8>::digits; @@ -193,19 +193,19 @@ namespace NKikimr { } }; - inline TVectorType operator -(const TVectorType &v1, const TVectorType &v2) { + inline TVectorType operator -(const TVectorType &v1, const TVectorType &v2) { Y_VERIFY_DEBUG(v1.Size == v2.Size); - return TVectorType(v1.Vec ^ (v1.Vec & v2.Vec), v1.Size); + return TVectorType(v1.Vec ^ (v1.Vec & v2.Vec), v1.Size); } - inline TVectorType operator &(const TVectorType &v1, const TVectorType &v2) { + inline TVectorType operator &(const TVectorType &v1, const TVectorType &v2) { Y_VERIFY_DEBUG(v1.Size == v2.Size); - return TVectorType(v1.Vec & v2.Vec, v1.Size); + return TVectorType(v1.Vec & v2.Vec, v1.Size); } - inline TVectorType operator |(const TVectorType &v1, const TVectorType &v2) { + inline TVectorType operator |(const TVectorType &v1, const TVectorType &v2) { Y_VERIFY_DEBUG(v1.Size == v2.Size); - return TVectorType(v1.Vec | v2.Vec, v1.Size); + return TVectorType(v1.Vec | v2.Vec, v1.Size); } @@ -328,7 +328,7 @@ namespace NKikimr { return TShiftedBitVecBase::Get(i); } - TVectorType ToVector() const { + TVectorType ToVector() const { Y_VERIFY_DEBUG(End - Beg <= 8); ui8 vec = 0; TIterator it = Begin(); @@ -338,7 +338,7 @@ namespace NKikimr { it.Next(); } vec <<= 8 - (End - Beg); - return TVectorType(vec, End - Beg); + return TVectorType(vec, End - Beg); } }; @@ -389,7 +389,7 @@ namespace NKikimr { return res; } - TVectorType ToVector() const { + TVectorType ToVector() const { Y_VERIFY_DEBUG(End - Beg <= 2 * 8); ui8 vec = 0; TIterator it = Begin(); @@ -403,7 +403,7 @@ namespace NKikimr { vec |= ui8(!firstBit && secondBit); } vec <<= 8 - ((End - Beg) >> 1); - return TVectorType(vec, (End - Beg) >> 1); + return TVectorType(vec, (End - Beg) >> 1); } }; @@ -432,8 +432,8 @@ namespace NKikimr { } - TVectorType GetRow(ui8 row) const { - TVectorType vec(0, Columns); + TVectorType GetRow(ui8 row) const { + TVectorType vec(0, Columns); for (ui8 i = 0; i < Columns; i++) { if (Get(row, i)) vec.Set(i); @@ -441,8 +441,8 @@ namespace NKikimr { return vec; } - TVectorType GetColumn(ui8 column) const { - TVectorType vec(0, Rows); + TVectorType GetColumn(ui8 column) const { + TVectorType vec(0, Rows); for (ui8 i = 0; i < Rows; i++) { if (Get(i, column)) vec.Set(i); @@ -465,16 +465,16 @@ namespace NKikimr { Ptr[pos.Byte] &= ~pos.Mask; } - TVectorType OrRows() const { - TVectorType vec(0, Columns); + TVectorType OrRows() const { + TVectorType vec(0, Columns); for (ui8 i = 0; i < Rows; i++) { vec |= GetRow(i); } return vec; } - TVectorType OrColumns() const { - TVectorType vec(0, Rows); + TVectorType OrColumns() const { + TVectorType vec(0, Rows); for (ui8 i = 0; i < Columns; i++) { vec |= GetColumn(i); } diff --git a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix_ut.cpp b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix_ut.cpp index e3373f054c6..e6a234e0b20 100644 --- a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix_ut.cpp +++ b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_matrix_ut.cpp @@ -12,7 +12,7 @@ namespace NKikimr { Y_UNIT_TEST_SUITE(TBlobStorageIngressMatrix) { Y_UNIT_TEST(VectorTest) { - TVectorType vec(0, 7); + TVectorType vec(0, 7); vec.Set(0); vec.Set(4); vec.Set(6); @@ -28,25 +28,25 @@ namespace NKikimr { vec.Clear(6); UNIT_ASSERT(!vec.Get(6)); - TVectorType vec1_1(0xA6, 8); - TVectorType vec1_2(0x8C, 8); - TVectorType vec2_1(0xA6, 8); - TVectorType vec2_2(0x8C, 8); + TVectorType vec1_1(0xA6, 8); + TVectorType vec1_2(0x8C, 8); + TVectorType vec2_1(0xA6, 8); + TVectorType vec2_2(0x8C, 8); vec1_1 |= vec1_2; vec2_2 |= vec2_1; UNIT_ASSERT(vec1_1 == vec2_2); - TVectorType expectedResult(0xAE, 8); + TVectorType expectedResult(0xAE, 8); UNIT_ASSERT(vec1_1 == expectedResult); - UNIT_ASSERT(TVectorType(0, 1).Empty()); - UNIT_ASSERT(!TVectorType(0x80, 1).Empty()); + UNIT_ASSERT(TVectorType(0, 1).Empty()); + UNIT_ASSERT(!TVectorType(0x80, 1).Empty()); - UNIT_ASSERT(TVectorType(0x07, 5).Empty()); - UNIT_ASSERT(!TVectorType(0x37, 5).Empty()); + UNIT_ASSERT(TVectorType(0x07, 5).Empty()); + UNIT_ASSERT(!TVectorType(0x37, 5).Empty()); } Y_UNIT_TEST(VectorTestEmpty) { - TVectorType vec(0, 7); + TVectorType vec(0, 7); UNIT_ASSERT(vec.Empty()); vec.Set(0); UNIT_ASSERT(!vec.Empty()); @@ -60,42 +60,42 @@ namespace NKikimr { } Y_UNIT_TEST(VectorTestMinus) { - TVectorType vec1(0, 7); + TVectorType vec1(0, 7); vec1.Set(0); vec1.Set(4); vec1.Set(6); - TVectorType vec2(0, 7); + TVectorType vec2(0, 7); vec2.Set(1); vec2.Set(5); vec2.Set(6); - TVectorType res(0, 7); + TVectorType res(0, 7); res.Set(0); res.Set(4); UNIT_ASSERT(vec1 - vec2 == res); } Y_UNIT_TEST(VectorTestBitwiseAnd) { - TVectorType vec1(0, 7); + TVectorType vec1(0, 7); vec1.Set(0); vec1.Set(4); vec1.Set(6); - TVectorType vec2(0, 7); + TVectorType vec2(0, 7); vec2.Set(1); vec2.Set(5); vec2.Set(6); - TVectorType res(0, 7); + TVectorType res(0, 7); res.Set(6); UNIT_ASSERT((vec1 & vec2) == res); } Y_UNIT_TEST(VectorTestBitwiseComplement1) { - TVectorType vec1(0, 4); - TVectorType vec2(~vec1); - TVectorType vec3(0, 4); + TVectorType vec1(0, 4); + TVectorType vec2(~vec1); + TVectorType vec3(0, 4); vec3.Set(0); vec3.Set(1); vec3.Set(2); @@ -105,11 +105,11 @@ namespace NKikimr { } Y_UNIT_TEST(VectorTestBitwiseComplement2) { - TVectorType vec1(0, 5); + TVectorType vec1(0, 5); vec1.Set(2); vec1.Set(4); - TVectorType vec2(~vec1); - TVectorType vec3(0, 5); + TVectorType vec2(~vec1); + TVectorType vec3(0, 5); vec3.Set(0); vec3.Set(1); vec3.Set(3); @@ -118,16 +118,16 @@ namespace NKikimr { } Y_UNIT_TEST(VectorTestBitsBefore1) { - TVectorType vec1(0, 7); + TVectorType vec1(0, 7); vec1.Set(0); vec1.Set(4); vec1.Set(6); - TVector<ui8> res; + TVector<ui8> res; for (unsigned i = 0; i < vec1.GetSize(); i++) res.push_back(vec1.BitsBefore(i)); - TVector<ui8> canon; + TVector<ui8> canon; canon.push_back(0); canon.push_back(1); canon.push_back(1); @@ -140,15 +140,15 @@ namespace NKikimr { } Y_UNIT_TEST(VectorTestBitsBefore2) { - TVectorType vec1(0, 4); + TVectorType vec1(0, 4); vec1.Set(1); vec1.Set(2); - TVector<ui8> res; + TVector<ui8> res; for (unsigned i = 0; i < vec1.GetSize(); i++) res.push_back(vec1.BitsBefore(i)); - TVector<ui8> canon; + TVector<ui8> canon; canon.push_back(0); canon.push_back(0); canon.push_back(1); @@ -158,17 +158,17 @@ namespace NKikimr { } Y_UNIT_TEST(VectorTestIterator1) { - TVectorType vec1(0, 7); + TVectorType vec1(0, 7); vec1.Set(1); vec1.Set(4); vec1.Set(6); - TVector<ui8> res; + TVector<ui8> res; for (ui8 i = vec1.FirstPosition(); i != vec1.GetSize(); i = vec1.NextPosition(i)) { res.push_back(i); } - TVector<ui8> canon; + TVector<ui8> canon; canon.push_back(1); canon.push_back(4); canon.push_back(6); @@ -176,16 +176,16 @@ namespace NKikimr { } Y_UNIT_TEST(VectorTestIterator2) { - TVectorType vec1(0, 7); + TVectorType vec1(0, 7); vec1.Set(0); vec1.Set(1); vec1.Set(5); - TVector<ui8> res; + TVector<ui8> res; for (ui8 i = vec1.FirstPosition(); i != vec1.GetSize(); i = vec1.NextPosition(i)) res.push_back(i); - TVector<ui8> canon; + TVector<ui8> canon; canon.push_back(0); canon.push_back(1); canon.push_back(5); @@ -193,15 +193,15 @@ namespace NKikimr { } Y_UNIT_TEST(VectorTestIterator3) { - TVectorType vec1(0, 6); + TVectorType vec1(0, 6); vec1.Set(0); - TVector<ui8> res; + TVector<ui8> res; for (ui8 i = vec1.FirstPosition(); i != vec1.GetSize(); i = vec1.NextPosition(i)) { res.push_back(i); } - TVector<ui8> canon; + TVector<ui8> canon; canon.push_back(0); UNIT_ASSERT(res == canon); } @@ -231,27 +231,27 @@ namespace NKikimr { UNIT_ASSERT(m.Get(6, 6)); UNIT_ASSERT(m.Get(7, 2)); - TVectorType vecRows = m.OrRows(); - TVectorType vecRowsExpected(0xFE, 7); + TVectorType vecRows = m.OrRows(); + TVectorType vecRowsExpected(0xFE, 7); UNIT_ASSERT(vecRows == vecRowsExpected); - TVectorType vecColumns = m.OrColumns(); - TVectorType vecColumnsExpected(0xDF, 8); + TVectorType vecColumns = m.OrColumns(); + TVectorType vecColumnsExpected(0xDF, 8); UNIT_ASSERT(vecColumns == vecColumnsExpected); //m.DebugPrint(); - UNIT_ASSERT(m.GetRow(0) == TVectorType(0x80, 7)); - UNIT_ASSERT(m.GetRow(1) == TVectorType(0x40, 7)); - UNIT_ASSERT(m.GetRow(2) == TVectorType(0, 7)); - UNIT_ASSERT(m.GetRow(3) == TVectorType(0x10, 7)); - UNIT_ASSERT(m.GetRow(4) == TVectorType(0x8, 7)); - UNIT_ASSERT(m.GetRow(5) == TVectorType(0x4, 7)); - UNIT_ASSERT(m.GetRow(6) == TVectorType(0x2, 7)); - UNIT_ASSERT(m.GetRow(7) == TVectorType(0x20, 7)); - - UNIT_ASSERT(m.GetColumn(0) == TVectorType(0x80, 8)); - UNIT_ASSERT(m.GetColumn(2) == TVectorType(0x01, 8)); + UNIT_ASSERT(m.GetRow(0) == TVectorType(0x80, 7)); + UNIT_ASSERT(m.GetRow(1) == TVectorType(0x40, 7)); + UNIT_ASSERT(m.GetRow(2) == TVectorType(0, 7)); + UNIT_ASSERT(m.GetRow(3) == TVectorType(0x10, 7)); + UNIT_ASSERT(m.GetRow(4) == TVectorType(0x8, 7)); + UNIT_ASSERT(m.GetRow(5) == TVectorType(0x4, 7)); + UNIT_ASSERT(m.GetRow(6) == TVectorType(0x2, 7)); + UNIT_ASSERT(m.GetRow(7) == TVectorType(0x20, 7)); + + UNIT_ASSERT(m.GetColumn(0) == TVectorType(0x80, 8)); + UNIT_ASSERT(m.GetColumn(2) == TVectorType(0x01, 8)); } void DebugPrint(const TVector<std::pair<TVDiskID, TActorId> > &vec) { @@ -323,7 +323,7 @@ namespace NKikimr { vec.Set(2); vec.Set(4); vec.Set(5); - UNIT_ASSERT(vec.ToVector() == TVectorType(0xAC, 7)); + UNIT_ASSERT(vec.ToVector() == TVectorType(0xAC, 7)); } Y_UNIT_TEST(ShiftedHandoffBitVec) { @@ -333,10 +333,10 @@ namespace NKikimr { vec.Set(2); vec.Set(4); vec.Set(5); - UNIT_ASSERT(vec.ToVector() == TVectorType(0xAC, 7)); + UNIT_ASSERT(vec.ToVector() == TVectorType(0xAC, 7)); vec.Delete(2); vec.Delete(5); - UNIT_ASSERT(vec.ToVector() == TVectorType(0x88, 7)); + UNIT_ASSERT(vec.ToVector() == TVectorType(0x88, 7)); } } diff --git a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_ut.cpp b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_ut.cpp index 82cf659f5ac..81148541dfe 100644 --- a/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_ut.cpp +++ b/ydb/core/blobstorage/vdisk/ingress/blobstorage_ingress_ut.cpp @@ -33,26 +33,26 @@ namespace NKikimr { TIngress::Merge(res, i2.CopyWithoutLocal(groupInfo.Type)); TIngress::Merge(res, i3); - TVectorType vec = res.PartsWeKnowAbout(groupInfo.Type); - UNIT_ASSERT(vec == TVectorType(0xE0, 3)); + TVectorType vec = res.PartsWeKnowAbout(groupInfo.Type); + UNIT_ASSERT(vec == TVectorType(0xE0, 3)); - TVectorType parts(0, 3); + TVectorType parts(0, 3); //// parts = res.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk10, lb1) - res.LocalParts(groupInfo.Type); - UNIT_ASSERT(parts == TVectorType(0, 3)); + UNIT_ASSERT(parts == TVectorType(0, 3)); //// parts = res.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk21, lb1) - res.LocalParts(groupInfo.Type); - UNIT_ASSERT(parts == TVectorType(0x40, 3)); + UNIT_ASSERT(parts == TVectorType(0x40, 3)); // hand off with data TIngress i4 = *TIngress::CreateIngressWithLocal(&groupInfo.GetTopology(), vdisk01, TLogoBlobID(lb1, 2)); parts = i4.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk01, lb1) - i4.LocalParts(groupInfo.Type); - UNIT_ASSERT(parts == TVectorType(0x0, 3)); + UNIT_ASSERT(parts == TVectorType(0x0, 3)); // hand off without data TIngress i5(i4.CopyWithoutLocal(groupInfo.Type)); parts = i5.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk01, lb1) - i5.LocalParts(groupInfo.Type); - UNIT_ASSERT(parts == TVectorType(0x40, 3)); + UNIT_ASSERT(parts == TVectorType(0x40, 3)); } Y_UNIT_TEST(IngressPartsWeMustHaveLocally) { @@ -90,13 +90,13 @@ namespace NKikimr { printLocalParts(i6, vdisk30); // main - UNIT_ASSERT(i1.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk01, lb1) == TVectorType(0b10000000, 3)); - UNIT_ASSERT(i2.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk10, lb1) == TVectorType(0b01000000, 3)); - UNIT_ASSERT(i3.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk21, lb1) == TVectorType(0b00100000, 3)); + UNIT_ASSERT(i1.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk01, lb1) == TVectorType(0b10000000, 3)); + UNIT_ASSERT(i2.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk10, lb1) == TVectorType(0b01000000, 3)); + UNIT_ASSERT(i3.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk21, lb1) == TVectorType(0b00100000, 3)); // handoff - UNIT_ASSERT(i4.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk30, lb1) == TVectorType(0b00100000, 3)); - UNIT_ASSERT(i5.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk30, lb1) == TVectorType(0b10000000, 3)); - UNIT_ASSERT(i6.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk30, lb1) == TVectorType(0b10100000, 3)); + UNIT_ASSERT(i4.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk30, lb1) == TVectorType(0b00100000, 3)); + UNIT_ASSERT(i5.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk30, lb1) == TVectorType(0b10000000, 3)); + UNIT_ASSERT(i6.PartsWeMustHaveLocally(&groupInfo.GetTopology(), vdisk30, lb1) == TVectorType(0b10100000, 3)); } Y_UNIT_TEST(IngressLocalParts) { @@ -118,8 +118,8 @@ namespace NKikimr { // for main disk 0 TIngress i1 = *TIngress::CreateIngressWithLocal(&groupInfo.GetTopology(), vdiskM1, TLogoBlobID(lb1, 1)); { - TVectorType vec = i1.LocalParts(groupInfo.Type); - TVectorType canon(0, 3); + TVectorType vec = i1.LocalParts(groupInfo.Type); + TVectorType canon(0, 3); canon.Set(0); UNIT_ASSERT(vec == canon); } @@ -127,8 +127,8 @@ namespace NKikimr { // for main disk 1 TIngress i2 = *TIngress::CreateIngressWithLocal(&groupInfo.GetTopology(), vdiskM2, TLogoBlobID(lb1, 2)); { - TVectorType vec = i2.LocalParts(groupInfo.Type); - TVectorType canon(0, 3); + TVectorType vec = i2.LocalParts(groupInfo.Type); + TVectorType canon(0, 3); canon.Set(1); UNIT_ASSERT(vec == canon); } @@ -140,8 +140,8 @@ namespace NKikimr { TIngress res; TIngress::Merge(res, i3); TIngress::Merge(res, i4); - TVectorType vec = res.LocalParts(groupInfo.Type); - TVectorType canon(0, 3); + TVectorType vec = res.LocalParts(groupInfo.Type); + TVectorType canon(0, 3); canon.Set(0); canon.Set(2); UNIT_ASSERT(vec == canon); @@ -159,7 +159,7 @@ namespace NKikimr { for (ui32 vdisk = 0; vdisk < subgroup; ++vdisk) { for (ui32 mask = 1; mask < (1U << totalParts); ++mask) { - NMatrix::TVectorType parts(0, totalParts); + NMatrix::TVectorType parts(0, totalParts); for (ui8 i = 0; i < totalParts; ++i) { if (mask >> i & 1) { parts.Set(i); @@ -230,7 +230,7 @@ namespace NKikimr { // main3 // handoff - TVectorType emptyVec(0, 3); + TVectorType emptyVec(0, 3); // for main disk 0 TIngress i1 = *TIngress::CreateIngressWithLocal(&groupInfo.GetTopology(), vdiskM1, TLogoBlobID(lb1, 1)); @@ -255,9 +255,9 @@ namespace NKikimr { i5.Merge(i4); TIngress::TPairOfVectors res3 = i5.HandoffParts(&groupInfo.GetTopology(), vdisk00, lb1); { - TVectorType moveVec(0, 3); + TVectorType moveVec(0, 3); moveVec.Set(2); - TVectorType delVec(0, 3); + TVectorType delVec(0, 3); delVec.Set(1); UNIT_ASSERT(res3 == TIngress::TPairOfVectors(moveVec, delVec)); } @@ -265,9 +265,9 @@ namespace NKikimr { i5.DeleteHandoff(&groupInfo.GetTopology(), vdisk00, TLogoBlobID(lb1, 2)); TIngress::TPairOfVectors res4 = i5.HandoffParts(&groupInfo.GetTopology(), vdisk00, lb1); { - TVectorType moveVec(0, 3); + TVectorType moveVec(0, 3); moveVec.Set(2); - TVectorType delVec(0, 3); + TVectorType delVec(0, 3); UNIT_ASSERT(res4 == TIngress::TPairOfVectors(moveVec, delVec)); } @@ -278,8 +278,8 @@ namespace NKikimr { i5.Merge(i6woLocal); TIngress::TPairOfVectors res5 = i5.HandoffParts(&groupInfo.GetTopology(), vdisk00, lb1); { - TVectorType moveVec(0, 3); - TVectorType delVec(0, 3); + TVectorType moveVec(0, 3); + TVectorType delVec(0, 3); delVec.Set(2); UNIT_ASSERT(res5 == TIngress::TPairOfVectors(moveVec, delVec)); } diff --git a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_defs.cpp b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_defs.cpp index f75654db66c..2a22cad21ef 100644 --- a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_defs.cpp +++ b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_defs.cpp @@ -72,9 +72,9 @@ namespace NKikimr { void TLocalRecoveryInfo::OutputCounters(IOutputStream &str, - const TString &prefix, - const TString &suffix, - const TString &hr) const { + const TString &prefix, + const TString &suffix, + const TString &hr) const { auto boolToStr = [] (bool x) { return x ? "true" : "false"; }; str << "RecoveredLogStartLsn# " << RecoveredLogStartLsn << suffix << prefix << "SuccessfulRecovery# " << boolToStr(SuccessfulRecovery) << suffix @@ -202,7 +202,7 @@ namespace NKikimr { str << "\n"; } - TString TLocalRecoveryInfo::ToString() const { + TString TLocalRecoveryInfo::ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_defs.h b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_defs.h index 74149073478..7b0b7912e8d 100644 --- a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_defs.h +++ b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_defs.h @@ -267,7 +267,7 @@ namespace NKikimr { void FillIn(NKikimrBlobStorage::TLocalRecoveryInfo *proto) const; void Output(IOutputStream &str) const; void OutputHtml(IOutputStream &str) const; - TString ToString() const; + TString ToString() const; void SetStartingPoint(TLogSignature signature, ui64 lsn); void HandleReadLogResult(const NPDisk::TEvReadLogResult::TResults &results); void SetRecoveredLogStartLsn(ui64 lsn); @@ -278,9 +278,9 @@ namespace NKikimr { private: void Disp(TRec r); void OutputCounters(IOutputStream &str, - const TString &prefix, - const TString &suffix, - const TString &hr) const; + const TString &prefix, + const TString &suffix, + const TString &hr) const; }; } // NKikimr diff --git a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp index b9bdafdbb13..382f1fb6539 100644 --- a/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp +++ b/ydb/core/blobstorage/vdisk/localrecovery/localrecovery_public.cpp @@ -93,7 +93,7 @@ namespace NKikimr { HullBarriersDBInitialized && SyncLogInitialized; } - void SignalErrorAndDie(const TActorContext &ctx, NKikimrProto::EReplyStatus status, const TString &reason) { + void SignalErrorAndDie(const TActorContext &ctx, NKikimrProto::EReplyStatus status, const TString &reason) { LocRecCtx->RecovInfo->SuccessfulRecovery = false; VDiskMonGroup.VDiskLocalRecoveryState() = TDbMon::TDbLocalRecovery::Error; LOG_CRIT(ctx, BS_LOCALRECOVERY, @@ -252,8 +252,8 @@ namespace NKikimr { // read existing one emptyDb = false; counter = 0; - const TString &data = it->second.Data; - TString explanation; + const TString &data = it->second.Data; + TString explanation; NKikimrVDiskData::THullDbEntryPoint pb; const bool good = THullDbSignatureRoutines::Parse(pb, data, explanation); if (!good) { @@ -317,7 +317,7 @@ namespace NKikimr { bool InitSyncLogData(const TStartingPoints &startingPoints, const TActorContext &ctx) { TStartingPoints::const_iterator it; it = startingPoints.find(TLogSignature::SignatureSyncLogIdx); - TString entryPoint; + TString entryPoint; ui64 entryPointLsn = 0; if (it == startingPoints.end()) { @@ -372,7 +372,7 @@ namespace NKikimr { } else { // read existing one LocRecCtx->RecovInfo->EmptySyncer = false; - const TString &entryPoint = it->second.Data; + const TString &entryPoint = it->second.Data; if (!TSyncerData::CheckEntryPoint(LocRecCtx->VCtx->VDiskLogPrefix, SkeletonId, LocRecCtx->VCtx->ShortSelfVDisk, LocRecCtx->VCtx->Top, entryPoint)) { SignalErrorAndDie(ctx, NKikimrProto::ERROR, "Entry point for Syncer check failed"); @@ -424,7 +424,7 @@ namespace NKikimr { LocRecCtx->RecovInfo->EmptyHuge = false; const ui64 lsn = it->second.Lsn; - const TString &entryPoint = it->second.Data; + const TString &entryPoint = it->second.Data; if (!THullHugeKeeperPersState::CheckEntryPoint(entryPoint)) { SignalErrorAndDie(ctx, NKikimrProto::ERROR, "Entry point for HugeKeeper check failed"); return false; diff --git a/ydb/core/blobstorage/vdisk/query/query_readactor.cpp b/ydb/core/blobstorage/vdisk/query/query_readactor.cpp index dfe5cff3c0b..26de8f90dc0 100644 --- a/ydb/core/blobstorage/vdisk/query/query_readactor.cpp +++ b/ydb/core/blobstorage/vdisk/query/query_readactor.cpp @@ -67,7 +67,7 @@ namespace NKikimr { } void Handle(NPDisk::TEvChunkReadResult::TPtr &ev, const TActorContext &ctx) { - TString message; + TString message; const NKikimrProto::EReplyStatus status = ev->Get()->Status; if (status != NKikimrProto::OK) { TStringStream str; diff --git a/ydb/core/blobstorage/vdisk/query/query_readbatch.cpp b/ydb/core/blobstorage/vdisk/query/query_readbatch.cpp index a883191f156..a4db2d99a1a 100644 --- a/ydb/core/blobstorage/vdisk/query/query_readbatch.cpp +++ b/ydb/core/blobstorage/vdisk/query/query_readbatch.cpp @@ -190,7 +190,7 @@ namespace NKikimr { } } - TString TReadBatcher::DiskDataItemsToString() const { + TString TReadBatcher::DiskDataItemsToString() const { TStringStream str; for (const auto &i : Result->DiskDataItemPtrs) { str << i->ActualRead.ToString() << " "; diff --git a/ydb/core/blobstorage/vdisk/query/query_readbatch.h b/ydb/core/blobstorage/vdisk/query/query_readbatch.h index b0592a9a202..2adc6fb1128 100644 --- a/ydb/core/blobstorage/vdisk/query/query_readbatch.h +++ b/ydb/core/blobstorage/vdisk/query/query_readbatch.h @@ -62,7 +62,7 @@ namespace NKikimr { std::vector<TDiskPart> ExtraDiskItems; public: - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Type# "; switch (Type) { @@ -355,7 +355,7 @@ namespace NKikimr { NReadBatcher::TGlueRead *AddGlueRead(NReadBatcher::TDataItem *item); void PrepareReadPlan(); - TString DiskDataItemsToString() const; + TString DiskDataItemsToString() const; bool CheckDiskDataItemsOrdering(bool printOnFail = false) const; void ClearTmpItems() { diff --git a/ydb/core/blobstorage/vdisk/query/query_statdb.cpp b/ydb/core/blobstorage/vdisk/query/query_statdb.cpp index 65bded589f7..23a00227713 100644 --- a/ydb/core/blobstorage/vdisk/query/query_statdb.cpp +++ b/ydb/core/blobstorage/vdisk/query/query_statdb.cpp @@ -101,7 +101,7 @@ namespace NKikimr { } private: - TVector<TChannelInfo> Channels; + TVector<TChannelInfo> Channels; void Finish(IOutputStream &str, std::function<void (IOutputStream &)> t, @@ -152,7 +152,7 @@ namespace NKikimr { /////////////////////////////////////////////////////////////////////////////// class TAllTablets { private: - using THash = THashMap<ui64, TTabletInfoPtr>; // tabletID -> TTabletInfoPtr + using THash = THashMap<ui64, TTabletInfoPtr>; // tabletID -> TTabletInfoPtr THash Hash; TAllChannels AllChannels; @@ -336,9 +336,9 @@ namespace NKikimr { ui32 BlockedGeneration = 0; }; - using TMapType = TMap<ui64, TValue>; // TabletId -> TValue + using TMapType = TMap<ui64, TValue>; // TabletId -> TValue - TMapType Map; + TMapType Map; IOutputStream &Str; bool Pretty; }; @@ -437,9 +437,9 @@ namespace NKikimr { using TBarrierKind = bool; // hard=true or soft=false using TKey = std::tuple<ui64, ui32, TBarrierKind>; - using TMapType = TMap<TKey, TValue>; // TKey -> TValue + using TMapType = TMap<TKey, TValue>; // TKey -> TValue - TMapType Map; + TMapType Map; IOutputStream &Str; bool Pretty; }; diff --git a/ydb/core/blobstorage/vdisk/query/query_stattablet.cpp b/ydb/core/blobstorage/vdisk/query/query_stattablet.cpp index 16e25fb1a65..94cde3c55f1 100644 --- a/ydb/core/blobstorage/vdisk/query/query_stattablet.cpp +++ b/ydb/core/blobstorage/vdisk/query/query_stattablet.cpp @@ -100,12 +100,12 @@ namespace NKikimr { return *this; } }; - using TMapType = TMap<TChannelLevel, TValue>; + using TMapType = TMap<TChannelLevel, TValue>; IOutputStream &Str; ui64 TabletId; bool Pretty; - TMapType Map; + TMapType Map; const TIngress::EMode IngressMode; public: @@ -197,7 +197,7 @@ namespace NKikimr { } } - void RenderTableForChannel(TMapType::const_iterator begin, TMapType::const_iterator end) const { + void RenderTableForChannel(TMapType::const_iterator begin, TMapType::const_iterator end) const { // render output HTML(Str) { DIV_CLASS("panel panel-info") { @@ -227,7 +227,7 @@ namespace NKikimr { } TABLEBODY() { TValue total; - for (TMapType::const_iterator it = begin; it != end; ++it) { + for (TMapType::const_iterator it = begin; it != end; ++it) { const TString levelName = std::get<1>(it->first); total += it->second; RenderRow(levelName, it->second); @@ -241,9 +241,9 @@ namespace NKikimr { } void Finish() { - TMapType::const_iterator end = Map.end(); - TMapType::const_iterator first = end; - for (TMapType::const_iterator it = Map.begin(); it != end; ++it) { + TMapType::const_iterator end = Map.end(); + TMapType::const_iterator first = end; + for (TMapType::const_iterator it = Map.begin(); it != end; ++it) { if (first == end) { first = it; } else { diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp b/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp index 3a95c22022f..28164e1cfdf 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_hullrepljob.cpp @@ -212,7 +212,7 @@ namespace NKikimr { TIntrusivePtr<TBlobStorageGroupInfo> GInfo; const TActorId ParentId; const TLogoBlobID StartKey; - TVector<TVDiskProxyPtr> MergeHeap; + TVector<TVDiskProxyPtr> MergeHeap; TEvReplFinished::TInfoPtr ReplInfo; TRecoveryMachine::TRecoveredBlobsQueue RecoveryQueue; TReplSstStreamWriter Writer; @@ -237,9 +237,9 @@ namespace NKikimr { ui32 NumRunningProxies = 0; bool PhantomCheckPending = false; - TDeque<TLogoBlobID> Phantoms; + TDeque<TLogoBlobID> Phantoms; - THashSet<TChunkIdx> WrittenChunkIdxSet; + THashSet<TChunkIdx> WrittenChunkIdxSet; friend class TActorBootstrapped<THullReplJobActor>; @@ -493,7 +493,7 @@ namespace NKikimr { } // find out which proxies carry items with the same key - TVector<TVDiskProxyPtr>::iterator lastIter = MergeHeap.end(); + TVector<TVDiskProxyPtr>::iterator lastIter = MergeHeap.end(); while (lastIter != MergeHeap.begin() && MergeHeap.front()->GenLogoBlobId() == *CurrentKey) { PopHeap(MergeHeap.begin(), lastIter, TVDiskProxy::TPtrGreater()); --lastIter; diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_hullreplwritesst.h b/ydb/core/blobstorage/vdisk/repl/blobstorage_hullreplwritesst.h index f4f0e49015f..24c94ca438a 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_hullreplwritesst.h +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_hullreplwritesst.h @@ -17,7 +17,7 @@ namespace NKikimr { TLogoBlobID Id; TRope Data; bool IsHugeBlob; - NMatrix::TVectorType LocalParts; + NMatrix::TVectorType LocalParts; TRecoveredBlobInfo(const TLogoBlobID& id, TRope&& data, bool isHugeBlob, NMatrix::TVectorType localParts) : Id(id) @@ -259,7 +259,7 @@ namespace NKikimr { Y_VERIFY(!WritesInFlight); Y_VERIFY(FlushFinished); const auto& conclusion = Writer->GetConclusion(); - TVector<ui32> usedChunks = conclusion.UsedChunks; + TVector<ui32> usedChunks = conclusion.UsedChunks; PendingCommitMsg = std::make_unique<TEvAddBulkSst>(TVector<ui32>(ReservedChunks.begin(), ReservedChunks.end()), std::move(usedChunks), TLogoBlobsSstPtr(conclusion.LevelSegment), NumRecoveredBlobs); Writer.reset(); @@ -274,7 +274,7 @@ namespace NKikimr { EOutputState OutputState; std::unique_ptr<IEventBase> PendingPDiskMsg; std::unique_ptr<TEvAddBulkSst> PendingCommitMsg; - TDeque<ui32> ReservedChunks; + TDeque<ui32> ReservedChunks; ui32 MinReservedChunksCount; std::unique_ptr<TWriter> Writer; TDataMerger Merger; diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_repl.cpp b/ydb/core/blobstorage/vdisk/repl/blobstorage_repl.cpp index 34be219abce..da3a91732da 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_repl.cpp +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_repl.cpp @@ -34,7 +34,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TEvReplFinished::TInfo //////////////////////////////////////////////////////////////////////////// - TString TEvReplFinished::TInfo::ToString() const { + TString TEvReplFinished::TInfo::ToString() const { return Sprintf("{KeyPos: %s Eof: %s ReplicaOk: %" PRIu64 " RecoveryScheduled: %" PRIu64 " DataRecoverySuccess: %" PRIu64 " DataRecoveryFailure: %" PRIu64 "}", KeyPos.ToString().data(), (Eof ? "true" : "false"), ReplicaOk, RecoveryScheduled, DataRecoverySuccess, DataRecoveryFailure); @@ -430,7 +430,7 @@ namespace NKikimr { HTML(str) { TABLER() { str << "<td colspan=3>"; - TString id = CreateGuidAsString(); + TString id = CreateGuidAsString(); COLLAPSED_BUTTON_CONTENT(id, "More") { TABLE() { OutputQuantums(str, it, e); @@ -475,7 +475,7 @@ namespace NKikimr { TABLE_CLASS ("table table-condensed") { CAPTION() STRONG() {str << "Last " << historySize << " replication quantums"; } TABLEBODY() { - TVector<TEvReplFinished::TInfoPtr> quantums; + TVector<TEvReplFinished::TInfoPtr> quantums; for (auto it = History.Begin(); it != History.End(); ++it) { quantums.push_back(*it); } diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_repl.h b/ydb/core/blobstorage/vdisk/repl/blobstorage_repl.h index 629d65bea97..c5426c0497a 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_repl.h +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_repl.h @@ -11,7 +11,7 @@ namespace NKikimr { struct TProxyStat; }; - using TBlobIdQueue = TQueue<TLogoBlobID>; + using TBlobIdQueue = TQueue<TLogoBlobID>; using TBlobIdQueuePtr = std::shared_ptr<TBlobIdQueue>; //////////////////////////////////////////////////////////////////////////// @@ -73,7 +73,7 @@ namespace NKikimr { DropDonor = dropDonor; } - TString ToString() const; + TString ToString() const; void OutputHtml(IOutputStream &str) const; TInfo(); @@ -110,9 +110,9 @@ namespace NKikimr { }; struct TEvDetectedPhantomBlob : public TEventLocal<TEvDetectedPhantomBlob, TEvBlobStorage::EvDetectedPhantomBlob> { - TDeque<TLogoBlobID> Phantoms; + TDeque<TLogoBlobID> Phantoms; - TEvDetectedPhantomBlob(TDeque<TLogoBlobID>&& phantoms) + TEvDetectedPhantomBlob(TDeque<TLogoBlobID>&& phantoms) : Phantoms(std::move(phantoms)) {} diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_replbroker.cpp b/ydb/core/blobstorage/vdisk/repl/blobstorage_replbroker.cpp index 543f0a537db..d41a1e67f45 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_replbroker.cpp +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_replbroker.cpp @@ -22,7 +22,7 @@ namespace NKikimr { , Bytes(bytes) {} }; - TDeque<TMemQueueItem> MemQueue; + TDeque<TMemQueueItem> MemQueue; i64 MemFree; struct TMemToken { @@ -34,7 +34,7 @@ namespace NKikimr { , Bytes(bytes) {} }; - THashMap<TReplMemTokenId, TMemToken> MemTokens; + THashMap<TReplMemTokenId, TMemToken> MemTokens; TReplMemTokenId NextMemToken = 1; public: diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_replproxy.cpp b/ydb/core/blobstorage/vdisk/repl/blobstorage_replproxy.cpp index 1f82e552bac..39733d845f6 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_replproxy.cpp +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_replproxy.cpp @@ -107,7 +107,7 @@ namespace NKikimr { {} }; - using TResultQueue = TPriorityQueue<TQueueItem, TVector<TQueueItem>, TCompare>; + using TResultQueue = TPriorityQueue<TQueueItem, TVector<TQueueItem>, TCompare>; std::shared_ptr<TReplCtx> ReplCtx; const TBlobStorageGroupType GType; @@ -130,7 +130,7 @@ namespace NKikimr { TResultQueue ResultQueue; TQueue<std::unique_ptr<TEvBlobStorage::TEvVGet>> SchedulerRequestQ; - THashMap<ui64, TReplMemTokenId> RequestTokens; + THashMap<ui64, TReplMemTokenId> RequestTokens; friend class TActorBootstrapped<TVDiskProxyActor>; @@ -387,7 +387,7 @@ namespace NKikimr { ++CurPosIdx; if (q.GetStatus() == NKikimrProto::OK) { - TString buffer = q.GetBuffer(); + TString buffer = q.GetBuffer(); if (buffer.size() != GType.PartSize(id)) { TString message = VDISKP(ReplCtx->VCtx->VDiskLogPrefix, "Received incorrect data BlobId# %s Buffer.size# %zu;" diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_replproxy.h b/ydb/core/blobstorage/vdisk/repl/blobstorage_replproxy.h index e05f54cd079..74a49df23c7 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_replproxy.h +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_replproxy.h @@ -28,7 +28,7 @@ namespace NKikimr { TTrackableString Data; TDataElement(TMemoryConsumer&& consumer, const TLogoBlobID& logoBlobId, NKikimrProto::EReplyStatus status, - TString&& data) + TString&& data) : LogoBlobId(logoBlobId) , Status(status) , Data(std::move(consumer), std::move(data)) @@ -75,14 +75,14 @@ namespace NKikimr { // WRITE PART //////////////////////////////////////////////////////////////////////////////// - void Add(const TLogoBlobID& logoBlobId, TString&& data) { + void Add(const TLogoBlobID& logoBlobId, TString&& data) { Y_VERIFY_DEBUG(FrontPos == 0); Items.emplace_back(TMemoryConsumer(Consumer), logoBlobId, NKikimrProto::OK, std::move(data)); } void AddError(const TLogoBlobID& logoBlobId, NKikimrProto::EReplyStatus status) { Y_VERIFY_DEBUG(FrontPos == 0); - Items.emplace_back(TMemoryConsumer(Consumer), logoBlobId, status, TString()); + Items.emplace_back(TMemoryConsumer(Consumer), logoBlobId, status, TString()); } void Append(TDataPortion&& from) { diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine.h b/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine.h index 9568165e383..1bf463499c2 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine.h +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine.h @@ -58,7 +58,7 @@ namespace NKikimr { class TRecoveryMachine { public: using TRecoveredBlobInfo = TReplSstStreamWriter::TRecoveredBlobInfo; - using TRecoveredBlobsQueue = TQueue<TRecoveredBlobInfo>; + using TRecoveredBlobsQueue = TQueue<TRecoveredBlobInfo>; struct TPartSet { TDataPartSet PartSet; @@ -206,7 +206,7 @@ namespace NKikimr { Y_VERIFY(partSet.PartSet.FullDataSize == id.BlobSize()); // PartSet contains some data, other data will be restored and written in the same PartSet - TString recoveredData; + TString recoveredData; const ui32 incomingMask = partSet.PartSet.PartsMask; if (canRestore && needToRestore) { groupType.RestoreData((TErasureType::ECrcMode)id.CrcMode(), partSet.PartSet, recoveredData, @@ -291,7 +291,7 @@ namespace NKikimr { } // add next task during preparation phase - void AddTask(const TLogoBlobID &id, const NMatrix::TVectorType &partsToRecover, bool possiblePhantom, + void AddTask(const TLogoBlobID &id, const NMatrix::TVectorType &partsToRecover, bool possiblePhantom, TIngress ingress) { Y_VERIFY(!id.PartId()); Y_VERIFY(LostVec.empty() || LostVec.back().Id < id); @@ -327,11 +327,11 @@ namespace NKikimr { // structure for a lost part struct TLost { const TLogoBlobID Id; - const NMatrix::TVectorType PartsToRecover; + const NMatrix::TVectorType PartsToRecover; bool PossiblePhantom; const TIngress Ingress; - TLost(const TLogoBlobID &id, const NMatrix::TVectorType &partsToRecover, const bool possiblePhantom, + TLost(const TLogoBlobID &id, const NMatrix::TVectorType &partsToRecover, const bool possiblePhantom, TIngress ingress) : Id(id) , PartsToRecover(partsToRecover) diff --git a/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine_ut.cpp b/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine_ut.cpp index 3ff7efb53e2..427f098d4f2 100644 --- a/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine_ut.cpp +++ b/ydb/core/blobstorage/vdisk/repl/blobstorage_replrecoverymachine_ut.cpp @@ -9,17 +9,17 @@ namespace NKikimr { Y_UNIT_TEST_SUITE(TBlobStorageReplRecoveryMachine) { - TMap<TLogoBlobID, TVector<TString>> GenerateData(ui32 numBlobs, + TMap<TLogoBlobID, TVector<TString>> GenerateData(ui32 numBlobs, ui32 maxLen, const TIntrusivePtr<TBlobStorageGroupInfo> &info, - const TVector<TVDiskID>& vdisks) { - TMap<TLogoBlobID, TVector<TString>> rv; + const TVector<TVDiskID>& vdisks) { + TMap<TLogoBlobID, TVector<TString>> rv; TReallyFastRng32 rng(1); ui32 step = 1; while (numBlobs--) { ui32 len = 1 + rng() % maxLen; - TString data; + TString data; data.reserve(len); for (ui32 i = 0; i < len; ++i) { data.push_back(rng()); @@ -35,7 +35,7 @@ namespace NKikimr { TDataPartSet parts; info->Type.SplitData((TErasureType::ECrcMode)id.CrcMode(), data, parts); - TVector<TString> diskvec(vdisks.size()); + TVector<TString> diskvec(vdisks.size()); for (ui32 i = 0; i < info->Type.TotalPartCount(); ++i) { for (ui32 k = 0; k < vdisks.size(); ++k) { @@ -88,7 +88,7 @@ namespace NKikimr { auto info = MakeIntrusive<TEvReplFinished::TInfo>(); TBlobIdQueuePtr unreplicatedBlobsPtr = std::make_shared<TBlobIdQueue>(); NRepl::TRecoveryMachine m(replCtx, info, unreplicatedBlobsPtr); - TMap<TLogoBlobID, TVector<TString>> data = GenerateData(10000, 1024, groupInfo, vdisks); + TMap<TLogoBlobID, TVector<TString>> data = GenerateData(10000, 1024, groupInfo, vdisks); for (const auto& pair : data) { const TLogoBlobID& id = pair.first; @@ -124,7 +124,7 @@ namespace NKikimr { } for (const auto& pair : data) { const TLogoBlobID& id = pair.first; - const TVector<TString>& v = pair.second; + const TVector<TString>& v = pair.second; if (v[0].empty()) { continue; // nothing to recover on this disk } diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp index 44b3c58c9c4..ce9241c1668 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_monactors.cpp @@ -16,7 +16,7 @@ namespace NKikimr { class TMonErrorActor : public TActorBootstrapped<TMonErrorActor> { const TActorId NotifyId; NMon::TEvHttpInfo::TPtr Ev; - const TString Explanation; + const TString Explanation; friend class TActorBootstrapped<TMonErrorActor>; @@ -33,7 +33,7 @@ namespace NKikimr { TMonErrorActor(const TActorId ¬ifyId, NMon::TEvHttpInfo::TPtr &ev, - const TString &explanation) + const TString &explanation) : TActorBootstrapped<TMonErrorActor>() , NotifyId(notifyId) , Ev(ev) @@ -51,16 +51,16 @@ namespace NKikimr { const TActorId LocalRecovActorID; unsigned Counter; - TString SkeletonState; - TString HullInfo; - TString SyncerInfo; - TString SyncLogInfo; - TString ReplInfo; - TString LogCutterInfo; - TString HugeKeeperInfo; - TString HandoffInfo; - TString DskSpaceTrackerInfo; - TString LocalRecovInfo; + TString SkeletonState; + TString HullInfo; + TString SyncerInfo; + TString SyncLogInfo; + TString ReplInfo; + TString LogCutterInfo; + TString HugeKeeperInfo; + TString HandoffInfo; + TString DskSpaceTrackerInfo; + TString LocalRecovInfo; TString AnubisRunnerInfo; TString DelayedHugeBlobDeleterInfo; TString ScrubInfo; @@ -247,7 +247,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class TMonQueryBaseActor { protected: - TString BuildForm(const TString &dbnameParam, const TString &itemName, const TString &placeholder, bool index) { + TString BuildForm(const TString &dbnameParam, const TString &itemName, const TString &placeholder, bool index) { TStringStream str; HTML(str) { @@ -312,8 +312,8 @@ namespace NKikimr { friend class TActorBootstrapped<TSkeletonFrontMonLogoBlobsQueryActor>; - void OutputForm(const TActorContext &ctx, const TString &dbnameParam) { - TString html = BuildForm(dbnameParam, "LogoBlob", + void OutputForm(const TActorContext &ctx, const TString &dbnameParam) { + TString html = BuildForm(dbnameParam, "LogoBlob", "[tablet:gen:step:channel:cookie:hashtype:part:hash]", true); Finish(ctx, new NMon::TEvHttpInfoRes(html)); } @@ -321,16 +321,16 @@ namespace NKikimr { void Bootstrap(const TActorContext &ctx) { const TCgiParameters& cgi = Ev->Get()->Request.GetParams(); - TString dbnameParam = cgi.Get("dbname"); - TString formParam = cgi.Get("form"); - TString fromParam = cgi.Get("from"); - TString toParam = cgi.Get("to"); + TString dbnameParam = cgi.Get("dbname"); + TString formParam = cgi.Get("form"); + TString fromParam = cgi.Get("from"); + TString toParam = cgi.Get("to"); IndexOnly = cgi.Has("IndexOnly"); ShowInternals = cgi.Has("Internals"); bool submitButton = cgi.Has("submit"); bool allButton = cgi.Has("all"); - if (formParam != TString()) { + if (formParam != TString()) { OutputForm(ctx, dbnameParam); return; } @@ -348,7 +348,7 @@ namespace NKikimr { } // parse 'from' field - TString errorExplanation; + TString errorExplanation; bool good = TLogoBlobID::Parse(From, fromParam, errorExplanation); if (!good) { Finish(ctx, NMonUtil::PrepareError("Failed to parse 'from' field: " + errorExplanation)); @@ -517,23 +517,23 @@ namespace NKikimr { friend class TActorBootstrapped<TSkeletonFrontMonBarriersQueryActor>; - void OutputForm(const TActorContext &ctx, const TString &dbnameParam) { - TString html = BuildForm(dbnameParam, "Barrier", "[tablet:channel:gen:gencounter]", false); + void OutputForm(const TActorContext &ctx, const TString &dbnameParam) { + TString html = BuildForm(dbnameParam, "Barrier", "[tablet:channel:gen:gencounter]", false); Finish(ctx, new NMon::TEvHttpInfoRes(html)); } void Bootstrap(const TActorContext &ctx) { const TCgiParameters& cgi = Ev->Get()->Request.GetParams(); - TString dbnameParam = cgi.Get("dbname"); - TString formParam = cgi.Get("form"); - TString fromParam = cgi.Get("from"); - TString toParam = cgi.Get("to"); + TString dbnameParam = cgi.Get("dbname"); + TString formParam = cgi.Get("form"); + TString fromParam = cgi.Get("from"); + TString toParam = cgi.Get("to"); bool showInternals = cgi.Has("Internals"); bool submitButton = cgi.Has("submit"); bool allButton = cgi.Has("all"); - if (formParam != TString()) { + if (formParam != TString()) { OutputForm(ctx, dbnameParam); return; } @@ -548,7 +548,7 @@ namespace NKikimr { } // parse 'from' field - TString errorExplanation; + TString errorExplanation; bool good = TKeyBarrier::Parse(From, fromParam, errorExplanation); if (!good) { Finish(ctx, NMonUtil::PrepareError("Failed to parse 'from' field: " + errorExplanation)); @@ -699,7 +699,7 @@ namespace NKikimr { const TActorId SkeletonFrontID; NMon::TEvHttpInfo::TPtr Ev; const NKikimrBlobStorage::EDbStatAction Action; - const TString Dbname; + const TString Dbname; friend class TActorBootstrapped<TSkeletonFrontMonDbStatActor>; @@ -879,7 +879,7 @@ namespace NKikimr { const TActorId &skeletonFrontID, NMon::TEvHttpInfo::TPtr &ev, NKikimrBlobStorage::EDbStatAction action, - const TString &dbname) + const TString &dbname) : TActorBootstrapped<TSkeletonFrontMonDbStatActor>() , SelfVDiskId(selfVDiskId) , Cfg(cfg) @@ -898,8 +898,8 @@ namespace NKikimr { const TActorId NotifyId; const TActorId SkeletonID; NMon::TEvHttpInfo::TPtr Ev; - TString SkeletonFrontAnswer; - TString SkeletonAnswer; + TString SkeletonFrontAnswer; + TString SkeletonAnswer; friend class TActorBootstrapped<TSkeletonFrontMonMainPageActor>; @@ -963,7 +963,7 @@ namespace NKikimr { TSkeletonFrontMonMainPageActor(const TActorId ¬ifyId, const TActorId &skeletonID, NMon::TEvHttpInfo::TPtr &ev, - const TString &frontHtml) + const TString &frontHtml) : TActorBootstrapped<TSkeletonFrontMonMainPageActor>() , NotifyId(notifyId) , SkeletonID(skeletonID) @@ -982,12 +982,12 @@ namespace NKikimr { TIntrusivePtr<TVDiskConfig> cfg, const std::shared_ptr<TBlobStorageGroupInfo::TTopology> &top, NMon::TEvHttpInfo::TPtr &ev, - const TString &frontHtml) { + const TString &frontHtml) { const TCgiParameters& cgi = ev->Get()->Request.GetParams(); - const TString &type = cgi.Get("type"); - const TString &dbname = cgi.Get("dbname"); - if (type == TString()) { + const TString &type = cgi.Get("type"); + const TString &dbname = cgi.Get("dbname"); + if (type == TString()) { return new TSkeletonFrontMonMainPageActor(notifyId, skeletonID, ev, frontHtml); } else if (type == "query") { if (dbname == "LogoBlobs") { diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp index 96b813d3172..eb552873184 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeleton.cpp @@ -1542,7 +1542,7 @@ namespace NKikimr { for (const TLogoBlobID& id : msg->Phantoms) { LogoBlobIDFromLogoBlobID(id, record.AddLogoBlobs()); } - TString data; + TString data; bool res = record.SerializeToString(&data); Y_VERIFY(res); diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp index 08c32a8921e..6babdf72f3e 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_skeletonfront.cpp @@ -139,7 +139,7 @@ namespace NKikimr { // TIntQueueClass -- delayed queue //////////////////////////////////////////////////////////////////////////// class TIntQueueClass { - using TQueueType = TQueueInplace<TRecord, 4096>; + using TQueueType = TQueueInplace<TRecord, 4096>; private: std::unique_ptr<TQueueType, TQueueType::TCleanDestructor> Queue; @@ -153,7 +153,7 @@ namespace NKikimr { const ui64 MaxInFlightCost; public: const NKikimrBlobStorage::EVDiskInternalQueueId IntQueueId; - const TString Name; + const TString Name; private: NMonitoring::TDynamicCounters::TCounterPtr SkeletonFrontInFlightCount; @@ -177,7 +177,7 @@ namespace NKikimr { ui64 maxInFlightCount, ui64 maxInFlightCost, TIntrusivePtr<NMonitoring::TDynamicCounters> skeletonFrontGroup) - : Queue(new TQueueType()) + : Queue(new TQueueType()) , InFlightCount(0) , InFlightCost(0) , InFlightBytes(0) @@ -365,7 +365,7 @@ namespace NKikimr { str << "<br>"; } - TString GenerateHtmlState() const { + TString GenerateHtmlState() const { // NOTE: warning policy: // 1. For InFlightCount and InFlightCost we output them in yellow, if // queue size if half of maximun queue size @@ -403,7 +403,7 @@ namespace NKikimr { private: std::unique_ptr<TMyQueueBackpressure> QueueBackpressure; NKikimrBlobStorage::EVDiskQueueId ExtQueueId; - TString Name; + TString Name; NMonitoring::TDynamicCounters::TCounterPtr SkeletonFrontDeadline; NMonitoring::TDynamicCounters::TCounterPtr SkeletonFrontOverflow; NMonitoring::TDynamicCounters::TCounterPtr SkeletonFrontIncorrectMsgId; @@ -426,7 +426,7 @@ namespace NKikimr { } public: - TExtQueueClass(NKikimrBlobStorage::EVDiskQueueId extQueueId, const TString &name, ui64 totalCost, + TExtQueueClass(NKikimrBlobStorage::EVDiskQueueId extQueueId, const TString &name, ui64 totalCost, bool checkMsgId, TIntrusivePtr<NMonitoring::TDynamicCounters> skeletonFrontGroup, const TIntrusivePtr<TVDiskConfig>& config) : QueueBackpressure() @@ -535,7 +535,7 @@ namespace NKikimr { NotifyOtherClients(ctx, feedback); } - TString GenerateHtmlState() const { + TString GenerateHtmlState() const { TStringStream str; str << "\n"; HTML(str) { @@ -648,7 +648,7 @@ namespace NKikimr { const auto &bi = Config->BaseInfo; TString path = Sprintf("vdisk%09" PRIu32 "_%09" PRIu32, bi.PDiskId, bi.VDiskSlotId); - TString name = Sprintf("%s VDisk%09" PRIu32 "_%09" PRIu32, + TString name = Sprintf("%s VDisk%09" PRIu32 "_%09" PRIu32, VCtx->VDiskLogPrefix.data(), bi.PDiskId, bi.VDiskSlotId); mon->RegisterActorPage(vdisksMonPage, path, name, false, ctx.ExecutorThread.ActorSystem, ctx.SelfID); } @@ -1353,8 +1353,8 @@ namespace NKikimr { void Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorContext &ctx) { // we process mon requests out of order const TCgiParameters& cgi = ev->Get()->Request.GetParams(); - const TString& type = cgi.Get("type"); - TString html = (type == TString()) ? GenerateHtmlState(ctx) : TString(); + const TString& type = cgi.Get("type"); + TString html = (type == TString()) ? GenerateHtmlState(ctx) : TString(); auto aid = ctx.Register(CreateFrontSkeletonMonRequestHandler(SelfVDiskId, ctx.SelfID, SkeletonId, ctx.SelfID, Config, Top, ev, html)); ActiveActors.Insert(aid); diff --git a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfull.cpp b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfull.cpp index 5881368772c..9a4b67c5c7e 100644 --- a/ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfull.cpp +++ b/ydb/core/blobstorage/vdisk/skeleton/blobstorage_syncfull.cpp @@ -53,7 +53,7 @@ namespace NKikimr { friend class TActorBootstrapped<THullSyncFullActor>; void Serialize(const TActorContext &ctx, - TString *buf, + TString *buf, const TKeyLogoBlob &key, const TMemRecLogoBlob &memRec) { Y_UNUSED(ctx); @@ -64,7 +64,7 @@ namespace NKikimr { } void Serialize(const TActorContext &ctx, - TString *buf, + TString *buf, const TKeyBlock &key, const TMemRecBlock &memRec) { Y_UNUSED(ctx); @@ -75,7 +75,7 @@ namespace NKikimr { } void Serialize(const TActorContext &ctx, - TString *buf, + TString *buf, const TKeyBarrier &key, const TMemRecBarrier &memRec) { Y_UNUSED(ctx); @@ -138,7 +138,7 @@ namespace NKikimr { TKey &key, const TFilter &filter) { // reserve some space for data - TString *data = Result->Record.MutableData(); + TString *data = Result->Record.MutableData(); if (data->capacity() < Config->MaxResponseSize) { data->reserve(Config->MaxResponseSize); } diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer.cpp index bf0179b4ed9..5fb7c65f0f3 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer.cpp @@ -66,9 +66,9 @@ namespace NKikimr { {} }; - using TQueueType = TDeque<TItemAndSeq>; + using TQueueType = TDeque<TItemAndSeq>; - TQueueType Queue; + TQueueType Queue; ui64 InFlySeqNum = 0; ui64 CommittedSeqNum = 0; }; @@ -82,20 +82,20 @@ namespace NKikimr { const TActorId ReplyId; const TActorId NotifyId; const TActorId SchedulerId; - const TString LogAndPhase; + const TString LogAndPhase; friend class TActorBootstrapped<TSyncerHttpInfoActor>; void Bootstrap(const TActorContext &ctx) { if (SchedulerId == TActorId()) { - RenderHtmlAndReply(ctx, TString()); + RenderHtmlAndReply(ctx, TString()); } else { Become(&TThis::StateFunc); ctx.Send(SchedulerId, Ev->Release().Release()); } } - void RenderHtmlAndReply(const TActorContext &ctx, const TString &schedulerInfo) { + void RenderHtmlAndReply(const TActorContext &ctx, const TString &schedulerInfo) { TStringStream str; str << "\n"; HTML(str) { @@ -139,7 +139,7 @@ namespace NKikimr { NMon::TEvHttpInfo::TPtr &ev, const TActorId ¬ifyId, const TActorId &schedulerId, - const TString &logAndPhase) + const TString &logAndPhase) : TActorBootstrapped<TSyncerHttpInfoActor>() , SyncerCtx(sc) , Ev(ev) diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_committer.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_committer.cpp index 0c394f24443..3b324a2e379 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_committer.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_committer.cpp @@ -84,7 +84,7 @@ namespace NKikimr { } } - TString Serialize() const { + TString Serialize() const { return Sds.Serialize(); } @@ -107,7 +107,7 @@ namespace NKikimr { , Cookie(cookie) {} }; - using TNotifyVec = TVector<TNotify>; + using TNotifyVec = TVector<TNotify>; TIntrusivePtr<TSyncerContext> SyncerCtx; const TDuration AdvanceEntryPointTimeout; @@ -134,7 +134,7 @@ namespace NKikimr { // commit NPDisk::TCommitRecord commitRec; commitRec.IsStartingPoint = true; - TString data = State.Serialize(); + TString data = State.Serialize(); size_t dataSize = data.size(); TLsnSeg seg = SyncerCtx->LsnMngr->AllocLsnForLocalUse(); auto msg = std::make_unique<NPDisk::TEvLog>(SyncerCtx->PDiskCtx->Dsk->Owner, diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.cpp index 4de7b60fbe8..88083d5633e 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.cpp @@ -53,12 +53,12 @@ namespace NKikimr { void TPeerSyncState::Parse(const NKikimrVDiskData::TSyncerVDiskEntry &pb) { LastSyncStatus = pb.GetLastSyncStatus(); SyncState = SyncStateFromSyncState(pb.GetSyncState()); - SchTime = TInstant::MicroSeconds(pb.GetSchTime()); - LastTry = TInstant::MicroSeconds(pb.GetLastTry()); - LastGood = TInstant::MicroSeconds(pb.GetLastGood()); + SchTime = TInstant::MicroSeconds(pb.GetSchTime()); + LastTry = TInstant::MicroSeconds(pb.GetLastTry()); + LastGood = TInstant::MicroSeconds(pb.GetLastGood()); } - TString TPeerSyncState::ToString() const { + TString TPeerSyncState::ToString() const { TStringStream str; str << "{" << "LastSyncStatus# " << LastSyncStatus << " SyncState# " << SyncState.ToString() @@ -101,7 +101,7 @@ namespace NKikimr { Info = pb.GetSyncGuidInfo(); } - TString TPeerGuidInfo::ToString() const { + TString TPeerGuidInfo::ToString() const { TStringStream str; str << "{Guid#" << Info.GetGuid() << " State# " << Info.GetState() << "}"; return str.Str(); @@ -144,7 +144,7 @@ namespace NKikimr { PeerGuidInfo.Parse(pb); } - TString TPeer::ToString() const { + TString TPeer::ToString() const { TStringStream str; str << "{SyncState# " << PeerSyncState.ToString() << " GuidInfo# " << PeerGuidInfo.ToString() << "}"; @@ -161,7 +161,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TSyncNeighbors //////////////////////////////////////////////////////////////////////////// - TSyncNeighbors::TSyncNeighbors(const TString &logPrefix, + TSyncNeighbors::TSyncNeighbors(const TString &logPrefix, const TActorId ¬ifyId, const TVDiskIdShort &self, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top) @@ -191,7 +191,7 @@ namespace NKikimr { Neighbors.GenericParse(des); } - void TSyncNeighbors::OldParse(const TString &data) { + void TSyncNeighbors::OldParse(const TString &data) { Y_VERIFY(!data.empty()); TStringInput str(data); OldParse(str); @@ -202,7 +202,7 @@ namespace NKikimr { Neighbors.GenericParse(des); } - void TSyncNeighbors::Parse(const TString &data) { + void TSyncNeighbors::Parse(const TString &data) { Y_VERIFY(!data.empty()); TStringInput str(data); Parse(str); @@ -236,7 +236,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TSyncerDataSerializer //////////////////////////////////////////////////////////////////////////// - TString TSyncerDataSerializer::Serialize() const { + TString TSyncerDataSerializer::Serialize() const { // Data Format: // data ::= [Signature=4b] TSyncerEntryPoint_Serialized @@ -256,13 +256,13 @@ namespace NKikimr { LocalSyncerState.Serialize(s.Proto.MutableLocalGuidInfo()); } - TString TSyncerData::Serialize(const TBlobStorageGroupInfo *info) const { + TString TSyncerData::Serialize(const TBlobStorageGroupInfo *info) const { TSyncerDataSerializer s; Serialize(s, info); return s.Serialize(); } - void TSyncerData::ParseWOSignature(const TString &serProto) { + void TSyncerData::ParseWOSignature(const TString &serProto) { if (!serProto.empty()) { NKikimrVDiskData::TSyncerEntryPoint proto; auto status = proto.ParseFromString(serProto); @@ -273,7 +273,7 @@ namespace NKikimr { } // check and cut signature - TString TSyncerData::WithoutSignature(const TString &entryPoint) { + TString TSyncerData::WithoutSignature(const TString &entryPoint) { if (entryPoint.empty()) { return entryPoint; } else { @@ -287,11 +287,11 @@ namespace NKikimr { } } - TSyncerData::TSyncerData(const TString &logPrefix, + TSyncerData::TSyncerData(const TString &logPrefix, const TActorId ¬ifyId, const TVDiskIdShort &selfVDisk, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top, - const TString &entryPoint) + const TString &entryPoint) : Neighbors(MakeIntrusive<TSyncNeighbors>(logPrefix, notifyId, selfVDisk, @@ -299,18 +299,18 @@ namespace NKikimr { , LocalSyncerState() , NotifyId(notifyId) { - TString serProto = WithoutSignature(Convert(selfVDisk, top, entryPoint)); + TString serProto = WithoutSignature(Convert(selfVDisk, top, entryPoint)); ParseWOSignature(serProto); } - bool TSyncerData::CheckEntryPoint(const TString &logPrefix, + bool TSyncerData::CheckEntryPoint(const TString &logPrefix, const TActorId ¬ifyId, const TVDiskIdShort &selfVDisk, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top, - const TString &entryPoint) { + const TString &entryPoint) { try { TSyncerData n(logPrefix, notifyId, selfVDisk, top); - TString serProto = WithoutSignature(Convert(selfVDisk, top, entryPoint)); + TString serProto = WithoutSignature(Convert(selfVDisk, top, entryPoint)); n.ParseWOSignature(serProto); } catch (yexception) { return false; @@ -320,9 +320,9 @@ namespace NKikimr { // Convert from old entry point format to protobuf format // TODO: we can remove this function after migrating to the protobuf format - TString TSyncerData::Convert(const TVDiskIdShort &selfVDisk, + TString TSyncerData::Convert(const TVDiskIdShort &selfVDisk, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top, - const TString &entryPoint) { + const TString &entryPoint) { if (entryPoint.empty()) { return entryPoint; } else { diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.h b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.h index c623859a60c..7e537fa67e3 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.h +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data.h @@ -54,7 +54,7 @@ namespace NKikimr { void ParseFromArcadiaStream(IInputStream &str); void Serialize(NKikimrVDiskData::TSyncerVDiskEntry &pb) const; void Parse(const NKikimrVDiskData::TSyncerVDiskEntry &pb); - TString ToString() const; + TString ToString() const; void OutputHtml(IOutputStream &str) const; static bool Good(ESyncStatus status) { @@ -73,7 +73,7 @@ namespace NKikimr { void Serialize(NKikimrVDiskData::TSyncerVDiskEntry &pb) const; void Parse(const NKikimrVDiskData::TSyncerVDiskEntry &pb); - TString ToString() const; + TString ToString() const; void OutputHtml(IOutputStream &str) const; }; @@ -91,7 +91,7 @@ namespace NKikimr { void ParseFromArcadiaStream(IInputStream &str); void Serialize(NKikimrVDiskData::TSyncerVDiskEntry &pb) const; void Parse(const NKikimrVDiskData::TSyncerVDiskEntry &pb); - TString ToString() const; + TString ToString() const; void OutputHtml(IOutputStream &str) const; }; @@ -115,13 +115,13 @@ namespace NKikimr { ui64 DbBirthLsn = 0; // FIXME: remove after switching to the new sync private: - const TString LogPrefix; + const TString LogPrefix; const TActorId NotifyId; TNeighbors Neighbors; NSync::TQuorumTracker QuorumTracker; public: - TSyncNeighbors(const TString &logPrefix, + TSyncNeighbors(const TString &logPrefix, const TActorId ¬ifyId, const TVDiskIdShort &self, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top); @@ -136,8 +136,8 @@ namespace NKikimr { template <class TPrinter> void OutputHtml(IOutputStream &str, TPrinter &printer, - const TString &name, - const TString &divClass) const { + const TString &name, + const TString &divClass) const { Neighbors.OutputHtml<TPrinter>(str, printer, name, divClass); } @@ -152,11 +152,11 @@ namespace NKikimr { class TDes; void OldSerialize(IOutputStream &str, const TBlobStorageGroupInfo *info) const; void OldParse(IInputStream &str); - void OldParse(const TString &data); + void OldParse(const TString &data); void Serialize(IOutputStream &str, const TBlobStorageGroupInfo *info) const; void Serialize(NKikimrVDiskData::TSyncerEntryPoint *pb, const TBlobStorageGroupInfo *info) const; void Parse(IInputStream &str); - void Parse(const TString &data); + void Parse(const TString &data); void Parse(const NKikimrVDiskData::TSyncerEntryPoint &pb); void ApplyChanges(const TActorContext &ctx, const NSyncer::TSyncerJobTask *task, @@ -178,7 +178,7 @@ namespace NKikimr { public: friend struct TSyncerData; friend class TProtoState; - TString Serialize() const; + TString Serialize() const; }; @@ -190,33 +190,33 @@ namespace NKikimr { NSyncer::TLocalSyncerState LocalSyncerState; const TActorId NotifyId; - TSyncerData(const TString &logPrefix, + TSyncerData(const TString &logPrefix, const TActorId ¬ifyId, const TVDiskIdShort &selfVDisk, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top, - const TString &entryPoint = TString()); + const TString &entryPoint = TString()); // we call this func during local recovery to apply last changes from recovery log // FIXME: looks like we MUST NOT call this function!!!!!!!!!!!!!!!!!!!!!!!! void PutFromRecoveryLog(const TVDiskIdShort &vdisk, const TSyncState &syncState); - TString Serialize(const TBlobStorageGroupInfo *info) const; + TString Serialize(const TBlobStorageGroupInfo *info) const; void Serialize(TSyncerDataSerializer &s, const TBlobStorageGroupInfo *info) const; // check and cut signature - static TString WithoutSignature(const TString &entryPoint); - static bool CheckEntryPoint(const TString &logPrefix, + static TString WithoutSignature(const TString &entryPoint); + static bool CheckEntryPoint(const TString &logPrefix, const TActorId ¬ifyId, const TVDiskIdShort &selfVDisk, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top, - const TString &entryPoint); + const TString &entryPoint); // Convert from old entry point format to protobuf format // TODO: we can remove this function after migrating to the protobuf format - static TString Convert(const TVDiskIdShort &selfVDisk, + static TString Convert(const TVDiskIdShort &selfVDisk, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top, - const TString &entryPoint); + const TString &entryPoint); private: - void ParseWOSignature(const TString &serProto); + void ParseWOSignature(const TString &serProto); }; } // NKikimr diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data_ut.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data_ut.cpp index 0da0c427ee3..3c2e9073d7b 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data_ut.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_data_ut.cpp @@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(TSyncNeighborsTests) { TSyncNeighbors n("Prefix", TActorId(), self, info->PickTopology()); ui64 i = 123456u; for (auto &x: n) { - x.Get().PeerSyncState.SchTime = TInstant::MicroSeconds(++i); + x.Get().PeerSyncState.SchTime = TInstant::MicroSeconds(++i); } // old serialize/parse @@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(TSyncNeighborsTests) { n2.OldParse(output.Str()); i = 123456u; for (const auto &x: n2) { - UNIT_ASSERT_VALUES_EQUAL(x.Get().PeerSyncState.SchTime, TInstant::MicroSeconds(++i)); + UNIT_ASSERT_VALUES_EQUAL(x.Get().PeerSyncState.SchTime, TInstant::MicroSeconds(++i)); } } @@ -43,7 +43,7 @@ Y_UNIT_TEST_SUITE(TSyncNeighborsTests) { n3.Parse(output.Str()); i = 123456u; for (const auto &x: n3) { - UNIT_ASSERT_VALUES_EQUAL(x.Get().PeerSyncState.SchTime, TInstant::MicroSeconds(++i)); + UNIT_ASSERT_VALUES_EQUAL(x.Get().PeerSyncState.SchTime, TInstant::MicroSeconds(++i)); } } } diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_scheduler.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_scheduler.cpp index 92ae94e89f7..fc643d08ee7 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_scheduler.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncer_scheduler.cpp @@ -196,7 +196,7 @@ namespace NKikimr { } }; - using TSchedulerQueue = TPriorityQueue<TVDiskInfoPtr, TVector<TVDiskInfoPtr>, TGreater>; + using TSchedulerQueue = TPriorityQueue<TVDiskInfoPtr, TVector<TVDiskInfoPtr>, TGreater>; TIntrusivePtr<TSyncerContext> SyncerContext; TIntrusivePtr<TBlobStorageGroupInfo> GInfo; diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncquorum.h b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncquorum.h index 5d53a289ce0..0e162dd26d7 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncquorum.h +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncquorum.h @@ -12,7 +12,7 @@ namespace NKikimr { ++Map[vdisk]; } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Map: "; for (const auto &x : Map) { @@ -27,7 +27,7 @@ namespace NKikimr { } private: - THashMap<TVDiskIdShort, unsigned> Map; + THashMap<TVDiskIdShort, unsigned> Map; }; /////////////////////////////////////////////////////////////////////////// @@ -68,7 +68,7 @@ namespace NKikimr { str << "{Debug# " << Debug.ToString() << "}"; } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncquorum_ut.cpp b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncquorum_ut.cpp index 78e25633ab3..65172e6a2dd 100644 --- a/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncquorum_ut.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/blobstorage_syncquorum_ut.cpp @@ -11,8 +11,8 @@ namespace NKikimr { Y_UNIT_TEST_SUITE(TQuorumTrackerTests) { - TVector<TVDiskID> GetDisks(TBlobStorageGroupInfo *groupInfo) { - TVector<TVDiskID> vdisks; + TVector<TVDiskID> GetDisks(TBlobStorageGroupInfo *groupInfo) { + TVector<TVDiskID> vdisks; for (const auto &x : groupInfo->GetVDisks()) { auto vd = groupInfo->GetVDiskId(x.OrderNumber); vdisks.push_back(vd); @@ -21,8 +21,8 @@ namespace NKikimr { } void Check(TQuorumTracker tracker, // quorum tracker - const TVector<TVDiskID> &vdisks, // array of vdisks - const TVector<int> ¬YetQuorum, // array of vdisks pos to apply before achieving quorum + const TVector<TVDiskID> &vdisks, // array of vdisks + const TVector<int> ¬YetQuorum, // array of vdisks pos to apply before achieving quorum int q) // last vdisk pos that leads to quorum { for (const auto &x : notYetQuorum) { @@ -89,7 +89,7 @@ namespace NKikimr { const TVDiskID& self = vdisks[0]; TQuorumTracker tracker(self, groupInfo.PickTopology(), true); - TVector<int> notYetQuorum = {0, 1, 2, 3, 4, 7}; + TVector<int> notYetQuorum = {0, 1, 2, 3, 4, 7}; Check(tracker, vdisks, notYetQuorum, 6); } @@ -99,7 +99,7 @@ namespace NKikimr { const TVDiskID& self = vdisks[0]; TQuorumTracker tracker(self, groupInfo.PickTopology(), true); - TVector<int> notYetQuorum = {0, 1, 3, 4, 5, 6, 8, 9}; + TVector<int> notYetQuorum = {0, 1, 3, 4, 5, 6, 8, 9}; Check(tracker, vdisks, notYetQuorum, 2); } } diff --git a/ydb/core/blobstorage/vdisk/syncer/guid_proxyobtain.h b/ydb/core/blobstorage/vdisk/syncer/guid_proxyobtain.h index 6ee396c2850..71b9f61378f 100644 --- a/ydb/core/blobstorage/vdisk/syncer/guid_proxyobtain.h +++ b/ydb/core/blobstorage/vdisk/syncer/guid_proxyobtain.h @@ -33,7 +33,7 @@ namespace NKikimr { Y_VERIFY(!(State == TSyncVal::Final && Guid == TVDiskEternalGuid())); } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/syncer/guid_proxywrite.h b/ydb/core/blobstorage/vdisk/syncer/guid_proxywrite.h index 7396bcceb41..4dc5c595f39 100644 --- a/ydb/core/blobstorage/vdisk/syncer/guid_proxywrite.h +++ b/ydb/core/blobstorage/vdisk/syncer/guid_proxywrite.h @@ -32,7 +32,7 @@ namespace NKikimr { Y_VERIFY(!(State == TSyncVal::Final && Guid == TVDiskEternalGuid())); } - TString ToString() const { + TString ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/syncer/guid_recovery.cpp b/ydb/core/blobstorage/vdisk/syncer/guid_recovery.cpp index d4dc97f9aba..247856ee7e4 100644 --- a/ydb/core/blobstorage/vdisk/syncer/guid_recovery.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/guid_recovery.cpp @@ -114,7 +114,7 @@ namespace NKikimr { TDecision::TDecision(EDecision d, EFirstRunStep f, TVDiskEternalGuid guid, - const TString &e, + const TString &e, bool a) : Decision(d) , FirstRunStep(f) @@ -124,33 +124,33 @@ namespace NKikimr { {} TDecision TDecision::FirstRun(EFirstRunStep step, TVDiskEternalGuid guid) { - return TDecision(EDecision::FirstRun, step, guid, TString(), false); + return TDecision(EDecision::FirstRun, step, guid, TString(), false); } - TDecision TDecision::Inconsistency(const TString &expl) { + TDecision TDecision::Inconsistency(const TString &expl) { return TDecision(EDecision::Inconsistency, EFirstRunStep::STATE__Terminated, 0, expl, false); } TDecision TDecision::LostData(TVDiskEternalGuid guid, bool subsequentFailure) { return TDecision(EDecision::LostData, EFirstRunStep::STATE__Terminated, - guid, TString(), subsequentFailure); + guid, TString(), subsequentFailure); } TDecision TDecision::LostData(EFirstRunStep step, TVDiskEternalGuid guid, bool subsequentFailure) { - return TDecision(EDecision::LostData, step, guid, TString(), subsequentFailure); + return TDecision(EDecision::LostData, step, guid, TString(), subsequentFailure); } TDecision TDecision::Good(TVDiskEternalGuid guid) { return TDecision(EDecision::Good, EFirstRunStep::STATE__Terminated, - guid, TString(), false); + guid, TString(), false); } // We got Good decision, but need to pass additional step of FirstRun phase TDecision TDecision::Good(EFirstRunStep step, TVDiskEternalGuid guid) { - return TDecision(EDecision::Good, step, guid, TString(), false); + return TDecision(EDecision::Good, step, guid, TString(), false); } void TDecision::Output(IOutputStream &str) const { @@ -173,7 +173,7 @@ namespace NKikimr { str << "]"; } - TString TDecision::ToString() const { + TString TDecision::ToString() const { TStringStream str; Output(str); return str.Str(); @@ -195,7 +195,7 @@ namespace NKikimr { str << "]"; } - TString TOutcome::ToString() const { + TString TOutcome::ToString() const { TStringStream str; Output(str); return str.Str(); @@ -248,14 +248,14 @@ namespace NKikimr { const ESyncState State = TSyncVal::Empty; const TVDiskEternalGuid Guid = 0; const EFirstRunStep FirstRunStep = EFirstRunStep::STATE__Uninitialized; - const TString Explanation; + const TString Explanation; private: TVDiskQuorumDecision(bool i, ESyncState s, TVDiskEternalGuid guid, EFirstRunStep f, - const TString &e) + const TString &e) : IsInconsistent(i) , State(s) , Guid(guid) @@ -264,7 +264,7 @@ namespace NKikimr { {} public: - static TVDiskQuorumDecision Inconsistent(const TString &exp) { + static TVDiskQuorumDecision Inconsistent(const TString &exp) { return TVDiskQuorumDecision(true, TSyncVal::Empty, 0, EFirstRunStep::STATE__Uninitialized, exp); } @@ -394,8 +394,8 @@ namespace NKikimr { // analyze obtained results // via finalQuorum we calculate if we got quorum of fail domains of Final State TQuorumTracker finalQuorum(Self, Top, true); // include my faildomain - TMap<TVDiskEternalGuid, ui32> finalGuidMap; // Guid -> HowManyVDisksHasThisGuid - TMap<TVDiskEternalGuid, ui32> inProgressGuidMap; // Guid -> HowManyVDisksHasThisGuid + TMap<TVDiskEternalGuid, ui32> finalGuidMap; // Guid -> HowManyVDisksHasThisGuid + TMap<TVDiskEternalGuid, ui32> inProgressGuidMap; // Guid -> HowManyVDisksHasThisGuid ui32 emptyCounter = 0; ui32 noAnswer = 0; for (const auto &x : Neighbors) { diff --git a/ydb/core/blobstorage/vdisk/syncer/guid_recovery.h b/ydb/core/blobstorage/vdisk/syncer/guid_recovery.h index 1b3be5a03a9..86a9ec384ea 100644 --- a/ydb/core/blobstorage/vdisk/syncer/guid_recovery.h +++ b/ydb/core/blobstorage/vdisk/syncer/guid_recovery.h @@ -46,7 +46,7 @@ namespace NKikimr { // recovered guid TVDiskEternalGuid Guid; // human readable explanation for inconsistency - TString Explanation; + TString Explanation; // for FirstRun: // we can detect data loss: AddInfo means LostData // for LostData: @@ -57,7 +57,7 @@ namespace NKikimr { TDecision(EDecision d, EFirstRunStep f, TVDiskEternalGuid guid, - const TString &e, + const TString &e, bool a); public: @@ -69,7 +69,7 @@ namespace NKikimr { ~TDecision() = default; static TDecision FirstRun(EFirstRunStep step, TVDiskEternalGuid guid); - static TDecision Inconsistency(const TString &expl); + static TDecision Inconsistency(const TString &expl); static TDecision LostData(TVDiskEternalGuid guid, bool subsequentFailure); static TDecision LostData(EFirstRunStep step, TVDiskEternalGuid guid, @@ -77,11 +77,11 @@ namespace NKikimr { static TDecision Good(TVDiskEternalGuid guid); static TDecision Good(EFirstRunStep step, TVDiskEternalGuid guid); void Output(IOutputStream &str) const; - TString ToString() const; + TString ToString() const; EDecision GetDecision() const { return Decision; } TVDiskEternalGuid GetGuid() const { return Guid; } EFirstRunStep GetFirstRunStep() const; - TString GetExplanation() const { return Explanation; } + TString GetExplanation() const { return Explanation; } bool BadDecision() const { return IsBad(Decision); } }; @@ -93,7 +93,7 @@ namespace NKikimr { struct TOutcome { const EDecision Decision; const TVDiskEternalGuid Guid; - const TString Explanation; + const TString Explanation; TOutcome(const TDecision &d) : Decision(d.GetDecision()) @@ -114,7 +114,7 @@ namespace NKikimr { ~TOutcome() = default; bool BadDecision() const { return IsBad(Decision); } void Output(IOutputStream &str) const; - TString ToString() const; + TString ToString() const; }; } // NSyncer diff --git a/ydb/core/blobstorage/vdisk/syncer/syncer_job_actor.cpp b/ydb/core/blobstorage/vdisk/syncer/syncer_job_actor.cpp index c1a1629bf11..ad0b1dcfae3 100644 --- a/ydb/core/blobstorage/vdisk/syncer/syncer_job_actor.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/syncer_job_actor.cpp @@ -137,7 +137,7 @@ namespace NKikimr { } // use it for debug purposes - void HeavyDump(const TActorContext &ctx, const TString &data) const { + void HeavyDump(const TActorContext &ctx, const TString &data) const { // record handlers auto blobHandler = [&] (const NSyncLog::TLogoBlobRec *rec) { LOG_ERROR(ctx, BS_SYNCER, diff --git a/ydb/core/blobstorage/vdisk/syncer/syncer_job_task.cpp b/ydb/core/blobstorage/vdisk/syncer/syncer_job_task.cpp index de98610b833..5aac51cb6c5 100644 --- a/ydb/core/blobstorage/vdisk/syncer/syncer_job_task.cpp +++ b/ydb/core/blobstorage/vdisk/syncer/syncer_job_task.cpp @@ -89,7 +89,7 @@ namespace NKikimr { bool TSyncerJobTask::CheckFragmentFormat(const TString &data) { NSyncLog::TFragmentReader fragment(data); - TString errorString; + TString errorString; bool good = fragment.Check(errorString); if (!good) { Ctx->SyncerCtx->VCtx->Logger(NActors::NLog::PRI_ERROR, BS_SYNCER, @@ -179,7 +179,7 @@ namespace NKikimr { const TActorId &parentId) { const NKikimrBlobStorage::TEvVSyncResult &record = ev->Get()->Record; - const TString &data = record.GetData(); + const TString &data = record.GetData(); if (!CheckFragmentFormat(data)) { return ReplyAndDie(TSyncStatusVal::ProtocolError); } @@ -300,7 +300,7 @@ namespace NKikimr { const TActorId &parentId) { const NKikimrBlobStorage::TEvVSyncFullResult &record = ev->Get()->Record; - const TString &data = record.GetData(); + const TString &data = record.GetData(); if (!CheckFragmentFormat(data)) { return ReplyAndDie(TSyncStatusVal::ProtocolError); } diff --git a/ydb/core/blobstorage/vdisk/syncer/syncer_job_task.h b/ydb/core/blobstorage/vdisk/syncer/syncer_job_task.h index 9d6d0870092..e08909469d8 100644 --- a/ydb/core/blobstorage/vdisk/syncer/syncer_job_task.h +++ b/ydb/core/blobstorage/vdisk/syncer/syncer_job_task.h @@ -135,7 +135,7 @@ namespace NKikimr { const NSyncer::TPeerSyncState &peerState, const std::shared_ptr<TSjCtx> &ctx); void Output(IOutputStream &str) const; - TString ToString() const; + TString ToString() const; TSjOutcome NextRequest(); TSjOutcome Handle(TEvBlobStorage::TEvVSyncResult::TPtr &ev, const TActorId &parentId); TSjOutcome Handle(TEvBlobStorage::TEvVSyncFullResult::TPtr &ev, const TActorId &parentId); @@ -160,7 +160,7 @@ namespace NKikimr { // Private functions //////////////////////////////////////////////////////////////////////// void HandleStatusFlags(const NKikimrBlobStorage::TEvVSyncResult &record); - bool CheckFragmentFormat(const TString &data); + bool CheckFragmentFormat(const TString &data); void PrepareToFullRecovery(const TSyncState &syncState); TSjOutcome ContinueInFullRecoveryMode(); TSjOutcome ReplyAndDie(ESyncStatus status); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.cpp index c58468bd599..31eadacc191 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.cpp @@ -101,7 +101,7 @@ namespace NKikimr { e->LastDiskLsn = (e->DiskLogEmpty ? 0 : DiskSnapPtr->GetLastLsn()); } - TString TSyncLogSnapshot::BoundariesToString() const { + TString TSyncLogSnapshot::BoundariesToString() const { return Sprintf("{LogStartLsn: %" PRIu64 " %s %s}", LogStartLsn, MemSnapPtr->BoundariesToString().data(), DiskSnapPtr->BoundariesToString().data()); } @@ -260,7 +260,7 @@ namespace NKikimr { return LastEntryPointDbgInfo; } - TString TSyncLog::BoundariesToString() const { + TString TSyncLog::BoundariesToString() const { return Sprintf("{LogStartLsn: %" PRIu64 " LastLsnOfIndexRecord: %" PRIu64 " %s %s}", LogStartLsn, LastLsnOfIndexRecord, MemRecLog.BoundariesToString().data(), DiskRecLog.BoundariesToString().data()); @@ -389,7 +389,7 @@ namespace NKikimr { return DiskRecLog.ChunkSize; } - void TSyncLog::GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void TSyncLog::GetOwnedChunks(TSet<TChunkIdx>& chunks) const { DiskRecLog.GetOwnedChunks(chunks); } diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.h index 15ee59bfe46..1b96fab36ee 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdata.h @@ -94,7 +94,7 @@ namespace NKikimr { class TSyncLogSnapshot : public TThrRefBase { public: void FillInLogEssence(TLogEssence *e) const; - TString BoundariesToString() const; + TString BoundariesToString() const; void CheckSnapshotConsistency() const; // returns number of index records ui32 SerializeToProto(NKikimrVDiskData::TSyncLogEntryPoint &pb, const TDeltaToDiskRecLog &delta); @@ -174,7 +174,7 @@ namespace NKikimr { TString FirstLsnToKeepDecomposed() const; // just a reference to last entry point dbg info const TEntryPointDbgInfo &GetLastEntryPointDbgInfo() const; - TString BoundariesToString() const; + TString BoundariesToString() const; // create snaphsot of SyncLog (can be worked with asynchronously) TSyncLogSnapshotPtr GetSnapshot() const; // check that MemRecLog and DiskRecLog don't intersect by lsns, @@ -236,7 +236,7 @@ namespace NKikimr { // size of the chunk ui32 GetChunkSize() const; // returns chunks owned by DiskRecLog - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; private: // part of the log on disk diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk.cpp index 1a2fb95e1c5..e0f90e87a74 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk.cpp @@ -31,7 +31,7 @@ namespace NKikimr { } TDeltaToDiskRecLog &TDeltaToDiskRecLog::Append(ui32 chunkIdx, - const TVector<TSyncLogPageSnap> &pages) { + const TVector<TSyncLogPageSnap> &pages) { Y_VERIFY(AllAppends.empty() || AllAppends.back().ChunkIdx != chunkIdx); AllAppends.emplace_back(chunkIdx, pages); return *this; @@ -61,7 +61,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TOneChunkIndex //////////////////////////////////////////////////////////////////////////// - void TOneChunkIndex::UpdateIndex(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk) { + void TOneChunkIndex::UpdateIndex(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk) { Y_VERIFY_DEBUG(!Index.empty() && !pages.empty()); TSyncLogPageSnap firstPage = pages.front(); ui64 firstPageFirstLsn = firstPage.GetFirstLsn(); @@ -86,7 +86,7 @@ namespace NKikimr { AppendPages(pages, indexBulk, freePagePos); } - void TOneChunkIndex::AppendPages(const TVector<TSyncLogPageSnap> &pages, + void TOneChunkIndex::AppendPages(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk, ui32 freePagePos) { ui32 s = pages.size(); @@ -243,7 +243,7 @@ namespace NKikimr { } } - TString TDiskRecLogSnapshot::BoundariesToString() const { + TString TDiskRecLogSnapshot::BoundariesToString() const { if (Empty()) return Sprintf("{Dsk: empty}"); else @@ -368,7 +368,7 @@ namespace NKikimr { // force to delete nchunks (if we don't have space for instance) ui64 TDiskRecLog::DeleteChunks(ui32 nchunks, std::shared_ptr<IActorNotify> notifier, - TVector<ui32> &chunks) { + TVector<ui32> &chunks) { auto m = Guard(Lock); const ui32 curChunks = ManyIdxChunks.size(); const ui32 numChunksToDelete = Min(nchunks, curChunks); @@ -386,7 +386,7 @@ namespace NKikimr { return newLogStartLsn; } - void TDiskRecLog::UpdateIndex(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages) { + void TDiskRecLog::UpdateIndex(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages) { auto m = Guard(Lock); PrivateUpdateIndex(chunkIdx, pages); } @@ -435,7 +435,7 @@ namespace NKikimr { return (pos == end); } - TString TDiskRecLog::BoundariesToString() const { + TString TDiskRecLog::BoundariesToString() const { auto m = Guard(Lock); if (PrivateEmpty()) return Sprintf("{Dsk: empty}"); @@ -443,7 +443,7 @@ namespace NKikimr { return Sprintf("{Dsk: [%" PRIu64 ", %" PRIu64 "]}", PrivateGetFirstLsn(), PrivateGetLastLsn()); } - TString TDiskRecLog::ToString() const { + TString TDiskRecLog::ToString() const { auto m = Guard(Lock); TStringStream s; if (PrivateEmpty()) @@ -461,7 +461,7 @@ namespace NKikimr { return s.Str(); } - void TDiskRecLog::GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void TDiskRecLog::GetOwnedChunks(TSet<TChunkIdx>& chunks) const { for (const TIndexedChunkPtr& chunk : ManyIdxChunks) { chunk->GetOwnedChunks(chunks); } @@ -510,7 +510,7 @@ namespace NKikimr { } void TDiskRecLog::PrivateUpdateIndex(ui32 chunkIdx, - const TVector<TSyncLogPageSnap> &pages) { + const TVector<TSyncLogPageSnap> &pages) { if (!PrivateEmpty() && PrivateLastChunkIdx() == chunkIdx) { // update last chunk Y_VERIFY_DEBUG(pages.size() <= PrivateLastChunkFreePagesNum()); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk.h index f6b8a3abaaf..77c73af6a91 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk.h @@ -46,18 +46,18 @@ namespace NKikimr { } }; - TString ToString() const { + TString ToString() const { return Sprintf("{FirstLsn# %" PRIu64 " OffsInPages# %" PRIu32 " PagesNum# %" PRIu32 "}", FirstLsn, OffsetInPages, PagesNum); } - TString ToShortString() const { + TString ToShortString() const { return Sprintf("{%" PRIu64 " %" PRIu32 " %" PRIu32 "}", FirstLsn, OffsetInPages, PagesNum); } }; #pragma pack(pop) - typedef TVector<TDiskIndexRecord> TDiskIndexRecs; + typedef TVector<TDiskIndexRecord> TDiskIndexRecs; //////////////////////////////////////////////////////////////////////////// @@ -69,7 +69,7 @@ namespace NKikimr { struct TDeltaToDiskRecLog { // One write (append) we make to the chunk when swaping mem data to disk struct TOneAppend { - TOneAppend(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages) + TOneAppend(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages) : ChunkIdx(chunkIdx) , Pages(pages) {} @@ -78,11 +78,11 @@ namespace NKikimr { void Output(IOutputStream &str) const; ui32 ChunkIdx = 0; - TVector<TSyncLogPageSnap> Pages; + TVector<TSyncLogPageSnap> Pages; }; const ui32 IndexBulk; - TVector<TOneAppend> AllAppends; + TVector<TOneAppend> AllAppends; TDeltaToDiskRecLog(ui32 indexBulk) : IndexBulk(indexBulk) @@ -128,11 +128,11 @@ namespace NKikimr { Serialize(s); } - TString ToString() const { + TString ToString() const { return Sprintf("%" PRIu32, ChunkIdx); } - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { const bool inserted = chunks.insert(ChunkIdx).second; Y_VERIFY(inserted); } @@ -152,7 +152,7 @@ namespace NKikimr { class TOneChunkIndex : public TThrRefBase { public: - TOneChunkIndex(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk) { + TOneChunkIndex(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk) { AppendPages(pages, indexBulk, 0); } @@ -177,7 +177,7 @@ namespace NKikimr { } } - TString ToString() const { + TString ToString() const { TStringStream s; s << "{"; for (const auto &rec: Index) { @@ -191,7 +191,7 @@ namespace NKikimr { return new TOneChunkIndex(*this); } - void UpdateIndex(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk); + void UpdateIndex(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk); void OutputHtml(IOutputStream &str) const; // returns number of index records ui32 Serialize(IOutputStream &s) const; @@ -208,7 +208,7 @@ namespace NKikimr { TOneChunkIndex(const TOneChunkIndex &) = default; TOneChunkIndex(ui64 lastRealLsn, TDiskIndexRecs &index); - void AppendPages(const TVector<TSyncLogPageSnap> &pages, + void AppendPages(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk, ui32 freePagePos); }; @@ -293,7 +293,7 @@ namespace NKikimr { class TIndexedChunk : public TThrRefBase { public: - TIndexedChunk(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk) + TIndexedChunk(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk) : ChunkPtr(new TOneChunk(chunkIdx)) , IndexPtr(new TOneChunkIndex(pages, indexBulk)) {} @@ -323,7 +323,7 @@ namespace NKikimr { return IndexPtr->FreePagePos(); } - void UpdateIndex(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk) { + void UpdateIndex(const TVector<TSyncLogPageSnap> &pages, ui32 indexBulk) { IndexPtr->UpdateIndex(pages, indexBulk); } @@ -346,13 +346,13 @@ namespace NKikimr { void OutputHtml(IOutputStream &str) const; static std::pair<TIndexedChunkPtr, const char *> Construct(const char *serialized); - TString ToString() const { + TString ToString() const { TStringStream s; s << "{" << ChunkPtr->ToString() << " " << IndexPtr->ToString() << "}"; return s.Str(); } - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const { ChunkPtr->GetOwnedChunks(chunks); } @@ -365,7 +365,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TManyIdxChunks //////////////////////////////////////////////////////////////////////////// - typedef TDeque<TIndexedChunkPtr> TManyIndexedChunks; + typedef TDeque<TIndexedChunkPtr> TManyIndexedChunks; //////////////////////////////////////////////////////////////////////////// // TDiskRecLogSnapshot @@ -387,7 +387,7 @@ namespace NKikimr { } void OutputHtml(IOutputStream &str) const; - TString BoundariesToString() const; + TString BoundariesToString() const; ui32 Serialize(IOutputStream &s, const TDeltaToDiskRecLog &delta) const; ui32 LastChunkIdx() const; ui32 LastChunkFreePagesNum() const; @@ -570,15 +570,15 @@ namespace NKikimr { // returns new LogStartLsn ui64 DeleteChunks(ui32 nchunks, std::shared_ptr<IActorNotify> notifier, - TVector<ui32> &chunks); - void UpdateIndex(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages); + TVector<ui32> &chunks); + void UpdateIndex(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages); void UpdateIndex(const TDeltaToDiskRecLog &delta); // returns number of index records ui32 Serialize(IOutputStream &s) const; static bool CheckEntryPoint(const char *beg, const char *end); - TString BoundariesToString() const; - TString ToString() const; - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; + TString BoundariesToString() const; + TString ToString() const; + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; // calculate how many chunks adds this memory snapshot to current state ui32 HowManyChunksAdds(const TMemRecLogSnapshotPtr &swapSnap) const; @@ -606,7 +606,7 @@ namespace NKikimr { Y_VERIFY_DEBUG(!PrivateEmpty()); return ManyIdxChunks.back()->GetLastLsn(); } - void PrivateUpdateIndex(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages); + void PrivateUpdateIndex(ui32 chunkIdx, const TVector<TSyncLogPageSnap> &pages); }; } // NSyncLog diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk_ut.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk_ut.cpp index 59d02b15f5f..7b74b37bb3e 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk_ut.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogdsk_ut.cpp @@ -112,7 +112,7 @@ namespace NKikimr { TFillIn1Context ctx {1, 1}; for (int i = 0; i < 5; i++) { TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; pages.push_back(page); TStringStream s; @@ -126,7 +126,7 @@ namespace NKikimr { uc.UpdateIndexWithCheck(dsk.get(), delta); } - TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 1} {FirstLsn# 21 OffsInPages# 1 PagesNum# 1} " + TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 1} {FirstLsn# 21 OffsInPages# 1 PagesNum# 1} " "{FirstLsn# 41 OffsInPages# 2 PagesNum# 1} {FirstLsn# 61 OffsInPages# 3 PagesNum# 1} " "{FirstLsn# 81 OffsInPages# 4 PagesNum# 1} LastRealLsn# 99}}"; UNIT_ASSERT(dsk->ToString() == result); @@ -156,7 +156,7 @@ namespace NKikimr { TFillIn1Context ctx {1, 1}; // add first portion { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; for (int i = 0; i < 5; i++) { TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); pages.push_back(page); @@ -172,13 +172,13 @@ namespace NKikimr { dsk.reset(new TDiskRecLog(chunkSize, pageSize, indexBulk, serialized.data(), serialized.data() + serialized.size())); } - TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 4} {FirstLsn# 81 OffsInPages# 4 PagesNum# 1} " + TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 4} {FirstLsn# 81 OffsInPages# 4 PagesNum# 1} " "LastRealLsn# 99}}"; UNIT_ASSERT(dsk->ToString() == result); // add second portion { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; for (int i = 0; i < 5; i++) { TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); pages.push_back(page); @@ -213,7 +213,7 @@ namespace NKikimr { TFillIn1Context ctx {1, 1}; for (int k = 0; k < 4; k++) { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; for (int i = 0; i < 2; i++) { TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); pages.push_back(page); @@ -229,7 +229,7 @@ namespace NKikimr { TString serialized = s.Str(); dsk.reset(new TDiskRecLog(chunkSize, pageSize, indexBulk, serialized.data(), serialized.data() + serialized.size())); } - TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 2} {FirstLsn# 41 OffsInPages# 2 PagesNum# 2} " + TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 2} {FirstLsn# 41 OffsInPages# 2 PagesNum# 2} " "LastRealLsn# 79}} {1 {{FirstLsn# 81 OffsInPages# 0 PagesNum# 2} " "{FirstLsn# 121 OffsInPages# 2 PagesNum# 2} LastRealLsn# 159}}"; UNIT_ASSERT(dsk->ToString() == result); @@ -247,7 +247,7 @@ namespace NKikimr { TFillIn1Context ctx {1, 1}; for (int i = 0; i < 2; i++) { TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; pages.push_back(page); // update @@ -264,7 +264,7 @@ namespace NKikimr { // create a page TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; pages.push_back(page); // update @@ -282,7 +282,7 @@ namespace NKikimr { // append to the page page = AppendToSyncLogPage(page, 4, pageSize, ctx); { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; pages.push_back(page); // update @@ -296,7 +296,7 @@ namespace NKikimr { dsk.reset(new TDiskRecLog(chunkSize, pageSize, indexBulk, serialized.data(), serialized.data() + serialized.size())); } - TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 1} {FirstLsn# 21 OffsInPages# 1 PagesNum# 1} " + TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 1} {FirstLsn# 21 OffsInPages# 1 PagesNum# 1} " "{FirstLsn# 41 OffsInPages# 3 PagesNum# 1} LastRealLsn# 67}}"; UNIT_ASSERT(dsk->ToString() == result); UNIT_ASSERT(dsk->LastChunkIdx() == 0); @@ -313,7 +313,7 @@ namespace NKikimr { TFillIn1Context ctx {1, 1}; for (int i = 0; i < 2; i++) { TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; pages.push_back(page); // update @@ -331,7 +331,7 @@ namespace NKikimr { TSyncLogPagePtr page0 = CreateSyncLogPage(10, pageSize, ctx); TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; pages.push_back(page0); pages.push_back(page); @@ -349,7 +349,7 @@ namespace NKikimr { // append to the page page = AppendToSyncLogPage(page, 4, pageSize, ctx); { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; pages.push_back(page); // update @@ -363,7 +363,7 @@ namespace NKikimr { dsk.reset(new TDiskRecLog(chunkSize, pageSize, indexBulk, serialized.data(), serialized.data() + serialized.size())); } - TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 1} {FirstLsn# 21 OffsInPages# 1 PagesNum# 1} " + TString result = "{0 {{FirstLsn# 1 OffsInPages# 0 PagesNum# 1} {FirstLsn# 21 OffsInPages# 1 PagesNum# 1} " "{FirstLsn# 41 OffsInPages# 2 PagesNum# 1} {FirstLsn# 61 OffsInPages# 4 PagesNum# 1} " "LastRealLsn# 87}}"; UNIT_ASSERT(dsk->ToString() == result); @@ -383,7 +383,7 @@ namespace NKikimr { TSyncLogPagePtr lastPage; { // CASE: start from empty dsk - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; for (int i = 0; i < 5; ++i) { lastPage = CreateSyncLogPage(10, pageSize, ctx); pages.push_back(lastPage); @@ -401,7 +401,7 @@ namespace NKikimr { // prepare delta TDeltaToDiskRecLog delta(indexBulk); - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; pages.push_back(lastPage); delta.Append(0, pages); // one more page @@ -425,7 +425,7 @@ namespace NKikimr { TFillIn1Context ctx {1, 1}; for (int k = 0; k < 8; k++) { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; for (int i = 0; i < 2; i++) { TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); pages.push_back(page); @@ -441,7 +441,7 @@ namespace NKikimr { dsk.reset(new TDiskRecLog(chunkSize, pageSize, indexBulk, serialized.data(), serialized.data() + serialized.size())); } - TVector<ui32> chunks; + TVector<ui32> chunks; ui32 num = 0; chunks.clear(); @@ -469,7 +469,7 @@ namespace NKikimr { TFillIn1Context ctx {1, 1}; for (int k = 0; k < 8; k++) { - TVector<TSyncLogPageSnap> pages; + TVector<TSyncLogPageSnap> pages; for (int i = 0; i < 2; i++) { TSyncLogPagePtr page = CreateSyncLogPage(10, pageSize, ctx); pages.push_back(page); @@ -485,7 +485,7 @@ namespace NKikimr { dsk.reset(new TDiskRecLog(chunkSize, pageSize, indexBulk, serialized.data(), serialized.data() + serialized.size())); } - TVector<ui32> chunks; + TVector<ui32> chunks; ui64 lsn = 0; chunks.clear(); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogformat.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogformat.cpp index 3648ac95b90..340f1ca1415 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogformat.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogformat.cpp @@ -132,7 +132,7 @@ namespace NKikimr { ui32 TSerializeRoutines::SetGC(const TBlobStorageGroupType >ype, char *buf, ui64 lsn, - const TDeque<TLogoBlobID>& phantoms) { + const TDeque<TLogoBlobID>& phantoms) { char *pos = buf; TIngress ingressDontKeep; @@ -144,7 +144,7 @@ namespace NKikimr { return pos - buf; } - bool TSerializeRoutines::CheckData(const TString &data, TString &errorString) { + bool TSerializeRoutines::CheckData(const TString &data, TString &errorString) { const TRecordHdr *begin = (const TRecordHdr *)(data.data()); const TRecordHdr *end = (const TRecordHdr *)(data.data() + data.size()); @@ -213,7 +213,7 @@ namespace NKikimr { void TSequenceOfRecs::SetGC(const TBlobStorageGroupType >ype, ui64 lsn, - const TDeque<TLogoBlobID>& phantoms) { + const TDeque<TLogoBlobID>& phantoms) { Y_VERIFY(Size == 0); size_t size = NSyncLog::MaxRecFullSize * phantoms.size(); HeapBuf.resize(size); @@ -230,7 +230,7 @@ namespace NKikimr { } } - TString TSequenceOfRecs::ToString() const { + TString TSequenceOfRecs::ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogformat.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogformat.h index 396c4e7a39a..37eb7676f23 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogformat.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogformat.h @@ -33,7 +33,7 @@ namespace NKikimr { return TLogoBlobID(Raw); } - TString ToString() const { + TString ToString() const { return Sprintf("[%s %" PRIu64 "]", LogoBlobID().ToString().data(), Ingress.Raw()); } }; @@ -47,7 +47,7 @@ namespace NKikimr { , Generation(gen) {} - TString ToString() const { + TString ToString() const { return Sprintf("[TabletId# %" PRIu64 " Generation# %" PRIu32 "]", TabletId, Generation); } }; @@ -93,7 +93,7 @@ namespace NKikimr { , Ingress(ingressRaw) {} - TString ToString() const { + TString ToString() const { return Sprintf("[TabletId# %" PRIu64 " Channel# %" PRIu32 " %s]", TabletId, Channel, Hard ? "hard" : "soft"); } }; @@ -159,11 +159,11 @@ namespace NKikimr { return (const TBlockRecV2 *)(this + 1); } - TString ToString() const { + TString ToString() const { return Sprintf("{Lsn# %" PRIu64 " Rec# %s %s}", Lsn, RecTypeToStr(RecType), ValueToString().data()); } - TString ValueToString() const { + TString ValueToString() const { switch (RecType) { case RecLogoBlob: return GetLogoBlob()->ToString(); case RecBlock: return GetBlock()->ToString(); @@ -216,8 +216,8 @@ namespace NKikimr { static ui32 SetGC(const TBlobStorageGroupType >ype, char *buf, ui64 lsn, - const TDeque<TLogoBlobID>& phantoms); - static bool CheckData(const TString &data, TString &errorString); + const TDeque<TLogoBlobID>& phantoms); + static bool CheckData(const TString &data, TString &errorString); }; //////////////////////////////////////////////////////////////////////////// @@ -247,9 +247,9 @@ namespace NKikimr { const TBarrierIngress &ingress); void SetGC(const TBlobStorageGroupType >ype, ui64 lsn, - const TDeque<TLogoBlobID>& phantoms); + const TDeque<TLogoBlobID>& phantoms); void Output(IOutputStream &str) const; - TString ToString() const; + TString ToString() const; const char *GetData() const { return HeapBuf.empty() ? Buf : &(HeapBuf[0]); @@ -266,7 +266,7 @@ namespace NKikimr { char Buf[NSyncLog::MaxRecFullSize]; // Size in bytes ui32 Size = 0; - TVector<char> HeapBuf; + TVector<char> HeapBuf; }; //////////////////////////////////////////////////////////////////////////// diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmem.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmem.cpp index 75d6349b824..a4e79d72610 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmem.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmem.cpp @@ -92,7 +92,7 @@ namespace NKikimr { } } - TString TMemRecLogSnapshot::BoundariesToString() const { + TString TMemRecLogSnapshot::BoundariesToString() const { if (Empty()) return Sprintf("{Mem: empty}"); else @@ -319,7 +319,7 @@ namespace NKikimr { return snap; } - TString TMemRecLog::BoundariesToString() const { + TString TMemRecLog::BoundariesToString() const { if (Empty()) return Sprintf("{Mem: empty}"); else @@ -345,7 +345,7 @@ namespace NKikimr { s << "\n"; } - TString TMemRecLog::ToString() const { + TString TMemRecLog::ToString() const { TStringStream str; Output(str); return str.Str(); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmem.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmem.h index 4186dea1c6a..147dfc255e9 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmem.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmem.h @@ -35,7 +35,7 @@ namespace NKikimr { , LastLsn(0) {} - TString ToString() const { + TString ToString() const { return Sprintf("[FreePos# %" PRIu32 " RecsNum# %" PRIu32 " LastLsn# %" PRIu64 "]", FreePos, RecsNum, LastLsn); } @@ -124,7 +124,7 @@ namespace NKikimr { const ui32 PageSize; }; - typedef TDeque<TSyncLogPagePtr> TSyncLogPages; + typedef TDeque<TSyncLogPagePtr> TSyncLogPages; //////////////////////////////////////////////////////////////////////////// // TSyncLogPageROIterator @@ -245,7 +245,7 @@ namespace NKikimr { } TString ToVerboseString() const; - TString ToString() const; + TString ToString() const; void Output(IOutputStream &str) const; }; @@ -391,7 +391,7 @@ namespace NKikimr { } void OutputHtml(IOutputStream &str) const; - TString BoundariesToString() const; + TString BoundariesToString() const; void CheckSnapshotConsistency() const; private: @@ -453,7 +453,7 @@ namespace NKikimr { return Snap.Get() == it.Snap.Get() && It == it.It; } - TString ToString() const { + TString ToString() const { TStringStream str; str << "[pagePos# " << unsigned(It - Snap->Pages.begin()) << "]"; return str.Str(); @@ -499,7 +499,7 @@ namespace NKikimr { return Hdr; } - TString ToString() const { + TString ToString() const { return Sprintf("[PagesIt=%s Hdr=%p]", PagesIt.ToString().data(), Hdr); } @@ -560,9 +560,9 @@ namespace NKikimr { ui64 diskLastLsn, ui64 freeUpToLsn, // excluding ui32 freeNPages); - TString BoundariesToString() const; + TString BoundariesToString() const; void Output(IOutputStream &s) const; - TString ToString() const; + TString ToString() const; private: ui32 DiscardPages(ui32 pagesToKeep, ui64 lastUnneededLsn); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl.cpp index ec10a5c1e1b..5005601afaa 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl.cpp @@ -12,7 +12,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // Codec detector //////////////////////////////////////////////////////////////////////////// - ECodec FragmentCodecDetector(const TString &data) { + ECodec FragmentCodecDetector(const TString &data) { if (data.size() < 48) return ECodec::Naive; @@ -40,14 +40,14 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class TLogoBlobColumns { protected: - TVector<ui64> TabletIds; - TVector<ui8> Channels; - TVector<ui32> Generations; - TVector<ui32> Steps; - TVector<ui32> Cookies; - TVector<ui32> Sizes; - TVector<ui64> Ingresses; - TVector<ui32> Counters; + TVector<ui64> TabletIds; + TVector<ui8> Channels; + TVector<ui32> Generations; + TVector<ui32> Steps; + TVector<ui32> Cookies; + TVector<ui32> Sizes; + TVector<ui64> Ingresses; + TVector<ui32> Counters; const size_t LogoBlobColumnizedRowSize = (8 + 1 + 4 + 4 + 4 + 4 + 8 + 4); @@ -55,7 +55,7 @@ namespace NKikimr { virtual ~TLogoBlobColumns() { } - void Columnize(TVector<TLogoBlobRecWithSerial> &logoBlobs) { + void Columnize(TVector<TLogoBlobRecWithSerial> &logoBlobs) { Clear(); auto comp = [](const TLogoBlobRecWithSerial& x, const TLogoBlobRecWithSerial& y) { return std::make_tuple(x.LogoBlobID(), x.Ingress.Raw(), x.Counter) < @@ -87,7 +87,7 @@ namespace NKikimr { } } - void Decolumnize(TVector<TLogoBlobRecWithSerial> &logoBlobs) { + void Decolumnize(TVector<TLogoBlobRecWithSerial> &logoBlobs) { logoBlobs.clear(); const ui32 blobsSize = Size(); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl.h index 0b9251e5169..895bf3cbcb4 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl.h @@ -3,7 +3,7 @@ #include "defs.h" #include "blobstorage_synclogformat.h" #include <util/generic/buffer.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/list.h> #include <util/thread/singleton.h> #include <library/cpp/blockcodecs/codecs.h> @@ -42,7 +42,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // Codec detector //////////////////////////////////////////////////////////////////////////// - ECodec FragmentCodecDetector(const TString &data); + ECodec FragmentCodecDetector(const TString &data); //////////////////////////////////////////////////////////////////////////// // Codec headers diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl_ut.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl_ut.cpp index 344377c9a30..be8044958bc 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl_ut.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgimpl_ut.cpp @@ -105,7 +105,7 @@ Y_UNIT_TEST_SUITE(CodecsTest) { using namespace NCodecs; template <bool delta> - void PFor(const TVector<ui32> &v1) { + void PFor(const TVector<ui32> &v1) { const char *begin = (const char *)(&v1[0]); const char *end = begin + sizeof(v1[0]) * v1.size(); TStringBuf in(begin, end); @@ -115,7 +115,7 @@ Y_UNIT_TEST_SUITE(CodecsTest) { STR << "v size: " << sizeof(v1[0]) * v1.size() << "; encoded size: " << buf.Size() << "\n"; } - void Delta(const TVector<ui32> &v1) { + void Delta(const TVector<ui32> &v1) { const char *begin = (const char *)(&v1[0]); const char *end = begin + sizeof(v1[0]) * v1.size(); TStringBuf in(begin, end); @@ -125,7 +125,7 @@ Y_UNIT_TEST_SUITE(CodecsTest) { STR << "v size: " << sizeof(v1[0]) * v1.size() << "; encoded size: " << buf.Size() << "\n"; } - void RunLength(const TVector<ui32> &v1) { + void RunLength(const TVector<ui32> &v1) { const char *begin = (const char *)(&v1[0]); const char *end = begin + sizeof(v1[0]) * v1.size(); TStringBuf in(begin, end); @@ -137,10 +137,10 @@ Y_UNIT_TEST_SUITE(CodecsTest) { Y_UNIT_TEST(Basic) { // logoblobs - TVector<ui32> v1 {20, 21, 22, 23, 24, 15, 19, 16, 17, 18, 20, 78, 89, 90, 91, 93, 74, 68, 69}; - TVector<ui32> v2 {15, 16, 17, 19, 19, 20, 21, 22, 25, 26, 29, 25, 26, 45, 46, 47, 47, 49, 50}; - TVector<ui32> v3 {42, 42, 42, 42, 42, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66}; - TVector<ui32> v4 {66, 66, 66, 66, 66, 66, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + TVector<ui32> v1 {20, 21, 22, 23, 24, 15, 19, 16, 17, 18, 20, 78, 89, 90, 91, 93, 74, 68, 69}; + TVector<ui32> v2 {15, 16, 17, 19, 19, 20, 21, 22, 25, 26, 29, 25, 26, 45, 46, 47, 47, 49, 50}; + TVector<ui32> v3 {42, 42, 42, 42, 42, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66}; + TVector<ui32> v4 {66, 66, 66, 66, 66, 66, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; STR << "======= PFOR DELTA ===========\n"; PFor<true>(v1); @@ -160,7 +160,7 @@ Y_UNIT_TEST_SUITE(CodecsTest) { } Y_UNIT_TEST(NaturalNumbersAndZero) { - TVector<ui32> v; + TVector<ui32> v; const ui32 n = 100000; v.reserve(n); for (ui32 i = 0; i < n; i++) @@ -177,7 +177,7 @@ Y_UNIT_TEST_SUITE(CodecsTest) { } Y_UNIT_TEST(LargeAndRepeated) { - TVector<ui32> v; + TVector<ui32> v; for (ui32 t = 0; t < 100; t++) { ui32 n = RandomNumber<ui32>(); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgreader.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgreader.cpp index f4c59ec890f..851775a1146 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgreader.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgreader.cpp @@ -11,7 +11,7 @@ namespace NKikimr { ForEach(Data, fblob, fblock, fbar, fblock2); } - void TNaiveFragmentReader::ForEach(const TString &d, TReadLogoBlobRec fblob, TReadBlockRec fblock, + void TNaiveFragmentReader::ForEach(const TString &d, TReadLogoBlobRec fblob, TReadBlockRec fblock, TReadBarrierRec fbar, TReadBlockRecV2 fblock2) { const TRecordHdr *begin = (const TRecordHdr *)(d.data()); const TRecordHdr *end = (const TRecordHdr *)(d.data() + d.size()); @@ -124,7 +124,7 @@ namespace NKikimr { bool TOrderedLz4FragmentReader::Decompress() { if (!Decompressed) { // remove header from original string - TString uncompressed; + TString uncompressed; size_t hdrSize = GetOrderedLz4HeaderSize(); TStringBuf d(Data.data() + hdrSize, Data.size() - hdrSize); GetLz4Codec()->Decode(d, uncompressed); @@ -161,7 +161,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TFragmentReader //////////////////////////////////////////////////////////////////////////// - TFragmentReader::TFragmentReader(const TString &data) { + TFragmentReader::TFragmentReader(const TString &data) { ECodec codec = FragmentCodecDetector(data); switch (codec) { case ECodec::Naive: diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgreader.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgreader.h index d3c7780e929..ab215e4c064 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgreader.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgreader.h @@ -32,7 +32,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class TNaiveFragmentReader : public IFragmentReader { public: - TNaiveFragmentReader(const TString &data) + TNaiveFragmentReader(const TString &data) : Data(data) {} @@ -40,7 +40,7 @@ namespace NKikimr { virtual bool Check(TString &errorString) override; protected: - const TString &Data; + const TString &Data; void ForEach(const TString &d, TReadLogoBlobRec fblob, TReadBlockRec fblock, TReadBarrierRec fbar, TReadBlockRecV2 fblock2); }; @@ -50,7 +50,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class TLz4FragmentReader : public TNaiveFragmentReader { public: - TLz4FragmentReader(const TString &data) + TLz4FragmentReader(const TString &data) : TNaiveFragmentReader(data) , Uncompressed() {} @@ -59,7 +59,7 @@ namespace NKikimr { virtual bool Check(TString &errorString) override; private: - mutable TString Uncompressed; + mutable TString Uncompressed; void Decompress(); }; @@ -82,7 +82,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class TOrderedLz4FragmentReader : public TBaseOrderedFragmentReader { public: - TOrderedLz4FragmentReader(const TString &data) + TOrderedLz4FragmentReader(const TString &data) : Data(data) , Decompressed(false) {} @@ -90,7 +90,7 @@ namespace NKikimr { virtual bool Check(TString &errorString) override; private: - const TString &Data; + const TString &Data; bool Decompressed; bool Decompress() override; @@ -101,7 +101,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class TCustomCodecFragmentReader : public TBaseOrderedFragmentReader { public: - TCustomCodecFragmentReader(const TString &data) + TCustomCodecFragmentReader(const TString &data) : Data(data) , Decompressed(false) {} @@ -109,7 +109,7 @@ namespace NKikimr { virtual bool Check(TString &errorString) override; private: - const TString &Data; + const TString &Data; bool Decompressed; bool Decompress() override; @@ -121,7 +121,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// class TFragmentReader { public: - TFragmentReader(const TString &data); + TFragmentReader(const TString &data); void ForEach(TReadLogoBlobRec fblob, TReadBlockRec fblock, TReadBarrierRec fbar, TReadBlockRecV2 fblock2) { Impl->ForEach(fblob, fblock, fbar, fblock2); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter.cpp index ab2b6dc161f..d2f4e9a5656 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter.cpp @@ -11,7 +11,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TNaiveFragmentWriter //////////////////////////////////////////////////////////////////////////// - void TNaiveFragmentWriter::Finish(TString *respData) { + void TNaiveFragmentWriter::Finish(TString *respData) { respData->clear(); respData->reserve(DataSize); for (TBuffer& buffer : Chain) { @@ -22,11 +22,11 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TLz4FragmentWriter //////////////////////////////////////////////////////////////////////////// - void TLz4FragmentWriter::Finish(TString *respData) { + void TLz4FragmentWriter::Finish(TString *respData) { // construct result and compress it respData->clear(); TNaiveFragmentWriter::Finish(respData); - const TString compressed = GetLz4Codec()->Encode(*respData); + const TString compressed = GetLz4Codec()->Encode(*respData); // header std::pair<const char *, size_t> hdr = GetLz4Header(); @@ -41,12 +41,12 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TOrderedLz4FragmentWriter //////////////////////////////////////////////////////////////////////////// - void TOrderedLz4FragmentWriter::Finish(TString *respData) { + void TOrderedLz4FragmentWriter::Finish(TString *respData) { // reorder TReorderCodec codec(TReorderCodec::EEncoding::Trivial); const TString reordered = codec.Encode(Records); // compress - const TString compressed = GetLz4Codec()->Encode(reordered); + const TString compressed = GetLz4Codec()->Encode(reordered); // header std::pair<const char *, size_t> hdr = GetOrderedLz4Header(); @@ -60,7 +60,7 @@ namespace NKikimr { //////////////////////////////////////////////////////////////////////////// // TCustomCodecFragmentWriter //////////////////////////////////////////////////////////////////////////// - void TCustomCodecFragmentWriter::Finish(TString *respData) { + void TCustomCodecFragmentWriter::Finish(TString *respData) { // reorder TReorderCodec codec(TReorderCodec::EEncoding::Custom); const TString result = codec.Encode(Records); diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter.h index 70612240593..9b7cd1471bc 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter.h @@ -4,7 +4,7 @@ #include "blobstorage_synclogformat.h" #include "blobstorage_synclogmsgimpl.h" #include <util/generic/buffer.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/list.h> namespace NKikimr { @@ -14,7 +14,7 @@ namespace NKikimr { // TNaiveFragmentWriter //////////////////////////////////////////////////////////////////////////// class TNaiveFragmentWriter { - TList<TBuffer> Chain; + TList<TBuffer> Chain; size_t DataSize; public: @@ -48,7 +48,7 @@ namespace NKikimr { } } - void Finish(TString *respData); + void Finish(TString *respData); }; //////////////////////////////////////////////////////////////////////////// @@ -60,7 +60,7 @@ namespace NKikimr { : TNaiveFragmentWriter() {} - void Finish(TString *respData); + void Finish(TString *respData); }; //////////////////////////////////////////////////////////////////////////// @@ -123,7 +123,7 @@ namespace NKikimr { : TBaseOrderedWriter() {} - void Finish(TString *respData); + void Finish(TString *respData); }; //////////////////////////////////////////////////////////////////////////// @@ -135,7 +135,7 @@ namespace NKikimr { : TBaseOrderedWriter() {} - void Finish(TString *respData); + void Finish(TString *respData); }; } // NSyncLog diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter_ut.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter_ut.cpp index 9699c12a446..63d63eb3215 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter_ut.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogmsgwriter_ut.cpp @@ -6,14 +6,14 @@ using namespace NKikimr::NSyncLog; Y_UNIT_TEST_SUITE(NaiveFragmentWriterTest) { - void AppendBlock(TString &data, ui64 lsn, ui64 tabletId, ui32 gen) { + void AppendBlock(TString &data, ui64 lsn, ui64 tabletId, ui32 gen) { char buf[MaxRecFullSize]; ui32 len = TSerializeRoutines::SetBlock(buf, lsn, tabletId, gen, 0); data.append(buf, len); } Y_UNIT_TEST(Basic) { - TString data; + TString data; AppendBlock(data, 100, 66, 1); AppendBlock(data, 101, 66, 2); AppendBlock(data, 102, 66, 3); @@ -21,7 +21,7 @@ Y_UNIT_TEST_SUITE(NaiveFragmentWriterTest) { AppendBlock(data, 104, 66, 5); TNaiveFragmentWriter w; - TString result; + TString result; const TRecordHdr *begin = (const TRecordHdr *)(data.data()); const TRecordHdr *end = (const TRecordHdr *)(data.data() + data.size()); for (const TRecordHdr *it = begin; it < end; it = it->Next()) { @@ -29,25 +29,25 @@ Y_UNIT_TEST_SUITE(NaiveFragmentWriterTest) { result.append((const char *)it, it->GetSize()); UNIT_ASSERT_VALUES_EQUAL(w.GetSize(), result.size()); } - TString temp; + TString temp; w.Finish(&temp); UNIT_ASSERT_STRINGS_EQUAL(temp, result); } Y_UNIT_TEST(Long) { - TString data; + TString data; AppendBlock(data, 100, 66, 1); const TRecordHdr *rec = (const TRecordHdr *)(data.data()); TNaiveFragmentWriter w; - TString result; + TString result; while (result.size() < (5 << 20)) { w.Push(rec); result.append((const char *)rec, rec->GetSize()); UNIT_ASSERT_VALUES_EQUAL(w.GetSize(), result.size()); } - TString temp; + TString temp; w.Finish(&temp); UNIT_ASSERT_STRINGS_EQUAL(temp, result); } diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogneighbors.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogneighbors.h index 72bb1c825d8..387157ee396 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogneighbors.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogneighbors.h @@ -33,7 +33,7 @@ namespace NKikimr { , LockedLsn(p.LockedLsn) {} - TString ToString() const { + TString ToString() const { return Sprintf("{SyncedLsn: %" PRIu64 " LockedLsn: %" PRIu64 "}", SyncedLsn, LockedLsn); } @@ -47,7 +47,7 @@ namespace NKikimr { TNeighbors Neighbors; TSyncPosQueue SyncPosQueue; - const TString LogPrefix; + const TString LogPrefix; TActorSystem *ActorSystem; ui32 LocksNum; @@ -109,14 +109,14 @@ namespace NKikimr { return diskData.Get().SyncedLsn; } - TString ToString(char sep = '\0') const { + TString ToString(char sep = '\0') const { return Sprintf("{Global: %" PRIu64 " LocksNum: %" PRIu32 " Neighbors: %s}", GlobalSyncedLsn(), LocksNum, Neighbors.ToString(sep).data()); } TSyncLogNeighbors(const TVDiskIdShort &selfVDisk, std::shared_ptr<TBlobStorageGroupInfo::TTopology> top, - const TString &logPrefix, TActorSystem *actorSystem) + const TString &logPrefix, TActorSystem *actorSystem) : Neighbors(selfVDisk, top) , SyncPosQueue() , LogPrefix(logPrefix) diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogreader.cpp b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogreader.cpp index 2873bcb56c8..22ba980804c 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogreader.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogreader.cpp @@ -32,7 +32,7 @@ namespace NKikimr { TWhatsNextOutcome WhatsNext(ui64 syncedLsn, ui64 dbBirthLsn, const NSyncLog::TLogEssence *e, - std::function<TString()> reportInternals) { + std::function<TString()> reportInternals) { // NOTE: we use dbBirthLsn to handle read requests, below I describe why. // After lost data recovery, we would like syncer to start with DbBirthLsn, // because there is no need to sync previous records (they are obtained during diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogrecovery.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogrecovery.h index 9e7ea1ab997..d1692cb028b 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogrecovery.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogrecovery.h @@ -74,7 +74,7 @@ namespace NKikimr { ui64 GetLastLsnOfIndexRecord() const; ui64 GetLastLsn() const; const TSyncLogHeader &GetSyncLogHeader() const; - void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; + void GetOwnedChunks(TSet<TChunkIdx>& chunks) const; private: TString ToString() const; diff --git a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogwriteparts.h b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogwriteparts.h index 4b2347b4c4c..142a2c70169 100644 --- a/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogwriteparts.h +++ b/ydb/core/blobstorage/vdisk/synclog/blobstorage_synclogwriteparts.h @@ -37,7 +37,7 @@ namespace NKikimr { } } - const TVector<TSyncLogPageSnap> &GetSnapPages() const { + const TVector<TSyncLogPageSnap> &GetSnapPages() const { return Pages; } @@ -53,7 +53,7 @@ namespace NKikimr { private: const ui32 PageSize; - TVector<TSyncLogPageSnap> Pages; + TVector<TSyncLogPageSnap> Pages; std::vector<TDataRef> Refs; }; diff --git a/ydb/core/blobstorage/vdisk/synclog/codecs.h b/ydb/core/blobstorage/vdisk/synclog/codecs.h index ed377c46b1e..51e45bee5a4 100644 --- a/ydb/core/blobstorage/vdisk/synclog/codecs.h +++ b/ydb/core/blobstorage/vdisk/synclog/codecs.h @@ -15,7 +15,7 @@ namespace NCodecs { : CompressionRatio(compressionRatio) {} - TString GetName() const override { return "VarLengthInt"; } + TString GetName() const override { return "VarLengthInt"; } ui8 Encode(TStringBuf in, TBuffer& out) const override { if (in.size() / sizeof(TNumber) * sizeof(TNumber) != in.size()) @@ -69,7 +69,7 @@ namespace NCodecs { : CompressionRatio(compressionRatio) {} - TString GetName() const override { return "RunLength"; } + TString GetName() const override { return "RunLength"; } ui8 Encode(TStringBuf in, TBuffer& out) const override { if (in.size() / sizeof(TInputNumber) * sizeof(TInputNumber) != in.size()) @@ -132,7 +132,7 @@ namespace NCodecs { : CompressionRatio(compressionRatio) {} - TString GetName() const override { return "SemiSortedDelta"; } + TString GetName() const override { return "SemiSortedDelta"; } ui8 Encode(TStringBuf in, TBuffer& out) const override { if (in.size() / sizeof(TInputNumber) * sizeof(TInputNumber) != in.size()) diff --git a/ydb/core/blobstorage/vdisk/synclog/codecs_ut.cpp b/ydb/core/blobstorage/vdisk/synclog/codecs_ut.cpp index 94b29b860bc..30a462855e9 100644 --- a/ydb/core/blobstorage/vdisk/synclog/codecs_ut.cpp +++ b/ydb/core/blobstorage/vdisk/synclog/codecs_ut.cpp @@ -9,7 +9,7 @@ using namespace NCodecs; #define STR Cnull template <class TNumber, class TCodec> -void CheckCodec(const TVector<TNumber> &v, TCodecPtr codec = new TCodec) { +void CheckCodec(const TVector<TNumber> &v, TCodecPtr codec = new TCodec) { const char *begin = (const char *)(&v[0]); const char *end = begin + sizeof(v[0]) * v.size(); TStringBuf src(begin, end); @@ -31,19 +31,19 @@ void CheckCodec(const TVector<TNumber> &v, TCodecPtr codec = new TCodec) { Y_UNIT_TEST_SUITE(VarLengthIntCodec) { template <class TNumber> - void VarLength(const TVector<TNumber> &v) { + void VarLength(const TVector<TNumber> &v) { CheckCodec<TNumber, TVarLengthIntCodec<TNumber>>(v); } template <class TNumber> void BasicTest() { - TVector<TNumber> v {67, 1974, 7, 0, 7283647, 2973}; + TVector<TNumber> v {67, 1974, 7, 0, 7283647, 2973}; VarLength<TNumber>(v); } template <class TNumber> void Random() { - TVector<TNumber> v; + TVector<TNumber> v; for (size_t i = 0; i < 1000000; i++) v.push_back(RandomNumber<ui32>()); // ui32 -- small numbers are intentionally @@ -70,19 +70,19 @@ Y_UNIT_TEST_SUITE(VarLengthIntCodec) { Y_UNIT_TEST_SUITE(RunLengthCodec) { template <class TNumber> - void RunLength(const TVector<TNumber> &v) { + void RunLength(const TVector<TNumber> &v) { CheckCodec<TNumber, TRunLengthCodec<TNumber>>(v); } template <class TNumber> void BasicTest() { - TVector<TNumber> v {5, 5, 5, 5, 32, 1974, 7, 7, 7, 0, 7283647, 7283647, 7283647, 7283647, 7283647}; + TVector<TNumber> v {5, 5, 5, 5, 32, 1974, 7, 7, 7, 0, 7283647, 7283647, 7283647, 7283647, 7283647}; RunLength<TNumber>(v); } template <class TNumber> void Random() { - TVector<TNumber> v; + TVector<TNumber> v; for (size_t i = 0; i < 1000000; i++) v.push_back(RandomNumber<TNumber>()); @@ -109,19 +109,19 @@ Y_UNIT_TEST_SUITE(RunLengthCodec) { Y_UNIT_TEST_SUITE(SemiSortedDeltaCodec) { template <class TNumber> - void SemiSortedDelta(const TVector<TNumber> &v) { + void SemiSortedDelta(const TVector<TNumber> &v) { CheckCodec<TNumber, TSemiSortedDeltaCodec<TNumber>>(v); } template <class TNumber> void BasicTest() { - TVector<TNumber> v {5, 6, 6, 8, 9, 11, 18, 7, 7, 8, 10, 34, 35, 36, 20, 21, 23, 26}; + TVector<TNumber> v {5, 6, 6, 8, 9, 11, 18, 7, 7, 8, 10, 34, 35, 36, 20, 21, 23, 26}; SemiSortedDelta<TNumber>(v); } template <class TNumber> void Random() { - TVector<TNumber> v; + TVector<TNumber> v; for (size_t i = 0; i < 1000000; i++) v.push_back(RandomNumber<TNumber>()); @@ -148,7 +148,7 @@ Y_UNIT_TEST_SUITE(SemiSortedDeltaCodec) { Y_UNIT_TEST_SUITE(SemiSortedDeltaAndVarLengthCodec) { template <class TNumber> - void SemiSortedDeltaAndVarLength(const TVector<TNumber> &v) { + void SemiSortedDeltaAndVarLength(const TVector<TNumber> &v) { TCodecPtr p1(new TSemiSortedDeltaCodec<TNumber>); TCodecPtr p2(new TVarLengthIntCodec<TNumber>); TCodecPtr codec(new TPipelineCodec(p1, p2)); @@ -157,13 +157,13 @@ Y_UNIT_TEST_SUITE(SemiSortedDeltaAndVarLengthCodec) { template <class TNumber> void BasicTest() { - TVector<TNumber> v {5, 6, 6, 8, 9, 11, 18, 7, 7, 8, 10, 34, 35, 36, 20, 21, 23, 26}; + TVector<TNumber> v {5, 6, 6, 8, 9, 11, 18, 7, 7, 8, 10, 34, 35, 36, 20, 21, 23, 26}; SemiSortedDeltaAndVarLength<TNumber>(v); } template <class TNumber> void Random() { - TVector<TNumber> v; + TVector<TNumber> v; for (size_t i = 0; i < 1000000; i++) v.push_back(RandomNumber<TNumber>()); diff --git a/ydb/core/client/client_ut.cpp b/ydb/core/client/client_ut.cpp index b94c722588b..e5bc7d36820 100644 --- a/ydb/core/client/client_ut.cpp +++ b/ydb/core/client/client_ut.cpp @@ -29,7 +29,7 @@ namespace Tests { using namespace NMiniKQL; // const ui32 TestDomain = 1; -static const TString TablePlacement = "/dc-1/Berkanavt/tables"; +static const TString TablePlacement = "/dc-1/Berkanavt/tables"; namespace { @@ -300,7 +300,7 @@ struct TTxInfo { } }; -void ExtractResultInfo(const NKikimrMiniKQL::TResult& result, TVector<TTxInfo>& out) { +void ExtractResultInfo(const NKikimrMiniKQL::TResult& result, TVector<TTxInfo>& out) { TValue value = TValue::Create(result.GetValue(), result.GetType()); TValue list = value["__tx_info"]; @@ -413,7 +413,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { void ReadWriteViaMiniKQLBody(TClient &client, bool useHead, bool useFollower) { NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let row1 '('('key (Uint64 '2)))) (let row2 '('('key (Uint64 '2305843009213693951)))) @@ -428,7 +428,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { UNIT_ASSERT(client.FlatQuery(writeQuery, writeRes)); NKikimrMiniKQL::TResult readRes; - const TString readQueryTemplate = R"___( + const TString readQueryTemplate = R"___( ( (let row1 '('('key (Uint64 '2)))) (let nonExistRow1 '('('key (Uint64 '3)))) @@ -445,7 +445,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { ) )___"; - TString readQuery = readQueryTemplate; + TString readQuery = readQueryTemplate; SubstGlobal(readQuery, "__HEAD__", !useHead ? (useFollower ? "'follower" : "'online") : "'head"); UNIT_ASSERT(client.FlatQuery(readQuery, readRes)); @@ -638,7 +638,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { client.CreateTable(TablePlacement, tableSimple); } - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let row1 '('('key (Uint32 '2)))) (let row2 '('('key (Uint32 '3)))) @@ -724,7 +724,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { void GetStepTxIdBody(TClient &client, bool useHead) { NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let row1 '('('key (Uint64 '2)))) (let row2 '('('key (Uint64 '2305843009213693951)))) @@ -739,7 +739,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { UNIT_ASSERT(client.FlatQuery(writeQuery, writeRes)); NKikimrMiniKQL::TResult readRes; - const TString readQueryTemplate = R"___( + const TString readQueryTemplate = R"___( ( (let row1 '('('key (Uint64 '2)))) (let row2 '('('key (Uint64 '2305843009213693951)))) @@ -753,7 +753,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { ) )___"; - TString readQuery = readQueryTemplate; + TString readQuery = readQueryTemplate; SubstGlobal(readQuery, "__HEAD__", !useHead ? "'online" : "'head"); UNIT_ASSERT(client.FlatQuery(readQuery, readRes)); @@ -804,7 +804,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { void CASViaMiniKQLBody(TClient &client) { NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -819,7 +819,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { UNIT_ASSERT(client.FlatQuery(writeQuery, writeRes)); NKikimrMiniKQL::TResult updateRes; - const TString updateQuery = R"___( + const TString updateQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -849,7 +849,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { } NKikimrMiniKQL::TResult readRes; - const TString readQuery = R"___( + const TString readQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -930,7 +930,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { void RowEraseViaMiniKQLBody(TClient &client) { NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -945,7 +945,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { UNIT_ASSERT(client.FlatQuery(writeQuery, writeRes)); NKikimrMiniKQL::TResult updateRes; - const TString updateQuery = R"___( + const TString updateQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -957,7 +957,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { UNIT_ASSERT(client.FlatQuery(updateQuery, updateRes)); NKikimrMiniKQL::TResult readRes; - const TString readQuery = R"___( + const TString readQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -1038,7 +1038,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { void ReadRangeViaMiniKQLBody(TClient &client) { NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -1053,7 +1053,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { UNIT_ASSERT(client.FlatQuery(writeQuery, writeRes)); NKikimrMiniKQL::TResult readRes; - const TString readQuery = R"___( + const TString readQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let range '('IncFrom '('key (Uint64 '0) (Void)))) @@ -1134,7 +1134,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { void SelectRangeOptionsBody(TClient &client) { NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -1154,7 +1154,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { { NKikimrMiniKQL::TResult readRes; - const TString readQuery = R"___( + const TString readQuery = R"___( ( (let from (Parameter 'FROM (DataType 'Uint64))) (let to (Parameter 'TO (DataType 'Uint64))) @@ -1170,7 +1170,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { ) )___"; - const TString readParams = R"___( + const TString readParams = R"___( ( (let params (Parameters)) (let params (AddParameter params 'FROM (Uint64 '2))) @@ -1198,10 +1198,10 @@ Y_UNIT_TEST_SUITE(TClientTest) { } { - TString binQuery; + TString binQuery; NKikimrMiniKQL::TResult readRes; - const TString readQuery = R"___( + const TString readQuery = R"___( ( (let from (Parameter 'FROM (DataType 'Uint64))) (let to (Parameter 'TO (DataType 'Uint64))) @@ -1219,7 +1219,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { UNIT_ASSERT(client.Compile(readQuery, binQuery)); - const TString readParams = R"___( + const TString readParams = R"___( ( (let params (Parameters)) (let params (AddParameter params 'FROM (Uint64 '2))) @@ -1246,7 +1246,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { { NKikimrMiniKQL::TResult readRes; - const TString readQuery = R"___( + const TString readQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let range '('IncFrom 'ExcTo '('key (Uint64 '4) (Uint64 '2305843009213693952)))) @@ -1274,7 +1274,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { { NKikimrMiniKQL::TResult readRes; - const TString readQuery = R"___( + const TString readQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let range '('ExcFrom 'IncTo '('key (Uint64 '3) (Uint64 '2305843009213693950)))) @@ -1320,7 +1320,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { void MultiSelectBody(TClient &client, bool useFlatMap = false) { NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -1340,7 +1340,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { { NKikimrMiniKQL::TResult readRes; - const TString readQuery = useFlatMap ? + const TString readQuery = useFlatMap ? R"___( ( (let list (Parameter 'LIST (ListType (DataType 'Uint64)))) @@ -1368,7 +1368,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { ) )___"; - const TString readParams = R"___( + const TString readParams = R"___( ( (let params (Parameters)) (let params (AddParameter params 'LIST (AsList (Uint64 '2) (Uint64 '4)))) @@ -1475,7 +1475,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { )___", allowFollowerPromotion ? "true": "false")); NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = R"___( + const TString writeQuery = R"___( ( (let table '/dc-1/Berkanavt/tables/Simple) (let row1 '('('key (Uint64 '2)))) @@ -1489,7 +1489,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { } void CheckRead(TClient& client, bool readFromFollower) { - const TString readQuery = Sprintf( + const TString readQuery = Sprintf( R"___( ( (let key '('('key (Uint64 '2)))) @@ -1565,7 +1565,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { // force some rounds of compaction for (ui32 i : xrange(50, 3000)) { NKikimrMiniKQL::TResult writeRes; - const TString writeQuery = "((let table '/dc-1/Berkanavt/tables/Simple)" + const TString writeQuery = "((let table '/dc-1/Berkanavt/tables/Simple)" "(let row1 '('('key (Uint64 '" + ToString(i) + "))))" "(return (AsList" "(UpdateRow table row1 '( '('uint (Uint64 '" + ToString(i) + "))))" @@ -1702,7 +1702,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { { //Cerr << result.DebugString() << Endl; - TVector<TTxInfo> infos; + TVector<TTxInfo> infos; ExtractResultInfo(result, infos); for (const auto& txInfo : infos) { @@ -1758,15 +1758,15 @@ Y_UNIT_TEST_SUITE(TClientTest) { // local - TString DiffStrings(const TString& newStr, const TString& oldStr) { - TVector<NDiff::TChunk<char>> chunks; + TString DiffStrings(const TString& newStr, const TString& oldStr) { + TVector<NDiff::TChunk<char>> chunks; NDiff::InlineDiff(chunks, newStr, oldStr, "\n"); - TString res; + TString res; TStringOutput out(res); for (const auto& c : chunks) { - TString left(c.Left.begin(), c.Left.end()); - TString right(c.Right.begin(), c.Right.end()); + TString left(c.Left.begin(), c.Left.end()); + TString right(c.Right.begin(), c.Right.end()); if (!left.empty() || !right.empty()) { out << ">>>>>" << Endl << left << Endl @@ -1778,8 +1778,8 @@ Y_UNIT_TEST_SUITE(TClientTest) { return res; } - TString ToString(const NTabletFlatScheme::TSchemeChanges& scheme) { - TString str; + TString ToString(const NTabletFlatScheme::TSchemeChanges& scheme) { + TString str; ::google::protobuf::TextFormat::PrintToString(scheme, &str); return str; } @@ -1794,7 +1794,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { NTabletFlatScheme::TSchemeChanges scheme1; NTabletFlatScheme::TSchemeChanges scheme2; - TString err; + TString err; bool success = client.LocalSchemeTx(Tests::Hive, "", true, scheme1, err); UNIT_ASSERT(success); success = client.LocalSchemeTx(Tests::Hive, "", false, scheme2, err); @@ -1812,14 +1812,14 @@ Y_UNIT_TEST_SUITE(TClientTest) { TClient client(settings); NTabletFlatScheme::TSchemeChanges scheme; - TString err; + TString err; bool success = false; success = client.LocalSchemeTx(Tests::Hive, "", true, scheme, err); UNIT_ASSERT(success); - TString oldScheme = ToString(scheme); + TString oldScheme = ToString(scheme); - TString change = R"___( + TString change = R"___( Delta { DeltaType: AddColumn TableId: 10 @@ -1836,10 +1836,10 @@ Y_UNIT_TEST_SUITE(TClientTest) { // Dry run first success = client.LocalSchemeTx(Tests::Hive, change, true, scheme, err); UNIT_ASSERT(success); - TString dryRunScheme = ToString(scheme); + TString dryRunScheme = ToString(scheme); // Re-read success = client.LocalSchemeTx(Tests::Hive, "", true, scheme, err); - TString newScheme = ToString(scheme); + TString newScheme = ToString(scheme); UNIT_ASSERT_VALUES_EQUAL_C(newScheme, oldScheme, "Schema changed by dry-run"); // Update @@ -1848,7 +1848,7 @@ Y_UNIT_TEST_SUITE(TClientTest) { newScheme = ToString(scheme); UNIT_ASSERT_VALUES_EQUAL_C(newScheme, dryRunScheme, "Dry-run result is not equal"); - TString schemaDiff = DiffStrings(oldScheme, newScheme); + TString schemaDiff = DiffStrings(oldScheme, newScheme); Cout << schemaDiff << Endl; UNIT_ASSERT_C(!schemaDiff.empty(), "Schema not changed after update"); } @@ -1865,14 +1865,14 @@ Y_UNIT_TEST_SUITE(TClientTest) { WaitForLeaderStart(client, server.GetRuntime(), ChangeStateStorage(Tests::DummyTablet1, TestDomain), TDuration::Seconds(1)); NTabletFlatScheme::TSchemeChanges schemeInitial; - TString err; + TString err; bool success = false; success = client.LocalSchemeTx(Tests::DummyTablet1, "", true, schemeInitial, err); UNIT_ASSERT(success); - const TString oldScheme = ToString(schemeInitial); + const TString oldScheme = ToString(schemeInitial); - TString change = R"___( + TString change = R"___( Delta { DeltaType: DropTable TableId: 32 @@ -1883,9 +1883,9 @@ Y_UNIT_TEST_SUITE(TClientTest) { NTabletFlatScheme::TSchemeChanges schemeChanged; success = client.LocalSchemeTx(Tests::DummyTablet1, change, false, schemeChanged, err); UNIT_ASSERT(success); - const TString newScheme = ToString(schemeChanged); + const TString newScheme = ToString(schemeChanged); - TString schemaDiff = DiffStrings(oldScheme, newScheme); + TString schemaDiff = DiffStrings(oldScheme, newScheme); UNIT_ASSERT_C(!schemaDiff.empty(), "Schema not changed after update"); } diff --git a/ydb/core/client/flat_ut.cpp b/ydb/core/client/flat_ut.cpp index 362c052aa11..c07e12a9aa3 100644 --- a/ydb/core/client/flat_ut.cpp +++ b/ydb/core/client/flat_ut.cpp @@ -63,7 +63,7 @@ namespace { } if (strncmp(RequestString.data(), "GET /hosts HTTP/1.", 18) == 0) { - TString list = Sprintf("[\"localhost\"]"); + TString list = Sprintf("[\"localhost\"]"); Output() << "HTTP/1.1 200 Ok\r\n"; Output() << "Connection: close\r\n"; Output() << "X-Server: unit test server\r\n"; @@ -94,7 +94,7 @@ namespace { }; public: - inline THTTP200OkServer(TString res) + inline THTTP200OkServer(TString res) : Res_(std::move(res)) { } @@ -104,7 +104,7 @@ namespace { } private: - TString Res_; + TString Res_; }; } @@ -1075,8 +1075,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) { ); } - void TestLsSuccess(TFlatMsgBusClient& annoyingClient, const TString& name, const TVector<TString>& children) { - TString selfName = name; + void TestLsSuccess(TFlatMsgBusClient& annoyingClient, const TString& name, const TVector<TString>& children) { + TString selfName = name; if (selfName != "/") { selfName= name.substr(name.find_last_of('/')+1); } @@ -1087,10 +1087,10 @@ Y_UNIT_TEST_SUITE(TFlatTest) { UNIT_ASSERT_VALUES_EQUAL_C(res->Record.GetPathDescription().ChildrenSize(), children.size(), "Unexpected number of children for " + name); - THashSet<TString> actualChildren; - TString prevName; + THashSet<TString> actualChildren; + TString prevName; for (size_t i = 0; i < res->Record.GetPathDescription().ChildrenSize(); ++i) { - TString name = res->Record.GetPathDescription().GetChildren(i).GetName(); + TString name = res->Record.GetPathDescription().GetChildren(i).GetName(); bool res = actualChildren.insert(name).second; UNIT_ASSERT_C(res, "Repeating child: " + name); UNIT_ASSERT_C(prevName < name, "Children are not sorted: " + prevName + ", " + name); @@ -1103,7 +1103,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } } - void TestLsUknownPath(TFlatMsgBusClient& annoyingClient, const TString& name) { + void TestLsUknownPath(TFlatMsgBusClient& annoyingClient, const TString& name) { TAutoPtr<NMsgBusProxy::TBusResponse> res = annoyingClient.Ls(name); UNIT_ASSERT_VALUES_EQUAL_C(res->Record.HasPathDescription(), false, "Unxepected description for " + name); @@ -1221,7 +1221,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { TestLsSuccess(annoyingClient, "/dc-1", {"A", "B", "Dir1", "Dir2", "Dir3", "Dir4"}); } - void TestLsPathIdSuccess(TFlatMsgBusClient& annoyingClient, ui64 schemeshardId, ui64 pathId, const TString& selfName, const TVector<TString>& children) { + void TestLsPathIdSuccess(TFlatMsgBusClient& annoyingClient, ui64 schemeshardId, ui64 pathId, const TString& selfName, const TVector<TString>& children) { TAutoPtr<NMsgBusProxy::TBusResponse> res = annoyingClient.LsPathId(schemeshardId, pathId); UNIT_ASSERT_VALUES_EQUAL_C(res->Record.GetPathDescription().GetSelf().GetName(), selfName, "Self name doesn't match"); @@ -1229,9 +1229,9 @@ Y_UNIT_TEST_SUITE(TFlatTest) { UNIT_ASSERT_VALUES_EQUAL_C(res->Record.GetPathDescription().ChildrenSize(), children.size(), "Unexpected number of children for " + selfName); - THashSet<TString> actualChildren; + THashSet<TString> actualChildren; for (size_t i = 0; i < res->Record.GetPathDescription().ChildrenSize(); ++i) { - TString n = res->Record.GetPathDescription().GetChildren(i).GetName(); + TString n = res->Record.GetPathDescription().GetChildren(i).GetName(); bool res = actualChildren.insert(n).second; UNIT_ASSERT_C(res, "Repeating child: " + n); } @@ -1464,7 +1464,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { annoyingClient.MkDir("/dc-1", "Dir"); annoyingClient.CreateTable("/dc-1/Dir", table); - TString insertRowQuery = "(" + TString insertRowQuery = "(" "(let key '('('Key (Uint32 '%u))))" "(let value '('('Value (Utf8 '%s))))" "(let ret_ (AsList" @@ -1487,7 +1487,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } UNIT_ASSERT_C(errorCount > 0, "Out of disk space error must have happened"); - TString readQuery = + TString readQuery = "(" "(let range '('ExcFrom '('Key (Uint32 '0) (%s))))" "(let select '('Key))" @@ -1518,7 +1518,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { TFlatMsgBusClient annoyingClient(port); - TString table = + TString table = " Name: \"Table\"" " Columns { Name: \"Key\" Type: \"Uint32\"}" " Columns { Name: \"Value\" Type: \"Utf8\"}" @@ -1530,7 +1530,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { annoyingClient.MkDir("/dc-1", "Dir"); annoyingClient.CreateTable("/dc-1/Dir", table); - TString insertRowQuery = "(" + TString insertRowQuery = "(" "(let key '('('Key (Uint32 '%u))))" "(let value '('('Value (Utf8 '%s))))" "(let ret_ (AsList" @@ -1601,7 +1601,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { annoyingClient.MkDir("/dc-1", "Dir"); annoyingClient.CreateTable("/dc-1/Dir", table); - TString insertRowQuery = "(" + TString insertRowQuery = "(" "(let key '('('Key (Uint32 '%u))))" "(let value '('('Value (Utf8 '%s))))" "(let ret_ (AsList" @@ -1673,7 +1673,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { annoyingClient.MkDir("/dc-1", "Dir"); annoyingClient.CreateTable("/dc-1/Dir", table); - TString insertRowQuery = "(" + TString insertRowQuery = "(" "(let key '('('Key (Uint32 '%u))))" "(let value '('('Value (Utf8 '%s))))" "(let ret_ (AsList" @@ -1686,7 +1686,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { annoyingClient.FlatQuery(Sprintf(insertRowQuery.data(), i, TString(1000000, 'A').data())); } - TString readQuery = + TString readQuery = "(" "(let key1 '('('Key (Uint32 '4242))))" "(let row (SelectRow '/dc-1/Dir/Table key1 '('Value)))" @@ -1742,8 +1742,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) { RunWriteQueryRetryOverloads(annoyingClient, Sprintf(insertRowQuery.data(), key, value.data(), large.data(), table.data())); } - void WriteRow(TFlatMsgBusClient& annoyingClient, TString table, ui32 key, TString value) { - TString insertRowQuery = "(" + void WriteRow(TFlatMsgBusClient& annoyingClient, TString table, ui32 key, TString value) { + TString insertRowQuery = "(" "(let key '('('Key (Uint32 '%u))))" "(let value '('('Value (Utf8 '%s))))" "(let ret_ (AsList" @@ -1764,8 +1764,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } } - TString ReadRow(TFlatMsgBusClient& annoyingClient, TString table, ui32 key) { - TString query = + TString ReadRow(TFlatMsgBusClient& annoyingClient, TString table, ui32 key) { + TString query = R"( ( (let row '('('Key (Uint32 '%u)))) @@ -1867,14 +1867,14 @@ Y_UNIT_TEST_SUITE(TFlatTest) { NKikimrMiniKQL::TResult result; result.Swap(response.MutableExecutionEngineEvaluatedResponse()); - TString strResult; + TString strResult; ::google::protobuf::TextFormat::PrintToString(result.GetValue(), &strResult); return strResult; } - template <class TSetType> + template <class TSetType> void WaitForTabletsToBeDeletedInHive(TFlatMsgBusClient& annoyingClient, TTestActorRuntime* runtime, - const TSetType& tabletIds, const TDuration& timeout = TDuration::Seconds(20)) { + const TSetType& tabletIds, const TDuration& timeout = TDuration::Seconds(20)) { TInstant waitStart = TInstant::Now(); for (ui64 tabletId : tabletIds) { Cerr << "Check that tablet " << tabletId << " was deleted\n"; @@ -1905,8 +1905,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) { annoyingClient.CreateTable("/dc-1/Dir", " Name: \"Table\" CopyFromTable: \"/dc-1/Dir/TableOld\""); - TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); + TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); Cout << strResultOld << Endl; UNIT_ASSERT_NO_DIFF(strResult, strResultOld); @@ -1989,8 +1989,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) { cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG); Cerr << "Copy TableOld to Table" << Endl; annoyingClient.CreateTable("/dc-1/Dir", " Name: \"Table\" CopyFromTable: \"/dc-1/Dir/TableOld\""); - TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); + TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); Cout << strResult << Endl; UNIT_ASSERT_NO_DIFF(strResult, strResultOld); @@ -2058,11 +2058,11 @@ Y_UNIT_TEST_SUITE(TFlatTest) { TFlatMsgBusClient annoyingClient(port); PrepareSourceTable(annoyingClient); - TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); + TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); Cerr << strResultOld << Endl; - THashSet<ui64> datashards; - TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); + THashSet<ui64> datashards; + TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); datashards.insert(partitions.begin(), partitions.end()); cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG); @@ -2074,7 +2074,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { datashards.insert(partitions.begin(), partitions.end()); annoyingClient.DeleteTable("/dc-1/Dir", "Table"); - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); UNIT_ASSERT_NO_DIFF(strResult, strResultOld); // Make a new copy @@ -2107,10 +2107,10 @@ Y_UNIT_TEST_SUITE(TFlatTest) { TFlatMsgBusClient annoyingClient(port); PrepareSourceTable(annoyingClient); - TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); + TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); Cerr << strResultOld << Endl; - THashSet<ui64> datashards; + THashSet<ui64> datashards; auto oldShards = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); datashards.insert(oldShards.begin(), oldShards.end()); @@ -2125,7 +2125,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { // Drop original annoyingClient.DeleteTable("/dc-1/Dir", "TableOld"); - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); UNIT_ASSERT_NO_DIFF(strResult, strResultOld); // Delete the copy @@ -2146,8 +2146,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) { PrepareSourceTable(annoyingClient); - THashSet<ui64> datashards; - TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); + THashSet<ui64> datashards; + TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); datashards.insert(partitions.begin(), partitions.end()); // Copy the table @@ -2193,12 +2193,12 @@ Y_UNIT_TEST_SUITE(TFlatTest) { // Write new rows to the copy in order to trigger compaction WriteRandomRows(annoyingClient, "Table", 666, 100); - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); // Delete original table annoyingClient.DeleteTable("/dc-1/Dir", "TableOld"); - TString strResultAfter = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); + TString strResultAfter = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); UNIT_ASSERT_NO_DIFF(strResultAfter, strResult); // Delete the copy @@ -2218,8 +2218,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) { PrepareSourceTable(annoyingClient); - THashSet<ui64> datashards; - TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); + THashSet<ui64> datashards; + TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); datashards.insert(partitions.begin(), partitions.end()); // Copy the table @@ -2272,14 +2272,14 @@ Y_UNIT_TEST_SUITE(TFlatTest) { WriteRandomRows(annoyingClient, "Table", 666, 100); // Check that first partition of the original table is deleted after part is returned - WaitForTabletsToBeDeletedInHive(annoyingClient, cleverServer.GetRuntime(), THashSet<ui64>({partitions[0]})); + WaitForTabletsToBeDeletedInHive(annoyingClient, cleverServer.GetRuntime(), THashSet<ui64>({partitions[0]})); partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/Table"); datashards.insert(partitions.begin(), partitions.end()); - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); for (int i = 0; i < 5; ++i) { - TString strResultAfter = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); + TString strResultAfter = ReadFromTable(annoyingClient, "/dc-1/Dir/Table"); UNIT_ASSERT_NO_DIFF(strResultAfter, strResult); } @@ -2299,10 +2299,10 @@ Y_UNIT_TEST_SUITE(TFlatTest) { TFlatMsgBusClient annoyingClient(port); PrepareSourceTable(annoyingClient); - TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); + TString strResultOld = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); Cerr << strResultOld << Endl; - THashSet<ui64> datashards; + THashSet<ui64> datashards; auto oldShards = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); datashards.insert(oldShards.begin(), oldShards.end()); @@ -2322,7 +2322,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { // Drop first copy annoyingClient.DeleteTable("/dc-1/Dir", "Table"); - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/TableNew"); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/TableNew"); UNIT_ASSERT_NO_DIFF(strResult, strResultOld); // Drop original @@ -2349,12 +2349,12 @@ Y_UNIT_TEST_SUITE(TFlatTest) { WaitForTabletsToBeDeletedInHive(annoyingClient, cleverServer.GetRuntime(), datashards); } - void DoSplitMergeTable(TFlatMsgBusClient& annoyingClient, TString table, const TVector<ui64>& srcPartitions, const TVector<ui32>& splitPoints) { - TVector<ui64> partitionsBefore; + void DoSplitMergeTable(TFlatMsgBusClient& annoyingClient, TString table, const TVector<ui64>& srcPartitions, const TVector<ui32>& splitPoints) { + TVector<ui64> partitionsBefore; partitionsBefore = annoyingClient.GetTablePartitions(table); UNIT_ASSERT(partitionsBefore.size() > 0); - TString strResultBefore = ReadFromTable(annoyingClient, table); + TString strResultBefore = ReadFromTable(annoyingClient, table); TStringStream splitDescr; for (ui32 src : srcPartitions) { @@ -2365,22 +2365,22 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } annoyingClient.SplitTablePartition(table, splitDescr.Str()); - TVector<ui64> partitionsAfter; + TVector<ui64> partitionsAfter; partitionsAfter = annoyingClient.GetTablePartitions(table); UNIT_ASSERT_VALUES_EQUAL(partitionsAfter.size(), partitionsBefore.size() - srcPartitions.size() + splitPoints.size() + 1); // TODO: check paritions that were not supposed to change //UNIT_ASSERT_VALUES_EQUAL(partitionsAfter.back(), partitionsBefore.back()); - TString strResultAfter = ReadFromTable(annoyingClient, table); + TString strResultAfter = ReadFromTable(annoyingClient, table); UNIT_ASSERT_NO_DIFF(strResultBefore, strResultAfter); } - void SplitTable(TFlatMsgBusClient& annoyingClient, TString table, ui64 partitionIdx, const TVector<ui32>& splitPoints) { + void SplitTable(TFlatMsgBusClient& annoyingClient, TString table, ui64 partitionIdx, const TVector<ui32>& splitPoints) { DoSplitMergeTable(annoyingClient, table, {partitionIdx}, splitPoints); } - void MergeTable(TFlatMsgBusClient& annoyingClient, TString table, const TVector<ui64>& partitionIdxs) { + void MergeTable(TFlatMsgBusClient& annoyingClient, TString table, const TVector<ui64>& partitionIdxs) { DoSplitMergeTable(annoyingClient, table, partitionIdxs, {}); } @@ -2423,7 +2423,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { SplitTable(annoyingClient, "/dc-1/Dir/TableOld", 0, {100, 200}); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows = { + TMap<ui32, TString> rows = { {1, "AAA"}, {101, "BBB"}, {201, "CCC"}, @@ -2434,7 +2434,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } for (const auto& r : rows) { - TString val = ReadRow(annoyingClient, "TableOld", r.first); + TString val = ReadRow(annoyingClient, "TableOld", r.first); UNIT_ASSERT_VALUES_EQUAL(val, r.second); } @@ -2486,7 +2486,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { SplitTable(annoyingClient, "/dc-1/Dir/TableOld", 2, {300, 400}); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows = { + TMap<ui32, TString> rows = { {1, "AAA"}, {101, "BBB"}, {201, "CCC"}, @@ -2497,7 +2497,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } for (const auto& r : rows) { - TString val = ReadRow(annoyingClient, "TableOld", r.first); + TString val = ReadRow(annoyingClient, "TableOld", r.first); UNIT_ASSERT_VALUES_EQUAL(val, r.second); } @@ -2522,7 +2522,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { MergeTable(annoyingClient, "/dc-1/Dir/TableOld", {0, 1}); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows = { + TMap<ui32, TString> rows = { {1, "AAA"}, {101, "BBB"}, {201, "CCC"}, @@ -2533,7 +2533,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } for (const auto& r : rows) { - TString val = ReadRow(annoyingClient, "TableOld", r.first); + TString val = ReadRow(annoyingClient, "TableOld", r.first); UNIT_ASSERT_VALUES_EQUAL(val, r.second); } @@ -2556,7 +2556,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows = { + TMap<ui32, TString> rows = { {1, "AAA"}, {101, "BBB"}, {3000000201, "CCC"}, @@ -2569,7 +2569,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { MergeTable(annoyingClient, "/dc-1/Dir/TableOld", {0, 1}); for (const auto& r : rows) { - TString val = ReadRow(annoyingClient, "TableOld", r.first); + TString val = ReadRow(annoyingClient, "TableOld", r.first); UNIT_ASSERT_VALUES_EQUAL(val, r.second); } @@ -2653,7 +2653,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { MergeTable(annoyingClient, "/dc-1/Dir/TableOld", {0, 1}); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows = { + TMap<ui32, TString> rows = { {1, "AAA"}, {101, "BBB"}, {201, "CCC"}, @@ -2664,7 +2664,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } for (const auto& r : rows) { - TString val = ReadRow(annoyingClient, "TableOld", r.first); + TString val = ReadRow(annoyingClient, "TableOld", r.first); UNIT_ASSERT_VALUES_EQUAL(val, r.second); } @@ -2687,7 +2687,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows = { + TMap<ui32, TString> rows = { {1, "AAA"}, {101, "BBB"}, {201, "CCC"} @@ -2696,16 +2696,16 @@ Y_UNIT_TEST_SUITE(TFlatTest) { WriteRow(annoyingClient, "TableOld", r.first, r.second); } - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); SplitTable(annoyingClient, "/dc-1/Dir/TableOld", 0, {100, 200}); for (const auto& r : rows) { - TString val = ReadRow(annoyingClient, "TableOld", r.first); + TString val = ReadRow(annoyingClient, "TableOld", r.first); UNIT_ASSERT_VALUES_EQUAL(val, r.second); } - TString strResultAfter = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); + TString strResultAfter = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld"); UNIT_ASSERT_NO_DIFF(strResultAfter, strResult); annoyingClient.DeleteTable("/dc-1/Dir", "TableOld"); @@ -2727,7 +2727,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows ={ + TMap<ui32, TString> rows ={ {1, "AAA"}, {201, "BBB"}, {301, "CCC"} @@ -2739,12 +2739,12 @@ Y_UNIT_TEST_SUITE(TFlatTest) { WriteRow(annoyingClient, "TableOld", r.first, r.second); } - TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld", 201, false); + TString strResult = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld", 201, false); SplitTable(annoyingClient, "/dc-1/Dir/TableOld", 0, {100, 200}); for (const auto& r : rows) { - TString val = ReadRow(annoyingClient, "TableOld", r.first); + TString val = ReadRow(annoyingClient, "TableOld", r.first); UNIT_ASSERT_VALUES_EQUAL(val, r.second); } @@ -2760,7 +2760,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { } for (ui32 i = 0; i < 20; ++i) { // multiple rounds to move some reads to followers - TString strResultAfter = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld", 201, true); + TString strResultAfter = ReadFromTable(annoyingClient, "/dc-1/Dir/TableOld", 201, true); UNIT_ASSERT_NO_DIFF(strResultAfter, strResult); } @@ -2782,7 +2782,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows1 = { + TMap<ui32, TString> rows1 = { {1, "AAA"}, {101, "BBB"}, {201, "CCC"} @@ -2793,7 +2793,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { SplitTable(annoyingClient, "/dc-1/Dir/TableOld", 0, {100, 200}); - TMap<ui32, TString> rows2 = { + TMap<ui32, TString> rows2 = { {2, "2222AAA"}, {102, "2222BBB"}, {202, "2222CCC"} @@ -2805,7 +2805,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { for (auto tableId: annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld")) annoyingClient.KillTablet(cleverServer, tableId); - TMap<ui32, TString> rows = rows1; + TMap<ui32, TString> rows = rows1; rows.insert(rows2.begin(), rows2.end()); for (const auto& r : rows) { TString val = ReadRow(annoyingClient, "TableOld", r.first); @@ -2850,7 +2850,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { // cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG); // Write new rows to the copy in order to trigger compaction - TMap<ui32, TString> rows1 = { + TMap<ui32, TString> rows1 = { {1, "AAA"}, {101, "BBB"}, {201, "CCC"} @@ -2861,7 +2861,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { SplitTable(annoyingClient, "/dc-1/Dir/TableOld", 0, {100, 200}); - TMap<ui32, TString> rows2 = { + TMap<ui32, TString> rows2 = { {2, "2222AAA"}, {102, "2222BBB"}, {202, "2222CCC"} @@ -2872,10 +2872,10 @@ Y_UNIT_TEST_SUITE(TFlatTest) { SplitTable(annoyingClient, "/dc-1/Dir/TableOld", 1, {101}); - TMap<ui32, TString> rows = rows1; + TMap<ui32, TString> rows = rows1; rows.insert(rows2.begin(), rows2.end()); for (const auto& r : rows) { - TString val = ReadRow(annoyingClient, "TableOld", r.first); + TString val = ReadRow(annoyingClient, "TableOld", r.first); UNIT_ASSERT_VALUES_EQUAL(val, r.second); } @@ -2930,7 +2930,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { annoyingClient.MkDir("/dc-1", "Dir"); annoyingClient.CreateTable("/dc-1/Dir", tableDescr); - TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/T1"); + TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/T1"); UNIT_ASSERT_VALUES_EQUAL(partitions.size(), 1); // Force stats reporting without delays @@ -3241,7 +3241,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) { TFlatMsgBusClient annoyingClient(port); PrepareSourceTable(annoyingClient); - TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); + TVector<ui64> partitions = annoyingClient.GetTablePartitions("/dc-1/Dir/TableOld"); TAutoPtr<NKikimr::NMsgBusProxy::TBusTabletCountersRequest> request(new NKikimr::NMsgBusProxy::TBusTabletCountersRequest()); request->Record.SetTabletID(partitions[0]); diff --git a/ydb/core/client/flat_ut_client.h b/ydb/core/client/flat_ut_client.h index 07f5b30cc6b..8bcaff58b2a 100644 --- a/ydb/core/client/flat_ut_client.h +++ b/ydb/core/client/flat_ut_client.h @@ -84,12 +84,12 @@ public: runtime->Send(new IEventHandle(MakeTabletResolverID(), sender, new TEvTabletResolver::TEvTabletProblem(tabletId, TActorId()))); } - TVector<ui64> GetTablePartitions(const TString& tablePath) { + TVector<ui64> GetTablePartitions(const TString& tablePath) { TAutoPtr<NMsgBusProxy::TBusResponse> msg = Ls(tablePath); const NKikimrClient::TResponse &response = msg->Record; UNIT_ASSERT_VALUES_EQUAL(response.GetStatus(), NMsgBusProxy::MSTATUS_OK); const auto& descr = response.GetPathDescription(); - TVector<ui64> partitions; + TVector<ui64> partitions; for (ui32 i = 0; i < descr.TablePartitionsSize(); ++i) { partitions.push_back(descr.GetTablePartitions(i).GetDatashardId()); // Cerr << partitions.back() << Endl; diff --git a/ydb/core/client/locks_ut.cpp b/ydb/core/client/locks_ut.cpp index 47b7c3dfdd5..c93c755f73f 100644 --- a/ydb/core/client/locks_ut.cpp +++ b/ydb/core/client/locks_ut.cpp @@ -29,7 +29,7 @@ public: using TClient::FlatQuery; - void FlatQuery(const TString& mkql) { + void FlatQuery(const TString& mkql) { NKikimrMiniKQL::TResult res; TClient::TFlatQueryOptions opts; bool success = TClient::FlatQuery(mkql, opts, res); @@ -337,7 +337,7 @@ void TestLock(const TLocksTestOptions& testOpts) { } }; - TVector<NMiniKQL::IEngineFlat::TTxLock> txLocks; + TVector<NMiniKQL::IEngineFlat::TTxLock> txLocks; if (testOpts.NoLocks) { ui64 ssId = Max<ui64>(); @@ -487,7 +487,7 @@ void TestLock(const TLocksTestOptions& testOpts) { )) (return ret_) ))___"; - TString checkUpdated = Sprintf(checkUpdatedT, testOpts.Table, testOpts.UpdateKey); + TString checkUpdated = Sprintf(checkUpdatedT, testOpts.Table, testOpts.UpdateKey); cs.Client.FlatQuery(checkUpdated, res); { @@ -1135,7 +1135,7 @@ static void MultipleLocks() { (return ret_) ))___"; cs.Client.FlatQuery(q1, res); - TVector<NMiniKQL::IEngineFlat::TTxLock> locks1; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks1; ExtractResultLocks<TLocksVer>(res, locks1); { @@ -1167,7 +1167,7 @@ static void MultipleLocks() { (return ret_) ))___"; cs.Client.FlatQuery(q2, res); - TVector<NMiniKQL::IEngineFlat::TTxLock> locks2; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks2; ExtractResultLocks<TLocksVer>(res, locks2); { @@ -1188,7 +1188,7 @@ static void MultipleLocks() { (SetResult 'lock2 (SelectRow locksTable_ lockKey2_ lockCols_)) )) ))___"; - TString selectLocks = Sprintf(selectLocksT, + TString selectLocks = Sprintf(selectLocksT, TLocksVer::TableName(), TLocksVer::Columns(), TLocksVer::Key(locks1[0].LockId, locks1[0].DataShard, locks1[0].SchemeShard, locks1[0].PathId).data(), TLocksVer::Key(locks2[0].LockId, locks2[0].DataShard, locks2[0].SchemeShard, locks2[0].PathId).data(), @@ -1199,11 +1199,11 @@ static void MultipleLocks() { TValue result = TValue::Create(res.GetValue(), res.GetType()); - TVector<TString> names{"lock0", "lock1", "lock2"}; - TVector<NMiniKQL::IEngineFlat::TTxLock> outLocks; - TSet<ui64> uniqueLockId; - TSet<ui64> uniqueShards; - TSet<ui64> uniqueCounters; + TVector<TString> names{"lock0", "lock1", "lock2"}; + TVector<NMiniKQL::IEngineFlat::TTxLock> outLocks; + TSet<ui64> uniqueLockId; + TSet<ui64> uniqueShards; + TSet<ui64> uniqueCounters; for (const auto& name : names) { TValue lock = result[name]; UNIT_ASSERT(lock.HaveValue()); @@ -1240,8 +1240,8 @@ static void MultipleLocks() { TValue result = TValue::Create(res.GetValue(), res.GetType()); - TVector<TString> names{"lock0", "lock1", "lock2"}; - TVector<NMiniKQL::IEngineFlat::TTxLock> outLocks; + TVector<TString> names{"lock0", "lock1", "lock2"}; + TVector<NMiniKQL::IEngineFlat::TTxLock> outLocks; for (const auto& name : names) { TValue lock = result[name]; if (lock.HaveValue()) { @@ -1313,7 +1313,7 @@ static void SetLockNothing() { ))___"; cs.Client.FlatQuery(lockNothing, opts, res); - TVector<NMiniKQL::IEngineFlat::TTxLock> locks; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks; ExtractResultLocks<TLocksVer>(res, locks); for (const auto& l : locks) { TLocksVer::PrintLock(l); @@ -1342,7 +1342,7 @@ static void SetEraseSet() { ))___"; cs.Client.FlatQuery(Sprintf(queryT, 0), res); - TVector<NMiniKQL::IEngineFlat::TTxLock> locks1; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks1; ExtractResultLocks<TLocksVer>(res, locks1); { @@ -1362,7 +1362,7 @@ static void SetEraseSet() { TLocksVer::Key(locks1[0].LockId, locks1[0].DataShard, locks1[0].SchemeShard, locks1[0].PathId).data()), res); cs.Client.FlatQuery(Sprintf(queryT, locks1[0].LockId), res); - TVector<NMiniKQL::IEngineFlat::TTxLock> locks2; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks2; ExtractResultLocks<TLocksVer>(res, locks2); { @@ -1461,7 +1461,7 @@ static void SetBreakSetEraseBreak() { } #endif - TVector<NMiniKQL::IEngineFlat::TTxLock> locks; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks; ExtractResultLocks<TLocksVer>(res1, locks); { @@ -1674,7 +1674,7 @@ static void PointSetRemove() { )) ))___"; - TVector<NMiniKQL::IEngineFlat::TTxLock> locks; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks; for (ui64 i = 0; i < NUM_LOTS; ++i) { cs.Client.FlatQuery(Sprintf(setLock, i*2), res); // 0, 2, 4... ExtractResultLocks<TLocksVer>(res, locks); @@ -1777,7 +1777,7 @@ static void RangeSetRemove() { )) ))___"; - TVector<NMiniKQL::IEngineFlat::TTxLock> locks; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks; for (ui64 i = 0; i < NUM_LOTS; ++i) { cs.Client.FlatQuery(Sprintf(setLock, 2*i, 2*i+1), res); ExtractResultLocks<TLocksVer>(res, locks); @@ -1825,7 +1825,7 @@ static void LocksLimit() { ))"; Cout << "setting locks... " << Endl; - TVector<NMiniKQL::IEngineFlat::TTxLock> locks; + TVector<NMiniKQL::IEngineFlat::TTxLock> locks; locks.reserve(limit * 2); for (ui32 i = 0; i < limit; ++i) { diff --git a/ydb/core/client/metadata/types_metadata.cpp b/ydb/core/client/metadata/types_metadata.cpp index c1c2265734f..9b0455c7f79 100644 --- a/ydb/core/client/metadata/types_metadata.cpp +++ b/ydb/core/client/metadata/types_metadata.cpp @@ -3,11 +3,11 @@ #include <ydb/core/protos/scheme_type_metadata.pb.h> #include <ydb/core/scheme_types/scheme_type_metadata.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> namespace NKikimr { -void SerializeMetadata(const NScheme::TTypeMetadataRegistry& typesRegistry, TString* out) +void SerializeMetadata(const NScheme::TTypeMetadataRegistry& typesRegistry, TString* out) { NKikimrSchemeTypeMetadata::TMetadata metadata; for (const auto& type: typesRegistry) { @@ -25,7 +25,7 @@ void DeserializeMetadata(TStringBuf buffer, NScheme::TTypeMetadataRegistry* regi NKikimrSchemeTypeMetadata::TMetadata metadata; Y_VERIFY(metadata.ParseFromArray(buffer.data(), buffer.size())); - TVector<TTypeMetadata> deserializedMetadata; + TVector<TTypeMetadata> deserializedMetadata; deserializedMetadata.reserve(metadata.TypeSize()); for (const auto& protoType : metadata.GetType()) { TTypeMetadata typeMetadata( diff --git a/ydb/core/client/metadata/types_metadata.h b/ydb/core/client/metadata/types_metadata.h index ff366d513f3..3d008f3ce03 100644 --- a/ydb/core/client/metadata/types_metadata.h +++ b/ydb/core/client/metadata/types_metadata.h @@ -8,7 +8,7 @@ namespace NScheme { class TTypeMetadataRegistry; } // namespace NScheme -void SerializeMetadata(const NScheme::TTypeMetadataRegistry& typesRegistry, TString* out); +void SerializeMetadata(const NScheme::TTypeMetadataRegistry& typesRegistry, TString* out); void DeserializeMetadata(TStringBuf buffer, NScheme::TTypeMetadataRegistry* registry); } // namespace NKikimr diff --git a/ydb/core/client/metadata/ut/functions_metadata_ut.cpp b/ydb/core/client/metadata/ut/functions_metadata_ut.cpp index 0713c33e8dd..6e74d83050a 100644 --- a/ydb/core/client/metadata/ut/functions_metadata_ut.cpp +++ b/ydb/core/client/metadata/ut/functions_metadata_ut.cpp @@ -25,7 +25,7 @@ Y_UNIT_TEST_SUITE(TFunctionsMetadataTest) const auto functionRegistry = CreateBuiltinRegistry(); functionRegistry->Register("MyAdd", TFunctionDescriptor(AddUi32Metadata, nullptr)); - TString metadata; + TString metadata; SerializeMetadata(*functionRegistry, &metadata); DeserializeMetadata(metadata, *functionRegistry); diff --git a/ydb/core/client/minikql_compile/compile_context.h b/ydb/core/client/minikql_compile/compile_context.h index 22a9ebdf37e..41d882df254 100644 --- a/ydb/core/client/minikql_compile/compile_context.h +++ b/ydb/core/client/minikql_compile/compile_context.h @@ -31,7 +31,7 @@ struct TContext : public TAtomicRefCount<TContext> { TMaybe<IDbSchemeResolver::TTableResult> Response; }; - using TTableMap = THashMap<TString, TTableState>; + using TTableMap = THashMap<TString, TTableState>; TContext(const IFunctionRegistry* funcRegistry, const TTypeEnvironment* typeEnv); diff --git a/ydb/core/client/minikql_compile/compile_result.cpp b/ydb/core/client/minikql_compile/compile_result.cpp index 9891b7fc6f4..1596b771642 100644 --- a/ydb/core/client/minikql_compile/compile_result.cpp +++ b/ydb/core/client/minikql_compile/compile_result.cpp @@ -12,7 +12,7 @@ TMiniKQLCompileResult::TMiniKQLCompileResult(const TIssues& errors) { } -TMiniKQLCompileResult::TMiniKQLCompileResult(const TString& compiledProgram) +TMiniKQLCompileResult::TMiniKQLCompileResult(const TString& compiledProgram) : CompiledProgram(compiledProgram) { } diff --git a/ydb/core/client/minikql_compile/compile_result.h b/ydb/core/client/minikql_compile/compile_result.h index d92fd026030..3c86bedad50 100644 --- a/ydb/core/client/minikql_compile/compile_result.h +++ b/ydb/core/client/minikql_compile/compile_result.h @@ -17,9 +17,9 @@ struct TMiniKQLCompileResult { TMiniKQLCompileResult() = default; explicit TMiniKQLCompileResult(const TIssue& error); explicit TMiniKQLCompileResult(const TIssues& errors); - explicit TMiniKQLCompileResult(const TString& compiledProgram); + explicit TMiniKQLCompileResult(const TString& compiledProgram); TIssues Errors; - TString CompiledProgram; + TString CompiledProgram; }; } // namespace NYql diff --git a/ydb/core/client/minikql_compile/db_key_resolver.h b/ydb/core/client/minikql_compile/db_key_resolver.h index e748525fa81..c456963cd09 100644 --- a/ydb/core/client/minikql_compile/db_key_resolver.h +++ b/ydb/core/client/minikql_compile/db_key_resolver.h @@ -9,7 +9,7 @@ #include <util/generic/map.h> #include <util/generic/set.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <library/cpp/threading/future/future.h> @@ -22,8 +22,8 @@ using NKikimr::TTagDetails; class IDbSchemeResolver { public: struct TTable { - TString TableName; - TSet<TString> ColumnNames; + TString TableName; + TSet<TString> ColumnNames; ui64 RefreshAgainst = 0; }; @@ -34,7 +34,7 @@ public: LookupError = 2 }; - TTableResult(EStatus status, const TString& reason = TString()) + TTableResult(EStatus status, const TString& reason = TString()) : Status(status) , Reason(reason) {} @@ -47,20 +47,20 @@ public: }; EStatus Status; - TString Reason; + TString Reason; TTable Table; TAutoPtr<NKikimr::TTableId> TableId; ui32 KeyColumnCount = 0; - TMap<TString, TColumn> Columns; + TMap<TString, TColumn> Columns; ui64 CacheGeneration = 0; }; - using TTableResults = TVector<TTableResult>; + using TTableResults = TVector<TTableResult>; virtual ~IDbSchemeResolver() {} // Future-based API. - virtual NThreading::TFuture<TTableResults> ResolveTables(const TVector<TTable>& tables) = 0; + virtual NThreading::TFuture<TTableResults> ResolveTables(const TVector<TTable>& tables) = 0; // MessagePassing-based API. struct TEvents { diff --git a/ydb/core/client/minikql_compile/mkql_compile_service.cpp b/ydb/core/client/minikql_compile/mkql_compile_service.cpp index e01d61a22cc..e2f70dae2ed 100644 --- a/ydb/core/client/minikql_compile/mkql_compile_service.cpp +++ b/ydb/core/client/minikql_compile/mkql_compile_service.cpp @@ -15,11 +15,11 @@ namespace NKikimr { -TMiniKQLCompileServiceEvents::TEvCompile::TEvCompile(const TString& program) +TMiniKQLCompileServiceEvents::TEvCompile::TEvCompile(const TString& program) : Program(program) {} -TMiniKQLCompileServiceEvents::TEvCompileStatus::TEvCompileStatus(const TString& pgm, const NYql::TMiniKQLCompileResult& result) +TMiniKQLCompileServiceEvents::TEvCompileStatus::TEvCompileStatus(const TString& pgm, const NYql::TMiniKQLCompileResult& result) : Program(pgm) , Result(result) {} @@ -49,13 +49,13 @@ public: Alloc.Acquire(); } - TString Program; + TString Program; TActorId ResponseTo; NMiniKQL::TScopedAlloc Alloc; NMiniKQL::TTypeEnvironment TypeEnv; ui64 Cookie; bool Retried; - THashMap<TString, ui64> CompileResolveCookies; + THashMap<TString, ui64> CompileResolveCookies; bool ForceRefresh; }; @@ -160,7 +160,7 @@ private: private: const size_t COMPILE_INFLIGHT_LIMIT; - TQueue<TCompileContext::TPtr> CompileQueue; + TQueue<TCompileContext::TPtr> CompileQueue; using TCompilingMap = THashMap<TActorId, TCompileContext::TPtr>; TCompilingMap Compiling; diff --git a/ydb/core/client/minikql_compile/mkql_compile_service.h b/ydb/core/client/minikql_compile/mkql_compile_service.h index 4b0aca14917..6e63b8386fe 100644 --- a/ydb/core/client/minikql_compile/mkql_compile_service.h +++ b/ydb/core/client/minikql_compile/mkql_compile_service.h @@ -23,20 +23,20 @@ struct TMiniKQLCompileServiceEvents { static_assert(End < EventSpaceEnd(NActors::TEvents::ES_USERSPACE), "expect End < EventSpaceEnd(TEvents::ES_USERSPACE)"); struct TEvCompile : public NActors::TEventLocal<TEvCompile, Compile> { - explicit TEvCompile(const TString& program); + explicit TEvCompile(const TString& program); - TString Program; + TString Program; bool ForceRefresh = false; - THashMap<TString, ui64> CompileResolveCookies; + THashMap<TString, ui64> CompileResolveCookies; }; struct TEvCompileStatus : public NActors::TEventLocal<TEvCompileStatus, CompileStatus> { - TEvCompileStatus(const TString& program, const NYql::TMiniKQLCompileResult& result); + TEvCompileStatus(const TString& program, const NYql::TMiniKQLCompileResult& result); - TString Program; + TString Program; NYql::TMiniKQLCompileResult Result; - THashMap<TString, ui64> CompileResolveCookies; + THashMap<TString, ui64> CompileResolveCookies; }; }; diff --git a/ydb/core/client/minikql_compile/yql_expr_minikql.cpp b/ydb/core/client/minikql_compile/yql_expr_minikql.cpp index 76f38bf35cb..24c8ff068df 100644 --- a/ydb/core/client/minikql_compile/yql_expr_minikql.cpp +++ b/ydb/core/client/minikql_compile/yql_expr_minikql.cpp @@ -142,7 +142,7 @@ void CollectEraseRowKey(const TExprNode* child, TContext::TPtr ctx) { Y_ENSURE_EX(tupleItem->Child(0)->IsAtom() && !tupleItem->Child(0)->Content().empty(), TNodeException(tupleItem->Child(0)) << "Expected column name as non-empty atom."); - request.ColumnNames.insert(TString(tupleItem->Child(0)->Content())); + request.ColumnNames.insert(TString(tupleItem->Child(0)->Content())); } ctx->AddTableLookup(request); @@ -166,7 +166,7 @@ void CollectUpdateRowKey(const TExprNode* child, TContext::TPtr ctx) { Y_ENSURE_EX(tupleItem->Child(0)->IsAtom() && !tupleItem->Child(0)->Content().empty(), TNodeException(tupleItem->Child(0)) << "Expected column name as non-empty atom."); - request.ColumnNames.insert(TString(tupleItem->Child(0)->Content())); + request.ColumnNames.insert(TString(tupleItem->Child(0)->Content())); } auto updateTuple = child->Child(2); @@ -178,7 +178,7 @@ void CollectUpdateRowKey(const TExprNode* child, TContext::TPtr ctx) { Y_ENSURE_EX(tupleItem->Child(0)->IsAtom() && !tupleItem->Child(0)->Content().empty(), TNodeException(tupleItem->Child(0)) << "Expected column name as non-empty atom."); - request.ColumnNames.insert(TString(tupleItem->Child(0)->Content())); + request.ColumnNames.insert(TString(tupleItem->Child(0)->Content())); } ctx->AddTableLookup(request); @@ -202,7 +202,7 @@ void CollectSelectRowKey(const TExprNode* child, TContext::TPtr ctx) { Y_ENSURE_EX(tupleItem->Child(0)->IsAtom() && !tupleItem->Child(0)->Content().empty(), TNodeException(tupleItem->Child(0)) << "Expected column name as non-empty atom."); - request.ColumnNames.insert(TString(tupleItem->Child(0)->Content())); + request.ColumnNames.insert(TString(tupleItem->Child(0)->Content())); } auto selectTuple = child->Child(2); @@ -211,7 +211,7 @@ void CollectSelectRowKey(const TExprNode* child, TContext::TPtr ctx) { for (auto& tupleItem : selectTuple->Children()) { Y_ENSURE_EX(tupleItem->IsAtom() && !tupleItem->Content().empty(), TNodeException(*tupleItem) << "Expected column name as non-empty atom."); - request.ColumnNames.insert(TString(tupleItem->Content())); + request.ColumnNames.insert(TString(tupleItem->Content())); } ctx->AddTableLookup(request); @@ -238,7 +238,7 @@ void CollectSelectRangeKey(const TExprNode* child, TContext::TPtr ctx) { Y_ENSURE_EX(rangeItem->Child(0)->IsAtom() && !rangeItem->Child(0)->Content().empty(), TNodeException(rangeItem->Child(0)) << "Expected column name as non-empty atom."); - request.ColumnNames.insert(TString(rangeItem->Child(0)->Content())); + request.ColumnNames.insert(TString(rangeItem->Child(0)->Content())); } } @@ -248,7 +248,7 @@ void CollectSelectRangeKey(const TExprNode* child, TContext::TPtr ctx) { for (auto& tupleItem : selectTuple->Children()) { Y_ENSURE_EX(tupleItem->IsAtom() && !tupleItem->Content().empty(), TNodeException(*tupleItem) << "Expected column name as non-empty atom."); - request.ColumnNames.insert(TString(tupleItem->Content())); + request.ColumnNames.insert(TString(tupleItem->Content())); } ctx->AddTableLookup(request); @@ -377,7 +377,7 @@ private: const TTypeAnnotationNode* GetSelectType(IDbSchemeResolver::TTableResult* lookup, TExprNode& selectTuple, TExprContext& ctx) { - TVector<const TItemExprType*> resultItems; + TVector<const TItemExprType*> resultItems; for (auto& tupleItem : selectTuple.Children()) { auto columnName = tupleItem->Content(); @@ -535,7 +535,7 @@ private: auto selectType = GetSelectType(lookup, *selectTuple, ctx); auto listSelectType = ctx.MakeType<TListExprType>(selectType); - TVector<const TItemExprType*> resultItems; + TVector<const TItemExprType*> resultItems; resultItems.reserve(2); resultItems.push_back(ctx.MakeType<TItemExprType>("List", listSelectType)); auto boolType = ctx.MakeType<TDataExprType>(EDataSlot::Bool); @@ -618,7 +618,7 @@ private: } auto ui64Type = ctx.MakeType<TDataExprType>(EDataSlot::Uint64); - TVector<const TTypeAnnotationNode*> items; + TVector<const TTypeAnnotationNode*> items; items.reserve(2); items.push_back(ui64Type); items.push_back(ui64Type); @@ -647,7 +647,7 @@ private: IGraphTransformer::TStatus ParametersWrapper(TExprNode& node, TExprContext& ctx) { Y_ENSURE_EX(node.ChildrenSize() == 0, TNodeException(node) << "Parameters expects 0 args."); - auto structType = ctx.MakeType<TStructExprType>(TVector<const TItemExprType*>()); + auto structType = ctx.MakeType<TStructExprType>(TVector<const TItemExprType*>()); node.SetTypeAnn(structType); return TStatus::Ok; @@ -915,8 +915,8 @@ TIntrusivePtr<NCommon::IMkqlCallableCompiler> CreateMkqlCompiler(TContext::TPtr } auto rowTuple = node.Child(1); - TVector<TRuntimeNode> row(rowTuple->ChildrenSize()); - TVector<ui32> keyTypes(rowTuple->ChildrenSize()); + TVector<TRuntimeNode> row(rowTuple->ChildrenSize()); + TVector<ui32> keyTypes(rowTuple->ChildrenSize()); for (ui32 i = 0; i < rowTuple->ChildrenSize(); ++i) { auto columnName = rowTuple->Child(i)->Child(0)->Content(); auto column = lookup->Columns.FindPtr(columnName); @@ -926,7 +926,7 @@ TIntrusivePtr<NCommon::IMkqlCallableCompiler> CreateMkqlCompiler(TContext::TPtr keyTypes[i] = column->Type; } - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; FillColumnsToRead(lookup, node.Child(2), columnsToRead); auto readTargetNode = GetReadTargetNode(node, 3, ctx, mkqlContext); @@ -987,9 +987,9 @@ TIntrusivePtr<NCommon::IMkqlCallableCompiler> CreateMkqlCompiler(TContext::TPtr } TTableRangeOptions options = mkqlContext->PgmBuilder->GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(Max(fromComponents, toComponents)); - TVector<TRuntimeNode> from(fromComponents); - TVector<TRuntimeNode> to(toComponents); + TVector<ui32> keyTypes(Max(fromComponents, toComponents)); + TVector<TRuntimeNode> from(fromComponents); + TVector<TRuntimeNode> to(toComponents); ui32 keyIndex = 0; for (auto rangeItem : rangeTuple->Children()) { if (rangeItem->IsAtom()) { @@ -1031,7 +1031,7 @@ TIntrusivePtr<NCommon::IMkqlCallableCompiler> CreateMkqlCompiler(TContext::TPtr TVector<bool> forbidNullArgsTo(lookup->KeyColumnCount, false); options.ForbidNullArgsTo = forbidNullArgsTo; - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; FillColumnsToRead(lookup, node.Child(2), columnsToRead); auto optionsNode = node.Child(3); @@ -1074,8 +1074,8 @@ TIntrusivePtr<NCommon::IMkqlCallableCompiler> CreateMkqlCompiler(TContext::TPtr } auto rowTuple = node.Child(1); - TVector<TRuntimeNode> row(rowTuple->ChildrenSize()); - TVector<ui32> keyTypes(rowTuple->ChildrenSize()); + TVector<TRuntimeNode> row(rowTuple->ChildrenSize()); + TVector<ui32> keyTypes(rowTuple->ChildrenSize()); for (ui32 i = 0; i < rowTuple->ChildrenSize(); ++i) { auto columnName = rowTuple->Child(i)->Child(0)->Content(); auto column = lookup->Columns.FindPtr(columnName); @@ -1125,8 +1125,8 @@ TIntrusivePtr<NCommon::IMkqlCallableCompiler> CreateMkqlCompiler(TContext::TPtr } auto rowTuple = node.Child(1); - TVector<TRuntimeNode> row(rowTuple->ChildrenSize()); - TVector<ui32> keyTypes(rowTuple->ChildrenSize()); + TVector<TRuntimeNode> row(rowTuple->ChildrenSize()); + TVector<ui32> keyTypes(rowTuple->ChildrenSize()); for (ui32 i = 0; i < rowTuple->ChildrenSize(); ++i) { auto columnName = rowTuple->Child(i)->Child(0)->Content(); auto column = lookup->Columns.FindPtr(columnName); @@ -1292,9 +1292,9 @@ TRuntimeNode CompileNode(const TExprNode& node, TExprContext& exprCtx, TContext: } // anonymous namespace void CollectKeys(const TExprNode* root, TContext::TPtr ctx) { - TStack<const TExprNode*> activeNodes; + TStack<const TExprNode*> activeNodes; activeNodes.push(root); - THashSet<const TExprNode*> visited; + THashSet<const TExprNode*> visited; visited.insert(root); while (!activeNodes.empty()) { auto current = activeNodes.top(); @@ -1340,7 +1340,7 @@ ConvertToMiniKQL(TExprContainer::TPtr expr, CollectKeys(expr->Root.Get(), ctx); const auto& tablesToResolve = ctx->GetTablesToResolve(); if (!tablesToResolve.empty()) { - TVector<IDbSchemeResolver::TTable> requests; + TVector<IDbSchemeResolver::TTable> requests; requests.reserve(tablesToResolve.size()); for (const auto& x : tablesToResolve) { requests.push_back(x.second.Request); @@ -1415,7 +1415,7 @@ ConvertToMiniKQL(TExprContainer::TPtr expr, } -TMiniKQLCompileActorEvents::TEvCompileResult::TEvCompileResult(const TMiniKQLCompileResult& result, THashMap<TString, ui64> &&resolveCookies) +TMiniKQLCompileActorEvents::TEvCompileResult::TEvCompileResult(const TMiniKQLCompileResult& result, THashMap<TString, ui64> &&resolveCookies) : Result(result) , CompileResolveCookies(std::move(resolveCookies)) {} @@ -1426,11 +1426,11 @@ public: return NKikimrServices::TActivity::MINIKQL_COMPILE_ACTOR; } - TMiniKQLCompileActor(const TString& program, + TMiniKQLCompileActor(const TString& program, const NKikimr::NMiniKQL::TTypeEnvironment* typeEnv, IDbSchemeResolver* dbSchemeResolver, TActorId responseTo, - THashMap<TString, ui64> &&resolveRefreshCookies, + THashMap<TString, ui64> &&resolveRefreshCookies, bool forceCacheRefresh) : TypeEnv(typeEnv) , Program(program) @@ -1455,7 +1455,7 @@ public: Compiler = CreateMkqlCompiler(CompileCtx); const auto& tablesToResolve = CompileCtx->GetTablesToResolve(); if (!tablesToResolve.empty()) { - TVector<IDbSchemeResolver::TTable> requests; + TVector<IDbSchemeResolver::TTable> requests; requests.reserve(tablesToResolve.size()); for (auto& x : tablesToResolve) { requests.push_back(x.second.Request); @@ -1493,7 +1493,7 @@ public: private: void Handle(IDbSchemeResolver::TEvents::TEvResolveTablesResult::TPtr& ev, const TActorContext& ctx) { - THashMap<TString, ui64> compileResolveCookies; + THashMap<TString, ui64> compileResolveCookies; try { const auto& results = ev->Get()->Result; @@ -1586,13 +1586,13 @@ private: return true; } - TString CompileProgram() { + TString CompileProgram() { TRuntimeNode convertedNode = CompileNode(*Expr->Root, Expr->Context, CompileCtx, Compiler.Get()); TConvertResult convRes = CompileCtx->Finish(convertedNode); return NMiniKQL::SerializeRuntimeNode(convRes.Node, CompileCtx->PgmBuilder->GetTypeEnvironment()); } - void SendResponseAndDie(const TMiniKQLCompileResult& result, THashMap<TString, ui64> &&resolveCookies, const TActorContext& ctx) { + void SendResponseAndDie(const TMiniKQLCompileResult& result, THashMap<TString, ui64> &&resolveCookies, const TActorContext& ctx) { ctx.ExecutorThread.Send( new IEventHandle( ResponseTo, @@ -1610,21 +1610,21 @@ private: } const NKikimr::NMiniKQL::TTypeEnvironment* TypeEnv; - TString Program; + TString Program; TContext::TPtr CompileCtx; IDbSchemeResolver* DbSchemeResolver; TActorId ResponseTo; TExprContainer::TPtr Expr; TIntrusivePtr<NCommon::IMkqlCallableCompiler> Compiler; - THashMap<TString, ui64> ResolveRefreshCookies; + THashMap<TString, ui64> ResolveRefreshCookies; }; NActors::IActor* -CreateCompileActor(const TString& program, +CreateCompileActor(const TString& program, const NKikimr::NMiniKQL::TTypeEnvironment* typeEnv, IDbSchemeResolver* dbSchemeResolver, TActorId responseTo, - THashMap<TString, ui64> &&resolveRefreshCookies, + THashMap<TString, ui64> &&resolveRefreshCookies, bool forceCacheRefresh) { return new TMiniKQLCompileActor(program, typeEnv, dbSchemeResolver, responseTo, std::move(resolveRefreshCookies), forceCacheRefresh); diff --git a/ydb/core/client/minikql_compile/yql_expr_minikql.h b/ydb/core/client/minikql_compile/yql_expr_minikql.h index ab6011c105b..3d1ac8eec6e 100644 --- a/ydb/core/client/minikql_compile/yql_expr_minikql.h +++ b/ydb/core/client/minikql_compile/yql_expr_minikql.h @@ -44,20 +44,20 @@ struct TMiniKQLCompileActorEvents { }; static_assert(End < EventSpaceEnd(NActors::TEvents::ES_PRIVATE), "expect End < EventSpaceEnd(TEvents::ES_PRIVATE)"); struct TEvCompileResult : public NActors::TEventBase<TEvCompileResult, CompileResult> { - explicit TEvCompileResult(const TMiniKQLCompileResult& result, THashMap<TString, ui64> &&resolveCookies); + explicit TEvCompileResult(const TMiniKQLCompileResult& result, THashMap<TString, ui64> &&resolveCookies); DEFINE_SIMPLE_LOCAL_EVENT(TEvCompileResult, "EvCompileResult"); TMiniKQLCompileResult Result; - THashMap<TString, ui64> CompileResolveCookies; + THashMap<TString, ui64> CompileResolveCookies; }; }; NActors::IActor* -CreateCompileActor(const TString& program, +CreateCompileActor(const TString& program, const NKikimr::NMiniKQL::TTypeEnvironment* typeEnv, IDbSchemeResolver* dbSchemeResolver, NActors::TActorId responseTo, - THashMap<TString, ui64> &&resolveRefreshCookies, + THashMap<TString, ui64> &&resolveRefreshCookies, bool forceCacheRefresh); // TEvCompileResult. } // namespace NYql diff --git a/ydb/core/client/minikql_compile/yql_expr_minikql_compile_ut.cpp b/ydb/core/client/minikql_compile/yql_expr_minikql_compile_ut.cpp index 4fcdf735ba2..8ccecce0aa7 100644 --- a/ydb/core/client/minikql_compile/yql_expr_minikql_compile_ut.cpp +++ b/ydb/core/client/minikql_compile/yql_expr_minikql_compile_ut.cpp @@ -19,7 +19,7 @@ namespace { TScopedAlloc Alloc; TTypeEnvironment TypeEnv; TMockDbSchemeResolver DbSchemeResolver; - TVector<THolder<TKeyDesc>> DescList; + TVector<THolder<TKeyDesc>> DescList; TServices() : FunctionRegistry(CreateFunctionRegistry(CreateBuiltinRegistry())) @@ -40,7 +40,7 @@ namespace { } }; - bool TryProgramText2Bin(const TString& programText, TServices& services, TConvertResult& result) { + bool TryProgramText2Bin(const TString& programText, TServices& services, TConvertResult& result) { auto expr = ParseText(programText); auto resFuture = ConvertToMiniKQL(expr, services.FunctionRegistry.Get(), @@ -56,7 +56,7 @@ namespace { return true; } - TRuntimeNode ProgramText2Bin(const TString& programText, TServices& services) { + TRuntimeNode ProgramText2Bin(const TString& programText, TServices& services) { TConvertResult res; TryProgramText2Bin(programText, services, res); @@ -91,7 +91,7 @@ Y_UNIT_TEST_SUITE(TTestYqlToMiniKQLCompile) { Y_UNIT_TEST(CheckResolve) { TServices services; RegisterSampleTables(services); - TVector<IDbSchemeResolver::TTable> tablesToResolve; + TVector<IDbSchemeResolver::TTable> tablesToResolve; IDbSchemeResolver::TTable tableToResolve; tableToResolve.TableName = "table1"; tableToResolve.ColumnNames.insert("value"); @@ -246,7 +246,7 @@ Y_UNIT_TEST_SUITE(TTestYqlToMiniKQLCompile) { auto pgm = ProgramText2Bin(programText, services); services.ExtractKeys(pgm); UNIT_ASSERT_VALUES_EQUAL(services.DescList.size(), 2); - THashMap<TKeyDesc::ERowOperation, ui32> counters; + THashMap<TKeyDesc::ERowOperation, ui32> counters; for (ui32 i = 0; i < services.DescList.size(); ++i) { ++counters[services.DescList[i]->RowOperation]; } diff --git a/ydb/core/client/minikql_result_lib/converter_ut.cpp b/ydb/core/client/minikql_result_lib/converter_ut.cpp index 0fb5eff6211..b52bec807ce 100644 --- a/ydb/core/client/minikql_result_lib/converter_ut.cpp +++ b/ydb/core/client/minikql_result_lib/converter_ut.cpp @@ -20,7 +20,7 @@ Y_UNIT_TEST(TTestWithSimpleProgram) { Tests::TClient client(settings); client.InitRootScheme(); - const TString pgmText = R"___( + const TString pgmText = R"___( ( (let list (AsList (Uint32 '20) (Uint32 '10) (Uint32 '0))) (let opt (Just (String 'i_am_opt))) @@ -39,8 +39,8 @@ Y_UNIT_TEST(TTestWithSimpleProgram) { TStruct s = ConvertResult(result.GetValue(), result.GetType()); { - TListType l = s.GetMember<TOptional>("list").GetItem<TListType>(); - TVector<ui32> v; + TListType l = s.GetMember<TOptional>("list").GetItem<TListType>(); + TVector<ui32> v; for (ui32 item : l.MakeIterable<ui32>()) { v.push_back(item); } diff --git a/ydb/core/client/minikql_result_lib/list_funcs.inl b/ydb/core/client/minikql_result_lib/list_funcs.inl index 6fb2d46ab81..2fd2647bf02 100644 --- a/ydb/core/client/minikql_result_lib/list_funcs.inl +++ b/ydb/core/client/minikql_result_lib/list_funcs.inl @@ -2,80 +2,80 @@ template <typename T> -inline TListType::iterator<T>::iterator(google::protobuf::RepeatedPtrField<TProtoValue>::const_iterator item, const TProtoType& itemType) +inline TListType::iterator<T>::iterator(google::protobuf::RepeatedPtrField<TProtoValue>::const_iterator item, const TProtoType& itemType) : Item(item) , ItemType(itemType) { } template <typename T> -inline TListType::iterator<T>::iterator(const iterator& it) +inline TListType::iterator<T>::iterator(const iterator& it) : Item(it.Item) , ItemType(it.ItemType) { } template <typename T> -inline TListType::iterator<T>& TListType::iterator<T>::operator++() { +inline TListType::iterator<T>& TListType::iterator<T>::operator++() { ++Item; return *this; } template <typename T> -inline TListType::iterator<T> TListType::iterator<T>::operator++(int) { +inline TListType::iterator<T> TListType::iterator<T>::operator++(int) { iterator it(*this); ++(*this); return it; } template <typename T> -inline bool TListType::iterator<T>::operator!=(const iterator& it) const { +inline bool TListType::iterator<T>::operator!=(const iterator& it) const { return Item != it.Item; } template <typename T> -inline bool TListType::iterator<T>::operator==(const iterator& it) const { +inline bool TListType::iterator<T>::operator==(const iterator& it) const { return Item == it.Item; } template <typename T> -inline T TListType::iterator<T>::operator*() const { +inline T TListType::iterator<T>::operator*() const { return Get(); } template <typename T> -inline T TListType::iterator<T>::Get() const { +inline T TListType::iterator<T>::Get() const { ENSURE_KIND(ItemType, Data); auto schemeType = ItemType.GetData().GetScheme(); return NPrivate::GetData<T>(*Item, schemeType); } template <> -inline void TListType::iterator<void>::Get() const { +inline void TListType::iterator<void>::Get() const { return; } template <> -inline TOptional TListType::iterator<TOptional>::Get() const { +inline TOptional TListType::iterator<TOptional>::Get() const { return TOptional(*Item, ItemType); } template <> -inline TListType TListType::iterator<TListType>::Get() const { - return TListType(*Item, ItemType); +inline TListType TListType::iterator<TListType>::Get() const { + return TListType(*Item, ItemType); } template <> -inline TTuple TListType::iterator<TTuple>::Get() const { +inline TTuple TListType::iterator<TTuple>::Get() const { return TTuple(*Item, ItemType); } template <> -inline TStruct TListType::iterator<TStruct>::Get() const { +inline TStruct TListType::iterator<TStruct>::Get() const { return TStruct(*Item, ItemType); } template <> -inline TDict TListType::iterator<TDict>::Get() const { +inline TDict TListType::iterator<TDict>::Get() const { return TDict(*Item, ItemType); } diff --git a/ydb/core/client/minikql_result_lib/objects.h b/ydb/core/client/minikql_result_lib/objects.h index 4b5ae0da451..d1bed738ce1 100644 --- a/ydb/core/client/minikql_result_lib/objects.h +++ b/ydb/core/client/minikql_result_lib/objects.h @@ -17,7 +17,7 @@ using TProtoType = NKikimrMiniKQL::TType; using EProtoTypeKind = NKikimrMiniKQL::ETypeKind; class TOptional; -class TListType; +class TListType; class TTuple; class TStruct; class TDict; @@ -75,7 +75,7 @@ private: }; -class TListType { +class TListType { public: template <typename T> class iterator { @@ -99,7 +99,7 @@ public: template <typename T> class TIterableList { public: - TIterableList(const TListType& l) + TIterableList(const TListType& l) : List(l) { } @@ -113,11 +113,11 @@ public: } private: - const TListType& List; + const TListType& List; }; - explicit TListType(const TProtoValue& value, const TProtoType& type) + explicit TListType(const TProtoValue& value, const TProtoType& type) : RootValue(value) , RootType(type) , Size(RootValue.ListSize()) @@ -238,7 +238,7 @@ public: } template <typename K, typename V> - THashMap<K, V> GetHashMap() const; + THashMap<K, V> GetHashMap() const; private: const TProtoValue& RootValue; @@ -259,7 +259,7 @@ T TOptional::GetItem() const { #include "optional_funcs.inl" -// TListType. +// TListType. #include "list_funcs.inl" @@ -299,8 +299,8 @@ T TStruct::GetMember(size_t memberIndex) { // TDict. template <typename K, typename V> -THashMap<K, V> TDict::GetHashMap() const { - THashMap<K, V> m; +THashMap<K, V> TDict::GetHashMap() const { + THashMap<K, V> m; ui32 keySchemeType = RootType.GetDict().GetKey().GetData().GetScheme(); for (const auto& kvPair : RootValue.GetDict()) { auto dictKey = NPrivate::GetData<K>(kvPair.GetKey(), keySchemeType); diff --git a/ydb/core/client/minikql_result_lib/objects_ut.cpp b/ydb/core/client/minikql_result_lib/objects_ut.cpp index 49b3d300dcb..2dd024e75d8 100644 --- a/ydb/core/client/minikql_result_lib/objects_ut.cpp +++ b/ydb/core/client/minikql_result_lib/objects_ut.cpp @@ -46,14 +46,14 @@ Y_UNIT_TEST(TListTest) { value.AddList()->SetInt32(0); value.AddList()->SetInt32(100); - TListType l(value, type); + TListType l(value, type); UNIT_ASSERT_EQUAL(l.GetSize(), 3); UNIT_ASSERT_EQUAL(l.GetItem<i32>(0), -100); UNIT_ASSERT_EQUAL(l.GetItem<i32>(1), 0); UNIT_ASSERT_EQUAL(l.GetItem<i32>(2), 100); - TVector<i32> v; + TVector<i32> v; for (const auto& listItem : l.MakeIterable<i32>()) { v.push_back(listItem); } @@ -72,9 +72,9 @@ Y_UNIT_TEST(TListTest) { value.AddList()->MutableOptional()->SetInt32(-100); value.AddList()->MutableOptional()->SetInt32(0); value.AddList()->MutableOptional()->SetInt32(100); - TListType l(value, type); + TListType l(value, type); - TVector<i32> v; + TVector<i32> v; for (const TOptional& opt : l.MakeIterable<TOptional>()) { v.push_back(opt.GetItem<i32>()); } @@ -111,9 +111,9 @@ Y_UNIT_TEST(TTupleTest) { TOptional opt = t.GetElement<TOptional>(0); UNIT_ASSERT_EQUAL(opt.GetItem<i32>(), 911); - TListType l = t.GetElement<TListType>(1); + TListType l = t.GetElement<TListType>(1); - TVector<ui64> v; + TVector<ui64> v; for (ui64 item : l.MakeIterable<ui64>()) { v.push_back(item); } diff --git a/ydb/core/client/minikql_result_lib/optional_funcs.inl b/ydb/core/client/minikql_result_lib/optional_funcs.inl index 56cc00dcc79..5e839e92fe6 100644 --- a/ydb/core/client/minikql_result_lib/optional_funcs.inl +++ b/ydb/core/client/minikql_result_lib/optional_funcs.inl @@ -19,10 +19,10 @@ inline TOptional TOptional::GetItem<TOptional>() const { } template <> -inline TListType TOptional::GetItem<TListType>() const { +inline TListType TOptional::GetItem<TListType>() const { ENSURE_HAS_ITEM(); const auto& itemType = RootType.GetOptional().GetItem(); - return TListType(RootValue.GetOptional(), itemType); + return TListType(RootValue.GetOptional(), itemType); } template <> diff --git a/ydb/core/client/minikql_result_lib/struct_funcs.inl b/ydb/core/client/minikql_result_lib/struct_funcs.inl index 4c953878424..f2e7a519271 100644 --- a/ydb/core/client/minikql_result_lib/struct_funcs.inl +++ b/ydb/core/client/minikql_result_lib/struct_funcs.inl @@ -16,11 +16,11 @@ inline TOptional TStruct::GetMember<TOptional>(size_t memberIndex) { } template <> -inline TListType TStruct::GetMember<TListType>(size_t memberIndex) { +inline TListType TStruct::GetMember<TListType>(size_t memberIndex) { Y_ENSURE(CheckIndex(memberIndex), "Struct member index" << memberIndex << " is out of bounds."); const auto& memberType = RootType.GetStruct().GetMember(memberIndex).GetType(); const auto& member = RootValue.GetStruct(memberIndex); - return TListType(member, memberType); + return TListType(member, memberType); } template <> diff --git a/ydb/core/client/minikql_result_lib/tuple_funcs.inl b/ydb/core/client/minikql_result_lib/tuple_funcs.inl index 9c11f2f61ff..0798588dc98 100644 --- a/ydb/core/client/minikql_result_lib/tuple_funcs.inl +++ b/ydb/core/client/minikql_result_lib/tuple_funcs.inl @@ -16,11 +16,11 @@ inline TOptional TTuple::GetElement<TOptional>(size_t index) const { } template <> -inline TListType TTuple::GetElement<TListType>(size_t index) const { +inline TListType TTuple::GetElement<TListType>(size_t index) const { Y_ENSURE(CheckIndex(index), "Tuple element index" << index << " is out of bounds."); const auto& elementType = RootType.GetTuple().GetElement(index); const auto& element = RootValue.GetTuple(index); - return TListType(element, elementType); + return TListType(element, elementType); } template <> diff --git a/ydb/core/client/s3_listing_ut.cpp b/ydb/core/client/s3_listing_ut.cpp index 919c45dc467..b8ded5d1674 100644 --- a/ydb/core/client/s3_listing_ut.cpp +++ b/ydb/core/client/s3_listing_ut.cpp @@ -177,7 +177,7 @@ Y_UNIT_TEST_SUITE(TS3ListingTest) { void DoListingBySelectRange(TFlatMsgBusClient& annoyingClient, ui64 bucket, const TString& pathPrefix, const TString& pathDelimiter, const TString& startAfter, ui32 maxKeys, - TSet<TString>& commonPrefixes, TSet<TString>& contents) + TSet<TString>& commonPrefixes, TSet<TString>& contents) { // Read all rows from the bucket TString table = "Table"; @@ -209,7 +209,7 @@ Y_UNIT_TEST_SUITE(TS3ListingTest) { TValue value = TValue::Create(res.GetValue(), res.GetType()); TValue objects = value["Objects"]; TValue l = objects["List"]; - TVector<TString> paths; + TVector<TString> paths; for (ui32 i = 0; i < l.Size(); ++i) { TValue ps = l[i]; paths.emplace_back(ps["Path"]); @@ -242,8 +242,8 @@ Y_UNIT_TEST_SUITE(TS3ListingTest) { void DoS3Listing(TFlatMsgBusClient& annoyingClient, ui64 bucket, const TString& pathPrefix, const TString& pathDelimiter, const TString& startAfter, - const TVector<TString>& columnsToReturn, ui32 maxKeys, - TVector<TString>& commonPrefixes, TVector<TString>& contents) + const TVector<TString>& columnsToReturn, ui32 maxKeys, + TVector<TString>& commonPrefixes, TVector<TString>& contents) { TString pbPrefixCols = "Type {" @@ -300,12 +300,12 @@ Y_UNIT_TEST_SUITE(TS3ListingTest) { void CompareS3Listing(TFlatMsgBusClient& annoyingClient, ui64 bucket, const TString& pathPrefix, const TString& pathDelimiter, const TString& startAfter, ui32 maxKeys, const TVector<TString>& columnsToReturn) { - TSet<TString> expectedCommonPrefixes; - TSet<TString> expectedContents; + TSet<TString> expectedCommonPrefixes; + TSet<TString> expectedContents; DoListingBySelectRange(annoyingClient, bucket, pathPrefix, pathDelimiter, startAfter, maxKeys, expectedCommonPrefixes, expectedContents); - TVector<TString> commonPrefixes; - TVector<TString> contents; + TVector<TString> commonPrefixes; + TVector<TString> contents; DoS3Listing(annoyingClient, bucket, pathPrefix, pathDelimiter, startAfter, columnsToReturn, maxKeys, commonPrefixes, contents); UNIT_ASSERT_VALUES_EQUAL(expectedCommonPrefixes.size(), commonPrefixes.size()); diff --git a/ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp b/ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp index eb74fa36e94..275a62f1eb3 100644 --- a/ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp +++ b/ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp @@ -21,13 +21,13 @@ class TTableProxyActor : public TActorBootstrapped<TTableProxyActor> { const TActorId SchemeCache; const TActorId ResponseTo; - TVector<TTable> Tables; + TVector<TTable> Tables; void Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx) { const NSchemeCache::TSchemeCacheNavigate &request = *ev->Get()->Request; Y_VERIFY(request.ResultSet.size() == Tables.size()); - TVector<TTableResult> results; + TVector<TTableResult> results; results.reserve(Tables.size()); for (ui32 idx = 0, end = Tables.size(); idx != end; ++idx) { @@ -146,7 +146,7 @@ public: virtual ~TDbSchemeResolver() {} - virtual NThreading::TFuture<TTableResults> ResolveTables(const TVector<TTable>& tables) override { + virtual NThreading::TFuture<TTableResults> ResolveTables(const TVector<TTable>& tables) override { TTableResults results; for (auto& table : tables) { TTableResult result(TTableResult::Error, "Not implemented"); diff --git a/ydb/core/client/server/grpc_proxy_status.cpp b/ydb/core/client/server/grpc_proxy_status.cpp index 827335ad408..3a655338141 100644 --- a/ydb/core/client/server/grpc_proxy_status.cpp +++ b/ydb/core/client/server/grpc_proxy_status.cpp @@ -320,7 +320,7 @@ class TChooseProxyActor : public TActorBootstrapped<TChooseProxyActor>, public N using TBase = TActorBootstrapped<TChooseProxyActor>; THolder<NMsgBusProxy::TBusChooseProxy> Request; - THashMap<ui32, TString> NodeNames; + THashMap<ui32, TString> NodeNames; THashMap<ui32, TString> NodeDataCenter; THashMap<ui32, std::shared_ptr<TEvGRpcProxyStatus::TEvGetStatusResponse>> PerNodeResponse; diff --git a/ydb/core/client/server/msgbus_http_server.cpp b/ydb/core/client/server/msgbus_http_server.cpp index e535ebe3350..d27c76eae67 100644 --- a/ydb/core/client/server/msgbus_http_server.cpp +++ b/ydb/core/client/server/msgbus_http_server.cpp @@ -37,14 +37,14 @@ public: virtual void GetInFlightBulk(::TArrayRef<const NBus::TNetAddr>, TArrayRef<size_t>) const override {} virtual void GetConnectSyscallsNumBulkForTest(::TArrayRef<const NBus::TNetAddr>, TArrayRef<size_t>) const override {} virtual int GetInFlight() const noexcept override { return 1; } - virtual TString GetStatus(ui16) override { return TString(); } + virtual TString GetStatus(ui16) override { return TString(); } virtual NBus::TConnectionStatusMonRecord GetStatusProtobuf() override { return NBus::TConnectionStatusMonRecord(); } virtual NBus::NPrivate::TSessionDumpStatus GetStatusRecordInternal() override { return NBus::NPrivate::TSessionDumpStatus(); } - virtual TString GetStatusSingleLine() override { return TString(); } + virtual TString GetStatusSingleLine() override { return TString(); } virtual const NBus::TBusSessionConfig* GetConfig() const noexcept override { return &Config; } virtual const NBus::TBusProtocol* GetProto() const noexcept override { return &Protocol; } virtual NBus::TBusMessageQueue* GetQueue() const noexcept override { return nullptr; } - virtual TString GetNameInternal() override { return TString(); } + virtual TString GetNameInternal() override { return TString(); } virtual void Shutdown() override {} virtual void PauseInput(bool) override {} virtual unsigned GetActualListenPort() override { return 0; } @@ -181,7 +181,7 @@ void TMessageBusHttpServer::Output(NMonitoring::IMonHttpRequest& request) { const ::google::protobuf::Descriptor* msgDescriptor = message->GetRecord()->GetDescriptor(); if (msgDescriptor->name() == "TJSON") { NKikimrClient::TJSON* json(static_cast<NKikimrClient::TJSON*>(message->GetRecord())); - json->SetJSON(TString(postContent)); + json->SetJSON(TString(postContent)); } else { static NJson::TJsonReaderConfig readerConfig; static NProtobufJson::TJson2ProtoConfig protoConfig; diff --git a/ydb/core/client/server/msgbus_http_server.h b/ydb/core/client/server/msgbus_http_server.h index 911978c422e..c48df9475d4 100644 --- a/ydb/core/client/server/msgbus_http_server.h +++ b/ydb/core/client/server/msgbus_http_server.h @@ -12,7 +12,7 @@ namespace NMsgBusProxy { class IMessageBusHttpServer : public NMonitoring::IMonPage { public: - IMessageBusHttpServer(const TString& path, TIntrusivePtr<NMonitoring::TDynamicCounters> counters) + IMessageBusHttpServer(const TString& path, TIntrusivePtr<NMonitoring::TDynamicCounters> counters) : NMonitoring::IMonPage(path) , Counters(counters) {} diff --git a/ydb/core/client/server/msgbus_server.cpp b/ydb/core/client/server/msgbus_server.cpp index 8a4d8a3bbd5..9d84365c103 100644 --- a/ydb/core/client/server/msgbus_server.cpp +++ b/ydb/core/client/server/msgbus_server.cpp @@ -402,7 +402,7 @@ public: void Bootstrap(const TActorContext &ctx) { WhiteboardServiceId = NNodeWhiteboard::MakeNodeWhiteboardServiceId(ctx.SelfID.NodeId()); ctx.Send(WhiteboardServiceId, new NNodeWhiteboard::TEvWhiteboard::TEvSystemStateAddEndpoint("mbus", Sprintf(":%d", Session->GetProto()->GetPort()))); - Become(&TMessageBusMonitorActor::StateWork, ctx, TDuration::MicroSeconds(Interval), new TEvPrivate::TEvUpdateMsgBusStats()); + Become(&TMessageBusMonitorActor::StateWork, ctx, TDuration::MicroSeconds(Interval), new TEvPrivate::TEvUpdateMsgBusStats()); } protected: @@ -421,7 +421,7 @@ protected: systemStateInfo.SetMessageBusState(NKikimrWhiteboard::EFlag::Red); } ctx.Send(WhiteboardServiceId, new NNodeWhiteboard::TEvWhiteboard::TEvSystemStateUpdate(systemStateInfo)); - ctx.Schedule(TDuration::MicroSeconds(Interval), new TEvPrivate::TEvUpdateMsgBusStats()); + ctx.Schedule(TDuration::MicroSeconds(Interval), new TEvPrivate::TEvUpdateMsgBusStats()); } STFUNC(StateWork) { diff --git a/ydb/core/client/server/msgbus_server_db.cpp b/ydb/core/client/server/msgbus_server_db.cpp index 08f3d717864..8a9c78c2f0f 100644 --- a/ydb/core/client/server/msgbus_server_db.cpp +++ b/ydb/core/client/server/msgbus_server_db.cpp @@ -39,7 +39,7 @@ namespace { struct TEvReply : public TEventLocal<TEvReply, EvReply> { EResponseStatus Status; TEvTxUserProxy::TResultStatus::EStatus ProxyStatus; - TString Message; + TString Message; NKikimrTxUserProxy::TEvProposeTransactionStatus Result; TEvReply(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message) @@ -69,7 +69,7 @@ public: , Request(static_cast<RequestType*>(msg.ReleaseMessage())) {} - void ReplyWithErrorToInterface(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext&) { + void ReplyWithErrorToInterface(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext&) { TAutoPtr<TBusResponse> response(new TBusResponseStatus(status, message)); if (proxyStatus != TEvTxUserProxy::TResultStatus::Unknown) response->Record.SetProxyErrorCode(proxyStatus); @@ -173,7 +173,7 @@ public: : HostActor(hostActor) {} - void ReplyWithErrorToInterface(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext& ctx) { + void ReplyWithErrorToInterface(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext& ctx) { ctx.Send(HostActor, new TEvPrivate::TEvReply(status, proxyStatus, message)); } @@ -199,7 +199,7 @@ protected: TAutoPtr<NSchemeCache::TSchemeCacheNavigate> CacheNavigate; NJson::TJsonValue JSON; THPTimer StartTime; - TString Table; + TString Table; TString SecurityToken; // raw input TString UserToken; // built and serialized ui32 Requests = 0; @@ -219,7 +219,7 @@ protected: CompleteRequest(ctx); } - void ReplyWithError(EResponseStatus status, const TString& message, const TActorContext& ctx) { + void ReplyWithError(EResponseStatus status, const TString& message, const TActorContext& ctx) { ReplyWithError(status, TEvTxUserProxy::TResultStatus::Unknown, message, ctx); } @@ -326,7 +326,7 @@ public: } } - void ResolveTable(const TString& table, const NActors::TActorContext& ctx) { + void ResolveTable(const TString& table, const NActors::TActorContext& ctx) { TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate()); NSchemeCache::TSchemeCacheNavigate::TEntry entry; entry.Path = SplitPath(table); @@ -381,9 +381,9 @@ public: } void BuildProgram(const NJson::TJsonValue& json, NMiniKQL::TRuntimeNode& pgmReturn, NMiniKQL::TKikimrProgramBuilder& pgmBuilder, const NSchemeCache::TSchemeCacheNavigate::TEntry& tableInfo, - const TVector<const NTxProxy::TTableColumnInfo*>& keys, const THashMap<TString, const NTxProxy::TTableColumnInfo*>& columnByName, TVector<NMiniKQL::TRuntimeNode>& result) { - TVector<NMiniKQL::TRuntimeNode> keyColumns; - TVector<ui32> keyTypes; + const TVector<const NTxProxy::TTableColumnInfo*>& keys, const THashMap<TString, const NTxProxy::TTableColumnInfo*>& columnByName, TVector<NMiniKQL::TRuntimeNode>& result) { + TVector<NMiniKQL::TRuntimeNode> keyColumns; + TVector<ui32> keyTypes; keyTypes.reserve(keys.size()); for (const NTxProxy::TTableColumnInfo* key : keys) { Y_VERIFY(key != nullptr); @@ -419,7 +419,7 @@ public: NJson::TJsonValue jsonSelect; if (json.GetValue("Select", &jsonSelect)) { - TVector<NMiniKQL::TSelectColumn> columnsToRead; + TVector<NMiniKQL::TSelectColumn> columnsToRead; if (jsonSelect.IsArray()) { const NJson::TJsonValue::TArray& array = jsonSelect.GetArray(); columnsToRead.reserve(array.size()); @@ -445,7 +445,7 @@ public: result.emplace_back(pgmBuilder.SelectRow(tableInfo.TableId, keyTypes, columnsToRead, keyColumns, readTarget)); } else { NMiniKQL::TTableRangeOptions tableRangeOptions = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<NMiniKQL::TRuntimeNode> keyFromColumns = keyColumns; + TVector<NMiniKQL::TRuntimeNode> keyFromColumns = keyColumns; for (size_t i = keyColumns.size(); i < keyTypes.size(); ++i) { keyFromColumns.emplace_back(pgmBuilder.NewEmptyOptionalDataLiteral(keyTypes[i])); } @@ -458,7 +458,7 @@ public: NJson::TJsonValue jsonUpdate; if (json.GetValue("Update", &jsonUpdate)) { - const NJson::TJsonValue::TMapType& jsonMap = jsonUpdate.GetMap(); + const NJson::TJsonValue::TMapType& jsonMap = jsonUpdate.GetMap(); for (auto itVal = jsonMap.begin(); itVal != jsonMap.end(); ++itVal) { auto itCol = columnByName.find(itVal->first); if (itCol != columnByName.end()) { @@ -497,9 +497,9 @@ public: NMiniKQL::TKikimrProgramBuilder pgmBuilder(env, functionRegistry); NMiniKQL::TRuntimeNode pgmReturn = pgmBuilder.NewEmptyListOfVoid(); const NSchemeCache::TSchemeCacheNavigate::TEntry& tableInfo = CacheNavigate->ResultSet.front(); - TVector<const NTxProxy::TTableColumnInfo*> keys; - THashMap<TString, const NTxProxy::TTableColumnInfo*> columnByName; - TVector<NMiniKQL::TRuntimeNode> result; + TVector<const NTxProxy::TTableColumnInfo*> keys; + THashMap<TString, const NTxProxy::TTableColumnInfo*> columnByName; + TVector<NMiniKQL::TRuntimeNode> result; // reordering key columns for (auto itCol = tableInfo.Columns.begin(); itCol != tableInfo.Columns.end(); ++itCol) { @@ -521,7 +521,7 @@ public: } NMiniKQL::TRuntimeNode node = pgmBuilder.Build(pgmReturn); - TString bin = NMiniKQL::SerializeRuntimeNode(node, env); + TString bin = NMiniKQL::SerializeRuntimeNode(node, env); DbOperationsCounters->RequestPrepareTimeHistogram.Add(StartTime.Passed() * 1000/*ms*/); @@ -597,7 +597,7 @@ protected: TIntrusivePtr<TMessageBusDbOpsCounters> DbOperationsCounters; NJson::TJsonValue JSON; THashMap<TTabletId, TActorId> Pipes; - TDeque<TAutoPtr<TEvTxUserProxy::TEvProposeTransaction>> Requests; + TDeque<TAutoPtr<TEvTxUserProxy::TEvProposeTransaction>> Requests; THPTimer StartTime; TString SecurityToken; TString UserToken; // built and serialized @@ -609,12 +609,12 @@ protected: Die(ctx); } - void ReplyWithError(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext& ctx) { + void ReplyWithError(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext& ctx) { InterfaceBase::ReplyWithErrorToInterface(status, proxyStatus, message, ctx); CompleteRequest(ctx); } - void ReplyWithError(EResponseStatus status, const TString& message, const TActorContext& ctx) { + void ReplyWithError(EResponseStatus status, const TString& message, const TActorContext& ctx) { ReplyWithError(status, TEvTxUserProxy::TResultStatus::Unknown, message, ctx); } @@ -770,7 +770,7 @@ public: } void BuildRequests(const TActorContext& ctx) { - TString path; + TString path; NJson::TJsonValue jsonPath; if (JSON.GetValue("Path", &jsonPath)) { path = jsonPath.GetString(); @@ -824,7 +824,7 @@ public: NJson::TJsonValue jsonCreateTable; if (JSON.GetValue("CreateTable", &jsonCreateTable)) { - const NJson::TJsonValue::TMapType& jsonTables = jsonCreateTable.GetMap(); + const NJson::TJsonValue::TMapType& jsonTables = jsonCreateTable.GetMap(); for (auto itTable = jsonTables.begin(); itTable != jsonTables.end(); ++itTable) { TAutoPtr<TEvTxUserProxy::TEvProposeTransaction> Proposal(new TEvTxUserProxy::TEvProposeTransaction()); NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme()); @@ -835,7 +835,7 @@ public: // parsing CreateTable/<name>/Columns NJson::TJsonValue jsonColumn; if (itTable->second.GetValue("Columns", &jsonColumn)) { - const NJson::TJsonValue::TMapType& jsonColumns = jsonColumn.GetMap(); + const NJson::TJsonValue::TMapType& jsonColumns = jsonColumn.GetMap(); for (auto itColumn = jsonColumns.begin(); itColumn != jsonColumns.end(); ++itColumn) { NKikimrSchemeOp::TColumnDescription& column(*createTable.AddColumns()); column.SetName(itColumn->first); @@ -914,8 +914,8 @@ protected: TActorId SchemeCache; TIntrusivePtr<TMessageBusDbOpsCounters> DbOperationsCounters; NJson::TJsonValue JSON; - TDeque<TAutoPtr<IActor>> Operations; - TDeque<TAutoPtr<TEvPrivate::TEvReply>> Replies; + TDeque<TAutoPtr<IActor>> Operations; + TDeque<TAutoPtr<TEvPrivate::TEvReply>> Replies; int MaxInFlight; int CurrentInFlight; TString SecurityToken; @@ -924,12 +924,12 @@ protected: TBase::Die(ctx); } - void ReplyWithError(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext& ctx) { + void ReplyWithError(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext& ctx) { InterfaceBase::ReplyWithErrorToInterface(status, proxyStatus, message, ctx); CompleteRequest(ctx); } - void ReplyWithError(EResponseStatus status, const TString& message, const TActorContext& ctx) { + void ReplyWithError(EResponseStatus status, const TString& message, const TActorContext& ctx) { ReplyWithError(status, TEvTxUserProxy::TResultStatus::Unknown, message, ctx); } @@ -964,7 +964,7 @@ protected: if (CurrentInFlight == 0) { NKikimrTxUserProxy::TEvProposeTransactionStatus mergedResult; EResponseStatus status = MSTATUS_OK; - TString message; + TString message; for (const TAutoPtr<TEvPrivate::TEvReply>& reply : Replies) { if (status == MSTATUS_OK && reply->Status != MSTATUS_OK) { status = reply->Status; diff --git a/ydb/core/client/server/msgbus_server_get.cpp b/ydb/core/client/server/msgbus_server_get.cpp index 326de522b12..d33fa366960 100644 --- a/ydb/core/client/server/msgbus_server_get.cpp +++ b/ydb/core/client/server/msgbus_server_get.cpp @@ -57,7 +57,7 @@ public: IssueResponse(ctx); } - void IssueErrorResponse(TString message, const TActorContext& ctx) { + void IssueErrorResponse(TString message, const TActorContext& ctx) { Response.SetErrorDescription(message); IssueResponse(ctx); } diff --git a/ydb/core/client/server/msgbus_server_hive_create_tablet.cpp b/ydb/core/client/server/msgbus_server_hive_create_tablet.cpp index 0c41e53f090..45b7836cb7a 100644 --- a/ydb/core/client/server/msgbus_server_hive_create_tablet.cpp +++ b/ydb/core/client/server/msgbus_server_hive_create_tablet.cpp @@ -23,7 +23,7 @@ using TBase = TActorBootstrapped<TMessageBusHiveCreateTablet<ResponseType>>; ui64 OwnerId; ui64 OwnerIdx; TTabletTypes::EType TabletType; - TVector<ui32> AllowedNodeIDs; + TVector<ui32> AllowedNodeIDs; TVector<TSubDomainKey> AllowedDomains; TChannelsBindings BindedChannels; @@ -59,11 +59,11 @@ using TBase = TActorBootstrapped<TMessageBusHiveCreateTablet<ResponseType>>; bool WithRetry; TActorId PipeClient; - TDeque<TRequest> Requests; + TDeque<TRequest> Requests; NKikimrProto::EReplyStatus Status; ui32 ResponsesReceived; ui32 DomainUid; - TString ErrorReason; + TString ErrorReason; public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { return NKikimrServices::TActivity::MSGBUS_COMMON; diff --git a/ydb/core/client/server/msgbus_server_ic_debug.cpp b/ydb/core/client/server/msgbus_server_ic_debug.cpp index 7757757fee6..2871dc1ea68 100644 --- a/ydb/core/client/server/msgbus_server_ic_debug.cpp +++ b/ydb/core/client/server/msgbus_server_ic_debug.cpp @@ -55,10 +55,10 @@ public: params.SizeMin = record.GetSizeMin(); params.SizeMax = record.GetSizeMax(); params.InFlyMax = record.GetInFlyMax(); - params.IntervalMin = TDuration::MicroSeconds(record.GetIntervalMin()); - params.IntervalMax = TDuration::MicroSeconds(record.GetIntervalMax()); + params.IntervalMin = TDuration::MicroSeconds(record.GetIntervalMin()); + params.IntervalMax = TDuration::MicroSeconds(record.GetIntervalMax()); params.SoftLoad = record.GetSoftLoad(); - params.Duration = TDuration::MicroSeconds(record.GetDuration()); + params.Duration = TDuration::MicroSeconds(record.GetDuration()); params.UseProtobufWithPayload = record.GetUseProtobufWithPayload(); Callback = [=](const TActorContext& ctx) { ui32 poolId = 0; diff --git a/ydb/core/client/server/msgbus_server_keyvalue.cpp b/ydb/core/client/server/msgbus_server_keyvalue.cpp index ad644f4c269..e93d8c84c0e 100644 --- a/ydb/core/client/server/msgbus_server_keyvalue.cpp +++ b/ydb/core/client/server/msgbus_server_keyvalue.cpp @@ -38,7 +38,7 @@ public: } NBus::TBusMessage* CreateErrorReply(EResponseStatus status, const TActorContext &ctx, - const TString& text = TString()) override { + const TString& text = TString()) override { LOG_WARN_S(ctx, NKikimrServices::MSGBUS_REQUEST, "TMessageBusKeyValue TabletId# " << TabletId << " status# " << status << " text# \"" << text << "\" Marker# MBKV2" << Endl); diff --git a/ydb/core/client/server/msgbus_server_load.cpp b/ydb/core/client/server/msgbus_server_load.cpp index 4c9bee8ea0a..40c102e4e1e 100644 --- a/ydb/core/client/server/msgbus_server_load.cpp +++ b/ydb/core/client/server/msgbus_server_load.cpp @@ -5,7 +5,7 @@ namespace NKikimr { namespace NMsgBusProxy { class TBsTestLoadActorRequest : public TActorBootstrapped<TBsTestLoadActorRequest>, public TMessageBusSessionIdentHolder { - TVector<ui32> NodeIds; + TVector<ui32> NodeIds; NKikimrBlobStorage::TEvTestLoadRequest Cmd; NKikimrClient::TBsTestLoadResponse Response; ui32 ResponsesPending; @@ -30,7 +30,7 @@ public: ctx.Send(MakeBlobStorageLoadID(nodeId), msg.Release()); ++ResponsesPending; } - TVector<ui32>().swap(NodeIds); + TVector<ui32>().swap(NodeIds); Become(&TBsTestLoadActorRequest::StateFunc); CheckResponse(ctx); } diff --git a/ydb/core/client/server/msgbus_server_persqueue.cpp b/ydb/core/client/server/msgbus_server_persqueue.cpp index 78b83ef3a3b..f4057295fa9 100644 --- a/ydb/core/client/server/msgbus_server_persqueue.cpp +++ b/ydb/core/client/server/msgbus_server_persqueue.cpp @@ -139,8 +139,8 @@ NKikimrClient::TResponse CreateErrorReply(EResponseStatus status, NPersQueue::NE } struct TTopicInfo { - TVector<ui64> Tablets; - THashMap<ui32, ui64> PartitionToTablet; + TVector<ui64> Tablets; + THashMap<ui32, ui64> PartitionToTablet; ui64 BalancerTabletId = 0; THolder<NKikimrPQ::TReadSessionsInfoResponse> ReadSessionsInfo; @@ -148,20 +148,20 @@ struct TTopicInfo { NKikimrPQ::TPQTabletConfig Config; TIntrusiveConstPtr<TSchemeCacheNavigate::TPQGroupInfo> PQInfo; ui32 NumParts = 0; - THashSet<ui32> PartitionsToRequest; + THashSet<ui32> PartitionsToRequest; //fetchRequest part - THashMap<ui32, TAutoPtr<TEvPersQueue::TEvHasDataInfo>> FetchInfo; + THashMap<ui32, TAutoPtr<TEvPersQueue::TEvHasDataInfo>> FetchInfo; }; struct TTabletInfo { ui32 NodeId = 0; - TString Topic; + TString Topic; TActorId PipeClient; bool BrokenPipe = false; bool IsBalancer = false; - TVector<NKikimrPQ::TOffsetsResponse::TPartResult> OffsetResponses; - TVector<NKikimrPQ::TStatusResponse::TPartResult> StatusResponses; + TVector<NKikimrPQ::TOffsetsResponse::TPartResult> OffsetResponses; + TVector<NKikimrPQ::TStatusResponse::TPartResult> StatusResponses; }; TPersQueueBaseRequestProcessor::TPersQueueBaseRequestProcessor(const NKikimrClient::TPersQueueRequest& request, const TActorId& pqMetaCacheId, bool listNodes) @@ -437,7 +437,7 @@ class TMessageBusServerPersQueueImpl : public TActorBootstrapped<TMessageBusServ protected: NKikimrClient::TPersQueueRequest RequestProto; - const TString RequestId; + const TString RequestId; const bool IsMetaRequest; const bool IsFetchRequest; @@ -452,16 +452,16 @@ protected: TAutoPtr<TEvInterconnect::TEvNodesInfo> NodesInfo; - THashMap<TString, TTopicInfo> TopicInfo; - THashMap<ui64, TTabletInfo> TabletInfo; + THashMap<TString, TTopicInfo> TopicInfo; + THashMap<ui64, TTabletInfo> TabletInfo; ui32 TopicsAnswered; THashSet<ui64> TabletsDiscovered; - THashSet<ui64> TabletsAnswered; + THashSet<ui64> TabletsAnswered; ui32 AclRequests; ui32 DescribeRequests; ui32 PartTabletsRequested; - TString ErrorReason; + TString ErrorReason; bool NoTopicsAtStart; public: @@ -579,7 +579,7 @@ public: { auto& meta = RequestProto.GetMetaRequest(); - THashMap<ui32, TString> hostName(NodesInfo->Nodes.size()); + THashMap<ui32, TString> hostName(NodesInfo->Nodes.size()); for (const auto& n : NodesInfo->Nodes) hostName.insert(std::make_pair(n.NodeId, n.Host)); @@ -722,7 +722,7 @@ public: record.SetErrorCode(NPersQueue::NErrorCode::OK); auto stat = record.MutableMetaResponse()->MutableCmdGetReadSessionsInfoResult(); - THashMap<ui32, TString> hostName(NodesInfo->Nodes.size()); + THashMap<ui32, TString> hostName(NodesInfo->Nodes.size()); for (const auto& n : NodesInfo->Nodes) hostName.insert(std::make_pair(n.NodeId, n.Host)); @@ -736,7 +736,7 @@ public: topicRes->SetErrorCode(NPersQueue::NErrorCode::OK); } - THashMap<ui32, ui32> partitionToResp; + THashMap<ui32, ui32> partitionToResp; ui32 sz = 0; Y_VERIFY(p.second.ReadSessionsInfo); auto* sessionsInfo = p.second.ReadSessionsInfo.Get(); diff --git a/ydb/core/client/server/msgbus_server_pq_metacache.h b/ydb/core/client/server/msgbus_server_pq_metacache.h index 6c12b76b041..81dd477e0c4 100644 --- a/ydb/core/client/server/msgbus_server_pq_metacache.h +++ b/ydb/core/client/server/msgbus_server_pq_metacache.h @@ -7,7 +7,7 @@ #include <ydb/core/tx/scheme_cache/scheme_cache.h> #include <ydb/public/api/protos/draft/persqueue_error_codes.pb.h> #include <ydb/public/sdk/cpp/client/ydb_table/table.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> namespace NKikimr::NMsgBusProxy { diff --git a/ydb/core/client/server/msgbus_server_proxy.h b/ydb/core/client/server/msgbus_server_proxy.h index cb9f9c19d38..a21e0f6899e 100644 --- a/ydb/core/client/server/msgbus_server_proxy.h +++ b/ydb/core/client/server/msgbus_server_proxy.h @@ -92,10 +92,10 @@ public: } } - TIntrusivePtr<NACLib::TUserToken> GetUserToken(const TString& tokenString) { + TIntrusivePtr<NACLib::TUserToken> GetUserToken(const TString& tokenString) { // TODO: tokenString -> UID -> (cache) -> tokenObject // HACK tokenObject(tokenString) - just for testing purposes - TIntrusivePtr<NACLib::TUserToken> tokenObject = new NACLib::TUserToken(tokenString, TVector<NACLib::TSID>()); + TIntrusivePtr<NACLib::TUserToken> tokenObject = new NACLib::TUserToken(tokenString, TVector<NACLib::TSID>()); return tokenObject; } }; diff --git a/ydb/core/client/server/msgbus_server_request.cpp b/ydb/core/client/server/msgbus_server_request.cpp index 9223bea9f1a..2a3fe4424fa 100644 --- a/ydb/core/client/server/msgbus_server_request.cpp +++ b/ydb/core/client/server/msgbus_server_request.cpp @@ -18,13 +18,13 @@ namespace NMsgBusProxy { class TMessageBusServerRequest : public TMessageBusSecureRequest<TMessageBusServerRequestBase<TMessageBusServerRequest>> { using TBase = TMessageBusSecureRequest<TMessageBusServerRequestBase<TMessageBusServerRequest>>; THolder<TBusRequest> Request; - TVector<TString*> WriteResolvedKeysTo; + TVector<TString*> WriteResolvedKeysTo; TAutoPtr<TEvTxUserProxy::TEvProposeTransaction> Proposal; TAutoPtr<NKikimrTxUserProxy::TEvProposeTransactionStatus> ProposalStatus; size_t InFlyRequests; - THashMap<TString, ui64> CompileResolveCookies; - TString TextProgramForCompilation; + THashMap<TString, ui64> CompileResolveCookies; + TString TextProgramForCompilation; bool CompilationRetried; void ReplyWithResult(EResponseStatus status, NKikimrTxUserProxy::TEvProposeTransactionStatus &result, @@ -118,7 +118,7 @@ public: NMiniKQL::TScopedAlloc alloc(counters, AppData(ctx)->FunctionRegistry->SupportsSizedAllocators()); NMiniKQL::TTypeEnvironment env(alloc); NMiniKQL::TRuntimeNode node = NMiniKQL::ImportValueFromProto(mkqlTx.GetParams().GetProto(), env); - TString bin = NMiniKQL::SerializeRuntimeNode(node, env); + TString bin = NMiniKQL::SerializeRuntimeNode(node, env); mkqlTx.MutableParams()->ClearProto(); mkqlTx.MutableParams()->SetBin(bin); } @@ -195,7 +195,7 @@ void TMessageBusServerRequest::Handle(TMiniKQLCompileServiceEvents::TEvCompileSt const bool need2CompileProgram = (bool)TextProgramForCompilation; const bool need2CompileParams = mkqlTx->HasParams() && mkqlTx->GetParams().HasText(); - const TString& pgm = ev->Get()->Program; + const TString& pgm = ev->Get()->Program; Y_VERIFY((need2CompileProgram && TextProgramForCompilation == pgm) // TODO: do not check texts, trust cookies || (need2CompileParams && mkqlTx->GetParams().GetText() == pgm)); diff --git a/ydb/core/client/server/msgbus_server_request.h b/ydb/core/client/server/msgbus_server_request.h index b77d50983e6..7b5a10b4297 100644 --- a/ydb/core/client/server/msgbus_server_request.h +++ b/ydb/core/client/server/msgbus_server_request.h @@ -20,7 +20,7 @@ public: HandleError(status, proxyStatus, TEvTxUserProxy::TResultStatus::Str(proxyStatus), ctx); } - void HandleError(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext &ctx) { + void HandleError(EResponseStatus status, TEvTxUserProxy::TResultStatus::EStatus proxyStatus, const TString& message, const TActorContext &ctx) { TAutoPtr<TBusResponse> response(new TBusResponseStatus(status, message)); if (proxyStatus != TEvTxUserProxy::TResultStatus::Unknown) diff --git a/ydb/core/client/server/msgbus_server_resolve_node.cpp b/ydb/core/client/server/msgbus_server_resolve_node.cpp index 762df383cb8..7bdc60ca17e 100644 --- a/ydb/core/client/server/msgbus_server_resolve_node.cpp +++ b/ydb/core/client/server/msgbus_server_resolve_node.cpp @@ -34,7 +34,7 @@ public: void Handle(TEvInterconnect::TEvNodesInfo::TPtr& ev, const TActorContext& ctx) { const TEvInterconnect::TEvNodesInfo& nodesInfo = *ev->Get(); THolder<TBusResponse> response(new TBusResponse()); - TVector<TVector<TEvInterconnect::TNodeInfo>::const_iterator> items; + TVector<TVector<TEvInterconnect::TNodeInfo>::const_iterator> items; if (ResolveRequest.GetResolveLocalNode() || ResolveRequest.GetHost() == ".") { ui32 localNodeId = SelfId().NodeId(); for (auto it = nodesInfo.Nodes.begin(); it != nodesInfo.Nodes.end(); ++it) { diff --git a/ydb/core/client/server/msgbus_server_s3_listing.cpp b/ydb/core/client/server/msgbus_server_s3_listing.cpp index 3626866322b..705a5ca65b3 100644 --- a/ydb/core/client/server/msgbus_server_s3_listing.cpp +++ b/ydb/core/client/server/msgbus_server_s3_listing.cpp @@ -34,17 +34,17 @@ private: bool WaitingResolveReply; bool Finished; TAutoPtr<NSchemeCache::TSchemeCacheNavigate> ResolveNamesResult; - TVector<NScheme::TTypeId> KeyColumnTypes; + TVector<NScheme::TTypeId> KeyColumnTypes; TSysTables::TTableColumnInfo PathColumnInfo; - TVector<TSysTables::TTableColumnInfo> CommonPrefixesColumns; - TVector<TSysTables::TTableColumnInfo> ContentsColumns; + TVector<TSysTables::TTableColumnInfo> CommonPrefixesColumns; + TVector<TSysTables::TTableColumnInfo> ContentsColumns; TSerializedCellVec PrefixColumns; TSerializedCellVec StartAfterSuffixColumns; TSerializedCellVec KeyRangeFrom; TSerializedCellVec KeyRangeTo; ui32 CurrentShardIdx; - TVector<TSerializedCellVec> CommonPrefixesRows; - TVector<TSerializedCellVec> ContentsRows; + TVector<TSerializedCellVec> CommonPrefixesRows; + TVector<TSerializedCellVec> ContentsRows; public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { @@ -178,8 +178,8 @@ private: auto& entry = ResolveNamesResult->ResultSet.front(); - TVector<ui32> keyColumnIds; - THashMap<TString, ui32> columnByName; + TVector<ui32> keyColumnIds; + THashMap<TString, ui32> columnByName; for (const auto& ci : entry.Columns) { columnByName[ci.second.Name] = ci.second.Id; i32 keyOrder = ci.second.KeyOrder; @@ -193,7 +193,7 @@ private: } TString errStr; - TVector<TCell> prefixCells; + TVector<TCell> prefixCells; TConstArrayRef<NScheme::TTypeId> prefixTypes(KeyColumnTypes.data(), KeyColumnTypes.size() - 1); // -1 for path column NMiniKQL::CellsFromTuple(&Request->GetKeyPrefix().GetType(), Request->GetKeyPrefix().GetValue(), prefixTypes, true, prefixCells, errStr); @@ -263,8 +263,8 @@ private: bool BuildKeyRange(const NActors::TActorContext& ctx) { Y_UNUSED(ctx); - TVector<TCell> fromValues(PrefixColumns.GetCells().begin(), PrefixColumns.GetCells().end()); - TVector<TCell> toValues(PrefixColumns.GetCells().begin(), PrefixColumns.GetCells().end()); + TVector<TCell> fromValues(PrefixColumns.GetCells().begin(), PrefixColumns.GetCells().end()); + TVector<TCell> toValues(PrefixColumns.GetCells().begin(), PrefixColumns.GetCells().end()); TString pathPrefix = Request->GetPathColumnPrefix(); TString endPathPrefix; @@ -299,7 +299,7 @@ private: KeyRangeTo.GetCells(), false, false); - TVector<TKeyDesc::TColumnOp> columns; + TVector<TKeyDesc::TColumnOp> columns; for (const auto& ci : ContentsColumns) { TKeyDesc::TColumnOp op = { ci.Id, TKeyDesc::EColumnOperation::Read, ci.PType, 0, 0 }; columns.push_back(op); @@ -525,7 +525,7 @@ private: } } - void AddResultRow(NKikimrMiniKQL::TValue& listOfRows, const TVector<TSysTables::TTableColumnInfo>& rowScheme, const TSerializedCellVec& cells) const { + void AddResultRow(NKikimrMiniKQL::TValue& listOfRows, const TVector<TSysTables::TTableColumnInfo>& rowScheme, const TSerializedCellVec& cells) const { Y_VERIFY(rowScheme.size() >= cells.GetCells().size()); TString errStr; diff --git a/ydb/core/client/server/msgbus_server_tablet_kill.cpp b/ydb/core/client/server/msgbus_server_tablet_kill.cpp index 62da8569e2c..667c5b954a1 100644 --- a/ydb/core/client/server/msgbus_server_tablet_kill.cpp +++ b/ydb/core/client/server/msgbus_server_tablet_kill.cpp @@ -18,7 +18,7 @@ public: void Handle(TEvTablet::TEvTabletDead::TPtr&, const TActorContext &) { } - virtual NBus::TBusMessage* CreateErrorReply(EResponseStatus, const TActorContext&, const TString& text = TString()) override { + virtual NBus::TBusMessage* CreateErrorReply(EResponseStatus, const TActorContext&, const TString& text = TString()) override { return new TBusResponseStatus(MSTATUS_OK, text); } }; diff --git a/ydb/core/client/server/msgbus_server_tablet_state.cpp b/ydb/core/client/server/msgbus_server_tablet_state.cpp index c8582fc5501..163ccac5841 100644 --- a/ydb/core/client/server/msgbus_server_tablet_state.cpp +++ b/ydb/core/client/server/msgbus_server_tablet_state.cpp @@ -18,7 +18,7 @@ using namespace NNodeWhiteboard; class TMessageBusTabletStateRequest : public TActorBootstrapped<TMessageBusTabletStateRequest>, public TMessageBusSessionIdentHolder { protected: TAutoPtr<TEvInterconnect::TEvNodesInfo> NodesInfo; - TMap<ui64, TAutoPtr<TEvWhiteboard::TEvTabletStateResponse>> PerNodeTabletInfo; + TMap<ui64, TAutoPtr<TEvWhiteboard::TEvTabletStateResponse>> PerNodeTabletInfo; size_t NodesRequested; size_t NodesReceived; const NKikimrClient::TTabletStateRequest Record; diff --git a/ydb/core/client/server/msgbus_server_tracer.cpp b/ydb/core/client/server/msgbus_server_tracer.cpp index ff93f8d1cbe..b1e559149d0 100644 --- a/ydb/core/client/server/msgbus_server_tracer.cpp +++ b/ydb/core/client/server/msgbus_server_tracer.cpp @@ -105,7 +105,7 @@ void TMessageBusTracerService::StateFunc(TAutoPtr<IEventHandle> &ev, const TActo void TMessageBusTracerService::HandleStartTrace(TEvMessageBusTracer::TEvStartTrace::TPtr &ev, const TActorContext &ctx) { const TEvMessageBusTracer::TEvStartTrace *event = ev->Get(); Path = event->Path; - Stream = new TFileOutput(Path); + Stream = new TFileOutput(Path); LOG_NOTICE_S(ctx, NKikimrServices::MSGBUS_TRACER, "MessageBus tracing started, file '" << Path << "' " << ctx.SelfID.ToString()); @@ -135,12 +135,12 @@ void TMessageBusTracerService::HandleTraceEvent(TEvMessageBusTracer::TEvTraceEve } } -TEvMessageBusTracer::TEvStartTrace::TEvStartTrace(const TString &path) +TEvMessageBusTracer::TEvStartTrace::TEvStartTrace(const TString &path) : Path(path) { } -TEvMessageBusTracer::TEvTraceStatus::TEvTraceStatus(bool traceActive, const TString &path) +TEvMessageBusTracer::TEvTraceStatus::TEvTraceStatus(bool traceActive, const TString &path) : TraceActive(traceActive) , Path(path) { @@ -200,9 +200,9 @@ public: }; class TMessageBusTracerStartTrace: public TMessageBusTraceSimpleActor<TMessageBusTracerStartTrace> { - TString Path; + TString Path; public: - TMessageBusTracerStartTrace(NMsgBusProxy::TBusMessageContext &msg, const TString& path) + TMessageBusTracerStartTrace(NMsgBusProxy::TBusMessageContext &msg, const TString& path) : TMessageBusTraceSimpleActor<TMessageBusTracerStartTrace>(msg) , Path(path) { @@ -214,7 +214,7 @@ public: } }; -IActor* CreateMessageBusTracerStartTrace(NMsgBusProxy::TBusMessageContext &msg, const TString& path) { +IActor* CreateMessageBusTracerStartTrace(NMsgBusProxy::TBusMessageContext &msg, const TString& path) { return new TMessageBusTracerStartTrace(msg, path); } diff --git a/ydb/core/client/server/msgbus_server_tracer.h b/ydb/core/client/server/msgbus_server_tracer.h index 57a3812f5d5..ee5dc43b463 100644 --- a/ydb/core/client/server/msgbus_server_tracer.h +++ b/ydb/core/client/server/msgbus_server_tracer.h @@ -28,7 +28,7 @@ public: protected: TActorId MessageBusTracerActorID; bool TraceActive; - TString TracePath; + TString TracePath; void OnMessage(NBus::TOnMessageContext &msg) override; void OnMessageDied(NBus::TBusKey id) override; void OnMessageReplied(NBus::TBusKey id, NBus::TBusMessage *response) override; @@ -58,9 +58,9 @@ struct TEvMessageBusTracer { class TEvStartTrace : public TEventLocal<TEvStartTrace, TEvMessageBusTracer::EvStartTrace> { public: - TString Path; + TString Path; - TEvStartTrace(const TString &path); + TEvStartTrace(const TString &path); }; class TEvStopTrace : public TEventLocal<TEvStopTrace, TEvMessageBusTracer::EvStopTrace> { @@ -71,9 +71,9 @@ struct TEvMessageBusTracer { class TEvTraceStatus : public TEventLocal<TEvTraceStatus, TEvMessageBusTracer::EvTraceStatus> { public: bool TraceActive; - TString Path; + TString Path; - TEvTraceStatus(bool traceActive, const TString &path); + TEvTraceStatus(bool traceActive, const TString &path); }; }; @@ -95,7 +95,7 @@ private: void HandleTraceEvent(TEvMessageBusTracer::TEvTraceEvent::TPtr &ev, const TActorContext &); TAutoPtr<IOutputStream> Stream; - TString Path; + TString Path; }; inline TActorId MakeMessageBusTraceServiceID(ui32 node = 0) { @@ -103,7 +103,7 @@ inline TActorId MakeMessageBusTraceServiceID(ui32 node = 0) { return TActorId(node, TStringBuf(x, 12)); } -IActor* CreateMessageBusTracerStartTrace(NMsgBusProxy::TBusMessageContext &msg, const TString &path); +IActor* CreateMessageBusTracerStartTrace(NMsgBusProxy::TBusMessageContext &msg, const TString &path); IActor* CreateMessageBusTracerStopTrace(NMsgBusProxy::TBusMessageContext &msg); } diff --git a/ydb/core/client/server/msgbus_tabletreq.h b/ydb/core/client/server/msgbus_tabletreq.h index f173ae90976..1e8ce09886b 100644 --- a/ydb/core/client/server/msgbus_tabletreq.h +++ b/ydb/core/client/server/msgbus_tabletreq.h @@ -60,7 +60,7 @@ protected: } virtual NBus::TBusMessage* CreateErrorReply(EResponseStatus status, const TActorContext &ctx, - const TString& text = TString()) { + const TString& text = TString()) { LOG_ERROR_S(ctx, NKikimrServices::MSGBUS_REQUEST, "TabletRequest TabletId# " << TabletId << " status# " << status << " text# \"" << text << "\"" << Endl); return new TBusResponseStatus(status, text); diff --git a/ydb/core/cms/cluster_info.cpp b/ydb/core/cms/cluster_info.cpp index a1dc8a0b95f..465d84d8b09 100644 --- a/ydb/core/cms/cluster_info.cpp +++ b/ydb/core/cms/cluster_info.cpp @@ -589,10 +589,10 @@ static TServices MakeServices(const NKikimrCms::TAction &action) { return services; } -TSet<TLockableItem *> TClusterInfo::FindLockedItems(const NKikimrCms::TAction &action, +TSet<TLockableItem *> TClusterInfo::FindLockedItems(const NKikimrCms::TAction &action, const TActorContext *ctx) { - TSet<TLockableItem *> res; + TSet<TLockableItem *> res; if (ActionRequiresHost(action) && !HasNode(action.GetHost())) { if (ctx) @@ -644,8 +644,8 @@ TSet<TLockableItem *> TClusterInfo::FindLockedItems(const NKikimrCms::TAction &a ui64 TClusterInfo::AddLocks(const TPermissionInfo &permission, const TActorContext *ctx) { TInstant deadline(permission.Deadline); - TDuration duration = TDuration::MicroSeconds(permission.Action.GetDuration()); - Y_UNUSED(duration); + TDuration duration = TDuration::MicroSeconds(permission.Action.GetDuration()); + Y_UNUSED(duration); auto items = FindLockedItems(permission.Action, ctx); ui64 locks = 0; diff --git a/ydb/core/cms/cluster_info.h b/ydb/core/cms/cluster_info.h index af5fe24af80..0ac624072ae 100644 --- a/ydb/core/cms/cluster_info.h +++ b/ydb/core/cms/cluster_info.h @@ -49,7 +49,7 @@ struct TPermissionInfo { , RequestId(requestId) , Owner(owner) , Action(permission.GetAction()) - , Deadline(TInstant::MicroSeconds(permission.GetDeadline())) + , Deadline(TInstant::MicroSeconds(permission.GetDeadline())) { } @@ -163,7 +163,7 @@ public: { PermissionId = permission.PermissionId; LockDeadline = permission.Deadline; - ActionDeadline = LockDeadline + TDuration::MicroSeconds(Action.GetDuration()); + ActionDeadline = LockDeadline + TDuration::MicroSeconds(Action.GetDuration()); } TLock(const TLock &other) = default; TLock(TLock &&other) = default; @@ -182,10 +182,10 @@ public: { NotificationId = notification.NotificationId; if (notification.Notification.HasTime()) - LockStart = TInstant::MicroSeconds(notification.Notification.GetTime()); + LockStart = TInstant::MicroSeconds(notification.Notification.GetTime()); else LockStart = TActivationContext::Now(); - LockDeadline = LockStart + TDuration::MicroSeconds(action.GetDuration()); + LockDeadline = LockStart + TDuration::MicroSeconds(action.GetDuration()); } TString NotificationId; @@ -288,7 +288,7 @@ public: TMaybe<TLock> Lock; std::list<TExternalLock> ExternalLocks; std::list<TScheduledLock> ScheduledLocks; - TVector<TTemporaryLock> TempLocks; + TVector<TTemporaryLock> TempLocks; ui64 DeactivatedLocksOrder = Max<ui64>(); }; using TLockableItemPtr = TIntrusivePtr<TLockableItem>; @@ -320,9 +320,9 @@ public: ui16 IcPort = 0; TNodeLocation Location; TString Version; - TSet<ui64> Tablets; + TSet<ui64> Tablets; TSet<TPDiskID> PDisks; - TSet<TVDiskID> VDisks; + TSet<TVDiskID> VDisks; bool HasTenantInfo = false; TString Tenant; TString PreviousTenant; @@ -383,7 +383,7 @@ public: ui32 NodeId; TString Host; TString Path; - TSet<TVDiskID> VDisks; + TSet<TVDiskID> VDisks; // SlotIdx -> VDiskID THashMap<ui32, TVDiskID> VSlots; @@ -427,7 +427,7 @@ public: ui32 NodeId; TString Host; ui32 SlotId; - TSet<ui32> BSGroups; + TSet<ui32> BSGroups; private: static bool NameToId(const TString &name, TVDiskID &id); @@ -447,7 +447,7 @@ struct TBSGroupInfo { ui32 GroupId = 0; TErasureType Erasure; - TSet<TVDiskID> VDisks; + TSet<TVDiskID> VDisks; }; /** @@ -461,11 +461,11 @@ struct TBSGroupInfo { */ class TClusterInfo : public TThrRefBase { public: - using TNodes = THashMap<ui32, TNodeInfoPtr>; - using TTablets = THashMap<ui64, TTabletInfo>; + using TNodes = THashMap<ui32, TNodeInfoPtr>; + using TTablets = THashMap<ui64, TTabletInfo>; using TPDisks = THashMap<TPDiskID, TPDiskInfoPtr, TPDiskIDHash>; - using TVDisks = THashMap<TVDiskID, TVDiskInfoPtr>; - using TBSGroups = THashMap<ui32, TBSGroupInfo>; + using TVDisks = THashMap<TVDiskID, TVDiskInfoPtr>; + using TBSGroups = THashMap<ui32, TBSGroupInfo>; TClusterInfo() = default; TClusterInfo(const TClusterInfo &other) = default; @@ -809,7 +809,7 @@ private: return TPDiskID(); } - TSet<TLockableItem *> FindLockedItems(const NKikimrCms::TAction &action, const TActorContext *ctx); + TSet<TLockableItem *> FindLockedItems(const NKikimrCms::TAction &action, const TActorContext *ctx); TNodes Nodes; TTablets Tablets; @@ -822,9 +822,9 @@ private: bool Outdated = false; // Fast access structures. - TMultiMap<TString, ui32> HostNameToNodeId; + TMultiMap<TString, ui32> HostNameToNodeId; TMultiMap<TString, ui32> TenantToNodeId; - THashMap<TString, TLockableItemPtr> LockableItems; + THashMap<TString, TLockableItemPtr> LockableItems; }; inline bool ActionRequiresHost(NKikimrCms::TAction::EType type) diff --git a/ydb/core/cms/cms.cpp b/ydb/core/cms/cms.cpp index 0a205024e3c..ccab9013cbb 100644 --- a/ydb/core/cms/cms.cpp +++ b/ydb/core/cms/cms.cpp @@ -600,10 +600,10 @@ bool TCms::TryToLockPDisk(const TAction &action, bool TCms::TryToLockVDisks(const TAction &action, const TActionOptions& opts, - const TSet<TVDiskID> &vdisks, + const TSet<TVDiskID> &vdisks, TErrorInfo &error) const { - TDuration duration = TDuration::MicroSeconds(action.GetDuration()); + TDuration duration = TDuration::MicroSeconds(action.GetDuration()); duration += opts.PermissionDuration; auto res = true; @@ -715,7 +715,7 @@ bool TCms::CheckActionReplaceDevices(const TAction &action, { auto point = ClusterInfo->PushRollbackPoint(); bool res = true; - TDuration duration = TDuration::MicroSeconds(action.GetDuration()); + TDuration duration = TDuration::MicroSeconds(action.GetDuration()); duration += opts.PermissionDuration; for (const auto &device : action.GetDevices()) { @@ -833,9 +833,9 @@ void TCms::ScheduleNotificationsCleanup(const TActorContext &ctx) TInstant earliest = TInstant::Max(); for (const auto &entry : State->Notifications) { - TInstant start = TInstant::MicroSeconds(entry.second.Notification.GetTime()); + TInstant start = TInstant::MicroSeconds(entry.second.Notification.GetTime()); for (const auto &action : entry.second.Notification.GetActions()) { - TDuration duration = TDuration::MicroSeconds(action.GetDuration()); + TDuration duration = TDuration::MicroSeconds(action.GetDuration()); Y_VERIFY(duration); earliest = Min(earliest, start + duration); } @@ -871,7 +871,7 @@ void TCms::DoPermissionsCleanup(const TActorContext &ctx) { ScheduledCleanups.pop(); - TVector<TString> ids; + TVector<TString> ids; auto now = ctx.Now(); for (const auto &entry : State->Permissions) { const TDuration duration = TDuration::MicroSeconds(entry.second.Action.GetDuration()); @@ -1047,7 +1047,7 @@ void TCms::RemovePermission(TEvCms::TEvManagePermissionRequest::TPtr &ev, bool d LOG_INFO(ctx, NKikimrServices::CMS, "User %s %s permissions %s", user.data(), done ? "is done with" : "rejected", ToString(rec.GetPermissions()).data()); - TVector<TString> ids; + TVector<TString> ids; resp->Record.MutableStatus()->SetCode(TStatus::OK); for (const auto &id : rec.GetPermissions()) { auto it = State->Permissions.find(id); @@ -1610,7 +1610,7 @@ void TCms::Handle(TEvCms::TEvCheckRequest::TPtr &ev, const TActorContext &ctx) bool TCms::CheckNotificationDeadline(const TAction &action, TInstant time, TErrorInfo &error, const TActorContext &ctx) const { - if (time + TDuration::MicroSeconds(action.GetDuration()) < ctx.Now()) { + if (time + TDuration::MicroSeconds(action.GetDuration()) < ctx.Now()) { error.Code = TStatus::WRONG_REQUEST; error.Reason = "Action already finished"; return false; @@ -1717,7 +1717,7 @@ bool TCms::CheckNotification(const TNotification ¬ification, TNotificationResponse &resp, const TActorContext &ctx) const { - TInstant time = TInstant::MicroSeconds(notification.GetTime()); + TInstant time = TInstant::MicroSeconds(notification.GetTime()); resp.MutableStatus()->SetCode(TStatus::OK); for (const auto &action : notification.GetActions()) { @@ -1819,7 +1819,7 @@ void TCms::Handle(TEvCms::TEvRemoveWalleTask::TPtr &ev, const TActorContext &ctx if (State->ScheduledRequests.contains(task.RequestId)) { Execute(CreateTxRemoveRequest(task.RequestId, std::move(ev->Release()), handle), ctx); } else { - TVector<TString> ids(task.Permissions.begin(), task.Permissions.end()); + TVector<TString> ids(task.Permissions.begin(), task.Permissions.end()); Execute(CreateTxRemovePermissions(ids, std::move(ev->Release()), handle), ctx); } } else { diff --git a/ydb/core/cms/cms_impl.h b/ydb/core/cms/cms_impl.h index 48138884907..0f47b1e57df 100644 --- a/ydb/core/cms/cms_impl.h +++ b/ydb/core/cms/cms_impl.h @@ -414,10 +414,10 @@ private: void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx); private: - TStack<TInstant> ScheduledCleanups; + TStack<TInstant> ScheduledCleanups; TString NotSupportedReason; TQueue<TAutoPtr<IEventHandle>> InitQueue; - TQueue<TAutoPtr<IEventHandle>> Queue; + TQueue<TAutoPtr<IEventHandle>> Queue; TCmsStatePtr State; TLogger Logger; // Shortcut to State->ClusterInfo. diff --git a/ydb/core/cms/cms_state.h b/ydb/core/cms/cms_state.h index 5f0b6ff2e21..00129d20a06 100644 --- a/ydb/core/cms/cms_state.h +++ b/ydb/core/cms/cms_state.h @@ -14,7 +14,7 @@ namespace NCms { struct TWalleTaskInfo { TString TaskId; TString RequestId; - TSet<TString> Permissions; + TSet<TString> Permissions; TString ToString() const { return TStringBuilder() << "{" @@ -27,9 +27,9 @@ struct TWalleTaskInfo { struct TCmsState : public TAtomicRefCount<TCmsState> { // Main state. - THashMap<TString, TPermissionInfo> Permissions; - THashMap<TString, TRequestInfo> ScheduledRequests; - THashMap<TString, TNotificationInfo> Notifications; + THashMap<TString, TPermissionInfo> Permissions; + THashMap<TString, TRequestInfo> ScheduledRequests; + THashMap<TString, TNotificationInfo> Notifications; TDowntimes Downtimes; ui64 NextPermissionId = 0; ui64 NextRequestId = 0; @@ -37,8 +37,8 @@ struct TCmsState : public TAtomicRefCount<TCmsState> { ui64 LastLogRecordTimestamp = 0; // State of Wall-E tasks. - THashMap<TString, TWalleTaskInfo> WalleTasks; - THashMap<TString, TString> WalleRequests; + THashMap<TString, TWalleTaskInfo> WalleTasks; + THashMap<TString, TString> WalleRequests; // CMS config. TCmsConfig Config; diff --git a/ydb/core/cms/cms_tx_load_state.cpp b/ydb/core/cms/cms_tx_load_state.cpp index eb144dc0def..b9364998c8f 100644 --- a/ydb/core/cms/cms_tx_load_state.cpp +++ b/ydb/core/cms/cms_tx_load_state.cpp @@ -119,7 +119,7 @@ public: permission.RequestId = requestId; permission.Owner = owner; google::protobuf::TextFormat::ParseFromString(actionStr, &permission.Action); - permission.Deadline = TInstant::MicroSeconds(deadline); + permission.Deadline = TInstant::MicroSeconds(deadline); LOG_DEBUG(ctx, NKikimrServices::CMS, "Loaded permission %s owned by %s valid until %s: %s", id.data(), owner.data(), TInstant::MicroSeconds(deadline).ToStringLocalUpToSeconds().data(), actionStr.data()); diff --git a/ydb/core/cms/cms_tx_remove_expired_notifications.cpp b/ydb/core/cms/cms_tx_remove_expired_notifications.cpp index 6235b7f8f0f..bfe1f3fe9d2 100644 --- a/ydb/core/cms/cms_tx_remove_expired_notifications.cpp +++ b/ydb/core/cms/cms_tx_remove_expired_notifications.cpp @@ -20,7 +20,7 @@ public: TInstant now = ctx.Now(); for (auto entry = Self->State->Notifications.begin(); entry != Self->State->Notifications.end();) { auto &info = entry->second; - TInstant time = TInstant::MicroSeconds(info.Notification.GetTime()); + TInstant time = TInstant::MicroSeconds(info.Notification.GetTime()); bool modified = false; auto next = entry; @@ -28,7 +28,7 @@ public: auto *actions = info.Notification.MutableActions(); for (auto i = actions->begin(); i != actions->end(); ) { - TInstant deadline = time + TDuration::MicroSeconds(i->GetDuration()); + TInstant deadline = time + TDuration::MicroSeconds(i->GetDuration()); if (deadline <= now) { LOG_INFO(ctx, NKikimrServices::CMS, "Removing expired action from notification %s: %s", diff --git a/ydb/core/cms/cms_tx_remove_permissions.cpp b/ydb/core/cms/cms_tx_remove_permissions.cpp index 6e638c72ffb..7ad987cc6ae 100644 --- a/ydb/core/cms/cms_tx_remove_permissions.cpp +++ b/ydb/core/cms/cms_tx_remove_permissions.cpp @@ -67,7 +67,7 @@ public: private: THolder<IEventBase> Request; TAutoPtr<IEventHandle> Response; - TVector<TString> Ids; + TVector<TString> Ids; bool Expired; }; diff --git a/ydb/core/cms/cms_ut_common.h b/ydb/core/cms/cms_ut_common.h index f1f9c1a74db..65bb3f0eecd 100644 --- a/ydb/core/cms/cms_ut_common.h +++ b/ydb/core/cms/cms_ut_common.h @@ -36,7 +36,7 @@ public: using TEvWhiteboard = NNodeWhiteboard::TEvWhiteboard; static NKikimrBlobStorage::TEvControllerConfigResponse Config; - static THashMap<ui32, TFakeNodeInfo> Info; + static THashMap<ui32, TFakeNodeInfo> Info; static TMutex Mutex; void Bootstrap(const TActorContext &ctx) diff --git a/ydb/core/cms/config.h b/ydb/core/cms/config.h index 471880e34f6..8d21481808e 100644 --- a/ydb/core/cms/config.h +++ b/ydb/core/cms/config.h @@ -211,8 +211,8 @@ struct TCmsConfig { void Deserialize(const NKikimrCms::TCmsConfig &config) { - DefaultRetryTime = TDuration::MicroSeconds(config.GetDefaultRetryTime()); - DefaultPermissionDuration = TDuration::MicroSeconds(config.GetDefaultPermissionDuration()); + DefaultRetryTime = TDuration::MicroSeconds(config.GetDefaultRetryTime()); + DefaultPermissionDuration = TDuration::MicroSeconds(config.GetDefaultPermissionDuration()); InfoCollectionTimeout = TDuration::MicroSeconds(config.GetInfoCollectionTimeout()); TenantLimits.CopyFrom(config.GetTenantLimits()); ClusterLimits.CopyFrom(config.GetClusterLimits()); diff --git a/ydb/core/cms/downtime.cpp b/ydb/core/cms/downtime.cpp index 2d72a676fa7..0bf337a1c24 100644 --- a/ydb/core/cms/downtime.cpp +++ b/ydb/core/cms/downtime.cpp @@ -58,7 +58,7 @@ void TDowntime::AddDowntime(const TLockableItem &item, TInstant now) AddDowntime(item.Timestamp, now, "known downtime"); if (item.Lock.Defined()) { - auto end = Min(now + TDuration::MicroSeconds(item.Lock->Action.GetDuration()), + auto end = Min(now + TDuration::MicroSeconds(item.Lock->Action.GetDuration()), item.Lock->ActionDeadline); AddDowntime(now, end, item.Lock->PermissionId); } diff --git a/ydb/core/cms/downtime.h b/ydb/core/cms/downtime.h index 0e517a1467f..bcc097a4932 100644 --- a/ydb/core/cms/downtime.h +++ b/ydb/core/cms/downtime.h @@ -63,7 +63,7 @@ public: } }; - using TSegments = TSet<TSegment, TSegmentCmp>; + using TSegments = TSet<TSegment, TSegmentCmp>; public: TDowntime(TDuration ignoredDowntimeGap = TDuration::Zero()); diff --git a/ydb/core/cms/http.cpp b/ydb/core/cms/http.cpp index 648d864b6ed..41d412ebf24 100644 --- a/ydb/core/cms/http.cpp +++ b/ydb/core/cms/http.cpp @@ -195,7 +195,7 @@ private: ReplyWithFile(ev, ctx, TString{msg->Request.GetPathInfo()}); } - THashMap<TString, TAutoPtr<TApiMethodHandlerBase>> ApiHandlers; + THashMap<TString, TAutoPtr<TApiMethodHandlerBase>> ApiHandlers; const TStringBuf HELP_LINK = "Check /api/help for usage details"; }; diff --git a/ydb/core/control/immediate_control_board_actor.cpp b/ydb/core/control/immediate_control_board_actor.cpp index bcb4a3344c3..962fb251dfb 100644 --- a/ydb/core/control/immediate_control_board_actor.cpp +++ b/ydb/core/control/immediate_control_board_actor.cpp @@ -34,7 +34,7 @@ class TImmediateControlActor : public TActorBootstrapped<TImmediateControlActor> TMutex Mtx; TIntrusivePtr<TControlBoard> Board; - TVector<TLogRecord> HistoryLog; + TVector<TLogRecord> HistoryLog; NMonitoring::TDynamicCounters::TCounterPtr HasChanged; NMonitoring::TDynamicCounters::TCounterPtr ChangedCount; diff --git a/ydb/core/control/immediate_control_board_actor_ut.cpp b/ydb/core/control/immediate_control_board_actor_ut.cpp index 2753077d936..0f1bf237fc1 100644 --- a/ydb/core/control/immediate_control_board_actor_ut.cpp +++ b/ydb/core/control/immediate_control_board_actor_ut.cpp @@ -73,7 +73,7 @@ struct TTestConfig { template <class T> static void Run(i64 instances = 1) { TVector<TActorId> testIds; - TAppData appData(0, 0, 0, 0, TMap<TString, ui32>(), + TAppData appData(0, 0, 0, 0, TMap<TString, ui32>(), nullptr, nullptr, nullptr, nullptr); try { diff --git a/ydb/core/control/immediate_control_board_ut.cpp b/ydb/core/control/immediate_control_board_ut.cpp index dba6280ab5b..79860ce7a4a 100644 --- a/ydb/core/control/immediate_control_board_ut.cpp +++ b/ydb/core/control/immediate_control_board_ut.cpp @@ -123,7 +123,7 @@ Y_UNIT_TEST_SUITE(ControlImplementationTests) { return nullptr; }; TIntrusivePtr<TControlBoard> Icb(new TControlBoard); - TVector<THolder<TThread>> threads; + TVector<THolder<TThread>> threads; threads.reserve(TEST_THREADS_CNT); for (ui64 i = 0; i < TEST_THREADS_CNT; ++i) { threads.emplace_back(new TThread(parallelJob, (void *)Icb.Get())); diff --git a/ydb/core/driver_lib/base_utils/base_utils.h b/ydb/core/driver_lib/base_utils/base_utils.h index 4809f2824da..38644d6a36e 100644 --- a/ydb/core/driver_lib/base_utils/base_utils.h +++ b/ydb/core/driver_lib/base_utils/base_utils.h @@ -17,13 +17,13 @@ namespace NKikimr { struct TCmdFormatConfig { - TString Path; + TString Path; NSize::TSize DiskSize; NSize::TSize ChunkSize; NSize::TSize SectorSize; ui64 Guid; ui64 MainKey; - TString TextMessage; + TString TextMessage; TCmdFormatConfig(); @@ -31,7 +31,7 @@ struct TCmdFormatConfig { }; struct TCmdFormatInfoConfig { - TString Path; + TString Path; ui64 MainKey; bool IsVerbose; @@ -41,8 +41,8 @@ struct TCmdFormatInfoConfig { }; struct TCmdNodeByHostConfig { - TString NamingFile; - TString Hostname; + TString NamingFile; + TString Hostname; i32 Port; TCmdNodeByHostConfig(); @@ -51,7 +51,7 @@ struct TCmdNodeByHostConfig { }; struct TCmdFormatUtilConfig { - TString FormatFile; + TString FormatFile; ui32 NodeId; TCmdFormatUtilConfig (); diff --git a/ydb/core/driver_lib/cli_base/cli_cmds_db.cpp b/ydb/core/driver_lib/cli_base/cli_cmds_db.cpp index 450d4135c6c..a7d749106dd 100644 --- a/ydb/core/driver_lib/cli_base/cli_cmds_db.cpp +++ b/ydb/core/driver_lib/cli_base/cli_cmds_db.cpp @@ -40,8 +40,8 @@ public: " Or short pathname if profile path is set (e.g. test1/test2)."); } - TString Base; - TString Name; + TString Base; + TString Name; virtual void Parse(TConfig& config) override { TClientCommand::Parse(config); @@ -123,7 +123,7 @@ public: bool ReturnTxId; - TList<TAutoPtr<NKikimrClient::TSchemeOperation>> Requests; + TList<TAutoPtr<NKikimrClient::TSchemeOperation>> Requests; virtual void Config(TConfig& config) override { TClientCommand::Config(config); @@ -180,7 +180,7 @@ public: {} TAutoPtr<NKikimrClient::TSchemeDescribe> Request; - TString Path; + TString Path; bool Tree; bool Details; bool AccessRights; @@ -220,7 +220,7 @@ public: Request->SetPath(Path); } else { // treat path as PathId like '72075186232623600/1225' - TVector<TString> fields; + TVector<TString> fields; Split(Path, "/", fields); if (fields.size() != 2) { Cerr << "Invaid path or pathId: " << Path << Endl; @@ -241,9 +241,9 @@ public: Protobuf = Protobuf || PartitionStats || Boundaries; } - void PadString(TString& str, size_t size) { + void PadString(TString& str, size_t size) { if (str.size() < size) { - str += TString(size - str.size(), ' '); + str += TString(size - str.size(), ' '); } else { str += ' '; } @@ -251,7 +251,7 @@ public: void PrintEntry(const NKikimrSchemeOp::TPathDescription& path) { const NKikimrSchemeOp::TDirEntry& entry(path.GetSelf()); - TString type; + TString type; switch(entry.GetPathType()) { case NKikimrSchemeOp::EPathTypeDir: type = "<dir>"; @@ -279,13 +279,13 @@ public: break; } - TString id(Sprintf("%lu/%lu", entry.GetSchemeshardId(), entry.GetPathId())); - TString name(entry.GetName()); + TString id(Sprintf("%lu/%lu", entry.GetSchemeshardId(), entry.GetPathId())); + TString name(entry.GetName()); PadString(id, 24); PadString(type, 11); PadString(name, 26); - TString owner; - TString acl; + TString owner; + TString acl; if (AccessRights) { if (entry.HasOwner()) { owner = entry.GetOwner(); @@ -324,12 +324,12 @@ public: Cout << Endl; const auto& keyColumnIds(table.GetKeyColumnIds()); for (const NKikimrSchemeOp::TColumnDescription& column : table.GetColumns()) { - TString id(ToString(column.GetId())); - TString type(column.GetType()); - TString name(column.GetName()); - id = id + TString(szColumns[0] - id.size(), ' '); - type = type + TString(szColumns[1] - type.size(), ' '); - name = name + TString(szColumns[2] - name.size(), ' '); + TString id(ToString(column.GetId())); + TString type(column.GetType()); + TString name(column.GetName()); + id = id + TString(szColumns[0] - id.size(), ' '); + type = type + TString(szColumns[1] - type.size(), ' '); + name = name + TString(szColumns[2] - name.size(), ' '); Cout << id << "│" << type << "│" << name << "│"; auto itKey = std::find(keyColumnIds.begin(), keyColumnIds.end(), column.GetId()); if (itKey != keyColumnIds.end()) { @@ -343,7 +343,7 @@ public: const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroup(path.GetPersQueueGroup()); for (ui32 pi = 0; pi < pqGroup.PartitionsSize(); ++pi) { const auto& partition = pqGroup.GetPartitions(pi); - TString partitionId = Sprintf(" %6" PRIu32 " ", partition.GetPartitionId()); + TString partitionId = Sprintf(" %6" PRIu32 " ", partition.GetPartitionId()); Cout << partitionId << "│" << partition.GetTabletId() << Endl; } break; @@ -418,7 +418,7 @@ public: //Cout << Path << Endl; for (const NKikimrSchemeOp::TPathDescription& entry : entries) { if (cnt > 0) { - Cout << TString((cnt - 1) * 3, ' '); + Cout << TString((cnt - 1) * 3, ' '); Cout << "└─ "; } PrintEntry(entry); @@ -460,7 +460,7 @@ public: } static void PrintEntry(const NKikimrSchemeOp::TDirEntry& entry) { - TString type; + TString type; switch(entry.GetPathType()) { case NKikimrSchemeOp::EPathTypeDir: type = "<dir>"; @@ -517,7 +517,7 @@ public: {} TAutoPtr<NKikimrClient::TSchemeInitRoot> Request; - TString Root; + TString Root; TString DefaultStoragePool; virtual void Config(TConfig& config) override { @@ -573,7 +573,7 @@ public: config.Opts->AddLongOption('v', "verbose", "Verbose output").NoArgument().SetFlag(&Verbose); } - TString Owner; + TString Owner; TString Path; virtual void Parse(TConfig& config) override { @@ -668,9 +668,9 @@ public: SetFreeArgTitle(1, "<ACCESS>", "ACCESS"); } - TString Access; - TString Base; - TString Name; + TString Access; + TString Base; + TString Name; virtual void Parse(TConfig& config) override { TClientCommand::Parse(config); @@ -739,9 +739,9 @@ public: SetFreeArgTitle(1, "<ACCESS>", "ACCESS"); } - TString Access; - TString Base; - TString Name; + TString Access; + TString Base; + TString Name; virtual void Parse(TConfig& config) override { TClientCommand::Parse(config); @@ -1284,8 +1284,8 @@ public: : TClientCommandConfig("minikql", { "execute", "exec", "mkql" }, "Execute Mini-KQL query") {} - TString MiniKQL; - TString Params; + TString MiniKQL; + TString Params; bool Proto = false; virtual void Config(TConfig& config) override { @@ -1302,7 +1302,7 @@ public: if (config.ParseResult->GetFreeArgsPos() > 1) { auto paramsArg = config.ParseResult->GetFreeArgs()[1]; Params = Proto - ? TUnbufferedFileInput(paramsArg).ReadAll() + ? TUnbufferedFileInput(paramsArg).ReadAll() : GetMiniKQL(paramsArg); } } diff --git a/ydb/core/driver_lib/cli_config_base/config_base.cpp b/ydb/core/driver_lib/cli_config_base/config_base.cpp index 3672ce3ec2f..cc32d0521a5 100644 --- a/ydb/core/driver_lib/cli_config_base/config_base.cpp +++ b/ydb/core/driver_lib/cli_config_base/config_base.cpp @@ -41,7 +41,7 @@ TCommandConfig::TServerEndpoint TCommandConfig::ParseServerAddress(const TString return endpoint; } -const TString ArgFormatDescription() { +const TString ArgFormatDescription() { return R"___( Common option formats: NUM - integer number, bounds should be deducted from a command context diff --git a/ydb/core/driver_lib/cli_config_base/config_base.h b/ydb/core/driver_lib/cli_config_base/config_base.h index 6db66dc7d1b..efc1599b487 100644 --- a/ydb/core/driver_lib/cli_config_base/config_base.h +++ b/ydb/core/driver_lib/cli_config_base/config_base.h @@ -13,7 +13,7 @@ #include <util/generic/ptr.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/generic/variant.h> @@ -31,7 +31,7 @@ namespace NKikimr { TDuration ParseDuration(const TStringBuf& str); // all modes use common argument format -const TString ArgFormatDescription(); +const TString ArgFormatDescription(); struct TCommandConfig { TMaybe<std::variant<NMsgBusProxy::TMsgBusClientConfig, NGRpcProxy::TGRpcClientConfig>> ClientConfig; @@ -78,14 +78,14 @@ template<> struct TCliCommands<MODES_ENUM> {\ \ TCliCommands(): Mode( (DEFAULT_VALUE) ) {}\ \ - static TString CommandsCsv() {\ + static TString CommandsCsv() {\ TStringStream commandsList;\ bool first = true;\ MODES_MAP(APPEND_ENUM);\ return commandsList.Str();\ }\ \ - static TString CommandsDescription(const TString& toolName) {\ + static TString CommandsDescription(const TString& toolName) {\ TStringStream helpStream;\ helpStream << "[global options...] <command> [command options...] [mbus] [messagebus options...]";\ helpStream << "\n\nAvailable commands are:\n";\ diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_cms.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_cms.cpp index 8d8e54af65f..e0361505af6 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_cms.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_cms.cpp @@ -86,7 +86,7 @@ public: class TClientCommandState : public TCmsClientCommand { public: - TVector<TString> Hosts; + TVector<TString> Hosts; TClientCommandState() : TCmsClientCommand("state", {}, "Get cluster state") @@ -115,10 +115,10 @@ public: { auto &state = response.GetClusterStateResponse().GetState(); - TInstant timestamp = TInstant::MicroSeconds(state.GetTimestamp()); + TInstant timestamp = TInstant::MicroSeconds(state.GetTimestamp()); Cout << "Cluster state at " << timestamp.ToStringLocalUpToSeconds() << Endl; - TMultiMap<TString, const NKikimrCms::THostState*> hosts; + TMultiMap<TString, const NKikimrCms::THostState*> hosts; for (auto &host : state.GetHosts()) hosts.emplace(host.GetName(), &host); @@ -139,14 +139,14 @@ public: Cout << " Markers: " << JoinSeq(", ", markers) << Endl; } - TMultiMap<TString, const NKikimrCms::TServiceState*> services; + TMultiMap<TString, const NKikimrCms::TServiceState*> services; for (auto &service : host.GetServices()) services.emplace(service.GetName(), &service); for (auto &pr : services) PrintService(*pr.second); - TMultiMap<TString, const NKikimrCms::TDeviceState*> devices; + TMultiMap<TString, const NKikimrCms::TDeviceState*> devices; for (auto &device : host.GetDevices()) devices.emplace(device.GetName(), &device); diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_config.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_config.cpp index aae54255e91..a54a489d6e9 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_config.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_config.cpp @@ -188,7 +188,7 @@ public: if (ProtoFile) { try { - data = TUnbufferedFileInput(ProtoFile).ReadAll(); + data = TUnbufferedFileInput(ProtoFile).ReadAll(); } catch (const yexception& ex) { Cerr << "failed to ready query from file: " << ex.what() << Endl; return EXIT_FAILURE; diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp index a9be370d37f..a657ab00963 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_disk.cpp @@ -15,7 +15,7 @@ public: bool IsVerbose; bool LockDevice; ui64 MainKey; - TString Path; + TString Path; virtual void Config(TConfig& config) override { TClientCommand::Config(config); @@ -103,13 +103,13 @@ public: : TClientCommand("format", {}, "Format local disk") {} - TString Path; + TString Path; NSize::TSize DiskSize; NSize::TSize ChunkSize; NSize::TSize SectorSize; ui64 Guid; ui64 MainKey; - TString TextMessage; + TString TextMessage; bool IsErasureEncode; virtual void Config(TConfig& config) override { diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp index af2801de362..51c78a3fdf5 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_genconfig.cpp @@ -13,13 +13,13 @@ using NBsController::TCandidate; using NBsController::GroupFromCandidates; class TClientCommandGenConfigStatic : public TClientCommandConfig { - TString ErasureList; + TString ErasureList; - TString ErasureStr; - TString DesiredPDiskType = "ROT"; - TString DistinctionLevelStr = "body"; - TString BsFormatFile; - TString RingDistinctionLevelStr; + TString ErasureStr; + TString DesiredPDiskType = "ROT"; + TString DistinctionLevelStr = "body"; + TString BsFormatFile; + TString RingDistinctionLevelStr; TBlobStorageGroupType Type; ui32 AvailabilityDomain = 1; @@ -33,7 +33,7 @@ class TClientCommandGenConfigStatic : public TClientCommandConfig { ui32 RingEndLevel; ui32 VSlot = 0; ui32 NumRings = 0; - TString VDiskKind = "Default"; + TString VDiskKind = "Default"; int VDiskKindVal = 0; int ExpectedSlotCount = -1; @@ -46,8 +46,8 @@ class TClientCommandGenConfigStatic : public TClientCommandConfig { TFailDomain Prefix; struct TPDiskInfo { - const TString Type; // PDisk type as mentioned in bs_format.txt - const TString Path; // path to device on a node + const TString Type; // PDisk type as mentioned in bs_format.txt + const TString Path; // path to device on a node const TFailDomain FailDom; // physical location of a PDisk const ui64 PDiskGuid; // PDisk unique identifier const ui32 PDiskId; // PDisk per-node identifier @@ -75,7 +75,7 @@ class TClientCommandGenConfigStatic : public TClientCommandConfig { } } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{Type# " << Type << " FailDom# " << FailDom.ToString() << " PDiskGuid# " << PDiskGuid << " PDiskId# " << PDiskId << " NodeId# " << NodeId << "}"; @@ -87,7 +87,7 @@ class TClientCommandGenConfigStatic : public TClientCommandConfig { TFailDomain fdom; using T = NKikimrConfig::TBlobStorageFormatConfig::TDrive; - TVector<std::tuple<int, bool(T::*)() const, ui64(T::*)() const>> levels = { + TVector<std::tuple<int, bool(T::*)() const, ui64(T::*)() const>> levels = { std::make_tuple(10, &T::HasDataCenterId, &T::GetDataCenterId), std::make_tuple(20, &T::HasRoomId, &T::GetRoomId ), std::make_tuple(30, &T::HasRackId, &T::GetRackId ), @@ -149,7 +149,7 @@ public: .StoreResult(&BsFormatFile); } - ui32 ParseDistinctionLevel(const TString& s) { + ui32 ParseDistinctionLevel(const TString& s) { const ui32 level = s == "dc" ? 10 : s == "room" ? 20 : @@ -217,7 +217,7 @@ public: NKikimrConfig::TBlobStorageFormatConfig bsFormat; try { - TUnbufferedFileInput input(BsFormatFile); + TUnbufferedFileInput input(BsFormatFile); const bool status = google::protobuf::TextFormat::ParseFromString(input.ReadAll(), &bsFormat); if (!status) { ythrow yexception() << "failed to parse protobuf"; @@ -228,7 +228,7 @@ public: } // make a set of PDisks that fit our filtering condition - TVector<TPDiskInfo> pdisks; + TVector<TPDiskInfo> pdisks; for (const NKikimrConfig::TBlobStorageFormatConfig::TDrive& drive : bsFormat.GetDrive()) { TPDiskInfo pdiskInfo(drive); if (pdiskInfo.Type == DesiredPDiskType && Prefix.IsSubdomainOf(pdiskInfo.FailDom)) { @@ -236,12 +236,12 @@ public: } } - TVector<TCandidate> candidates; + TVector<TCandidate> candidates; for (const TPDiskInfo& pdisk : pdisks) { candidates.emplace_back(pdisk.FailDom, BeginLevel, EndLevel, 0 /*badness*/, pdisk.NodeId, pdisk.PDiskId, VSlot); } - TVector<TVector<TVector<const TCandidate*>>> bestGroup; + TVector<TVector<TVector<const TCandidate*>>> bestGroup; if (!CreateGroupWithRings(candidates, NumRings, FailDomains, VDisksPerFailDomain, RingBeginLevel, RingEndLevel, bestGroup)) { Cerr << "Can't create group with given parameters" @@ -307,14 +307,14 @@ public: ++vdiskIdx; }; - auto transformDomain = [&](const TVector<const TCandidate*>& inVDisks, auto& outRing, ui32 ringIdx, ui32& domainIdx) { + auto transformDomain = [&](const TVector<const TCandidate*>& inVDisks, auto& outRing, ui32 ringIdx, ui32& domainIdx) { ui32 vdiskIdx = 0; std::for_each(inVDisks.begin(), inVDisks.end(), std::bind(transformVDisk, std::placeholders::_1, std::ref(*outRing.AddFailDomains()), ringIdx, domainIdx, std::ref(vdiskIdx))); ++domainIdx; }; - auto transformRing = [&](const TVector<TVector<const TCandidate*>>& inDomains, auto& outGroup, ui32& ringIdx) { + auto transformRing = [&](const TVector<TVector<const TCandidate*>>& inDomains, auto& outGroup, ui32& ringIdx) { ui32 domainIdx = 0; std::for_each(inDomains.begin(), inDomains.end(), std::bind(transformDomain, std::placeholders::_1, std::ref(*outGroup.AddRings()), ringIdx, std::ref(domainIdx))); @@ -330,7 +330,7 @@ public: std::for_each(bestGroup.begin(), bestGroup.end(), std::bind(transformRing, std::placeholders::_1, std::ref(group), std::ref(ringIdx))); - TString message; + TString message; if (!google::protobuf::TextFormat::PrintToString(pb, &message)) { Cerr << "failed to format resulting protobuf" << Endl; return EXIT_FAILURE; diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_get.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_get.cpp index f6593600871..d088618836b 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_get.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_get.cpp @@ -27,8 +27,8 @@ public: if (config.ParseResult->Has("extreme")) { TLogoBlobID id; - TString errorExplanation; - const TString& blob = config.ParseResult->Get("extreme"); + TString errorExplanation; + const TString& blob = config.ParseResult->Get("extreme"); if (!TLogoBlobID::Parse(id, blob, errorExplanation)) { ythrow yexception() << "Failed to parse LogoBlobId '" << blob << "': " << errorExplanation; } diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp index 6766dd31719..be860b12a6f 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp @@ -28,10 +28,10 @@ protected: ui32 LogLevel; // log settings ui32 LogSamplingLevel; // log settings ui32 LogSamplingRate; // log settings - TString LogFormat;// log settings + TString LogFormat;// log settings TString SysLogServiceTag; //unique tags for sys logs TString LogFileName; // log file name to initialize file log backend - TString ClusterName; // log settings + TString ClusterName; // log settings ui32 NodeId; TString NodeIdValue; @@ -39,15 +39,15 @@ protected: ui32 BusProxyPort; NBus::TBusQueueConfig ProxyBusQueueConfig; NBus::TBusServerSessionConfig ProxyBusSessionConfig; - TVector<ui64> ProxyBindToProxy; + TVector<ui64> ProxyBindToProxy; ui32 MonitoringPort; TString MonitoringAddress; ui32 MonitoringThreads; - TString RestartsCountFile; - TString TracePath; + TString RestartsCountFile; + TString TracePath; size_t CompileInflightLimit; // MiniKQLCompileService - TString UDFsDir; - TVector<TString> UDFsPaths; + TString UDFsDir; + TVector<TString> UDFsPaths; TString HostLabelOverride; TString TenantName; TString TenantDomain; diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_tablet.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_tablet.cpp index 361e757ca1d..4f1c6bc898c 100644 --- a/ydb/core/driver_lib/cli_utils/cli_cmds_tablet.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_cmds_tablet.cpp @@ -10,10 +10,10 @@ public: : TClientCommandConfig("request", { "req" }, "Request to KV tablet") {} - TString ProtoBuf; + TString ProtoBuf; TAutoPtr<NKikimrClient::TKeyValueRequest> Request; - TString OutputFile; - TString InputFile; + TString OutputFile; + TString InputFile; int OnResponse(const NKikimrClient::TResponse& response) { if (!OutputFile.empty()) { @@ -22,7 +22,7 @@ public: Y_VERIFY(response.GetReadResult(0).GetStatus() == NKikimrProto::OK); Y_VERIFY(response.GetReadResult(0).HasValue()); TFile file(OutputFile, CreateNew | WrOnly); - TString data = response.GetReadResult(0).GetValue(); + TString data = response.GetReadResult(0).GetValue(); file.Write(data.data(), data.size()); file.Close(); } else if (!InputFile.empty()) { @@ -66,7 +66,7 @@ public: Y_VERIFY(Request->CmdWriteSize() == 1); Y_VERIFY(Request->GetCmdWrite(0).HasKey()); Y_VERIFY(!Request->GetCmdWrite(0).HasValue()); - TString data = TUnbufferedFileInput(InputFile).ReadAll(); + TString data = TUnbufferedFileInput(InputFile).ReadAll(); Request->MutableCmdWrite(0)->SetValue(data); } } @@ -89,8 +89,8 @@ public: } TAutoPtr<NMsgBusProxy::TBusTabletLocalMKQL> Request; - TString Program; - TString Params; + TString Program; + TString Params; virtual void Config(TConfig& config) override { TClientCommand::Config(config); @@ -169,7 +169,7 @@ public: } TAutoPtr<NMsgBusProxy::TBusTabletLocalSchemeTx> Request; - TString SchemeChanges; + TString SchemeChanges; virtual void Config(TConfig& config) override { TClientCommand::Config(config); diff --git a/ydb/core/driver_lib/cli_utils/cli_keyvalue.cpp b/ydb/core/driver_lib/cli_utils/cli_keyvalue.cpp index a1756c0b11d..6f1dc7ec272 100644 --- a/ydb/core/driver_lib/cli_utils/cli_keyvalue.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_keyvalue.cpp @@ -10,9 +10,9 @@ namespace NDriverClient { struct TCmdKeyValueConfig : public TCliCmdConfig { bool IsReadToFile; bool IsWriteFromFile; - TString ReadToPath; - TString WriteFromPath; - TString Proto; + TString ReadToPath; + TString WriteFromPath; + TString Proto; TCmdKeyValueConfig(); @@ -52,7 +52,7 @@ int KeyValueRequest(TCommandConfig &cmdConf, int argc, char **argv) { TCmdKeyValueConfig requestConfig; requestConfig.Parse(argc, argv); - TVector<NKikimrClient::TKeyValueRequest> records; + TVector<NKikimrClient::TKeyValueRequest> records; NKikimrClient::TKeyValueRequest& record = *records.emplace(records.end()); const bool isOk = ::google::protobuf::TextFormat::ParseFromString(requestConfig.Proto, &record); @@ -63,7 +63,7 @@ int KeyValueRequest(TCommandConfig &cmdConf, int argc, char **argv) { const ui32 maxReadBlockSize = 20 << 20; const ui32 maxWriteBlockSize = 16 << 20; - TString readBuffer; + TString readBuffer; if (requestConfig.IsReadToFile) { Y_VERIFY(record.CmdReadSize() == 1); auto& cmdRead = *record.MutableCmdRead(0); @@ -74,13 +74,13 @@ int KeyValueRequest(TCommandConfig &cmdConf, int argc, char **argv) { Y_VERIFY(record.CmdWriteSize() == 1); Y_VERIFY(record.GetCmdWrite(0).HasKey()); Y_VERIFY(!record.GetCmdWrite(0).HasValue()); - TString data = TUnbufferedFileInput(requestConfig.WriteFromPath).ReadAll(); + TString data = TUnbufferedFileInput(requestConfig.WriteFromPath).ReadAll(); if (data.size() <= maxWriteBlockSize) { record.MutableCmdWrite(0)->SetValue(data); } else { const auto& originalCmdWrite = record.GetCmdWrite(0); - TString key = originalCmdWrite.GetKey(); - TVector<TString> parts; + TString key = originalCmdWrite.GetKey(); + TVector<TString> parts; ui64 tabletId = record.GetTabletId(); @@ -117,7 +117,7 @@ int KeyValueRequest(TCommandConfig &cmdConf, int argc, char **argv) { NKikimrClient::TKeyValueRequest& last = *records.emplace(records.end()); last.SetTabletId(tabletId); auto& cmdConcat = *last.AddCmdConcat(); - for (const TString& part : parts) { + for (const TString& part : parts) { cmdConcat.AddInputKeys(part); } cmdConcat.SetOutputKey(key); @@ -139,7 +139,7 @@ int KeyValueRequest(TCommandConfig &cmdConf, int argc, char **argv) { Y_VERIFY(response.GetReadResult(0).HasStatus()); Y_VERIFY(response.GetReadResult(0).GetStatus() == NKikimrProto::OK); Y_VERIFY(response.GetReadResult(0).HasValue()); - TString data = response.GetReadResult(0).GetValue(); + TString data = response.GetReadResult(0).GetValue(); readBuffer += data; if (data.size() == maxReadBlockSize) { @@ -159,7 +159,7 @@ int KeyValueRequest(TCommandConfig &cmdConf, int argc, char **argv) { Y_FAIL("unexpected case"); } } else { - TString str; + TString str; const bool isOk = ::google::protobuf::TextFormat::PrintToString(response, &str); if (!isOk) { ythrow TWithBackTrace<yexception>() << "Error printing response to string!"; diff --git a/ydb/core/driver_lib/cli_utils/cli_load.cpp b/ydb/core/driver_lib/cli_utils/cli_load.cpp index c2567f5e4f9..fe8d8df8bd3 100644 --- a/ydb/core/driver_lib/cli_utils/cli_load.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_load.cpp @@ -5,7 +5,7 @@ namespace NKikimr { namespace NDriverClient { struct TCmdLoadConfig : public TCliCmdConfig { - TString Proto; + TString Proto; void Parse(int argc, char **argv) { using namespace NLastGetopt; diff --git a/ydb/core/driver_lib/cli_utils/cli_mb_trace.cpp b/ydb/core/driver_lib/cli_utils/cli_mb_trace.cpp index df1fa4a79f3..d6886f00663 100644 --- a/ydb/core/driver_lib/cli_utils/cli_mb_trace.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_mb_trace.cpp @@ -6,8 +6,8 @@ namespace NKikimr { namespace NDriverClient { struct TCmdMessageBusTraceConfig : public TCliCmdConfig { - TString Command; - TString Path; + TString Command; + TString Path; ui32 MaxInFlight; TCmdMessageBusTraceConfig() : MaxInFlight(1) {} diff --git a/ydb/core/driver_lib/cli_utils/cli_minikql_compile_and_exec.cpp b/ydb/core/driver_lib/cli_utils/cli_minikql_compile_and_exec.cpp index b4429d5721b..8c3cb1fe29b 100644 --- a/ydb/core/driver_lib/cli_utils/cli_minikql_compile_and_exec.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_minikql_compile_and_exec.cpp @@ -20,11 +20,11 @@ struct TCmdCompileAndExecMiniKQLConfig : public TCliCmdConfig { void Parse(int argc, char **argv); - TString PathToTextPgm; - TString PathToBinPgm; + TString PathToTextPgm; + TString PathToBinPgm; - TString PathToTextParams; - TString PathToBinParams; + TString PathToTextParams; + TString PathToBinParams; }; int CompileAndExecMiniKQL(TCommandConfig &cmdConf, int argc, char **argv) { @@ -47,18 +47,18 @@ int CompileAndExecMiniKQL(TCommandConfig &cmdConf, int argc, char **argv) { auto* mkqlTx = request->Record.MutableTransaction()->MutableMiniKQLTransaction(); if (config.PathToBinPgm) { - TString pgmBin = TFileInput(config.PathToBinPgm).ReadAll(); + TString pgmBin = TFileInput(config.PathToBinPgm).ReadAll(); mkqlTx->MutableProgram()->SetBin(pgmBin); } else if (config.PathToTextPgm) { - TString pgmText = TFileInput(config.PathToTextPgm).ReadAll(); + TString pgmText = TFileInput(config.PathToTextPgm).ReadAll(); mkqlTx->MutableProgram()->SetText(pgmText); } if (config.PathToBinParams) { - TString paramsBin = TFileInput(config.PathToBinParams).ReadAll(); + TString paramsBin = TFileInput(config.PathToBinParams).ReadAll(); mkqlTx->MutableParams()->SetBin(paramsBin); } else if (config.PathToTextParams) { - TString paramsText = TFileInput(config.PathToTextParams).ReadAll(); + TString paramsText = TFileInput(config.PathToTextParams).ReadAll(); mkqlTx->MutableParams()->SetText(paramsText); } @@ -82,7 +82,7 @@ int CompileAndExecMiniKQL(TCommandConfig &cmdConf, int argc, char **argv) { if (config.PathToBinPgm) { errors.PrintTo(Cerr); } else { - const TString pgmText = TFileInput(config.PathToTextPgm).ReadAll(); + const TString pgmText = TFileInput(config.PathToTextPgm).ReadAll(); errors.PrintWithProgramTo(Cerr, config.PathToTextPgm, pgmText); } } @@ -94,7 +94,7 @@ int CompileAndExecMiniKQL(TCommandConfig &cmdConf, int argc, char **argv) { if (config.PathToBinParams) { errors.PrintTo(Cerr); } else { - const TString paramsText = TFileInput(config.PathToTextParams).ReadAll(); + const TString paramsText = TFileInput(config.PathToTextParams).ReadAll(); errors.PrintWithProgramTo(Cerr, config.PathToTextParams, paramsText); } } diff --git a/ydb/core/driver_lib/cli_utils/cli_persqueue.cpp b/ydb/core/driver_lib/cli_utils/cli_persqueue.cpp index 66bc9151e50..8917fba4d00 100644 --- a/ydb/core/driver_lib/cli_utils/cli_persqueue.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_persqueue.cpp @@ -6,7 +6,7 @@ namespace NKikimr { namespace NDriverClient { struct TCmdPersQueueStressConfig : public TCliCmdConfig { - TString Proto; //for config + TString Proto; //for config TCmdPersQueueStressConfig(); void Parse(int argc, char **argv); @@ -39,7 +39,7 @@ TCmdPersQueueStressConfig::TCmdPersQueueStressConfig() void TCmdPersQueueStressConfig::Parse(int argc, char **argv) { using namespace NLastGetopt; - TString fileName; + TString fileName; TOpts opts = TOpts::Default(); opts.AddLongOption("protobuf", "string representation of the request protobuf").Optional().StoreResult(&Proto); @@ -52,7 +52,7 @@ void TCmdPersQueueStressConfig::Parse(int argc, char **argv) { exit(1); } if (fileName) { - Proto = TUnbufferedFileInput(fileName).ReadAll(); + Proto = TUnbufferedFileInput(fileName).ReadAll(); } ConfigureMsgBusLastGetopt(res, argc, argv); } diff --git a/ydb/core/driver_lib/cli_utils/cli_persqueue_stress.cpp b/ydb/core/driver_lib/cli_utils/cli_persqueue_stress.cpp index 39b6a0c07c9..9d5b13ea8df 100644 --- a/ydb/core/driver_lib/cli_utils/cli_persqueue_stress.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_persqueue_stress.cpp @@ -7,10 +7,10 @@ namespace NDriverClient { struct TCmdPersQueueConfig : public TCliCmdConfig { bool IsWrite; - TString Topic; + TString Topic; ui32 Partition; //write options - TString SourceId; + TString SourceId; ui32 OneCmdMinSize; ui32 OneCmdMaxSize; //read options @@ -35,9 +35,9 @@ int PersQueueStress(TCommandConfig &cmdConf, int argc, char** argv) { ui64 DoneBytes = 0; TInstant timestamp = TInstant::Now(); - TVector<ui32> buckets(3000); + TVector<ui32> buckets(3000); - TString cookie; + TString cookie; { TAutoPtr<NMsgBusProxy::TBusPersQueue> request(new NMsgBusProxy::TBusPersQueue); auto pr = request->Record.MutablePartitionRequest(); @@ -83,7 +83,7 @@ int PersQueueStress(TCommandConfig &cmdConf, int argc, char** argv) { write->SetSourceId(config.SourceId); write->SetSeqNo(++seqNo); ui32 size = config.OneCmdMinSize + rand() % (config.OneCmdMaxSize - config.OneCmdMinSize + 1); - write->SetData(TString(size, 'a')); + write->SetData(TString(size, 'a')); totalSize += size; } TInstant tt = TInstant::Now(); @@ -176,7 +176,7 @@ void TCmdPersQueueConfig::Parse(int argc, char **argv) { TOpts opts = TOpts::Default(); - TString command; + TString command; opts.AddLongOption('c', "command", "type of action").Required().RequiredArgument("[write|read]").StoreResult(&command); opts.AddLongOption("topic", "topic").Required().RequiredArgument("STR").StoreResult(&Topic); opts.AddLongOption("partition", "partition").Required().RequiredArgument("NUM").StoreResult(&Partition); diff --git a/ydb/core/driver_lib/cli_utils/cli_scheme_initroot.cpp b/ydb/core/driver_lib/cli_utils/cli_scheme_initroot.cpp index ebca272cc4d..f31ad61d969 100644 --- a/ydb/core/driver_lib/cli_utils/cli_scheme_initroot.cpp +++ b/ydb/core/driver_lib/cli_utils/cli_scheme_initroot.cpp @@ -8,7 +8,7 @@ namespace NKikimr { namespace NDriverClient { struct TCmdSchemeInitShardConfig : public TCliCmdConfig { - TString TagName; + TString TagName; TAutoPtr<NKikimrTxScheme::TConfig> GlobalConfig; @@ -65,8 +65,8 @@ TCmdSchemeInitShardConfig::TCmdSchemeInitShardConfig() void TCmdSchemeInitShardConfig::Parse(int argc, char **argv) { using namespace NLastGetopt; - TString configPb; - TString configPbFile; + TString configPb; + TString configPbFile; TOpts opts = TOpts::Default(); opts.AddLongOption('n', "name", "domain name").Required().RequiredArgument("STR").StoreResult(&TagName); diff --git a/ydb/core/driver_lib/cli_utils/proto_common.h b/ydb/core/driver_lib/cli_utils/proto_common.h index 7220fa47eee..08ed317c958 100644 --- a/ydb/core/driver_lib/cli_utils/proto_common.h +++ b/ydb/core/driver_lib/cli_utils/proto_common.h @@ -3,7 +3,7 @@ namespace NKikimr { namespace NDriverClient { - inline TString GetProtobufEnumOptions(const google::protobuf::EnumDescriptor *desc) { + inline TString GetProtobufEnumOptions(const google::protobuf::EnumDescriptor *desc) { TStringStream options; options << "{"; for (int i = 0; i < desc->value_count(); ++i) { @@ -13,7 +13,7 @@ namespace NKikimr { return options.Str(); } - inline int GetProtobufOption(const google::protobuf::EnumDescriptor *desc, const char *option, const TString& optval) { + inline int GetProtobufOption(const google::protobuf::EnumDescriptor *desc, const char *option, const TString& optval) { const google::protobuf::EnumValueDescriptor *value = desc->FindValueByName(optval); if (!value) { int num; diff --git a/ydb/core/driver_lib/run/config_parser.h b/ydb/core/driver_lib/run/config_parser.h index 5825ec6c49e..6c20aa03ab9 100644 --- a/ydb/core/driver_lib/run/config_parser.h +++ b/ydb/core/driver_lib/run/config_parser.h @@ -31,10 +31,10 @@ protected: ui32 LogLevel; // log settings ui32 LogSamplingLevel; // log settings ui32 LogSamplingRate; // log settings - TString LogFormat;// log settings - TString ClusterName; // log settings - TString UDFsDir; // directory to recurcively load UDFs from - TVector<TString> UDFsPaths; // fine tunned UDFs list to load + TString LogFormat;// log settings + TString ClusterName; // log settings + TString UDFsDir; // directory to recurcively load UDFs from + TVector<TString> UDFsPaths; // fine tunned UDFs list to load TGlobalOpts(); }; @@ -45,13 +45,13 @@ protected: ui32 BusProxyPort; NBus::TBusQueueConfig ProxyBusQueueConfig; NBus::TBusServerSessionConfig ProxyBusSessionConfig; - TVector<ui64> ProxyBindToProxy; + TVector<ui64> ProxyBindToProxy; ui32 MonitoringPort; TString MonitoringAddress; ui32 MonitoringThreads; - TString RestartsCountFile; + TString RestartsCountFile; bool StartTracingBusProxy; - TString TracePath; + TString TracePath; size_t CompileInflightLimit; // MiniKQLCompileService TRunOpts(); diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp index 819c1478d19..301f23bb55d 100644 --- a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp +++ b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp @@ -546,10 +546,10 @@ void TBasicServicesInitializer::InitializeServices(NActors::TActorSystemSetup* s TIntrusivePtr<TTableNameserverSetup> table(new TTableNameserverSetup()); for (const auto &node : nsConfig.GetNode()) { const ui32 nodeId = node.GetNodeId(); - const TString host = node.HasHost() ? node.GetHost() : TString(); + const TString host = node.HasHost() ? node.GetHost() : TString(); const ui32 port = node.GetPort(); - const TString resolveHost = node.HasInterconnectHost() ? + const TString resolveHost = node.HasInterconnectHost() ? node.GetInterconnectHost() : host; // Use ip address only when dns host not specified @@ -1111,16 +1111,16 @@ void TResourceBrokerInitializer::InitializeServices( // TRestartsCountPublisher void TRestartsCountPublisher::PublishRestartsCount(const NMonitoring::TDynamicCounters::TCounterPtr& counter, - const TString& restartsCountFile) { + const TString& restartsCountFile) { if (restartsCountFile.size()) { try { - TUnbufferedFileInput fileInput(restartsCountFile); - const TString content = fileInput.ReadAll(); + TUnbufferedFileInput fileInput(restartsCountFile); + const TString content = fileInput.ReadAll(); *counter = FromString<ui32>(content); } catch (yexception) { *counter = 0; } - TUnbufferedFileOutput fileOutput(restartsCountFile); + TUnbufferedFileOutput fileOutput(restartsCountFile); fileOutput.Write(ToString(*counter+1)); } } @@ -1242,7 +1242,7 @@ void TGRpcProxyStatusInitializer::InitializeServices( // This code is shared between default kikimr bootstrapper and alternative bootstrapper static TIntrusivePtr<TTabletSetupInfo> CreateTablet( - const TString& typeName, + const TString& typeName, const TIntrusivePtr<TTabletStorageInfo>& tabletInfo, const TAppData* appData, const TIntrusivePtr<ITabletFactory>& customTablets = nullptr) @@ -1936,7 +1936,7 @@ TKqpServiceInitializer::TKqpServiceInitializer( void TKqpServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) { bool enableKqp = true; - TVector<NKikimrKqp::TKqpSetting> settings; + TVector<NKikimrKqp::TKqpSetting> settings; if (Config.HasKQPConfig()) { auto& kqpConfig = Config.GetKQPConfig(); if (kqpConfig.HasEnable()) { @@ -2020,8 +2020,8 @@ TTxProxyInitializer::TTxProxyInitializer(const TKikimrRunConfig &runConfig) { } -TVector<ui64> TTxProxyInitializer::CollectAllAllocatorsFromAllDomains(const TAppData *appData) { - TVector<ui64> allocators; +TVector<ui64> TTxProxyInitializer::CollectAllAllocatorsFromAllDomains(const TAppData *appData) { + TVector<ui64> allocators; for (auto it: appData->DomainsInfo->Domains) { auto &domain = it.second; for (auto tabletId: domain->TxAllocators) { @@ -2077,7 +2077,7 @@ void TLeaseHolderInitializer::InitializeServices(NActors::TActorSystemSetup* set { // Lease holder is required for dynamic nodes only. if (Config.GetDynamicNodeConfig().HasNodeInfo()) { - TInstant expire = TInstant::MicroSeconds(Config.GetDynamicNodeConfig().GetNodeInfo().GetExpire()); + TInstant expire = TInstant::MicroSeconds(Config.GetDynamicNodeConfig().GetNodeInfo().GetExpire()); auto holder = NNodeBroker::CreateLeaseHolder(expire); setup->LocalServices.emplace_back(TActorId(), TActorSetupCmd(holder, TMailboxType::HTSwap, appData->UserPoolId)); diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.h b/ydb/core/driver_lib/run/kikimr_services_initializers.h index 407ce1bb7ba..21a36edd47d 100644 --- a/ydb/core/driver_lib/run/kikimr_services_initializers.h +++ b/ydb/core/driver_lib/run/kikimr_services_initializers.h @@ -169,7 +169,7 @@ public: class TRestartsCountPublisher : public IKikimrServicesInitializer { static void PublishRestartsCount(const NMonitoring::TDynamicCounters::TCounterPtr& counter, - const TString& restartsCountFile); + const TString& restartsCountFile); public: TRestartsCountPublisher(const TKikimrRunConfig& runConfig); @@ -203,7 +203,7 @@ public: }; class TTxProxyInitializer : public IKikimrServicesInitializer { - TVector<ui64> CollectAllAllocatorsFromAllDomains(const NKikimr::TAppData* appData); + TVector<ui64> CollectAllAllocatorsFromAllDomains(const NKikimr::TAppData* appData); public: TTxProxyInitializer(const TKikimrRunConfig& runConfig); diff --git a/ydb/core/driver_lib/run/main.cpp b/ydb/core/driver_lib/run/main.cpp index f0a9315685b..06efa9c6df0 100644 --- a/ydb/core/driver_lib/run/main.cpp +++ b/ydb/core/driver_lib/run/main.cpp @@ -96,7 +96,7 @@ int MainRun(const TKikimrRunConfig& runConfig, std::shared_ptr<TModuleFactories> if (mode == EDM_NO) { fprintf(stderr, "Unknown command '%s'\n\n", *argv); - opts.PrintUsage(TString("")); + opts.PrintUsage(TString("")); exit(1); } diff --git a/ydb/core/driver_lib/run/run.cpp b/ydb/core/driver_lib/run/run.cpp index a4f74aa4e0f..e249b813cd4 100644 --- a/ydb/core/driver_lib/run/run.cpp +++ b/ydb/core/driver_lib/run/run.cpp @@ -144,7 +144,7 @@ public: const ui32 domainId = domain.GetDomainId(); const ui64 schemeRoot = domain.HasSchemeRoot() ? domain.GetSchemeRoot() : 0; const ui64 planResolution = domain.HasPlanResolution() ? domain.GetPlanResolution() : 500; - const TString domainName = domain.HasName() ? domain.GetName() : Sprintf("domain-%" PRIu32, domainId); + const TString domainName = domain.HasName() ? domain.GetName() : Sprintf("domain-%" PRIu32, domainId); TDomainsInfo::TDomain::TStoragePoolKinds poolTypes; for (auto &type : domain.GetStoragePoolTypes()) { Y_VERIFY(!poolTypes.contains(type.GetKind()), "duplicated slot type"); @@ -242,7 +242,7 @@ public: for (const NKikimrConfig::TChannelProfileConfig::TProfile::TChannel &channel : profile.GetChannel()) { Y_VERIFY(channel.HasErasureSpecies()); Y_VERIFY(channel.HasPDiskCategory()); - TString name = channel.GetErasureSpecies(); + TString name = channel.GetErasureSpecies(); TBlobStorageGroupType::EErasureSpecies erasure = TBlobStorageGroupType::ErasureSpeciesByName(name); if (erasure == TBlobStorageGroupType::ErasureSpeciesCount) { ythrow yexception() << "wrong erasure species \"" << name << "\""; @@ -836,12 +836,12 @@ void TKikimrRunner::InitializeAppData(const TKikimrRunConfig& runConfig) const ui32 userPoolId = cfg.GetActorSystemConfig().HasUserExecutor() ? cfg.GetActorSystemConfig().GetUserExecutor() : 0; const ui32 ioPoolId = cfg.GetActorSystemConfig().HasIoExecutor() ? cfg.GetActorSystemConfig().GetIoExecutor() : 0; const ui32 batchPoolId = cfg.GetActorSystemConfig().HasBatchExecutor() ? cfg.GetActorSystemConfig().GetBatchExecutor() : 0; - TMap<TString, ui32> servicePools; + TMap<TString, ui32> servicePools; for (ui32 i = 0; i < cfg.GetActorSystemConfig().ServiceExecutorSize(); ++i) { auto item = cfg.GetActorSystemConfig().GetServiceExecutor(i); - const TString service = item.GetServiceName(); + const TString service = item.GetServiceName(); const ui32 pool = item.GetExecutorId(); - servicePools.insert(std::pair<TString, ui32>(service, pool)); + servicePools.insert(std::pair<TString, ui32>(service, pool)); } AppData.Reset(new TAppData(sysPoolId, userPoolId, ioPoolId, batchPoolId, @@ -990,7 +990,7 @@ void TKikimrRunner::InitializeLogSettings(const TKikimrRunConfig& runConfig) } if (LogSettings->Format == NLog::TSettings::JSON_FORMAT) { - TString fullHostName = HostName(); + TString fullHostName = HostName(); size_t firstDot = fullHostName.find_first_of('.'); LogSettings->ShortHostName = fullHostName.substr(0, firstDot); } @@ -1003,7 +1003,7 @@ void TKikimrRunner::ApplyLogSettings(const TKikimrRunConfig& runConfig) auto logConfig = runConfig.AppConfig.GetLogConfig(); for (const auto& entry : logConfig.GetEntry()) { - const TString& componentName = entry.GetComponent(); + const TString& componentName = entry.GetComponent(); NLog::EComponent component; if (componentName.empty()) { @@ -1014,7 +1014,7 @@ void TKikimrRunner::ApplyLogSettings(const TKikimrRunConfig& runConfig) componentName.data()); } - TString explanation; + TString explanation; if (entry.HasLevel()) { Y_VERIFY(LogSettings->SetLevel((NLog::EPriority)entry.GetLevel(), component, explanation) == 0); } @@ -1332,8 +1332,8 @@ void RegisterBaseTagForMemoryProfiling(TActorSystem* as) { Y_VERIFY(as != nullptr); if (as->MemProfActivityBase != 0) return; - TVector<TString> holders; - TVector<const char*> activityNames; + TVector<TString> holders; + TVector<const char*> activityNames; for (ui32 i = 0; i < NKikimrServices::TActivity::EType_ARRAYSIZE; ++i) { auto current = (NKikimrServices::TActivity::EType)i; const char* currName = NKikimrServices::TActivity::EType_Name(current).c_str(); @@ -1530,9 +1530,9 @@ void TKikimrRunner::InitializeRegistries(const TKikimrRunConfig& runConfig) { FormatFactory.Reset(new TFormatFactory); #ifdef KIKIMR_UDF_DYNAMIC_LINK - const TString& udfsDir = runConfig.AppConfig.GetUDFsDir(); + const TString& udfsDir = runConfig.AppConfig.GetUDFsDir(); - TVector<TString> udfsPaths; + TVector<TString> udfsPaths; if (!udfsDir.empty()) { if (NFs::Exists(udfsDir) && IsDir(udfsDir)) { NMiniKQL::FindUdfsInDir(udfsDir, &udfsPaths); diff --git a/ydb/core/driver_lib/run/service_initializer.h b/ydb/core/driver_lib/run/service_initializer.h index 870fd3da689..2bd11a64bfa 100644 --- a/ydb/core/driver_lib/run/service_initializer.h +++ b/ydb/core/driver_lib/run/service_initializer.h @@ -16,7 +16,7 @@ struct IAppDataInitializer : public virtual TThrRefBase { class TAppDataInitializersList : public IAppDataInitializer { - TList<TIntrusivePtr<IAppDataInitializer> > AppDataInitializersList; + TList<TIntrusivePtr<IAppDataInitializer> > AppDataInitializersList; public: void AddAppDataInitializer(TIntrusivePtr<IAppDataInitializer> appDataInitializer); @@ -34,7 +34,7 @@ struct IServiceInitializer: public virtual TThrRefBase { class TServiceInitializersList : public IServiceInitializer { - TList<TIntrusivePtr<IServiceInitializer> > ServiceInitializersList; + TList<TIntrusivePtr<IServiceInitializer> > ServiceInitializersList; public: void AddServiceInitializer(TIntrusivePtr<IServiceInitializer> serviceInitializer); diff --git a/ydb/core/engine/kikimr_program_builder.cpp b/ydb/core/engine/kikimr_program_builder.cpp index fd32a772ee9..265b7b1ec3f 100644 --- a/ydb/core/engine/kikimr_program_builder.cpp +++ b/ydb/core/engine/kikimr_program_builder.cpp @@ -194,13 +194,13 @@ TRuntimeNode TKikimrProgramBuilder::RewriteNullType( return DoRewriteNullType(value, expectedType, NullInternName, Env); } -TVector<TRuntimeNode> TKikimrProgramBuilder::FixKeysType( +TVector<TRuntimeNode> TKikimrProgramBuilder::FixKeysType( const TArrayRef<const ui32>& keyTypes, const TKeyColumnValues& row) const { MKQL_ENSURE(!row.empty(), "Expected at least 1 key column"); MKQL_ENSURE(keyTypes.size() == row.size(), "Mismatch of key types count"); - TVector<TRuntimeNode> tmp(row.size()); + TVector<TRuntimeNode> tmp(row.size()); for (ui32 i = 0; i < row.size(); ++i) { tmp[i] = RewriteNullType(row[i], keyTypes[i]); bool isOptional; @@ -297,8 +297,8 @@ TRuntimeNode TKikimrProgramBuilder::SelectRange( MKQL_ENSURE(options.FromColumns.size() > 0, "Expected at least one key component in the 'from' section of the range"); const ui32 maxKeyColumnsCount = ::Max<ui32>(options.FromColumns.size(), options.ToColumns.size()); MKQL_ENSURE(keyTypes.size() == maxKeyColumnsCount, "Mismatch of key types count"); - TVector<TRuntimeNode> from(options.FromColumns.size()); - TVector<TRuntimeNode> to(options.ToColumns.size()); + TVector<TRuntimeNode> from(options.FromColumns.size()); + TVector<TRuntimeNode> to(options.ToColumns.size()); for (ui32 i = 0; i < maxKeyColumnsCount; ++i) { TDataType* dataFrom = nullptr; TDataType* dataTo = nullptr; @@ -560,7 +560,7 @@ TRuntimeNode TKikimrProgramBuilder::Bind(TRuntimeNode program, TRuntimeNode para retItemType = AS_TYPE(TListType, retItemType)->GetItemType(); } - TVector<TRuntimeNode> mapResults; + TVector<TRuntimeNode> mapResults; mapResults.reserve(list->GetItemsCount()); TExploringNodeVisitor explorer; diff --git a/ydb/core/engine/kikimr_program_builder.h b/ydb/core/engine/kikimr_program_builder.h index 717132c0b96..782e597c1d4 100644 --- a/ydb/core/engine/kikimr_program_builder.h +++ b/ydb/core/engine/kikimr_program_builder.h @@ -234,7 +234,7 @@ public: private: TRuntimeNode NewDataLiteral(const std::pair<ui64, ui64>& data) const; TRuntimeNode BuildTableId(const TTableId& tableId) const; - TVector<TRuntimeNode> FixKeysType( + TVector<TRuntimeNode> FixKeysType( const TArrayRef<const ui32>& keyTypes, const TKeyColumnValues& row) const; TRuntimeNode RewriteNullType( diff --git a/ydb/core/engine/kikimr_program_builder_ut.cpp b/ydb/core/engine/kikimr_program_builder_ut.cpp index efa073ae2f8..35b96466f8e 100644 --- a/ydb/core/engine/kikimr_program_builder_ut.cpp +++ b/ydb/core/engine/kikimr_program_builder_ut.cpp @@ -68,11 +68,11 @@ namespace NMiniKQL { Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { void VerifySerialization(TNode* pgm, const TTypeEnvironment& env) { - TString s = PrintNode(pgm); - TString serialized = SerializeNode(pgm, env); + TString s = PrintNode(pgm); + TString serialized = SerializeNode(pgm, env); Cout << "Serialized as " << serialized.size() << " bytes" << Endl; TNode* pgm2 = DeserializeNode(serialized, env); - TString s2 = PrintNode(pgm2); + TString s2 = PrintNode(pgm2); UNIT_ASSERT_EQUAL(s, s2); } @@ -86,12 +86,12 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { auto functionRegistry = CreateFunctionRegistry(CreateBuiltinRegistry()); TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); - TVector<TRuntimeNode> keyColumns; + TVector<TRuntimeNode> keyColumns; keyColumns.push_back(pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42)); keyColumns.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id)); keyColumns.push_back(pgmBuilder.NewOptional( pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("qwe"))); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id, NUdf::TDataType<char*>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id, NUdf::TDataType<char*>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.EraseRow(TTableId(1, 2), keyTypes, keyColumns)); @@ -101,7 +101,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Erase); @@ -129,13 +129,13 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { auto functionRegistry = CreateFunctionRegistry(CreateBuiltinRegistry()); TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); - TVector<TRuntimeNode> keyColumns; + TVector<TRuntimeNode> keyColumns; keyColumns.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id)); keyColumns.push_back(pgmBuilder.Add( pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(34), pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(12))); keyColumns.push_back(pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("qwe")); - TVector<ui32> keyTypes({ NUdf::TDataType<ui64>::Id, NUdf::TDataType<ui32>::Id, NUdf::TDataType<char*>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui64>::Id, NUdf::TDataType<ui32>::Id, NUdf::TDataType<char*>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.EraseRow(TTableId(1, 2), keyTypes, keyColumns)); @@ -145,7 +145,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Erase); @@ -171,13 +171,13 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { auto functionRegistry = CreateFunctionRegistry(CreateBuiltinRegistry()); TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); - TVector<TRuntimeNode> keyColumns; + TVector<TRuntimeNode> keyColumns; keyColumns.push_back(pgmBuilder.Add( pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(34), pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(12))); keyColumns.push_back(pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("qwe")); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<char*>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<char*>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.EraseRow(TTableId(1, 2), keyTypes, keyColumns)); @@ -187,7 +187,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Erase); @@ -210,15 +210,15 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { auto functionRegistry = CreateFunctionRegistry(CreateBuiltinRegistry()); TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); - TVector<TRuntimeNode> keyColumns; + TVector<TRuntimeNode> keyColumns; keyColumns.push_back(pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42)); keyColumns.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id)); keyColumns.push_back(pgmBuilder.NewOptional( pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("qwe"))); - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; columnsToRead.emplace_back("column1", 34, (ui32)NUdf::TDataType<ui32>::Id); columnsToRead.emplace_back("column2", 56, (ui32)NUdf::TDataType<ui64>::Id); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id, NUdf::TDataType<char*>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id, NUdf::TDataType<char*>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.SetResult("myRes", pgmBuilder.SelectRow(TTableId(1, 2), keyTypes, @@ -229,7 +229,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Read); @@ -263,7 +263,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { auto functionRegistry = CreateFunctionRegistry(CreateBuiltinRegistry()); TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); - TVector<TRuntimeNode> keyColumns; + TVector<TRuntimeNode> keyColumns; keyColumns.push_back(pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42)); keyColumns.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id)); keyColumns.push_back(pgmBuilder.NewOptional( @@ -274,7 +274,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { update.EraseColumn(56); update.InplaceUpdateColumn(78, NUdf::TDataType<ui64>::Id, pgmBuilder.TProgramBuilder::NewDataLiteral<ui64>(1), EInplaceUpdateMode::Sum); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id, NUdf::TDataType<char*>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id, NUdf::TDataType<char*>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.UpdateRow(TTableId(1, 2), keyTypes, keyColumns, update)); @@ -284,7 +284,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Update); @@ -321,7 +321,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { auto functionRegistry = CreateFunctionRegistry(CreateBuiltinRegistry()); TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); - TVector<TRuntimeNode> keyColumns; + TVector<TRuntimeNode> keyColumns; keyColumns.push_back(pgmBuilder.Add( pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(34), pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(12))); @@ -334,7 +334,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { update.EraseColumn(56); update.InplaceUpdateColumn(78, NUdf::TDataType<ui64>::Id, pgmBuilder.TProgramBuilder::NewDataLiteral<ui64>(1), EInplaceUpdateMode::Sum); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id, NUdf::TDataType<char*>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id, NUdf::TDataType<char*>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.UpdateRow(TTableId(1, 2), keyTypes, keyColumns, update)); @@ -344,7 +344,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Update); @@ -380,15 +380,15 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); TTableRangeOptions options(pgmBuilder.GetDefaultTableRangeOptions()); - TVector<TRuntimeNode> from; + TVector<TRuntimeNode> from; from.push_back(pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42)); from.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id)); options.FromColumns = from; - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; columnsToRead.emplace_back("column1", 34, (ui32)NUdf::TDataType<ui32>::Id); columnsToRead.emplace_back("column2", 56, (ui32)NUdf::TDataType<ui64>::Id); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.SetResult("myRes", pgmBuilder.SelectRange(TTableId(1, 2), keyTypes, @@ -399,7 +399,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Read); @@ -429,16 +429,16 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); TTableRangeOptions options(pgmBuilder.GetDefaultTableRangeOptions()); - TVector<TRuntimeNode> from; + TVector<TRuntimeNode> from; from.push_back(pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42)); from.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id)); options.FromColumns = from; options.Flags = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(TReadRangeOptions::TFlags::ExcludeInitValue); - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; columnsToRead.emplace_back("column1", 34, (ui32)NUdf::TDataType<ui32>::Id); columnsToRead.emplace_back("column2", 56, (ui32)NUdf::TDataType<ui64>::Id); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.SetResult("myRes", pgmBuilder.SelectRange(TTableId(1, 2), keyTypes, @@ -449,7 +449,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Read); @@ -479,18 +479,18 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); TTableRangeOptions options(pgmBuilder.GetDefaultTableRangeOptions()); - TVector<TRuntimeNode> from; + TVector<TRuntimeNode> from; from.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id)); - TVector<TRuntimeNode> to; + TVector<TRuntimeNode> to; to.push_back(pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42)); to.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id)); options.FromColumns = from; options.ToColumns = to; - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; columnsToRead.emplace_back("column1", 34, (ui32)NUdf::TDataType<ui32>::Id); columnsToRead.emplace_back("column2", 56, (ui32)NUdf::TDataType<ui64>::Id); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.SetResult("myRes", pgmBuilder.SelectRange(TTableId(1, 2), keyTypes, @@ -501,7 +501,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Read); @@ -533,19 +533,19 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); TTableRangeOptions options(pgmBuilder.GetDefaultTableRangeOptions()); - TVector<TRuntimeNode> from; + TVector<TRuntimeNode> from; from.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id)); - TVector<TRuntimeNode> to; + TVector<TRuntimeNode> to; to.push_back(pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42)); to.push_back(pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id)); options.FromColumns = from; options.ToColumns = to; options.Flags = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(TReadRangeOptions::TFlags::ExcludeTermValue); - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; columnsToRead.emplace_back("column1", 34, (ui32)NUdf::TDataType<ui32>::Id); columnsToRead.emplace_back("column2", 56, (ui32)NUdf::TDataType<ui64>::Id); - TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<ui32>::Id, NUdf::TDataType<ui64>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.SetResult("myRes", pgmBuilder.SelectRange(TTableId(1, 2), keyTypes, @@ -556,7 +556,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Read); @@ -588,17 +588,17 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); TTableRangeOptions options(pgmBuilder.GetDefaultTableRangeOptions()); - TVector<TRuntimeNode> from; - TVector<TRuntimeNode> to; + TVector<TRuntimeNode> from; + TVector<TRuntimeNode> to; from.push_back(pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("a")); to.push_back(pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("bc")); options.FromColumns = from; options.ToColumns = to; - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; columnsToRead.emplace_back("column1", 34, (ui32)NUdf::TDataType<ui32>::Id); columnsToRead.emplace_back("column2", 56, (ui32)NUdf::TDataType<ui64>::Id); - TVector<ui32> keyTypes({ NUdf::TDataType<char*>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<char*>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.SetResult("myRes", pgmBuilder.SelectRange(TTableId(1, 2), keyTypes, @@ -609,7 +609,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Read); @@ -638,8 +638,8 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TKikimrProgramBuilder pgmBuilder(env, *functionRegistry); auto pgmReturn = pgmBuilder.NewEmptyListOfVoid(); TTableRangeOptions options(pgmBuilder.GetDefaultTableRangeOptions()); - TVector<TRuntimeNode> from; - TVector<TRuntimeNode> to; + TVector<TRuntimeNode> from; + TVector<TRuntimeNode> to; from.push_back(pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("a")); to.push_back(pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("bc")); options.FromColumns = from; @@ -647,10 +647,10 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { options.Flags = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>( TReadRangeOptions::TFlags::ExcludeInitValue | TReadRangeOptions::TFlags::ExcludeTermValue); - TVector<TSelectColumn> columnsToRead; + TVector<TSelectColumn> columnsToRead; columnsToRead.emplace_back("column1", 34, (ui32)NUdf::TDataType<ui32>::Id); columnsToRead.emplace_back("column2", 56, (ui32)NUdf::TDataType<ui64>::Id); - TVector<ui32> keyTypes({ NUdf::TDataType<char*>::Id }); + TVector<ui32> keyTypes({ NUdf::TDataType<char*>::Id }); pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.SetResult("myRes", pgmBuilder.SelectRange(TTableId(1, 2), keyTypes, @@ -661,7 +661,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { TExploringNodeVisitor explorer; explorer.Walk(pgm, env); - TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); + TVector<THolder<TKeyDesc>> tableKeys = ExtractTableKeys(explorer, env); UNIT_ASSERT_VALUES_EQUAL(tableKeys.size(), 1); UNIT_ASSERT(tableKeys[0]->TableId.HasSamePath(TTableId(1, 2))); UNIT_ASSERT(tableKeys[0]->RowOperation == TKeyDesc::ERowOperation::Read); @@ -722,7 +722,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { try { pgmBuilder.Bind(pgmBuilder.AsList(pgmBuilder.SetResult("Result", param)), paramsBuilder.Build()); } catch (const yexception& ex) { - UNIT_ASSERT(TString(ex.what()).EndsWith("Missing value for parameter: Param2")); + UNIT_ASSERT(TString(ex.what()).EndsWith("Missing value for parameter: Param2")); return; } @@ -743,7 +743,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLProgramBuilderTest) { try { pgmBuilder.Bind(pgmBuilder.AsList(pgmBuilder.SetResult("Result", param)), paramsBuilder.Build()); } catch (const yexception& ex) { - UNIT_ASSERT(TString(ex.what()).Contains("Incorrect type for parameter Param1")); + UNIT_ASSERT(TString(ex.what()).Contains("Incorrect type for parameter Param1")); return; } diff --git a/ydb/core/engine/minikql/flat_local_tx_minikql.h b/ydb/core/engine/minikql/flat_local_tx_minikql.h index 0feabf20e68..6d4759b62e4 100644 --- a/ydb/core/engine/minikql/flat_local_tx_minikql.h +++ b/ydb/core/engine/minikql/flat_local_tx_minikql.h @@ -20,7 +20,7 @@ public: : Scheme(scheme) , TabletId(tabletId) {} - virtual NThreading::TFuture<TTableResults> ResolveTables(const TVector<TTable>& tables) override { + virtual NThreading::TFuture<TTableResults> ResolveTables(const TVector<TTable>& tables) override { TTableResults results; results.reserve(tables.size()); @@ -76,8 +76,8 @@ class TFlatLocalMiniKQL : public NTabletFlatExecutor::ITransaction { const TLocalMiniKQLProgram SourceProgram; const TMiniKQLFactory* const Factory; - TString SerializedMiniKQLProgram; - TString SerializedMiniKQLParams; + TString SerializedMiniKQLProgram; + TString SerializedMiniKQLParams; TAutoPtr<NYql::TMiniKQLCompileResult> ProgramCompileResult; @@ -284,7 +284,7 @@ class TFlatLocalMiniKQL : public NTabletFlatExecutor::ITransaction { if (EngineResultStatusCode != IEngineFlat::EResult::Ok) return MakeResponse(proxyEngine.Get(), ctx); - const TString shardProgram = shardData.Program; + const TString shardProgram = shardData.Program; proxyEngine->AfterShardProgramsExtracted(); TEngineHostCounters hostCounters; @@ -326,7 +326,7 @@ class TFlatLocalMiniKQL : public NTabletFlatExecutor::ITransaction { if (EngineResultStatusCode != IEngineFlat::EResult::Ok) return MakeResponse(engine.Get(), ctx); - const TString shardEngineReply = engine->GetShardReply(TabletId); + const TString shardEngineReply = engine->GetShardReply(TabletId); proxyEngine->AddShardReply(TabletId, shardEngineReply); proxyEngine->FinalizeOriginReplies(TabletId); } diff --git a/ydb/core/engine/minikql/minikql_engine_host.cpp b/ydb/core/engine/minikql/minikql_engine_host.cpp index 36c35f32cc4..01323e41aff 100644 --- a/ydb/core/engine/minikql/minikql_engine_host.cpp +++ b/ydb/core/engine/minikql/minikql_engine_host.cpp @@ -119,7 +119,7 @@ bool TEngineHost::IsValidKey(TKeyDesc& key, std::pair<ui64, ui64>& maxSnapshotTi return true; } -ui64 TEngineHost::CalculateReadSize(const TVector<const TKeyDesc*>& keys) const { +ui64 TEngineHost::CalculateReadSize(const TVector<const TKeyDesc*>& keys) const { NTable::TSizeEnv env; for (const TKeyDesc* ki : keys) { @@ -690,7 +690,7 @@ public: GetListIterator().Skip(); } - TString key = FirstKey ? *FirstKey : TString(); + TString key = FirstKey ? *FirstKey : TString(); return MakeString(key); } @@ -720,7 +720,7 @@ private: bool Reverse; mutable TMaybe<bool> Truncated; - mutable TMaybe<TString> FirstKey; + mutable TMaybe<TString> FirstKey; mutable TMaybe<ui64> SizeBytes; TEngineHost& EngineHost; IKeyAccessSampler::TPtr KeyAccessSampler; diff --git a/ydb/core/engine/minikql/minikql_engine_host.h b/ydb/core/engine/minikql/minikql_engine_host.h index 012ee6891bc..dde17220abe 100644 --- a/ydb/core/engine/minikql/minikql_engine_host.h +++ b/ydb/core/engine/minikql/minikql_engine_host.h @@ -99,7 +99,7 @@ public: const TScheme::TTableInfo* GetTableInfo(const TTableId& tableId) const override; bool IsReadonly() const override; bool IsValidKey(TKeyDesc& key, std::pair<ui64, ui64>& maxSnapshotTime) const override; - ui64 CalculateReadSize(const TVector<const TKeyDesc*>& keys) const override; + ui64 CalculateReadSize(const TVector<const TKeyDesc*>& keys) const override; ui64 CalculateResultSize(const TKeyDesc& key) const override; void PinPages(const TVector<THolder<TKeyDesc>>& keys, ui64 pageFaultCount) override; diff --git a/ydb/core/engine/mkql_engine_flat.cpp b/ydb/core/engine/mkql_engine_flat.cpp index c7fe388eef8..211a1f548d0 100644 --- a/ydb/core/engine/mkql_engine_flat.cpp +++ b/ydb/core/engine/mkql_engine_flat.cpp @@ -105,7 +105,7 @@ public: const TResultsMap& GetMap() const { return ResultsMap; } public: - TString ToString(const THolderFactory& holderFactory, const TTypeEnvironment& env) const { + TString ToString(const THolderFactory& holderFactory, const TTypeEnvironment& env) const { const NUdf::TUnboxedValue value(GetResultsValue(holderFactory)); return TString(TValuePacker(false, GetResultsType(env)).Pack(value)); } @@ -129,7 +129,7 @@ public: private: static TListType* GetResultsType(const TTypeEnvironment& env) { - const std::array<std::pair<TString, TType*>, 2> members = {{ + const std::array<std::pair<TString, TType*>, 2> members = {{ {"Id", TDataType::Create(NUdf::TDataType<ui32>::Id, env)}, {"Result", TDataType::Create(NUdf::TDataType<char*>::Id, env)} }}; @@ -168,7 +168,7 @@ TRuntimeNode RenameCallable(TCallable& callable, const TStringBuf& newName, cons return TRuntimeNode(builder.Build(), false); } -void ExtractResultType(TCallable& callable, const TTypeEnvironment& env, TMap<TString, TType*>& resTypes) { +void ExtractResultType(TCallable& callable, const TTypeEnvironment& env, TMap<TString, TType*>& resTypes) { MKQL_ENSURE(callable.GetInputsCount() == 2, "Expected 2 args"); const auto& labelInput = callable.GetInput(0); @@ -186,7 +186,7 @@ void ExtractResultType(TCallable& callable, const TTypeEnvironment& env, TMap<TS MKQL_ENSURE(CanExportType(payload.GetStaticType(), env), TStringBuilder() << "Failed to export type:" << *payload.GetStaticType()); - auto& type = resTypes[TString(label)]; + auto& type = resTypes[TString(label)]; if (!type) { type = payload.GetStaticType(); return; @@ -196,7 +196,7 @@ void ExtractResultType(TCallable& callable, const TTypeEnvironment& env, TMap<TS TStringBuilder() << "Mismatch of result type for label: " << label); } -void ExtractAcquireLocksType(const TTypeEnvironment& env, TMap<TString, TType*>& resTypes) { +void ExtractAcquireLocksType(const TTypeEnvironment& env, TMap<TString, TType*>& resTypes) { { auto lockStructType = GetTxLockType(env, false); auto lockListType = TListType::Create(lockStructType, env); @@ -216,7 +216,7 @@ void ExtractAcquireLocksType(const TTypeEnvironment& env, TMap<TString, TType*>& } } -void ExtractDiagnosticsType(const TTypeEnvironment& env, TMap<TString, TType*>& resTypes) { +void ExtractDiagnosticsType(const TTypeEnvironment& env, TMap<TString, TType*>& resTypes) { auto structType = GetDiagnosticsType(env); auto listType = TListType::Create(structType, env); @@ -266,7 +266,7 @@ public: Alloc.Acquire(); } - TString GetErrors() const noexcept override { + TString GetErrors() const noexcept override { return Errors; } @@ -319,7 +319,7 @@ public: { explorer.Walk(programNode.GetNode(), Env); - TMap<TString, TType*> resTypes; + TMap<TString, TType*> resTypes; for (auto node : explorer.GetNodes()) { if (node->GetType()->GetKind() != TType::EKind::Callable) continue; @@ -384,9 +384,9 @@ public: Y_VERIFY(!AreAffectedShardsPrepared, "PrepareShardPrograms is already called"); TGuard<TScopedAlloc> allocGuard(Alloc); AffectedShards.clear(); - TSet<ui64> affectedShardSet; - TSet<ui64> writeSet; - TSet<ui64> onlineReadSet; + TSet<ui64> affectedShardSet; + TSet<ui64> writeSet; + TSet<ui64> onlineReadSet; for (ui32 keyIndex = 0; keyIndex < DbKeys.size(); ++keyIndex) { auto& key = DbKeys[keyIndex]; Y_VERIFY(key->Status == TKeyDesc::EStatus::Ok, "Some DB keys are not resolved correctly"); @@ -428,7 +428,7 @@ public: AffectedShards.reserve(affectedShardSet.size()); ui64 coordinatorRequiresShardCount = 0; for (ui64 shard : affectedShardSet) { - auto shardData = TShardData(shard, TString()); + auto shardData = TShardData(shard, TString()); if (writeSet.contains(shard)) shardData.HasWrites = true; if (onlineReadSet.contains(shard)) @@ -528,7 +528,7 @@ public: Y_VERIFY(!AreShardProgramsExtracted, "AfterShardProgramsExtracted is already called"); TGuard<TScopedAlloc> allocGuard(Alloc); TVector<THolder<TKeyDesc>>().swap(DbKeys); - TVector<TProgramParts>().swap(SpecializedParts); + TVector<TProgramParts>().swap(SpecializedParts); AreShardProgramsExtracted = true; } @@ -608,7 +608,7 @@ public: THolderFactory holderFactory(Alloc.Ref(), memInfo, Settings.FunctionRegistry); for (auto& pair : ExecutionReplies) { - const TString& reply = pair.second; + const TString& reply = pair.second; TCallableResults results = TCallableResults::FromString(reply, holderFactory, Env); for (const auto& pair : results.GetMap()) { @@ -874,7 +874,7 @@ public: } // Extract reads that are included in the reply - THashSet<TStringBuf> replyIds; + THashSet<TStringBuf> replyIds; const auto& replyStruct = static_cast<const TStructLiteral&>(*replyPgm.GetNode()); for (ui32 j = 0, f = replyStruct.GetValuesCount(); j < f; ++j) { TStringBuf uniqId(replyStruct.GetType()->GetMemberName(j)); @@ -896,7 +896,7 @@ public: } // Extract reads that are included in out readsets - THashMap<TStringBuf, THashSet<ui64>> readTargets; + THashMap<TStringBuf, THashSet<ui64>> readTargets; const ui64 myShardId = Settings.Host->GetShardId(); auto shardsToWriteNode = pgmStruct.GetValue(4); MKQL_ENSURE(shardsToWriteNode.IsImmediate() && shardsToWriteNode.GetNode()->GetType()->IsStruct(), @@ -1056,7 +1056,7 @@ public: TGuard<TScopedAlloc> allocGuard(Alloc); - TVector<THolder<TKeyDesc>> prechargeKeys; + TVector<THolder<TKeyDesc>> prechargeKeys; // iterate over all ProgramPerOrigin (for merged datashards) for (const auto& pi : ProgramPerOrigin) { auto pgm = pi.second; @@ -1098,8 +1098,8 @@ public: OutgoingReadsets.clear(); const ui64 myShardId = Settings.Host->GetShardId(); - TVector<TString> readResults; - THashMap<ui64, TCallableResults> resultsPerTarget; + TVector<TString> readResults; + THashMap<ui64, TCallableResults> resultsPerTarget; TMemoryUsageInfo memInfo("Memory"); THolderFactory holderFactory(Alloc.Ref(), memInfo, Settings.FunctionRegistry); @@ -1177,7 +1177,7 @@ public: } for (auto& result : resultsPerTarget) { - TString resultValue = result.second.ToString(holderFactory, Env); + TString resultValue = result.second.ToString(holderFactory, Env); OutgoingReadsets.push_back(TReadSet(result.first, pgm.first, resultValue)); } } @@ -1215,7 +1215,7 @@ public: void AfterOutgoingReadsetsExtracted() noexcept override { Y_VERIFY(!AreOutgoingReadSetsExtracted, "AfterOutgoingReadsetsExtracted is already called"); TGuard<TScopedAlloc> allocGuard(Alloc); - TVector<TReadSet>().swap(OutgoingReadsets); + TVector<TReadSet>().swap(OutgoingReadsets); AreOutgoingReadSetsExtracted = true; } @@ -1231,7 +1231,7 @@ public: IncomingReadsetsShards.clear(); try { const ui64 myShardId = Settings.Host->GetShardId(); - THashSet<ui64> shards; + THashSet<ui64> shards; for (const auto& pgm : ProgramPerOrigin) { auto& pgmStruct = GetPgmStruct(pgm.second); @@ -1276,7 +1276,7 @@ public: } void AddIncomingReadset(const TStringBuf& readset) noexcept override { - IncomingReadsets.push_back(TString(readset)); + IncomingReadsets.push_back(TString(readset)); } EResult Cancel() override { @@ -1426,7 +1426,7 @@ public: return EResult::Ok; } - TString GetShardReply(ui64 origin) const noexcept override { + TString GetShardReply(ui64 origin) const noexcept override { Y_VERIFY(IsExecuted, "Execute is not called yet"); auto it = ExecutionReplies.find(origin); Y_VERIFY(it != ExecutionReplies.end(), "Bad origin: %" PRIu64, origin); @@ -1475,7 +1475,7 @@ private: struct TCallableContext { TCallable* Node; TKeyDesc* Key; - THashSet<ui64> ShardsToWrite; + THashSet<ui64> ShardsToWrite; TRuntimeNode ShardsForRead; TCallableContext() @@ -1493,7 +1493,7 @@ private: TRuntimeNode Program; }; - static void AddShards(TSet<ui64>& set, const TKeyDesc& key) { + static void AddShards(TSet<ui64>& set, const TKeyDesc& key) { for (auto& partition : key.Partitions) { Y_VERIFY(partition.ShardId); set.insert(partition.ShardId); @@ -1717,8 +1717,8 @@ private: ProxyProgram = SinglePassVisitCallables(Program, const_cast<TExploringNodeVisitor&>(ProgramExplorer), funcProvider, Env, false, wereChanges); ProxyProgramExplorer.Walk(ProxyProgram.GetNode(), Env, {}, true, nodesCount); - auto isPureLambda = [this] (TVector<TNode*> args, TRuntimeNode value) { - THashSet<ui32> knownArgIds; + auto isPureLambda = [this] (TVector<TNode*> args, TRuntimeNode value) { + THashSet<ui32> knownArgIds; for (auto& arg : args) { if (!arg->GetType()->IsCallable()) { return false; @@ -1730,8 +1730,8 @@ private: knownArgIds.insert(argCallable->GetUniqueId()); } - TVector<TCallable*> foundArgs; - THashSet<TNode*> visitedNodes; + TVector<TCallable*> foundArgs; + THashSet<TNode*> visitedNodes; TExploringNodeVisitor lambdaExplorer; lambdaExplorer.Walk(value.GetNode(), Env, args); for (auto& node : lambdaExplorer.GetNodes()) { @@ -1763,9 +1763,9 @@ private: return true; }; - THashSet<ui32> pureCallables; - THashSet<ui32> aggregatedCallables; - THashMap<ui32, ui32> callableConsumers; + THashSet<ui32> pureCallables; + THashSet<ui32> aggregatedCallables; + THashMap<ui32, ui32> callableConsumers; for (auto& node : ProxyProgramExplorer.GetNodes()) { if (!node->GetType()->IsCallable()) { continue; @@ -2088,44 +2088,44 @@ private: TDataType* Ui64Type; TStructType* ResultType; std::pair<ui64, ui64> StepTxId; - TVector<IEngineFlat::TTxLock> TxLocks; + TVector<IEngineFlat::TTxLock> TxLocks; TMaybe<ui64> LockTxId; bool NeedDiagnostics; - TVector<IEngineFlat::TTabletInfo> TabletInfos; + TVector<IEngineFlat::TTabletInfo> TabletInfos; - mutable TString Errors; + mutable TString Errors; EStatus Status; TRuntimeNode Program; TExploringNodeVisitor ProgramExplorer; TRuntimeNode ProxyProgram; TExploringNodeVisitor ProxyProgramExplorer; - TVector<TProgramParts> SpecializedParts; - TMap<ui64, TRuntimeNode> ProgramPerOrigin; + TVector<TProgramParts> SpecializedParts; + TMap<ui64, TRuntimeNode> ProgramPerOrigin; TMap<ui64, ui64> ProgramSizes; TVector<THolder<TKeyDesc>> DbKeys; - TVector<TShardData> AffectedShards; + TVector<TShardData> AffectedShards; TMaybe<bool> ReadOnlyProgram; - THashMap<ui32, TCallableContext> ProxyCallables; - THashMap<ui32, TCallable*> ProxyRepliesCallables; - THashMap<ui32, TCallable*> ProxyRepliesReads; + THashMap<ui32, TCallableContext> ProxyCallables; + THashMap<ui32, TCallable*> ProxyRepliesCallables; + THashMap<ui32, TCallable*> ProxyRepliesReads; TRuntimeNode ShardsToWrite; bool AreAffectedShardsPrepared; bool AreShardProgramsExtracted; - TSet<ui64> FinalizedShards; + TSet<ui64> FinalizedShards; bool IsResultBuilt; bool IsProgramValidated; bool AreOutgoingReadSetsPrepared; bool AreOutgoingReadSetsExtracted; - TVector<TReadSet> OutgoingReadsets; + TVector<TReadSet> OutgoingReadsets; bool AreIncomingReadsetsPrepared; - TVector<ui64> IncomingReadsetsShards; - TVector<TString> IncomingReadsets; - THashMap<ui64, TStructLiteral*> ReadPerOrigin; + TVector<ui64> IncomingReadsetsShards; + TVector<TString> IncomingReadsets; + THashMap<ui64, TStructLiteral*> ReadPerOrigin; bool IsExecuted; - TMap<ui64, TString> ExecutionReplies; + TMap<ui64, TString> ExecutionReplies; IComputationPattern::TPtr Pattern; THolder<IComputationGraph> ResultGraph; - THashMap<TString, NUdf::TUnboxedValue> ResultValues; + THashMap<TString, NUdf::TUnboxedValue> ResultValues; bool ReadOnlyOriginPrograms; bool IsCancelled; }; diff --git a/ydb/core/engine/mkql_engine_flat.h b/ydb/core/engine/mkql_engine_flat.h index 7bee67584b9..4795f9e076f 100644 --- a/ydb/core/engine/mkql_engine_flat.h +++ b/ydb/core/engine/mkql_engine_flat.h @@ -41,7 +41,7 @@ public: struct TShardData { ui64 ShardId; - TString Program; + TString Program; bool HasWrites; bool HasOnlineReads; bool Immediate; @@ -53,7 +53,7 @@ public: , Immediate(false) {} - TShardData(ui64 shardId, const TString& program) + TShardData(ui64 shardId, const TString& program) : ShardId(shardId) , Program(program) , HasWrites(false) @@ -66,7 +66,7 @@ public: ui64 TargetShardId; ui64 OriginShardId; TRuntimeNode Root; - TString Body; + TString Body; TReadSet() {} @@ -77,7 +77,7 @@ public: , Root(root) {} - TReadSet(ui64 targetShardId, ui64 originShardId, const TString& body) + TReadSet(ui64 targetShardId, ui64 originShardId, const TString& body) : TargetShardId(targetShardId) , OriginShardId(originShardId) , Body(body) @@ -143,7 +143,7 @@ public: std::unique_ptr<TKeyDesc> Key; bool IsWrite; bool IsResultPart; - THashSet<ui64> TargetShards; + THashSet<ui64> TargetShards; TValidatedKey(THolder<TKeyDesc>&& key, bool isWrite) : Key(key.Release()) @@ -158,7 +158,7 @@ public: }; struct TValidationInfo { - TVector<TValidatedKey> Keys; + TVector<TValidatedKey> Keys; ui32 ReadsCount; ui32 WritesCount; ui32 DynKeysCount; @@ -188,7 +188,7 @@ public: }; //-- error reporting - virtual TString GetErrors() const noexcept = 0; + virtual TString GetErrors() const noexcept = 0; //-- proxy/shard interface virtual void SetStepTxId(const std::pair<ui64, ui64>& stepTxId) noexcept = 0; @@ -230,7 +230,7 @@ public: virtual EResult Cancel() = 0; virtual EResult PinPages(ui64 pageFaultCount = 0) = 0; virtual EResult Execute() = 0; - virtual TString GetShardReply(ui64 origin) const noexcept = 0; + virtual TString GetShardReply(ui64 origin) const noexcept = 0; virtual size_t GetMemoryUsed() const noexcept = 0; virtual size_t GetMemoryAllocated() const noexcept = 0; diff --git a/ydb/core/engine/mkql_engine_flat_extfunc.cpp b/ydb/core/engine/mkql_engine_flat_extfunc.cpp index 414d3aeeb45..916e9c2f6c4 100644 --- a/ydb/core/engine/mkql_engine_flat_extfunc.cpp +++ b/ydb/core/engine/mkql_engine_flat_extfunc.cpp @@ -48,7 +48,7 @@ namespace { return MakeCell(dataType->GetSchemeType(), value, env); } - void ExtractRow(const NUdf::TUnboxedValue& row, TTupleType* rowType, TVector<TCell>& cells, const TTypeEnvironment& env) { + void ExtractRow(const NUdf::TUnboxedValue& row, TTupleType* rowType, TVector<TCell>& cells, const TTypeEnvironment& env) { cells.resize(rowType->GetElementsCount()); for (ui32 i = 0; i < rowType->GetElementsCount(); ++i) { cells[i] = ExtractCell(row.GetElement(i), rowType->GetElementType(i), env); @@ -228,7 +228,7 @@ namespace { private: void Apply(NUdf::IApplyContext& applyContext) const override { auto& engineCtx = *CheckedCast<TEngineFlatApplyContext*>(&applyContext); - TVector<TCell> row; + TVector<TCell> row; ExtractRow(Row, Owner->RowType, row, *engineCtx.Env); if (!engineCtx.Host->IsPathErased(Owner->TableId) && engineCtx.Host->IsMyKey(Owner->TableId, row)) { @@ -282,12 +282,12 @@ namespace { private: void Apply(NUdf::IApplyContext& applyContext) const override { auto& engineCtx = *CheckedCast<TEngineFlatApplyContext*>(&applyContext); - TVector<TCell> row; + TVector<TCell> row; ExtractRow(Row, Owner->RowType, row, *engineCtx.Env); if (!engineCtx.Host->IsPathErased(Owner->TableId) && engineCtx.Host->IsMyKey(Owner->TableId, row)) { auto updateStruct = Owner->UpdateStruct; - TVector<IEngineFlatHost::TUpdateCommand> commands(updateStruct->GetValuesCount()); + TVector<IEngineFlatHost::TUpdateCommand> commands(updateStruct->GetValuesCount()); for (ui32 i = 0; i < updateStruct->GetValuesCount(); ++i) { auto& cmd = commands[i]; auto columnIdBuf = updateStruct->GetType()->GetMemberName(i); @@ -370,7 +370,7 @@ namespace { } IComputationNode* WrapAcquireLocks(TCallable& callable, const TComputationNodeFactoryContext& ctx, - const TVector<IEngineFlat::TTxLock>& txLocks) + const TVector<IEngineFlat::TTxLock>& txLocks) { MKQL_ENSURE(callable.GetInputsCount() == 1, "Expected 1 arg"); @@ -412,7 +412,7 @@ namespace { } IComputationNode* WrapDiagnostics(TCallable& callable, const TComputationNodeFactoryContext& ctx, - const TVector<IEngineFlat::TTabletInfo>& tabletInfos) + const TVector<IEngineFlat::TTabletInfo>& tabletInfos) { MKQL_ENSURE(callable.GetInputsCount() == 0, "Expected zero args"); @@ -455,7 +455,7 @@ namespace { MKQL_ENSURE(callable.GetInputsCount() == 0, "Expected zero args"); auto ui64Type = TDataType::Create(NUdf::TDataType<ui64>::Id, ctx.Env); - TVector<TType*> tupleTypes(2, ui64Type); + TVector<TType*> tupleTypes(2, ui64Type); auto tupleType = TTupleType::Create(tupleTypes.size(), tupleTypes.data(), ctx.Env); NUdf::TUnboxedValue* items = nullptr; @@ -600,7 +600,7 @@ namespace { bool truncatedAny = false; ui32 keyColumnsCount = 0; - TVector<NUdf::TDataTypeId> types; + TVector<NUdf::TDataTypeId> types; using TPartKey = std::tuple<const TCell*, NUdf::TUnboxedValue, ui64, ui64, NUdf::TUnboxedValue, bool>; @@ -619,7 +619,7 @@ namespace { auto firstKeyValue = value.GetElement(2); ui64 sizeInBytes = value.GetElement(3).Get<ui64>(); - TString firstKey(firstKeyValue.AsStringRef()); + TString firstKey(firstKeyValue.AsStringRef()); truncatedAny = truncatedAny || truncated; ui64 itemsCount = list.GetListLength(); @@ -958,7 +958,7 @@ NUdf::TUnboxedValue PerformLocalSelectRow(TCallable& callable, IEngineFlatHost& auto tableNode = callable.GetInput(0); const auto tableId = ExtractTableId(tableNode); auto tupleNode = AS_VALUE(TTupleLiteral, callable.GetInput(3)); - TVector<TCell> row; + TVector<TCell> row; ExtractRow(row, tupleNode, env); auto returnType = callable.GetType()->GetReturnType(); @@ -979,8 +979,8 @@ NUdf::TUnboxedValue PerformLocalSelectRange(TCallable& callable, IEngineFlatHost ui64 itemsLimit = AS_VALUE(TDataLiteral, callable.GetInput(6))->AsValue().Get<ui64>(); ui64 bytesLimit = AS_VALUE(TDataLiteral, callable.GetInput(7))->AsValue().Get<ui64>(); - TVector<TCell> fromValues; - TVector<TCell> toValues; + TVector<TCell> fromValues; + TVector<TCell> toValues; ExtractRow(fromValues, AS_VALUE(TTupleLiteral, callable.GetInput(3)), env); ExtractRow(toValues, AS_VALUE(TTupleLiteral, callable.GetInput(4)), env); @@ -1029,7 +1029,7 @@ TStructType* GetTxLockType(const TTypeEnvironment& env, bool v2) { return lockStructType; } - TVector<std::pair<TString, TType*>> lockStructMembers = { + TVector<std::pair<TString, TType*>> lockStructMembers = { std::make_pair("Counter", ui64Type), std::make_pair("DataShard", ui64Type), std::make_pair("Generation", ui32Type), @@ -1045,7 +1045,7 @@ TStructType* GetDiagnosticsType(const TTypeEnvironment& env) { auto ui64Type = TDataType::Create(NUdf::TDataType<ui64>::Id, env); auto boolType = TDataType::Create(NUdf::TDataType<bool>::Id, env); - TVector<std::pair<TString, TType*>> diagStructMembers = { + TVector<std::pair<TString, TType*>> diagStructMembers = { std::make_pair("ActorIdRawX1", ui64Type), std::make_pair("ActorIdRawX2", ui64Type), std::make_pair("ExecLatency", ui64Type), diff --git a/ydb/core/engine/mkql_engine_flat_host.h b/ydb/core/engine/mkql_engine_flat_host.h index 0593fb3a9b8..0ddfc47a73d 100644 --- a/ydb/core/engine/mkql_engine_flat_host.h +++ b/ydb/core/engine/mkql_engine_flat_host.h @@ -33,7 +33,7 @@ public: virtual bool IsValidKey(TKeyDesc& key, std::pair<ui64, ui64>& maxSnapshotTime) const = 0; // Calculate the whole size of data that needs to be read into memory - virtual ui64 CalculateReadSize(const TVector<const TKeyDesc*>& keys) const = 0; + virtual ui64 CalculateReadSize(const TVector<const TKeyDesc*>& keys) const = 0; // Exstimate size of the merged result of reading the data virtual ui64 CalculateResultSize(const TKeyDesc& key) const = 0; diff --git a/ydb/core/engine/mkql_engine_flat_host_ut.cpp b/ydb/core/engine/mkql_engine_flat_host_ut.cpp index 68679f168df..7c4e49b5a6f 100644 --- a/ydb/core/engine/mkql_engine_flat_host_ut.cpp +++ b/ydb/core/engine/mkql_engine_flat_host_ut.cpp @@ -88,7 +88,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLEngineFlatHostTest) { UNIT_ASSERT(row.IsReady()); UNIT_ASSERT(row.IsValid()); ui64 value = row.GetValue<Schema::TestTable::Value>(); - TString name = row.GetValue<Schema::TestTable::Name>(); + TString name = row.GetValue<Schema::TestTable::Name>(); bool boolValue = row.GetValue<Schema::TestTable::BoolValue>(); UNIT_ASSERT(value == i); UNIT_ASSERT(ToString(value) == name); diff --git a/ydb/core/engine/mkql_engine_flat_impl.h b/ydb/core/engine/mkql_engine_flat_impl.h index bb232a52aae..de69dba3038 100644 --- a/ydb/core/engine/mkql_engine_flat_impl.h +++ b/ydb/core/engine/mkql_engine_flat_impl.h @@ -4,7 +4,7 @@ namespace NKikimr { namespace NMiniKQL { - typedef THashMap<ui32, TVector<TString>> TIncomingResults; + typedef THashMap<ui32, TVector<TString>> TIncomingResults; struct TBuiltinStrings { TBuiltinStrings(const TTypeEnvironment& env) @@ -46,7 +46,7 @@ namespace NMiniKQL { const TInternName Length; const TInternName Arg; - THashSet<TInternName> All; + THashSet<TInternName> All; }; struct TFlatEngineStrings : public TTableStrings { @@ -93,14 +93,14 @@ namespace NMiniKQL { const TEngineFlatSettings& Settings; const TFlatEngineStrings& Strings; const std::pair<ui64, ui64>& StepTxId; - THashSet<ui32> LocalReadCallables; + THashSet<ui32> LocalReadCallables; TIncomingResults Results; }; struct TProxyExecData { TProxyExecData(const TEngineFlatSettings& settings, const TFlatEngineStrings& strings, - const std::pair<ui64, ui64>& stepTxId, const TVector<IEngineFlat::TTabletInfo>& tabletInfos, - const TVector<IEngineFlat::TTxLock>& locks) + const std::pair<ui64, ui64>& stepTxId, const TVector<IEngineFlat::TTabletInfo>& tabletInfos, + const TVector<IEngineFlat::TTxLock>& locks) : Settings(settings) , Strings(strings) , StepTxId(stepTxId) @@ -111,8 +111,8 @@ namespace NMiniKQL { const TEngineFlatSettings& Settings; const TFlatEngineStrings& Strings; const std::pair<ui64, ui64> StepTxId; - const TVector<IEngineFlat::TTabletInfo>& TabletInfos; - const TVector<IEngineFlat::TTxLock>& TxLocks; + const TVector<IEngineFlat::TTabletInfo>& TabletInfos; + const TVector<IEngineFlat::TTxLock>& TxLocks; TIncomingResults Results; }; @@ -127,7 +127,7 @@ namespace NMiniKQL { struct TEngineFlatApplyContext : public NUdf::IApplyContext { bool IsAborted = false; IEngineFlatHost* Host = nullptr; - THashMap<TString, NUdf::TUnboxedValue>* ResultValues = nullptr; + THashMap<TString, NUdf::TUnboxedValue>* ResultValues = nullptr; const TTypeEnvironment* Env = nullptr; }; diff --git a/ydb/core/engine/mkql_engine_flat_ut.cpp b/ydb/core/engine/mkql_engine_flat_ut.cpp index e2b12e2d7a5..326eb72d41d 100644 --- a/ydb/core/engine/mkql_engine_flat_ut.cpp +++ b/ydb/core/engine/mkql_engine_flat_ut.cpp @@ -51,7 +51,7 @@ namespace { struct TShardDbState { THashMap<ui64, TAutoPtr<NTable::TDatabase>> Dbs; THashMap<ui64, NTable::TDummyEnv> Envs; - THashMap<ui64, ui32> Steps; + THashMap<ui64, ui32> Steps; template <typename TSchema> void AddShard(ui64 tabletId) { @@ -103,8 +103,8 @@ namespace { } struct TDriver { - using TOutgoingReadsets = TMap<ui64, TMap<ui64, TString>>; - using TIncomingReadsets = TMap<ui64, TVector<ui64>>; + using TOutgoingReadsets = TMap<ui64, TMap<ui64, TString>>; + using TIncomingReadsets = TMap<ui64, TVector<ui64>>; TIntrusivePtr<IFunctionRegistry> FunctionRegistry; TIntrusivePtr<IRandomProvider> RandomProvider; @@ -114,9 +114,9 @@ namespace { TKikimrProgramBuilder PgmBuilder; TShardDbState ShardDbState; std::function<void(TEngineFlatSettings&)> SettingsConfigurer; - std::function<void(ui64, const TString&)> ShardProgramInspector; + std::function<void(ui64, const TString&)> ShardProgramInspector; std::function<void(const TOutgoingReadsets&, const TIncomingReadsets&)> ReadSetsInspector; - std::function<void(ui64, const TString&)> ShardReplyInspector; + std::function<void(ui64, const TString&)> ShardReplyInspector; TDriver() : FunctionRegistry(CreateFunctionRegistry(CreateBuiltinRegistry())) @@ -125,9 +125,9 @@ namespace { , Env(Alloc) , PgmBuilder(Env, *FunctionRegistry) , SettingsConfigurer([](TEngineFlatSettings&) {}) - , ShardProgramInspector([](ui64, const TString&) {}) + , ShardProgramInspector([](ui64, const TString&) {}) , ReadSetsInspector([](const TOutgoingReadsets&, const TIncomingReadsets&) {}) - , ShardReplyInspector([](ui64, const TString&) {}) + , ShardReplyInspector([](ui64, const TString&) {}) { } @@ -140,7 +140,7 @@ namespace { NKikimrMiniKQL::TResult& res, std::function<void(TKeyDesc&)> keyResolver, IEngineFlat::TShardLimits shardLimits = IEngineFlat::TShardLimits()) { - TString pgmStr = SerializeRuntimeNode(pgm, Env); + TString pgmStr = SerializeRuntimeNode(pgm, Env); TEngineFlatSettings settings(IEngineFlat::EProtocol::V1, FunctionRegistry.Get(), *RandomProvider, *TimeProvider); SettingsConfigurer(settings); @@ -165,7 +165,7 @@ namespace { } const ui32 affectedShardCount = proxyEngine->GetAffectedShardCount(); - TMap<ui64, TString> shardPrograms; + TMap<ui64, TString> shardPrograms; for (ui32 index = 0; index < affectedShardCount; ++index) { IEngineFlat::TShardData shardData; UNIT_ASSERT(proxyEngine->GetAffectedShard(index, shardData) == IEngineFlat::EResult::Ok); @@ -176,7 +176,7 @@ namespace { proxyEngine->AfterShardProgramsExtracted(); THashMap<ui64, TAutoPtr<TEngineHostCounters>> hostCounters; - THashMap<ui64, TAutoPtr<IEngineFlatHost>> hosts; + THashMap<ui64, TAutoPtr<IEngineFlatHost>> hosts; for (const auto& shardPgm : shardPrograms) { auto& counters = hostCounters[shardPgm.first]; counters.Reset(new TEngineHostCounters()); @@ -261,7 +261,7 @@ namespace { Cerr << dataEngine->GetErrors() << Endl; } else { - const TString reply = dataEngine->GetShardReply(shardPgm.first); + const TString reply = dataEngine->GetShardReply(shardPgm.first); ShardReplyInspector(shardPgm.first, reply); proxyEngine->AddShardReply(shardPgm.first, reply); proxyEngine->FinalizeOriginReplies(shardPgm.first); @@ -298,7 +298,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLEngineFlatTest) { TRuntimeNode value = TRuntimeNode()) { auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)TKey; TRuntimeNode::TList row(1); row[0] = key ? key : pgmBuilder.NewNull(); @@ -322,12 +322,12 @@ Y_UNIT_TEST_SUITE(TMiniKQLEngineFlatTest) { TDriver& driver) { auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)TKey; TRuntimeNode::TList row(1); row[0] = pgmBuilder.NewNull(); - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto value = pgmBuilder.SelectRow(TTableId(OwnerId, Table1Id), keyTypes, columns, row); @@ -411,11 +411,11 @@ Value { TDriver driver; driver.ShardDbState.AddShard<Schema1>(Shard1); auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.TProgramBuilder::TProgramBuilder::NewDataLiteral<ui32>(42); - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; auto value = pgmBuilder.SelectRow(TTableId(OwnerId, Table1Id), keyTypes, columns, row); auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("myRes", value))); @@ -468,11 +468,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42); - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; auto value = pgmBuilder.SelectRow(TTableId(OwnerId, Table1Id), keyTypes, columns, row); auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("myRes", value))); @@ -527,11 +527,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42); - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto value = pgmBuilder.SelectRow(TTableId(OwnerId, Table1Id), keyTypes, columns, row); auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("myRes", value))); @@ -675,7 +675,7 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.Add( @@ -717,7 +717,7 @@ Value { pgmBuilder.TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Utf8>("qwe")); } - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.NewNull(); @@ -790,7 +790,7 @@ Value { driver.ShardDbState.AddShard<Schema1>(Shard1); auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.Add( @@ -828,7 +828,7 @@ Value { driver.ShardDbState.AddShard<Schema1>(Shard1); auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.Add( @@ -900,7 +900,7 @@ Value { driver.ShardDbState.AddShard<Schema1>(Shard1); auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.Add( @@ -950,7 +950,7 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.Add( @@ -1003,7 +1003,7 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.Add( @@ -1042,9 +1042,9 @@ Value { TDriver driver; driver.ShardDbState.AddShard<Schema1>(Shard1); auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -1113,9 +1113,9 @@ Value { TDriver driver; driver.ShardDbState.AddShard<Schema1>(Shard1); auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewNull(); @@ -1199,11 +1199,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -1317,10 +1317,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -1427,10 +1427,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewNull(); @@ -1540,11 +1540,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -1661,10 +1661,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(43); @@ -1782,10 +1782,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(43); @@ -1898,10 +1898,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); TRuntimeNode::TList rowTo(1); @@ -2022,10 +2022,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); TRuntimeNode::TList rowTo(1); @@ -2132,10 +2132,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); TRuntimeNode::TList rowTo(1); @@ -2252,10 +2252,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); TRuntimeNode::TList rowTo(1); @@ -2381,10 +2381,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); TRuntimeNode::TList rowTo(1); @@ -2503,10 +2503,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); TRuntimeNode::TList rowTo(1); @@ -2625,10 +2625,10 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); TRuntimeNode::TList rowTo(1); @@ -2743,20 +2743,20 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes1(1); + TVector<ui32> keyTypes1(1); keyTypes1[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row1(1); - TVector<TSelectColumn> columns1; + TVector<TSelectColumn> columns1; columns1.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); row1[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42); auto value1 = pgmBuilder.SelectRow(TTableId(OwnerId, Table1Id), keyTypes1, columns1, row1); - TVector<ui32> keyTypes2(1); + TVector<ui32> keyTypes2(1); keyTypes2[0] = (ui32)NUdf::TDataType<ui64>::Id; TRuntimeNode::TList row2(1); row2[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui64>(11); - TVector<TSelectColumn> columns2; + TVector<TSelectColumn> columns2; columns2.emplace_back("4", (ui32)Schema2::Table2::Value::ColumnId, (ui32)Schema2::Table2::Value::ColumnType); auto value2 = pgmBuilder.SelectRow(TTableId(OwnerId, Table2Id), keyTypes2, columns2, row2); @@ -2892,13 +2892,13 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes1(1); + TVector<ui32> keyTypes1(1); keyTypes1[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row1(1); row1[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42); auto value1 = pgmBuilder.EraseRow(TTableId(OwnerId, Table1Id), keyTypes1, row1); - TVector<ui32> keyTypes2(1); + TVector<ui32> keyTypes2(1); keyTypes2[0] = (ui32)NUdf::TDataType<ui64>::Id; TRuntimeNode::TList row2(1); row2[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui64>(11); @@ -2948,7 +2948,7 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes1(1); + TVector<ui32> keyTypes1(1); keyTypes1[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row1(1); row1[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42); @@ -2960,7 +2960,7 @@ Value { auto value1 = pgmBuilder.UpdateRow(TTableId(OwnerId, Table1Id), keyTypes1, row1, update1); - TVector<ui32> keyTypes2(1); + TVector<ui32> keyTypes2(1); keyTypes2[0] = (ui32)NUdf::TDataType<ui64>::Id; TRuntimeNode::TList row2(1); row2[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui64>(11); @@ -3040,7 +3040,7 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes1(1); + TVector<ui32> keyTypes1(1); keyTypes1[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row1(1); row1[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42); @@ -3050,13 +3050,13 @@ Value { NUdf::TDataType<NUdf::TUtf8>::Id, pgmBuilder.TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::Utf8>("asd")); - TVector<TSelectColumn> columns1; + TVector<TSelectColumn> columns1; columns1.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto oldRow1 = pgmBuilder.SelectRow(TTableId(OwnerId, Table1Id), keyTypes1, columns1, row1); auto value1 = pgmBuilder.UpdateRow(TTableId(OwnerId, Table1Id), keyTypes1, row1, update1); - TVector<ui32> keyTypes2(1); + TVector<ui32> keyTypes2(1); keyTypes2[0] = (ui32)NUdf::TDataType<ui64>::Id; TRuntimeNode::TList row2(1); row2[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui64>(11); @@ -3067,7 +3067,7 @@ Value { NUdf::TDataType<ui32>::Id, pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(32)); - TVector<TSelectColumn> columns2; + TVector<TSelectColumn> columns2; columns2.emplace_back("4", (ui32)Schema2::Table2::Value::ColumnId, (ui32)Schema2::Table2::Value::ColumnType); auto oldRow2 = pgmBuilder.SelectRow(TTableId(OwnerId, Table2Id), keyTypes2, columns2, row2); @@ -3162,11 +3162,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(42); - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto value = pgmBuilder.SelectRow(TTableId(OwnerId, Table1Id), keyTypes, columns, row); auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("myRes", value))); @@ -3239,11 +3239,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -3329,7 +3329,7 @@ Value { driver.ShardDbState.AddShard<Schema1>(Shard1); auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.Add( @@ -3380,7 +3380,7 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList row(1); row[0] = pgmBuilder.Add( @@ -3436,11 +3436,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -3561,11 +3561,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -3690,11 +3690,11 @@ Value { } auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("2", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -4688,7 +4688,7 @@ Value { } Y_UNIT_TEST(TestMapsPushdown) { - const TString okValue = "Ok"; + const TString okValue = "Ok"; TDriver driver; driver.ShardDbState.AddShard<Schema1>(Shard1); @@ -4730,12 +4730,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -4743,7 +4743,7 @@ Value { options.Flags = pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(TReadRangeOptions::TFlags::ExcludeTermValue); auto range = pgmBuilder.SelectRange(TTableId(OwnerId, Table1Id), keyTypes, columns, options); auto list = pgmBuilder.Member(range, "List"); - TVector<TStringBuf> filterNullColumns {"Value"}; + TVector<TStringBuf> filterNullColumns {"Value"}; auto filterNull = pgmBuilder.FilterNullMembers(list, filterNullColumns); auto filtered = pgmBuilder.Filter(filterNull, [&pgmBuilder, &okValue](TRuntimeNode item) { return pgmBuilder.AggrEquals( @@ -4755,7 +4755,7 @@ Value { pgmBuilder.Member(item, "ID"), pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(10))); }); auto flatmapped = pgmBuilder.FlatMap(mapped, [&pgmBuilder](TRuntimeNode item) { - TString prefix = "mapped_"; + TString prefix = "mapped_"; auto prefixNode = pgmBuilder.TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::String>(prefix); return pgmBuilder.AsList(pgmBuilder.AddMember(item, "RemappedId", pgmBuilder.Concat( @@ -4764,7 +4764,7 @@ Value { }); auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", flatmapped))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(program.Contains("Filter")); @@ -4806,12 +4806,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -4829,7 +4829,7 @@ Value { results.push_back(pgmBuilder.SetResult("Result2", list)); auto pgm = pgmBuilder.Build(pgmBuilder.AsList(results)); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(!program.Contains("Map")); }; @@ -4874,12 +4874,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -4897,7 +4897,7 @@ Value { auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", mapped))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(!program.Contains("Map")); }; @@ -4916,7 +4916,7 @@ Value { TDriver driver; driver.ShardDbState.AddShard<Schema1>(Shard1); - const TString okValue = "Ok"; + const TString okValue = "Ok"; { driver.ShardDbState.BeginTransaction(Shard1); NIceDb::TNiceDb db(*driver.ShardDbState.Dbs[Shard1]); @@ -4936,12 +4936,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -4959,7 +4959,7 @@ Value { pgmBuilder.Member(item, "ID"), pgmBuilder.TProgramBuilder::NewDataLiteral<ui32>(10))); }); auto flatmapped = pgmBuilder.OrderedFlatMap(mapped, [&pgmBuilder](TRuntimeNode item) { - TString prefix = "mapped_"; + TString prefix = "mapped_"; auto prefixNode = pgmBuilder.TProgramBuilder::NewDataLiteral<NUdf::EDataSlot::String>(prefix); return pgmBuilder.AsList(pgmBuilder.AddMember(item, "RemappedId", pgmBuilder.Concat( @@ -4969,7 +4969,7 @@ Value { auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", flatmapped))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(!program.Contains("Filter")); UNIT_ASSERT(!program.Contains("OrderedFilter")); @@ -5022,12 +5022,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5041,7 +5041,7 @@ Value { }); auto write = pgmBuilder.Map(mapped, [&pgmBuilder](TRuntimeNode item) { - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui64>::Id; TRuntimeNode::TList row(1); @@ -5055,7 +5055,7 @@ Value { auto pgm = pgmBuilder.Build(write); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { if (shard == Shard1) { UNIT_ASSERT(!program.Contains("Map")); } @@ -5065,12 +5065,12 @@ Value { UNIT_ASSERT_EQUAL(driver.Run(pgm, res, &TwoShardResolver), IEngineFlat::EStatus::Complete); { - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema2::Table2::ID::ColumnId, (ui32)Schema2::Table2::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema2::Table2::Value::ColumnId, (ui32)Schema2::Table2::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui64>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id); @@ -5127,11 +5127,11 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns1; + TVector<TSelectColumn> columns1; columns1.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns1.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options1 = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes1(1); + TVector<ui32> keyTypes1(1); keyTypes1[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom1(1); rowFrom1[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5140,11 +5140,11 @@ Value { auto range1 = pgmBuilder.SelectRange(TTableId(OwnerId, Table1Id), keyTypes1, columns1, options1); auto list1 = pgmBuilder.Member(range1, "List"); - TVector<TSelectColumn> columns2; + TVector<TSelectColumn> columns2; columns2.emplace_back("ID", (ui32)Schema2::Table2::ID::ColumnId, (ui32)Schema2::Table2::ID::ColumnType); columns2.emplace_back("Value", (ui32)Schema2::Table2::Value::ColumnId, (ui32)Schema2::Table2::Value::ColumnType); auto options2 = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes2(1); + TVector<ui32> keyTypes2(1); keyTypes2[0] = (ui32)NUdf::TDataType<ui64>::Id; TRuntimeNode::TList rowFrom2(1); rowFrom2[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id); @@ -5217,11 +5217,11 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns1; + TVector<TSelectColumn> columns1; columns1.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns1.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options1 = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes1(1); + TVector<ui32> keyTypes1(1); keyTypes1[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom1(1); rowFrom1[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5230,11 +5230,11 @@ Value { auto range1 = pgmBuilder.SelectRange(TTableId(OwnerId, Table1Id), keyTypes1, columns1, options1); auto list1 = pgmBuilder.Member(range1, "List"); - TVector<TSelectColumn> columns2; + TVector<TSelectColumn> columns2; columns2.emplace_back("ID", (ui32)Schema2::Table2::ID::ColumnId, (ui32)Schema2::Table2::ID::ColumnType); columns2.emplace_back("Value", (ui32)Schema2::Table2::Value::ColumnId, (ui32)Schema2::Table2::Value::ColumnType); auto options2 = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes2(1); + TVector<ui32> keyTypes2(1); keyTypes2[0] = (ui32)NUdf::TDataType<ui64>::Id; TRuntimeNode::TList rowFrom2(1); rowFrom2[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui64>::Id); @@ -5320,12 +5320,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5374,7 +5374,7 @@ Value { auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", merge))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(program.Contains("FlatMap")); @@ -5434,12 +5434,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5484,7 +5484,7 @@ Value { auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", merge))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(!program.Contains("FlatMap")); @@ -5543,12 +5543,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5557,7 +5557,7 @@ Value { auto range = pgmBuilder.SelectRange(TTableId(OwnerId, Table1Id), keyTypes, columns, options); auto list = pgmBuilder.Member(range, "List"); - const TString filterValue = "Value1"; + const TString filterValue = "Value1"; auto filtered = pgmBuilder.Filter(list, [&pgmBuilder, &filterValue](TRuntimeNode item) { return pgmBuilder.AggrNotEquals( pgmBuilder.Unwrap(pgmBuilder.Member(item, "Value"), pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>(""), "", 0, 0), @@ -5568,7 +5568,7 @@ Value { auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", take))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(program.Contains("Filter")); @@ -5625,12 +5625,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5643,7 +5643,7 @@ Value { auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", take))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(!program.Contains("Take")); @@ -5701,12 +5701,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5715,7 +5715,7 @@ Value { auto range = pgmBuilder.SelectRange(TTableId(OwnerId, Table1Id), keyTypes, columns, options); auto list = pgmBuilder.Member(range, "List"); - const TString filterValue = "Value2"; + const TString filterValue = "Value2"; auto filtered = pgmBuilder.Filter(list, [&pgmBuilder, &filterValue](TRuntimeNode item) { return pgmBuilder.AggrNotEquals( pgmBuilder.Unwrap(pgmBuilder.Member(item, "Value"), pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>(""), "", 0, 0), @@ -5726,7 +5726,7 @@ Value { auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", length))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(program.Contains("Filter")); @@ -5780,12 +5780,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5801,7 +5801,7 @@ Value { auto take = pgmBuilder.Take(mapped, pgmBuilder.TProgramBuilder::NewDataLiteral<ui64>(2)); - const TString filterValue = "Value2"; + const TString filterValue = "Value2"; auto filtered = pgmBuilder.Filter(take, [&pgmBuilder, &filterValue](TRuntimeNode item) { return pgmBuilder.AggrNotEquals( pgmBuilder.Unwrap(pgmBuilder.Member(item, "Value"), pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>(""), "", 0, 0), @@ -5811,7 +5811,7 @@ Value { auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", length))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(program.Contains("Map")); @@ -5867,12 +5867,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -5952,12 +5952,12 @@ Value { auto& pgmBuilder = driver.PgmBuilder; - TVector<TSelectColumn> columns; + TVector<TSelectColumn> columns; columns.emplace_back("ID", (ui32)Schema1::Table1::ID::ColumnId, (ui32)Schema1::Table1::ID::ColumnType); columns.emplace_back("Value", (ui32)Schema1::Table1::Value::ColumnId, (ui32)Schema1::Table1::Value::ColumnType); auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -6208,7 +6208,7 @@ Value { auto& pgmBuilder = driver.PgmBuilder; auto options = pgmBuilder.GetDefaultTableRangeOptions(); - TVector<ui32> keyTypes(1); + TVector<ui32> keyTypes(1); keyTypes[0] = (ui32)NUdf::TDataType<ui32>::Id; TRuntimeNode::TList rowFrom(1); rowFrom[0] = pgmBuilder.NewEmptyOptionalDataLiteral(NUdf::TDataType<ui32>::Id); @@ -6219,7 +6219,7 @@ Value { auto length = pgmBuilder.Length(list); auto pgm = pgmBuilder.Build(pgmBuilder.AsList(pgmBuilder.SetResult("Result", length))); - driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { + driver.ShardProgramInspector = [] (ui64 shard, const TString& program) { Y_UNUSED(shard); UNIT_ASSERT(!program.Contains("Map")); }; diff --git a/ydb/core/engine/mkql_keys.cpp b/ydb/core/engine/mkql_keys.cpp index 05afb89adc2..0350356c849 100644 --- a/ydb/core/engine/mkql_keys.cpp +++ b/ydb/core/engine/mkql_keys.cpp @@ -46,11 +46,11 @@ TCell MakeCell(const NUdf::TUnboxedValuePod& value) { } THolder<TKeyDesc> ExtractKeyTuple(const TTableId& tableId, TTupleLiteral* tuple, - const TVector<TKeyDesc::TColumnOp>& columns, + const TVector<TKeyDesc::TColumnOp>& columns, TKeyDesc::ERowOperation rowOperation, bool requireStaticKey, const TTypeEnvironment& env) { - TVector<ui32> keyColumnTypes(tuple->GetValuesCount()); - TVector<TCell> fromValues(tuple->GetValuesCount()); - TVector<TCell> toValues(tuple->GetValuesCount()); + TVector<ui32> keyColumnTypes(tuple->GetValuesCount()); + TVector<TCell> fromValues(tuple->GetValuesCount()); + TVector<TCell> toValues(tuple->GetValuesCount()); bool inclusiveFrom = true; bool inclusiveTo = true; bool point = true; @@ -83,7 +83,7 @@ THolder<TKeyDesc> ExtractKeyTuple(const TTableId& tableId, TTupleLiteral* tuple, return MakeHolder<TKeyDesc>(tableId, range, rowOperation, keyColumnTypes, columns); } -void ExtractReadColumns(TStructType* columnsType, TStructLiteral* tags, TVector<TKeyDesc::TColumnOp>& columns) { +void ExtractReadColumns(TStructType* columnsType, TStructLiteral* tags, TVector<TKeyDesc::TColumnOp>& columns) { MKQL_ENSURE(columnsType->GetMembersCount() == tags->GetValuesCount(), "Mismatch count of tags"); for (ui32 i = 0; i < columnsType->GetMembersCount(); ++i) { auto memberName = columnsType->GetMemberName(i); @@ -105,7 +105,7 @@ THolder<TKeyDesc> ExtractSelectRow(TCallable& callable, const TTypeEnvironment& MKQL_ENSURE(columnsNode.IsImmediate() && columnsNode.GetNode()->GetType()->IsType(), "Expected struct type"); auto columnsType = AS_TYPE(TStructType, static_cast<TType*>(columnsNode.GetNode())); auto tags = AS_VALUE(TStructLiteral, callable.GetInput(2)); - TVector<TKeyDesc::TColumnOp> columns(columnsType->GetMembersCount()); + TVector<TKeyDesc::TColumnOp> columns(columnsType->GetMembersCount()); ExtractReadColumns(columnsType, tags, columns); auto tuple = AS_VALUE(TTupleLiteral, callable.GetInput(3)); THolder<TKeyDesc> desc = ExtractKeyTuple(tableId, tuple, columns, TKeyDesc::ERowOperation::Read, true, env); @@ -119,7 +119,7 @@ THolder<TKeyDesc> ExtractSelectRange(TCallable& callable, const TTypeEnvironment auto columnsNode = callable.GetInput(1); MKQL_ENSURE(columnsNode.IsImmediate() && columnsNode.GetNode()->GetType()->IsType(), "Expected struct type"); auto columnsType = AS_TYPE(TStructType, static_cast<TType*>(columnsNode.GetNode())); - TVector<TKeyDesc::TColumnOp> columns(columnsType->GetMembersCount()); + TVector<TKeyDesc::TColumnOp> columns(columnsType->GetMembersCount()); auto tags = AS_VALUE(TStructLiteral, callable.GetInput(2)); ExtractReadColumns(columnsType, tags, columns); auto fromTuple = AS_VALUE(TTupleLiteral, callable.GetInput(3)); @@ -131,9 +131,9 @@ THolder<TKeyDesc> ExtractSelectRange(TCallable& callable, const TTypeEnvironment ui64 itemsLimit = AS_VALUE(TDataLiteral, callable.GetInput(6))->AsValue().Get<ui64>(); ui64 bytesLimit = AS_VALUE(TDataLiteral, callable.GetInput(7))->AsValue().Get<ui64>(); - TVector<ui32> keyColumnTypes(Max(fromTuple->GetValuesCount(), toTuple->GetValuesCount())); - TVector<TCell> fromValues(keyColumnTypes.size()); // padded with NULLs - TVector<TCell> toValues(toTuple->GetValuesCount()); + TVector<ui32> keyColumnTypes(Max(fromTuple->GetValuesCount(), toTuple->GetValuesCount())); + TVector<TCell> fromValues(keyColumnTypes.size()); // padded with NULLs + TVector<TCell> toValues(toTuple->GetValuesCount()); bool inclusiveFrom = !(flags & TReadRangeOptions::TFlags::ExcludeInitValue); bool inclusiveTo = !(flags & TReadRangeOptions::TFlags::ExcludeTermValue); bool point = false; @@ -179,7 +179,7 @@ THolder<TKeyDesc> ExtractUpdateRow(TCallable& callable, const TTypeEnvironment& auto tableId = ExtractTableId(callable.GetInput(0)); auto updateNode = callable.GetInput(2); auto update = AS_VALUE(TStructLiteral, updateNode); - TVector<TKeyDesc::TColumnOp> columns(update->GetValuesCount()); + TVector<TKeyDesc::TColumnOp> columns(update->GetValuesCount()); for (ui32 i = 0; i < update->GetValuesCount(); ++i) { auto memberName = update->GetType()->GetMemberName(i); ui32 columnId = 0; @@ -236,7 +236,7 @@ THolder<TKeyDesc> ExtractEraseRow(TCallable& callable, const TTypeEnvironment& e auto tableId = ExtractTableId(callable.GetInput(0)); auto tuple = AS_VALUE(TTupleLiteral, callable.GetInput(1)); THolder<TKeyDesc> desc; - return ExtractKeyTuple(tableId, tuple, TVector<TKeyDesc::TColumnOp>(), TKeyDesc::ERowOperation::Erase, false, env); + return ExtractKeyTuple(tableId, tuple, TVector<TKeyDesc::TColumnOp>(), TKeyDesc::ERowOperation::Erase, false, env); } } @@ -303,8 +303,8 @@ THolder<TKeyDesc> ExtractTableKey(TCallable& callable, const TTableStrings& stri return nullptr; } -TVector<THolder<TKeyDesc>> ExtractTableKeys(TExploringNodeVisitor& explorer, const TTypeEnvironment& env) { - TVector<THolder<TKeyDesc>> descList; +TVector<THolder<TKeyDesc>> ExtractTableKeys(TExploringNodeVisitor& explorer, const TTypeEnvironment& env) { + TVector<THolder<TKeyDesc>> descList; TTableStrings strings(env); for (auto node : explorer.GetNodes()) { if (node->GetType()->GetKind() != TType::EKind::Callable) diff --git a/ydb/core/engine/mkql_keys.h b/ydb/core/engine/mkql_keys.h index 635ad3ce147..881abbcb996 100644 --- a/ydb/core/engine/mkql_keys.h +++ b/ydb/core/engine/mkql_keys.h @@ -37,12 +37,12 @@ struct TTableStrings { const TInternName UpdateRow; const TInternName EraseRow; - THashSet<TInternName> All; - THashSet<TInternName> DbWrites; + THashSet<TInternName> All; + THashSet<TInternName> DbWrites; }; THolder<TKeyDesc> ExtractTableKey(TCallable& callable, const TTableStrings& strings, const TTypeEnvironment& env); -TVector<THolder<TKeyDesc>> ExtractTableKeys(TExploringNodeVisitor& explorer, const TTypeEnvironment& env); +TVector<THolder<TKeyDesc>> ExtractTableKeys(TExploringNodeVisitor& explorer, const TTypeEnvironment& env); TTableId ExtractTableId(const TRuntimeNode& node); TCell MakeCell(NUdf::TDataTypeId typeId, const NUdf::TUnboxedValuePod& value, const TTypeEnvironment& env, bool copy = true); void FillKeyTupleValue(const NUdf::TUnboxedValue& row, const TVector<ui32>& rowIndices, diff --git a/ydb/core/engine/mkql_proto.cpp b/ydb/core/engine/mkql_proto.cpp index 3dd053e3724..05e02a52828 100644 --- a/ydb/core/engine/mkql_proto.cpp +++ b/ydb/core/engine/mkql_proto.cpp @@ -173,7 +173,7 @@ protected: }; template <> -class TAlmostDoneTypeValue<TString> : public TRawTypeValue { +class TAlmostDoneTypeValue<TString> : public TRawTypeValue { public: TAlmostDoneTypeValue(NUdf::TDataTypeId schemeType, const TString& value) : TRawTypeValue(value.data(), value.size(), schemeType) @@ -185,7 +185,7 @@ bool CellsFromTuple(const NKikimrMiniKQL::TType* tupleType, const NKikimrMiniKQL::TValue& tupleValue, const TConstArrayRef<NScheme::TTypeId>& types, bool allowCastFromString, - TVector<TCell>& key, + TVector<TCell>& key, TString& errStr) { diff --git a/ydb/core/engine/mkql_proto.h b/ydb/core/engine/mkql_proto.h index 510ff15991f..3478c0a2172 100644 --- a/ydb/core/engine/mkql_proto.h +++ b/ydb/core/engine/mkql_proto.h @@ -19,7 +19,7 @@ bool CellsFromTuple(const NKikimrMiniKQL::TType* tupleType, const NKikimrMiniKQL::TValue& tupleValue, const TConstArrayRef<NScheme::TTypeId>& expectedTypes, bool allowCastFromString, - TVector<TCell>& key, + TVector<TCell>& key, TString& errStr); bool CellToValue(NScheme::TTypeId typeId, const TCell& c, NKikimrMiniKQL::TValue& val, TString& errStr); diff --git a/ydb/core/engine/mkql_proto_ut.cpp b/ydb/core/engine/mkql_proto_ut.cpp index c6e00e947c5..0823f8ba772 100644 --- a/ydb/core/engine/mkql_proto_ut.cpp +++ b/ydb/core/engine/mkql_proto_ut.cpp @@ -394,7 +394,7 @@ Y_UNIT_TEST(TestExportVariantStructTypeYdb) { bool parseOk = ::google::protobuf::TextFormat::ParseFromString(paramsProto, ¶ms); UNIT_ASSERT_C(parseOk, paramsProto); - TVector<TCell> cells; + TVector<TCell> cells; TString errStr; bool res = CellsFromTuple(¶ms.GetType(), params.GetValue(), types, true, cells, errStr); UNIT_ASSERT_VALUES_EQUAL_C(res, errStr.empty(), paramsProto); diff --git a/ydb/core/erasure/erasure.cpp b/ydb/core/erasure/erasure.cpp index a41b0279328..e5d167dea22 100644 --- a/ydb/core/erasure/erasure.cpp +++ b/ydb/core/erasure/erasure.cpp @@ -16,7 +16,7 @@ # define VERBOSE_COUT(a) \ Cerr << a -static TString DebugFormatBits(ui64 value) { +static TString DebugFormatBits(ui64 value) { TStringStream s; for (size_t i = 7; i >=4; --i) { s << ((value >> i) & 1); @@ -1541,8 +1541,8 @@ void EoBlockRestore(TErasureType::ECrcMode crcMode, const TErasureType &type, TD // TODO: use 2-nd part of 'eo-split' to restore m+1 part // TODO: 1-pass if (missingDataPartIdxA <= p.DataParts && missingDataPartIdxB >= p.TotalParts - 1) { - TString temp; - TString &buffer = restoreFullData ? outBuffer : temp; + TString temp; + TString &buffer = restoreFullData ? outBuffer : temp; if (!restoreFullData && restoreParts && missingDataPartIdxB == p.TotalParts - 1) { // The (f1) case, but no full data needed, only parts TRACE("case# f1" << Endl); @@ -1583,8 +1583,8 @@ void EoBlockRestore(TErasureType::ECrcMode crcMode, const TErasureType &type, TD if (missingDataPartIdxA == p.TotalParts - 1 && missingDataPartIdxB == p.TotalParts) { TRACE("case# c" << Endl); VERBOSE_COUT(__LINE__ << " of " << __FILE__ << Endl); - TString temp; - TString &buffer = restoreFullData ? outBuffer : temp; + TString temp; + TString &buffer = restoreFullData ? outBuffer : temp; if (!restoreFullData) { TRACE(__LINE__ << Endl); if (!restoreParityParts) { @@ -1934,7 +1934,7 @@ void XorBlockRestore(TErasureType::ECrcMode crcMode, const TErasureType &type, T p.XorRestorePart<isStripe, restoreParts, restoreFullData, restoreParityParts>(partSet, missingDataPartIdx); } -const std::array<TString, TErasureType::ErasureSpeciesCount> TErasureType::ErasureName{{ +const std::array<TString, TErasureType::ErasureSpeciesCount> TErasureType::ErasureName{{ "none", "mirror-3", "block-3-1", diff --git a/ydb/core/erasure/erasure.h b/ydb/core/erasure/erasure.h index 35bd68c2d2f..3ecb90208c6 100644 --- a/ydb/core/erasure/erasure.h +++ b/ydb/core/erasure/erasure.h @@ -6,7 +6,7 @@ #include <ydb/core/util/yverify_stream.h> #include <util/stream/str.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/bt_exception.h> #include <util/string/builder.h> @@ -281,12 +281,12 @@ struct TErasureType { return ErasureSpecies; } - TString ToString() const { + TString ToString() const { Y_VERIFY((ui64)ErasureSpecies < ErasureSpeciesCount); return ErasureName[ErasureSpecies]; } - static TString ErasureSpeciesName(ui32 erasureSpecies) { + static TString ErasureSpeciesName(ui32 erasureSpecies) { if (erasureSpecies < ErasureSpeciesCount) { return ErasureName[erasureSpecies]; } @@ -295,7 +295,7 @@ struct TErasureType { return str.Str(); } - static EErasureSpecies ErasureSpeciesByName(TString name) { + static EErasureSpecies ErasureSpeciesByName(TString name) { for (ui32 species = 0; species < TErasureType::ErasureSpeciesCount; ++species) { if (TErasureType::ErasureName[species] == name) { return TErasureType::EErasureSpecies(species); @@ -342,7 +342,7 @@ struct TErasureType { ui32 BlockSplitPartIndex(ui64 offset, ui64 dataSize, ui64 &outPartOffset) const; ui64 BlockSplitWholeOffset(ui64 dataSize, ui64 partIdx, ui64 offset) const; - static const std::array<TString, ErasureSpeciesCount> ErasureName; + static const std::array<TString, ErasureSpeciesCount> ErasureName; protected: EErasureSpecies ErasureSpecies; diff --git a/ydb/core/erasure/erasure_perf_test.cpp b/ydb/core/erasure/erasure_perf_test.cpp index 2aaee893345..3110a57fb07 100644 --- a/ydb/core/erasure/erasure_perf_test.cpp +++ b/ydb/core/erasure/erasure_perf_test.cpp @@ -47,7 +47,7 @@ TString GenerateData(ui32 dataSize) { return testString; } -std::pair<double, double> CalcAvgSd(TVector<double> ×) { +std::pair<double, double> CalcAvgSd(TVector<double> ×) { double avg = 0; double sd = 0; auto min = std::min_element(times.begin(), times.end()); @@ -69,13 +69,13 @@ std::pair<double, double> CalcAvgSd(TVector<double> ×) { } template <bool measureSplit, bool measureRestore> -std::pair<double, double> MeasureTime(TErasureType &type, TVector<ui32> &missedParts, ui32 dataSize, +std::pair<double, double> MeasureTime(TErasureType &type, TVector<ui32> &missedParts, ui32 dataSize, bool isRestoreParts, bool isRestoreFullData) { const size_t attempts = dataSize < 10000 ? ATTEMPTS : 10; THPTimer timer; - TVector<double> times; + TVector<double> times; ui32 partMask = ~(ui32)0; for (const ui32 &part : missedParts) { partMask &= ~(ui32)(1ul << part); @@ -144,7 +144,7 @@ std::pair<double, double> MeasureTime(TErasureType &type, TVector<ui32> &missedP return CalcAvgSd(times); } -TVector<TVector<ui32>> ChooseCombinationCase(TErasureType &type) { +TVector<TVector<ui32>> ChooseCombinationCase(TErasureType &type) { if (type.GetErasure() == TErasureType::EErasureSpecies::Erasure4Plus2Stripe || type.GetErasure() == TErasureType::EErasureSpecies::Erasure4Plus2Block ) { return { {0, 1} @@ -161,11 +161,11 @@ const char *Bool2str(bool val) { void MeasureRestoreTime(TErasureType &type) { Cout << "EErasureType = " << type.ToString() << " Measuring restore time, time in milliseconds" << Endl; - TVector<TVector<ui32>> testCombin = ChooseCombinationCase(type); + TVector<TVector<ui32>> testCombin = ChooseCombinationCase(type); TVector<ui64> dataSizes {100, 4*1024, 4111, 8*1024, 8207, 4062305, 4*1024*1024}; for (const ui64 &size : dataSizes) { Cout << " size=" << size << Endl; - for (TVector<ui32> &combination : testCombin) { + for (TVector<ui32> &combination : testCombin) { for (ui32 variant = 1; variant < 2; ++variant) { bool isRestoreParts = false; bool isRestoreFullData = false; @@ -198,7 +198,7 @@ void MeasureRestoreTime(TErasureType &type) { void MeasureSplitTime(TErasureType &type) { Cout << "EErasureType = " << type.ToString() << Endl; - TVector<ui32> combination {0, 1}; + TVector<ui32> combination {0, 1}; //TVector<ui64> dataSizes {100, 4012, 4*1024, 4111, 8*1024, 8207, 4062305, 4*1024*1024}; TVector<ui64> dataSizes {100, 4012, 4*1024, 4111}; for (const ui64 &size : dataSizes) { diff --git a/ydb/core/erasure/erasure_ut.cpp b/ydb/core/erasure/erasure_ut.cpp index 2473bd16506..7507158ec99 100644 --- a/ydb/core/erasure/erasure_ut.cpp +++ b/ydb/core/erasure/erasure_ut.cpp @@ -231,7 +231,7 @@ TVector<TDiff> GenerateRandomDiff(NPrivate::TMersenne64 &randGen, ui32 dataSize, Y_UNIT_TEST_SUITE(TErasureTypeTest) { // Test if new version is capable to restore data splited by current version (which is right by definition) Y_UNIT_TEST(isSplittedDataEqualsToOldVerion) { - TVector<TVector<ui8>> dataPool { + TVector<TVector<ui8>> dataPool { {49,184,130,19,181,231,130}, {249,122,57,146,140,30,69,51,88,81,92,29,220,192,18,14,195,162,244,139,59,141,161,14, @@ -245,7 +245,7 @@ Y_UNIT_TEST_SUITE(TErasureTypeTest) { 206,247,46,22,73,11,70,87,124,4,242,9,165,99,82,83,40,165,55,53,187,238,96,248,16, 103,197,132,216,107,191,229,140,90,129,81,63,232,85,19,232,59,96,193,5,133,139,251, 148,144,0,147,22,247,36,221,244,117,144,98,173,40} }; - TVector<TVector<TVector<ui8>>> partsPool { + TVector<TVector<TVector<ui8>>> partsPool { { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, @@ -285,8 +285,8 @@ Y_UNIT_TEST_SUITE(TErasureTypeTest) { }; TErasureType type(TErasureType::EErasureSpecies::Erasure4Plus2Block); for (ui32 variant = 0; variant < dataPool.size(); ++variant) { - TVector<ui8> &data = dataPool[variant]; - TVector<TVector<ui8>> &expectedParts = partsPool[variant]; + TVector<ui8> &data = dataPool[variant]; + TVector<TVector<ui8>> &expectedParts = partsPool[variant]; TString testString; testString.resize(data.size()); for (ui32 i = 0; i < testString.size(); ++i) { @@ -337,7 +337,7 @@ Y_UNIT_TEST_SUITE(TErasureTypeTest) { TString errorInfo = Sprintf("species=%d (%s) dataSize=%d partMask=0x%x (%s)", species, TErasureType::ErasureSpeciesName(species).c_str(), dataSize, partMask, mask); - TString testString; + TString testString; testString.resize(dataSize); for (ui32 i = 0; i < testString.size(); ++i) { ui32 col = (i / 8) % 4; @@ -387,11 +387,11 @@ Y_UNIT_TEST_SUITE(TErasureTypeTest) { } } - TString mode = Sprintf(" restoreParts=%s restoreFullData=%s ", + TString mode = Sprintf(" restoreParts=%s restoreFullData=%s ", (isRestoreParts ? "true" : "false"), (isRestoreFullData ? "true" : "false")); - TString restoredString; + TString restoredString; try { groupType.RestoreData(TErasureType::CrcModeNone, partSet, restoredString, isRestoreParts, isRestoreFullData, isRestoreParts); @@ -864,7 +864,7 @@ Y_UNIT_TEST_SUITE(TErasureTypeTest) { partMask &= ~(ui32)(1 << missingPartIdx[1]); // Prepare the test data - TString testString; + TString testString; ui32 dataSize = 129; testString.resize(dataSize); for (ui32 i = 0; i < testString.size(); ++i) { @@ -888,12 +888,12 @@ Y_UNIT_TEST_SUITE(TErasureTypeTest) { const ui64 partialSize = 2; const ui64 partialShift = 95; const ui32 partShift = 0; - TString restoredString; + TString restoredString; groupType.PartialDataRestore(TErasureType::CrcModeNone, partialShift, partialSize, partShift, partSet, restoredString); // Make sure the restored data matches the original - TString expectedString = testString.substr(partialShift, partialSize); + TString expectedString = testString.substr(partialShift, partialSize); UNIT_ASSERT_EQUAL(expectedString.size(), restoredString.size()); UNIT_ASSERT_STRINGS_EQUAL(expectedString.data(), restoredString.data()); } @@ -910,7 +910,7 @@ Y_UNIT_TEST_SUITE(TErasureTypeTest) { partMask &= ~(ui32)(1 << missingPartIdx[1]); // Prepare the test data - TString testString; + TString testString; ui32 dataSize = 129; testString.resize(dataSize); for (ui32 i = 0; i < testString.size(); ++i) { @@ -934,12 +934,12 @@ Y_UNIT_TEST_SUITE(TErasureTypeTest) { const ui64 partialSize = 34; const ui64 partialShift = 31; const ui32 partShift = 0; - TString restoredString; + TString restoredString; groupType.PartialDataRestore(TErasureType::CrcModeNone, partialShift, partialSize, partShift, partSet, restoredString); // Make sure the restored data matches the original - TString expectedString = testString.substr(partialShift, partialSize); + TString expectedString = testString.substr(partialShift, partialSize); UNIT_ASSERT_EQUAL(expectedString.size(), restoredString.size()); UNIT_ASSERT_STRINGS_EQUAL(expectedString.data(), restoredString.data()); }*/ diff --git a/ydb/core/keyvalue/keyvalue_collect_operation.cpp b/ydb/core/keyvalue/keyvalue_collect_operation.cpp index 0ed2bdf78bc..467be56eebd 100644 --- a/ydb/core/keyvalue/keyvalue_collect_operation.cpp +++ b/ydb/core/keyvalue/keyvalue_collect_operation.cpp @@ -5,7 +5,7 @@ namespace NKikimr { namespace NKeyValue { TCollectOperationHeader::TCollectOperationHeader(ui64 collectGeneration, ui64 collectStep, - TVector<TLogoBlobID> &keep, TVector<TLogoBlobID> &doNotKeep) + TVector<TLogoBlobID> &keep, TVector<TLogoBlobID> &doNotKeep) : CollectGeneration(collectGeneration) , CollectStep(collectStep) , KeepCount(keep.size()) diff --git a/ydb/core/keyvalue/keyvalue_collect_operation.h b/ydb/core/keyvalue/keyvalue_collect_operation.h index 49c67c34cf7..40b30905466 100644 --- a/ydb/core/keyvalue/keyvalue_collect_operation.h +++ b/ydb/core/keyvalue/keyvalue_collect_operation.h @@ -42,14 +42,14 @@ struct TCollectOperationHeader { TCollectOperationHeader(ui64 collectGeneration, ui64 collectStep, - TVector<TLogoBlobID> &keep, TVector<TLogoBlobID> &doNotKeep); + TVector<TLogoBlobID> &keep, TVector<TLogoBlobID> &doNotKeep); }; #pragma pack(pop) struct TCollectOperation : public TThrRefBase { TCollectOperationHeader Header; - TVector<TLogoBlobID> Keep; - TVector<TLogoBlobID> DoNotKeep; + TVector<TLogoBlobID> Keep; + TVector<TLogoBlobID> DoNotKeep; TCollectOperation(ui64 collectGeneration, ui64 collectStep, TVector<TLogoBlobID> &&keep, TVector<TLogoBlobID> &&doNotKeep) diff --git a/ydb/core/keyvalue/keyvalue_collector.cpp b/ydb/core/keyvalue/keyvalue_collector.cpp index 8b7696bcb25..2d6f347959f 100644 --- a/ydb/core/keyvalue/keyvalue_collector.cpp +++ b/ydb/core/keyvalue/keyvalue_collector.cpp @@ -10,8 +10,8 @@ namespace NKeyValue { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct TGroupCollector { - TDeque<TLogoBlobID> Keep; - TDeque<TLogoBlobID> DoNotKeep; + TDeque<TLogoBlobID> Keep; + TDeque<TLogoBlobID> DoNotKeep; }; class TKeyValueCollector : public TActorBootstrapped<TKeyValueCollector> { @@ -24,7 +24,7 @@ class TKeyValueCollector : public TActorBootstrapped<TKeyValueCollector> { ui64 CollectorErrors; bool IsSpringCleanup; - TMap<ui32, TMap<ui32, TGroupCollector>> CollectorForGroupForChannel; + TMap<ui32, TMap<ui32, TGroupCollector>> CollectorForGroupForChannel; public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { return NKikimrServices::TActivity::KEYVALUE_ACTOR; @@ -153,10 +153,10 @@ public: return; } - void PrepareVector(const TDeque<TLogoBlobID> &in, THolder<TVector<TLogoBlobID>> &out) { + void PrepareVector(const TDeque<TLogoBlobID> &in, THolder<TVector<TLogoBlobID>> &out) { ui64 size = in.size(); if (size) { - out.Reset(new TVector<TLogoBlobID>(size)); + out.Reset(new TVector<TLogoBlobID>(size)); ui64 outIdx = 0; for (const auto &blob: in) { (*out)[outIdx] = blob; @@ -167,8 +167,8 @@ public: } void SendTheRequest(const TActorContext &ctx) { - THolder<TVector<TLogoBlobID>> keep; - THolder<TVector<TLogoBlobID>> doNotKeep; + THolder<TVector<TLogoBlobID>> keep; + THolder<TVector<TLogoBlobID>> doNotKeep; PrepareVector(CollectorForGroupForChannel.begin()->second.begin()->second.Keep, keep); PrepareVector(CollectorForGroupForChannel.begin()->second.begin()->second.DoNotKeep, doNotKeep); ui32 channelIdx = CollectorForGroupForChannel.begin()->first; diff --git a/ydb/core/keyvalue/keyvalue_collector_ut.cpp b/ydb/core/keyvalue/keyvalue_collector_ut.cpp index 4456a823803..4532e15fc9f 100644 --- a/ydb/core/keyvalue/keyvalue_collector_ut.cpp +++ b/ydb/core/keyvalue/keyvalue_collector_ut.cpp @@ -111,8 +111,8 @@ Y_UNIT_TEST(TestKeyValueCollectorEmpty) { TContext context; context.Setup(); - TVector<TLogoBlobID> keep; - TVector<TLogoBlobID> doNotKeep; + TVector<TLogoBlobID> keep; + TVector<TLogoBlobID> doNotKeep; TIntrusivePtr<NKeyValue::TCollectOperation> operation(new NKeyValue::TCollectOperation(100, 100, std::move(keep), std::move(doNotKeep))); context.SetActor(CreateKeyValueCollector( context.GetTabletActorId(), operation, context.GetTabletInfo().Get(), 200, 200, true)); @@ -137,9 +137,9 @@ Y_UNIT_TEST(TestKeyValueCollectorSingle) { TContext context; context.Setup(); - TVector<TLogoBlobID> keep; + TVector<TLogoBlobID> keep; keep.emplace_back(0x10010000001000Bull, 5, 58949, NKeyValue::BLOB_CHANNEL, 1209816, 10); - TVector<TLogoBlobID> doNotKeep; + TVector<TLogoBlobID> doNotKeep; TIntrusivePtr<NKeyValue::TCollectOperation> operation(new NKeyValue::TCollectOperation(100, 100, std::move(keep), std::move(doNotKeep))); context.SetActor(CreateKeyValueCollector( context.GetTabletActorId(), operation, context.GetTabletInfo().Get(), 200, 200, true)); @@ -173,8 +173,8 @@ Y_UNIT_TEST(TestKeyValueCollectorMultiple) { TContext context; context.Setup(); - TVector<TLogoBlobID> keep; - TVector<TLogoBlobID> doNotKeep; + TVector<TLogoBlobID> keep; + TVector<TLogoBlobID> doNotKeep; doNotKeep.emplace_back(0x10010000001000Bull, 5, 58949, NKeyValue::BLOB_CHANNEL, 1209816, 10); doNotKeep.emplace_back(0x10010000001000Bull, 15, 58949, NKeyValue::BLOB_CHANNEL, 1209816, 10); doNotKeep.emplace_back(0x10010000001000Bull, 25, 58949, NKeyValue::BLOB_CHANNEL, 1209816, 10); @@ -185,7 +185,7 @@ Y_UNIT_TEST(TestKeyValueCollectorMultiple) { doNotKeep.emplace_back(0x10010000001000Bull, 25, 58949, NKeyValue::BLOB_CHANNEL + 1, 1209816, 10); doNotKeep.emplace_back(0x10010000001000Bull, 35, 58949, NKeyValue::BLOB_CHANNEL + 1, 1209816, 10); - TSet<TLogoBlobID> ids; + TSet<TLogoBlobID> ids; for (ui32 i = 0; i < doNotKeep.size(); ++i) { ids.insert(doNotKeep[i]); } diff --git a/ydb/core/keyvalue/keyvalue_flat_impl.h b/ydb/core/keyvalue/keyvalue_flat_impl.h index 292f2feff93..5a271f8639a 100644 --- a/ydb/core/keyvalue/keyvalue_flat_impl.h +++ b/ydb/core/keyvalue/keyvalue_flat_impl.h @@ -247,7 +247,7 @@ protected: }; TKeyValueState State; - TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue; + TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue; TActorId CollectorActorId; void OnDetach(const TActorContext &ctx) override { diff --git a/ydb/core/keyvalue/keyvalue_helpers.cpp b/ydb/core/keyvalue/keyvalue_helpers.cpp index cd4051d8cd3..425bec5771f 100644 --- a/ydb/core/keyvalue/keyvalue_helpers.cpp +++ b/ydb/core/keyvalue/keyvalue_helpers.cpp @@ -14,12 +14,12 @@ ui8 THelpers::Checksum(ui8 prev, size_t dataSize, const ui8* data) { return prev; } -bool THelpers::CheckChecksum(const TString &key) { +bool THelpers::CheckChecksum(const TString &key) { ui8 sum = Checksum(0, key.size(), (const ui8*)key.data()); return (sum == 0); } -TString THelpers::GenerateKeyFor(EItemType itemType, const ui8* data, size_t size) { +TString THelpers::GenerateKeyFor(EItemType itemType, const ui8* data, size_t size) { TString key = TString::Uninitialized(sizeof(TKeyHeader) + size); TDataHeader header; header.ItemType = itemType; @@ -29,13 +29,13 @@ TString THelpers::GenerateKeyFor(EItemType itemType, const ui8* data, size_t siz return key; } -TString THelpers::GenerateKeyFor(EItemType itemType, const TString &arbitraryPart) { +TString THelpers::GenerateKeyFor(EItemType itemType, const TString &arbitraryPart) { const size_t size = arbitraryPart.size(); const ui8 *data = (const ui8 *) arbitraryPart.data(); return GenerateKeyFor(itemType, data, size); } -bool THelpers::ExtractKeyParts(const TString &key, TString &arbitraryPart, TKeyHeader &header) { +bool THelpers::ExtractKeyParts(const TString &key, TString &arbitraryPart, TKeyHeader &header) { if (!CheckChecksum(key)) { return false; } @@ -51,44 +51,44 @@ bool THelpers::ExtractKeyParts(const TString &key, TString &arbitraryPart, TKeyH } void THelpers::DbUpdateState(TKeyValueStoredStateData &state, ISimpleDb &db, const TActorContext &ctx) { - TString empty; - TString key = THelpers::GenerateKeyFor(EIT_STATE, empty); + TString empty; + TString key = THelpers::GenerateKeyFor(EIT_STATE, empty); state.UpdateChecksum(); TString value = TString::Uninitialized(sizeof(state)); memcpy(const_cast<char*>(value.data()), &state, sizeof(state)); db.Update(key, value, ctx); } -void THelpers::DbEraseUserKey(const TString &userKey, ISimpleDb &db, const TActorContext &ctx) { - TString key = THelpers::GenerateKeyFor(EIT_KEYVALUE_1, userKey); +void THelpers::DbEraseUserKey(const TString &userKey, ISimpleDb &db, const TActorContext &ctx) { + TString key = THelpers::GenerateKeyFor(EIT_KEYVALUE_1, userKey); db.Erase(key, ctx); } -void THelpers::DbUpdateUserKeyValue(const TString &userKey, const TString& value, ISimpleDb &db, +void THelpers::DbUpdateUserKeyValue(const TString &userKey, const TString& value, ISimpleDb &db, const TActorContext &ctx) { - TString key = THelpers::GenerateKeyFor(EIT_KEYVALUE_1, userKey); + TString key = THelpers::GenerateKeyFor(EIT_KEYVALUE_1, userKey); db.Update(key, value, ctx); } void THelpers::DbEraseTrash(const TLogoBlobID &id, ISimpleDb &db, const TActorContext &ctx) { TTrashKeyArbitrary arbitrary; arbitrary.LogoBlobId = id; - TString key = THelpers::GenerateKeyFor(EIT_TRASH, (ui8*)&arbitrary, sizeof(TTrashKeyArbitrary)); + TString key = THelpers::GenerateKeyFor(EIT_TRASH, (ui8*)&arbitrary, sizeof(TTrashKeyArbitrary)); db.Erase(key, ctx); } void THelpers::DbUpdateTrash(const TLogoBlobID &id, ISimpleDb &db, const TActorContext &ctx) { TTrashKeyArbitrary arbitrary; arbitrary.LogoBlobId = id; - TString key = THelpers::GenerateKeyFor(EIT_TRASH, (ui8*)&arbitrary, sizeof(TTrashKeyArbitrary)); - TString value; + TString key = THelpers::GenerateKeyFor(EIT_TRASH, (ui8*)&arbitrary, sizeof(TTrashKeyArbitrary)); + TString value; db.Update(key, value, ctx); } void THelpers::DbUpdateCollect(ui64 collectGeneration, ui64 collectStep, - TVector<TLogoBlobID> keep, TVector<TLogoBlobID> doNotKeep, ISimpleDb &db, const TActorContext &ctx) { - TString empty; - TString key = THelpers::GenerateKeyFor(EIT_COLLECT, empty); + TVector<TLogoBlobID> keep, TVector<TLogoBlobID> doNotKeep, ISimpleDb &db, const TActorContext &ctx) { + TString empty; + TString key = THelpers::GenerateKeyFor(EIT_COLLECT, empty); TCollectOperationHeader header(collectGeneration, collectStep, keep, doNotKeep); TString value = TString::Uninitialized( sizeof(TCollectOperationHeader) + sizeof(TLogoBlobID) * (keep.size() + doNotKeep.size())); @@ -106,8 +106,8 @@ void THelpers::DbUpdateCollect(ui64 collectGeneration, ui64 collectStep, } void THelpers::DbEraseCollect(ISimpleDb &db, const TActorContext &ctx) { - TString empty; - TString key = THelpers::GenerateKeyFor(EIT_COLLECT, empty); + TString empty; + TString key = THelpers::GenerateKeyFor(EIT_COLLECT, empty); db.Erase(key, ctx); } diff --git a/ydb/core/keyvalue/keyvalue_helpers.h b/ydb/core/keyvalue/keyvalue_helpers.h index 68960f3b868..093506555cb 100644 --- a/ydb/core/keyvalue/keyvalue_helpers.h +++ b/ydb/core/keyvalue/keyvalue_helpers.h @@ -12,21 +12,21 @@ struct TKeyValueStoredStateData; struct TKeyValueData; struct THelpers { static ui8 Checksum(ui8 prev, size_t dataSize, const ui8* data); - static bool CheckChecksum(const TString &key); + static bool CheckChecksum(const TString &key); - static bool ExtractKeyParts(const TString &key, TString &arbitraryPart, TKeyHeader &header); - static TString GenerateKeyFor(EItemType itemType, const ui8* data, size_t size); - static TString GenerateKeyFor(EItemType itemType, const TString &arbitraryPart); + static bool ExtractKeyParts(const TString &key, TString &arbitraryPart, TKeyHeader &header); + static TString GenerateKeyFor(EItemType itemType, const ui8* data, size_t size); + static TString GenerateKeyFor(EItemType itemType, const TString &arbitraryPart); static void DbUpdateState(TKeyValueStoredStateData &state, ISimpleDb &db, const TActorContext &ctx); - static void DbEraseUserKey(const TString &userKey, ISimpleDb &db, const TActorContext &ctx); - static void DbUpdateUserKeyValue(const TString &userKey, const TString& value, ISimpleDb &db, + static void DbEraseUserKey(const TString &userKey, ISimpleDb &db, const TActorContext &ctx); + static void DbUpdateUserKeyValue(const TString &userKey, const TString& value, ISimpleDb &db, const TActorContext &ctx); static void DbEraseTrash(const TLogoBlobID &id, ISimpleDb &db, const TActorContext &ctx); static void DbUpdateTrash(const TLogoBlobID &id, ISimpleDb &db, const TActorContext &ctx); static void DbEraseCollect(ISimpleDb &db, const TActorContext &ctx); static void DbUpdateCollect(ui64 collectGeneration, ui64 collectStep, - TVector<TLogoBlobID> keep, TVector<TLogoBlobID> doNotKeep, ISimpleDb &db, const TActorContext &ctx); + TVector<TLogoBlobID> keep, TVector<TLogoBlobID> doNotKeep, ISimpleDb &db, const TActorContext &ctx); using TGenerationStep = std::tuple<ui32, ui32>; static TGenerationStep GenerationStep(const TLogoBlobID &id); diff --git a/ydb/core/keyvalue/keyvalue_index_record.cpp b/ydb/core/keyvalue/keyvalue_index_record.cpp index 2765cc50bb2..c5319243f70 100644 --- a/ydb/core/keyvalue/keyvalue_index_record.cpp +++ b/ydb/core/keyvalue/keyvalue_index_record.cpp @@ -11,7 +11,7 @@ TIndexRecord::TChainItem::TChainItem(const TLogoBlobID &id, ui64 offset) { } -TIndexRecord::TChainItem::TChainItem(TString &inlineData, ui64 offset) +TIndexRecord::TChainItem::TChainItem(TString &inlineData, ui64 offset) : InlineData(inlineData) , Offset(offset) { @@ -89,8 +89,8 @@ bool TIndexRecord::operator==(const TIndexRecord& right) const { return Chain == right.Chain && CreationUnixTime == right.CreationUnixTime; } -TString TIndexRecord::Serialize() const { - TString value; +TString TIndexRecord::Serialize() const { + TString value; ui64 totalSize = sizeof(TKeyValueData2); for (ui32 i = 0; i < Chain.size(); ++i) { if (Chain[i].IsInline()) { @@ -123,13 +123,13 @@ TString TIndexRecord::Serialize() const { return value; } -EItemType TIndexRecord::ReadItemType(const TString &rawData) { +EItemType TIndexRecord::ReadItemType(const TString &rawData) { Y_VERIFY(rawData.size() >= sizeof(TDataHeader)); const TDataHeader *dataHeader = (const TDataHeader *)rawData.data(); return (EItemType)dataHeader->ItemType; } -bool TIndexRecord::Deserialize1(const TString &rawData, TString &outErrorInfo) { +bool TIndexRecord::Deserialize1(const TString &rawData, TString &outErrorInfo) { Y_VERIFY(rawData.size() >= sizeof(TKeyValueData1)); const TKeyValueData1 *data = (const TKeyValueData1 *)rawData.data(); const ui32 numItems = TKeyValueData1::GetNumItems(rawData.size()); @@ -167,7 +167,7 @@ bool TIndexRecord::Deserialize1(const TString &rawData, TString &outErrorInfo) { return true; } -bool TIndexRecord::Deserialize2(const TString &rawData, TString &outErrorInfo) { +bool TIndexRecord::Deserialize2(const TString &rawData, TString &outErrorInfo) { Y_VERIFY(rawData.size() >= sizeof(TKeyValueData2)); const TKeyValueData2 *data = (const TKeyValueData2 *)rawData.data(); if (!data->CheckChecksum(rawData.size())) { diff --git a/ydb/core/keyvalue/keyvalue_index_record.h b/ydb/core/keyvalue/keyvalue_index_record.h index 3df68fe96c7..61bf3296d54 100644 --- a/ydb/core/keyvalue/keyvalue_index_record.h +++ b/ydb/core/keyvalue/keyvalue_index_record.h @@ -10,11 +10,11 @@ namespace NKeyValue { struct TIndexRecord { struct TChainItem { TLogoBlobID LogoBlobId; - TString InlineData; + TString InlineData; ui64 Offset; TChainItem(const TLogoBlobID &id, ui64 offset); - TChainItem(TString &inlineData, ui64 offset); + TChainItem(TString &inlineData, ui64 offset); bool IsInline() const; ui64 GetSize() const; @@ -25,17 +25,17 @@ struct TIndexRecord { bool operator==(const TChainItem& right) const; }; - TVector<TChainItem> Chain; + TVector<TChainItem> Chain; ui64 CreationUnixTime; TIndexRecord(); TIndexRecord(const TIndexRecord& /*other*/) = delete; ui64 GetFullValueSize() const; ui32 GetReadItems(ui64 offset, ui64 size, TIntermediate::TRead& read) const; - TString Serialize() const; - bool Deserialize1(const TString &rawData, TString &outErrorInfo); - bool Deserialize2(const TString &rawData, TString &outErrorInfo); - static EItemType ReadItemType(const TString &rawData); + TString Serialize() const; + bool Deserialize1(const TString &rawData, TString &outErrorInfo); + bool Deserialize2(const TString &rawData, TString &outErrorInfo); + static EItemType ReadItemType(const TString &rawData); // equlity operator for testing bool operator==(const TIndexRecord& right) const; diff --git a/ydb/core/keyvalue/keyvalue_intermediate.cpp b/ydb/core/keyvalue/keyvalue_intermediate.cpp index 82a78d9fa29..8960c1702c1 100644 --- a/ydb/core/keyvalue/keyvalue_intermediate.cpp +++ b/ydb/core/keyvalue/keyvalue_intermediate.cpp @@ -14,7 +14,7 @@ TIntermediate::TRead::TRead() , Status(NKikimrProto::UNKNOWN) {} -TIntermediate::TRead::TRead(const TString &key, ui32 valueSize, ui64 creationUnixTime, +TIntermediate::TRead::TRead(const TString &key, ui32 valueSize, ui64 creationUnixTime, NKikimrClient::TKeyValueRequest::EStorageChannel storageChannel) : Key(key) , Offset(0) diff --git a/ydb/core/keyvalue/keyvalue_intermediate.h b/ydb/core/keyvalue/keyvalue_intermediate.h index c28c14b9c37..d7adb06b931 100644 --- a/ydb/core/keyvalue/keyvalue_intermediate.h +++ b/ydb/core/keyvalue/keyvalue_intermediate.h @@ -32,9 +32,9 @@ struct TIntermediate { {} }; - TVector<TReadItem> ReadItems; - TString Key; - TString Value; + TVector<TReadItem> ReadItems; + TString Key; + TString Value; ui32 Offset; ui32 Size; ui32 ValueSize; @@ -43,25 +43,25 @@ struct TIntermediate { NKikimrClient::TKeyValueRequest::EStorageChannel StorageChannel; NKikimrBlobStorage::EGetHandleClass HandleClass; NKikimrProto::EReplyStatus Status; - TString Message; + TString Message; TRead(); - TRead(const TString &key, ui32 valueSize, ui64 creationUnixTime, + TRead(const TString &key, ui32 valueSize, ui64 creationUnixTime, NKikimrClient::TKeyValueRequest::EStorageChannel storageChannel); NKikimrProto::EReplyStatus ItemsStatus() const; NKikimrProto::EReplyStatus CumulativeStatus() const; }; struct TRangeRead { - TDeque<TRead> Reads; + TDeque<TRead> Reads; NKikimrBlobStorage::EGetHandleClass HandleClass; NKikimrProto::EReplyStatus Status; bool IncludeData; ui64 LimitBytes; }; struct TWrite { - TVector<TLogoBlobID> LogoBlobIds; - TString Key; - TString Data; + TVector<TLogoBlobID> LogoBlobIds; + TString Key; + TString Data; TEvBlobStorage::TEvPut::ETactic Tactic; NKikimrBlobStorage::EPutHandleClass HandleClass; NKikimrProto::EReplyStatus Status; @@ -72,17 +72,17 @@ struct TIntermediate { TKeyRange Range; }; struct TRename { - TString OldKey; - TString NewKey; + TString OldKey; + TString NewKey; }; struct TCopyRange { TKeyRange Range; - TString PrefixToAdd; - TString PrefixToRemove; + TString PrefixToAdd; + TString PrefixToRemove; }; struct TConcat { - TVector<TString> InputKeys; - TString OutputKey; + TVector<TString> InputKeys; + TString OutputKey; bool KeepInputs; }; struct TGetStatus { @@ -93,8 +93,8 @@ struct TIntermediate { }; struct TTrimLeakedBlobs { ui32 MaxItemsToTrim; - TMultiMap<ui32, ui32> ChannelGroupMap; - TVector<TLogoBlobID> FoundBlobs; + TMultiMap<ui32, ui32> ChannelGroupMap; + TVector<TLogoBlobID> FoundBlobs; }; struct TSetExecutorFastLogPolicy { bool IsAllowed; @@ -103,14 +103,14 @@ struct TIntermediate { using TCmd = std::variant<TWrite, TDelete, TRename, TCopyRange, TConcat>; using TReadCmd = std::variant<TRead, TRangeRead>; - TDeque<TRead> Reads; - TDeque<TRangeRead> RangeReads; - TDeque<TWrite> Writes; - TDeque<TDelete> Deletes; - TDeque<TRename> Renames; - TDeque<TCopyRange> CopyRanges; - TDeque<TConcat> Concats; - TDeque<TGetStatus> GetStatuses; + TDeque<TRead> Reads; + TDeque<TRangeRead> RangeReads; + TDeque<TWrite> Writes; + TDeque<TDelete> Deletes; + TDeque<TRename> Renames; + TDeque<TCopyRange> CopyRanges; + TDeque<TConcat> Concats; + TDeque<TGetStatus> GetStatuses; TMaybe<TTrimLeakedBlobs> TrimLeakedBlobs; TMaybe<TSetExecutorFastLogPolicy> SetExecutorFastLogPolicy; diff --git a/ydb/core/keyvalue/keyvalue_key_range.h b/ydb/core/keyvalue/keyvalue_key_range.h index 055df4132bd..26d24a9d958 100644 --- a/ydb/core/keyvalue/keyvalue_key_range.h +++ b/ydb/core/keyvalue/keyvalue_key_range.h @@ -6,10 +6,10 @@ namespace NKeyValue { struct TKeyRange { bool HasFrom; - TString KeyFrom; + TString KeyFrom; bool IncludeFrom; bool HasTo; - TString KeyTo; + TString KeyTo; bool IncludeTo; static TKeyRange WholeDatabase() { diff --git a/ydb/core/keyvalue/keyvalue_request_stat.h b/ydb/core/keyvalue/keyvalue_request_stat.h index 070ffcbecac..8a9b562069e 100644 --- a/ydb/core/keyvalue/keyvalue_request_stat.h +++ b/ydb/core/keyvalue/keyvalue_request_stat.h @@ -23,9 +23,9 @@ struct TRequestStat { ui64 Writes; ui64 GetStatuses; ui64 EnqueuedAs; - TDeque<ui64> GetLatencies; - TDeque<ui64> PutLatencies; - TDeque<ui64> GetStatusLatencies; + TDeque<ui64> GetLatencies; + TDeque<ui64> PutLatencies; + TDeque<ui64> GetStatusLatencies; TInstant KeyvalueStorageRequestSentAt; TInstant LocalBaseTxCreatedAt; TInstant IntermediateCreatedAt; diff --git a/ydb/core/keyvalue/keyvalue_simple_db.h b/ydb/core/keyvalue/keyvalue_simple_db.h index 5ef31e96ccc..33065ba73e5 100644 --- a/ydb/core/keyvalue/keyvalue_simple_db.h +++ b/ydb/core/keyvalue/keyvalue_simple_db.h @@ -6,8 +6,8 @@ namespace NKeyValue { class ISimpleDb { public: - virtual void Erase(const TString &key, const TActorContext &ctx) = 0; - virtual void Update(const TString &key, const TString &value, const TActorContext &ctx) = 0; + virtual void Erase(const TString &key, const TActorContext &ctx) = 0; + virtual void Update(const TString &key, const TString &value, const TActorContext &ctx) = 0; }; } // NKeyValue diff --git a/ydb/core/keyvalue/keyvalue_simple_db_flat.cpp b/ydb/core/keyvalue/keyvalue_simple_db_flat.cpp index 0e2cc43559b..4325983dd23 100644 --- a/ydb/core/keyvalue/keyvalue_simple_db_flat.cpp +++ b/ydb/core/keyvalue/keyvalue_simple_db_flat.cpp @@ -12,14 +12,14 @@ TSimpleDbFlat::TSimpleDbFlat(NTable::TDatabase &db) : Db(db) {} -void TSimpleDbFlat::Erase(const TString &key, const TActorContext &ctx) { +void TSimpleDbFlat::Erase(const TString &key, const TActorContext &ctx) { Y_UNUSED(ctx); const auto keyStr = NScheme::TSmallBoundedString::TInstance(key); const TRawTypeValue rawTypeValue = (TRawTypeValue)keyStr; Db.Update(TABLE_ID, NTable::ERowOp::Erase, {&rawTypeValue, 1}, { }); } -void TSimpleDbFlat::Update(const TString &key, const TString &value, const TActorContext &ctx) { +void TSimpleDbFlat::Update(const TString &key, const TString &value, const TActorContext &ctx) { Y_UNUSED(ctx); const auto keyStr = NScheme::TSmallBoundedString::TInstance(key); const TRawTypeValue rawTypeValue = (TRawTypeValue)keyStr; diff --git a/ydb/core/keyvalue/keyvalue_simple_db_flat.h b/ydb/core/keyvalue/keyvalue_simple_db_flat.h index 82661a9f157..75e0b912615 100644 --- a/ydb/core/keyvalue/keyvalue_simple_db_flat.h +++ b/ydb/core/keyvalue/keyvalue_simple_db_flat.h @@ -16,8 +16,8 @@ protected: NTable::TDatabase &Db; public: TSimpleDbFlat(NTable::TDatabase &db); - void Erase(const TString &key, const TActorContext &ctx) override; - void Update(const TString &key, const TString &value, const TActorContext &ctx) override; + void Erase(const TString &key, const TActorContext &ctx) override; + void Update(const TString &key, const TString &value, const TActorContext &ctx) override; }; } // NKeyValue diff --git a/ydb/core/keyvalue/keyvalue_state.cpp b/ydb/core/keyvalue/keyvalue_state.cpp index 6b31c463f83..478da26f18f 100644 --- a/ydb/core/keyvalue/keyvalue_state.cpp +++ b/ydb/core/keyvalue/keyvalue_state.cpp @@ -383,7 +383,7 @@ void TKeyValueState::Load(const TString &key, const TString& value) { IsEmptyDbStart = false; } - TString arbitraryPart; + TString arbitraryPart; TKeyHeader header; bool isOk = THelpers::ExtractKeyParts(key, arbitraryPart, header); Y_VERIFY(isOk); @@ -396,7 +396,7 @@ void TKeyValueState::Load(const TString &key, const TString& value) { case EIT_KEYVALUE_1: { TIndexRecord &record = Index[arbitraryPart]; - TString errorInfo; + TString errorInfo; bool isOk = false; EItemType headerItemType = TIndexRecord::ReadItemType(value); if (headerItemType == EIT_KEYVALUE_1) { @@ -446,8 +446,8 @@ void TKeyValueState::Load(const TString &key, const TString& value) { ui64 totalSize = sizeof(TCollectOperationHeader) + sizeof(TLogoBlobID) * (header->KeepCount + header->DoNotKeepCount); Y_VERIFY(value.size() == totalSize); - TVector<TLogoBlobID> keep; - TVector<TLogoBlobID> doNotKeep; + TVector<TLogoBlobID> keep; + TVector<TLogoBlobID> doNotKeep; keep.resize(header->KeepCount); doNotKeep.resize(header->DoNotKeepCount); const char* data = value.data() + sizeof(TCollectOperationHeader); @@ -1645,9 +1645,9 @@ void TKeyValueState::Dereference(const TLogoBlobID& id, ISimpleDb& db, const TAc } } -void TKeyValueState::UpdateKeyValue(const TString& key, const TIndexRecord& record, ISimpleDb& db, +void TKeyValueState::UpdateKeyValue(const TString& key, const TIndexRecord& record, ISimpleDb& db, const TActorContext& ctx) { - TString value = record.Serialize(); + TString value = record.Serialize(); THelpers::DbUpdateUserKeyValue(key, value, db, ctx); } @@ -1717,7 +1717,7 @@ bool TKeyValueState::CheckDeadline(const TActorContext &ctx, NKikimrClient::TKey THolder<TIntermediate> &intermediate) { if (kvRequest.HasDeadlineInstantMs()) { TInstant now = TAppData::TimeProvider->Now(); - intermediate->Deadline = TInstant::MicroSeconds(kvRequest.GetDeadlineInstantMs() * 1000ull); + intermediate->Deadline = TInstant::MicroSeconds(kvRequest.GetDeadlineInstantMs() * 1000ull); if (intermediate->Deadline <= now) { TStringStream str; @@ -2330,8 +2330,8 @@ bool TKeyValueState::PrepareCmdCopyRange(const TActorContext& ctx, NKikimrClient } else if (!ConvertRange(request.GetRange(), &interm.Range, ctx, intermediate, "CmdCopyRange", i)) { return false; } - interm.PrefixToAdd = request.HasPrefixToAdd() ? request.GetPrefixToAdd() : TString(); - interm.PrefixToRemove = request.HasPrefixToRemove() ? request.GetPrefixToRemove() : TString(); + interm.PrefixToAdd = request.HasPrefixToAdd() ? request.GetPrefixToAdd() : TString(); + interm.PrefixToRemove = request.HasPrefixToRemove() ? request.GetPrefixToRemove() : TString(); } return false; } @@ -2533,7 +2533,7 @@ TPrepareResult TKeyValueState::PrepareCommands(NKikimrKeyValue::ExecuteTransacti return {}; } -void TKeyValueState::ReplyError(const TActorContext &ctx, TString errorDescription, +void TKeyValueState::ReplyError(const TActorContext &ctx, TString errorDescription, NMsgBusProxy::EResponseStatus status, THolder<TIntermediate> &intermediate, const TTabletStorageInfo *info) { LOG_INFO_S(ctx, NKikimrServices::KEYVALUE, errorDescription); @@ -3181,11 +3181,11 @@ bool TKeyValueState::ConvertRange(const NKikimrClient::TKeyValueRequest::TKeyRan return true; } -TString TKeyValueState::Dump() const { +TString TKeyValueState::Dump() const { TStringStream ss; ss << "=== INDEX ===\n"; for (auto& x : Index) { - const TString& k = x.first; + const TString& k = x.first; const TIndexRecord& v = x.second; ss << k << "=== ctime:" << v.CreationUnixTime; for (const TIndexRecord::TChainItem& y : v.Chain) { @@ -3202,8 +3202,8 @@ void TKeyValueState::VerifyEqualIndex(const TKeyValueState& state) const { int i = 0; for (auto i1 = Index.cbegin(), e1 = Index.cend(); i1 != e1; ++i, ++i1, ++i2) { Y_VERIFY(i2 != e2, "index length differs. Dump:\n%s\n%s\n", Dump().data(), state.Dump().data()); - const TString& k1 = i1->first; - const TString& k2 = i2->first; + const TString& k1 = i1->first; + const TString& k2 = i2->first; Y_VERIFY(k1 == k2, "index key #%d differs. Dump:\n%s\n%s\n", i, Dump().data(), state.Dump().data()); const TIndexRecord& v1 = i1->second; const TIndexRecord& v2 = i2->second; diff --git a/ydb/core/keyvalue/keyvalue_state.h b/ydb/core/keyvalue/keyvalue_state.h index f57a69d35d3..6a271b4b92f 100644 --- a/ydb/core/keyvalue/keyvalue_state.h +++ b/ydb/core/keyvalue/keyvalue_state.h @@ -60,19 +60,19 @@ public: using TCommand = NKikimrKeyValue::ExecuteTransactionRequest::Command; class TIncrementalKeySet { - TMap<TString, TIndexRecord>& Index; - TSet<TString> AddedKeys; - TSet<TString> DeletedKeys; + TMap<TString, TIndexRecord>& Index; + TSet<TString> AddedKeys; + TSet<TString> DeletedKeys; class TIterator { TIncrementalKeySet& KeySet; - TMap<TString, TIndexRecord>::iterator IndexIterator; - TSet<TString>::iterator AddedKeysIterator; - TSet<TString>::iterator DeletedKeysIterator; + TMap<TString, TIndexRecord>::iterator IndexIterator; + TSet<TString>::iterator AddedKeysIterator; + TSet<TString>::iterator DeletedKeysIterator; public: - TIterator(TIncrementalKeySet& keySet, TMap<TString, TIndexRecord>::iterator indexIterator, - TSet<TString>::iterator addedKeysIterator, TSet<TString>::iterator deletedKeysIterator) + TIterator(TIncrementalKeySet& keySet, TMap<TString, TIndexRecord>::iterator indexIterator, + TSet<TString>::iterator addedKeysIterator, TSet<TString>::iterator deletedKeysIterator) : KeySet(keySet) , IndexIterator(indexIterator) , AddedKeysIterator(addedKeysIterator) @@ -90,7 +90,7 @@ public: return *this; } - const TString& operator*() const { + const TString& operator*() const { if (IndexIterator != KeySet.Index.end() && AddedKeysIterator != KeySet.AddedKeys.end()) { return std::min(IndexIterator->first, *AddedKeysIterator); } else if (IndexIterator != KeySet.Index.end()) { @@ -102,7 +102,7 @@ public: } } - const TString *operator->() const { + const TString *operator->() const { return &**this; } @@ -118,7 +118,7 @@ public: DeletedKeysIterator = KeySet.DeletedKeys.end(); break; } else { - const TString& currentKey = **this; + const TString& currentKey = **this; while (DeletedKeysIterator != KeySet.DeletedKeys.end() && *DeletedKeysIterator < currentKey) { ++DeletedKeysIterator; // FIXME: optimize } @@ -133,7 +133,7 @@ public: void MoveNext() { if (IndexIterator != KeySet.Index.end() && AddedKeysIterator != KeySet.AddedKeys.end()) { - const TString& key = std::min(IndexIterator->first, *AddedKeysIterator); + const TString& key = std::min(IndexIterator->first, *AddedKeysIterator); if (IndexIterator->first == key) { ++IndexIterator; } @@ -164,7 +164,7 @@ public: using iterator = TIterator; public: - TIncrementalKeySet(TMap<TString, TIndexRecord>& index) + TIncrementalKeySet(TMap<TString, TIndexRecord>& index) : Index(index) {} @@ -173,19 +173,19 @@ public: AddedKeys.insert(first, last); if (last != first) { --last; - TSet<TString>::iterator begin = DeletedKeys.lower_bound(*first); - TSet<TString>::iterator end = DeletedKeys.upper_bound(*last); + TSet<TString>::iterator begin = DeletedKeys.lower_bound(*first); + TSet<TString>::iterator end = DeletedKeys.upper_bound(*last); DeletedKeys.erase(begin, end); } } - void insert(const TString& key) { + void insert(const TString& key) { AddedKeys.insert(key); DeletedKeys.erase(key); } void erase(const iterator& iter) { - const TString& key = *iter; + const TString& key = *iter; DeletedKeys.insert(key); AddedKeys.erase(key); } @@ -199,14 +199,14 @@ public: } } - iterator find(const TString& key) { - TSet<TString>::iterator deleted = DeletedKeys.lower_bound(key); + iterator find(const TString& key) { + TSet<TString>::iterator deleted = DeletedKeys.lower_bound(key); if (deleted != DeletedKeys.end() && *deleted == key) { return end(); } - TMap<TString, TIndexRecord>::iterator index = Index.lower_bound(key); - TSet<TString>::iterator added = AddedKeys.lower_bound(key); + TMap<TString, TIndexRecord>::iterator index = Index.lower_bound(key); + TSet<TString>::iterator added = AddedKeys.lower_bound(key); if ((index != Index.end() && index->first == key) || (added != AddedKeys.end() && *added == key)) { return TIterator{*this, index, added, deleted}; @@ -223,11 +223,11 @@ public: return TIterator{*this, Index.end(), AddedKeys.end(), DeletedKeys.end()}; } - iterator lower_bound(const TString& key) { + iterator lower_bound(const TString& key) { return TIterator{*this, Index.lower_bound(key), AddedKeys.lower_bound(key), DeletedKeys.lower_bound(key)}; } - iterator upper_bound(const TString& key) { + iterator upper_bound(const TString& key) { return TIterator{*this, Index.upper_bound(key), AddedKeys.upper_bound(key), DeletedKeys.upper_bound(key)}; } }; @@ -245,9 +245,9 @@ protected: TVector<TRangeSet> ChannelRangeSets; TIndex Index; - THashMap<TLogoBlobID, ui32> RefCounts; - TSet<TLogoBlobID> Trash; - TMap<ui64, ui64> InFlightForStep; + THashMap<TLogoBlobID, ui32> RefCounts; + TSet<TLogoBlobID> Trash; + TMap<ui64, ui64> InFlightForStep; THashMap<ui64, TInstant> RequestInputTime; ui64 NextRequestUid = 0; TIntrusivePtr<TCollectOperation> CollectOperation; @@ -268,7 +268,7 @@ protected: TActorId ChannelBalancerActorId; ui64 InitialCollectsSent = 0; - TDeque<TAutoPtr<TIntermediate>> Queue; + TDeque<TAutoPtr<TIntermediate>> Queue; ui64 IntermediatesInFlight; ui64 IntermediatesInFlightLimit; ui64 RoInlineIntermediatesInFlight; @@ -410,7 +410,7 @@ public: } void Dereference(const TIndexRecord& record, ISimpleDb& db, const TActorContext& ctx); - void UpdateKeyValue(const TString& key, const TIndexRecord& record, ISimpleDb& db, const TActorContext& ctx); + void UpdateKeyValue(const TString& key, const TIndexRecord& record, ISimpleDb& db, const TActorContext& ctx); void Dereference(const TLogoBlobID& id, ISimpleDb& db, const TActorContext& ctx, bool initial); ui32 GetPerGenerationCounter() { @@ -533,7 +533,7 @@ public: THolder<TIntermediate> &intermediate, const TTabletStorageInfo *info, const TActorContext &ctx); TPrepareResult InitGetStatusCommand(TIntermediate::TGetStatus &cmd, NKikimrClient::TKeyValueRequest::EStorageChannel storageChannel, const TTabletStorageInfo *info); - void ReplyError(const TActorContext &ctx, TString errorDescription, + void ReplyError(const TActorContext &ctx, TString errorDescription, NMsgBusProxy::EResponseStatus status, THolder<TIntermediate> &intermediate, const TTabletStorageInfo *info = nullptr); @@ -713,7 +713,7 @@ public: } public: // For testing - TString Dump() const; + TString Dump() const; void VerifyEqualIndex(const TKeyValueState& state) const; }; diff --git a/ydb/core/keyvalue/keyvalue_storage_request.cpp b/ydb/core/keyvalue/keyvalue_storage_request.cpp index e9032d2ed3d..d3a58eead13 100644 --- a/ydb/core/keyvalue/keyvalue_storage_request.cpp +++ b/ydb/core/keyvalue/keyvalue_storage_request.cpp @@ -51,12 +51,12 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques }; struct TInFlightBatch { - TVector<TReadQueueItem> ReadQueue; + TVector<TReadQueueItem> ReadQueue; TInstant SentAt; }; - TMap<ui64, TInFlightBatch> InFlightBatchByCookie; - TDeque<TReadQueueItem> ReadItems; + TMap<ui64, TInFlightBatch> InFlightBatchByCookie; + TDeque<TReadQueueItem> ReadItems; TStackVec<ui32, 16> YellowMoveChannels; TStackVec<ui32, 16> YellowStopChannels; @@ -457,7 +457,7 @@ public: Become(&TThis::StateWait); } - void ReplyErrorAndDie(const TActorContext &ctx, TString errorDescription, + void ReplyErrorAndDie(const TActorContext &ctx, TString errorDescription, NMsgBusProxy::EResponseStatus status = NMsgBusProxy::MSTATUS_INTERNALERROR, NLog::EPriority logPriority = NLog::PRI_ERROR) { LOG_LOG_S(ctx, logPriority, NKikimrServices::KEYVALUE, errorDescription); @@ -498,7 +498,7 @@ public: TLogoBlobID prevId; ui32 prevGroup = Max<ui32>(); decltype(ReadItems)::iterator it; - TVector<TReadQueueItem> skippedItems; + TVector<TReadQueueItem> skippedItems; NKikimrBlobStorage::EGetHandleClass handleClass = NKikimrBlobStorage::FastRead; bool isHandleClassSet = false; for (it = ReadItems.begin(); it != ReadItems.end(); ++it) { diff --git a/ydb/core/keyvalue/keyvalue_ut.cpp b/ydb/core/keyvalue/keyvalue_ut.cpp index 4ae1fcf56a6..af069312a4e 100644 --- a/ydb/core/keyvalue/keyvalue_ut.cpp +++ b/ydb/core/keyvalue/keyvalue_ut.cpp @@ -63,7 +63,7 @@ struct TTestContext { TTabletTypes::EType TabletType; ui64 TabletId; TInitialEventsFilter InitialEventsFilter; - TVector<ui64> TabletIds; + TVector<ui64> TabletIds; THolder<TTestActorRuntime> Runtime; TActorId Edge; @@ -73,7 +73,7 @@ struct TTestContext { TabletIds.push_back(TabletId); } - void Prepare(const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &outActiveZone) { + void Prepare(const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &outActiveZone) { Y_UNUSED(dispatchName); outActiveZone = false; Runtime.Reset(new TTestBasicRuntime); @@ -127,7 +127,7 @@ void DoWithRetry(std::function<bool(void)> action, i32 retryCount = 2) { UNIT_ASSERT(isEnd); } -void CmdWrite(const TDeque<TString> &keys, const TDeque<TString> &values, +void CmdWrite(const TDeque<TString> &keys, const TDeque<TString> &values, const NKikimrClient::TKeyValueRequest::EStorageChannel storageChannel, const NKikimrClient::TKeyValueRequest::EPriority priority, TTestContext &tc) { Y_VERIFY(keys.size() == values.size()); @@ -163,17 +163,17 @@ void CmdWrite(const TDeque<TString> &keys, const TDeque<TString> &values, }); } -void CmdWrite(const TString &key, const TString &value, +void CmdWrite(const TString &key, const TString &value, const NKikimrClient::TKeyValueRequest::EStorageChannel storageChannel, const NKikimrClient::TKeyValueRequest::EPriority priority, TTestContext &tc) { - TDeque<TString> keys = {key}; - TDeque<TString> values = {value}; + TDeque<TString> keys = {key}; + TDeque<TString> values = {value}; CmdWrite(keys, values, storageChannel, priority, tc); } -void CmdRead(const TDeque<TString> &keys, +void CmdRead(const TDeque<TString> &keys, const NKikimrClient::TKeyValueRequest::EPriority priority, - const TDeque<TString> &expectedValues, const TDeque<bool> expectedNodatas, TTestContext &tc) { + const TDeque<TString> &expectedValues, const TDeque<bool> expectedNodatas, TTestContext &tc) { Y_VERIFY(keys.size() == expectedValues.size()); Y_VERIFY(expectedNodatas.size() == 0 || expectedNodatas.size() == keys.size()); TAutoPtr<IEventHandle> handle; @@ -245,12 +245,12 @@ void CmdRename(const TDeque<TString> &oldKeys, const TDeque<TString> &newKeys, T } void CmdRename(const TString &oldKey, const TString &newKey, TTestContext &tc, bool expectOk = true) { - TDeque<TString> oldKeys = {oldKey}; - TDeque<TString> newKeys = {newKey}; + TDeque<TString> oldKeys = {oldKey}; + TDeque<TString> newKeys = {newKey}; CmdRename(oldKeys, newKeys, tc, expectOk); } -void CmdConcat(const TDeque<TString> &inputKeys, const TString &outputKey, const bool keepInputs, TTestContext &tc) { +void CmdConcat(const TDeque<TString> &inputKeys, const TString &outputKey, const bool keepInputs, TTestContext &tc) { TAutoPtr<IEventHandle> handle; TEvKeyValue::TEvResponse *result; THolder<TEvKeyValue::TEvRequest> request; @@ -277,7 +277,7 @@ void CmdConcat(const TDeque<TString> &inputKeys, const TString &outputKey, const }); } -void CmdDeleteRange(const TString &from, const bool includeFrom, const TString &to, const bool includeTo, +void CmdDeleteRange(const TString &from, const bool includeFrom, const TString &to, const bool includeTo, TTestContext &tc, ui32 expectedStatus = (ui32)NMsgBusProxy::MSTATUS_OK) { TAutoPtr<IEventHandle> handle; TEvKeyValue::TEvResponse *result; @@ -311,8 +311,8 @@ void CmdDeleteRange(const TString &from, const bool includeFrom, const TString & }); } -void CmdCopyRange(const TString &from, const bool includeFrom, const TString &to, const bool includeTo, - const TString &prefixToAdd, const TString &prefixToRemove, TTestContext &tc) { +void CmdCopyRange(const TString &from, const bool includeFrom, const TString &to, const bool includeTo, + const TString &prefixToAdd, const TString &prefixToRemove, TTestContext &tc) { TAutoPtr<IEventHandle> handle; TEvKeyValue::TEvResponse *result; THolder<TEvKeyValue::TEvRequest> request; @@ -855,7 +855,7 @@ Y_UNIT_TEST(TestWriteReadDeleteWithRestartsThenResponseOk) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); CmdWrite("key", "value", NKikimrClient::TKeyValueRequest::MAIN, @@ -1010,7 +1010,7 @@ Y_UNIT_TEST(TestInlineWriteReadDeleteWithRestartsThenResponseOk) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); CmdWrite("key", "value", NKikimrClient::TKeyValueRequest::INLINE, @@ -1141,11 +1141,11 @@ Y_UNIT_TEST(TestWriteReadWithRestartsThenResponseOk) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); - TDeque<TString> keys; - TDeque<TString> values; + TDeque<TString> keys; + TDeque<TString> values; { TStringStream value; for (ui32 itemIdx = 0; itemIdx <= 4; ++itemIdx) { @@ -1157,8 +1157,8 @@ Y_UNIT_TEST(TestWriteReadWithRestartsThenResponseOk) { CmdWrite(keys, values, NKikimrClient::TKeyValueRequest::EXTRA9, NKikimrClient::TKeyValueRequest::REALTIME, tc); - TDeque<TString> expectedKeys; - TDeque<TString> expectedValues; + TDeque<TString> expectedKeys; + TDeque<TString> expectedValues; for (ui32 itemIdx = 1; itemIdx < 4; ++itemIdx) { expectedKeys.push_back(keys[itemIdx]); expectedValues.push_back(values[itemIdx]); @@ -1220,16 +1220,16 @@ Y_UNIT_TEST(TestInlineWriteReadWithRestartsThenResponseOk) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); - TDeque<TString> keys; - TDeque<TString> values; + TDeque<TString> keys; + TDeque<TString> values; tc.Prepare(dispatchName, setup, activeZone); { TStringStream value; for (ui32 itemIdx = 0; itemIdx <= 4; ++itemIdx) { - TDeque<TString> keys1; - TDeque<TString> values1; + TDeque<TString> keys1; + TDeque<TString> values1; value << "x"; keys1.push_back(Sprintf("key%" PRIu32, itemIdx)); keys.push_back(Sprintf("key%" PRIu32, itemIdx)); @@ -1243,8 +1243,8 @@ Y_UNIT_TEST(TestInlineWriteReadWithRestartsThenResponseOk) { } } - TDeque<TString> expectedKeys; - TDeque<TString> expectedValues; + TDeque<TString> expectedKeys; + TDeque<TString> expectedValues; for (ui32 itemIdx = 1; itemIdx < 4; ++itemIdx) { expectedKeys.push_back(keys[itemIdx]); expectedValues.push_back(values[itemIdx]); @@ -1321,7 +1321,7 @@ Y_UNIT_TEST(TestEmptyWriteReadDeleteWithRestartsThenResponseOk) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); CmdWrite("key", "", NKikimrClient::TKeyValueRequest::MAIN, @@ -1329,8 +1329,8 @@ Y_UNIT_TEST(TestEmptyWriteReadDeleteWithRestartsThenResponseOk) { CmdRead({"key"}, NKikimrClient::TKeyValueRequest::REALTIME, {""}, {}, tc); - TDeque<TString> expectedKeys; - TDeque<TString> expectedValues; + TDeque<TString> expectedKeys; + TDeque<TString> expectedValues; expectedKeys.push_back("key"); expectedValues.push_back(""); { @@ -1370,7 +1370,7 @@ Y_UNIT_TEST(TestInlineEmptyWriteReadDeleteWithRestartsThenResponseOk) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); CmdWrite("key", "", NKikimrClient::TKeyValueRequest::INLINE, @@ -1378,8 +1378,8 @@ Y_UNIT_TEST(TestInlineEmptyWriteReadDeleteWithRestartsThenResponseOk) { CmdRead({"key"}, NKikimrClient::TKeyValueRequest::REALTIME, {""}, {}, tc); - TDeque<TString> expectedKeys; - TDeque<TString> expectedValues; + TDeque<TString> expectedKeys; + TDeque<TString> expectedValues; expectedKeys.push_back("key"); expectedValues.push_back(""); { @@ -1428,7 +1428,7 @@ Y_UNIT_TEST(TestWriteReadRangeLimitThenLimitWorks) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); const ui32 itemCount = 1000; @@ -1526,8 +1526,8 @@ Y_UNIT_TEST(TestWriteReadRangeDataLimitThenLimitWorks) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); const ui32 itemCount = 10000; - TDeque<TString> keys; - TDeque<TString> values; + TDeque<TString> keys; + TDeque<TString> values; for (ui32 itemIdx = 0; itemIdx < itemCount; ++itemIdx) { keys.push_back(Sprintf("k%07" PRIu32, itemIdx)); values.push_back(PrepareData(8, itemIdx)); @@ -1535,8 +1535,8 @@ Y_UNIT_TEST(TestWriteReadRangeDataLimitThenLimitWorks) { CmdWrite(keys, values, NKikimrClient::TKeyValueRequest::MAIN, NKikimrClient::TKeyValueRequest::REALTIME, tc); - TDeque<TString> expectedKeys; - TDeque<TString> expectedValues; + TDeque<TString> expectedKeys; + TDeque<TString> expectedValues; ui64 totalSize = 0; ui64 sizeLimit = 200; for (ui32 itemIdx = 0; itemIdx < itemCount; ++itemIdx) { @@ -1610,12 +1610,12 @@ Y_UNIT_TEST(TestInlineWriteReadRangeLimitThenLimitWorks) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); const ui32 itemCount = 1000; - TDeque<TString> keys; - TDeque<TString> values; + TDeque<TString> keys; + TDeque<TString> values; for (ui32 itemIdx = 0; itemIdx < itemCount; ++itemIdx) { keys.push_back(Sprintf("k%07" PRIu32, itemIdx)); values.push_back(PrepareData(8, itemIdx)); @@ -1623,8 +1623,8 @@ Y_UNIT_TEST(TestInlineWriteReadRangeLimitThenLimitWorks) { CmdWrite(keys, values, NKikimrClient::TKeyValueRequest::INLINE, NKikimrClient::TKeyValueRequest::REALTIME, tc); - TDeque<TString> expectedKeys; - TDeque<TString> expectedValues; + TDeque<TString> expectedKeys; + TDeque<TString> expectedValues; ui64 totalSize = 0; ui64 sizeLimit = 200; for (ui32 itemIdx = 0; itemIdx < itemCount; ++itemIdx) { @@ -1664,12 +1664,12 @@ Y_UNIT_TEST(TestCopyRangeWorks) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); const ui32 itemCount = 100; - TDeque<TString> keys; - TDeque<TString> values; + TDeque<TString> keys; + TDeque<TString> values; for (ui32 itemIdx = 0; itemIdx < itemCount; ++itemIdx) { keys.push_back(Sprintf("k%07" PRIu32, itemIdx)); values.push_back(Sprintf("v%07" PRIu32, (ui32)itemIdx)); @@ -1681,8 +1681,8 @@ Y_UNIT_TEST(TestCopyRangeWorks) { CmdWrite("0", "0", NKikimrClient::TKeyValueRequest::MAIN, NKikimrClient::TKeyValueRequest::REALTIME, tc); - TDeque<TString> expectedKeys; - TDeque<TString> expectedValues; + TDeque<TString> expectedKeys; + TDeque<TString> expectedValues; for (ui32 itemIdx = 0; itemIdx < itemCount; ++itemIdx) { expectedKeys.push_back(Sprintf("pk%07" PRIu32, itemIdx)); expectedValues.push_back(Sprintf("v%07" PRIu32, (ui32)itemIdx)); @@ -1734,13 +1734,13 @@ Y_UNIT_TEST(TestInlineCopyRangeWorks) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); const ui32 itemCount = 100; for (ui32 itemIdx = 0; itemIdx < itemCount; ) { - TDeque<TString> keys; - TDeque<TString> values; + TDeque<TString> keys; + TDeque<TString> values; ui32 endItemIdx = Min(itemCount, itemIdx + 20); for (; itemIdx < endItemIdx; ++itemIdx) { keys.push_back(Sprintf("k%07" PRIu32, itemIdx)); @@ -1757,8 +1757,8 @@ Y_UNIT_TEST(TestInlineCopyRangeWorks) { CmdWrite("0", "0", NKikimrClient::TKeyValueRequest::INLINE, NKikimrClient::TKeyValueRequest::REALTIME, tc); - TDeque<TString> expectedKeys; - TDeque<TString> expectedValues; + TDeque<TString> expectedKeys; + TDeque<TString> expectedValues; for (ui32 itemIdx = 0; itemIdx < itemCount; ++itemIdx) { expectedKeys.push_back(Sprintf("pk%07" PRIu32, itemIdx)); expectedValues.push_back(Sprintf("v%07" PRIu32, (ui32)itemIdx)); @@ -1780,7 +1780,7 @@ Y_UNIT_TEST(TestConcatWorks) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); CmdWrite({"1", "2", "3", "4"}, {"hello", ", ", "world", "!"}, NKikimrClient::TKeyValueRequest::MAIN, @@ -1830,7 +1830,7 @@ Y_UNIT_TEST(TestRenameWorks) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); CmdWrite({"1", "2", "3", "4"}, {"123", "456", "789", "012"}, NKikimrClient::TKeyValueRequest::MAIN, @@ -1872,7 +1872,7 @@ Y_UNIT_TEST(TestWriteToExtraChannelThenReadMixedChannelsReturnsOk) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); CmdWrite("key1", "value1", NKikimrClient::TKeyValueRequest::MAIN, @@ -1912,14 +1912,14 @@ Y_UNIT_TEST(TestWriteToExtraChannelThenReadMixedChannelsReturnsOkNewApi) { Y_UNIT_TEST(TestIncrementalKeySet) { // generate initial key set - TSet<TString> keys; + TSet<TString> keys; for (ui32 i = 0; i < 100; ++i) { keys.insert(Sprintf("%04d", i)); } // fill index to match those keys - TMap<TString, NKeyValue::TIndexRecord> index; - for (const TString& key : keys) { + TMap<TString, NKeyValue::TIndexRecord> index; + for (const TString& key : keys) { index[key]; } @@ -1939,7 +1939,7 @@ Y_UNIT_TEST(TestIncrementalKeySet) { UNIT_ASSERT_EQUAL(iiter, incr.end()); // find - for (const TString& key : keys) { + for (const TString& key : keys) { auto iiter = incr.find(key); UNIT_ASSERT_UNEQUAL(iiter, incr.end()); UNIT_ASSERT_VALUES_EQUAL(key, *iiter); @@ -1947,7 +1947,7 @@ Y_UNIT_TEST(TestIncrementalKeySet) { // lower_bound for (ui32 i = 0; i < 150; ++i) { - TString key = Sprintf("%04d", i); + TString key = Sprintf("%04d", i); auto iter = keys.lower_bound(key); auto iiter = incr.lower_bound(key); if (iter == keys.end()) { @@ -1959,7 +1959,7 @@ Y_UNIT_TEST(TestIncrementalKeySet) { // same for upper_bound for (ui32 i = 0; i < 150; ++i) { - TString key = Sprintf("%04d", i); + TString key = Sprintf("%04d", i); auto iter = keys.upper_bound(key); auto iiter = incr.upper_bound(key); if (iter == keys.end()) { @@ -1972,9 +1972,9 @@ Y_UNIT_TEST(TestIncrementalKeySet) { if (!keys.empty() && rng() % 2 == 1) { // generate delete command ui32 index = rng() % keys.size(); - TSet<TString>::iterator iter = keys.begin(); + TSet<TString>::iterator iter = keys.begin(); std::advance(iter, index); - TString key = *iter; + TString key = *iter; auto iiter = incr.find(key); UNIT_ASSERT_UNEQUAL(iiter, incr.end()); UNIT_ASSERT_VALUES_EQUAL(*iiter, key); @@ -1982,7 +1982,7 @@ Y_UNIT_TEST(TestIncrementalKeySet) { incr.erase(iiter); } else { // generate insert command - TString key = Sprintf("%04d", rng() % 150); + TString key = Sprintf("%04d", rng() % 150); keys.insert(key); incr.insert(key); } @@ -1993,7 +1993,7 @@ Y_UNIT_TEST(TestGetStatusWorks) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); CmdGetStatus(NKikimrClient::TKeyValueRequest::MAIN, diff --git a/ydb/core/kqp/counters/kqp_counters.h b/ydb/core/kqp/counters/kqp_counters.h index 53a8f7d2c23..4dac9225f8e 100644 --- a/ydb/core/kqp/counters/kqp_counters.h +++ b/ydb/core/kqp/counters/kqp_counters.h @@ -100,7 +100,7 @@ protected: NMonitoring::TDynamicCounterPtr QueryReplayGroup; // Requests - THashMap<NKikimrKqp::EQueryAction, NMonitoring::TDynamicCounters::TCounterPtr> QueryActionRequests; + THashMap<NKikimrKqp::EQueryAction, NMonitoring::TDynamicCounters::TCounterPtr> QueryActionRequests; NMonitoring::TDynamicCounters::TCounterPtr OtherQueryRequests; NMonitoring::TDynamicCounters::TCounterPtr CloseSessionRequests; NMonitoring::TDynamicCounters::TCounterPtr CreateSessionRequests; diff --git a/ydb/core/kqp/host/kqp_host.cpp b/ydb/core/kqp/host/kqp_host.cpp index 44af6d11682..50434cdfb57 100644 --- a/ydb/core/kqp/host/kqp_host.cpp +++ b/ydb/core/kqp/host/kqp_host.cpp @@ -77,7 +77,7 @@ public: private: bool Discard = false; - TString Result; + TString Result; }; struct TExecuteContext : TThrRefBase { @@ -267,7 +267,7 @@ public: if (result.GetRowsLimit()) { fillSettings.RowsLimitPerWrite = result.GetRowsLimit(); } - TVector<TString> columnHints(result.GetColumnHints().begin(), result.GetColumnHints().end()); + TVector<TString> columnHints(result.GetColumnHints().begin(), result.GetColumnHints().end()); auto protoResult = KikimrResultToProto(*resultValue, columnHints, fillSettings, queryResult.ProtobufArenaPtr.get()); @@ -1011,7 +1011,7 @@ public: , ModuleResolver(moduleResolver) , KeepConfigChanges(keepConfigChanges) , SessionCtx(new TKikimrSessionContext(config)) - , ClustersMap({{Cluster, TString(KikimrProviderName)}}) + , ClustersMap({{Cluster, TString(KikimrProviderName)}}) , TypesCtx(MakeIntrusive<TTypeAnnotationContext>()) , PlanBuilder(CreatePlanBuilder(*TypesCtx)) , FakeWorld(ExprCtx->NewWorld(TPosition())) @@ -1060,7 +1060,7 @@ public: FillSettings.FormatDetails, writerFactory); auto resultProvider = CreateResultProvider(ResultProviderConfig); TypesCtx->AddDataSink(ResultProviderName, resultProvider); - TypesCtx->AvailablePureResultDataSources = TVector<TString>(1, TString(KikimrProviderName)); + TypesCtx->AvailablePureResultDataSources = TVector<TString>(1, TString(KikimrProviderName)); // Config provider const TGatewaysConfig* gatewaysConfig = nullptr; // TODO: can we get real gatewaysConfig here? @@ -2173,13 +2173,13 @@ private: private: TIntrusivePtr<IKqpGateway> Gateway; - TString Cluster; + TString Cluster; THolder<TExprContext> ExprCtx; IModuleResolver::TPtr ModuleResolver; bool KeepConfigChanges; TIntrusivePtr<TKikimrSessionContext> SessionCtx; - THashMap<TString, TString> ClustersMap; + THashMap<TString, TString> ClustersMap; TIntrusivePtr<NKikimr::NMiniKQL::IFunctionRegistry> FuncRegistryHolder; const NKikimr::NMiniKQL::IFunctionRegistry* FuncRegistry; diff --git a/ydb/core/kqp/host/kqp_run_prepared.cpp b/ydb/core/kqp/host/kqp_run_prepared.cpp index e71a3bacee2..337869e7097 100644 --- a/ydb/core/kqp/host/kqp_run_prepared.cpp +++ b/ydb/core/kqp/host/kqp_run_prepared.cpp @@ -122,7 +122,7 @@ private: YQL_CLOG(DEBUG, ProviderKqp) << "Mkql:" << Endl << mkqlText; } - TVector<NKikimrKqp::TParameterBinding> bindings(mkql.GetBindings().begin(), mkql.GetBindings().end()); + TVector<NKikimrKqp::TParameterBinding> bindings(mkql.GetBindings().begin(), mkql.GetBindings().end()); auto execParams = BuildParamsMap(bindings, TxState, TransformCtx, AcquireLocks); if (YQL_CLOG_ACTIVE(TRACE, ProviderKqp)) { diff --git a/ydb/core/kqp/host/kqp_runner.cpp b/ydb/core/kqp/host/kqp_runner.cpp index 42b4eca7c66..f39bf50e15f 100644 --- a/ydb/core/kqp/host/kqp_runner.cpp +++ b/ydb/core/kqp/host/kqp_runner.cpp @@ -617,7 +617,7 @@ private: private: TIntrusivePtr<IKqpGateway> Gateway; - TString Cluster; + TString Cluster; TTypeAnnotationContext& TypesCtx; const NMiniKQL::IFunctionRegistry& FuncRegistry; TKikimrConfiguration::TPtr Config; diff --git a/ydb/core/kqp/kqp_ic_gateway.cpp b/ydb/core/kqp/kqp_ic_gateway.cpp index 47489a9bd54..ddcfb555db9 100644 --- a/ydb/core/kqp/kqp_ic_gateway.cpp +++ b/ydb/core/kqp/kqp_ic_gateway.cpp @@ -651,8 +651,8 @@ private: TKqpParamsMap ParamsMap; bool CompilationPending; bool CompilationRetried; - TString MkqlProgramText; - THashMap<TString, ui64> CompileResolveCookies; + TString MkqlProgramText; + THashMap<TString, ui64> CompileResolveCookies; TAlignedPagePoolCounters AllocCounters; TActorId MiniKqlComplileServiceActorId; }; @@ -935,7 +935,7 @@ private: }; template<typename TResult> -TFuture<TResult> InvalidCluster(const TString& cluster) { +TFuture<TResult> InvalidCluster(const TString& cluster) { return MakeFuture(ResultFromError<TResult>("Invalid cluster:" + cluster)); } @@ -998,7 +998,7 @@ public: return cluster == Cluster; } - TVector<TString> GetClusters() override { + TVector<TString> GetClusters() override { return {Cluster}; } @@ -1011,7 +1011,7 @@ public: return {}; } - TMaybe<TString> GetSetting(const TString& cluster, const TString& name) override { + TMaybe<TString> GetSetting(const TString& cluster, const TString& name) override { Y_UNUSED(cluster); Y_UNUSED(name); return {}; @@ -1032,7 +1032,7 @@ public: return UserToken ? UserToken->Serialized : TString(); } - TFuture<TListPathResult> ListPath(const TString& cluster, const TString &path) override { + TFuture<TListPathResult> ListPath(const TString& cluster, const TString &path) override { using TRequest = TEvTxUserProxy::TEvNavigate; try { @@ -1265,7 +1265,7 @@ public: } } - TFuture<TGenericResult> DropTable(const TString& cluster, const TString& table) override { + TFuture<TGenericResult> DropTable(const TString& cluster, const TString& table) override { try { if (!CheckCluster(cluster)) { return InvalidCluster<TGenericResult>(cluster); @@ -2031,7 +2031,7 @@ private: }); } - bool CheckCluster(const TString& cluster) { + bool CheckCluster(const TString& cluster) { return cluster == Cluster; } diff --git a/ydb/core/kqp/prepare/kqp_query_analyze.cpp b/ydb/core/kqp/prepare/kqp_query_analyze.cpp index b37e4eb0582..5ecb205ae60 100644 --- a/ydb/core/kqp/prepare/kqp_query_analyze.cpp +++ b/ydb/core/kqp/prepare/kqp_query_analyze.cpp @@ -460,7 +460,7 @@ void AnalyzeNodes(const TVector<TExprBase>& nodes, TAnalyzeTxContext& ctx) { bool Analyze(const TExprNode::TPtr& exprRoot, TKqpAnalyzeResults& results, ECommitSafety commitSafety) { TAnalyzeTxContext analyzeCtx; - TVector<TExprBase> nodes; + TVector<TExprBase> nodes; GatherNodeScopes(TExprBase(exprRoot), analyzeCtx); diff --git a/ydb/core/kqp/prepare/kqp_query_exec.cpp b/ydb/core/kqp/prepare/kqp_query_exec.cpp index bc2d4e94ce9..a4bcf7ce337 100644 --- a/ydb/core/kqp/prepare/kqp_query_exec.cpp +++ b/ydb/core/kqp/prepare/kqp_query_exec.cpp @@ -244,7 +244,7 @@ public: const auto& analyzeResults = TransformCtx->AnalyzeResults; - TVector<TExprBase> results; + TVector<TExprBase> results; for (auto& root : analyzeResults.ExecutionRoots) { if (root.Scope) { ctx.AddError(TIssue(ctx.GetPosition(root.Node.Pos()), TStringBuilder() @@ -377,7 +377,7 @@ public: private: TIntrusivePtr<IKqpGateway> Gateway; - TString Cluster; + TString Cluster; TIntrusivePtr<TKqpTransactionState> TxState; TIntrusivePtr<TKqlTransformContext> TransformCtx; TMkqlExecuteResult MkqlExecuteResult; @@ -795,8 +795,8 @@ void LogMkqlResult(const NKikimrMiniKQL::TResult& result, TExprContext& ctx) { Y_UNUSED(ctx); if (YQL_CLOG_ACTIVE(TRACE, ProviderKqp)) { - TString resultType; - TString resultValue; + TString resultType; + TString resultValue; NProtoBuf::TextFormat::PrintToString(result.GetType(), &resultType); NProtoBuf::TextFormat::PrintToString(result.GetValue(), &resultValue); diff --git a/ydb/core/kqp/prepare/kqp_query_finalize.cpp b/ydb/core/kqp/prepare/kqp_query_finalize.cpp index 5e442780f7a..1697082dc33 100644 --- a/ydb/core/kqp/prepare/kqp_query_finalize.cpp +++ b/ydb/core/kqp/prepare/kqp_query_finalize.cpp @@ -91,7 +91,7 @@ TExprBase GetEraseLocksEffects(const TString& cluster, TPositionHandle pos, TCoP const TTypeAnnotationNode* GetTxLockListType(TExprContext& ctx) { auto ui32Type = ctx.MakeType<TDataExprType>(EDataSlot::Uint32); auto ui64Type = ctx.MakeType<TDataExprType>(EDataSlot::Uint64); - TVector<const TItemExprType*> lockItems; + TVector<const TItemExprType*> lockItems; lockItems.reserve(6); lockItems.push_back(ctx.MakeType<TItemExprType>("LockId", ui64Type)); lockItems.push_back(ctx.MakeType<TItemExprType>("DataShard", ui64Type)); @@ -592,7 +592,7 @@ private: private: TIntrusivePtr<IKqpGateway> Gateway; - TString Cluster; + TString Cluster; TIntrusivePtr<TKqpTransactionState> TxState; TIntrusivePtr<TKqlTransformContext> TransformCtx; EFinalizeState State; diff --git a/ydb/core/kqp/prepare/kqp_query_rewrite.cpp b/ydb/core/kqp/prepare/kqp_query_rewrite.cpp index cb24a1b8a1d..c38d4bf6344 100644 --- a/ydb/core/kqp/prepare/kqp_query_rewrite.cpp +++ b/ydb/core/kqp/prepare/kqp_query_rewrite.cpp @@ -138,7 +138,7 @@ TExprBase SplitMap(TExprBase input, TCoLambda lambda, TExprContext& ctx, const T return true; }; - THashSet<const TExprNode*> innerNodes; + THashSet<const TExprNode*> innerNodes; innerNodes.insert(lambda.Args().Arg(0).Raw()); VisitExpr(exprRootsTuple.Ptr(), [&innerNodes, &isSameScope, &analyzeResults] (const TExprNode::TPtr& node) { @@ -155,7 +155,7 @@ TExprBase SplitMap(TExprBase input, TCoLambda lambda, TExprContext& ctx, const T return true; }); - THashMap<const TExprNode*, TExprBase> jointsMap; + THashMap<const TExprNode*, TExprBase> jointsMap; for (TExprBase root : execRoots) { jointsMap.insert(std::make_pair(root.Raw(), root)); } @@ -201,7 +201,7 @@ TExprBase SplitMap(TExprBase input, TCoLambda lambda, TExprContext& ctx, const T return true; }); - TVector<TExprBase> jointNodes; + TVector<TExprBase> jointNodes; jointNodes.reserve(jointsMap.size()); for (auto& pair : jointsMap) { jointNodes.push_back(pair.second); @@ -248,7 +248,7 @@ TExprBase SplitMap(TExprBase input, TCoLambda lambda, TExprContext& ctx, const T .Done(); } -TExprNode::TPtr SplitMap(TExprBase mapNode, TExprContext& ctx, const TVector<TExprBase>& execRoots, +TExprNode::TPtr SplitMap(TExprBase mapNode, TExprContext& ctx, const TVector<TExprBase>& execRoots, const TKqpAnalyzeResults& analyzeResults) { YQL_ENSURE(mapNode.Ptr()->GetTypeAnn()->GetKind() == ETypeAnnotationKind::List); diff --git a/ydb/core/kqp/provider/yql_kikimr_datasink.cpp b/ydb/core/kqp/provider/yql_kikimr_datasink.cpp index 035d6b77012..46515522a3c 100644 --- a/ydb/core/kqp/provider/yql_kikimr_datasink.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_datasink.cpp @@ -651,7 +651,7 @@ public: return nullptr; } - bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override { + bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override { Y_UNUSED(compact); if (CanExecute(node)) { children.push_back(node.ChildPtr(0)); @@ -671,7 +671,7 @@ public: } TString GetProviderPath(const TExprNode&) override { - return TString(KikimrProviderName); + return TString(KikimrProviderName); } private: diff --git a/ydb/core/kqp/provider/yql_kikimr_datasource.cpp b/ydb/core/kqp/provider/yql_kikimr_datasource.cpp index 65ef7eb932a..5bdb78212dc 100644 --- a/ydb/core/kqp/provider/yql_kikimr_datasource.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_datasource.cpp @@ -98,8 +98,8 @@ public: futures.reserve(tablesCount); for (auto& it : SessionCtx->Tables().GetTables()) { - const TString& clusterName = it.first.first; - const TString& tableName = it.first.second; + const TString& clusterName = it.first.first; + const TString& tableName = it.first.second; TKikimrTableDescription& table = SessionCtx->Tables().GetTable(clusterName, tableName); if (table.Metadata) { @@ -452,7 +452,7 @@ public: return nullptr; } - TString newName; + TString newName; switch (key.GetKeyType()) { case TKikimrKey::Type::Table: newName = TKiReadTable::CallableName(); @@ -567,7 +567,7 @@ public: return source; } - bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override { + bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override { Y_UNUSED(compact); if (CanExecute(node)) { children.push_back(node.ChildPtr(0)); @@ -577,10 +577,10 @@ public: return false; } - TString GetProviderPath(const TExprNode& node) override { + TString GetProviderPath(const TExprNode& node) override { Y_UNUSED(node); - return TString(KikimrProviderName); + return TString(KikimrProviderName); } private: diff --git a/ydb/core/kqp/provider/yql_kikimr_exec.cpp b/ydb/core/kqp/provider/yql_kikimr_exec.cpp index ad360fcaebe..934ff742685 100644 --- a/ydb/core/kqp/provider/yql_kikimr_exec.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_exec.cpp @@ -323,7 +323,7 @@ private: static TExprNode::TPtr GetResOrPullResult(const TExprNode& node, const IDataProvider::TFillSettings& fillSettings, const TTypeAnnotationNode* resultType, const NKikimrMiniKQL::TResult& resultValue, TExprContext& ctx) { - TVector<TString> columnHints(NCommon::GetResOrPullColumnHints(node)); + TVector<TString> columnHints(NCommon::GetResOrPullColumnHints(node)); auto protoValue = &resultValue; YQL_ENSURE(resultValue.GetArena()); diff --git a/ydb/core/kqp/provider/yql_kikimr_gateway.cpp b/ydb/core/kqp/provider/yql_kikimr_gateway.cpp index e49f84b5e1e..3092a5a2893 100644 --- a/ydb/core/kqp/provider/yql_kikimr_gateway.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_gateway.cpp @@ -34,13 +34,13 @@ static void CreateDirs(std::shared_ptr<TVector<TString>> partsHolder, size_t ind CreateDirs(partsHolder, index + 1, promise, createDir); }); - TString basePath = IKikimrGateway::CombinePath(parts.begin(), parts.begin() + index); + TString basePath = IKikimrGateway::CombinePath(parts.begin(), parts.begin() + index); createDir(basePath, parts[index], partPromise); } TKikimrClusterMapping::TKikimrClusterMapping(const TKikimrGatewayConfig& config) { - THashMap<TString, TString> defaultSettings; + THashMap<TString, TString> defaultSettings; for (auto& setting : config.GetDefaultSettings()) { defaultSettings[setting.GetName()] = setting.GetValue(); } @@ -71,14 +71,14 @@ TKikimrClusterMapping::TKikimrClusterMapping(const TKikimrGatewayConfig& config) } } -void TKikimrClusterMapping::GetAllClusterNames(TVector<TString>& names) const { +void TKikimrClusterMapping::GetAllClusterNames(TVector<TString>& names) const { names.clear(); for (const auto& c: Clusters) { names.push_back(c.first); } } -const TKikimrClusterConfig& TKikimrClusterMapping::GetClusterConfig(const TString& name) const { +const TKikimrClusterConfig& TKikimrClusterMapping::GetClusterConfig(const TString& name) const { if (const TKikimrClusterConfig* config = Clusters.FindPtr(name)) { return *config; } else { @@ -86,15 +86,15 @@ const TKikimrClusterConfig& TKikimrClusterMapping::GetClusterConfig(const TStrin } } -TMaybe<TString> TKikimrClusterMapping::GetClusterSetting(const TString& cluster, const TString& name) const { +TMaybe<TString> TKikimrClusterMapping::GetClusterSetting(const TString& cluster, const TString& name) const { auto clusterSettings = ClusterSettings.FindPtr(cluster); YQL_ENSURE(clusterSettings); auto setting = clusterSettings->FindPtr(name); - return setting ? *setting : TMaybe<TString>(); + return setting ? *setting : TMaybe<TString>(); } -TString TKikimrClusterMapping::GetDefaultClusterName() const { +TString TKikimrClusterMapping::GetDefaultClusterName() const { if (!DefaultClusterName) { ythrow yexception() << "TKikimrGatewayConfig: No default cluster"; } @@ -114,7 +114,7 @@ TKikimrPathId TKikimrPathId::Parse(const TStringBuf& str) { return TKikimrPathId(FromString<ui64>(ownerStr), FromString<ui64>(idStr)); } -TString IKikimrGateway::CanonizePath(const TString& path) { +TString IKikimrGateway::CanonizePath(const TString& path) { if (path.empty()) { return "/"; } @@ -126,8 +126,8 @@ TString IKikimrGateway::CanonizePath(const TString& path) { return path; } -TVector<TString> IKikimrGateway::SplitPath(const TString& path) { - TVector<TString> parts; +TVector<TString> IKikimrGateway::SplitPath(const TString& path) { + TVector<TString> parts; Split(path, "/", parts); return parts; } @@ -147,7 +147,7 @@ bool IKikimrGateway::TrySplitTablePath(const TString& path, std::pair<TString, T return true; } -TFuture<IKikimrGateway::TGenericResult> IKikimrGateway::CreatePath(const TString& path, TCreateDirFunc createDir) { +TFuture<IKikimrGateway::TGenericResult> IKikimrGateway::CreatePath(const TString& path, TCreateDirFunc createDir) { auto partsHolder = std::make_shared<TVector<TString>>(SplitPath(path)); auto &parts = *partsHolder; diff --git a/ydb/core/kqp/provider/yql_kikimr_gateway.h b/ydb/core/kqp/provider/yql_kikimr_gateway.h index 7598494a2b9..8fa9c8d0933 100644 --- a/ydb/core/kqp/provider/yql_kikimr_gateway.h +++ b/ydb/core/kqp/provider/yql_kikimr_gateway.h @@ -19,7 +19,7 @@ #include <util/datetime/base.h> #include <util/generic/flags.h> #include <util/generic/map.h> -#include <util/generic/maybe.h> +#include <util/generic/maybe.h> #include <util/generic/hash.h> #include <util/generic/ptr.h> #include <util/string/join.h> @@ -178,9 +178,9 @@ struct TTableSettings { }; struct TKikimrColumnMetadata { - TString Name; + TString Name; ui32 Id = 0; - TString Type; + TString Type; bool NotNull = false; ui32 TypeId = 0; TVector<TString> Families; @@ -272,8 +272,8 @@ enum class EKikimrTableKind : ui32 { struct TKikimrTableMetadata : public TThrRefBase { bool DoesExist = false; - TString Cluster; - TString Name; + TString Cluster; + TString Name; TKikimrPathId PathId; TString SysView; ui64 SchemaVersion = 0; @@ -288,8 +288,8 @@ struct TKikimrTableMetadata : public TThrRefBase { TInstant LastAccessTime; TInstant LastUpdateTime; - TMap<TString, TKikimrColumnMetadata> Columns; - TVector<TString> KeyColumnNames; + TMap<TString, TKikimrColumnMetadata> Columns; + TVector<TString> KeyColumnNames; TVector<TString> ColumnOrder; // Indexes and SecondaryGlobalIndexMetadata must be in same order @@ -299,7 +299,7 @@ struct TKikimrTableMetadata : public TThrRefBase { TVector<TColumnFamily> ColumnFamilies; TTableSettings TableSettings; - TKikimrTableMetadata(const TString& cluster, const TString& table) + TKikimrTableMetadata(const TString& cluster, const TString& table) : Cluster(cluster) , Name(table) , PathId(std::make_pair(0, 0)) {} @@ -459,12 +459,12 @@ struct TDropGroupSettings { }; struct TKikimrListPathItem { - TKikimrListPathItem(TString name, bool isDirectory) { + TKikimrListPathItem(TString name, bool isDirectory) { Name = name; IsDirectory = isDirectory; } - TString Name; + TString Name; bool IsDirectory; }; @@ -474,16 +474,16 @@ class TKikimrClusterMapping { public: TKikimrClusterMapping(const TKikimrGatewayConfig& config); - void GetAllClusterNames(TVector<TString>& names) const; - const TKikimrClusterConfig& GetClusterConfig(const TString& name) const; - TMaybe<TString> GetClusterSetting(const TString& cluster, const TString& name) const; - TString GetDefaultClusterName() const; + void GetAllClusterNames(TVector<TString>& names) const; + const TKikimrClusterConfig& GetClusterConfig(const TString& name) const; + TMaybe<TString> GetClusterSetting(const TString& cluster, const TString& name) const; + TString GetDefaultClusterName() const; bool HasCluster(const TString& cluster) const; private: - THashMap<TString, TKikimrClusterConfig> Clusters; - THashMap<TString, THashMap<TString, TString>> ClusterSettings; - TString DefaultClusterName; + THashMap<TString, TKikimrClusterConfig> Clusters; + THashMap<TString, THashMap<TString, TString>> ClusterSettings; + TString DefaultClusterName; }; template<typename TResult> @@ -533,8 +533,8 @@ public: }; struct TListPathResult : public TGenericResult { - TString Path; - TVector<TKikimrListPathItem> Items; + TString Path; + TVector<TKikimrListPathItem> Items; }; struct TTableMetadataResult : public TGenericResult { @@ -542,7 +542,7 @@ public: }; struct TQueryResult : public TGenericResult { - TString SessionId; + TString SessionId; TVector<NKikimrMiniKQL::TResult*> Results; TMaybe<NKikimrKqp::TQueryProfile> Profile; // TODO: Deprecate. NKqpProto::TKqpStatsQuery QueryStats; @@ -583,14 +583,14 @@ public: public: virtual bool HasCluster(const TString& cluster) = 0; - virtual TVector<TString> GetClusters() = 0; + virtual TVector<TString> GetClusters() = 0; virtual TString GetDefaultCluster() = 0; virtual TMaybe<TKikimrClusterConfig> GetClusterConfig(const TString& cluster) = 0; - virtual TMaybe<TString> GetSetting(const TString& cluster, const TString& name) = 0; + virtual TMaybe<TString> GetSetting(const TString& cluster, const TString& name) = 0; virtual void SetToken(const TString& cluster, const TString& token) = 0; - virtual NThreading::TFuture<TListPathResult> ListPath(const TString& cluster, const TString& path) = 0; + virtual NThreading::TFuture<TListPathResult> ListPath(const TString& cluster, const TString& path) = 0; virtual NThreading::TFuture<TTableMetadataResult> LoadTableMetadata( const TString& cluster, const TString& table, TLoadTableMetadataSettings settings) = 0; @@ -601,7 +601,7 @@ public: virtual NThreading::TFuture<TGenericResult> RenameTable(const TString& src, const TString& dst, const TString& cluster) = 0; - virtual NThreading::TFuture<TGenericResult> DropTable(const TString& cluster, const TString& table) = 0; + virtual NThreading::TFuture<TGenericResult> DropTable(const TString& cluster, const TString& table) = 0; virtual NThreading::TFuture<TGenericResult> CreateUser(const TString& cluster, const TCreateUserSettings& settings) = 0; @@ -618,9 +618,9 @@ public: virtual TVector<TString> GetCollectedSchemeData() = 0; public: - using TCreateDirFunc = std::function<void(const TString&, const TString&, NThreading::TPromise<TGenericResult>)>; + using TCreateDirFunc = std::function<void(const TString&, const TString&, NThreading::TPromise<TGenericResult>)>; - static TString CanonizePath(const TString& path); + static TString CanonizePath(const TString& path); template <typename TIter> static TString CombinePath(TIter begin, TIter end, bool canonize = true) { @@ -630,11 +630,11 @@ public: : path; } - static TVector<TString> SplitPath(const TString& path); + static TVector<TString> SplitPath(const TString& path); static bool TrySplitTablePath(const TString& path, std::pair<TString, TString>& result, TString& error); - static NThreading::TFuture<TGenericResult> CreatePath(const TString& path, TCreateDirFunc createDir); + static NThreading::TFuture<TGenericResult> CreatePath(const TString& path, TCreateDirFunc createDir); static TString CreateIndexTablePath(const TString& tableName, const TString& indexName); diff --git a/ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp b/ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp index 791a617c083..efadcbf5c5f 100644 --- a/ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp @@ -119,7 +119,7 @@ void TestLoadTableMetadataCommon(TIntrusivePtr<IKikimrGateway> gateway) { } void TestRunSimpleCommon(TIntrusivePtr<IKqpGateway> gateway) { - const TString program(R"( + const TString program(R"( ( (let key '( '('Group (Uint32 '1)) diff --git a/ydb/core/kqp/provider/yql_kikimr_mkql.cpp b/ydb/core/kqp/provider/yql_kikimr_mkql.cpp index 4cd98892e44..272bc356975 100644 --- a/ydb/core/kqp/provider/yql_kikimr_mkql.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_mkql.cpp @@ -37,7 +37,7 @@ TExprNode::TPtr MkqlRewriteCallables(TCallable callable, TExprContext& ctx, cons if (auto maybeSelectRow = callable.Maybe<TKiSelectRow>()) { auto selectRow = maybeSelectRow.Cast(); auto vt = selectRow.Table(); - TExprNode::TListType children = { + TExprNode::TListType children = { BuildMkqlVersionedTable(vt.Path(), vt.SchemaVersion(), vt.PathId(), ctx, selectRow.Pos()), selectRow.Key().Ptr(), selectRow.Select().Ptr() @@ -54,7 +54,7 @@ TExprNode::TPtr MkqlRewriteCallables(TCallable callable, TExprContext& ctx, cons auto selectRange = maybeSelectRange.Cast(); auto vt = selectRange.Table(); - TExprNode::TListType children = { + TExprNode::TListType children = { BuildMkqlVersionedTable(vt.Path(), vt.SchemaVersion(), vt.PathId(), ctx, selectRange.Pos()), selectRange.Range().Ptr(), selectRange.Select().Ptr(), diff --git a/ydb/core/kqp/provider/yql_kikimr_opt.cpp b/ydb/core/kqp/provider/yql_kikimr_opt.cpp index cdbb6e600dd..49952d09417 100644 --- a/ydb/core/kqp/provider/yql_kikimr_opt.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_opt.cpp @@ -138,7 +138,7 @@ TExprNode::TPtr KiRedundantSortByPk(TExprBase node, TExprContext& ctx, auto keySelector = maybeSort ? maybeSort.Cast().KeySelectorLambda() : maybePartialSort.Cast().KeySelectorLambda(); auto read = input; - TMaybe<THashSet<TStringBuf>> passthroughFields; + TMaybe<THashSet<TStringBuf>> passthroughFields; if (maybePartialSort && input.Maybe<TCoFlatMap>()) { auto flatmap = input.Cast<TCoFlatMap>(); diff --git a/ydb/core/kqp/provider/yql_kikimr_provider.cpp b/ydb/core/kqp/provider/yql_kikimr_provider.cpp index 635d1648279..a82f1950e54 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_provider.cpp @@ -18,11 +18,11 @@ const TStringBuf CommitModeRollback = "rollback"; const TStringBuf CommitModeScheme = "scheme"; struct TKikimrData { - THashSet<TStringBuf> DataSourceNames; - THashSet<TStringBuf> DataSinkNames; - THashSet<TStringBuf> KqlNames; + THashSet<TStringBuf> DataSourceNames; + THashSet<TStringBuf> DataSinkNames; + THashSet<TStringBuf> KqlNames; - THashSet<TStringBuf> CommitModes; + THashSet<TStringBuf> CommitModes; THashSet<TStringBuf> SupportedEffects; TYdbOperations SchemeOps; @@ -148,7 +148,7 @@ TKikimrTableDescription& TKikimrTablesData::GetOrAddTable(const TString& cluster return Tables[std::make_pair(cluster, table)]; } -TKikimrTableDescription& TKikimrTablesData::GetTable(const TString& cluster, const TString& table) { +TKikimrTableDescription& TKikimrTablesData::GetTable(const TString& cluster, const TString& table) { auto desc = Tables.FindPtr(std::make_pair(cluster, table)); YQL_ENSURE(desc, "Unexpected empty metadata, cluster '" << cluster << "', table '" << table << "'"); @@ -168,7 +168,7 @@ const TKikimrTableDescription& TKikimrTablesData::ExistingTable(const TStringBuf bool TKikimrTableDescription::Load(TExprContext& ctx, bool withSystemColumns) { ColumnTypes.clear(); - TVector<const TItemExprType*> items; + TVector<const TItemExprType*> items; for (auto pair : Metadata->Columns) { auto& column = pair.second; @@ -208,14 +208,14 @@ bool TKikimrTableDescription::Load(TExprContext& ctx, bool withSystemColumns) { return true; } -TMaybe<ui32> TKikimrTableDescription::GetKeyColumnIndex(const TString& name) const { +TMaybe<ui32> TKikimrTableDescription::GetKeyColumnIndex(const TString& name) const { auto it = std::find(Metadata->KeyColumnNames.begin(), Metadata->KeyColumnNames.end(), name); return it == Metadata->KeyColumnNames.end() ? TMaybe<ui32>() : it - Metadata->KeyColumnNames.begin(); } -const TTypeAnnotationNode* TKikimrTableDescription::GetColumnType(const TString& name) const { +const TTypeAnnotationNode* TKikimrTableDescription::GetColumnType(const TString& name) const { auto* type = ColumnTypes.FindPtr(name); if (!type) { return nullptr; @@ -285,7 +285,7 @@ void TKikimrTableDescription::ToYson(NYson::TYsonWriter& writer) const { writer.OnKeyedItem("Type"); NCommon::WriteTypeToYson(writer, item->GetItemType()); - TMaybe<ui32> keyIndex = GetKeyColumnIndex(TString(name)); + TMaybe<ui32> keyIndex = GetKeyColumnIndex(TString(name)); writer.OnKeyedItem("ClusterSortOrder"); writer.OnBeginList(); @@ -398,7 +398,7 @@ NNodes::TCoAtomList BuildColumnsList( TExprContext& ctx, bool withSystemColumns ) { - TVector<TExprBase> columnsToSelect; + TVector<TExprBase> columnsToSelect; for (const auto& pair : table.Metadata->Columns) { auto atom = Build<TCoAtom>(ctx, pos) .Value(pair.second.Name) @@ -660,15 +660,15 @@ bool TKikimrTransactionContextBase::ApplyTableOperations(const TVector<NKqpProto return true; } -const THashSet<TStringBuf>& KikimrDataSourceFunctions() { +const THashSet<TStringBuf>& KikimrDataSourceFunctions() { return Singleton<TKikimrData>()->DataSourceNames; } -const THashSet<TStringBuf>& KikimrDataSinkFunctions() { +const THashSet<TStringBuf>& KikimrDataSinkFunctions() { return Singleton<TKikimrData>()->DataSinkNames; } -const THashSet<TStringBuf>& KikimrKqlFunctions() { +const THashSet<TStringBuf>& KikimrKqlFunctions() { return Singleton<TKikimrData>()->KqlNames; } @@ -676,7 +676,7 @@ const THashSet<TStringBuf>& KikimrSupportedEffects() { return Singleton<TKikimrData>()->SupportedEffects; } -const THashSet<TStringBuf>& KikimrCommitModes() { +const THashSet<TStringBuf>& KikimrCommitModes() { return Singleton<TKikimrData>()->CommitModes; } diff --git a/ydb/core/kqp/provider/yql_kikimr_provider.h b/ydb/core/kqp/provider/yql_kikimr_provider.h index 6903e6f1932..b3204fce8c8 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider.h +++ b/ydb/core/kqp/provider/yql_kikimr_provider.h @@ -104,9 +104,9 @@ struct TKikimrQueryContext : TThrRefBase { std::shared_ptr<const NKikimrKqp::TPreparedQuery> PreparedQuery; TKikimrParamsMap Parameters; - THashMap<ui64, IKikimrQueryExecutor::TQueryResult> Results; - THashMap<ui64, TIntrusivePtr<IKikimrQueryExecutor::TAsyncQueryResult>> InProgress; - TVector<ui64> ExecutionOrder; + THashMap<ui64, IKikimrQueryExecutor::TQueryResult> Results; + THashMap<ui64, TIntrusivePtr<IKikimrQueryExecutor::TAsyncQueryResult>> InProgress; + TVector<ui64> ExecutionOrder; NActors::TActorId ReplyTarget; TMaybe<NKikimrKqp::TRlPath> RlPath; @@ -190,10 +190,10 @@ public: bool Load(TExprContext& ctx, bool withVirtualColumns = false); void ToYson(NYson::TYsonWriter& writer) const; - TMaybe<ui32> GetKeyColumnIndex(const TString& name) const; - const TTypeAnnotationNode* GetColumnType(const TString& name) const; + TMaybe<ui32> GetKeyColumnIndex(const TString& name) const; + const TTypeAnnotationNode* GetColumnType(const TString& name) const; - const THashMap<TString, const TTypeAnnotationNode*> GetColumnTypesMap() const { return ColumnTypes; } + const THashMap<TString, const TTypeAnnotationNode*> GetColumnTypesMap() const { return ColumnTypes; } bool DoesExist() const; @@ -201,7 +201,7 @@ public: bool GetNeedsStats() const { return NeedsStats; } private: - THashMap<TString, const TTypeAnnotationNode*> ColumnTypes; + THashMap<TString, const TTypeAnnotationNode*> ColumnTypes; bool NeedsStats = false; }; @@ -212,7 +212,7 @@ public: TKikimrTablesData& operator=(const TKikimrTablesData&) = delete; TKikimrTableDescription& GetOrAddTable(const TString& cluster, const TString& database, const TString& table); - TKikimrTableDescription& GetTable(const TString& cluster, const TString& table); + TKikimrTableDescription& GetTable(const TString& cluster, const TString& table); const TKikimrTableDescription* EnsureTableExists(const TString& cluster, const TString& table, TPositionHandle pos, TExprContext& ctx) const; @@ -228,7 +228,7 @@ public: } private: - THashMap<std::pair<TString, TString>, TKikimrTableDescription> Tables; + THashMap<std::pair<TString, TString>, TKikimrTableDescription> Tables; }; enum class TYdbOperation : ui32 { @@ -340,11 +340,11 @@ public: void ClearTx() { TxCtx.Reset(); } void SetTx(TIntrusivePtr<IKikimrTransactionContext>& txCtx) { TxCtx.Reset(txCtx); } - TString GetUserName() const { + TString GetUserName() const { return UserName; } - void SetUserName(const TString& userName) { + void SetUserName(const TString& userName) { UserName = userName; } diff --git a/ydb/core/kqp/provider/yql_kikimr_provider_impl.h b/ydb/core/kqp/provider/yql_kikimr_provider_impl.h index e1aa3cda2b4..c7f360bae5e 100644 --- a/ydb/core/kqp/provider/yql_kikimr_provider_impl.h +++ b/ydb/core/kqp/provider/yql_kikimr_provider_impl.h @@ -66,13 +66,13 @@ public: return *KeyType; } - TString GetTablePath() const { + TString GetTablePath() const { Y_VERIFY_DEBUG(KeyType.Defined()); Y_VERIFY_DEBUG(KeyType == Type::Table || KeyType == Type::TableScheme); return Target; } - TString GetFolderPath() const { + TString GetFolderPath() const { Y_VERIFY_DEBUG(KeyType.Defined()); Y_VERIFY_DEBUG(KeyType == Type::TableList); return Target; @@ -260,12 +260,12 @@ NCommon::TTableLookup::TCompareResult KiTableLookupCompare(NNodes::TExprBase lef NNodes::TKiProgram BuildKiProgram(NNodes::TKiDataQuery query, const TKikimrTablesData& tablesData, TExprContext& ctx, bool withSystemColumns); -const THashSet<TStringBuf>& KikimrDataSourceFunctions(); -const THashSet<TStringBuf>& KikimrDataSinkFunctions(); -const THashSet<TStringBuf>& KikimrKqlFunctions(); +const THashSet<TStringBuf>& KikimrDataSourceFunctions(); +const THashSet<TStringBuf>& KikimrDataSinkFunctions(); +const THashSet<TStringBuf>& KikimrKqlFunctions(); const THashSet<TStringBuf>& KikimrSupportedEffects(); -const THashSet<TStringBuf>& KikimrCommitModes(); +const THashSet<TStringBuf>& KikimrCommitModes(); const TStringBuf& KikimrCommitModeFlush(); const TStringBuf& KikimrCommitModeRollback(); const TStringBuf& KikimrCommitModeScheme(); diff --git a/ydb/core/kqp/provider/yql_kikimr_results.cpp b/ydb/core/kqp/provider/yql_kikimr_results.cpp index 8ec93f416d1..309b4ae58a3 100644 --- a/ydb/core/kqp/provider/yql_kikimr_results.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_results.cpp @@ -27,7 +27,7 @@ bool ResultsOverflow(ui64 rows, ui64 bytes, const IDataProvider::TFillSettings& } void WriteValueToYson(const TStringStream& stream, NCommon::TYsonResultWriter& writer, const NKikimrMiniKQL::TType& type, - const NKikimrMiniKQL::TValue& value, const TVector<TString>* fieldsOrder, + const NKikimrMiniKQL::TValue& value, const TVector<TString>* fieldsOrder, const IDataProvider::TFillSettings& fillSettings, bool& truncated, bool firstLevel = false) { switch (type.GetKind()) { @@ -181,7 +181,7 @@ void WriteValueToYson(const TStringStream& stream, NCommon::TYsonResultWriter& w if (fieldsOrder) { YQL_ENSURE(fieldsOrder->size() == structType.MemberSize()); - TMap<TString, size_t> memberIndices; + TMap<TString, size_t> memberIndices; for (size_t i = 0; i < structType.MemberSize(); ++i) { memberIndices[structType.GetMember(i).GetName()] = i; } @@ -348,7 +348,7 @@ TVector<NKikimrMiniKQL::TResult*> UnpackKikimrRunResult(const NKikimrMiniKQL::TR } void KikimrResultToYson(const TStringStream& stream, NYson::TYsonWriter& writer, const NKikimrMiniKQL::TResult& result, - const TVector<TString>& columnHints, const IDataProvider::TFillSettings& fillSettings, bool& truncated) + const TVector<TString>& columnHints, const IDataProvider::TFillSettings& fillSettings, bool& truncated) { truncated = false; NCommon::TYsonResultWriter resultWriter(writer); @@ -392,7 +392,7 @@ NKikimrMiniKQL::TResult* KikimrResultToProto(const NKikimrMiniKQL::TResult& resu if (result.GetType().GetKind() == NKikimrMiniKQL::ETypeKind::List) { const auto& itemType = result.GetType().GetList().GetItem(); - TMap<TString, size_t> memberIndices; + TMap<TString, size_t> memberIndices; if (itemType.GetKind() == NKikimrMiniKQL::ETypeKind::Struct && !columnHints.empty()) { const auto& structType = itemType.GetStruct(); @@ -480,7 +480,7 @@ const TTypeAnnotationNode* ParseTypeFromKikimrProto(const NKikimrMiniKQL::TType& } case NKikimrMiniKQL::ETypeKind::Tuple: { - TTypeAnnotationNode::TListType tupleItems; + TTypeAnnotationNode::TListType tupleItems; for (auto& element : type.GetTuple().GetElement()) { auto elementType = ParseTypeFromKikimrProto(element, ctx); @@ -504,7 +504,7 @@ const TTypeAnnotationNode* ParseTypeFromKikimrProto(const NKikimrMiniKQL::TType& } case NKikimrMiniKQL::ETypeKind::Struct: { - TVector<const TItemExprType*> structMembers; + TVector<const TItemExprType*> structMembers; for (auto& member : type.GetStruct().GetMember()) { auto memberType = ParseTypeFromKikimrProto(member.GetType(), ctx); if (!memberType) { @@ -677,7 +677,7 @@ TExprNode::TPtr ParseKikimrProtoValue(const NKikimrMiniKQL::TType& type, const N return nullptr; } - TExprNode::TListType itemNodes; + TExprNode::TListType itemNodes; for (ui32 i = 0; i < tupleType.ElementSize(); ++i) { const auto& itemType = tupleType.GetElement(i); auto itemNode = ParseKikimrProtoValue(itemType, value.GetTuple(i), pos, ctx); @@ -698,7 +698,7 @@ TExprNode::TPtr ParseKikimrProtoValue(const NKikimrMiniKQL::TType& type, const N return nullptr; } - TExprNode::TListType itemNodes; + TExprNode::TListType itemNodes; for (ui32 i = 0; i < value.ListSize(); ++i) { auto itemNode = ParseKikimrProtoValue(itemType, value.GetList(i), pos, ctx); if (!itemNode) { @@ -721,7 +721,7 @@ TExprNode::TPtr ParseKikimrProtoValue(const NKikimrMiniKQL::TType& type, const N return nullptr; } - TExprNode::TListType structMembers; + TExprNode::TListType structMembers; for (ui32 i = 0; i < structType.MemberSize(); ++i) { const auto& member = structType.GetMember(i); @@ -743,7 +743,7 @@ TExprNode::TPtr ParseKikimrProtoValue(const NKikimrMiniKQL::TType& type, const N case NKikimrMiniKQL::ETypeKind::Dict: { const auto& dictType = type.GetDict(); - TExprNode::TListType dictPairs; + TExprNode::TListType dictPairs; for (ui32 i = 0; i < value.DictSize(); ++i) { auto keyNode = ParseKikimrProtoValue(dictType.GetKey(), value.GetDict(i).GetKey(), pos, ctx); if (!keyNode) { @@ -814,7 +814,7 @@ TMaybe<TString> KqpResultToYson(const NKikimrMiniKQL::TResult& kqpResult, const writer.OnBeginMap(); writer.OnKeyedItem("Type"); - TVector<TString> columns; + TVector<TString> columns; if (dataResult.GetType().GetKind() == NKikimrMiniKQL::ETypeKind::List) { const auto& itemType = dataResult.GetType().GetList().GetItem(); if (itemType.GetKind() == NKikimrMiniKQL::ETypeKind::Struct) { diff --git a/ydb/core/kqp/provider/yql_kikimr_results.h b/ydb/core/kqp/provider/yql_kikimr_results.h index c3460f8a07d..73afe4ba3ca 100644 --- a/ydb/core/kqp/provider/yql_kikimr_results.h +++ b/ydb/core/kqp/provider/yql_kikimr_results.h @@ -13,7 +13,7 @@ void GetKikimrUnpackedRunResult(const NKikimrMiniKQL::TResult& runResult, ui32 i TVector<NKikimrMiniKQL::TResult*> UnpackKikimrRunResult(const NKikimrMiniKQL::TResult& runResult, google::protobuf::Arena* arena); void KikimrResultToYson(const TStringStream& stream, NYson::TYsonWriter& writer, const NKikimrMiniKQL::TResult& result, - const TVector<TString>& columnHints, const IDataProvider::TFillSettings& fillSettings, bool& truncated); + const TVector<TString>& columnHints, const IDataProvider::TFillSettings& fillSettings, bool& truncated); NKikimrMiniKQL::TResult* KikimrResultToProto(const NKikimrMiniKQL::TResult& result, const TVector<TString>& columnHints, const IDataProvider::TFillSettings& fillSettings, google::protobuf::Arena* arena); diff --git a/ydb/core/kqp/provider/yql_kikimr_settings.h b/ydb/core/kqp/provider/yql_kikimr_settings.h index 530cfb28558..16ab38d6776 100644 --- a/ydb/core/kqp/provider/yql_kikimr_settings.h +++ b/ydb/core/kqp/provider/yql_kikimr_settings.h @@ -108,7 +108,7 @@ struct TKikimrConfiguration : public TKikimrSettings, public NCommon::TSettingDi void Init(const TProtoConfig& config) { TMaybe<TString> defaultCluster; - TVector<TString> clusters(Reserve(config.ClusterMappingSize())); + TVector<TString> clusters(Reserve(config.ClusterMappingSize())); for (auto& cluster: config.GetClusterMapping()) { clusters.push_back(cluster.GetName()); if (cluster.HasDefault() && cluster.GetDefault()) { @@ -134,7 +134,7 @@ struct TKikimrConfiguration : public TKikimrSettings, public NCommon::TSettingDi void Init(const TDefultSettingsContainer& defaultSettings, const TString& cluster, const TSettingsContainer& settings, bool freezeDefaults) { - this->SetValidClusters(TVector<TString>{cluster}); + this->SetValidClusters(TVector<TString>{cluster}); this->Dispatch(NCommon::ALL_CLUSTERS, "_DefaultCluster", cluster, EStage::CONFIG); this->Dispatch(defaultSettings); diff --git a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp index 692165204ae..634f2642757 100644 --- a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp @@ -16,9 +16,9 @@ using namespace NNodes; const TString DocApiTableVersionAttribute = "__document_api_version"; const TTypeAnnotationNode* GetExpectedRowType(const TKikimrTableDescription& tableDesc, - const TVector<TString>& columns, const TPosition& pos, TExprContext& ctx) + const TVector<TString>& columns, const TPosition& pos, TExprContext& ctx) { - TVector<const TItemExprType*> expectedRowTypeItems; + TVector<const TItemExprType*> expectedRowTypeItems; for (auto& column : columns) { auto columnType = tableDesc.GetColumnType(column); @@ -39,7 +39,7 @@ const TTypeAnnotationNode* GetExpectedRowType(const TKikimrTableDescription& tab const TTypeAnnotationNode* GetExpectedRowType(const TKikimrTableDescription& tableDesc, const TStructExprType& structType, const TPosition& pos, TExprContext& ctx) { - TVector<TString> columns; + TVector<TString> columns; for (auto& item : structType.GetItems()) { columns.push_back(TString(item->GetName())); } @@ -105,7 +105,7 @@ public: private: TStatus HandleKiRead(TKiReadBase node, TExprContext& ctx) override { - auto cluster = TString(node.DataSource().Cluster()); + auto cluster = TString(node.DataSource().Cluster()); TKikimrKey key(ctx); if (!key.Extract(node.TableKey().Ref())) { @@ -143,7 +143,7 @@ private: } if (HasSetting(readTable.Settings().Ref(), "unwrap_values")) { - TVector<const TItemExprType*> unwrappedItems; + TVector<const TItemExprType*> unwrappedItems; for (auto* item : selectType->Cast<TStructExprType>()->GetItems()) { auto unwrappedType = item->GetItemType()->Cast<TOptionalExprType>()->GetItemType(); auto newItemType = ctx.MakeType<TItemExprType>(item->GetName(), unwrappedType); @@ -157,7 +157,7 @@ private: auto listSelectType = ctx.MakeType<TListExprType>(selectType); - TTypeAnnotationNode::TListType children; + TTypeAnnotationNode::TListType children; children.push_back(node.World().Ref().GetTypeAnn()); children.push_back(listSelectType); auto tupleAnn = ctx.MakeType<TTupleExprType>(children); @@ -170,7 +170,7 @@ private: case TKikimrKey::Type::TableList: { auto tableListAnnotation = BuildCommonTableListType(ctx); - TTypeAnnotationNode::TListType children; + TTypeAnnotationNode::TListType children; children.push_back(node.World().Ref().GetTypeAnn()); children.push_back(tableListAnnotation); node.Ptr()->SetTypeAnn(ctx.MakeType<TTupleExprType>(children)); @@ -184,7 +184,7 @@ private: return TStatus::Error; } - TTypeAnnotationNode::TListType children; + TTypeAnnotationNode::TListType children; children.push_back(node.World().Ref().GetTypeAnn()); children.push_back(ctx.MakeType<TDataExprType>(EDataSlot::Yson)); node.Ptr()->SetTypeAnn(ctx.MakeType<TTupleExprType>(children)); @@ -306,7 +306,7 @@ private: if (auto maybeTuple = node.Input().Maybe<TExprList>()) { auto tuple = maybeTuple.Cast(); - TVector<TExprBase> convertedValues; + TVector<TExprBase> convertedValues; for (const auto& value : tuple) { auto valueType = value.Ref().GetTypeAnn(); if (valueType->GetKind() != ETypeAnnotationKind::Struct) { @@ -402,7 +402,7 @@ private: auto inputColumns = GetSetting(node.Settings().Ref(), "input_columns"); if (!inputColumns) { - TExprNode::TListType columns; + TExprNode::TListType columns; for (auto& item : rowType->GetItems()) { columns.push_back(ctx.NewAtom(node.Pos(), item->GetName())); } @@ -479,7 +479,7 @@ private: for (auto& item : updateResultType->GetItems()) { const auto& name = item->GetName(); - if (table->GetKeyColumnIndex(TString(name))) { + if (table->GetKeyColumnIndex(TString(name))) { ctx.AddError(TIssue(ctx.GetPosition(node.Pos()), TStringBuilder() << "Cannot update primary key column: " << name)); return IGraphTransformer::TStatus::Error; @@ -551,8 +551,8 @@ private: } virtual TStatus HandleCreateTable(TKiCreateTable create, TExprContext& ctx) override { - TString cluster = TString(create.DataSink().Cluster()); - TString table = TString(create.Table()); + TString cluster = TString(create.DataSink().Cluster()); + TString table = TString(create.Table()); auto columnTypeError = GetColumnTypeErrorFn(ctx); @@ -573,7 +573,7 @@ private: auto nameNode = columnTuple.Item(0).Cast<TCoAtom>(); auto typeNode = columnTuple.Item(1); - auto columnName = TString(nameNode.Value()); + auto columnName = TString(nameNode.Value()); auto columnType = typeNode.Ref().GetTypeAnn(); YQL_ENSURE(columnType && columnType->GetKind() == ETypeAnnotationKind::Type); @@ -1401,7 +1401,7 @@ private: return true; } - TString tmpDir = "/Root/Tmp/"; + TString tmpDir = "/Root/Tmp/"; TString homeDir = "/Root/Home/" + SessionCtx->GetUserName() + "/"; auto tablePath = Gateway->CanonizePath(table); diff --git a/ydb/core/kqp/proxy/kqp_proxy_service.cpp b/ydb/core/kqp/proxy/kqp_proxy_service.cpp index decd2cb3011..b7028e91638 100644 --- a/ydb/core/kqp/proxy/kqp_proxy_service.cpp +++ b/ydb/core/kqp/proxy/kqp_proxy_service.cpp @@ -614,7 +614,7 @@ public: LogRequest(request, requestInfo, ev->Sender, requestId, dbCounters); } - TString sessionId = request.GetSessionId(); + TString sessionId = request.GetSessionId(); PendingRequests.SetSessionId(requestId, sessionId, dbCounters); // We add extra milliseconds to the user-specified timeout, so it means we give additional priority for worker replies, // because it is much better to give detailed error message rather than generic timeout. diff --git a/ydb/core/mind/bscontroller/config.h b/ydb/core/mind/bscontroller/config.h index 006b0578e78..aff900c02ce 100644 --- a/ydb/core/mind/bscontroller/config.h +++ b/ydb/core/mind/bscontroller/config.h @@ -46,15 +46,15 @@ namespace NKikimr { TBlobStorageController& Self; // user-defined configuration - TCowHolder<TMap<THostConfigId, THostConfigInfo>> HostConfigs; - TCowHolder<TMap<TBoxId, TBoxInfo>> Boxes; - TCowHolder<TMap<TBoxStoragePoolId, TStoragePoolInfo>> StoragePools; - TCowHolder<TMultiMap<TBoxStoragePoolId, TGroupId>> StoragePoolGroups; + TCowHolder<TMap<THostConfigId, THostConfigInfo>> HostConfigs; + TCowHolder<TMap<TBoxId, TBoxInfo>> Boxes; + TCowHolder<TMap<TBoxStoragePoolId, TStoragePoolInfo>> StoragePools; + TCowHolder<TMultiMap<TBoxStoragePoolId, TGroupId>> StoragePoolGroups; // system-level configuration TOverlayMap<TPDiskId, TPDiskInfo> PDisks; TOverlayMap<TSerial, TDriveSerialInfo> DrivesSerials; - TCowHolder<TMap<TNodeId, TNodeInfo>> Nodes; + TCowHolder<TMap<TNodeId, TNodeInfo>> Nodes; TOverlayMap<TVSlotId, TVSlotInfo> VSlots; TOverlayMap<TGroupId, TGroupInfo> Groups; TCowHolder<TMap<TGroupSpecies, TVector<TGroupId>>> IndexGroupSpeciesToGroup; diff --git a/ydb/core/mind/bscontroller/config_fit_groups.cpp b/ydb/core/mind/bscontroller/config_fit_groups.cpp index cb8801b0f5f..89c10aa59b6 100644 --- a/ydb/core/mind/bscontroller/config_fit_groups.cpp +++ b/ydb/core/mind/bscontroller/config_fit_groups.cpp @@ -166,7 +166,7 @@ namespace NKikimr { }; // a set of preserved slots (which are not changed during this transaction) - TMap<TVDiskID, TVSlotId> preservedSlots; + TMap<TVDiskID, TVSlotId> preservedSlots; // mapping for audit log TMap<TVDiskIdShort, TVSlotId> replacedSlots; diff --git a/ydb/core/mind/bscontroller/group_mapper.h b/ydb/core/mind/bscontroller/group_mapper.h index f66ba3171c3..5949854a98e 100644 --- a/ydb/core/mind/bscontroller/group_mapper.h +++ b/ydb/core/mind/bscontroller/group_mapper.h @@ -15,7 +15,7 @@ namespace NKikimr { THolder<TImpl> Impl; public: - using TGroupDefinition = TVector<TVector<TVector<TPDiskId>>>; // Realm/Domain/Disk + using TGroupDefinition = TVector<TVector<TVector<TPDiskId>>>; // Realm/Domain/Disk using TForbiddenPDisks = std::unordered_set<TPDiskId, THash<TPDiskId>>; public: diff --git a/ydb/core/mind/bscontroller/grouper.cpp b/ydb/core/mind/bscontroller/grouper.cpp index db44d16898d..3408d49958b 100644 --- a/ydb/core/mind/bscontroller/grouper.cpp +++ b/ydb/core/mind/bscontroller/grouper.cpp @@ -28,16 +28,16 @@ TCandidate::TCandidate(TFailDomain failDomain, ui8 beginLevel, ui8 lastLevel, ui struct TGrouper { struct TCandidateSet { - typedef TVector<const TCandidate*> TGroupFailDomain; + typedef TVector<const TCandidate*> TGroupFailDomain; struct TGroup { - TVector<TGroupFailDomain> Domains; + TVector<TGroupFailDomain> Domains; ui32 FullDomainCount; TGroup() : FullDomainCount(0) {} }; - typedef TMap<TFailDomain, TGroup> TGroupMap; + typedef TMap<TFailDomain, TGroup> TGroupMap; TGroupMap CandidatesMap; TGroup *LastGroup; @@ -91,7 +91,7 @@ struct TGrouper { } void GetLastGroup(ui32 domainCount, ui32 candidatePerDomainCount, - TVector<TVector<const TCandidate*>> &outGroup) { + TVector<TVector<const TCandidate*>> &outGroup) { outGroup.resize(domainCount); size_t writeDomainIdx = 0; for (size_t domainIdx = 0; domainIdx < LastGroup->Domains.size(); ++domainIdx) { @@ -104,13 +104,13 @@ struct TGrouper { } }; - TMap<TFailDomain::TLevelIds, TCandidateSet> Maps; - TVector<TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator> SetsToPopulate; + TMap<TFailDomain::TLevelIds, TCandidateSet> Maps; + TVector<TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator> SetsToPopulate; ui32 DomainCount; ui32 CandidatePerDomainCount; bool IsBingo; - TVector<TVector<const TCandidate*>> *BestGroup; + TVector<TVector<const TCandidate*>> *BestGroup; TGrouper(ui32 domainCount, ui32 candidatesPerDomainCount) : DomainCount(domainCount) @@ -119,7 +119,7 @@ struct TGrouper { , BestGroup(nullptr) {} - bool Populate(TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator it, const TCandidate *candidate) { + bool Populate(TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator it, const TCandidate *candidate) { // TODO: Calculate isEmpty and isKeyEqual without creating the intersection. TFailDomain::TLevelIds intersection = candidate->InfixFailDomain.Intersect(it->first); if (intersection.IsEmpty()) { @@ -139,7 +139,7 @@ struct TGrouper { void AddToMaps(const TCandidate *candidate) { // Add candidate to all existing sets, while checking for exact match of the keys. bool isEqualKeyPresent = false; - for (TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator it = Maps.begin(); it != Maps.end(); ++it) { + for (TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator it = Maps.begin(); it != Maps.end(); ++it) { bool isKeyEqual = Populate(it, candidate); if (IsBingo) { return; @@ -148,9 +148,9 @@ struct TGrouper { } // If there is no such key in the map, generate all intersections. if (!isEqualKeyPresent) { - TVector<TFailDomain::TLevelIds> newIds; + TVector<TFailDomain::TLevelIds> newIds; newIds.reserve(Maps.size()); - for (TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator it = Maps.begin(); it != Maps.end(); ++it) { + for (TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator it = Maps.begin(); it != Maps.end(); ++it) { newIds.push_back(candidate->InfixFailDomain.Intersect(it->first)); } TFailDomain::TLevelIds idToInsert = candidate->InfixFailDomain.MakeIds(); @@ -159,7 +159,7 @@ struct TGrouper { Maps[newIds[i]]; } // List all empty sets in SetsToPopulate. - for (TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator it = Maps.begin(); it != Maps.end(); ++it) { + for (TMap<TFailDomain::TLevelIds, TCandidateSet>::iterator it = Maps.begin(); it != Maps.end(); ++it) { if (it->second.IsEmpty()) { SetsToPopulate.push_back(it); } @@ -177,7 +177,7 @@ struct TGrouper { } } - bool SelectCandidates(const TVector<TCandidate> &candidates, TVector<TVector<const TCandidate*>> &outBestGroup) { + bool SelectCandidates(const TVector<TCandidate> &candidates, TVector<TVector<const TCandidate*>> &outBestGroup) { IsBingo = false; BestGroup = &outBestGroup; @@ -185,7 +185,7 @@ struct TGrouper { SetsToPopulate.clear(); // TODO: Candidates may be required to have a specific prefix. - TVector<const TCandidate*> sortedCandidates(candidates.size()); + TVector<const TCandidate*> sortedCandidates(candidates.size()); for (size_t i = 0; i < candidates.size(); ++i) { sortedCandidates[i] = &candidates[i]; } @@ -212,7 +212,7 @@ struct TGrouper { return false; } - bool VerifyGroup(const TVector<TVector<const TCandidate*>> &group) const { + bool VerifyGroup(const TVector<TVector<const TCandidate*>> &group) const { if (group.size() != DomainCount) { Cout << "a" << Endl; return false; @@ -252,23 +252,23 @@ struct TGrouper { } }; -bool GroupFromCandidates(TVector<TCandidate> &candidates, ui32 domainCount, ui32 candidatesPerDomainCount, - TVector<TVector<const TCandidate*>> &outBestGroup) { +bool GroupFromCandidates(TVector<TCandidate> &candidates, ui32 domainCount, ui32 candidatesPerDomainCount, + TVector<TVector<const TCandidate*>> &outBestGroup) { TGrouper grouper(domainCount, candidatesPerDomainCount); return grouper.SelectCandidates(candidates, outBestGroup); } -bool VerifyGroup(const TVector<TVector<const TCandidate*>> &group, ui32 domainCount, ui32 candidatesPerDomainCount) { +bool VerifyGroup(const TVector<TVector<const TCandidate*>> &group, ui32 domainCount, ui32 candidatesPerDomainCount) { TGrouper grouper(domainCount, candidatesPerDomainCount); return grouper.VerifyGroup(group); } -bool CreateGroupWithRings(const TVector<TCandidate>& candidates, ui32 numRings, ui32 numFailDomainsPerRing, +bool CreateGroupWithRings(const TVector<TCandidate>& candidates, ui32 numRings, ui32 numFailDomainsPerRing, ui32 numDisksPerFailDomain, ui32 firstRingDxLevel, ui32 lastRingDxLevel, - TVector<TVector<TVector<const TCandidate*>>>& bestGroup) { + TVector<TVector<TVector<const TCandidate*>>>& bestGroup) { // calculate per-ring map of candidates - TVector<TString> keys; - TMultiMap<TString, const TCandidate*> perRingMap; + TVector<TString> keys; + TMultiMap<TString, const TCandidate*> perRingMap; for (const TCandidate& candidate : candidates) { // calculate infix according to ring distinction rules TFailDomain infix; @@ -288,8 +288,8 @@ bool CreateGroupWithRings(const TVector<TCandidate>& candidates, ui32 numRings, } // traverse through all rings and create groups for these rings - TVector<const TCandidate*> candptr; - TVector<TCandidate> ringCandidates; + TVector<const TCandidate*> candptr; + TVector<TCandidate> ringCandidates; bestGroup.reserve(bestGroup.size() + keys.size()); for (const TString& key : keys) { // get candidates for this ring @@ -304,7 +304,7 @@ bool CreateGroupWithRings(const TVector<TCandidate>& candidates, ui32 numRings, } // generate group - TVector<TVector<const TCandidate*>> failDomain; + TVector<TVector<const TCandidate*>> failDomain; if (!GroupFromCandidates(ringCandidates, numFailDomainsPerRing, numDisksPerFailDomain, failDomain)) { return false; } @@ -333,7 +333,7 @@ bool CreateGroupWithRings(const TVector<TCandidate>& candidates, ui32 numRings, } // calculate overall badness of all fail domains and delete the worst ones - TVector<ui32> badness; + TVector<ui32> badness; badness.reserve(bestGroup.size()); for (const auto& ring : bestGroup) { ui32 sum = 0; diff --git a/ydb/core/mind/bscontroller/grouper.h b/ydb/core/mind/bscontroller/grouper.h index d5541986332..56833b70bb9 100644 --- a/ydb/core/mind/bscontroller/grouper.h +++ b/ydb/core/mind/bscontroller/grouper.h @@ -19,14 +19,14 @@ struct TCandidate { ui32 vDiskSlotId); }; -bool GroupFromCandidates(TVector<TCandidate> &candidates, ui32 domainCount, ui32 candidatesPerDomainCount, - TVector<TVector<const TCandidate*>> &outBestGroup); +bool GroupFromCandidates(TVector<TCandidate> &candidates, ui32 domainCount, ui32 candidatesPerDomainCount, + TVector<TVector<const TCandidate*>> &outBestGroup); -bool VerifyGroup(const TVector<TVector<const TCandidate*>> &group, ui32 domainCount, ui32 candidatesPerDomainCount); +bool VerifyGroup(const TVector<TVector<const TCandidate*>> &group, ui32 domainCount, ui32 candidatesPerDomainCount); -bool CreateGroupWithRings(const TVector<TCandidate>& candidates, ui32 numRings, ui32 numFailDomainsPerRing, +bool CreateGroupWithRings(const TVector<TCandidate>& candidates, ui32 numRings, ui32 numFailDomainsPerRing, ui32 numDisksPerFailDomain, ui32 firstRingDxLevel, ui32 lastRingDxLevel, - TVector<TVector<TVector<const TCandidate*>>>& bestGroup); + TVector<TVector<TVector<const TCandidate*>>>& bestGroup); } //NBsController diff --git a/ydb/core/mind/bscontroller/grouper_ut.cpp b/ydb/core/mind/bscontroller/grouper_ut.cpp index a119ff665ae..e4384394ab8 100644 --- a/ydb/core/mind/bscontroller/grouper_ut.cpp +++ b/ydb/core/mind/bscontroller/grouper_ut.cpp @@ -19,11 +19,11 @@ enum ELevel { Y_UNIT_TEST_SUITE(TBlobStorageControllerGrouperTest) { static void construct_group_and_assert_it_is_valid( - TVector<NBsController::TCandidate> candidates, + TVector<NBsController::TCandidate> candidates, const ui32 domainCount, const ui32 candidatesPerDomainCount = 1 ) { - TVector<TVector<const NBsController::TCandidate*>> group; + TVector<TVector<const NBsController::TCandidate*>> group; bool isOk = NBsController::GroupFromCandidates(candidates, domainCount, candidatesPerDomainCount, group); UNIT_ASSERT(isOk); isOk = NBsController::VerifyGroup(group, domainCount, candidatesPerDomainCount); @@ -31,17 +31,17 @@ Y_UNIT_TEST_SUITE(TBlobStorageControllerGrouperTest) { } static void construct_group_and_assert_it_is_NOT_valid( - TVector<NBsController::TCandidate> candidates, + TVector<NBsController::TCandidate> candidates, const ui32 domainCount, const ui32 candidatesPerDomainCount = 1 ) { - TVector<TVector<const NBsController::TCandidate*>> group; + TVector<TVector<const NBsController::TCandidate*>> group; bool isOk = NBsController::GroupFromCandidates(candidates, domainCount, candidatesPerDomainCount, group); UNIT_ASSERT(!isOk); } Y_UNIT_TEST(TestGroupFromCandidatesEmpty) { - TVector<NBsController::TCandidate> candidates; + TVector<NBsController::TCandidate> candidates; construct_group_and_assert_it_is_NOT_valid(candidates, 4, 1); } @@ -50,7 +50,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageControllerGrouperTest) { ui32 pDiskId = 0; ui32 badness = 0; const ui32 vDiskSlotId = 1; - TVector<NBsController::TCandidate> candidates; + TVector<NBsController::TCandidate> candidates; for (ui32 rackIdx = 0; rackIdx < 4; ++rackIdx) { TFailDomain failDomain; failDomain.Levels[LevelRack] = rackIdx; @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageControllerGrouperTest) { ui32 nodeId = 0; const ui32 vDiskSlotId = 1; - TVector<NBsController::TCandidate> candidates; + TVector<NBsController::TCandidate> candidates; for (ui32 domainIdx = 0; domainIdx < 3; ++domainIdx) { for (ui32 roomIdx = 0; roomIdx < 10; ++roomIdx) { for (ui32 rackIdx = 0; rackIdx < 8; ++rackIdx) { @@ -97,13 +97,13 @@ Y_UNIT_TEST_SUITE(TBlobStorageControllerGrouperTest) { construct_group_and_assert_it_is_NOT_valid(candidates, 9, 4); } - static TVector<NBsController::TCandidate> create_server( + static TVector<NBsController::TCandidate> create_server( const ui32 domainIdx, const ui32 roomIdx, const ui32 rackIdx, const ui32 serverIdx, - TVector<std::pair<ui32, ui32>> driveIdx_badness + TVector<std::pair<ui32, ui32>> driveIdx_badness ) { const ui32 vDiskSlotId = 1; - TVector<NBsController::TCandidate> candidates; + TVector<NBsController::TCandidate> candidates; for (auto x: driveIdx_badness) { const ui32 driveIdx = x.first; @@ -127,7 +127,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageControllerGrouperTest) { } Y_UNIT_TEST(when_one_server_per_rack_in_4_racks_then_can_construct_group_with_4_domains) { - TVector<NBsController::TCandidate> candidates; + TVector<NBsController::TCandidate> candidates; for (ui32 rackIdx = 0; rackIdx < 4; ++rackIdx) { auto s = create_server(1, 1, rackIdx, 1, {{1, 2}}); @@ -144,7 +144,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageControllerGrouperTest) { const ui32 domainIdx = 1; const ui32 roomIdx = 0; - TVector<NBsController::TCandidate> candidates; + TVector<NBsController::TCandidate> candidates; auto s1 = create_server(domainIdx, roomIdx, 1, 1, {{1, 0}}); auto s2 = create_server(domainIdx, roomIdx, 2, 1, {{2, 0}}); diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h index ba311a254c3..2dacd456b0f 100644 --- a/ydb/core/mind/bscontroller/impl.h +++ b/ydb/core/mind/bscontroller/impl.h @@ -876,8 +876,8 @@ public: using Table = Schema::Box; - using TUserIds = TSet<Schema::BoxUser::TKey::Type>; - using THosts = TMap<THostKey, THostInfo>; + using TUserIds = TSet<Schema::BoxUser::TKey::Type>; + using THosts = TMap<THostKey, THostInfo>; Table::Name::Type Name; TMaybe<Table::Generation::Type> Generation; @@ -1084,8 +1084,8 @@ public: return res; } - using TUserIds = TSet<Schema::BoxStoragePoolUser::TKey::Type>; - using TPDiskFilters = TSet<TPDiskFilter>; + using TUserIds = TSet<Schema::BoxStoragePoolUser::TKey::Type>; + using TPDiskFilters = TSet<TPDiskFilter>; TUserIds UserIds; TPDiskFilters PDiskFilters; @@ -1477,8 +1477,8 @@ private: } //TGroupStatusTracker GroupStatusTracker; - TDeque<TAutoPtr<IEventHandle>> InitQueue; - THashMap<Schema::Group::Owner::Type, Schema::Group::ID::Type> OwnerIdIdxToGroup; + TDeque<TAutoPtr<IEventHandle>> InitQueue; + THashMap<Schema::Group::Owner::Type, Schema::Group::ID::Type> OwnerIdIdxToGroup; void ReadGroups(TSet<ui32>& groupIDsToRead, bool discard, TEvBlobStorage::TEvControllerNodeServiceSetUpdate *result); diff --git a/ydb/core/mind/dynamic_nameserver_impl.h b/ydb/core/mind/dynamic_nameserver_impl.h index ae0e1889511..a861a986f39 100644 --- a/ydb/core/mind/dynamic_nameserver_impl.h +++ b/ydb/core/mind/dynamic_nameserver_impl.h @@ -40,7 +40,7 @@ struct TDynamicConfig : public TThrRefBase { info.GetResolveHost(), (ui16)info.GetPort(), TNodeLocation(info.GetLocation()), - TInstant::MicroSeconds(info.GetExpire())) + TInstant::MicroSeconds(info.GetExpire())) { } @@ -58,7 +58,7 @@ struct TDynamicConfig : public TThrRefBase { TInstant Expire; }; - THashMap<ui32, TDynamicNodeInfo> DynamicNodes; + THashMap<ui32, TDynamicNodeInfo> DynamicNodes; THashMap<ui32, TDynamicNodeInfo> ExpiredNodes; TEpochInfo Epoch; }; diff --git a/ydb/core/mind/hive/hive_impl.cpp b/ydb/core/mind/hive/hive_impl.cpp index 58ca2ac3e43..cdce116892d 100644 --- a/ydb/core/mind/hive/hive_impl.cpp +++ b/ydb/core/mind/hive/hive_impl.cpp @@ -1476,7 +1476,7 @@ bool THive::DomainHasNodes(const TSubDomainKey &domainKey) const { } TResourceNormalizedValues THive::GetStDevResourceValues() const { - TVector<TResourceNormalizedValues> values; + TVector<TResourceNormalizedValues> values; values.reserve(Nodes.size()); for (const auto& ni : Nodes) { if (ni.second.IsAlive() && !ni.second.Down) { @@ -1523,7 +1523,7 @@ bool THive::IsTabletMoveExpedient(const TTabletInfo& tablet, const TNodeInfo& no return true; } - TVector<TResourceNormalizedValues> values; + TVector<TResourceNormalizedValues> values; std::size_t oldNode = std::numeric_limits<std::size_t>::max(); std::size_t newNode = std::numeric_limits<std::size_t>::max(); values.reserve(Nodes.size()); diff --git a/ydb/core/mind/hive/hive_ut.cpp b/ydb/core/mind/hive/hive_ut.cpp index 0383d49a123..d1b052cfd9b 100644 --- a/ydb/core/mind/hive/hive_ut.cpp +++ b/ydb/core/mind/hive/hive_ut.cpp @@ -83,7 +83,7 @@ namespace { runtime.SetLogPriority(NKikimrServices::BOOTSTRAPPER, otherPriority); } - THashMap<ui32, TIntrusivePtr<TNodeWardenConfig>> NodeWardenConfigs; + THashMap<ui32, TIntrusivePtr<TNodeWardenConfig>> NodeWardenConfigs; void SetupDomainInfo(TTestActorRuntime &runtime, TAppPrepare &app) { app.ClearDomainsAndHive(); @@ -134,7 +134,7 @@ namespace { void SetupNodeWarden(TTestActorRuntime &runtime) { for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) { - TString staticConfig( + TString staticConfig( "AvailabilityDomains: 0 " "PDisks { NodeID: $Node1 PDiskID: 1 PDiskGuid: 1 Path: \"/tmp/pdisk.dat\" }" "VDisks { VDiskID { GroupID: 0 GroupGeneration: 1 Ring: 0 Domain: 0 VDisk: 0 }" @@ -456,7 +456,7 @@ void InitSchemeRoot(TTestBasicRuntime& runtime, const TActorId& sender) { Y_UNIT_TEST_SUITE(THiveTest) { template <typename KeyType, typename ValueType> - static double GetStDev(const THashMap<KeyType, ValueType>& values) { + static double GetStDev(const THashMap<KeyType, ValueType>& values) { double sum = double(); if (values.empty()) return sum; @@ -474,7 +474,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { } template <typename KeyType, typename ValueType> - static ValueType GetMinMaxDiff(const THashMap<KeyType, ValueType>& values) { + static ValueType GetMinMaxDiff(const THashMap<KeyType, ValueType>& values) { ValueType minVal = std::numeric_limits<ValueType>::max(); ValueType maxVal = std::numeric_limits<ValueType>::min(); @@ -602,7 +602,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { void SendReassignTablet(TTestActorRuntime &runtime, ui64 hiveTablet, ui64 tabletId, - const TVector<ui32>& channels, + const TVector<ui32>& channels, ui32 nodeIndex) { TActorId senderB = runtime.AllocateEdgeActor(nodeIndex); runtime.SendToPipe(hiveTablet, senderB, new TEvHive::TEvReassignTablet(tabletId, channels), 0, GetPipeConfigWithRetries()); @@ -2137,13 +2137,13 @@ Y_UNIT_TEST_SUITE(THiveTest) { THiveInitialEventsFilter initialEventsFilter; - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back(hiveTablet); tabletIds.push_back(bsControllerTablet); tabletIds.push_back(testerTablet); RunTestWithReboots(tabletIds, [&]() { return initialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { if (ENABLE_DETAILED_HIVE_LOG) { Ctest << "At dispatch " << dispatchName << Endl; } @@ -2188,7 +2188,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { Y_UNIT_TEST(TestLocalDisconnect) { TTestBasicRuntime runtime(1, false); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); @@ -2242,7 +2242,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { Y_UNIT_TEST(TestLocalReplacement) { TTestBasicRuntime runtime(2, false); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); @@ -2320,7 +2320,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { Y_UNIT_TEST(TestLimitedNodeList) { TTestBasicRuntime runtime(3, false); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); @@ -2462,7 +2462,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvLookupChannelInfo(tabletId)); TAutoPtr<IEventHandle> handle1; TEvHive::TEvChannelInfo* channelInfo1 = runtime.GrabEdgeEventRethrow<TEvHive::TEvChannelInfo>(handle1); - TVector<ui32> channels = {1, 2}; + TVector<ui32> channels = {1, 2}; runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvInvalidateStoragePools(), 0, GetPipeConfigWithRetries()); @@ -2507,7 +2507,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { RunTestWithReboots({hiveTablet, bsControllerTablet, testerTablet}, [&]() { return initialEventsFilter.Prepare(); - }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { + }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) { if (ENABLE_DETAILED_HIVE_LOG) { Ctest << "At dispatch " << dispatchName << Endl; } @@ -2613,7 +2613,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { TTestBasicRuntime runtime(1, false); Setup(runtime, true); TActorId sender = runtime.AllocateEdgeActor(); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; TAutoPtr<ITabletScheduledEventsGuard> guard = CreateTabletScheduledEventsGuard(tabletIds, runtime, sender); const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); @@ -2636,7 +2636,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { Y_UNIT_TEST(TestFailureNotification) { TTestBasicRuntime runtime(3, false); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; TActorId senderA = runtime.AllocateEdgeActor(); TAutoPtr<ITabletScheduledEventsGuard> guard = CreateTabletScheduledEventsGuard(tabletIds, runtime, senderA); const ui64 hiveTablet = MakeDefaultHiveID(0); @@ -2648,7 +2648,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { // Create the tablet ui32 tabletType = 0; THolder<TEvHive::TEvCreateTablet> ev(new TEvHive::TEvCreateTablet(testerTablet, 100500, tabletType, 0)); - TVector<ui32> allowedNodes; + TVector<ui32> allowedNodes; allowedNodes.push_back(runtime.GetNodeId(1)); ev->SetStartupOptions(TEvHive::TEvCreateTablet::FlagLimitAllowedNodes, &allowedNodes, 0, 0); ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, ev.Release(), 0); @@ -2664,7 +2664,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { Y_UNIT_TEST(TestFollowers) { TTestBasicRuntime runtime(3, false); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); @@ -2689,7 +2689,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { Y_UNIT_TEST(TestFollowersReconfiguration) { TTestBasicRuntime runtime(3, false); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; TActorId senderA = runtime.AllocateEdgeActor(); //TAutoPtr<ITabletScheduledEventsGuard> guard = CreateTabletScheduledEventsGuard(tabletIds, runtime, senderA); const ui64 hiveTablet = MakeDefaultHiveID(0); @@ -2738,7 +2738,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { TTestBasicRuntime runtime(NODES, false); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); @@ -2808,7 +2808,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { TTestBasicRuntime runtime(2, false); Setup(runtime, true); const int nodeBase = runtime.GetNodeId(0); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; TActorId senderA = runtime.AllocateEdgeActor(); const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); @@ -2900,7 +2900,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { // creating NUM_TABLETS tablets TTabletTypes::EType tabletType = TTabletTypes::Dummy; - TVector<ui64> tablets; + TVector<ui64> tablets; for (int i = 0; i < NUM_TABLETS; ++i) { THolder<TEvHive::TEvCreateTablet> ev(new TEvHive::TEvCreateTablet(testerTablet, 100500 + i, tabletType, BINDED_CHANNELS)); ev->Record.SetObjectId(i); @@ -3376,7 +3376,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { Y_UNIT_TEST(TestRestartTablets) { TTestBasicRuntime runtime(3, false); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); @@ -3439,7 +3439,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { Y_UNIT_TEST(TestFollowersCrossDC_Easy) { TTestBasicRuntime runtime((ui32)9, (ui32)3); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); @@ -3591,7 +3591,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { static constexpr ui32 FOLLOWERS = NODES / DCS; TTestBasicRuntime runtime(NODES, DCS); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); @@ -3644,7 +3644,7 @@ Y_UNIT_TEST_SUITE(THiveTest) { static constexpr ui32 FOLLOWERS = NODES / DCS; TTestBasicRuntime runtime(NODES, DCS); Setup(runtime, true); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; const ui64 hiveTablet = MakeDefaultHiveID(0); const ui64 testerTablet = MakeDefaultHiveID(1); CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive); diff --git a/ydb/core/mind/hive/monitoring.cpp b/ydb/core/mind/hive/monitoring.cpp index 7e9a83b354e..91b28ae4c16 100644 --- a/ydb/core/mind/hive/monitoring.cpp +++ b/ydb/core/mind/hive/monitoring.cpp @@ -32,8 +32,8 @@ public: const TActorId Source; - TMap<ui64, TTabletInfo> TabletInfo; - TMap<ui32, TNodeInfo> NodeInfo; + TMap<ui64, TTabletInfo> TabletInfo; + TMap<ui32, TNodeInfo> NodeInfo; TTxMonEvent_DbState(const TActorId &source, TSelf *hive) : TBase(hive) @@ -427,7 +427,7 @@ public: }; -TString GetDurationString(TDuration duration) { +TString GetDurationString(TDuration duration) { int seconds = duration.Seconds(); if (seconds < 60) return Sprintf("%ds", seconds); @@ -462,7 +462,7 @@ public: } void RenderHTMLPage(IOutputStream& out, const TActorContext&) { - TVector<ui64> tabletIdIndex; + TVector<ui64> tabletIdIndex; tabletIdIndex.reserve(Self->Tablets.size()); for (const auto &tabletPair : Self->Tablets) { TTabletId tabletId = tabletPair.first; @@ -1057,7 +1057,7 @@ public: Y_UNUSED(ctx); } - static TString GetTabletType(TTabletTypes::EType type) { + static TString GetTabletType(TTabletTypes::EType type) { switch(type) { case TTabletTypes::SchemeShard: return "SS"; @@ -1104,8 +1104,8 @@ public: ui64 tablets = 0; ui64 runningTablets = 0; ui64 aliveNodes = 0; - THashMap<ui32, TMap<TString, ui32>> tabletsByNodeByType; - THashMap<TTabletTypes::EType, ui32> tabletTypesToChannels; + THashMap<ui32, TMap<TString, ui32>> tabletsByNodeByType; + THashMap<TTabletTypes::EType, ui32> tabletTypesToChannels; for (const auto& pr : Self->Tablets) { if (pr.second.IsRunning()) { @@ -1748,7 +1748,7 @@ public: ui64 tablets = 0; ui64 runningTablets = 0; ui64 aliveNodes = 0; - THashMap<ui32, TMap<TString, ui32>> tabletsByNodeByType; + THashMap<ui32, TMap<TString, ui32>> tabletsByNodeByType; for (const auto& pr : Self->Tablets) { if (pr.second.IsRunning()) { @@ -1838,7 +1838,7 @@ public: jsonNode["Starting"] = node.Tablets[TTabletInfo::EVolatileState::TABLET_VOLATILE_STATE_STARTING].size(); jsonNode["Running"] = node.Tablets[TTabletInfo::EVolatileState::TABLET_VOLATILE_STATE_RUNNING].size(); { - TString types; + TString types; auto nodeTabletTypes = tabletsByNodeByType.find(node.Id); if (nodeTabletTypes != tabletsByNodeByType.end()) { for (auto it = nodeTabletTypes->second.begin(); it != nodeTabletTypes->second.end(); ++it) { @@ -1864,7 +1864,7 @@ public: const TActorId Source; const TNodeId NodeId; const bool Down; - TString Response; + TString Response; TTxMonEvent_SetDown(const TActorId& source, TNodeId nodeId, bool down, TSelf* hive) : TBase(hive) @@ -1899,7 +1899,7 @@ public: const TActorId Source; const TNodeId NodeId; const bool Freeze; - TString Response; + TString Response; TTxMonEvent_SetFreeze(const TActorId& source, TNodeId nodeId, bool freeze, TSelf* hive) : TBase(hive) @@ -1933,7 +1933,7 @@ class TTxMonEvent_KickNode : public TTransactionBase<THive> { public: const TActorId Source; const TNodeId NodeId; - TString Response; + TString Response; TTxMonEvent_KickNode(const TActorId& source, TNodeId nodeId, TSelf* hive) : TBase(hive) @@ -2115,7 +2115,7 @@ public: const TActorId Source; TTabletId TabletId = 0; TTabletTypes::EType TabletType = TTabletTypes::TYPE_INVALID; - TVector<ui32> TabletChannels; + TVector<ui32> TabletChannels; ui32 GroupId = 0; TVector<ui32> ForcedGroupIds; int TabletPercent = 100; @@ -2194,7 +2194,7 @@ public: Self->SubActors.emplace_back(waitActor); } for (TLeaderTabletInfo* tablet : tablets) { - TVector<ui32> channels; + TVector<ui32> channels; TVector<ui32> forcedGroupIds; bool skip = false; if (GroupId != 0) { @@ -3333,7 +3333,7 @@ void THive::CreateEvMonitoring(NMon::TEvRemoteHttpInfo::TPtr& ev, const TActorCo } NMon::TEvRemoteHttpInfo* httpInfo = ev->Get(); TCgiParameters cgi(httpInfo->Cgi()); - TString page = cgi.Has("page") ? cgi.Get("page") : ""; + TString page = cgi.Has("page") ? cgi.Get("page") : ""; if (page == "MemStateTablets") return Execute(new TTxMonEvent_MemStateTablets(ev->Sender, ev, this), ctx); if (page == "MemStateNodes") diff --git a/ydb/core/mind/lease_holder.cpp b/ydb/core/mind/lease_holder.cpp index 5d47d04c71f..90c95bb0436 100644 --- a/ydb/core/mind/lease_holder.cpp +++ b/ydb/core/mind/lease_holder.cpp @@ -162,7 +162,7 @@ private: return; } - Expire = TInstant::MicroSeconds(rec.GetExpire()); + Expire = TInstant::MicroSeconds(rec.GetExpire()); LastResponse = ctx.Now(); LOG_DEBUG_S(ctx, NKikimrServices::NODE_BROKER, "Node has now extended lease expiring " << ToString(Expire)); diff --git a/ydb/core/mind/local.cpp b/ydb/core/mind/local.cpp index 09fc15f76dd..279b35d650d 100644 --- a/ydb/core/mind/local.cpp +++ b/ydb/core/mind/local.cpp @@ -63,7 +63,7 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> { TInstant From; TTabletEntry() - : From(TInstant::MicroSeconds(0)) + : From(TInstant::MicroSeconds(0)) {} }; @@ -78,7 +78,7 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> { const TActorId Owner; const ui64 HiveId; - TVector<TSubDomainKey> ServicedDomains; + TVector<TSubDomainKey> ServicedDomains; TActorId HivePipeClient; bool Connected; @@ -403,7 +403,7 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> { LOG_DEBUG_S(ctx, NKikimrServices::LOCAL, "TLocalNodeRegistrar: Handle TEvLocal::TEvBootTablet tabletType:" << tabletType << " tabletId:" << tabletId << " suggestedGen:" << suggestedGen); - TMap<TTabletTypes::EType, TLocalConfig::TTabletClassInfo>::const_iterator it = Config->TabletClassInfo.find(tabletType); + TMap<TTabletTypes::EType, TLocalConfig::TTabletClassInfo>::const_iterator it = Config->TabletClassInfo.find(tabletType); if (it == Config->TabletClassInfo.end()) { LOG_ERROR_S(ctx, NKikimrServices::LOCAL, "TLocalNodeRegistrar: boot-tablet unknown tablet type: " diff --git a/ydb/core/mind/local.h b/ydb/core/mind/local.h index 05c9bdc48eb..0349e4b4bc6 100644 --- a/ydb/core/mind/local.h +++ b/ydb/core/mind/local.h @@ -364,7 +364,7 @@ struct TLocalConfig : public TThrRefBase { {} }; - TMap<TTabletTypes::EType, TTabletClassInfo> TabletClassInfo; + TMap<TTabletTypes::EType, TTabletClassInfo> TabletClassInfo; }; IActor* CreateLocal(TLocalConfig *config); diff --git a/ydb/core/mind/node_broker_impl.h b/ydb/core/mind/node_broker_impl.h index e3b68b0587b..73d3404cc0f 100644 --- a/ydb/core/mind/node_broker_impl.h +++ b/ydb/core/mind/node_broker_impl.h @@ -289,7 +289,7 @@ private: // ID of domain node broker is responsible for. ui32 DomainId; // All registered dynamic nodes. - THashMap<ui32, TNodeInfo> Nodes; + THashMap<ui32, TNodeInfo> Nodes; THashMap<ui32, TNodeInfo> ExpiredNodes; // Maps <Host/Addr:Port> to NodeID. THashMap<std::tuple<TString, TString, ui16>, ui32> Hosts; @@ -306,7 +306,7 @@ private: ui64 ConfigSubscriptionId; // Events collected during initialization phase. - TVector<TAutoPtr<IEventHandle>> EnqueuedEvents; + TVector<TAutoPtr<IEventHandle>> EnqueuedEvents; TMultiMap<ui64, TEvNodeBroker::TEvListNodes::TPtr> DelayedListNodesRequests; // Transactions queue. TTxProcessor::TPtr TxProcessor; diff --git a/ydb/core/mind/node_broker_ut.cpp b/ydb/core/mind/node_broker_ut.cpp index 0d9498ddcdd..082b15e31dd 100644 --- a/ydb/core/mind/node_broker_ut.cpp +++ b/ydb/core/mind/node_broker_ut.cpp @@ -44,7 +44,7 @@ void SetupLogging(TTestActorRuntime& runtime) runtime.SetLogPriority(NKikimrServices::NODE_BROKER, priority); } -THashMap<ui32, TIntrusivePtr<TNodeWardenConfig>> NodeWardenConfigs; +THashMap<ui32, TIntrusivePtr<TNodeWardenConfig>> NodeWardenConfigs; void SetupServices(TTestActorRuntime &runtime, ui32 maxDynNodes, @@ -561,7 +561,7 @@ void CheckNameserverNodesList(TTestActorRuntime &runtime, TActorId sender, size_t count) { - THashMap<ui32, TEvInterconnect::TNodeInfo> nodes; + THashMap<ui32, TEvInterconnect::TNodeInfo> nodes; GetNameserverNodesList(runtime, sender, nodes, true); UNIT_ASSERT_VALUES_EQUAL(nodes.size(), count); } @@ -611,7 +611,7 @@ void CheckNameserverDynamicNodesList(TTestActorRuntime &runtime, size_t count, Ts... args) { - THashMap<ui32, TEvInterconnect::TNodeInfo> nodes; + THashMap<ui32, TEvInterconnect::TNodeInfo> nodes; GetNameserverNodesList(runtime, sender, nodes, false); UNIT_ASSERT_VALUES_EQUAL(nodes.size(), count); CheckNameserverDynamicNodesList(nodes, args...); diff --git a/ydb/core/mind/tenant_slot_broker.cpp b/ydb/core/mind/tenant_slot_broker.cpp index 65f7a86328b..36570d5c74d 100644 --- a/ydb/core/mind/tenant_slot_broker.cpp +++ b/ydb/core/mind/tenant_slot_broker.cpp @@ -625,7 +625,7 @@ void TTenantSlotBroker::Die(const TActorContext &ctx) void TTenantSlotBroker::LoadConfigFromProto(const NKikimrTenantSlotBroker::TConfig &config) { - PendingTimeout = TDuration::MicroSeconds(config.GetPendingSlotTimeout()); + PendingTimeout = TDuration::MicroSeconds(config.GetPendingSlotTimeout()); } void TTenantSlotBroker::ProcessEnqueuedEvents(const TActorContext &ctx) diff --git a/ydb/core/mind/tenant_ut_broker.cpp b/ydb/core/mind/tenant_ut_broker.cpp index 4c124b3d83b..7f198f98a89 100644 --- a/ydb/core/mind/tenant_ut_broker.cpp +++ b/ydb/core/mind/tenant_ut_broker.cpp @@ -489,7 +489,7 @@ void CheckTenantState(TTenantTestRuntime &runtime, runtime.SetObserverFunc(TTestActorRuntime::DefaultObserverFunc); if (!ok) { NKikimrTenantSlotBroker::TConfig config; - TDuration delay = TDuration::MicroSeconds(config.GetPendingSlotTimeout()); + TDuration delay = TDuration::MicroSeconds(config.GetPendingSlotTimeout()); TDispatchOptions options; options.FinalEvents.emplace_back(TTenantSlotBroker::TEvPrivate::EvCheckSlotStatus, 1); runtime.DispatchEvents(options, delay); diff --git a/ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp b/ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp index 011f03d93cd..d8ea0c71287 100644 --- a/ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp +++ b/ydb/core/mind/ut_fat/blobstorage_node_warden_ut_fat.cpp @@ -181,7 +181,7 @@ void SetupServices(TTestActorRuntime &runtime) { str << " }" << Endl; str << " }" << Endl; str << "}"; - TString staticConfig(str.Str()); + TString staticConfig(str.Str()); SubstGlobal(staticConfig, "$Node1", Sprintf("%" PRIu32, runtime.GetNodeId(0))); @@ -198,7 +198,7 @@ void SetupServices(TTestActorRuntime &runtime) { if (nodeIndex == 0) { static TTempDir tempDir; - TString pDiskPath = tempDir() + "/pdisk0.dat"; + TString pDiskPath = tempDir() + "/pdisk0.dat"; nodeWardenConfig->ServiceSet.MutablePDisks(0)->SetPath(pDiskPath); ui64 pDiskGuid = 1; diff --git a/ydb/core/mon/mon.cpp b/ydb/core/mon/mon.cpp index d4722266f34..d3046a82121 100644 --- a/ydb/core/mon/mon.cpp +++ b/ydb/core/mon/mon.cpp @@ -230,7 +230,7 @@ namespace NActors { //////////////////////////////////////////////////////////////////////////////// class THtmlResultMonPage: public THtmlMonPage { public: - THtmlResultMonPage(const TString &path, const TString &title, const TString &host, bool preTag, + THtmlResultMonPage(const TString &path, const TString &title, const TString &host, bool preTag, const NMon::IEvHttpInfoRes &result) : THtmlMonPage(path, title, true) , Host(host) @@ -297,7 +297,7 @@ namespace NActors { } private: - TString Host; + TString Host; bool PreTag; const NMon::IEvHttpInfoRes &Result; }; @@ -329,7 +329,7 @@ namespace NActors { //////////////////////////////////////////////////////////////////////////////// class TActorMonPage: public IMonPage { public: - TActorMonPage(const TString &path, const TString &title, const TString &host, bool preTag, + TActorMonPage(const TString &path, const TString &title, const TString &host, bool preTag, TActorSystem *actorSystem, const TActorId &actorId, const TVector<TString> &sids, TMon::TRequestAuthorizer authorizer) : IMonPage(path, title) @@ -372,7 +372,7 @@ namespace NActors { } private: - TString Host; + TString Host; bool PreTag; TActorSystem *ActorSystem; TActorId TargetActorId; @@ -416,13 +416,13 @@ namespace NActors { TBase::SortPages(); } - TIndexMonPage *TMon::RegisterIndexPage(const TString &path, const TString &title) { + TIndexMonPage *TMon::RegisterIndexPage(const TString &path, const TString &title) { auto page = TBase::RegisterIndexPage(path, title); TBase::SortPages(); return page; } - IMonPage *TMon::RegisterActorPage(TIndexMonPage *index, const TString &relPath, + IMonPage *TMon::RegisterActorPage(TIndexMonPage *index, const TString &relPath, const TString &title, bool preTag, TActorSystem *actorSystem, const TActorId &actorId, bool useAuth) { return RegisterActorPage({ .Title = title, @@ -455,18 +455,18 @@ namespace NActors { return page; } - IMonPage *TMon::RegisterCountersPage(const TString &path, const TString &title, TIntrusivePtr<TDynamicCounters> counters) { + IMonPage *TMon::RegisterCountersPage(const TString &path, const TString &title, TIntrusivePtr<TDynamicCounters> counters) { TDynamicCountersPage* page = new TDynamicCountersPage(path, title, counters); page->SetUnknownGroupPolicy(EUnknownGroupPolicy::Ignore); Register(page); return page; } - IMonPage *TMon::FindPage(const TString &relPath) { + IMonPage *TMon::FindPage(const TString &relPath) { return TBase::FindPage(relPath); } - TIndexMonPage *TMon::FindIndexPage(const TString &relPath) { + TIndexMonPage *TMon::FindIndexPage(const TString &relPath) { return TBase::FindIndexPage(relPath); } diff --git a/ydb/core/mon/mon.h b/ydb/core/mon/mon.h index 1cb5dbecd0c..b4c8fd61268 100644 --- a/ydb/core/mon/mon.h +++ b/ydb/core/mon/mon.h @@ -33,7 +33,7 @@ namespace NActors { void Stop(); void Register(NMonitoring::IMonPage *page); - NMonitoring::TIndexMonPage *RegisterIndexPage(const TString &path, const TString &title); + NMonitoring::TIndexMonPage *RegisterIndexPage(const TString &path, const TString &title); struct TRegisterActorPageFields { TString Title; @@ -47,11 +47,11 @@ namespace NActors { }; NMonitoring::IMonPage* RegisterActorPage(TRegisterActorPageFields fields); - NMonitoring::IMonPage *RegisterActorPage(NMonitoring::TIndexMonPage *index, const TString &relPath, + NMonitoring::IMonPage *RegisterActorPage(NMonitoring::TIndexMonPage *index, const TString &relPath, const TString &title, bool preTag, TActorSystem *actorSystem, const TActorId &actorId, bool useAuth = true); - NMonitoring::IMonPage *RegisterCountersPage(const TString &path, const TString &title, TIntrusivePtr<NMonitoring::TDynamicCounters> counters); - NMonitoring::IMonPage *FindPage(const TString &relPath); - NMonitoring::TIndexMonPage *FindIndexPage(const TString &relPath); + NMonitoring::IMonPage *RegisterCountersPage(const TString &path, const TString &title, TIntrusivePtr<NMonitoring::TDynamicCounters> counters); + NMonitoring::IMonPage *FindPage(const TString &relPath); + NMonitoring::TIndexMonPage *FindIndexPage(const TString &relPath); void OutputIndexPage(IOutputStream& out) override; void SetAllowedSIDs(const TVector<TString>& sids); // sets allowed users/groups for this web interface ui16 GetListenPort(); diff --git a/ydb/core/node_whiteboard/node_whiteboard.h b/ydb/core/node_whiteboard/node_whiteboard.h index cdf7601807c..935c58902ae 100644 --- a/ydb/core/node_whiteboard/node_whiteboard.h +++ b/ydb/core/node_whiteboard/node_whiteboard.h @@ -114,7 +114,7 @@ struct TEvWhiteboard{ struct TEvPDiskStateUpdate : TEventPB<TEvPDiskStateUpdate, NKikimrWhiteboard::TPDiskStateInfo, EvPDiskStateUpdate> { TEvPDiskStateUpdate() = default; - TEvPDiskStateUpdate(ui32 pDiskId, const TString& path, ui64 guid, ui64 category) { + TEvPDiskStateUpdate(ui32 pDiskId, const TString& path, ui64 guid, ui64 category) { Record.SetPDiskId(pDiskId); Record.SetPath(path); Record.SetGuid(guid); @@ -279,7 +279,7 @@ struct TEvWhiteboard{ Record.SetNumberOfCpus(numberOfCpus); } - TEvSystemStateUpdate(const TVector<double>& loadAverage) { + TEvSystemStateUpdate(const TVector<double>& loadAverage) { for (double d : loadAverage) { Record.AddLoadAverage(d); } diff --git a/ydb/core/persqueue/blob.cpp b/ydb/core/persqueue/blob.cpp index 7727f12a130..6c9086a9670 100644 --- a/ydb/core/persqueue/blob.cpp +++ b/ydb/core/persqueue/blob.cpp @@ -9,7 +9,7 @@ namespace NKikimr { namespace NPQ { -TBlobIterator::TBlobIterator(const TKey& key, const TString& blob) +TBlobIterator::TBlobIterator(const TKey& key, const TString& blob) : Key(key) , Data(blob.c_str()) , End(Data + blob.size()) @@ -62,7 +62,7 @@ const TBatch& TBlobIterator::GetBatch() return Batch; } -void CheckBlob(const TKey& key, const TString& blob) +void CheckBlob(const TKey& key, const TString& blob) { for (TBlobIterator it(key, blob); it.IsValid(); it.Next()); } @@ -173,17 +173,17 @@ TClientBlob TClientBlob::Deserialize(const char* data, ui32 size) ui16 sz = ReadUnaligned<ui16>(data); data += sizeof(ui16); Y_VERIFY(data + sz < end); - TString sourceId(data, sz); + TString sourceId(data, sz); data += sz; Y_VERIFY(data < end, "size %u SeqNo %" PRIu64 " SourceId %s", size, seqNo, sourceId.c_str()); - TString dt(data, end - data); + TString dt(data, end - data); return TClientBlob(sourceId, seqNo, dt, std::move(partData), writeTimestamp, createTimestamp, us, partitionKey, explicitHashKey); } -TString TBatch::Serialize() { +TString TBatch::Serialize() { Y_VERIFY(Packed); - TString res; + TString res; ui16 sz = Header.ByteSize(); bool rs = Header.SerializeToString(&res); Y_VERIFY(rs); @@ -228,15 +228,15 @@ void TBatch::Pack() { ui32 totalCount = Blobs.size(); Y_VERIFY(totalCount == Header.GetCount() + Header.GetInternalPartsCount()); ui32 cnt = 0; - THashMap<TStringBuf, ui32> reorderMap; + THashMap<TStringBuf, ui32> reorderMap; for (ui32 i = 0; i < Blobs.size(); ++i) { if (Blobs[i].IsLastPart()) ++cnt; ++reorderMap[TStringBuf(Blobs[i].SourceId)]; } Y_VERIFY(cnt == Header.GetCount()); - TVector<ui32> start(reorderMap.size(), 0); - TVector<ui32> pos(Blobs.size(), 0); + TVector<ui32> start(reorderMap.size(), 0); + TVector<ui32> pos(Blobs.size(), 0); ui32 sum = 0; ui32 i = 0; for (auto it = reorderMap.begin(); it != reorderMap.end(); ++it) { @@ -360,7 +360,7 @@ void TBatch::Pack() { OutputChunk(chunk, output, res); } - PackedData = TString{res.Data(), res.Size()}; + PackedData = TString{res.Data(), res.Size()}; Header.SetPayloadSize(PackedData.size()); if (GetPackedSize() > GetUnpackedSize() + GetMaxHeaderSize()) { //packing is not effective, write as-is @@ -369,10 +369,10 @@ void TBatch::Pack() { for (ui32 i = 0; i < Blobs.size(); ++i) { Blobs[i].Serialize(res); } - PackedData = TString{res.Data(), res.Size()}; + PackedData = TString{res.Data(), res.Size()}; Header.SetPayloadSize(PackedData.size()); } - TVector<TClientBlob> tmp; + TVector<TClientBlob> tmp; Blobs.swap(tmp); InternalPartsPos.resize(0); Y_VERIFY(GetPackedSize() <= GetUnpackedSize() + GetMaxHeaderSize()); //be sure that PackedSize is not bigger than packed size for packing type 0 @@ -390,11 +390,11 @@ void TBatch::Unpack() { InternalPartsPos.push_back(i); } Y_VERIFY(InternalPartsPos.size() == GetInternalPartsCount()); - TString tmp; + TString tmp; tmp.swap(PackedData); } -void TBatch::UnpackTo(TVector<TClientBlob> *blobs) +void TBatch::UnpackTo(TVector<TClientBlob> *blobs) { Y_VERIFY(!PackedData.empty()); auto type = Header.GetFormat(); @@ -418,18 +418,18 @@ NScheme::TDataRef GetChunk(const char*& data, const char *end) return NScheme::TDataRef(data - size, size); } -void TBatch::UnpackToType1(TVector<TClientBlob> *blobs) { +void TBatch::UnpackToType1(TVector<TClientBlob> *blobs) { Y_VERIFY(Header.GetFormat() == NKikimrPQ::TBatchHeader::ECompressed); Y_VERIFY(!PackedData.empty()); ui32 totalBlobs = Header.GetCount() + Header.GetInternalPartsCount(); ui32 partsSize = 0; - TVector<ui32> end; - TVector<ui32> pos; + TVector<ui32> end; + TVector<ui32> pos; pos.reserve(totalBlobs); const char* data = PackedData.data(); const char* dataEnd = PackedData.data() + PackedData.size(); ui32 sourceIdCount = 0; - TVector<TString> sourceIds; + TVector<TString> sourceIds; NScheme::TTypeCodecs ui32Codecs(NScheme::NTypeIds::Uint32), ui64Codecs(NScheme::NTypeIds::Uint64), stringCodecs(NScheme::NTypeIds::String); //read order @@ -456,7 +456,7 @@ void TBatch::UnpackToType1(TVector<TClientBlob> *blobs) { sourceIds.emplace_back(ref.Data(), ref.Size()); } } - TVector<ui64> seqNo; + TVector<ui64> seqNo; seqNo.reserve(totalBlobs); //read SeqNo @@ -467,7 +467,7 @@ void TBatch::UnpackToType1(TVector<TClientBlob> *blobs) { seqNo.push_back(*(ui64*)iter->Next().Data()); } } - TVector<TString> dt; + TVector<TString> dt; dt.reserve(totalBlobs); //read Data @@ -479,7 +479,7 @@ void TBatch::UnpackToType1(TVector<TClientBlob> *blobs) { dt.emplace_back(ref.Data(), ref.Size()); } } - THashMap<ui32, TPartData> partData; + THashMap<ui32, TPartData> partData; //read PartData { @@ -578,7 +578,7 @@ void TBatch::UnpackToType1(TVector<TClientBlob> *blobs) { } } -void TBatch::UnpackToType0(TVector<TClientBlob> *blobs) { +void TBatch::UnpackToType0(TVector<TClientBlob> *blobs) { Y_VERIFY(Header.GetFormat() == NKikimrPQ::TBatchHeader::EUncompressed); Y_VERIFY(!PackedData.empty()); ui32 shift = 0; @@ -708,7 +708,7 @@ TPartitionedBlob::TPartitionedBlob(const TPartitionedBlob& x) , MaxBlobSize(x.MaxBlobSize) {} -TPartitionedBlob::TPartitionedBlob(const ui32 partition, const ui64 offset, const TString& sourceId, const ui64 seqNo, const ui16 totalParts, +TPartitionedBlob::TPartitionedBlob(const ui32 partition, const ui64 offset, const TString& sourceId, const ui64 seqNo, const ui16 totalParts, const ui32 totalSize, THead& head, THead& newHead, bool headCleared, bool needCompactHead, const ui32 maxBlobSize) : Partition(partition) , Offset(offset) @@ -749,9 +749,9 @@ TPartitionedBlob::TPartitionedBlob(const ui32 partition, const ui64 offset, cons } } -TString TPartitionedBlob::CompactHead(bool glueHead, THead& head, bool glueNewHead, THead& newHead, ui32 estimatedSize) +TString TPartitionedBlob::CompactHead(bool glueHead, THead& head, bool glueNewHead, THead& newHead, ui32 estimatedSize) { - TString valueD; + TString valueD; valueD.reserve(estimatedSize); if (glueHead) { for (ui32 pp = 0; pp < head.Batches.size(); ++pp) { @@ -776,11 +776,11 @@ TString TPartitionedBlob::CompactHead(bool glueHead, THead& head, bool glueNewHe return valueD; } -std::pair<TKey, TString> TPartitionedBlob::Add(TClientBlob&& blob) +std::pair<TKey, TString> TPartitionedBlob::Add(TClientBlob&& blob) { Y_VERIFY(NewHead.Offset >= Head.Offset); ui32 size = blob.GetBlobSize(); - std::pair<TKey, TString> res; + std::pair<TKey, TString> res; Y_VERIFY(InternalPartsCount < 1000); //just check for future packing if (HeadSize + BlobsSize + size + GetMaxHeaderSize() > MaxBlobSize) NeedCompactHead = true; @@ -803,7 +803,7 @@ std::pair<TKey, TString> TPartitionedBlob::Add(TClientBlob&& blob) StartPartNo = NextPartNo; InternalPartsCount = 0; - TString valueD = CompactHead(GlueHead, Head, GlueNewHead, NewHead, HeadSize + BlobsSize + (BlobsSize > 0 ? GetMaxHeaderSize() : 0)); + TString valueD = CompactHead(GlueHead, Head, GlueNewHead, NewHead, HeadSize + BlobsSize + (BlobsSize > 0 ? GetMaxHeaderSize() : 0)); GlueHead = GlueNewHead = false; if (!Blobs.empty()) { @@ -836,7 +836,7 @@ bool TPartitionedBlob::IsComplete() const } -bool TPartitionedBlob::IsNextPart(const TString& sourceId, const ui64 seqNo, const ui16 partNo, TString *reason) const +bool TPartitionedBlob::IsNextPart(const TString& sourceId, const ui64 seqNo, const ui16 partNo, TString *reason) const { if (sourceId != SourceId || seqNo != SeqNo || partNo != NextPartNo) { TStringBuilder s; diff --git a/ydb/core/persqueue/blob.h b/ydb/core/persqueue/blob.h index 633ec2499a3..62a974ea8b5 100644 --- a/ydb/core/persqueue/blob.h +++ b/ydb/core/persqueue/blob.h @@ -12,7 +12,7 @@ namespace NKikimr { namespace NPQ { -void CheckBlob(const TKey& key, const TString& blob); +void CheckBlob(const TKey& key, const TString& blob); struct TPartData { ui16 PartNo; @@ -34,9 +34,9 @@ struct TClientBlob { static const ui8 HAS_US = 8; static const ui8 HAS_KINESIS = 16; - TString SourceId; + TString SourceId; ui64 SeqNo; - TString Data; + TString Data; TMaybe<TPartData> PartData; TInstant WriteTimestamp; TInstant CreateTimestamp; @@ -98,7 +98,7 @@ struct TClientBlob { }; -//TBatch represents several clientBlobs. Can be in unpacked state(TVector<TClientBlob> blobs) +//TBatch represents several clientBlobs. Can be in unpacked state(TVector<TClientBlob> blobs) //or packed(PackedData) //on disk representation: //<ui16 size><serialized proto header><payload> @@ -109,15 +109,15 @@ struct TClientBlob { struct TBatch { bool Packed; - TVector<TClientBlob> Blobs; - TVector<ui32> InternalPartsPos; + TVector<TClientBlob> Blobs; + TVector<ui32> InternalPartsPos; NKikimrPQ::TBatchHeader Header; - TString PackedData; + TString PackedData; TBatch() : Packed(false) {} - TBatch(const ui64 offset, const ui16 partNo, const TVector<TClientBlob>& blobs) + TBatch(const ui64 offset, const ui16 partNo, const TVector<TClientBlob>& blobs) : Packed(false) { Header.SetOffset(offset); @@ -185,11 +185,11 @@ struct TBatch { ui32 GetPackedSize() const { Y_VERIFY(Packed); return sizeof(ui16) + PackedData.size() + Header.ByteSize(); } void Pack(); void Unpack(); - void UnpackTo(TVector<TClientBlob> *result); - void UnpackToType0(TVector<TClientBlob> *result); - void UnpackToType1(TVector<TClientBlob> *result); + void UnpackTo(TVector<TClientBlob> *result); + void UnpackToType0(TVector<TClientBlob> *result); + void UnpackToType1(TVector<TClientBlob> *result); - TString Serialize(); + TString Serialize(); ui32 FindPos(const ui64 offset, const ui16 partNo) const; @@ -197,7 +197,7 @@ struct TBatch { class TBlobIterator { public: - TBlobIterator(const TKey& key, const TString& blob); + TBlobIterator(const TKey& key, const TString& blob); //return true is there is batch bool IsValid(); //get next batch and return false if there is no next batch @@ -257,11 +257,11 @@ public: TPartitionedBlob(const TPartitionedBlob& x); - TPartitionedBlob(const ui32 partition, const ui64 offset, const TString& sourceId, const ui64 seqNo, + TPartitionedBlob(const ui32 partition, const ui64 offset, const TString& sourceId, const ui64 seqNo, const ui16 totalParts, const ui32 totalSize, THead& head, THead& newHead, bool headCleared, bool needCompactHead, const ui32 maxBlobSize); - std::pair<TKey, TString> Add(TClientBlob&& blob); + std::pair<TKey, TString> Add(TClientBlob&& blob); bool IsInited() const { return !SourceId.empty(); } @@ -272,13 +272,13 @@ public: ui64 GetOffset() const { return Offset; } ui16 GetHeadPartNo() const { return HeadPartNo; } - bool IsNextPart(const TString& sourceId, const ui64 seqNo, const ui16 partNo, TString *reason) const; + bool IsNextPart(const TString& sourceId, const ui64 seqNo, const ui16 partNo, TString *reason) const; const std::deque<TClientBlob>& GetClientBlobs() const { return Blobs; } const std::deque<std::pair<TKey, ui32>> GetFormedBlobs() const { return FormedBlobs; } private: - TString CompactHead(bool glueHead, THead& head, bool glueNewHead, THead& newHead, ui32 estimatedSize); + TString CompactHead(bool glueHead, THead& head, bool glueNewHead, THead& newHead, ui32 estimatedSize); private: ui32 Partition; @@ -286,7 +286,7 @@ private: ui16 InternalPartsCount; ui64 StartOffset; ui16 StartPartNo; - TString SourceId; + TString SourceId; ui64 SeqNo; ui16 TotalParts; ui32 TotalSize; diff --git a/ydb/core/persqueue/cache_eviction.h b/ydb/core/persqueue/cache_eviction.h index 07ae210f852..12d8785b91c 100644 --- a/ydb/core/persqueue/cache_eviction.h +++ b/ydb/core/persqueue/cache_eviction.h @@ -56,7 +56,7 @@ namespace NPQ { ui64 CookiePQ; ui32 Partition; ui32 MetadataWritesCount; - TVector<TRequestedBlob> Blobs; + TVector<TRequestedBlob> Blobs; TKvRequest(ERequestType type, TActorId sender, ui64 cookie, ui32 partition) : Type(type) @@ -123,8 +123,8 @@ namespace NPQ { {} virtual void SaveHeadBlob(const TBlobId& blob) = 0; - virtual void SaveUserOffset(TString client, ui32 partition, ui64 offset) = 0; - virtual TDeque<TBlobId> BlobsToTouch() const = 0; + virtual void SaveUserOffset(TString client, ui32 partition, ui64 offset) = 0; + virtual TDeque<TBlobId> BlobsToTouch() const = 0; }; class TCacheStrategyKeepUsed : public TCacheEvictionStrategy { @@ -143,7 +143,7 @@ namespace NPQ { Head.pop_front(); } - virtual void SaveUserOffset(TString client, ui32 partition, ui64 offset) override + virtual void SaveUserOffset(TString client, ui32 partition, ui64 offset) override { Y_UNUSED(client); Y_UNUSED(partition); @@ -153,14 +153,14 @@ namespace NPQ { #endif } - virtual TDeque<TBlobId> BlobsToTouch() const override + virtual TDeque<TBlobId> BlobsToTouch() const override { return Head; } private: ui32 HeadBlobsCount; - TDeque<TBlobId> Head; + TDeque<TBlobId> Head; }; /// Intablet (L1) cache logic @@ -192,7 +192,7 @@ namespace NPQ { TCacheValue::TWeakPtr Blob; }; - using TMapType = THashMap<TBlobId, TValueL1>; + using TMapType = THashMap<TBlobId, TValueL1>; struct TCounters { ui64 SizeBytes = 0; @@ -230,18 +230,18 @@ namespace NPQ { } }; - TIntabletCache(TString topicName, ui32 l1Size) + TIntabletCache(TString topicName, ui32 l1Size) : TopicName(topicName) , L1Strategy(nullptr) { Y_UNUSED(l1Size); } - const TMapType& CachedMap() const { return Cache; } + const TMapType& CachedMap() const { return Cache; } ui64 GetSize() const { return Cache.size(); } const TCounters& GetCounters() const { return Counters; } - void SetUserOffset(const TActorContext& ctx, TString client, ui32 partition, ui64 offset) + void SetUserOffset(const TActorContext& ctx, TString client, ui32 partition, ui64 offset) { if (L1Strategy) { LOG_DEBUG_S(ctx, NKikimrServices::PERSQUEUE, "Setting reader offset. User: " @@ -303,7 +303,7 @@ namespace NPQ { ctx.Send(MakePersQueueL2CacheID(), l2Request.Release()); // -> L2 } - void SavePrefetchBlobs(const TActorContext& ctx, const TKvRequest& kvReq, const TVector<bool>& store) + void SavePrefetchBlobs(const TActorContext& ctx, const TKvRequest& kvReq, const TVector<bool>& store) { Y_VERIFY(store.size() == kvReq.Blobs.size()); @@ -373,7 +373,7 @@ namespace NPQ { if (L1Strategy) { THolder<TCacheL2Request> reqData = MakeHolder<TCacheL2Request>(TopicName); - TDeque<TBlobId> needTouch = L1Strategy->BlobsToTouch(); + TDeque<TBlobId> needTouch = L1Strategy->BlobsToTouch(); PrepareTouch(ctx, reqData, needTouch); THolder<TEvPqCache::TEvCacheL2Request> l2Request = MakeHolder<TEvPqCache::TEvCacheL2Request>(reqData.Release()); @@ -382,7 +382,7 @@ namespace NPQ { } private: - void PrepareTouch(const TActorContext& ctx, THolder<TCacheL2Request>& reqData, const TDeque<TBlobId>& used) + void PrepareTouch(const TActorContext& ctx, THolder<TCacheL2Request>& reqData, const TDeque<TBlobId>& used) { for (auto& blob : used) { TCacheBlobL2 blobL2 = {blob.Partition, blob.Offset, blob.PartNo, nullptr}; @@ -443,7 +443,7 @@ namespace NPQ { void RemoveEvicted() { - TMapType actual; + TMapType actual; for (const auto& c: Cache) { auto ptr = c.second.GetBlob(); if (ptr) { @@ -456,12 +456,12 @@ namespace NPQ { } private: - TString TopicName; - TMapType Cache; + TString TopicName; + TMapType Cache; TCounters Counters; THolder<TCacheEvictionStrategy> L1Strategy; - void RemoveBlob(const TMapType::iterator& it) + void RemoveBlob(const TMapType::iterator& it) { Counters.Dec(it->second); Cache.erase(it); diff --git a/ydb/core/persqueue/config/config.cpp b/ydb/core/persqueue/config/config.cpp index 027fc5e64a8..40cf2a49012 100644 --- a/ydb/core/persqueue/config/config.cpp +++ b/ydb/core/persqueue/config/config.cpp @@ -3,7 +3,7 @@ #include <util/string/printf.h> namespace NKikimr { -bool CheckPersQueueConfig(const NKikimrPQ::TPQTabletConfig& config, const bool shouldHavePartitionsList, TString *error) { +bool CheckPersQueueConfig(const NKikimrPQ::TPQTabletConfig& config, const bool shouldHavePartitionsList, TString *error) { if (!config.HasPartitionConfig()) { if (error) *error = "no PartitionConfig"; @@ -20,7 +20,7 @@ bool CheckPersQueueConfig(const NKikimrPQ::TPQTabletConfig& config, const bool s return false; } - THashSet<ui32> parts; + THashSet<ui32> parts; for (const auto partitionId : partitionIds) { if (!parts.insert(partitionId).second) { if (error) diff --git a/ydb/core/persqueue/config/config.h b/ydb/core/persqueue/config/config.h index 86e11c8f327..de1f39c4822 100644 --- a/ydb/core/persqueue/config/config.h +++ b/ydb/core/persqueue/config/config.h @@ -3,6 +3,6 @@ namespace NKikimr { -bool CheckPersQueueConfig(const NKikimrPQ::TPQTabletConfig& config, const bool shouldHavePartitionsList = true, TString *error = nullptr); +bool CheckPersQueueConfig(const NKikimrPQ::TPQTabletConfig& config, const bool shouldHavePartitionsList = true, TString *error = nullptr); } // NKikimr diff --git a/ydb/core/persqueue/events/internal.h b/ydb/core/persqueue/events/internal.h index bc892988b47..6f5682cb205 100644 --- a/ydb/core/persqueue/events/internal.h +++ b/ydb/core/persqueue/events/internal.h @@ -20,12 +20,12 @@ namespace NPQ { ui32 Count; ui16 InternalPartsCount; ui32 Size; - TString Value; + TString Value; bool Cached; TRequestedBlob() = delete; - TRequestedBlob(ui64 offset, ui16 partNo, ui32 count, ui16 internalPartsCount, ui32 size, TString value) + TRequestedBlob(ui64 offset, ui16 partNo, ui32 count, ui16 internalPartsCount, ui32 size, TString value) : Offset(offset) , PartNo(partNo) , Count(count) @@ -38,7 +38,7 @@ namespace NPQ { struct TErrorInfo { NPersQueue::NErrorCode::EErrorCode ErrorCode; - TString ErrorStr; + TString ErrorStr; TErrorInfo() : ErrorCode(NPersQueue::NErrorCode::OK) @@ -118,7 +118,7 @@ struct TEvPQ { struct TEvWrite : public TEventLocal<TEvWrite, EvWrite> { struct TMsg { - TString SourceId; + TString SourceId; ui64 SeqNo; ui16 PartNo; ui16 TotalParts; @@ -127,7 +127,7 @@ struct TEvPQ { ui64 ReceiveTimestamp; bool DisableDeduplication; ui64 WriteTimestamp; - TString Data; + TString Data; ui32 UncompressedSize; TString PartitionKey; TString ExplicitHashKey; @@ -145,9 +145,9 @@ struct TEvPQ { ui64 Cookie; ui64 MessageNo; - TString OwnerCookie; + TString OwnerCookie; TMaybe<ui64> Offset; - TVector<TMsg> Msgs; + TVector<TMsg> Msgs; bool IsDirectWrite; }; @@ -183,8 +183,8 @@ struct TEvPQ { ui64 Offset; ui16 PartNo; ui32 Count; - TString SessionId; - TString ClientId; + TString SessionId; + TString ClientId; ui32 Timeout; ui32 Size; ui32 MaxTimeLagMs; @@ -200,29 +200,29 @@ struct TEvPQ { {} TActorId Sender; - TString Query; + TString Query; }; struct TEvGetMaxSeqNoRequest : public TEventLocal<TEvGetMaxSeqNoRequest, EvGetMaxSeqNoRequest> { - TEvGetMaxSeqNoRequest(const ui64 cookie, const TVector<TString>& sourceIds) + TEvGetMaxSeqNoRequest(const ui64 cookie, const TVector<TString>& sourceIds) : Cookie(cookie) , SourceIds(sourceIds) {} ui64 Cookie; - TVector<TString> SourceIds; + TVector<TString> SourceIds; }; struct TEvMonResponse : public TEventLocal<TEvMonResponse, EvMonResponse> { - TEvMonResponse(ui32 partition, const TVector<TString>& res, const TString& str) + TEvMonResponse(ui32 partition, const TVector<TString>& res, const TString& str) : Partition(partition) , Res(res) , Str(str) {} ui32 Partition; - TVector<TString> Res; - TString Str; + TVector<TString> Res; + TString Str; }; @@ -249,7 +249,7 @@ struct TEvPQ { } ui64 Cookie; - TString ClientId; + TString ClientId; ui64 Offset; TString SessionId; ui32 Generation; @@ -265,7 +265,7 @@ struct TEvPQ { {} ui64 Cookie; - TString ClientId; + TString ClientId; }; @@ -287,7 +287,7 @@ struct TEvPQ { {} TActorId Sender; - TString ClientId; + TString ClientId; }; struct TEvPartitionOffsetsResponse : public TEventLocal<TEvPartitionOffsetsResponse, EvPartitionOffsetsResponse> { @@ -341,13 +341,13 @@ struct TEvPQ { {} NPersQueue::NErrorCode::EErrorCode ErrorCode; - TString Error; + TString Error; ui64 Cookie; }; struct TEvBlobRequest : public TEventLocal<TEvBlobRequest, EvBlobRequest> { - TEvBlobRequest(const TString& user, const ui64 cookie, const ui32 partition, const ui64 readOffset, - TVector<NPQ::TRequestedBlob>&& blobs) + TEvBlobRequest(const TString& user, const ui64 cookie, const ui32 partition, const ui64 readOffset, + TVector<NPQ::TRequestedBlob>&& blobs) : User(user) , Cookie(cookie) , Partition(partition) @@ -355,18 +355,18 @@ struct TEvPQ { , Blobs(std::move(blobs)) {} - TString User; + TString User; ui64 Cookie; ui32 Partition; ui64 ReadOffset; - TVector<NPQ::TRequestedBlob> Blobs; + TVector<NPQ::TRequestedBlob> Blobs; }; class TEvBlobResponse : public TEventLocal<TEvBlobResponse, EvBlobResponse> { public: NPQ::TErrorInfo Error; - TEvBlobResponse(const ui64 cookie, TVector<NPQ::TRequestedBlob>&& blobs, NPQ::TErrorInfo error = NPQ::TErrorInfo()) + TEvBlobResponse(const ui64 cookie, TVector<NPQ::TRequestedBlob>&& blobs, NPQ::TErrorInfo error = NPQ::TErrorInfo()) : Error(error) , Cookie(cookie) , Blobs(std::move(blobs)) @@ -377,7 +377,7 @@ struct TEvPQ { return Cookie; } - const TVector<NPQ::TRequestedBlob>& GetBlobs() const + const TVector<NPQ::TRequestedBlob>& GetBlobs() const { return Blobs; } @@ -391,7 +391,7 @@ struct TEvPQ { private: ui64 Cookie; - TVector<NPQ::TRequestedBlob> Blobs; + TVector<NPQ::TRequestedBlob> Blobs; }; struct TEvChangeOwner : public TEventLocal<TEvChangeOwner, EvChangeOwner> { @@ -443,7 +443,7 @@ struct TEvPQ { , Config(config) {} - TString TopicName; + TString TopicName; NKikimrPQ::TPQTabletConfig Config; }; diff --git a/ydb/core/persqueue/internals_ut.cpp b/ydb/core/persqueue/internals_ut.cpp index d72ffe5e11e..1dcf16170b0 100644 --- a/ydb/core/persqueue/internals_ut.cpp +++ b/ydb/core/persqueue/internals_ut.cpp @@ -19,7 +19,7 @@ Y_UNIT_TEST(TestPartitionedBlobSimpleTest) { TPartitionedBlob blob(0, 0, "sourceId", 1, 1, 10, head, newHead, false, false, 8 << 20); TClientBlob clientBlob("sourceId", 1, "valuevalue", TMaybe<TPartData>(), TInstant::MilliSeconds(1), TInstant::MilliSeconds(1), 0, "123", "123"); UNIT_ASSERT(blob.IsInited()); - TString error; + TString error; UNIT_ASSERT(blob.IsNextPart("sourceId", 1, 0, &error)); blob.Add(std::move(clientBlob)); @@ -30,12 +30,12 @@ Y_UNIT_TEST(TestPartitionedBlobSimpleTest) { void Test(bool headCompacted, ui32 parts, ui32 partSize, ui32 leftInHead) { - TVector<TClientBlob> all; + TVector<TClientBlob> all; THead head; head.Offset = 100; - TString value(102400, 'a'); - head.Batches.push_back(TBatch(head.Offset, 0, TVector<TClientBlob>())); + TString value(102400, 'a'); + head.Batches.push_back(TBatch(head.Offset, 0, TVector<TClientBlob>())); for (ui32 i = 0; i < 50; ++i) { head.Batches.back().AddBlob(TClientBlob( "sourceId" + TString(1,'a' + rand() % 26), i + 1, value, TMaybe<TPartData>(), @@ -48,7 +48,7 @@ void Test(bool headCompacted, ui32 parts, ui32 partSize, ui32 leftInHead) UNIT_ASSERT(head.Batches.back().Header.GetFormat() == NKikimrPQ::TBatchHeader::ECompressed); head.Batches.back().Unpack(); head.Batches.back().Pack(); - TString str = head.Batches.back().Serialize(); + TString str = head.Batches.back().Serialize(); auto header = ExtractHeader(str.c_str(), str.size()); TBatch batch(header, str.c_str() + header.ByteSize() + sizeof(ui16)); batch.Unpack(); @@ -57,7 +57,7 @@ void Test(bool headCompacted, ui32 parts, ui32 partSize, ui32 leftInHead) UNIT_ASSERT(head.Batches.back().GetUnpackedSize() + GetMaxHeaderSize() >= head.Batches.back().GetPackedSize()); THead newHead; newHead.Offset = head.GetNextOffset(); - newHead.Batches.push_back(TBatch(newHead.Offset, 0, TVector<TClientBlob>())); + newHead.Batches.push_back(TBatch(newHead.Offset, 0, TVector<TClientBlob>())); for (ui32 i = 0; i < 10; ++i) { newHead.Batches.back().AddBlob(TClientBlob( "sourceId2", i + 1, value, TMaybe<TPartData>(), @@ -66,13 +66,13 @@ void Test(bool headCompacted, ui32 parts, ui32 partSize, ui32 leftInHead) all.push_back(newHead.Batches.back().Blobs.back()); //newHead always glued } newHead.PackedSize = newHead.Batches.back().GetUnpackedSize(); - TString value2(partSize, 'b'); + TString value2(partSize, 'b'); ui32 maxBlobSize = 8 << 20; TPartitionedBlob blob(0, newHead.GetNextOffset(), "sourceId3", 1, parts, parts * value2.size(), head, newHead, headCompacted, false, maxBlobSize); - TVector<std::pair<TKey, TString>> formed; + TVector<std::pair<TKey, TString>> formed; - TString error; + TString error; for (ui32 i = 0; i < parts; ++i) { UNIT_ASSERT(!blob.IsComplete()); UNIT_ASSERT(blob.IsNextPart("sourceId3", 1, i, &error)); @@ -94,7 +94,7 @@ void Test(bool headCompacted, ui32 parts, ui32 partSize, ui32 leftInHead) UNIT_ASSERT(formed[i].second.size() <= 8 * 1024 * 1024); UNIT_ASSERT(formed[i].second.size() > 6 * 1024 * 1024); } - TVector<TClientBlob> real; + TVector<TClientBlob> real; ui32 nextOffset = headCompacted ? newHead.Offset : head.Offset; for (auto& p : formed) { const char* data = p.second.c_str(); @@ -168,7 +168,7 @@ Y_UNIT_TEST(TestPartitionedBigTest) { } Y_UNIT_TEST(TestBatchPacking) { - TString value(10, 'a'); + TString value(10, 'a'); TBatch batch; for (ui32 i = 0; i < 100; ++i) { batch.AddBlob(TClientBlob( @@ -177,12 +177,12 @@ Y_UNIT_TEST(TestBatchPacking) { )); } batch.Pack(); - TString s = batch.PackedData; + TString s = batch.PackedData; UNIT_ASSERT(batch.Header.GetFormat() == NKikimrPQ::TBatchHeader::ECompressed); batch.Unpack(); batch.Pack(); UNIT_ASSERT(batch.PackedData == s); - TString str = batch.Serialize(); + TString str = batch.Serialize(); auto header = ExtractHeader(str.c_str(), str.size()); TBatch batch2(header, str.c_str() + header.ByteSize() + sizeof(ui16)); batch2.Unpack(); diff --git a/ydb/core/persqueue/key.h b/ydb/core/persqueue/key.h index 098c67cf7d9..b771c823141 100644 --- a/ydb/core/persqueue/key.h +++ b/ydb/core/persqueue/key.h @@ -117,7 +117,7 @@ public: { } - TKey(const TString& data) + TKey(const TString& data) { Assign(data.data(), data.size()); Y_VERIFY(data.size() == KeySize() + IsHead()); @@ -140,8 +140,8 @@ public: virtual ~TKey() {} - TString ToString() const { - return TString(Data(), Size()); + TString ToString() const { + return TString(Data(), Size()); } void SetHead(const bool isHead) { diff --git a/ydb/core/persqueue/partition.cpp b/ydb/core/persqueue/partition.cpp index cc8e2419cf2..50334f7d9ba 100644 --- a/ydb/core/persqueue/partition.cpp +++ b/ydb/core/persqueue/partition.cpp @@ -323,7 +323,7 @@ void TPartition::ReplyGetClientOffsetOk(const TActorContext& ctx, const ui64 dst static void RequestRange(const TActorContext& ctx, const TActorId& dst, ui32 partition, - TKeyPrefix::EType c, bool includeData = false, const TString& key = "", bool dropTmp = false) + TKeyPrefix::EType c, bool includeData = false, const TString& key = "", bool dropTmp = false) { THolder<TEvKeyValue::TEvRequest> request(new TEvKeyValue::TEvRequest); auto read = request->Record.AddCmdReadRange(); @@ -523,8 +523,8 @@ TPartition::TPartition(ui64 tabletId, ui32 partition, const TActorId& tablet, co void TPartition::HandleMonitoring(TEvPQ::TEvMonRequest::TPtr& ev, const TActorContext& ctx) { - TVector<TString> res; - TString str; + TVector<TString> res; + TString str; if (CurrentStateFunc() == &TThis::StateInit) { str = "State is StateInit"; } else if (CurrentStateFunc() == &TThis::StateIdle) { @@ -1376,7 +1376,7 @@ void TPartition::HandleInfoRangeRead(const NKikimrClient::TKeyValueResponse::TRe { //megaqc check here all results Y_VERIFY(range.HasStatus()); - const TString *key = nullptr; + const TString *key = nullptr; switch (range.GetStatus()) { case NKikimrProto::OK: case NKikimrProto::OVERRUN: @@ -1463,7 +1463,7 @@ void TPartition::FormHeadAndProceed(const TActorContext& ctx) { Head.Offset = EndOffset; Head.PartNo = 0; - TVector<TString> keys; + TVector<TString> keys; while (DataKeysBody.size() > 0 && DataKeysBody.back().Key.IsHead()) { Y_VERIFY(DataKeysBody.back().Key.GetOffset() + DataKeysBody.back().Key.GetCount() == Head.Offset); //no gaps in head allowed HeadKeys.push_front(DataKeysBody.back()); @@ -1650,10 +1650,10 @@ void TPartition::InitComplete(const TActorContext& ctx) { ss << "SYNC INIT sourceId " << s.first << " seqNo " << s.second.SeqNo << " offset " << s.second.Offset << "\n"; } for (const auto& h : DataKeysBody) { - ss << "SYNC INIT DATA KEY: " << TString(h.Key.Data(), h.Key.Size()) << " size " << h.Size << "\n"; + ss << "SYNC INIT DATA KEY: " << TString(h.Key.Data(), h.Key.Size()) << " size " << h.Size << "\n"; } for (const auto& h : HeadKeys) { - ss << "SYNC INIT HEAD KEY: " << TString(h.Key.Data(), h.Key.Size()) << " size " << h.Size << "\n"; + ss << "SYNC INIT HEAD KEY: " << TString(h.Key.Data(), h.Key.Size()) << " size " << h.Size << "\n"; } LOG_DEBUG_S(ctx, NKikimrServices::PERSQUEUE, ss); @@ -1753,7 +1753,7 @@ THashMap<TString, NKikimr::NPQ::TOwnerInfo>::iterator TPartition::DropOwner(THas void TPartition::InitUserInfoForImportantClients(const TActorContext& ctx) { - TSet<TString> important; + TSet<TString> important; for (const auto& importantUser : Config.GetPartitionConfig().GetImportantClientId()) { important.insert(importantUser); TUserInfo* userInfo = UsersInfoStorage.GetIfExists(importantUser); @@ -2142,7 +2142,7 @@ void TPartition::Handle(TEvPQ::TEvUpdateWriteTimestamp::TPtr& ev, const TActorCo void TPartition::Handle(TEvPQ::TEvSetClientInfo::TPtr& ev, const TActorContext& ctx) { - const TString& user = ev->Get()->ClientId; + const TString& user = ev->Get()->ClientId; auto& userInfo = UsersInfoStorage.GetOrCreate(user, ctx); if (userInfo.UserActs.size() > MAX_USER_ACTS) { @@ -2315,7 +2315,7 @@ TReadAnswer TReadInfo::FormAnswer( ui32 cnt = 0, pcnt = 0; ui32 size = 0, psize = 0; - const TVector<TRequestedBlob>& blobs = response->GetBlobs(); + const TVector<TRequestedBlob>& blobs = response->GetBlobs(); Y_VERIFY(blobs.size() == Blobs.size()); response->Check(); @@ -2328,7 +2328,7 @@ TReadAnswer TReadInfo::FormAnswer( ui32 count = blobs[pos].Count; ui16 partNo = blobs[pos].PartNo; ui16 internalPartsCount = blobs[pos].InternalPartsCount; - const TString& blobValue = blobs[pos].Value; + const TString& blobValue = blobs[pos].Value; if (blobValue.empty()) { // this is ok. Means that someone requested too much data LOG_DEBUG(ctx, NKikimrServices::PERSQUEUE, "Not full answer here!"); @@ -2478,7 +2478,7 @@ TVector<TRequestedBlob> TPartition::GetReadRequestFromBody(const ui64 startOffse ui32& count = *rcount; ui32& size = *rsize; count = size = 0; - TVector<TRequestedBlob> blobs; + TVector<TRequestedBlob> blobs; if (!DataKeysBody.empty() && (Head.Offset > startOffset || Head.Offset == startOffset && Head.PartNo > partNo)) { //will read smth from body auto it = std::upper_bound(DataKeysBody.begin(), DataKeysBody.end(), std::make_pair(startOffset, partNo), [](const std::pair<ui64, ui16>& offsetAndPartNo, const TDataKey& p) { return offsetAndPartNo.first < p.Key.GetOffset() || offsetAndPartNo.first == p.Key.GetOffset() && offsetAndPartNo.second < p.Key.GetPartNo();}); @@ -2524,7 +2524,7 @@ TVector<TClientBlob> TPartition::GetReadRequestFromHead(const ui64 startOffset, { ui32& count = *rcount; ui32& size = *rsize; - TVector<TClientBlob> res; + TVector<TClientBlob> res; std::optional<ui64> firstAddedBlobOffset{}; ui32 pos = 0; if (startOffset > Head.Offset || startOffset == Head.Offset && partNo > Head.PartNo) { @@ -2534,7 +2534,7 @@ TVector<TClientBlob> TPartition::GetReadRequestFromHead(const ui64 startOffset, for (;pos < Head.Batches.size(); ++pos) { - TVector<TClientBlob> blobs; + TVector<TClientBlob> blobs; Head.Batches[pos].UnpackTo(&blobs); ui32 i = 0; ui64 offset = Head.Batches[pos].GetOffset(); @@ -2914,7 +2914,7 @@ void TPartition::ProcessTimestampRead(const TActorContext& ctx) { ReadingForOffset = 0; ReadingForUserReadRuleGeneration = 0; while (!ReadingTimestamp && !UpdateUserInfoTimestamp.empty()) { - TString user = UpdateUserInfoTimestamp.front(); + TString user = UpdateUserInfoTimestamp.front(); UpdateUserInfoTimestamp.pop_front(); auto userInfo = UsersInfoStorage.GetIfExists(user); if (!userInfo || !userInfo->ReadScheduled) @@ -3378,7 +3378,7 @@ void TPartition::HandleSetOffsetResponse(NKikimrClient::TResponse& response, con ui64 cookie = response.GetCookie(); auto it = CookieToUser.find(cookie); Y_VERIFY(it != CookieToUser.end()); - TString user = it->second; + TString user = it->second; CookieToUser.erase(it); TUserInfo* userInfo = UsersInfoStorage.GetIfExists(user); @@ -3535,7 +3535,7 @@ void TPartition::HandleWriteResponse(const TActorContext& ctx) { SyncMemoryStateWithKVState(ctx); //if EndOffset changed there could be subscriptions witch could be completed - TVector<std::pair<TReadInfo, ui64>> reads = Subscriber.GetReads(EndOffset); + TVector<std::pair<TReadInfo, ui64>> reads = Subscriber.GetReads(EndOffset); for (auto& read : reads) { Y_VERIFY(EndOffset > read.first.Offset); ProcessRead(ctx, std::move(read.first), read.second, true); @@ -4120,7 +4120,7 @@ bool TPartition::AppendHeadWithNewWrites(TEvKeyValue::TEvRequest* request, const LOG_DEBUG_S(ctx, NKikimrServices::PERSQUEUE, "Topic '" << TopicName << "' partition " << Partition << " part blob processing sourceId '" << EscapeC(p.Msg.SourceId) << "' seqNo " << p.Msg.SeqNo << " partNo " << p.Msg.PartNo); - TString s; + TString s; if (!PartitionedBlob.IsNextPart(p.Msg.SourceId, p.Msg.SeqNo, p.Msg.PartNo, &s)) { //this must not be happen - client sends gaps, fail this client till the end CancelAllWritesOnWrite(ctx, request, s, p, sourceIdWriter); @@ -4159,7 +4159,7 @@ bool TPartition::AppendHeadWithNewWrites(TEvKeyValue::TEvRequest* request, const bool lastBlobPart = blob.IsLastPart(); //will return compacted tmp blob - std::pair<TKey, TString> newWrite = PartitionedBlob.Add(std::move(blob)); + std::pair<TKey, TString> newWrite = PartitionedBlob.Add(std::move(blob)); if (!newWrite.second.empty()) { auto write = request->Record.AddCmdWrite(); @@ -4190,7 +4190,7 @@ bool TPartition::AppendHeadWithNewWrites(TEvKeyValue::TEvRequest* request, const TKey key(request->Record.GetCmdWrite(i).GetKey()); if (key.GetType() == TKeyPrefix::TypeTmpData) { key.SetType(TKeyPrefix::TypeData); - request->Record.MutableCmdWrite(i)->SetKey(TString(key.Data(), key.Size())); + request->Record.MutableCmdWrite(i)->SetKey(TString(key.Data(), key.Size())); ++curWrites; } } @@ -4201,9 +4201,9 @@ bool TPartition::AppendHeadWithNewWrites(TEvKeyValue::TEvRequest* request, const if (i + curWrites < formedBlobs.size()) { //this KV pair is already writed, rename needed auto rename = request->Record.AddCmdRename(); TKey key = x.first; - rename->SetOldKey(TString(key.Data(), key.Size())); + rename->SetOldKey(TString(key.Data(), key.Size())); key.SetType(TKeyPrefix::TypeData); - rename->SetNewKey(TString(key.Data(), key.Size())); + rename->SetNewKey(TString(key.Data(), key.Size())); } if (!DataKeysBody.empty() && CompactedKeys.empty()) { Y_VERIFY(DataKeysBody.back().Key.GetOffset() + DataKeysBody.back().Key.GetCount() <= x.first.GetOffset(), @@ -4225,7 +4225,7 @@ bool TPartition::AppendHeadWithNewWrites(TEvKeyValue::TEvRequest* request, const ui32 countOfLastParts = 0; for (auto& x : PartitionedBlob.GetClientBlobs()) { if (NewHead.Batches.empty() || NewHead.Batches.back().Packed) { - NewHead.Batches.emplace_back(curOffset, x.GetPartNo(), TVector<TClientBlob>()); + NewHead.Batches.emplace_back(curOffset, x.GetPartNo(), TVector<TClientBlob>()); NewHead.PackedSize += GetMaxHeaderSize(); //upper bound for packed size } if (x.IsLastPart()) { @@ -4259,7 +4259,7 @@ bool TPartition::AppendHeadWithNewWrites(TEvKeyValue::TEvRequest* request, const ++curOffset; PartitionedBlob = TPartitionedBlob(Partition, 0, "", 0, 0, 0, Head, NewHead, true, false, MaxBlobSize); } - TString().swap(p.Msg.Data); + TString().swap(p.Msg.Data); pp.QuotedTime = WriteQuota.GetQuotedTime() - pp.QuotedTime; //change to duration pp.QueueTime = ctx.Now().MilliSeconds() - pp.QueueTime; pp.WriteTime = ctx.Now().MilliSeconds(); @@ -4326,7 +4326,7 @@ std::pair<TKey, ui32> TPartition::GetNewWriteKey(bool headCleared) void TPartition::AddNewWriteBlob(std::pair<TKey, ui32>& res, TEvKeyValue::TEvRequest* request, bool headCleared, const TActorContext& ctx) { const auto& key = res.first; - TString valueD; + TString valueD; valueD.reserve(res.second); ui32 pp = Head.FindPos(key.GetOffset(), key.GetPartNo()); if (pp < Max<ui32>() && key.GetOffset() < EndOffset) { //this batch trully contains this offset diff --git a/ydb/core/persqueue/partition.h b/ydb/core/persqueue/partition.h index 2eec26f2516..b7abbc416c6 100644 --- a/ydb/core/persqueue/partition.h +++ b/ydb/core/persqueue/partition.h @@ -170,7 +170,7 @@ private: void FilterDeadlinedWrites(const TActorContext& ctx); void SetDeadlinesForWrites(const TActorContext& ctx); - void ReadTimestampForOffset(const TString& user, TUserInfo& ui, const TActorContext& ctx); + void ReadTimestampForOffset(const TString& user, TUserInfo& ui, const TActorContext& ctx); void ProcessTimestampsForNewData(const ui64 prevEndOffset, const TActorContext& ctx); void ReportLabeledCounters(const TActorContext& ctx); ui64 GetSizeLag(i64 offset); @@ -188,7 +188,7 @@ private: void CancelAllWritesOnIdle(const TActorContext& ctx); //additional contaiters are half-filled, need to clear them too struct TWriteMsg; // forward - void CancelAllWritesOnWrite(const TActorContext& ctx, TEvKeyValue::TEvRequest* request, const TString& errorStr, + void CancelAllWritesOnWrite(const TActorContext& ctx, TEvKeyValue::TEvRequest* request, const TString& errorStr, const TWriteMsg& p, TSourceIdWriter& sourceIdWriter, NPersQueue::NErrorCode::EErrorCode errorCode); @@ -243,7 +243,7 @@ public: private: template <typename TEv> - TString EventStr(const char * func, const TEv& ev) { + TString EventStr(const char * func, const TEv& ev) { TStringStream ss; ss << func << " event# " << ev->GetTypeRewrite() << " (" << ev->GetBase()->ToStringHeader() << "), Tablet " << Tablet << ", Partition " << Partition << ", Sender " << ev->Sender.ToString() << ", Recipient " << ev->Recipient.ToString() << ", Cookie: " << ev->Cookie; @@ -407,7 +407,7 @@ private: struct TUserCookie { - TString User; + TString User; ui64 Cookie; }; @@ -415,7 +415,7 @@ private: ui64 TabletID; ui32 Partition; NKikimrPQ::TPQTabletConfig Config; - TString TopicName; + TString TopicName; TString TopicPath; bool LocalDC; TString DCId; @@ -558,7 +558,7 @@ private: ui32 MaxWriteResponsesSize; std::deque<TDataKey> DataKeysBody; - TVector<TKeyLevel> DataKeysHead; + TVector<TKeyLevel> DataKeysHead; std::deque<TDataKey> HeadKeys; std::deque<std::pair<ui64,ui64>> GapOffsets; @@ -570,16 +570,16 @@ private: TUsersInfoStorage UsersInfoStorage; - std::deque<TString> UpdateUserInfoTimestamp; + std::deque<TString> UpdateUserInfoTimestamp; bool ReadingTimestamp; - TString ReadingForUser; + TString ReadingForUser; ui64 ReadingForUserReadRuleGeneration; ui64 ReadingForOffset; - THashMap<ui64, TString> CookieToUser; + THashMap<ui64, TString> CookieToUser; ui64 SetOffsetCookie; - THashMap<ui64, TReadInfo> ReadInfo; // cookie -> {...} + THashMap<ui64, TReadInfo> ReadInfo; // cookie -> {...} ui64 Cookie; TInstant CreationTime; TDuration InitDuration; @@ -610,8 +610,8 @@ private: bool DiskIsFull; - TSet<THasDataReq> HasDataRequests; - TSet<THasDataDeadline> HasDataDeadlines; + TSet<THasDataReq> HasDataRequests; + TSet<THasDataDeadline> HasDataDeadlines; ui64 HasDataReqNum; TQuotaTracker WriteQuota; diff --git a/ydb/core/persqueue/pq_impl.cpp b/ydb/core/persqueue/pq_impl.cpp index 9937dbe561c..9d753e4aef5 100644 --- a/ydb/core/persqueue/pq_impl.cpp +++ b/ydb/core/persqueue/pq_impl.cpp @@ -22,7 +22,7 @@ namespace NKikimr { namespace NPQ { -const TString TMP_REQUEST_MARKER = "__TMP__REQUEST__MARKER__"; +const TString TMP_REQUEST_MARKER = "__TMP__REQUEST__MARKER__"; const ui32 CACHE_SIZE = 100 << 20; //100mb per tablet by default const ui32 MAX_BYTES = 25 * 1024 * 1024; const TDuration TOTAL_TIMEOUT = TDuration::Seconds(120); @@ -50,7 +50,7 @@ struct TPartitionInfo { TMaybe<TPartitionKeyRange> KeyRange; bool InitDone; TTabletCountersBase Baseline; - THashMap<TString, TTabletLabeledCountersBase> LabeledCounters; + THashMap<TString, TTabletLabeledCountersBase> LabeledCounters; }; struct TChangeNotification { @@ -293,12 +293,12 @@ public: const TActorId Sender; const TActorId Tablet; - const TString TopicName; + const TString TopicName; const ui32 Partition; const ui64 MessageNo; ui32 CounterId; ui32 Waiting; - const TString ReqId; + const TString ReqId; THolder<TEvPersQueue::TEvResponse> Response; TInstant Timestamp; bool WasSplit; @@ -387,7 +387,7 @@ private: ui64 TabletId; TActorId Sender; ui32 Waiting; - TVector<typename T2::TPartResult> Result; + TVector<typename T2::TPartResult> Result; }; @@ -521,14 +521,14 @@ private: } TActorId Sender; - TString Query; - TMap<ui32, TVector<TString>> Results; - TVector<TString> Str; + TString Query; + TMap<ui32, TVector<TString>> Results; + TVector<TString> Str; TMap<ui32, TActorId> Partitions; TActorId Cache; ui32 TotalRequests; ui32 TotalResponses; - TString TopicName; + TString TopicName; ui64 TabletID; ui32 Inflight; }; @@ -562,7 +562,7 @@ void TPersQueue::FillMeteringParams(const TActorContext& ctx) void TPersQueue::ApplyNewConfigAndReply(const TActorContext& ctx) { - THashSet<ui32> was; + THashSet<ui32> was; if (NewConfig.PartitionsSize()) { for (const auto& partition : NewConfig.GetPartitions()) { was.insert(partition.GetPartitionId()); @@ -876,7 +876,7 @@ void TPersQueue::Handle(TEvPQ::TEvPartitionCounters::TPtr& ev, const TActorConte } -void TPersQueue::AggregateAndSendLabeledCountersFor(const TString& group, const TActorContext& ctx) +void TPersQueue::AggregateAndSendLabeledCountersFor(const TString& group, const TActorContext& ctx) { if (CounterEventsInflight[group].RefCount() <= 1) { if (CounterEventsInflight[group].RefCount() == 0) { @@ -907,7 +907,7 @@ void TPersQueue::Handle(TEvPQ::TEvPartitionLabeledCounters::TPtr& ev, const TAct { auto it = Partitions.find(ev->Get()->Partition); Y_VERIFY(it != Partitions.end()); - const TString& group = ev->Get()->LabeledCounters.GetGroup(); + const TString& group = ev->Get()->LabeledCounters.GetGroup(); it->second.LabeledCounters[group] = ev->Get()->LabeledCounters; Y_UNUSED(ctx); // if uncommented, all changes will be reported immediatly @@ -980,7 +980,7 @@ void TPersQueue::Handle(TEvPQ::TEvProxyResponse::TPtr& ev, const TActorContext& } -void TPersQueue::FinishResponse(THashMap<ui64, TAutoPtr<TResponseBuilder>>::iterator it) +void TPersQueue::FinishResponse(THashMap<ui64, TAutoPtr<TResponseBuilder>>::iterator it) { // ctx.Send(Tablet, new TEvPQ::TEvCompleteResponse(Sender, CounterId, , Response.Release())); Counters->Percentile()[it->second->CounterId].IncrementFor((TAppData::TimeProvider->Now() - it->second->Timestamp).MilliSeconds()); @@ -1133,7 +1133,7 @@ void TPersQueue::ProcessUpdateConfigRequest(TAutoPtr<TEvPersQueue::TEvUpdateConf << " Config update version " << cfg.GetVersion() << "(current " << Config.GetVersion() << ") received from actor " << sender << " txId " << record.GetTxId() << " config:\n" << cfg.DebugString()); - TString str; + TString str; Y_VERIFY(CheckPersQueueConfig(cfg, true, &str), "%s", str.c_str()); @@ -1190,7 +1190,7 @@ void TPersQueue::Handle(TEvPersQueue::TEvDropTablet::TPtr& ev, const TActorConte NKikimrPQ::TTabletState stateProto; stateProto.SetState(record.GetRequestedState()); - TString strState; + TString strState; bool ok = stateProto.SerializeToString(&strState); Y_VERIFY(ok); @@ -1299,7 +1299,7 @@ void TPersQueue::HandleGetMaxSeqNoRequest(const ui64 responseCookie, const TActo Y_VERIFY(req.HasCmdGetMaxSeqNo()); InitResponseBuilder(responseCookie, 1, COUNTER_LATENCY_PQ_GET_MAX_SEQ_NO); const auto& cmd = req.GetCmdGetMaxSeqNo(); - TVector<TString> ids; + TVector<TString> ids; ids.reserve(cmd.SourceIdSize()); for (ui32 i = 0; i < cmd.SourceIdSize(); ++i) ids.push_back(cmd.GetSourceId(i)); @@ -1411,7 +1411,7 @@ void TPersQueue::HandleWriteRequest(const ui64 responseCookie, const TActorId& p CurrentPutUnitsQuantity += req.GetPutUnitsSize(); } - TVector <TEvPQ::TEvWrite::TMsg> msgs; + TVector <TEvPQ::TEvWrite::TMsg> msgs; bool mirroredPartition = Config.GetPartitionConfig().HasMirrorFrom(); @@ -1456,7 +1456,7 @@ void TPersQueue::HandleWriteRequest(const ui64 responseCookie, const TActorId& p it->second.Inc(cmd.ByteSize()); } - TString errorStr = ""; + TString errorStr = ""; if (!cmd.HasSeqNo() && !req.GetIsDirectWrite()) { errorStr = "no SeqNo"; } else if (!cmd.HasData() || cmd.GetData().empty()){ @@ -1521,7 +1521,7 @@ void TPersQueue::HandleWriteRequest(const ui64 responseCookie, const TActorId& p } Y_VERIFY(!cmd.HasTotalParts(), "too big part"); //change this verify for errorStr, when LB will be ready while (pos < totalSize) { - TString data = cmd.GetData().substr(pos, mSize - diff); + TString data = cmd.GetData().substr(pos, mSize - diff); pos += mSize - diff; diff = 0; msgs.push_back({cmd.GetSourceId(), static_cast<ui64>(cmd.GetSeqNo()), partNo, @@ -1790,7 +1790,7 @@ void TPersQueue::HandleSplitMessageGroupRequest(ui64 responseCookie, const TActo void TPersQueue::Handle(TEvPersQueue::TEvRequest::TPtr& ev, const TActorContext& ctx) { NKikimrClient::TPersQueueRequest& request = ev->Get()->Record; - TString s = request.HasRequestId() ? request.GetRequestId() : "<none>"; + TString s = request.HasRequestId() ? request.GetRequestId() : "<none>"; ui32 p = request.HasPartitionRequest() && request.GetPartitionRequest().HasPartition() ? request.GetPartitionRequest().GetPartition() : 0; ui64 m = request.HasPartitionRequest() && request.GetPartitionRequest().HasMessageNo() ? request.GetPartitionRequest().GetMessageNo() : 0; TMaybe<ui64> c; @@ -2025,7 +2025,7 @@ void TPersQueue::Handle(TEvInterconnect::TEvNodeInfo::TPtr& ev, const TActorCont } void TPersQueue::HandleWakeup(const TActorContext& ctx) { - THashSet<TString> groups; + THashSet<TString> groups; for (auto& p : Partitions) { for (auto& m : p.second.LabeledCounters) { groups.insert(m.first); diff --git a/ydb/core/persqueue/pq_impl.h b/ydb/core/persqueue/pq_impl.h index bc3bfb10ba5..70e4b995a18 100644 --- a/ydb/core/persqueue/pq_impl.h +++ b/ydb/core/persqueue/pq_impl.h @@ -36,7 +36,7 @@ class TPersQueue : public NKeyValue::TKeyValueFlat { void InitResponseBuilder(const ui64 responseCookie, const ui32 count, const ui32 counterId); void Handle(TEvPQ::TEvError::TPtr& ev, const TActorContext&); void Handle(TEvPQ::TEvProxyResponse::TPtr& ev, const TActorContext&); - void FinishResponse(THashMap<ui64, TAutoPtr<TResponseBuilder>>::iterator it); + void FinishResponse(THashMap<ui64, TAutoPtr<TResponseBuilder>>::iterator it); void Handle(TEvInterconnect::TEvNodeInfo::TPtr& ev, const TActorContext&); @@ -51,7 +51,7 @@ class TPersQueue : public NKeyValue::TKeyValueFlat { void Handle(TEvPQ::TEvPartitionLabeledCounters::TPtr& ev, const TActorContext&); void Handle(TEvPQ::TEvPartitionLabeledCountersDrop::TPtr& ev, const TActorContext&); - void AggregateAndSendLabeledCountersFor(const TString& group, const TActorContext&); + void AggregateAndSendLabeledCountersFor(const TString& group, const TActorContext&); void Handle(TEvPQ::TEvTabletCacheCounters::TPtr& ev, const TActorContext&); void SetCacheCounters(TEvPQ::TEvTabletCacheCounters::TCacheCounters& cacheCounters); @@ -135,16 +135,16 @@ public: private: bool ConfigInited; ui32 PartitionsInited; - THashMap<ui32, TPartitionInfo> Partitions; - THashMap<TString, TIntrusivePtr<TEvTabletCounters::TInFlightCookie>> CounterEventsInflight; + THashMap<ui32, TPartitionInfo> Partitions; + THashMap<TString, TIntrusivePtr<TEvTabletCounters::TInFlightCookie>> CounterEventsInflight; TActorId CacheActor; - TSet<TChangeNotification> ChangeConfigNotification; + TSet<TChangeNotification> ChangeConfigNotification; NKikimrPQ::TPQTabletConfig NewConfig; bool NewConfigShouldBeApplied; - TString TopicName; + TString TopicName; TString TopicPath; bool LocalDC; TString DCId; @@ -152,16 +152,16 @@ private: NKikimrPQ::TPQTabletConfig Config; NKikimrPQ::ETabletState TabletState; - TSet<TChangeNotification> TabletStateRequests; + TSet<TChangeNotification> TabletStateRequests; TAutoPtr<TTabletCountersBase> Counters; TEvPQ::TEvTabletCacheCounters::TCacheCounters CacheCounters; TMap<TString, NKikimr::NPQ::TMultiCounter> BytesWrittenFromDC; - THashMap<TString, TTabletLabeledCountersBase> LabeledCounters; + THashMap<TString, TTabletLabeledCountersBase> LabeledCounters; - TVector<TAutoPtr<TEvPersQueue::TEvHasDataInfo>> HasDataRequests; + TVector<TAutoPtr<TEvPersQueue::TEvHasDataInfo>> HasDataRequests; TVector<std::pair<TAutoPtr<TEvPersQueue::TEvUpdateConfig>, TActorId> > UpdateConfigRequests; struct TPipeInfo { @@ -173,7 +173,7 @@ private: THashMap<TActorId, TPipeInfo> PipesInfo; ui64 NextResponseCookie; - THashMap<ui64, TAutoPtr<TResponseBuilder>> ResponseProxy; + THashMap<ui64, TAutoPtr<TResponseBuilder>> ResponseProxy; NMetrics::TResourceMetrics *ResourceMetrics; diff --git a/ydb/core/persqueue/pq_l2_cache.cpp b/ydb/core/persqueue/pq_l2_cache.cpp index e56642c39ae..79a9fa068d4 100644 --- a/ydb/core/persqueue/pq_l2_cache.cpp +++ b/ydb/core/persqueue/pq_l2_cache.cpp @@ -26,7 +26,7 @@ void TPersQueueCacheL2::Bootstrap(const TActorContext& ctx) void TPersQueueCacheL2::Handle(TEvPqCache::TEvCacheL2Request::TPtr& ev, const TActorContext& ctx) { THolder<TCacheL2Request> request(ev->Get()->Data.Release()); - TString topicName = request->TopicName; + TString topicName = request->TopicName; Y_VERIFY(topicName.size(), "PQ L2. Empty topic name in L2"); @@ -35,13 +35,13 @@ void TPersQueueCacheL2::Handle(TEvPqCache::TEvCacheL2Request::TPtr& ev, const TA RemoveBlobs(ctx, topicName, request->RemovedBlobs); RegretBlobs(ctx, topicName, request->MissedBlobs); - THashMap<TKey, TCacheValue::TPtr> evicted; + THashMap<TKey, TCacheValue::TPtr> evicted; AddBlobs(ctx, topicName, request->StoredBlobs, evicted); SendResponses(ctx, evicted); } -void TPersQueueCacheL2::SendResponses(const TActorContext& ctx, const THashMap<TKey, TCacheValue::TPtr>& evictedBlobs) +void TPersQueueCacheL2::SendResponses(const TActorContext& ctx, const THashMap<TKey, TCacheValue::TPtr>& evictedBlobs) { TInstant now = TAppData::TimeProvider->Now(); THashMap<TActorId, THolder<TCacheL2Response>> responses; @@ -73,8 +73,8 @@ void TPersQueueCacheL2::SendResponses(const TActorContext& ctx, const THashMap<T } /// @return outRemoved - map of evicted items. L1 should be noticed about them -void TPersQueueCacheL2::AddBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, - THashMap<TKey, TCacheValue::TPtr>& outEvicted) +void TPersQueueCacheL2::AddBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, + THashMap<TKey, TCacheValue::TPtr>& outEvicted) { ui32 numUnused = 0; for (const TCacheBlobL2& blob : blobs) { @@ -126,7 +126,7 @@ void TPersQueueCacheL2::AddBlobs(const TActorContext& ctx, TString topic, const } } -void TPersQueueCacheL2::RemoveBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs) +void TPersQueueCacheL2::RemoveBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs) { ui32 numEvicted = 0; ui32 numUnused = 0; @@ -156,7 +156,7 @@ void TPersQueueCacheL2::RemoveBlobs(const TActorContext& ctx, TString topic, con } } -void TPersQueueCacheL2::TouchBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, bool isHit) +void TPersQueueCacheL2::TouchBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, bool isHit) { TInstant now = TAppData::TimeProvider->Now(); @@ -184,7 +184,7 @@ void TPersQueueCacheL2::TouchBlobs(const TActorContext& ctx, TString topic, cons } } -void TPersQueueCacheL2::RegretBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs) +void TPersQueueCacheL2::RegretBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs) { for (const TCacheBlobL2& blob : blobs) { LOG_DEBUG_S(ctx, NKikimrServices::PERSQUEUE, "PQ Cache (L2). Missed blob. Topic '" << topic @@ -200,18 +200,18 @@ void TPersQueueCacheL2::Handle(NMon::TEvHttpInfo::TPtr& ev, const TActorContext& { const auto& params = ev->Get()->Request.GetParams(); if (params.Has("submit")) { - TString strParam = params.Get("newCacheLimit"); + TString strParam = params.Get("newCacheLimit"); if (strParam.size()) { ui32 valueMb = atoll(strParam.data()); MaxSize = SizeInBytes(valueMb); // will be applyed at next AddBlobs } } - TString html = HttpForm(); + TString html = HttpForm(); ctx.Send(ev->Sender, new NMon::TEvHttpInfoRes(html)); } -TString TPersQueueCacheL2::HttpForm() const +TString TPersQueueCacheL2::HttpForm() const { TStringStream str; HTML(str) { diff --git a/ydb/core/persqueue/pq_l2_cache.h b/ydb/core/persqueue/pq_l2_cache.h index f9fcccbc8ed..42aadb0eb25 100644 --- a/ydb/core/persqueue/pq_l2_cache.h +++ b/ydb/core/persqueue/pq_l2_cache.h @@ -43,12 +43,12 @@ struct TL2Counters { class TPersQueueCacheL2 : public TActorBootstrapped<TPersQueueCacheL2> { public: struct TKey { - TString TopicName; + TString TopicName; ui32 Partition; ui64 Offset; ui16 PartNo; - TKey(TString topicName, const TCacheBlobL2& blob) + TKey(TString topicName, const TCacheBlobL2& blob) : TopicName(topicName) , Partition(blob.Partition) , Offset(blob.Offset) @@ -110,13 +110,13 @@ private: void Handle(NMon::TEvHttpInfo::TPtr& ev, const TActorContext& ctx); void Handle(TEvPqCache::TEvCacheL2Request::TPtr& ev, const TActorContext& ctx); - void SendResponses(const TActorContext& ctx, const THashMap<TKey, TCacheValue::TPtr>& evicted); + void SendResponses(const TActorContext& ctx, const THashMap<TKey, TCacheValue::TPtr>& evicted); - void AddBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, - THashMap<TKey, TCacheValue::TPtr>& outEvicted); - void RemoveBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs); - void TouchBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, bool isHit = true); - void RegretBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs); + void AddBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, + THashMap<TKey, TCacheValue::TPtr>& outEvicted); + void RemoveBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs); + void TouchBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs, bool isHit = true); + void RegretBlobs(const TActorContext& ctx, TString topic, const TVector<TCacheBlobL2>& blobs); static ui64 SizeInBytes(ui64 maxSizeMB) { static const ui64 MIN_SIZE = 32; @@ -133,7 +133,7 @@ private: TDuration RetentionTime; TL2Counters Counters; - TString HttpForm() const; + TString HttpForm() const; }; } // NPQ diff --git a/ydb/core/persqueue/pq_l2_service.h b/ydb/core/persqueue/pq_l2_service.h index a9c5eefd164..ccd31714cdd 100644 --- a/ydb/core/persqueue/pq_l2_service.h +++ b/ydb/core/persqueue/pq_l2_service.h @@ -47,7 +47,7 @@ struct TCacheValue : TNonCopyable { return AccessCount; } - TString GetValue() const { + TString GetValue() const { return Value; } @@ -60,7 +60,7 @@ struct TCacheValue : TNonCopyable { } private: - const TString Value; + const TString Value; const TActorId Owner; std::atomic<ui64> AccessTime; std::atomic<ui32> AccessCount; @@ -74,15 +74,15 @@ struct TCacheBlobL2 { }; struct TCacheL2Request { - TString TopicName; + TString TopicName; ui64 Cookie; - TVector<TCacheBlobL2> RequestedBlobs; - TVector<TCacheBlobL2> StoredBlobs; - TVector<TCacheBlobL2> RemovedBlobs; - TVector<TCacheBlobL2> ExpectedBlobs; - TVector<TCacheBlobL2> MissedBlobs; + TVector<TCacheBlobL2> RequestedBlobs; + TVector<TCacheBlobL2> StoredBlobs; + TVector<TCacheBlobL2> RemovedBlobs; + TVector<TCacheBlobL2> ExpectedBlobs; + TVector<TCacheBlobL2> MissedBlobs; - explicit TCacheL2Request(TString topicName) + explicit TCacheL2Request(TString topicName) : TopicName(topicName) , Cookie(0) {} @@ -90,9 +90,9 @@ struct TCacheL2Request { struct TCacheL2Response { ui64 Cookie = 0; - TString TopicName; + TString TopicName; bool Overload = false; - TVector<TCacheBlobL2> Removed; + TVector<TCacheBlobL2> Removed; }; diff --git a/ydb/core/persqueue/pq_ut.cpp b/ydb/core/persqueue/pq_ut.cpp index 13a61229105..82d32c2e16f 100644 --- a/ydb/core/persqueue/pq_ut.cpp +++ b/ydb/core/persqueue/pq_ut.cpp @@ -563,7 +563,7 @@ Y_UNIT_TEST(TestSeveralOwners) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; TString s{32, 'c'}; ui32 pp = 4 + 8 + 1 + 9; @@ -595,7 +595,7 @@ Y_UNIT_TEST(TestWaitInOwners) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; TString s{32, 'c'}; ui32 pp = 4 + 8 + 1 + 9; @@ -691,7 +691,7 @@ Y_UNIT_TEST(TestReserveBytes) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; TString s{32, 'c'}; ui32 pp = 4 + 8 + 1 + 9; @@ -744,7 +744,7 @@ Y_UNIT_TEST(TestMessageNo) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); activeZone = false; @@ -752,9 +752,9 @@ Y_UNIT_TEST(TestMessageNo) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; - TString s{32, 'c'}; + TString s{32, 'c'}; ui32 pp = 4 + 8 + 1 + 9; data.push_back({1, s.substr(pp)}); data.push_back({2, s.substr(pp)}); @@ -796,7 +796,7 @@ Y_UNIT_TEST(TestPartitionedBlobFails) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); activeZone = false; @@ -804,18 +804,18 @@ Y_UNIT_TEST(TestPartitionedBlobFails) { PQTabletPrepare(20000000, 200 * 1024 * 1024, 0, {{"user1", true}}, tc); //one important client, never delete - TString ss{50*1024*1024, '_'}; + TString ss{50*1024*1024, '_'}; char k = 0; - TString s = ""; + TString s = ""; s += k; s += ss; s += char((1) % 256); ++k; - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; data.push_back({1, s}); - TVector<TString> parts; + TVector<TString> parts; ui32 size = 400*1024; ui32 diff = 50; for (ui32 pos = 0; pos < s.size();) { @@ -940,7 +940,7 @@ Y_UNIT_TEST(TestPartitionedBlobFails) { //check very big msg cookie = CmdSetOwner(0, tc).first; - WritePartData(0, "sourceidY", 13, 1, 0, 5, s.size(), TString{10*1024*1024, 'a'}, tc, cookie, 0); + WritePartData(0, "sourceidY", 13, 1, 0, 5, s.size(), TString{10*1024*1024, 'a'}, tc, cookie, 0); result = tc.Runtime->GrabEdgeEvent<TEvPersQueue::TEvResponse>(handle); @@ -956,7 +956,7 @@ Y_UNIT_TEST(TestAlreadyWritten) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); activeZone = false; @@ -964,9 +964,9 @@ Y_UNIT_TEST(TestAlreadyWritten) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob activeZone = true; - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; - TString s{32, 'c'}; + TString s{32, 'c'}; ui32 pp = 4 + 8 + 1 + 9; data.push_back({2, s.substr(pp)}); data.push_back({1, s.substr(pp)}); @@ -1008,7 +1008,7 @@ Y_UNIT_TEST(TestWritePQCompact) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); activeZone = false; @@ -1017,12 +1017,12 @@ Y_UNIT_TEST(TestWritePQCompact) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 2, 8 * 1024 * 1024 - 512 * 1024); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; - TString ss{1024*1024 - 100, '_'}; - TString s1{131072, 'a'}; - TString s2{2048, 'b'}; - TString s3{32, 'c'}; + TString ss{1024*1024 - 100, '_'}; + TString s1{131072, 'a'}; + TString s2{2048, 'b'}; + TString s3{32, 'c'}; ui32 pp = 4 + 8 + 2 + 9; for (ui32 i = 0; i < 8; ++i) { data.push_back({i + 1, ss.substr(pp)}); @@ -1065,7 +1065,7 @@ Y_UNIT_TEST(TestWritePQBigMessage) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); activeZone = false; @@ -1074,13 +1074,13 @@ Y_UNIT_TEST(TestWritePQBigMessage) { PQTabletPrepare(20000000, 1000 * 1024 * 1024, 0, {{"user1", true}}, tc, 2, 8 * 1024 * 1024 - 512 * 1024); //nothing dropped //no important clients, lifetimeseconds=0 - delete all right now, except last datablob - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; - TString ss{50*1024*1024 - 100 - 2, '_'}; - TString s1{400*1024 - 2, 'a'}; + TString ss{50*1024*1024 - 100 - 2, '_'}; + TString s1{400*1024 - 2, 'a'}; ui32 pp = 4 + 8 + 2 + 9; char k = 0; - TString s = ""; + TString s = ""; s += k; s += ss.substr(pp); s += char((1) % 256); @@ -1088,7 +1088,7 @@ Y_UNIT_TEST(TestWritePQBigMessage) { data.push_back({1, s}); for (ui32 i = 0; i < 25;++i) { - TString s = ""; + TString s = ""; s += k; s += s1.substr(pp); s += char((i + 2) % 256); @@ -1118,23 +1118,23 @@ Y_UNIT_TEST(TestWritePQ) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); tc.Runtime->SetScheduledLimit(100); PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user", true}}, tc); //important client, lifetimeseconds=0 - never delete - TVector<std::pair<ui64, TString>> data, data1, data2; + TVector<std::pair<ui64, TString>> data, data1, data2; activeZone = PlainOrSoSlow(true, false); - TString ss{1024*1024, '_'}; - TString s1{131072, 'a'}; - TString s2{2048, 'b'}; - TString s3{32, 'c'}; + TString ss{1024*1024, '_'}; + TString s1{131072, 'a'}; + TString s2{2048, 'b'}; + TString s3{32, 'c'}; ui32 pp = 4 + 8 + 2 + 9; - TString sb{15*1024*1024 + 512*1024, '_'}; + TString sb{15*1024*1024 + 512*1024, '_'}; data.push_back({1, sb.substr(pp)}); CmdWrite(0,"sourceid0", data, tc, false, {}, true, "", -1, 100); activeZone = false; @@ -1154,8 +1154,8 @@ Y_UNIT_TEST(TestWritePQ) { data.push_back({2, ss.substr(pp)}); CmdWrite(0,"sourceid4", data, tc); - TString a1{8*1024*1024 - 1024, '_'}; - TString a2{2*1024, '_'}; + TString a1{8*1024*1024 - 1024, '_'}; + TString a2{2*1024, '_'}; data.clear(); data.push_back({1, a1.substr(pp)}); data1.clear(); @@ -1189,7 +1189,7 @@ Y_UNIT_TEST(TestWritePQ) { CmdWrite(1,"sourceId9", data1, tc, false, {}, false, "", -1, 2000); //to other partition data1.clear(); - data1.push_back({1, TString{200, 'a'}}); + data1.push_back({1, TString{200, 'a'}}); for (ui32 i = 1; i <= NUM_WRITES; ++i) { data1.front().first = i; CmdWrite(1, "sourceidx", data1, tc, false, {}, false, "", -1); @@ -1209,17 +1209,17 @@ Y_UNIT_TEST(TestSourceIdDropByUserWrites) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); tc.Runtime->SetScheduledLimit(200); PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc); //no important client, lifetimeseconds=0 - delete right now - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; activeZone = true; - TString ss{32, '_'}; + TString ss{32, '_'}; data.push_back({1, ss}); CmdWrite(0,"sourceid0", data, tc, false, {}, false, "", -1, 100); @@ -1289,7 +1289,7 @@ Y_UNIT_TEST(TestWriteOffsetWithBigMessage) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); tc.Runtime->SetScheduledLimit(200); @@ -1298,15 +1298,15 @@ Y_UNIT_TEST(TestWriteOffsetWithBigMessage) { activeZone = false; - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; - data.push_back({1, TString{10*1024*1024, 'a'}}); + data.push_back({1, TString{10*1024*1024, 'a'}}); CmdWrite(1, "sourceIdx", data, tc, false, {}, false, "", -1, 80000); data.front().first = 2; CmdWrite(1, "sourceIdx", data, tc, false, {}, false, "", -1, 160000); data.clear(); - data.push_back({1, TString{100*1024, 'a'}}); + data.push_back({1, TString{100*1024, 'a'}}); for (ui32 i = 0; i < 100; ++i) { data.push_back(data.front()); data.back().first = i + 2; @@ -1324,7 +1324,7 @@ Y_UNIT_TEST(TestWriteSplit) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); activeZone = false; @@ -1333,7 +1333,7 @@ Y_UNIT_TEST(TestWriteSplit) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"user1", true}}, tc); //never delete const ui32 size = PlainOrSoSlow(2*1024*1024, 1*1024*1024); - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; data.push_back({1, TString{size, 'b'}}); data.push_back({2, TString{size, 'a'}}); activeZone = PlainOrSoSlow(true, false); @@ -1349,18 +1349,18 @@ Y_UNIT_TEST(TestLowWatermark) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); tc.Runtime->SetScheduledLimit(200); PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {}, tc, 2, 2 * 1024 * 1024); //no important clients, lifetimeseconds=0 - delete all right now, except last datablob - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; ui32 pp = 4 + 8 + 2 + 9; - TString ss{1024*1024, '_'}; + TString ss{1024*1024, '_'}; data.push_back({1, ss.substr(pp)}); data.push_back({2, ss.substr(pp)}); data.push_back({3, ss.substr(pp)}); @@ -1385,7 +1385,7 @@ Y_UNIT_TEST(TestWriteToFullPartition) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); activeZone = false; tc.Prepare(dispatchName, setup, activeZone); @@ -1394,10 +1394,10 @@ Y_UNIT_TEST(TestWriteToFullPartition) { PQTabletPrepare(11, 100 * 1024 * 1024, 0, {}, tc); - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; activeZone = PlainOrSoSlow(true, false); - TString s{32, 'c'}; + TString s{32, 'c'}; ui32 pp = 8 + 4 + 2 + 9; for (ui32 i = 0; i < 10; ++i) { data.push_back({i + 1, s.substr(pp)}); @@ -1429,7 +1429,7 @@ Y_UNIT_TEST(TestPQPartialRead) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete activeZone = false; - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; ui32 pp = 4 + 8 + 2 + 9 + 100 + 40; //pp is for size of meta TString tmp{1024*1024 - pp - 2, '-'}; @@ -1453,7 +1453,7 @@ Y_UNIT_TEST(TestPQRead) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); @@ -1462,13 +1462,13 @@ Y_UNIT_TEST(TestPQRead) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete activeZone = false; - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; ui32 pp = 4 + 8 + 2 + 9 + 100 + 40; //pp is for size of meta - TString tmp{1024*1024 - pp - 2, '-'}; + TString tmp{1024*1024 - pp - 2, '-'}; char k = 0; for (ui32 i = 0; i < 26 * 1024 * 1024;) { //3 full blobs and 2 in head - TString ss = ""; + TString ss = ""; ss += k; ss += tmp; ss += char((i + 1) % 256); @@ -1505,7 +1505,7 @@ Y_UNIT_TEST(TestPQSmallRead) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); @@ -1514,24 +1514,24 @@ Y_UNIT_TEST(TestPQSmallRead) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete activeZone = false; - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; ui32 pp = 4 + 8 + 2 + 9 ; //5 is for 8 blobs for header - TString tmp{32 - pp - 2, '-'}; + TString tmp{32 - pp - 2, '-'}; char k = 0; - TString ss = ""; + TString ss = ""; ss += k; ss += tmp; ss += char(1); data.push_back({1, ss}); CmdWrite(0, "sourceid0", data, tc, false, {}, true); - ++k; data[0].second = TString(1, k) + tmp + char(1); + ++k; data[0].second = TString(1, k) + tmp + char(1); CmdWrite(0, "sourceid1", data, tc, false, {}, false); - ++k; data[0].second = TString(1, k) + tmp + char(1); + ++k; data[0].second = TString(1, k) + tmp + char(1); CmdWrite(0, "sourceid2", data, tc, false, {}, false); - ++k; data[0].second = TString(1, k) + tmp + char(1); + ++k; data[0].second = TString(1, k) + tmp + char(1); CmdWrite(0, "sourceid3", data, tc, false, {}, false); - ++k; data[0].second = TString(1, k) + tmp + char(1); + ++k; data[0].second = TString(1, k) + tmp + char(1); CmdWrite(0, "sourceid4", data, tc, false, {}, false); PQGetPartInfo(0, 5, tc); @@ -1546,7 +1546,7 @@ Y_UNIT_TEST(TestPQReadAhead) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); activeZone = false; @@ -1555,14 +1555,14 @@ Y_UNIT_TEST(TestPQReadAhead) { PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; ui32 pp = 8 + 4 + 2 + 9; - TString tmp{1024*1024 - pp - 2, '-'}; - TString tmp0{32 - pp - 2, '-'}; + TString tmp{1024*1024 - pp - 2, '-'}; + TString tmp0{32 - pp - 2, '-'}; char k = 0; for (ui32 i = 0; i < 5; ++i) { - TString ss = ""; + TString ss = ""; ss += k; ss += tmp0; ss += char((i + 1) % 256); @@ -1570,7 +1570,7 @@ Y_UNIT_TEST(TestPQReadAhead) { data.push_back({i + 1, ss}); } for (ui32 i = 0; i < 17 * 1024 * 1024;) { //3 full blobs and 2 in head - TString ss = ""; + TString ss = ""; ss += k; ss += tmp; ss += char((i + 10) % 256); @@ -1593,7 +1593,7 @@ Y_UNIT_TEST(TestOwnership) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); @@ -1601,7 +1601,7 @@ Y_UNIT_TEST(TestOwnership) { PQTabletPrepare(10, 100 * 1024 * 1024, 0, {}, tc); - TString cookie, cookie2; + TString cookie, cookie2; cookie = CmdSetOwner(0, tc).first; UNIT_ASSERT(!cookie.empty()); cookie2 = CmdSetOwner(0, tc).first; @@ -1614,7 +1614,7 @@ Y_UNIT_TEST(TestSetClientOffset) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); tc.Runtime->SetScheduledLimit(50); @@ -1623,7 +1623,7 @@ Y_UNIT_TEST(TestSetClientOffset) { activeZone = true; - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; CmdSetOffset(0, "user1", 100, false, tc); //must be true , error CmdGetOffset(0, "user1", 0, tc); // must be -1 @@ -1653,7 +1653,7 @@ Y_UNIT_TEST(TestReadSessions) { activeZone = true; - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; CmdCreateSession(0, "user1", "session1", tc); CmdSetOffset(0, "user1", 0, false, tc, "session1"); //all ok - session is set CmdSetOffset(0, "user1", 0, true, tc, "other_session"); //fails - session1 is active @@ -1683,7 +1683,7 @@ Y_UNIT_TEST(TestGetTimestamps) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); tc.Runtime->SetScheduledLimit(50); @@ -1693,11 +1693,11 @@ Y_UNIT_TEST(TestGetTimestamps) { PQTabletPrepare(10, 100 * 1024 * 1024, 0, {{"user1", false}}, tc); - TVector<std::pair<ui64, TString>> data; - data.push_back({1, TString(1024, 'a')}); - data.push_back({2, TString(1024, 'a')}); - data.push_back({3, TString(1024, 'a')}); - data.push_back({4, TString(1024, 'a')}); + TVector<std::pair<ui64, TString>> data; + data.push_back({1, TString(1024, 'a')}); + data.push_back({2, TString(1024, 'a')}); + data.push_back({3, TString(1024, 'a')}); + data.push_back({4, TString(1024, 'a')}); CmdWrite(0, "sourceid0", data, tc, false, {}, true, "", -1, 1); CmdGetOffset(0, "user1", 0, tc, -1); @@ -1736,20 +1736,20 @@ Y_UNIT_TEST(TestChangeConfig) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); activeZone = false; tc.Prepare(dispatchName, setup, activeZone); activeZone = false; tc.Runtime->SetScheduledLimit(50); - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; ui32 pp = 8 + 4 + 2 + 9; - TString tmp0{32 - pp - 2, '-'}; + TString tmp0{32 - pp - 2, '-'}; char k = 0; for (ui32 i = 0; i < 5; ++i) { - TString ss = ""; + TString ss = ""; ss += k; ss += tmp0; ss += char((i + 1) % 256); @@ -1771,20 +1771,20 @@ Y_UNIT_TEST(TestReadSubscription) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); activeZone = false; tc.Runtime->SetScheduledLimit(600); tc.Runtime->SetScheduledEventFilter(&tc.ImmediateLogFlushAndRequestTimeoutFilter); - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; ui32 pp = 8 + 4 + 2 + 9; - TString tmp0{32 - pp - 2, '-'}; + TString tmp0{32 - pp - 2, '-'}; char k = 0; for (ui32 i = 0; i < 5; ++i) { - TString ss = ""; + TString ss = ""; ss += k; ss += tmp0; ss += char((i + 1) % 256); @@ -1869,7 +1869,7 @@ Y_UNIT_TEST(TestPQCacheSizeManagement) { TTestContext tc; RunTestWithReboots(tc.TabletIds, [&]() { return tc.InitialEventsFilter.Prepare(); - }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { + }, [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) { TFinalizer finalizer(tc); tc.Prepare(dispatchName, setup, activeZone); @@ -1878,13 +1878,13 @@ Y_UNIT_TEST(TestPQCacheSizeManagement) { activeZone = false; PQTabletPrepare(20000000, 100 * 1024 * 1024, 0, {{"aaa", true}}, tc); //important client - never delete - TVector<std::pair<ui64, TString>> data; + TVector<std::pair<ui64, TString>> data; ui32 pp = 4 + 8 + 2 + 9 + 100; - TString tmp{1024*1024 - pp - 2, '-'}; + TString tmp{1024*1024 - pp - 2, '-'}; char k = 0; for (ui32 i = 0; i < 26 * 1024 * 1024;) { - TString ss = ""; + TString ss = ""; ss += k; ss += tmp; ss += char((i + 1) % 256); diff --git a/ydb/core/persqueue/read.h b/ydb/core/persqueue/read.h index d0bc79c6929..b778662feb5 100644 --- a/ydb/core/persqueue/read.h +++ b/ydb/core/persqueue/read.h @@ -70,9 +70,9 @@ namespace NPQ { return false; } - TVector<TKvRequest> RemoveFromProgress(const TActorContext& ctx, const TKvRequest& blocker) + TVector<TKvRequest> RemoveFromProgress(const TActorContext& ctx, const TKvRequest& blocker) { - TVector<TKvRequest> unblocked; + TVector<TKvRequest> unblocked; for (const TRequestedBlob& reqBlob : blocker.Blobs) { TBlobId blob(blocker.Partition, reqBlob.Offset, reqBlob.PartNo, reqBlob.Count, reqBlob.InternalPartsCount); ReadsInProgress.erase(blob); @@ -163,7 +163,7 @@ namespace NPQ { void OnKvReadResult(TEvKeyValue::TEvResponse::TPtr& ev, const TActorContext& ctx, TKvRequest& kvReq) { auto resp = ev->Get()->Record; - TVector<TRequestedBlob>& outBlobs = kvReq.Blobs; + TVector<TRequestedBlob>& outBlobs = kvReq.Blobs; ui32 cachedCount = std::accumulate(outBlobs.begin(), outBlobs.end(), 0u, [](ui32 sum, const TRequestedBlob& blob) { return sum + (blob.Value.empty() ? 0 : 1); @@ -182,7 +182,7 @@ namespace NPQ { "Unexpected KV read result size %" PRIu64 " for cached %" PRIu32 "/%" PRIu64 " blobs, proto %s", resp.ReadResultSize(), cachedCount, outBlobs.size(), ev->Get()->ToString().data()); - TVector<bool> kvBlobs(outBlobs.size(), false); + TVector<bool> kvBlobs(outBlobs.size(), false); ui32 pos = 0; for (ui32 i = 0; i < resp.ReadResultSize(); ++i, ++pos) { auto r = resp.MutableReadResult(i); @@ -216,7 +216,7 @@ namespace NPQ { Cache.SavePrefetchBlobs(ctx, kvReq, kvBlobs); } - TVector<TKvRequest> unblockedReads = RemoveFromProgress(ctx, kvReq); // before kvReq.MakePQResponse() + TVector<TKvRequest> unblockedReads = RemoveFromProgress(ctx, kvReq); // before kvReq.MakePQResponse() THolder<TEvPQ::TEvBlobResponse> response = kvReq.MakePQResponse(ctx, error); response->Check(); @@ -268,12 +268,12 @@ namespace NPQ { for (ui32 i = 0; i < srcRequest.CmdWriteSize(); ++i) { auto cmd = srcRequest.GetCmdWrite(i); if (cmd.HasKeyToCache()) { - TString strKey = cmd.GetKeyToCache(); + TString strKey = cmd.GetKeyToCache(); TKey key = TKey(strKey); Y_VERIFY(!key.IsHead()); Y_VERIFY(strKey.size() == TKey::KeySize(), "Unexpected key size: %" PRIu64, strKey.size()); - TString value = cmd.GetValue(); + TString value = cmd.GetValue(); kvReq.Partition = key.GetPartition(); TRequestedBlob blob(key.GetOffset(), key.GetPartNo(), key.GetCount(), key.GetInternalPartsCount(), value.size(), value); kvReq.Blobs.push_back(blob); @@ -343,7 +343,7 @@ namespace NPQ { } } } - ctx.Send(ev->Sender, new TEvPQ::TEvMonResponse(Max<ui32>(), TVector<TString>(), out.Str())); + ctx.Send(ev->Sender, new TEvPQ::TEvMonResponse(Max<ui32>(), TVector<TString>(), out.Str())); } void UpdateCounters(const TActorContext& ctx) @@ -379,12 +379,12 @@ namespace NPQ { } TActorId Tablet; - TString TopicName; + TString TopicName; ui64 Cookie; // any TKvRequest would be placed into KvRequests or into BlockedReads depending on ReadsInProgress content - THashMap<ui64, TKvRequest> KvRequests; - THashMap<TBlobId, TVector<TKvRequest>> BlockedReads; - THashSet<TBlobId> ReadsInProgress; + THashMap<ui64, TKvRequest> KvRequests; + THashMap<TBlobId, TVector<TKvRequest>> BlockedReads; + THashSet<TBlobId> ReadsInProgress; TIntabletCache Cache; TInstant CountersUpdateTime; }; diff --git a/ydb/core/persqueue/read_balancer.cpp b/ydb/core/persqueue/read_balancer.cpp index 4eb9c7206dd..67e91ba11c7 100644 --- a/ydb/core/persqueue/read_balancer.cpp +++ b/ydb/core/persqueue/read_balancer.cpp @@ -471,7 +471,7 @@ void TPersQueueReadBalancer::Handle(TEvPersQueue::TEvUpdateBalancerConfig::TPtr TotalGroups = record.HasTotalGroupCount() ? record.GetTotalGroupCount() : 0; ui32 prevNextPartitionId = NextPartitionId; NextPartitionId = record.HasNextPartitionId() ? record.GetNextPartitionId() : 0; - THashMap<ui32, TPartitionInfo> partitionsInfo; + THashMap<ui32, TPartitionInfo> partitionsInfo; Consumers.clear(); for (const auto& rr : TabletConfig.GetReadRules()) { @@ -479,7 +479,7 @@ void TPersQueueReadBalancer::Handle(TEvPersQueue::TEvUpdateBalancerConfig::TPtr } TVector<std::pair<ui32, TPartInfo>> newPartitions; - TVector<ui32> deletedPartitions; + TVector<ui32> deletedPartitions; TVector<std::pair<ui64, TTabletInfo>> newTablets; TVector<std::pair<ui32, ui32>> newGroups; diff --git a/ydb/core/persqueue/read_balancer.h b/ydb/core/persqueue/read_balancer.h index 6a07edcb784..396d0f17abc 100644 --- a/ydb/core/persqueue/read_balancer.h +++ b/ydb/core/persqueue/read_balancer.h @@ -147,7 +147,7 @@ class TPersQueueReadBalancer : public TActor<TPersQueueReadBalancer>, public TTa struct TTxWrite : public ITransaction { TPersQueueReadBalancer * const Self; - TVector<ui32> DeletedPartitions; + TVector<ui32> DeletedPartitions; TVector<std::pair<ui32, TPartInfo>> NewPartitions; TVector<std::pair<ui64, TTabletInfo>> NewTablets; TVector<std::pair<ui32, ui32>> NewGroups; @@ -377,7 +377,7 @@ class TPersQueueReadBalancer : public TActor<TPersQueueReadBalancer>, public TTa bool WakeupScheduled = false; }; - THashMap<ui32, TPartitionInfo> PartitionsInfo; + THashMap<ui32, TPartitionInfo> PartitionsInfo; THashMap<ui32, TVector<ui32>> GroupsInfo; THashMap<ui64, TTabletInfo> TabletsInfo; @@ -418,7 +418,7 @@ class TPersQueueReadBalancer : public TActor<TPersQueueReadBalancer>, public TTa THashMap<ui64, TActorId> TabletPipes; - THashSet<ui64> WaitingForStat; + THashSet<ui64> WaitingForStat; bool WaitingForACL; ui64 TotalAvgSpeedSec; ui64 MaxAvgSpeedSec; diff --git a/ydb/core/persqueue/subscriber.cpp b/ydb/core/persqueue/subscriber.cpp index 641c566a1c9..733d405ac5f 100644 --- a/ydb/core/persqueue/subscriber.cpp +++ b/ydb/core/persqueue/subscriber.cpp @@ -27,9 +27,9 @@ void TSubscriberLogic::AddSubscription(TReadInfo&& info, const ui64 cookie) Y_VERIFY(res); } -TVector<std::pair<TReadInfo, ui64>> TSubscriberLogic::CompleteSubscriptions(const ui64 endOffset) +TVector<std::pair<TReadInfo, ui64>> TSubscriberLogic::CompleteSubscriptions(const ui64 endOffset) { - TVector<std::pair<TReadInfo, ui64>> res; + TVector<std::pair<TReadInfo, ui64>> res; while (!WaitingReads.empty()) { const ui64& offset = WaitingReads.front().Offset; const ui64& cookie = WaitingReads.front().Cookie; @@ -73,7 +73,7 @@ void TSubscriber::AddSubscription(TReadInfo&& info, const ui32 timeout, const ui ctx.Schedule(TDuration::MilliSeconds(timeout), new TEvPQ::TEvReadTimeout(cookie)); } -TVector<std::pair<TReadInfo, ui64>> TSubscriber::GetReads(const ui64 endOffset) { +TVector<std::pair<TReadInfo, ui64>> TSubscriber::GetReads(const ui64 endOffset) { auto res = Subscriber.CompleteSubscriptions(endOffset); Counters.Cumulative()[COUNTER_PQ_READ_SUBSCRIPTION_OK].Increment(res.size()); return res; diff --git a/ydb/core/persqueue/subscriber.h b/ydb/core/persqueue/subscriber.h index 7bbfe41e1f2..4b1206a6bed 100644 --- a/ydb/core/persqueue/subscriber.h +++ b/ydb/core/persqueue/subscriber.h @@ -18,7 +18,7 @@ struct TReadAnswer { }; struct TReadInfo { - TString User; + TString User; TString ClientDC; ui64 Offset; ui16 PartNo; @@ -31,9 +31,9 @@ struct TReadInfo { bool IsSubscription; - TVector<TRequestedBlob> Blobs; //offset, count, value + TVector<TRequestedBlob> Blobs; //offset, count, value ui64 CachedOffset; //offset of head can be bigger than last databody offset - TVector<TClientBlob> Cached; //records from head + TVector<TClientBlob> Cached; //records from head TReadInfo() = delete; TReadInfo( @@ -79,7 +79,7 @@ struct TReadInfo { const ui64 dst, const ui64 sizeLag ) { - TEvPQ::TEvBlobResponse response(0, TVector<TRequestedBlob>()); + TEvPQ::TEvBlobResponse response(0, TVector<TRequestedBlob>()); return FormAnswer(ctx, response, endOffset, partition, ui, dst, sizeLag); } }; @@ -101,9 +101,9 @@ public: TMaybe<TReadInfo> ForgetSubscription(const ui64 cookie); //form TReadInfo::Cached with new data and return ready reads - TVector<std::pair<TReadInfo, ui64>> CompleteSubscriptions(const ui64 endOffset); + TVector<std::pair<TReadInfo, ui64>> CompleteSubscriptions(const ui64 endOffset); private: - THashMap<ui64, TReadInfo> ReadInfo; // cookie -> {...} + THashMap<ui64, TReadInfo> ReadInfo; // cookie -> {...} std::deque<TOffsetCookie> WaitingReads; }; @@ -119,7 +119,7 @@ public: TMaybe<TReadInfo> OnTimeout(TEvPQ::TEvReadTimeout::TPtr& ev); //get completed subscriptions - TVector<std::pair<TReadInfo, ui64>> GetReads(const ui64 endOffsets); + TVector<std::pair<TReadInfo, ui64>> GetReads(const ui64 endOffsets); private: TSubscriberLogic Subscriber; diff --git a/ydb/core/persqueue/type_codecs_defs.h b/ydb/core/persqueue/type_codecs_defs.h index 90c55d4b892..2d956aca66f 100644 --- a/ydb/core/persqueue/type_codecs_defs.h +++ b/ydb/core/persqueue/type_codecs_defs.h @@ -191,7 +191,7 @@ public: }; /***************************************************************************//** - * TDataRef can either share the data (TString) or keep a reference (TStringBuf). + * TDataRef can either share the data (TString) or keep a reference (TStringBuf). * It uses short string optimization (SSO) to store small data (<= 16b). * TODO: Move to ydb/core/util ******************************************************************************/ @@ -228,13 +228,13 @@ public: } } - /// Ownership of the TString is taken with zero-copy. - TDataRef(const TString& data) + /// Ownership of the TString is taken with zero-copy. + TDataRef(const TString& data) : TDataRef(data, data.data(), data.size()) { } - /// Ownership of the TString is taken with zero-copy. - TDataRef(const TString& data, const char* begin, size_t size) + /// Ownership of the TString is taken with zero-copy. + TDataRef(const TString& data, const char* begin, size_t size) : SharedData_(data) , Data_(begin) , Size_(size) @@ -242,8 +242,8 @@ public: , IsNull_(0) { } - /// Ownership of the TString is taken with zero-copy. - TDataRef(const TString& data, size_t begin, size_t size) + /// Ownership of the TString is taken with zero-copy. + TDataRef(const TString& data, size_t begin, size_t size) : TDataRef(data, data.data() + begin, size) { } @@ -284,18 +284,18 @@ public: } static inline TDataRef CopyLong(const char* data, size_t size) { - return TDataRef(TString(data, size)); + return TDataRef(TString(data, size)); } static inline TDataRef Copy(const char* data, size_t size) { - return size <= INTRUSIVE_SIZE ? TDataRef(data, size, true) : TDataRef(TString(data, size)); + return size <= INTRUSIVE_SIZE ? TDataRef(data, size, true) : TDataRef(TString(data, size)); } private: static const size_t INTRUSIVE_SIZE = 16; static const ui8 LONG_SIZE = 0x1F; - TString SharedData_; // FIXME: It's a bottleneck (slows down a document traverse). + TString SharedData_; // FIXME: It's a bottleneck (slows down a document traverse). union { char IntrusiveData_[INTRUSIVE_SIZE]; @@ -371,7 +371,7 @@ public: } private: - using TIdToCodec = THashMap<ui16, const ICodec*>; + using TIdToCodec = THashMap<ui16, const ICodec*>; TIdToCodec Codecs; const ICodec* DefaultNullable; diff --git a/ydb/core/persqueue/type_codecs_ut.cpp b/ydb/core/persqueue/type_codecs_ut.cpp index d9f0b647557..c3dd37808e2 100644 --- a/ydb/core/persqueue/type_codecs_ut.cpp +++ b/ydb/core/persqueue/type_codecs_ut.cpp @@ -18,7 +18,7 @@ using TDataRef = NScheme::TDataRef; Y_UNIT_TEST_SUITE(TTypeCodecsTest) { - void Metrics(const TVector<TDataRef>& values, const ICodec* codec) { + void Metrics(const TVector<TDataRef>& values, const ICodec* codec) { TAutoPtr<TFlatBlobDataOutputStream> output(new TFlatBlobDataOutputStream()); auto chunk = codec->MakeChunk(output.Get()); @@ -54,7 +54,7 @@ Y_UNIT_TEST_SUITE(TTypeCodecsTest) { Cerr << "Iterate: " << TInstant::Now() - start << Endl; } - void TestImpl(const TVector<TDataRef>& values, const ICodec* codec) { + void TestImpl(const TVector<TDataRef>& values, const ICodec* codec) { TAutoPtr<TFlatBlobDataOutputStream> output(new TFlatBlobDataOutputStream()); auto chunk = codec->MakeChunk(output.Get()); for (const auto& value : values) { @@ -89,7 +89,7 @@ Y_UNIT_TEST_SUITE(TTypeCodecsTest) { THolder<TTypeCodecs> codecs(new TTypeCodecs(NScheme::TBool::TypeId)); - TVector<TDataRef> values(1000, TDataRef((const char*)&VALUE_FALSE, sizeof(VALUE_FALSE))); + TVector<TDataRef> values(1000, TDataRef((const char*)&VALUE_FALSE, sizeof(VALUE_FALSE))); for (int i = 0; i < 100; ++i) { values[i * 2] = TDataRef((const char*)&VALUE_TRUE, sizeof(VALUE_TRUE)); values[500 + i] = TDataRef((const char*)&VALUE_TRUE, sizeof(VALUE_TRUE)); @@ -109,7 +109,7 @@ Y_UNIT_TEST_SUITE(TTypeCodecsTest) { Y_UNIT_TEST(TestFixedLenCodec) { THolder<TTypeCodecs> codecs(new TTypeCodecs(NScheme::TInt32::TypeId)); - TVector<TDataRef> values; + TVector<TDataRef> values; for (int i = 0; i < 1000; ++i) { int data = i; values.push_back(TDataRef((const char*)&data, sizeof(data), true)); @@ -133,9 +133,9 @@ Y_UNIT_TEST_SUITE(TTypeCodecsTest) { TReallyFastRng32 rand(100500); - TVector<TDataRef> values; + TVector<TDataRef> values; for (int i = 0; i < 1000; ++i) { - TVector<char> value(rand.Uniform(10)); + TVector<char> value(rand.Uniform(10)); for (char& c : value) c = 'a' + rand.Uniform(26); values.push_back(TDataRef(value.data(), value.size(), true)); @@ -157,7 +157,7 @@ Y_UNIT_TEST_SUITE(TTypeCodecsTest) { TReallyFastRng32 rand(100500); - TVector<TDataRef> values; + TVector<TDataRef> values; for (int i = 0; i < 1000; ++i) { ui32 value = rand.Uniform(100500); values.push_back(TDataRef((const char*)&value, sizeof(value), true)); @@ -179,7 +179,7 @@ Y_UNIT_TEST_SUITE(TTypeCodecsTest) { TReallyFastRng32 rand(100500); - TVector<TDataRef> values; + TVector<TDataRef> values; for (int i = 0; i < 1000; ++i) { i32 value = rand.Uniform(100500); if (i & 1) @@ -203,7 +203,7 @@ Y_UNIT_TEST_SUITE(TTypeCodecsTest) { TReallyFastRng32 rand(100500); - TVector<TDataRef> values; + TVector<TDataRef> values; ui32 value = 2000000; for (int i = 0; i < 1000; ++i) { if (rev) @@ -234,7 +234,7 @@ Y_UNIT_TEST_SUITE(TTypeCodecsTest) { TReallyFastRng32 rand(100500); - TVector<TDataRef> values; + TVector<TDataRef> values; ui32 value = -17; for (int i = 0; i < 1000; ++i) { value += rand.Uniform(1000); diff --git a/ydb/core/persqueue/type_coders.h b/ydb/core/persqueue/type_coders.h index 26c2566d32e..c7aa7e67303 100644 --- a/ydb/core/persqueue/type_coders.h +++ b/ydb/core/persqueue/type_coders.h @@ -136,7 +136,7 @@ protected: private: ui32 DataSize; - TVector<ui32> Offsets; + TVector<ui32> Offsets; TCoderMask<IsNullable> Mask; TFlatBlobDataOutputStream* Output; }; diff --git a/ydb/core/persqueue/type_decoders.h b/ydb/core/persqueue/type_decoders.h index 30a8846923c..3405176fa98 100644 --- a/ydb/core/persqueue/type_decoders.h +++ b/ydb/core/persqueue/type_decoders.h @@ -443,7 +443,7 @@ private: TValueDecoder ValueDecoder; }; - using TCache = TDeque<TType>; + using TCache = TDeque<TType>; private: TDataRef Data; diff --git a/ydb/core/persqueue/user_info.h b/ydb/core/persqueue/user_info.h index 258e947c467..56f413f47c7 100644 --- a/ydb/core/persqueue/user_info.h +++ b/ydb/core/persqueue/user_info.h @@ -151,7 +151,7 @@ struct TReadSpeedLimiterHolder { struct TUserInfo { THolder<TReadSpeedLimiterHolder> ReadSpeedLimiter; - TString Session = ""; + TString Session = ""; ui32 Generation = 0; ui32 Step = 0; i64 Offset = 0; diff --git a/ydb/core/protos/grpc_pq_old.proto b/ydb/core/protos/grpc_pq_old.proto index ed273e14041..4e42d9932d0 100755 --- a/ydb/core/protos/grpc_pq_old.proto +++ b/ydb/core/protos/grpc_pq_old.proto @@ -5,7 +5,7 @@ message TKeyValue { optional string Value = 2; } -message TMapType { +message TMapType { repeated TKeyValue Items = 1; } @@ -34,7 +34,7 @@ message TDataChunk { optional int64 Codec = 10; - optional TMapType ExtraFields = 126; + optional TMapType ExtraFields = 126; optional bytes Data = 127; // ~ 64K } diff --git a/ydb/core/protos/sqs.proto b/ydb/core/protos/sqs.proto index eae557a6241..d2b6ea3f976 100644 --- a/ydb/core/protos/sqs.proto +++ b/ydb/core/protos/sqs.proto @@ -276,13 +276,13 @@ message TListQueuesRequest { } message TListQueuesResponse { - message TQueueType { + message TQueueType { optional string QueueName = 1; optional string QueueUrl = 2; } optional TError Error = 1; optional string RequestId = 2; - repeated TQueueType Queues = 3; + repeated TQueueType Queues = 3; } message TListUsersRequest { diff --git a/ydb/core/protos/tablet_database.proto b/ydb/core/protos/tablet_database.proto index a6658688a66..0b9e586517e 100644 --- a/ydb/core/protos/tablet_database.proto +++ b/ydb/core/protos/tablet_database.proto @@ -55,12 +55,12 @@ message TExecutorSettings { } message TCompactionBroker { - message TQueueType { + message TQueueType { optional uint32 QueueID = 1; optional uint32 Quota = 2; } - repeated TQueueType Queue = 1; + repeated TQueueType Queue = 1; } message TEvSetCompactionBrokerConfig { diff --git a/ydb/core/scheme/scheme_tablecell.cpp b/ydb/core/scheme/scheme_tablecell.cpp index c9ffaccc8e9..98673959a75 100644 --- a/ydb/core/scheme/scheme_tablecell.cpp +++ b/ydb/core/scheme/scheme_tablecell.cpp @@ -66,7 +66,7 @@ TString DbgPrintCell(const TCell& r, NScheme::TTypeId typeId, const NScheme::TTy if (!t.IsKnownType()) return Sprintf("Unknow typeId 0x%x", (ui32)typeId); - TString res = t->GetName(); + TString res = t->GetName(); res += " : "; DbgPrintValue(res, r, typeId); @@ -112,8 +112,8 @@ void DbgPrintValue(TString &res, const TCell &r, ui32 type) { } } -TString DbgPrintTuple(const TDbTupleRef& row, const NScheme::TTypeRegistry& typeRegistry) { - TString res = "("; +TString DbgPrintTuple(const TDbTupleRef& row, const NScheme::TTypeRegistry& typeRegistry) { + TString res = "("; for (ui32 i = 0; i < row.ColumnCount; ++i) { res += DbgPrintCell(row.Columns[i], row.Types[i], typeRegistry); if (i < row.ColumnCount-1) diff --git a/ydb/core/scheme/scheme_tablecell.h b/ydb/core/scheme/scheme_tablecell.h index bccfdca97db..b12da8d841f 100644 --- a/ydb/core/scheme/scheme_tablecell.h +++ b/ydb/core/scheme/scheme_tablecell.h @@ -394,7 +394,7 @@ private: // When loading from a buffer the cells will point to the buffer contents class TSerializedCellVec { public: - explicit TSerializedCellVec(TString buf) + explicit TSerializedCellVec(TString buf) { Parse(buf); } @@ -444,7 +444,7 @@ public: return ok; } - void Parse(const TString &buf) { + void Parse(const TString &buf) { Y_VERIFY(TryParse(buf, *this)); } @@ -454,14 +454,14 @@ public: static TString Serialize(const TConstArrayRef<TCell>& cells) { if (cells.empty()) - return TString(); + return TString(); size_t sz = sizeof(ui16); for (auto& c : cells) { sz += sizeof(TValue) + c.Size(); } - TString res; + TString res; res.reserve(sz); ui16 cnt = cells.size(); res.append((const char*)&cnt, sizeof(ui16)); @@ -519,12 +519,12 @@ private: } private: - TString Buf; - TVector<TCell> Cells; + TString Buf; + TVector<TCell> Cells; }; void DbgPrintValue(TString&, const TCell&, ui32 type); -TString DbgPrintCell(const TCell& r, NScheme::TTypeId typeId, const NScheme::TTypeRegistry& typeRegistry); -TString DbgPrintTuple(const TDbTupleRef& row, const NScheme::TTypeRegistry& typeRegistry); +TString DbgPrintCell(const TCell& r, NScheme::TTypeId typeId, const NScheme::TTypeRegistry& typeRegistry); +TString DbgPrintTuple(const TDbTupleRef& row, const NScheme::TTypeRegistry& typeRegistry); } diff --git a/ydb/core/scheme/scheme_tabledefs.h b/ydb/core/scheme/scheme_tabledefs.h index 190233fdeee..d37a9698146 100644 --- a/ydb/core/scheme/scheme_tabledefs.h +++ b/ydb/core/scheme/scheme_tabledefs.h @@ -564,17 +564,17 @@ private: struct TSecurityObject : TAtomicRefCount<TSecurityObject>, NACLib::TSecurityObject { using TPtr = TIntrusivePtr<TSecurityObject>; - static NACLib::TSecurityObject FromByteStream(const NACLibProto::TSecurityObject* parent, const TString& owner, const TString& acl, bool isContainer) { + static NACLib::TSecurityObject FromByteStream(const NACLibProto::TSecurityObject* parent, const TString& owner, const TString& acl, bool isContainer) { NACLib::TSecurityObject object(owner, isContainer); Y_VERIFY(object.MutableACL()->ParseFromString(acl)); return parent != nullptr ? object.MergeWithParent(*parent) : object; } - TSecurityObject(const TString& owner, const TString& acl, bool isContainer) + TSecurityObject(const TString& owner, const TString& acl, bool isContainer) : NACLib::TSecurityObject(FromByteStream(nullptr, owner, acl, isContainer)) {} - TSecurityObject(const TSecurityObject* parent, const TString& owner, const TString& acl, bool isContainer) + TSecurityObject(const TSecurityObject* parent, const TString& owner, const TString& acl, bool isContainer) : NACLib::TSecurityObject(FromByteStream(parent, owner, acl, isContainer)) {} }; @@ -667,14 +667,14 @@ public: const TOwnedTableRange Range; const TRangeLimits RangeLimits; const ERowOperation RowOperation; - const TVector<NScheme::TTypeId> KeyColumnTypes; // For SelectRange there can be not full key - const TVector<TColumnOp> Columns; + const TVector<NScheme::TTypeId> KeyColumnTypes; // For SelectRange there can be not full key + const TVector<TColumnOp> Columns; const bool Reverse; TReadTarget ReadTarget; // Set for Read row operation // out EStatus Status; - TVector<TColumnInfo> ColumnInfos; + TVector<TColumnInfo> ColumnInfos; TVector<TPartitionInfo> Partitions; TIntrusivePtr<TSecurityObject> SecurityObject; diff --git a/ydb/core/scheme/tablet_scheme_defs.h b/ydb/core/scheme/tablet_scheme_defs.h index 697638079d6..50fc84bda82 100644 --- a/ydb/core/scheme/tablet_scheme_defs.h +++ b/ydb/core/scheme/tablet_scheme_defs.h @@ -20,7 +20,7 @@ public: ~TTagDetails() {} - TString Name; + TString Name; ui32 Idx; ui32 ValueType; ui32 PayloadType; diff --git a/ydb/core/scheme_types/scheme_raw_type_value.h b/ydb/core/scheme_types/scheme_raw_type_value.h index 1cb0946b6d7..25bd55f4d30 100644 --- a/ydb/core/scheme_types/scheme_raw_type_value.h +++ b/ydb/core/scheme_types/scheme_raw_type_value.h @@ -40,11 +40,11 @@ public: bool IsEmpty() const { return Buffer == nullptr; } explicit operator bool() const noexcept { return !IsEmpty(); } - TString ToString() const { + TString ToString() const { TStringBuilder builder; builder << "(type:" << ValueType; if (!IsEmpty()) { - builder << ", value:" << TString((const char*)Buffer, BufferSize).Quote(); + builder << ", value:" << TString((const char*)Buffer, BufferSize).Quote(); } builder << ")"; return std::move(builder); diff --git a/ydb/core/scheme_types/scheme_type_metadata.h b/ydb/core/scheme_types/scheme_type_metadata.h index 9c55fcc0a27..363d767bddd 100644 --- a/ydb/core/scheme_types/scheme_type_metadata.h +++ b/ydb/core/scheme_types/scheme_type_metadata.h @@ -35,8 +35,8 @@ public: ::TString Name; }; - typedef THashMap<TTypeId, const ITypeMetadata*> TMapById; - typedef THashMap<::TString, const ITypeMetadata*> TMapByName; + typedef THashMap<TTypeId, const ITypeMetadata*> TMapById; + typedef THashMap<::TString, const ITypeMetadata*> TMapByName; void Register(const ITypeMetadata* metadata) { Y_VERIFY(MapById.insert({ metadata->GetTypeId(), metadata }).second); diff --git a/ydb/core/scheme_types/scheme_type_registry.h b/ydb/core/scheme_types/scheme_type_registry.h index a82af192675..cdc24624523 100644 --- a/ydb/core/scheme_types/scheme_type_registry.h +++ b/ydb/core/scheme_types/scheme_type_registry.h @@ -6,7 +6,7 @@ #include <util/generic/map.h> #include <util/generic/maybe.h> #include <util/generic/singleton.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/string/builder.h> @@ -80,8 +80,8 @@ public: ythrow yexception() << "Unknown type: " << name; } - TVector<const IType*> GetTypes() const { - TVector<const IType*> types; + TVector<const IType*> GetTypes() const { + TVector<const IType*> types; types.reserve(TypeByIdMap.size()); for (const auto& entry : TypeByIdMap) types.push_back(entry.second); @@ -104,8 +104,8 @@ public: private: // - typedef TMap<ui32, const IType *> TTypeByIdMap; - typedef TMap<::TString, const IType *> TTypeByNameMap; + typedef TMap<ui32, const IType *> TTypeByIdMap; + typedef TMap<::TString, const IType *> TTypeByNameMap; TTypeByIdMap TypeByIdMap; TTypeByNameMap TypeByNameMap; diff --git a/ydb/core/security/ticket_parser.cpp b/ydb/core/security/ticket_parser.cpp index c7d024d03dc..07c754f915f 100644 --- a/ydb/core/security/ticket_parser.cpp +++ b/ydb/core/security/ticket_parser.cpp @@ -65,7 +65,7 @@ class TTicketParser : public TActorBootstrapped<TTicketParser> { TString Subject; // login TEvTicketParser::TError Error; TIntrusivePtr<NACLib::TUserToken> Token; - TString SerializedToken; + TString SerializedToken; TDeque<THolder<TEventHandle<TEvTicketParser::TEvAuthorizeTicket>>> AuthorizeRequests; ui64 ResponsesLeft = 0; TInstant InitTime; @@ -111,7 +111,7 @@ class TTicketParser : public TActorBootstrapped<TTicketParser> { } }; - THashMap<TString, TTokenRecord> UserTokens; + THashMap<TString, TTokenRecord> UserTokens; TPriorityQueue<TTokenRefreshRecord> RefreshQueue; std::unordered_map<TString, NLogin::TLoginProvider> LoginProviders; bool UseLoginProvider = false; diff --git a/ydb/core/tablet/bootstrapper.cpp b/ydb/core/tablet/bootstrapper.cpp index d2e5dd8b7f3..e7f3fbe6ef7 100644 --- a/ydb/core/tablet/bootstrapper.cpp +++ b/ydb/core/tablet/bootstrapper.cpp @@ -110,7 +110,7 @@ class TBootstrapper : public TActor<TBootstrapper> { return false; } - TVector<TWatched> Watched; + TVector<TWatched> Watched; }; // we are under watch, must notify on error @@ -140,7 +140,7 @@ class TBootstrapper : public TActor<TBootstrapper> { Watchers.push_back(TWatcher(actorId, round)); } - TVector<TWatcher> Watchers; + TVector<TWatcher> Watchers; }; struct TRound { @@ -166,7 +166,7 @@ class TBootstrapper : public TActor<TBootstrapper> { {} }; - TVector<TAlien> Aliens; + TVector<TAlien> Aliens; }; TAutoPtr<TWatch> Watches; // we watch them diff --git a/ydb/core/tablet/bootstrapper.h b/ydb/core/tablet/bootstrapper.h index 2e246ea2b07..3a0509229d3 100644 --- a/ydb/core/tablet/bootstrapper.h +++ b/ydb/core/tablet/bootstrapper.h @@ -34,7 +34,7 @@ struct TEvBootstrapper { struct TBootstrapperInfo : public TThrRefBase { TIntrusivePtr<TTabletSetupInfo> SetupInfo; - TVector<ui32> OtherNodes; + TVector<ui32> OtherNodes; TDuration WatchThreshold; TDuration OfflineDelay; bool StartFollowers; diff --git a/ydb/core/tablet/node_tablet_monitor.cpp b/ydb/core/tablet/node_tablet_monitor.cpp index 8bb34e7ea0b..2b3dc1172b2 100644 --- a/ydb/core/tablet/node_tablet_monitor.cpp +++ b/ydb/core/tablet/node_tablet_monitor.cpp @@ -111,7 +111,7 @@ public: Die(ctx); } - void Notify(const TActorContext &ctx, const TString& html) { + void Notify(const TActorContext &ctx, const TString& html) { ctx.Send(Sender, new NMon::TEvHttpInfoRes(html)); } @@ -209,8 +209,8 @@ public: } void BuildTabletList(std::function<bool(const NKikimrWhiteboard::TTabletStateInfo&)> filter, - TVector<TTabletListElement>& tabletsToRender) { - TVector<ui64> tabletIdIndex; + TVector<TTabletListElement>& tabletsToRender) { + TVector<ui64> tabletIdIndex; tabletsToRender.clear(); for (const auto& ni : PerNodeTabletInfo) { @@ -246,7 +246,7 @@ public: void RenderResponse(const TActorContext &ctx) { Sort(NodesInfo->Nodes.begin(), NodesInfo->Nodes.end()); - TString filterNodeHost; + TString filterNodeHost; if (FilterNodeId != 0) { auto eq_it = EqualRange(NodesInfo->Nodes.begin(), NodesInfo->Nodes.end(), FilterNodeId); if (eq_it.first != NodesInfo->Nodes.end()) { @@ -258,7 +258,7 @@ public: Renderer->RenderPageHeader(str); for(ui32 cls = 0; cls < StateClassifier->GetMaxTabletStateClass(); cls++) { auto filter = StateClassifier->GetTabletStateClassFilter(cls); - TVector<TTabletListElement> tablets; + TVector<TTabletListElement> tablets; BuildTabletList(filter, tablets); auto listName = StateClassifier->GetTabletStateClassName(cls); Renderer->RenderTabletList(str, listName, tablets, {FilterNodeId, filterNodeHost}); @@ -269,7 +269,7 @@ public: Die(ctx); } - void Notify(const TActorContext &ctx, const TString& html) { + void Notify(const TActorContext &ctx, const TString& html) { ctx.Send(Sender, new NMon::TEvHttpInfoRes(html)); } @@ -286,7 +286,7 @@ public: protected: TActorId Sender; TAutoPtr<TEvInterconnect::TEvNodesInfo> NodesInfo; - TMap<ui64, TAutoPtr<TEvWhiteboard::TEvTabletStateResponse>> PerNodeTabletInfo; + TMap<ui64, TAutoPtr<TEvWhiteboard::TEvTabletStateResponse>> PerNodeTabletInfo; size_t NodesRequested; size_t NodesReceived; ui32 FilterNodeId; @@ -330,7 +330,7 @@ public: void Handle(TEvStateStorage::TEvResponseReplicasDumps::TPtr &ev, const TActorContext &ctx) { Sort(NodesInfo->Nodes.begin(), NodesInfo->Nodes.end()); TEvStateStorage::TEvResponseReplicasDumps &event = *ev->Get(); - TMap<ui64, TVector<std::pair<ui32, const NKikimrStateStorage::TEvInfo*>>> indexByTabletId; + TMap<ui64, TVector<std::pair<ui32, const NKikimrStateStorage::TEvInfo*>>> indexByTabletId; for (const auto& rdi : event.ReplicasDumps) { const TEvStateStorage::TEvReplicaDump& replicaDump = *rdi.second; for (const NKikimrStateStorage::TEvInfo& ei : replicaDump.Record.GetInfo()) { @@ -389,7 +389,7 @@ public: Die(ctx); } - void Notify(const TActorContext &ctx, const TString& html) { + void Notify(const TActorContext &ctx, const TString& html) { ctx.Send(Sender, new NMon::TEvHttpInfoRes(html)); } @@ -447,7 +447,7 @@ private: NMon::TEvHttpInfo* msg = ev->Get(); const TCgiParameters& cgi = msg->Request.GetParams(); if (cgi.Has("action")) { - const TString &actionParam = cgi.Get("action"); + const TString &actionParam = cgi.Get("action"); if (actionParam == "browse_nodes") { ctx.ExecutorThread.RegisterActor(new TNodeList(ev->Sender)); return; diff --git a/ydb/core/tablet/node_tablet_monitor.h b/ydb/core/tablet/node_tablet_monitor.h index 0fe88912003..82735bf60ec 100644 --- a/ydb/core/tablet/node_tablet_monitor.h +++ b/ydb/core/tablet/node_tablet_monitor.h @@ -22,7 +22,7 @@ inline TActorId MakeNodeTabletMonitorID(ui32 node = 0) { struct ITabletStateClassifier : public TAtomicRefCount<ITabletStateClassifier>{ virtual ui32 GetMaxTabletStateClass() const = 0; virtual std::function<bool(const NKikimrWhiteboard::TTabletStateInfo&)> GetTabletStateClassFilter(ui32 cls) const = 0; - virtual TString GetTabletStateClassName(ui32 cls) = 0; + virtual TString GetTabletStateClassName(ui32 cls) = 0; virtual ~ITabletStateClassifier() {} }; @@ -37,7 +37,7 @@ struct TTabletListElement { struct TTabletFilterInfo { ui32 FilterNodeId; - TString FilterNodeHost; + TString FilterNodeHost; }; @@ -45,8 +45,8 @@ struct ITabletListRenderer : public TAtomicRefCount<ITabletListRenderer> { virtual void RenderPageHeader(TStringStream& str) = 0; virtual void RenderPageFooter(TStringStream& str) = 0; virtual void RenderTabletList(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo) = 0; virtual ~ITabletListRenderer() {} diff --git a/ydb/core/tablet/node_whiteboard.cpp b/ydb/core/tablet/node_whiteboard.cpp index 783758e99d1..1c06f797bdc 100644 --- a/ydb/core/tablet/node_whiteboard.cpp +++ b/ydb/core/tablet/node_whiteboard.cpp @@ -620,7 +620,7 @@ protected: // auto& record = response->Record; // const TIntrusivePtr<NMonitoring::TDynamicCounters> &counters = AppData(ctx)->Counters; // TIntrusivePtr<NMonitoring::TDynamicCounters> interconnectCounters = GetServiceCounters(counters, "interconnect"); -// interconnectCounters->EnumerateSubgroups([&record, &interconnectCounters](const TString &name, const TString &value) -> void { +// interconnectCounters->EnumerateSubgroups([&record, &interconnectCounters](const TString &name, const TString &value) -> void { // NKikimrWhiteboard::TNodeStateInfo &nodeStateInfo = *record.AddNodeStateInfo(); // TIntrusivePtr<NMonitoring::TDynamicCounters> peerCounters = interconnectCounters->GetSubgroup(name, value); // NMonitoring::TDynamicCounters::TCounterPtr connectedCounter = peerCounters->GetCounter("Connected"); @@ -779,8 +779,8 @@ protected: ctx.Send(ev->Sender, response.Release(), 0, ev->Cookie); } - static TVector<double> GetLoadAverage() { - TVector<double> loadAvg(3); + static TVector<double> GetLoadAverage() { + TVector<double> loadAvg(3); loadAvg.resize(NSystemInfo::LoadAverage(loadAvg.data(), loadAvg.size())); return loadAvg; } diff --git a/ydb/core/tablet/pipe_tracker.h b/ydb/core/tablet/pipe_tracker.h index 33b90ba82bb..198e4da5ad6 100644 --- a/ydb/core/tablet/pipe_tracker.h +++ b/ydb/core/tablet/pipe_tracker.h @@ -55,8 +55,8 @@ private: {} }; - TVector<TCommand> Attach; - TVector<TCommand> Detach; + TVector<TCommand> Attach; + TVector<TCommand> Detach; }; } diff --git a/ydb/core/tablet/resource_broker.cpp b/ydb/core/tablet/resource_broker.cpp index fff30b26010..a0c7f4523ab 100644 --- a/ydb/core/tablet/resource_broker.cpp +++ b/ydb/core/tablet/resource_broker.cpp @@ -165,7 +165,7 @@ TTaskQueue::TTaskQueue(const NKikimrResourceBroker::TQueueConfig &config, , TotalLimit(totalLimit) , RealResourceUsage(0) , PlannedResourceUsage(0) - , UsageTimestamp(TInstant::MicroSeconds(0)) + , UsageTimestamp(TInstant::MicroSeconds(0)) , QueueCounters(counters->GetSubgroup("queue", Name)) , TotalCounters(totalCounters) { @@ -588,7 +588,7 @@ void TScheduler::ScheduleTasks(const TActorSystem &as, { UpdateResourceUsage(as); - TSet<TTaskQueuePtr, TTaskQueueLess> pending; + TSet<TTaskQueuePtr, TTaskQueueLess> pending; for (auto &entry : Queues) { auto &queue = entry.second; if (!queue->Empty()) @@ -753,7 +753,7 @@ void TScheduler::Configure(const TResourceBrokerConfig &config, const TActorSyst for (auto &task : config.GetTasks()) { TTaskCountersPtr counters = new TTaskCounters(Counters->GetSubgroup("task", task.GetName())); TTaskConfig taskConfig(task.GetName(), - TDuration::MicroSeconds(task.GetDefaultDuration()), + TDuration::MicroSeconds(task.GetDefaultDuration()), counters); Y_VERIFY(Queues.contains(task.GetQueueName()), " queue '%s' wasn't found in config", task.GetQueueName().data()); taskConfig.Queue = Queues.at(task.GetQueueName()); @@ -1183,8 +1183,8 @@ void TResourceBrokerActor::Handle(TEvResourceBroker::TEvConfigure::TPtr &ev, LOG_DEBUG(ctx, NKikimrServices::RESOURCE_BROKER, "New config: %s", rec.ShortDebugString().data()); - TSet<TString> queues; - TSet<TString> tasks; + TSet<TString> queues; + TSet<TString> tasks; bool success = true; TString error; for (auto &queue : rec.GetQueues()) diff --git a/ydb/core/tablet/resource_broker_impl.h b/ydb/core/tablet/resource_broker_impl.h index 2c781692f60..d65eb6b7ac0 100644 --- a/ydb/core/tablet/resource_broker_impl.h +++ b/ydb/core/tablet/resource_broker_impl.h @@ -150,7 +150,7 @@ public: TDuration GetAverage() const; private: - TVector<TDuration> Values; + TVector<TDuration> Values; size_t Current; TDuration Total; }; @@ -244,7 +244,7 @@ private: public: TString Name; ui32 Weight; - TSet<TTaskPtr, TTaskEarlier> Tasks; + TSet<TTaskPtr, TTaskEarlier> Tasks; TResourceLimit QueueLimit; TResourceLimitPtr TotalLimit; double RealResourceUsage; @@ -388,8 +388,8 @@ private: TTaskConfig &TaskConfig(const TString &type); TInstant Now; - THashMap<TString, TTaskQueuePtr> Queues; - THashMap<TString, TTaskConfig> TaskConfigs; + THashMap<TString, TTaskQueuePtr> Queues; + THashMap<TString, TTaskConfig> TaskConfigs; TResourceLimitPtr ResourceLimit; THashMap<std::pair<TActorId, ui64>, TTaskPtr> Tasks; const NMonitoring::TDynamicCounterPtr Counters; diff --git a/ydb/core/tablet/resource_broker_ut.cpp b/ydb/core/tablet/resource_broker_ut.cpp index 5948509025b..3930b067a47 100644 --- a/ydb/core/tablet/resource_broker_ut.cpp +++ b/ydb/core/tablet/resource_broker_ut.cpp @@ -619,7 +619,7 @@ Y_UNIT_TEST_SUITE(TResourceBroker) { auto brokerId = runtime.Register(broker); WaitForBootstrap(runtime); - TSet<ui64> ids; + TSet<ui64> ids; const char *names[] = { "unknown", "compaction0", "compaction1", "wrong" }; for (ui64 i = 1; i <= 1000; ++i) { SubmitTask(runtime, brokerId, sender, i, RandomNumber<ui32>(500), RandomNumber<ui32>(500), diff --git a/ydb/core/tablet/tablet_counters.h b/ydb/core/tablet/tablet_counters.h index a8cc27e9eda..ae7d54d4afa 100644 --- a/ydb/core/tablet/tablet_counters.h +++ b/ydb/core/tablet/tablet_counters.h @@ -564,7 +564,7 @@ public: const char* const * metaInfo, const ui8* types, const ui8* aggrFunc, - const TString& group, const char* const * groupNames, const ui64 id) + const TString& group, const char* const * groupNames, const ui64 id) : Counters(countersQnt) , Ids(countersQnt) , MetaInfo(metaInfo) @@ -594,7 +594,7 @@ public: return Counters; } - const TString& GetGroup() const { + const TString& GetGroup() const { return Group; } @@ -659,7 +659,7 @@ private: const char* const * MetaInfo; const ui8* Types; const ui8* AggregateFunc; - TString Group; + TString Group; const char* const * GroupNames; bool Drop; }; diff --git a/ydb/core/tablet/tablet_counters_aggregator.cpp b/ydb/core/tablet/tablet_counters_aggregator.cpp index 1885b26e09c..6df5a9a1bdf 100644 --- a/ydb/core/tablet/tablet_counters_aggregator.cpp +++ b/ydb/core/tablet/tablet_counters_aggregator.cpp @@ -59,7 +59,7 @@ const ui32 WAKEUP_TIMEOUT_SECONDS = 4; //////////////////////////////////////////// -using TCountersVector = TVector<NMonitoring::TDynamicCounters::TCounterPtr>; +using TCountersVector = TVector<NMonitoring::TDynamicCounters::TCounterPtr>; struct THistogramCounter { TVector<TTabletPercentileCounter::TRangeDef> Ranges; @@ -103,15 +103,15 @@ public: {} void AddSimpleCounter(const char* name, THolder<THistogramCounter> percentileAggregate = THolder<THistogramCounter>()) { - auto fnAddCounter = [this](const char* name, TVector<NMonitoring::TDynamicCounters::TCounterPtr>& container) { + auto fnAddCounter = [this](const char* name, TVector<NMonitoring::TDynamicCounters::TCounterPtr>& container) { auto counter = CounterGroup->GetCounter(name, false); container.push_back(counter); }; CountersByTabletID.push_back(TCountersByTabletIDMap()); ChangedCounters.push_back(true); - TString maxName = Sprintf("MAX(%s)", name); - TString sumName = Sprintf("SUM(%s)", name); + TString maxName = Sprintf("MAX(%s)", name); + TString sumName = Sprintf("SUM(%s)", name); fnAddCounter(maxName.data(), MaxSimpleCounters); fnAddCounter(sumName.data(), SumSimpleCounters); @@ -181,10 +181,10 @@ private: TCountersVector MaxSimpleCounters; TCountersVector SumSimpleCounters; THistogramVector HistSimpleCounters; - using TCountersByTabletIDMap = THashMap<ui64, ui64>; + using TCountersByTabletIDMap = THashMap<ui64, ui64>; - TVector<TCountersByTabletIDMap> CountersByTabletID; - TVector<bool> ChangedCounters; + TVector<TCountersByTabletIDMap> CountersByTabletID; + TVector<bool> ChangedCounters; private: void Recalc(ui32 idx) { @@ -333,7 +333,7 @@ struct TTabletLabeledCountersResponseContext { class TAggregatedLabeledCounters { public: // - TAggregatedLabeledCounters(ui32 count, const ui8* aggrFunc, const char * const * names, const ui8* types, const TString& groupNames) + TAggregatedLabeledCounters(ui32 count, const ui8* aggrFunc, const char * const * names, const ui8* types, const TString& groupNames) : AggrFunc(aggrFunc) , Names(names) , GroupNames(groupNames) @@ -419,15 +419,15 @@ private: NMonitoring::TDynamicCounterPtr CounterGroup; const ui8* AggrFunc; const char* const * Names; - TString GroupNames; + TString GroupNames; const ui8* Types; - mutable TVector<ui64> AggrCounters; - mutable TVector<ui64> Ids; + mutable TVector<ui64> AggrCounters; + mutable TVector<ui64> Ids; mutable bool Changed; - using TCountersByTabletIDMap = THashMap<ui64, std::pair<ui64, ui64>>; //second pair is for counter and id - TVector<TCountersByTabletIDMap> CountersByTabletID; + using TCountersByTabletIDMap = THashMap<ui64, std::pair<ui64, ui64>>; //second pair is for counter and id + TVector<TCountersByTabletIDMap> CountersByTabletID; private: void Recalc(ui32 idx) const { @@ -530,8 +530,8 @@ public: if (iterTabletType == LabeledCountersByTabletTypeAndGroup.end()) { TString tabletTypeStr = TTabletTypes::TypeToStr(tabletType); - TString groupNames; - TVector<TString> rr; + TString groupNames; + TVector<TString> rr; StringSplitter(labeledCounters->GetGroup()).Split('/').SkipEmpty().Collect(&rr); // TODO: change here to "|" for (ui32 i = 0; i < rr.size(); ++i) { if (i > 0) @@ -565,7 +565,7 @@ public: itPath->second->Forget(tabletID, tabletType); } //and from all labeledCounters that could have this tablet - auto iterTabletTypeAndGroup = LabeledCountersByTabletTypeAndGroup.lower_bound(std::make_pair(tabletType, TString())); + auto iterTabletTypeAndGroup = LabeledCountersByTabletTypeAndGroup.lower_bound(std::make_pair(tabletType, TString())); for (; iterTabletTypeAndGroup != LabeledCountersByTabletTypeAndGroup.end() && iterTabletTypeAndGroup->first.first == tabletType; ) { bool empty = iterTabletTypeAndGroup->second->ForgetTablet(tabletID); if (empty) { @@ -582,7 +582,7 @@ public: } void Query(const NKikimrTabletCountersAggregator::TEvTabletCountersRequest& request, NKikimrTabletCountersAggregator::TEvTabletCountersResponse& response) { - TVector<ui64> tabletIDs(request.GetTabletIds().begin(), request.GetTabletIds().end()); + TVector<ui64> tabletIDs(request.GetTabletIds().begin(), request.GetTabletIds().end()); if (tabletIDs.empty()) { for (const auto& pr : QuietTabletCounters) { auto& countersInfo = *response.AddCountersInfo(); @@ -647,7 +647,7 @@ public: LOG_INFO_S(ctx, NKikimrServices::TABLET_AGGREGATOR, "got request v" << request.GetVersion()); - TString group = request.HasGroup() ? request.GetGroup() : ""; + TString group = request.HasGroup() ? request.GetGroup() : ""; TTabletTypes::EType tabletType = request.GetTabletType(); ui32 cc = 0; @@ -825,7 +825,7 @@ private: } // old style - PercentileCounters.push_back(TVector<NMonitoring::TDynamicCounters::TCounterPtr>()); + PercentileCounters.push_back(TVector<NMonitoring::TDynamicCounters::TCounterPtr>()); auto counterRBeginIter = PercentileCounters.rbegin(); auto& percentileCounter = counters->Percentile()[i]; @@ -1530,7 +1530,7 @@ private: typedef THashMap<TPathId, TIntrusivePtr<TTabletCountersForDb>> TCountersByPathId; typedef TMap<TTabletTypes::EType, THolder<TTabletCountersBase>> TAppCountersByTabletType; - typedef TMap<std::pair<TTabletTypes::EType, TString>, TAutoPtr<TAggregatedLabeledCounters> > TLabeledCountersByTabletTypeAndGroup; + typedef TMap<std::pair<TTabletTypes::EType, TString>, TAutoPtr<TAggregatedLabeledCounters> > TLabeledCountersByTabletTypeAndGroup; TCountersByTabletType CountersByTabletType; TCountersByPathId CountersByPathId; @@ -1540,7 +1540,7 @@ private: TYdbTabletCountersPtr YdbCounters; TLabeledCountersByTabletTypeAndGroup LabeledCountersByTabletTypeAndGroup; - THashMap<ui64, std::pair<TAutoPtr<TTabletCountersBase>, TAutoPtr<TTabletCountersBase>>> QuietTabletCounters; + THashMap<ui64, std::pair<TAutoPtr<TTabletCountersBase>, TAutoPtr<TTabletCountersBase>>> QuietTabletCounters; }; @@ -1588,7 +1588,7 @@ private: TAutoPtr<TTabletMon> TabletMon; TActorId DbWatcherActorId; THashMap<TActorId, std::pair<TActorId, TAutoPtr<NMon::TEvHttpInfo>>> HttpRequestHandlers; - THashSet<ui32> TabletTypeOfReceivedLabeledCounters; + THashSet<ui32> TabletTypeOfReceivedLabeledCounters; bool Follower; }; @@ -1681,11 +1681,11 @@ TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletLabeledCo auto it = HttpRequestHandlers.find(ev->Sender); if (it == HttpRequestHandlers.end()) return; - TString html; + TString html; TStringOutput oss(html); NMonitoring::TDynamicCounters counters; const auto& params = it->second.second->Request.GetParams(); - TString reqTabletType = params.Get("type"); + TString reqTabletType = params.Get("type"); auto mainGroup = counters.GetSubgroup("user_counters", reqTabletType); @@ -1697,8 +1697,8 @@ TTabletCountersAggregatorActor::HandleWork(TEvTabletCounters::TEvTabletLabeledCo for (ui32 i = 0; i < response.LabeledCountersByGroupSize(); ++i) { const auto ucByGroup = response.GetLabeledCountersByGroup(i); - TVector<TString> groups; - TVector<TString> groupNames; + TVector<TString> groups; + TVector<TString> groupNames; Y_VERIFY(ucByGroup.GetDelimiter() == "/"); StringSplitter(ucByGroup.GetGroup()).Split('/').SkipEmpty().Collect(&groups); @@ -1801,7 +1801,7 @@ TTabletCountersAggregatorActor::HandleWork(NMon::TEvHttpInfo::TPtr &ev, const TA for (ui32 tabletType = 0; tabletType < TTabletTypes::USER_TYPE_START; ++tabletType) { if (!NKikimrTabletBase::TTabletTypes::EType_IsValid(tabletType)) continue; - TString tabletTypeStr = TTabletTypes::TypeToStr((TTabletTypes::EType)tabletType); + TString tabletTypeStr = TTabletTypes::TypeToStr((TTabletTypes::EType)tabletType); if (tabletTypeStr == reqTabletType) { TActorId handler = CreateClusterLabeledCountersAggregator(ctx.SelfID, (TTabletTypes::EType)tabletType, ctx, 1, "", workers); HttpRequestHandlers.insert(std::make_pair(handler, std::make_pair(ev->Sender, ev->Release()))); @@ -1809,9 +1809,9 @@ TTabletCountersAggregatorActor::HandleWork(NMon::TEvHttpInfo::TPtr &ev, const TA } } //reaching this point means that this is unknow tablet type, response with nothing - TString html; + TString html; for (const auto& tabletType: TabletTypeOfReceivedLabeledCounters) { - TString tabletTypeStr = TTabletTypes::TypeToStr((TTabletTypes::EType)tabletType); + TString tabletTypeStr = TTabletTypes::TypeToStr((TTabletTypes::EType)tabletType); html += "<a href=\"?type=" + tabletTypeStr + "\">" + tabletTypeStr + " labeled counters</a><br>"; html += "<a href=\"?type=" + tabletTypeStr + "&json=1\">" + tabletTypeStr + " labeled counters as json</a><br>"; html += "<a href=\"?type=" + tabletTypeStr + "&spack=1\">" + tabletTypeStr + " labeled counters as spack</a><br>"; @@ -1898,8 +1898,8 @@ class TClusterLabeledCountersAggregatorActorV1 : public TActorBootstrapped<TClus TTabletTypes::EType TabletType; ui32 NodesRequested; ui32 NodesReceived; - TVector<ui32> Nodes; - THashMap<ui32, TAutoPtr<TEvTabletCounters::TEvTabletLabeledCountersResponse>> PerNodeResponse; + TVector<ui32> Nodes; + THashMap<ui32, TAutoPtr<TEvTabletCounters::TEvTabletLabeledCountersResponse>> PerNodeResponse; ui32 NumWorkers; ui32 WorkerId; @@ -2031,19 +2031,19 @@ public: LOG_INFO_S(ctx, NKikimrServices::TABLET_AGGREGATOR, "aggregator all answers recieved - replying " << ctx.SelfID); - TVector<ui8> types; - TVector<ui8> aggrFuncs; - TVector<const char*> names; + TVector<ui8> types; + TVector<ui8> aggrFuncs; + TVector<const char*> names; ui32 metaInfoCount = 0; - THashMap<TString, TAutoPtr<TTabletLabeledCountersBase>> groupsToLabeledCounter; - THashMap<TString, std::pair<ui32,ui32>> startPos; - THashMap<TString, TString> groupToNames; + THashMap<TString, TAutoPtr<TTabletLabeledCountersBase>> groupsToLabeledCounter; + THashMap<TString, std::pair<ui32,ui32>> startPos; + THashMap<TString, TString> groupToNames; for (auto& resp : PerNodeResponse) { if (!resp.second) continue; for (ui32 i = 0; i < resp.second->Record.LabeledCountersByGroupSize(); ++i) { const auto& labeledCounterByGroup = resp.second->Record.GetLabeledCountersByGroup(i); - const TString& group = labeledCounterByGroup.GetGroup(); + const TString& group = labeledCounterByGroup.GetGroup(); if (startPos.find(group) != startPos.end()) continue; ui32 count = labeledCounterByGroup.LabeledCounterSize(); diff --git a/ydb/core/tablet/tablet_counters_protobuf.h b/ydb/core/tablet/tablet_counters_protobuf.h index 11d3a334def..33046cab4d7 100644 --- a/ydb/core/tablet/tablet_counters_protobuf.h +++ b/ydb/core/tablet/tablet_counters_protobuf.h @@ -16,10 +16,10 @@ struct TAppParsedOpts { public: const size_t Size; protected: - TVector<TString> NamesStrings; - TVector<const char*> Names; - TVector<TVector<TTabletPercentileCounter::TRangeDef>> Ranges; - TVector<TTabletPercentileCounter::TRangeDef> AppGlobalRanges; + TVector<TString> NamesStrings; + TVector<const char*> Names; + TVector<TVector<TTabletPercentileCounter::TRangeDef>> Ranges; + TVector<TTabletPercentileCounter::TRangeDef> AppGlobalRanges; TVector<bool> Integral; public: explicit TAppParsedOpts(const size_t diff = 0) @@ -57,7 +57,7 @@ public: } // Make plain strings out of Strokas to fullfil interface of TTabletCountersBase - for (const TString& s : NamesStrings) { + for (const TString& s : NamesStrings) { Names.push_back(s.empty() ? nullptr : s.c_str()); } @@ -72,7 +72,7 @@ public: return Names.begin(); } - virtual const TVector<TTabletPercentileCounter::TRangeDef>& GetRanges(size_t idx) const + virtual const TVector<TTabletPercentileCounter::TRangeDef>& GetRanges(size_t idx) const { Y_VERIFY(idx < Size); if (!Ranges[idx].empty()) { @@ -90,17 +90,17 @@ public: } protected: - TString GetFilePrefix(const NProtoBuf::FileDescriptor* desc) { + TString GetFilePrefix(const NProtoBuf::FileDescriptor* desc) { if (desc->options().HasExtension(TabletTypeName)) { return desc->options().GetExtension(TabletTypeName) + "/"; } else { - return TString(); + return TString(); } } - TVector<TTabletPercentileCounter::TRangeDef> ParseRanges(const TCounterOptions& co) + TVector<TTabletPercentileCounter::TRangeDef> ParseRanges(const TCounterOptions& co) { - TVector<TTabletPercentileCounter::TRangeDef> ranges; + TVector<TTabletPercentileCounter::TRangeDef> ranges; ranges.reserve(co.RangesSize()); for (size_t j = 0; j < co.RangesSize(); j++) { const TRange& r = co.GetRanges(j); @@ -126,7 +126,7 @@ private: using TBase::Ranges; using TBase::Integral; using TBase::AppGlobalRanges; - TVector<TTabletPercentileCounter::TRangeDef> TxGlobalRanges; + TVector<TTabletPercentileCounter::TRangeDef> TxGlobalRanges; public: TParsedOpts() : TAppParsedOpts<AppCountersDesc>(TxCountersDesc()->value_count() * TxTypesDesc()->value_count()) @@ -146,7 +146,7 @@ public: Y_VERIFY(tt->options().HasExtension(TxTypeOpts), "tx type '%s' number (%d) is missing TxTypeOpts", tt->full_name().c_str(), txType); const TTxTypeOptions& tto = tt->options().GetExtension(TxTypeOpts); - TString txPrefix = tto.GetName() + "/"; + TString txPrefix = tto.GetName() + "/"; for (int i = 0; i < txDesc->value_count(); i++) { const NProtoBuf::EnumValueDescriptor* v = txDesc->value(i); Y_VERIFY(v->number() == v->index(), "counter '%s' number (%d) != index (%d)", @@ -160,7 +160,7 @@ public: const TCounterOptions& co = v->options().GetExtension(CounterOpts); Y_VERIFY(!co.GetName().empty(), "counter '%s' number (%d) has an empty name", v->full_name().c_str(), v->number()); - TVector<TTabletPercentileCounter::TRangeDef> ranges = TBase::ParseRanges(co); + TVector<TTabletPercentileCounter::TRangeDef> ranges = TBase::ParseRanges(co); NamesStrings.push_back(TBase::GetFilePrefix(typesDesc->file()) + txPrefix + co.GetName()); Ranges.push_back(TBase::ParseRanges(co)); Integral.push_back(co.GetIntegral()); @@ -179,7 +179,7 @@ public: virtual ~TParsedOpts() {} - virtual const TVector<TTabletPercentileCounter::TRangeDef>& GetRanges(size_t idx) const + virtual const TVector<TTabletPercentileCounter::TRangeDef>& GetRanges(size_t idx) const { Y_VERIFY(idx < Size); if (!Ranges[idx].empty()) { @@ -207,7 +207,7 @@ struct TParsedOptsPair { private: T1 Opts1; T2 Opts2; - TVector<const char*> Names; + TVector<const char*> Names; public: const size_t Size; public: @@ -230,7 +230,7 @@ public: return Names.begin(); } - const TVector<TTabletPercentileCounter::TRangeDef>& GetRanges(size_t idx) const + const TVector<TTabletPercentileCounter::TRangeDef>& GetRanges(size_t idx) const { Y_VERIFY(idx < Size); if (idx < Opts1.Size) @@ -267,12 +267,12 @@ struct TLabeledCounterParsedOpts { public: const size_t Size; protected: - TVector<TString> NamesStrings; - TVector<const char*> Names; - TVector<ui8> AggregateFuncs; - TVector<ui8> Types; - TVector<TString> GroupNamesStrings; - TVector<const char*> GroupNames; + TVector<TString> NamesStrings; + TVector<const char*> Names; + TVector<ui8> AggregateFuncs; + TVector<ui8> Types; + TVector<TString> GroupNamesStrings; + TVector<const char*> GroupNames; public: explicit TLabeledCounterParsedOpts() : Size(LabeledCountersDesc()->value_count()) @@ -296,7 +296,7 @@ public: } // Make plain strings out of Strokas to fullfil interface of TTabletCountersBase - for (const TString& s : NamesStrings) { + for (const TString& s : NamesStrings) { Names.push_back(s.data()); } @@ -309,7 +309,7 @@ public: GroupNamesStrings.push_back(gn.GetNames(i)); } - for (const TString& s : GroupNamesStrings) { + for (const TString& s : GroupNamesStrings) { GroupNames.push_back(s.data()); } } @@ -342,11 +342,11 @@ public: } protected: - TString GetFilePrefix(const NProtoBuf::FileDescriptor* desc) { + TString GetFilePrefix(const NProtoBuf::FileDescriptor* desc) { if (desc->options().HasExtension(TabletTypeName)) { return desc->options().GetExtension(TabletTypeName) + "/"; } else { - return TString(); + return TString(); } } }; @@ -623,12 +623,12 @@ public: return NAux::GetLabeledCounterOpts<SimpleDesc>(); } - TProtobufTabletLabeledCounters(const TString& group, const ui64 id) + TProtobufTabletLabeledCounters(const TString& group, const ui64 id) : TTabletLabeledCountersBase( SimpleOpts()->Size, SimpleOpts()->GetNames(), SimpleOpts()->GetCounterTypes(), SimpleOpts()->GetAggregateFuncs(), group, SimpleOpts()->GetGroupNames(), id) { - TVector<TString> groups; + TVector<TString> groups; StringSplitter(group).Split('/').SkipEmpty().Collect(&groups); //TODO: change here to "|" Y_VERIFY(SimpleOpts()->GetGroupNamesSize() == groups.size()); } diff --git a/ydb/core/tablet/tablet_impl.h b/ydb/core/tablet/tablet_impl.h index b47b1f10971..de1baf97ec1 100644 --- a/ydb/core/tablet/tablet_impl.h +++ b/ydb/core/tablet/tablet_impl.h @@ -85,7 +85,7 @@ struct TEvTabletBase { const NKikimrProto::EReplyStatus Status; const TLogoBlobID Latest; const ui32 BlockedGeneration; - const TString Buffer; + const TString Buffer; const TString ErrorReason; TEvFindLatestLogEntryResult(NKikimrProto::EReplyStatus status, const TString &reason = TString()) @@ -96,7 +96,7 @@ struct TEvTabletBase { Y_VERIFY_DEBUG(status != NKikimrProto::OK); } - TEvFindLatestLogEntryResult(const TLogoBlobID &latest, ui32 blockedGeneration, const TString &buffer) + TEvFindLatestLogEntryResult(const TLogoBlobID &latest, ui32 blockedGeneration, const TString &buffer) : Status(NKikimrProto::OK) , Latest(latest) , BlockedGeneration(blockedGeneration) diff --git a/ydb/core/tablet/tablet_list_renderer.cpp b/ydb/core/tablet/tablet_list_renderer.cpp index ad36f12a291..5252f8949d0 100644 --- a/ydb/core/tablet/tablet_list_renderer.cpp +++ b/ydb/core/tablet/tablet_list_renderer.cpp @@ -40,7 +40,7 @@ std::function<bool(const NKikimrWhiteboard::TTabletStateInfo&)> TTabletStateClas } } -TString TTabletStateClassifier::GetTabletStateClassName(ui32 cls) +TString TTabletStateClassifier::GetTabletStateClassName(ui32 cls) { switch(cls) { case ACTIVE_TABLETS: @@ -56,8 +56,8 @@ TString TTabletStateClassifier::GetTabletStateClassName(ui32 cls) ///////////////////////////// TTabletListRenderer ///////////////////////////// void TTabletListRenderer::RenderHeader(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo) { Y_UNUSED(tabletsToRender); @@ -73,8 +73,8 @@ void TTabletListRenderer::RenderHeader(TStringStream& str, } void TTabletListRenderer::RenderTableHeader(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo) { Y_UNUSED(listName); @@ -98,7 +98,7 @@ void TTabletListRenderer::RenderTableHeader(TStringStream& str, } } -TString TTabletListRenderer::MakeTabletMonURL(const TTabletListElement& elem, +TString TTabletListRenderer::MakeTabletMonURL(const TTabletListElement& elem, const TTabletFilterInfo& filterInfo) { Y_UNUSED(filterInfo); @@ -107,7 +107,7 @@ TString TTabletListRenderer::MakeTabletMonURL(const TTabletListElement& elem, return str.Str(); } -TString TTabletListRenderer::GetUserStateName(const TTabletListElement& elem) +TString TTabletListRenderer::GetUserStateName(const TTabletListElement& elem) { if (elem.TabletStateInfo->HasUserState()) { return ToString(elem.TabletStateInfo->GetUserState()); @@ -118,8 +118,8 @@ TString TTabletListRenderer::GetUserStateName(const TTabletListElement& elem) } void TTabletListRenderer::RenderTableBody(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo) { Y_UNUSED(listName); @@ -130,13 +130,13 @@ void TTabletListRenderer::RenderTableBody(TStringStream& str, const auto& nodeInfo = *elem.NodeInfo; auto index = elem.TabletIndex; TTabletTypes::EType tabletType = (TTabletTypes::EType)ti.GetType(); - TString tabletTypeStr = TTabletTypes::TypeToStr(tabletType); - TString nodeName = ToString(nodeInfo.NodeId); + TString tabletTypeStr = TTabletTypes::TypeToStr(tabletType); + TString nodeName = ToString(nodeInfo.NodeId); TABLER() { if (filterInfo.FilterNodeId == 0) { - TString nodeName = nodeInfo.Host.empty() ? nodeInfo.Address : nodeInfo.Host; - TString tooltip = nodeInfo.Address; + TString nodeName = nodeInfo.Host.empty() ? nodeInfo.Address : nodeInfo.Host; + TString tooltip = nodeInfo.Address; TABLED() {str << ToString(nodeInfo.NodeId);} TABLED() {str << "<span data-html='true' data-toggle='tooltip' title='" + tooltip + "'>" << nodeName << "</span>";} } @@ -162,7 +162,7 @@ void TTabletListRenderer::RenderTableBody(TStringStream& str, } } -TString TTabletListRenderer::GetStateName(ETabletState state) { +TString TTabletListRenderer::GetStateName(ETabletState state) { return NKikimrWhiteboard::TTabletStateInfo::ETabletState_Name(state); } @@ -177,8 +177,8 @@ void TTabletListRenderer::RenderPageFooter(TStringStream& str) } void TTabletListRenderer::RenderTabletList(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo) { IOutputStream &__stream(str); diff --git a/ydb/core/tablet/tablet_list_renderer.h b/ydb/core/tablet/tablet_list_renderer.h index 41de78016f5..7390ff2e4fa 100644 --- a/ydb/core/tablet/tablet_list_renderer.h +++ b/ydb/core/tablet/tablet_list_renderer.h @@ -20,7 +20,7 @@ private: public: virtual ui32 GetMaxTabletStateClass() const override; virtual std::function<bool(const NKikimrWhiteboard::TTabletStateInfo&)> GetTabletStateClassFilter(ui32 cls) const override; - virtual TString GetTabletStateClassName(ui32 cls) override; + virtual TString GetTabletStateClassName(ui32 cls) override; }; @@ -28,26 +28,26 @@ public: class TTabletListRenderer : public ITabletListRenderer { protected: using ETabletState = NKikimrWhiteboard::TTabletStateInfo::ETabletState; - static TString GetStateName(ETabletState state); + static TString GetStateName(ETabletState state); - virtual TString MakeTabletMonURL(const TTabletListElement& elem, + virtual TString MakeTabletMonURL(const TTabletListElement& elem, const TTabletFilterInfo& filterInfo); - virtual TString GetUserStateName(const TTabletListElement& elem); + virtual TString GetUserStateName(const TTabletListElement& elem); virtual void RenderHeader(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo); virtual void RenderTableHeader(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo); virtual void RenderTableBody(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo); public: @@ -56,8 +56,8 @@ public: void RenderPageFooter(TStringStream& str) override; void RenderTabletList(TStringStream& str, - const TString& listName, - const TVector<TTabletListElement>& tabletsToRender, + const TString& listName, + const TVector<TTabletListElement>& tabletsToRender, const TTabletFilterInfo& filterInfo) override; }; diff --git a/ydb/core/tablet/tablet_metrics.h b/ydb/core/tablet/tablet_metrics.h index b426284d33f..46cc49b702b 100644 --- a/ydb/core/tablet/tablet_metrics.h +++ b/ydb/core/tablet/tablet_metrics.h @@ -74,8 +74,8 @@ protected: ui32 LevelNetwork = 0; ui32 LevelStorage = 0; ui32 LevelIops = 0; - THashMap<std::pair<TChannel, TGroupId>, ui32> LevelReadThroughput; - THashMap<std::pair<TChannel, TGroupId>, ui32> LevelWriteThroughput; + THashMap<std::pair<TChannel, TGroupId>, ui32> LevelReadThroughput; + THashMap<std::pair<TChannel, TGroupId>, ui32> LevelWriteThroughput; THashMap<std::pair<TChannel, TGroupId>, ui32> LevelReadIops; THashMap<std::pair<TChannel, TGroupId>, ui32> LevelWriteIops; TInstant LastUpdate; diff --git a/ydb/core/tablet/tablet_metrics_ut.cpp b/ydb/core/tablet/tablet_metrics_ut.cpp index 57cab15a5d6..9c45bb71ffd 100644 --- a/ydb/core/tablet/tablet_metrics_ut.cpp +++ b/ydb/core/tablet/tablet_metrics_ut.cpp @@ -99,7 +99,7 @@ Y_UNIT_TEST_SUITE(TFlatMetrics) { Y_UNIT_TEST(TimeSeriesKV) { TTimeSeriesValue<i64> value; TInstant time = TInstant::Now(); - TVector<i64> values = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,7476717,0,529363,-1065564}; + TVector<i64> values = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,7476717,0,529363,-1065564}; time -= TDuration::Days(1); for (i64 val : values) { value.Increment(val, time); @@ -112,7 +112,7 @@ Y_UNIT_TEST_SUITE(TFlatMetrics) { Y_UNIT_TEST(TimeSeriesKV2) { TTimeSeriesValue<i64> value; TInstant time = TInstant::Now(); - TVector<i64> values = {0,0,0,0,1502,0,-64006,-100840,-151185,-4088398,-169038,-167227,-74841,-111563,-107191,-146359,-107399,-195925,-140440,-173191,-30211,-128287,-185191,-140449}; + TVector<i64> values = {0,0,0,0,1502,0,-64006,-100840,-151185,-4088398,-169038,-167227,-74841,-111563,-107191,-146359,-107399,-195925,-140440,-173191,-30211,-128287,-185191,-140449}; time -= TDuration::Days(1); for (i64 val : values) { value.Increment(val, time); diff --git a/ydb/core/tablet/tablet_monitoring_proxy.cpp b/ydb/core/tablet/tablet_monitoring_proxy.cpp index a61a43b7e5c..944069a8ce7 100644 --- a/ydb/core/tablet/tablet_monitoring_proxy.cpp +++ b/ydb/core/tablet/tablet_monitoring_proxy.cpp @@ -95,7 +95,7 @@ public: Detach(ctx); } - void Notify(const TActorContext &ctx, const TString& html) { + void Notify(const TActorContext &ctx, const TString& html) { ctx.Send(Sender, new NMon::TEvHttpInfoRes(html)); } @@ -114,7 +114,7 @@ private: const ui64 TargetTablet; const bool ForceFollower; const TActorId Sender; - const TString Query; + const TString Query; TActorId PipeClient; const HTTP_METHOD Method; }; diff --git a/ydb/core/tablet/tablet_pipe_ut.cpp b/ydb/core/tablet/tablet_pipe_ut.cpp index 2a528070fb6..438746b8eb5 100644 --- a/ydb/core/tablet/tablet_pipe_ut.cpp +++ b/ydb/core/tablet/tablet_pipe_ut.cpp @@ -576,7 +576,7 @@ Y_UNIT_TEST_SUITE(TTabletPipeTest) { SetupTabletServices(runtime); TActorId sender = runtime.AllocateEdgeActor(); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); auto guard = CreateTabletScheduledEventsGuard(tabletIds, runtime, sender); @@ -721,7 +721,7 @@ Y_UNIT_TEST_SUITE(TTabletPipeTest) { TActorId sender = runtime.AllocateEdgeActor(); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); auto guard = CreateTabletScheduledEventsGuard(tabletIds, runtime, sender); @@ -878,7 +878,7 @@ Y_UNIT_TEST_SUITE(TTabletPipeTest) { TTestBasicRuntime runtime; SetupTabletServices(runtime); TActorId sender = runtime.AllocateEdgeActor(); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); auto scheduledEventsGuard = CreateTabletScheduledEventsGuard(tabletIds, runtime, sender); @@ -988,7 +988,7 @@ Y_UNIT_TEST_SUITE(TTabletPipeTest) { TActorId sender1 = runtime.AllocateEdgeActor(0); TActorId sender2 = runtime.AllocateEdgeActor(1); - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); auto guard = CreateTabletScheduledEventsGuard(tabletIds, runtime, sender1); diff --git a/ydb/core/tablet/tablet_req_delete.cpp b/ydb/core/tablet/tablet_req_delete.cpp index 754c79bb325..dee999c3516 100644 --- a/ydb/core/tablet/tablet_req_delete.cpp +++ b/ydb/core/tablet/tablet_req_delete.cpp @@ -21,7 +21,7 @@ class TTabletReqDelete : public TActorBootstrapped<TTabletReqDelete> { const TActorId Owner; TIntrusivePtr<TTabletStorageInfo> TabletStorageInfo; - TVector<TRequestInfo> Requests; + TVector<TRequestInfo> Requests; ui32 FinishedRequests; ui32 ErrorCount; ui32 Generation; @@ -42,7 +42,7 @@ class TTabletReqDelete : public TActorBootstrapped<TTabletReqDelete> { } void GenerateRequests() { - THashSet<std::pair<ui32, ui32>> groupChannels; + THashSet<std::pair<ui32, ui32>> groupChannels; for (const TTabletChannelInfo& channelInfo : TabletStorageInfo->Channels) { for (const TTabletChannelInfo::THistoryEntry& historyInfo : channelInfo.History) { if (groupChannels.emplace(historyInfo.GroupID, channelInfo.Channel).second) { diff --git a/ydb/core/tablet/tablet_req_rebuildhistory.cpp b/ydb/core/tablet/tablet_req_rebuildhistory.cpp index c0b4c0c2bc1..6cfcbeed561 100644 --- a/ydb/core/tablet/tablet_req_rebuildhistory.cpp +++ b/ydb/core/tablet/tablet_req_rebuildhistory.cpp @@ -39,14 +39,14 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil StatusMustBeIgnoredBody, } Status; - TVector<TLogoBlobID> References; - TVector<ui32> DependsOn; + TVector<TLogoBlobID> References; + TVector<ui32> DependsOn; bool IsSnapshot; bool IsTotalSnapshot; - TString EmbeddedLogBody; + TString EmbeddedLogBody; - TVector<TLogoBlobID> GcDiscovered; - TVector<TLogoBlobID> GcLeft; + TVector<TLogoBlobID> GcDiscovered; + TVector<TLogoBlobID> GcLeft; void BecomeConfirmed() { switch (Status) { @@ -155,7 +155,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil }; struct TGenerationEntry { - TVector<TLogEntry> Body; + TVector<TLogEntry> Body; std::pair<ui32, ui32> PrevGeneration; // gen : confirmed-state ui32 NextGeneration; ui32 Base; @@ -193,10 +193,10 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil std::pair<ui32, ui32> Snapshot; std::pair<ui32, ui32> Confirmed; - TMap<ui32, TGenerationEntry> LogInfo; - TSet<TLogoBlobID> RefsToCheck; + TMap<ui32, TGenerationEntry> LogInfo; + TSet<TLogoBlobID> RefsToCheck; TMap<ui32, TVector<TLogoBlobID>> RefsToCheckByGroup; - TSet<TLogoBlobID> RangesToDiscover; + TSet<TLogoBlobID> RangesToDiscover; ui32 RequestsLeft; NMetrics::TTabletThroughputRawValue GroupReadBytes; @@ -340,7 +340,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil sb << LogoBlobIDFromLogoBlobID(t).ToString() << ","; sb << "] for " << Info->TabletID; - return (TString)sb; + return (TString)sb; }()); const ui32 step = id.Step(); @@ -450,7 +450,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil IntrospectionTrace->Attach(MakeHolder<NTracing::TOnApplyDiscoveryRange>(msg->GroupId, msg->From, msg->To)); } Y_VERIFY(RangesToDiscover.erase(msg->To)); - for (TVector<TEvBlobStorage::TEvRangeResult::TResponse>::iterator it = msg->Responses.begin(), end = msg->Responses.end(); it != end; ++it) { + for (TVector<TEvBlobStorage::TEvRangeResult::TResponse>::iterator it = msg->Responses.begin(), end = msg->Responses.end(); it != end; ++it) { const TLogoBlobID &id = it->Id; GroupReadBytes[std::make_pair(id.Channel(), msg->GroupId)] += it->Buffer.size(); @@ -603,7 +603,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil std::pair<ui32, ui32> invalidLogEntry = std::make_pair(Max<ui32>(), Max<ui32>()); ui32 lastUnbrokenTailEntry = Confirmed.second; - for (TMap<ui32, TGenerationEntry>::iterator gen = LogInfo.begin(), egen = LogInfo.end();;) { + for (TMap<ui32, TGenerationEntry>::iterator gen = LogInfo.begin(), egen = LogInfo.end();;) { const ui32 generation = gen->first; TGenerationEntry &gx = gen->second; const bool isTailGeneration = LatestKnownStep.first == generation && Confirmed.first == generation; @@ -634,14 +634,14 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil case TLogEntry::StatusBody: { bool dependsOk = true; - for (TVector<ui32>::const_iterator it = entry.DependsOn.begin(), end = entry.DependsOn.end(); dependsOk && it != end; ++it) { + for (TVector<ui32>::const_iterator it = entry.DependsOn.begin(), end = entry.DependsOn.end(); dependsOk && it != end; ++it) { const ui32 x = *it; Y_VERIFY(x < step, "depends on future step %" PRIu32 " from %" PRIu32 ":%" PRIu32, x, generation, step); dependsOk = x < gx.Base || x <= Confirmed.second || gx.Entry(x).Status == TLogEntry::StatusOk || x <= generationSnapshotStep; } bool refsOk = true; - for (TVector<TLogoBlobID>::const_iterator it = entry.References.begin(), end = entry.References.end(); refsOk && it != end; ++it) { + for (TVector<TLogoBlobID>::const_iterator it = entry.References.begin(), end = entry.References.end(); refsOk && it != end; ++it) { const TLogoBlobID &x = *it; refsOk = !RefsToCheck.contains(x); } @@ -675,7 +675,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil sb << "]"; } - return (TString) sb; + return (TString) sb; }()); if (entry.EmbeddedLogBody) @@ -713,7 +713,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil } sb << "] for " << Info->TabletID; - return (TString) sb; + return (TString) sb; }()); if (entry.EmbeddedLogBody) @@ -759,7 +759,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil TStringBuilder sb; sb << "TTabletReqRebuildHistoryGraph::BuildHistory - Graph rebuild error - no Log entry for "; sb << Info->TabletID << ":" << invalidLogEntry.first << ":" << invalidLogEntry.second; - return (TString)sb; + return (TString)sb; }()); if (IntrospectionTrace) { IntrospectionTrace->Attach(MakeHolder<NTracing::TErrorRebuildGraph>(invalidLogEntry.first, invalidLogEntry.second)); diff --git a/ydb/core/tablet/tablet_req_writelog.cpp b/ydb/core/tablet/tablet_req_writelog.cpp index 7c4d02c405c..83877220da7 100644 --- a/ydb/core/tablet/tablet_req_writelog.cpp +++ b/ydb/core/tablet/tablet_req_writelog.cpp @@ -12,7 +12,7 @@ class TTabletReqWriteLog : public TActorBootstrapped<TTabletReqWriteLog> { const TActorId Owner; const TLogoBlobID LogEntryID; TAutoPtr<NKikimrTabletBase::TTabletLogEntry> LogEntry; - TVector<TEvTablet::TLogEntryReference> References; + TVector<TEvTablet::TLogEntryReference> References; const TEvBlobStorage::TEvPut::ETactic CommitTactic; TIntrusivePtr<TTabletStorageInfo> Info; @@ -85,7 +85,7 @@ class TTabletReqWriteLog : public TActorBootstrapped<TTabletReqWriteLog> { Die(ctx); } - void SendToBS(const TLogoBlobID &id, const TString &buffer, const TActorContext &ctx, + void SendToBS(const TLogoBlobID &id, const TString &buffer, const TActorContext &ctx, const NKikimrBlobStorage::EPutHandleClass handleClass) { Y_VERIFY(id.TabletID() == Info->TabletID); const TTabletChannelInfo *channelInfo = Info->ChannelInfo(id.Channel()); @@ -117,7 +117,7 @@ public: } void Bootstrap(const TActorContext &ctx) { - TString logEntryBuffer = LogEntry->SerializeAsString(); + TString logEntryBuffer = LogEntry->SerializeAsString(); // todo: adaptive save-with-retry and timeouts // todo: cancelation diff --git a/ydb/core/tablet/tablet_resolver.cpp b/ydb/core/tablet/tablet_resolver.cpp index c0a39a2216b..337cb6f9111 100644 --- a/ydb/core/tablet/tablet_resolver.cpp +++ b/ydb/core/tablet/tablet_resolver.cpp @@ -38,7 +38,7 @@ class TTabletResolver : public TActorBootstrapped<TTabletResolver> { , Cookie(cookie) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{EvPingTimeout TabletID: " << TabletID; if (Cookie.Get()) { @@ -98,11 +98,11 @@ class TTabletResolver : public TActorBootstrapped<TTabletResolver> { {} }; - typedef TOneOneQueueInplace<TQueueEntry *, 64> TQueueType; + typedef TOneOneQueueInplace<TQueueEntry *, 64> TQueueType; EState State = StInit; - TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> Queue; + TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> Queue; TActorId KnownLeader; TActorId KnownLeaderTablet; @@ -199,7 +199,7 @@ class TTabletResolver : public TActorBootstrapped<TTabletResolver> { bool PushQueue(TEvTabletResolver::TEvForward::TPtr &ev, TEntry &entry, const TActorContext &ctx) { if (!entry.Queue) - entry.Queue.Reset(new TEntry::TQueueType()); + entry.Queue.Reset(new TEntry::TQueueType()); entry.Queue->Push(new TEntry::TQueueEntry(ctx.Now(), ev)); return true; } @@ -321,7 +321,7 @@ class TTabletResolver : public TActorBootstrapped<TTabletResolver> { } void SendQueued(ui64 tabletId, TEntry &entry, const TActorContext &ctx) { - if (TEntry::TQueueType *queue = entry.Queue.Get()) { + if (TEntry::TQueueType *queue = entry.Queue.Get()) { for (TAutoPtr<TEntry::TQueueEntry> x = queue->Pop(); !!x; x.Reset(queue->Pop())) { TEvTabletResolver::TEvForward *msg = x->Ev->Get(); if (!SendForward(x->Ev->Sender, entry, msg, ctx)) @@ -356,7 +356,7 @@ class TTabletResolver : public TActorBootstrapped<TTabletResolver> { LOG_DEBUG(ctx, NKikimrServices::TABLET_RESOLVER, "DropEntry tabletId: %" PRIu64 " followers: %" PRIu64, tabletId, entry.KnownFollowers.size()); - if (TEntry::TQueueType *queue = entry.Queue.Get()) { + if (TEntry::TQueueType *queue = entry.Queue.Get()) { for (TAutoPtr<TEntry::TQueueEntry> x = queue->Pop(); !!x; x.Reset(queue->Pop())) { ctx.Send(x->Ev->Sender, new TEvTabletResolver::TEvForwardResult(NKikimrProto::ERROR, tabletId)); } @@ -819,7 +819,7 @@ public: if (!value) return; - if (TEntry::TQueueType *queue = value->Queue.Get()) { + if (TEntry::TQueueType *queue = value->Queue.Get()) { for (TAutoPtr<TEntry::TQueueEntry> x = queue->Pop(); !!x; x.Reset(queue->Pop())) { ActorSystem->Send(x->Ev->Sender, new TEvTabletResolver::TEvForwardResult(NKikimrProto::RACE, key)); } diff --git a/ydb/core/tablet/tablet_setup.h b/ydb/core/tablet/tablet_setup.h index 57ea7d6edba..6b0cdaab4ae 100644 --- a/ydb/core/tablet/tablet_setup.h +++ b/ydb/core/tablet/tablet_setup.h @@ -50,7 +50,7 @@ IActor* CreateTabletFollower(const TActorId &launcher, TTabletStorageInfo *info, struct ITabletFactory: public virtual TThrRefBase { virtual TIntrusivePtr<TTabletSetupInfo> CreateTablet( - const TString& typeName, + const TString& typeName, const TIntrusivePtr<TTabletStorageInfo>& tabletInfo, const TAppData& appData) = 0; }; diff --git a/ydb/core/tablet/tablet_sys.cpp b/ydb/core/tablet/tablet_sys.cpp index 44bfac7b2d6..88f9495abd4 100644 --- a/ydb/core/tablet/tablet_sys.cpp +++ b/ydb/core/tablet/tablet_sys.cpp @@ -129,11 +129,11 @@ void TTablet::WriteZeroEntry(TEvTablet::TDependencyGraph *graph) { ui32 confirmedStep = 0; ui32 lastInGeneration = 0; - TDeque<TEvTablet::TDependencyGraph::TEntry>::iterator it = graph->Entries.begin(); - TDeque<TEvTablet::TDependencyGraph::TEntry>::iterator end = graph->Entries.end(); + TDeque<TEvTablet::TDependencyGraph::TEntry>::iterator it = graph->Entries.begin(); + TDeque<TEvTablet::TDependencyGraph::TEntry>::iterator end = graph->Entries.end(); - TDeque<TEvTablet::TDependencyGraph::TEntry>::iterator snapIterator = it; - TDeque<TEvTablet::TDependencyGraph::TEntry>::iterator confirmedIterator = it; + TDeque<TEvTablet::TDependencyGraph::TEntry>::iterator snapIterator = it; + TDeque<TEvTablet::TDependencyGraph::TEntry>::iterator confirmedIterator = it; // find tail (todo: do it in reverse order?) for (; it != end; ++it) { @@ -218,7 +218,7 @@ void TTablet::WriteZeroEntry(TEvTablet::TDependencyGraph *graph) { Graph.Snapshot = snapshot; const TLogoBlobID logid(TabletID(), StateStorageInfo.KnownGeneration, 0, 0, 0, 0); - TVector<TEvTablet::TLogEntryReference> refs; + TVector<TEvTablet::TLogEntryReference> refs; Register(CreateTabletReqWriteLog(SelfId(), logid, entry.Release(), refs, TEvBlobStorage::TEvPut::TacticMinLatency, Info.Get())); BLOG_D(" TTablet::WriteZeroEntry. logid# " << logid.ToString()); @@ -1123,10 +1123,10 @@ bool TTablet::HandleNext(TEvTablet::TEvCommit::TPtr &ev) { if (saveFollowerUpdate) entry->FollowerUpdate->References.reserve(msg->References.size()); - for (TVector<TLogoBlobID>::const_iterator it = msg->ExternalReferences.begin(), end = msg->ExternalReferences.end(); it != end; ++it) + for (TVector<TLogoBlobID>::const_iterator it = msg->ExternalReferences.begin(), end = msg->ExternalReferences.end(); it != end; ++it) LogoBlobIDFromLogoBlobID(*it, x->AddReferences()); - for (TVector<TEvTablet::TLogEntryReference>::const_iterator it = msg->References.begin(), end = msg->References.end(); it != end; ++it) { + for (TVector<TEvTablet::TLogEntryReference>::const_iterator it = msg->References.begin(), end = msg->References.end(); it != end; ++it) { const TLogoBlobID &id = it->Id; Y_VERIFY(id.TabletID() == TabletID() && id.Generation() == StateStorageInfo.KnownGeneration); LogoBlobIDFromLogoBlobID(id, x->AddReferences()); @@ -1290,7 +1290,7 @@ void TTablet::GcLogChannel(ui32 step) { const TTabletChannelInfo *channelInfo = Info->ChannelInfo(0); if (GcCounter == 0) { - TSet<ui32> alreadySent; + TSet<ui32> alreadySent; for (const auto &x : channelInfo->History) { const ui32 groupId = x.GroupID; if (!alreadySent.insert(groupId).second) @@ -1910,7 +1910,7 @@ void TTablet::ExternalWriteZeroEntry(TTabletStorageInfo *info, ui32 gen, TActorI entry->SetZeroConfirmed(MakeGenStepPair(0, 0)); entry->SetZeroTailSz(0); TLogoBlobID logid(info->TabletID, gen, 0, 0, 0, 0); - TVector<TEvTablet::TLogEntryReference> refs; + TVector<TEvTablet::TLogEntryReference> refs; TActivationContext::Register(CreateTabletReqWriteLog(owner, logid, entry.Release(), refs, TEvBlobStorage::TEvPut::TacticDefault, info)); } diff --git a/ydb/core/tablet/tablet_sys.h b/ydb/core/tablet/tablet_sys.h index 661d75a4e0a..635f015b4e4 100644 --- a/ydb/core/tablet/tablet_sys.h +++ b/ydb/core/tablet/tablet_sys.h @@ -57,19 +57,19 @@ class TTablet : public TActor<TTablet> { } StateStorageInfo; struct TFollowerUpdate { - TVector<std::pair<TLogoBlobID, TString>> References; - TString Body; - TString AuxPayload; + TVector<std::pair<TLogoBlobID, TString>> References; + TString Body; + TString AuxPayload; - TVector<TLogoBlobID> GcDiscovered; - TVector<TLogoBlobID> GcLeft; + TVector<TLogoBlobID> GcDiscovered; + TVector<TLogoBlobID> GcLeft; }; struct TLogEntry { const ui32 Step; const ui32 ConfirmedOnSend; - TVector<ui32> Dependent; + TVector<ui32> Dependent; bool StateStorageConfirmed; bool BlobStorageConfirmed; ui32 DependenciesLeft; @@ -113,9 +113,9 @@ class TTablet : public TActor<TTablet> { struct TGraph { typedef TDeque<std::unique_ptr<TLogEntry>> TQueueType; - typedef THashMap<ui32, TLogEntry *> TIndex; + typedef THashMap<ui32, TLogEntry *> TIndex; - TQueueType Queue; + TQueueType Queue; TQueueType PostponedFollowerUpdates; TIndex Index; TDeque<TEvTablet::TEvCommit::TPtr> DelayCommitQueue; diff --git a/ydb/core/tablet_flat/flat_boot_blobs.h b/ydb/core/tablet_flat/flat_boot_blobs.h index 098d0fed5dc..b4a4c195bf8 100644 --- a/ydb/core/tablet_flat/flat_boot_blobs.h +++ b/ydb/core/tablet_flat/flat_boot_blobs.h @@ -14,7 +14,7 @@ namespace NBoot { class TLoadBlobs: public NBoot::IStep { public: - using TBlobIds = TVector<TLogoBlobID>; + using TBlobIds = TVector<TLogoBlobID>; static constexpr NBoot::EStep StepKind = NBoot::EStep::Blobs; @@ -28,7 +28,7 @@ namespace NBoot { void Start() noexcept override { } - void Feed(TLogoBlobID blobId, TString body) + void Feed(TLogoBlobID blobId, TString body) { if (State.Apply(blobId, std::move(body)) && Env) Env->Finish(this); diff --git a/ydb/core/tablet_flat/flat_boot_bundle.h b/ydb/core/tablet_flat/flat_boot_bundle.h index ecdec63649f..9b19a666072 100644 --- a/ydb/core/tablet_flat/flat_boot_bundle.h +++ b/ydb/core/tablet_flat/flat_boot_bundle.h @@ -149,7 +149,7 @@ namespace NBoot { TVector<NPageCollection::TLargeGlobId> LargeGlobIds; TVector<TIntrusivePtr<TCache>> PageCollections; TString Legacy; - TString Opaque; + TString Opaque; TVector<TString> Deltas; NTable::TEpoch Epoch; diff --git a/ydb/core/tablet_flat/flat_cxx_database.h b/ydb/core/tablet_flat/flat_cxx_database.h index 27a260bcb27..7261361ac57 100644 --- a/ydb/core/tablet_flat/flat_cxx_database.h +++ b/ydb/core/tablet_flat/flat_cxx_database.h @@ -162,12 +162,12 @@ public: return *reinterpret_cast<const TActorId*>(Data()); } - operator TString() const { + operator TString() const { Y_VERIFY(Type() == NScheme::NTypeIds::Utf8 || Type() == NScheme::NTypeIds::String || Type() == NScheme::NTypeIds::String2m || Type() == NScheme::NTypeIds::String4k, "Data=%" PRIxPTR ", Type=%" PRIi64 ", Size=%" PRIi64, (ui64)Data(), (i64)Type(), (i64)Size()); - return TString(reinterpret_cast<const char*>(Data()), Size()); + return TString(reinterpret_cast<const char*>(Data()), Size()); } operator TBuffer() const { @@ -188,18 +188,18 @@ public: } template <typename ElementType> - operator TVector<ElementType>() const { + operator TVector<ElementType>() const { static_assert(std::is_pod<ElementType>::value, "ElementType should be a POD type"); Y_VERIFY(Type() == NScheme::NTypeIds::String || Type() == NScheme::NTypeIds::String4k || Type() == NScheme::NTypeIds::String2m); Y_VERIFY(Size() % sizeof(ElementType) == 0); std::size_t count = Size() / sizeof(ElementType); const ElementType *begin = reinterpret_cast<const ElementType*>(Data()); const ElementType *end = begin + count; - return TVector<ElementType>(begin, end); + return TVector<ElementType>(begin, end); } template <typename ElementType> - void ExtractArray(THashSet<ElementType> &container) const { + void ExtractArray(THashSet<ElementType> &container) const { static_assert(std::is_pod<ElementType>::value, "ElementType should be a POD type"); Y_VERIFY(Type() == NScheme::NTypeIds::String || Type() == NScheme::NTypeIds::String4k || Type() == NScheme::NTypeIds::String2m); Y_VERIFY(Size() % sizeof(ElementType) == 0); @@ -266,7 +266,7 @@ public: } template <typename ElementType> - static typename NSchemeTypeMapper<NScheme::NTypeIds::String>::Type ConvertFrom(const TVector<ElementType>& value) { + static typename NSchemeTypeMapper<NScheme::NTypeIds::String>::Type ConvertFrom(const TVector<ElementType>& value) { return static_cast<typename NSchemeTypeMapper<NScheme::NTypeIds::String>::Type>( TString( reinterpret_cast<const char*>(value.data()), value.size() * sizeof(ElementType) @@ -647,7 +647,7 @@ struct Schema { constexpr static bool IsNotNull = _IsNotNull; using Type = typename NSchemeTypeMapper<_ColumnType>::Type; - static TString GetColumnName(const TString& typeName) { + static TString GetColumnName(const TString& typeName) { return typeName.substr(typeName.rfind(':') + 1); } }; @@ -661,11 +661,11 @@ struct Schema { using TupleType = std::tuple<typename T::Type>; using RealTupleType = std::tuple<typename NSchemeTypeMapper<T::ColumnType>::Type>; - static TString GetColumnName() { + static TString GetColumnName() { return GetColumnName(TypeName<T>()); } - static TString GetColumnName(const TString& typeName) { + static TString GetColumnName(const TString& typeName) { return T::GetColumnName(typeName); } @@ -1827,7 +1827,7 @@ struct Schema { template <TDuration::TValue Period = 0> struct ExecutorLogFlushPeriod { static void Materialize(TToughDb& database) { - database.Alter().SetExecutorLogFlushPeriod(TDuration::MicroSeconds(Period)); + database.Alter().SetExecutorLogFlushPeriod(TDuration::MicroSeconds(Period)); } }; @@ -1868,7 +1868,7 @@ struct Schema { template <typename Type> struct SchemaTables<Type> { - static TString GetTableName(const TString& typeName) { + static TString GetTableName(const TString& typeName) { return typeName.substr(typeName.rfind(':') + 1); } diff --git a/ydb/core/tablet_flat/flat_cxx_database_ut.cpp b/ydb/core/tablet_flat/flat_cxx_database_ut.cpp index 0423d82e624..beceb2be280 100644 --- a/ydb/core/tablet_flat/flat_cxx_database_ut.cpp +++ b/ydb/core/tablet_flat/flat_cxx_database_ut.cpp @@ -184,7 +184,7 @@ Y_UNIT_TEST_SUITE(TFlatCxxDatabaseTest) { UNIT_ASSERT(row.IsReady()); UNIT_ASSERT(row.IsValid()); ui64 value = row.GetValue<Schema::TestTable::Value>(); - TString name = row.GetValue<Schema::TestTable::Name>(); + TString name = row.GetValue<Schema::TestTable::Name>(); bool boolValue = row.GetValue<Schema::TestTable::BoolValue>(); ESomeEnum enumValue = row.GetValue<Schema::TestTable::EnumValue>(); TInstant instantValue = row.GetValue<Schema::TestTable::InstantValue>(); @@ -219,7 +219,7 @@ Y_UNIT_TEST_SUITE(TFlatCxxDatabaseTest) { for (ui64 i = 0; i < 1000; ++i) { UNIT_ASSERT(!rowset.EndOfSet()); ui64 value = rowset.GetValue<Schema::TestTable::Value>(); - TString name = rowset.GetValue<Schema::TestTable::Name>(); + TString name = rowset.GetValue<Schema::TestTable::Name>(); bool boolValue = rowset.GetValue<Schema::TestTable::BoolValue>(); UNIT_ASSERT_EQUAL(value, i); UNIT_ASSERT_EQUAL(ToString(value), name); @@ -315,7 +315,7 @@ Y_UNIT_TEST_SUITE(TFlatCxxDatabaseTest) { for (ui64 i = 500; i < 1000; ++i) { UNIT_ASSERT(!rowset.EndOfSet()); ui64 value = rowset.GetValue<Schema::TestTable::Value>(); - TString name = rowset.GetValue<Schema::TestTable::Name>(); + TString name = rowset.GetValue<Schema::TestTable::Name>(); bool boolValue = rowset.GetValue<Schema::TestTable::BoolValue>(); UNIT_ASSERT_EQUAL(value, i); UNIT_ASSERT_EQUAL(ToString(value), name); @@ -573,8 +573,8 @@ Y_UNIT_TEST_SUITE(TFlatCxxDatabaseTest) { UNIT_ASSERT(rowset.IsReady()); for (ui64 j = 0; j < 4; ++j) { UNIT_ASSERT(rowset.IsValid()); - TString should = IntToString<16>(j); - TString have = rowset.GetValue<Schema::TestTable3::ID2>(); + TString should = IntToString<16>(j); + TString have = rowset.GetValue<Schema::TestTable3::ID2>(); UNIT_ASSERT_EQUAL(should, have); UNIT_ASSERT_EQUAL((i - 1) * 4 + j, rowset.GetValue<Schema::TestTable3::Value>()); UNIT_ASSERT(rowset.Next()); diff --git a/ydb/core/tablet_flat/flat_dbase_scheme.h b/ydb/core/tablet_flat/flat_dbase_scheme.h index 1fd5ed2b480..b78128404a3 100644 --- a/ydb/core/tablet_flat/flat_dbase_scheme.h +++ b/ydb/core/tablet_flat/flat_dbase_scheme.h @@ -94,9 +94,9 @@ public: } ui32 Id; - TString Name; - THashMap<ui32, TRoom> Rooms; - THashMap<ui32, TFamily> Families; + TString Name; + THashMap<ui32, TRoom> Rooms; + THashMap<ui32, TFamily> Families; TIntrusiveConstPtr<TCompactionPolicy> CompactionPolicy; bool ColdBorrow = false; @@ -194,8 +194,8 @@ public: } - THashMap<ui32, TTableInfo> Tables; - THashMap<TString, ui32> TableNames; + THashMap<ui32, TTableInfo> Tables; + THashMap<TString, ui32> TableNames; TExecutorInfo Executor; TRedo Redo; }; diff --git a/ydb/core/tablet_flat/flat_dbase_sz_env.h b/ydb/core/tablet_flat/flat_dbase_sz_env.h index 39be8cd853c..a4637fa907d 100644 --- a/ydb/core/tablet_flat/flat_dbase_sz_env.h +++ b/ydb/core/tablet_flat/flat_dbase_sz_env.h @@ -46,7 +46,7 @@ namespace NTable { } private: - THashMap<const void*, THashSet<TPageId>> Touched; + THashMap<const void*, THashSet<TPageId>> Touched; ui64 Pages = 0; ui64 Bytes = 0; }; diff --git a/ydb/core/tablet_flat/flat_executor.cpp b/ydb/core/tablet_flat/flat_executor.cpp index 59afc462158..9608fb86134 100644 --- a/ydb/core/tablet_flat/flat_executor.cpp +++ b/ydb/core/tablet_flat/flat_executor.cpp @@ -802,9 +802,9 @@ void TExecutor::ApplyFollowerUpdate(THolder<TEvTablet::TFUpdateBody> update) { if (update->IsSnapshot) // do nothing over snapshot after initial one return; - TString schemeUpdate; - TString dataUpdate; - TStackVec<TString> partSwitches; + TString schemeUpdate; + TString dataUpdate; + TStackVec<TString> partSwitches; TStackVec<TLogoBlob> loanPartInfos; TVector<NPageCollection::TMemGlob> annex; @@ -814,7 +814,7 @@ void TExecutor::ApplyFollowerUpdate(THolder<TEvTablet::TFUpdateBody> update) { } else { for (auto &xpair : update->References) { const TLogoBlobID &id = xpair.first; - const TString &body = xpair.second; + const TString &body = xpair.second; const NBoot::TCookie cookie(id.Cookie()); Y_VERIFY(cookie.Type() == NBoot::TCookie::EType::Log); @@ -938,7 +938,7 @@ void TExecutor::ApplyFollowerAuxUpdate(const TString &auxBody) { if (!collectionInfo) continue; - TVector<NTable::TPageId> pages; + TVector<NTable::TPageId> pages; for (ui32 pageId : x.GetTouchedPages()) { auto* page = collectionInfo->EnsurePage(pageId); @@ -1706,7 +1706,7 @@ void TExecutor::PostponeTransaction(TAutoPtr<TSeat> seat, TPageCollectionTxEnv & for (auto &xpair : env.ToLoad) { TPrivatePageCache::TInfo *pageCollectionInfo = xpair.first; - TVector<NTable::TPageId> pages; + TVector<NTable::TPageId> pages; pages.reserve(xpair.second.size()); waitPages += xpair.second.size(); @@ -2457,7 +2457,7 @@ void TExecutor::Handle(NSharedCache::TEvRequest::TPtr &ev) { } TVector<NSharedCache::TEvResult::TLoaded> cached; - TVector<NTable::TPageId> left; + TVector<NTable::TPageId> left; for (auto &x : msg->Pages) { if (TSharedPageRef body = PrivatePageCache->LookupShared(x, collectionInfo)) { @@ -3723,7 +3723,7 @@ void TExecutor::RenderHtmlPage(NMon::TEvRemoteHttpInfo::TPtr &ev) const { } H3() {str << "Scheme:";} - TVector<ui32> tables; + TVector<ui32> tables; for (const auto &xtable : scheme->Tables) tables.push_back(xtable.first); Sort(tables); @@ -3740,7 +3740,7 @@ void TExecutor::RenderHtmlPage(NMon::TEvRemoteHttpInfo::TPtr &ev) const { } } TABLEBODY() { - TVector<ui32> columns; + TVector<ui32> columns; for (const auto &xcol : tinfo.Columns) columns.push_back(xcol.first); Sort(columns); diff --git a/ydb/core/tablet_flat/flat_executor.h b/ydb/core/tablet_flat/flat_executor.h index df08b3a338a..4cc7f3fdf1b 100644 --- a/ydb/core/tablet_flat/flat_executor.h +++ b/ydb/core/tablet_flat/flat_executor.h @@ -262,7 +262,7 @@ struct TPendingPartSwitch { TVector<TChangedBundle> Changed; TVector<TBundleDelta> Deltas; - TVector<TLogoBlobID> Leaving; + TVector<TLogoBlobID> Leaving; TVector<TLogoBlobID> LeavingTxStatus; TVector<TBundleMove> Moves; NTable::TEpoch Head = NTable::TEpoch::Zero(); @@ -374,7 +374,7 @@ class TExecutor ui32 ActivateTransactionWaiting = 0; ui32 ActivateTransactionInFlight = 0; - using TWaitingSnaps = THashMap<TTableSnapshotContext *, TIntrusivePtr<TTableSnapshotContext>>; + using TWaitingSnaps = THashMap<TTableSnapshotContext *, TIntrusivePtr<TTableSnapshotContext>>; const TIntrusivePtr<TIdEmitter> Emitter; TAutoPtr<TBroker> Broker; @@ -431,7 +431,7 @@ class TExecutor THolder<TExecutorStatsImpl> Stats; bool HasYellowCheckInFly = false; - TDeque<TPendingPartSwitch> PendingPartSwitches; + TDeque<TPendingPartSwitch> PendingPartSwitches; size_t ReadyPartSwitches = 0; ui64 UsedTabletMemory = 0; @@ -575,7 +575,7 @@ public: void DetachTablet(const TActorContext &ctx) override; void Execute(TAutoPtr<ITransaction> transaction, const TActorContext &ctx) override; - TString BorrowSnapshot(ui32 tableId, const TTableSnapshotContext& snap, TRawVals from, TRawVals to, ui64 loaner) const override; + TString BorrowSnapshot(ui32 tableId, const TTableSnapshotContext& snap, TRawVals from, TRawVals to, ui64 loaner) const override; ui64 MakeScanSnapshot(ui32 table) override; void DropScanSnapshot(ui64 snapId) override; diff --git a/ydb/core/tablet_flat/flat_executor_borrowlogic.cpp b/ydb/core/tablet_flat/flat_executor_borrowlogic.cpp index bd52264b10e..8b057073539 100644 --- a/ydb/core/tablet_flat/flat_executor_borrowlogic.cpp +++ b/ydb/core/tablet_flat/flat_executor_borrowlogic.cpp @@ -220,7 +220,7 @@ bool TExecutorBorrowLogic::BundleCompacted( void TExecutorBorrowLogic::BorrowBundle( const TLogoBlobID &bundleId, - const TSet<ui64> &loaners, + const TSet<ui64> &loaners, TLogCommit *commit) { auto storedInfoItPair = BorrowedInfo.insert(std::make_pair(bundleId, TBorrowedPartInfo())); @@ -298,7 +298,7 @@ void TExecutorBorrowLogic::SnapToLog(NKikimrExecutorFlat::TLogSnapshot &snap, TL Garbage.clear(); } -const THashMap<TLogoBlobID, TCompactedPartLoans>* TExecutorBorrowLogic::GetCompactedLoansList() { +const THashMap<TLogoBlobID, TCompactedPartLoans>* TExecutorBorrowLogic::GetCompactedLoansList() { return &CompactedPartLoans; } @@ -372,13 +372,13 @@ void TExecutorBorrowLogic::UpdateBorrow( smthChanged = true; if (storedInfo.BorrowInfo.FullBorrow.size() == 1) { - TVector<ui64>().swap(storedInfo.BorrowInfo.FullBorrow); + TVector<ui64>().swap(storedInfo.BorrowInfo.FullBorrow); if (storedInfo.BorrowInfo.Keep) { commit->GcDelta.Deleted.insert( commit->GcDelta.Deleted.end(), storedInfo.BorrowInfo.Keep.begin(), storedInfo.BorrowInfo.Keep.end()); - TVector<TLogoBlobID>().swap(storedInfo.BorrowInfo.Keep); + TVector<TLogoBlobID>().swap(storedInfo.BorrowInfo.Keep); KeepBytes += storedInfo.BorrowInfo.UpdateKeepBytes(); } } else { diff --git a/ydb/core/tablet_flat/flat_executor_borrowlogic.h b/ydb/core/tablet_flat/flat_executor_borrowlogic.h index 5d990b49dc0..a745f7121bb 100644 --- a/ydb/core/tablet_flat/flat_executor_borrowlogic.h +++ b/ydb/core/tablet_flat/flat_executor_borrowlogic.h @@ -19,8 +19,8 @@ class TExecutorBorrowLogic { TLogoBlobID BorrowBlobId; struct { // out - TVector<ui64> FullBorrow; - TVector<TLogoBlobID> Keep; + TVector<ui64> FullBorrow; + TVector<TLogoBlobID> Keep; ui64 KeepBytes = 0; bool HasKeep(const TLogoBlobID &blob) const noexcept @@ -44,7 +44,7 @@ class TExecutorBorrowLogic { TIntrusivePtr<TTabletStorageInfo> StorageInfo; // todo: must be list with info for every referenced tablet bool Collected = false; - TVector<TLogoBlobID> Keep; + TVector<TLogoBlobID> Keep; } LoanInfo; }; @@ -53,15 +53,15 @@ class TExecutorBorrowLogic { TVector<TCompactedPartLoans> Parts; }; - THashMap<TLogoBlobID, TBorrowedPartInfo> BorrowedInfo; + THashMap<TLogoBlobID, TBorrowedPartInfo> BorrowedInfo; TDeque<TLogoBlobID> Garbage; - THashMap<TLogoBlobID, TCompactedPartLoans> CompactedPartLoans; + THashMap<TLogoBlobID, TCompactedPartLoans> CompactedPartLoans; TDeque<TCompactedPart> PendingCompactedPartLoans; bool HasFlag; - THashMap<ui64, TIntrusivePtr<TTabletStorageInfo>> ReferencedStorageInfos; + THashMap<ui64, TIntrusivePtr<TTabletStorageInfo>> ReferencedStorageInfos; void UpdateStorageInfo(TTabletStorageInfo *update); @@ -95,7 +95,7 @@ public: // called on lender at moment of sharing part void BorrowBundle( const TLogoBlobID &bundleId, - const TSet<ui64> &loaners, + const TSet<ui64> &loaners, TLogCommit *commit); // called on loaner at moment of attaching part @@ -153,7 +153,7 @@ public: // returns true if smth moved to CompactedPartLoands so we need to signal for user tablet bool SetGcBarrier(ui32 step); - const THashMap<TLogoBlobID, TCompactedPartLoans>* GetCompactedLoansList(); + const THashMap<TLogoBlobID, TCompactedPartLoans>* GetCompactedLoansList(); const bool* GetHasFlag(); // on bootstrap diff --git a/ydb/core/tablet_flat/flat_executor_compaction_logic.h b/ydb/core/tablet_flat/flat_executor_compaction_logic.h index b85a13a19ec..0b94a96070a 100644 --- a/ydb/core/tablet_flat/flat_executor_compaction_logic.h +++ b/ydb/core/tablet_flat/flat_executor_compaction_logic.h @@ -85,7 +85,7 @@ struct TCompactionLogicState { THolder<NTable::ICompactionStrategy> Strategy; - TDeque<TSnapRequest> SnapRequests; + TDeque<TSnapRequest> SnapRequests; TIntrusiveConstPtr<TCompactionPolicy> Policy; @@ -125,7 +125,7 @@ struct TCompactionLogicState { NKikimrSchemeOp::ECompactionStrategy Strategy = NKikimrSchemeOp::CompactionStrategyGenerational; }; - TMap<ui32, TTableInfo> Tables; + TMap<ui32, TTableInfo> Tables; THashMap<ui32, TSnapshotState> Snapshots; }; @@ -134,7 +134,7 @@ class TFlatTableScan; struct TTableCompactionResult { NTable::TCompactionChanges Changes; NKikimrSchemeOp::ECompactionStrategy Strategy; - TVector<TIntrusivePtr<TTableSnapshotContext>> CompleteSnapshots; + TVector<TIntrusivePtr<TTableSnapshotContext>> CompleteSnapshots; bool MemCompacted = false; }; diff --git a/ydb/core/tablet_flat/flat_executor_database_ut.cpp b/ydb/core/tablet_flat/flat_executor_database_ut.cpp index 0168615c55b..f8977c2588a 100644 --- a/ydb/core/tablet_flat/flat_executor_database_ut.cpp +++ b/ydb/core/tablet_flat/flat_executor_database_ut.cpp @@ -131,8 +131,8 @@ private: const ui32 TxTable = 0; const ui32 AffectedTable = 4; - TVector<TDeque<TTxId>> DatashardTxQueues; - THashMap<TTxId, ui32> UnconfirmedCount; + TVector<TDeque<TTxId>> DatashardTxQueues; + THashMap<TTxId, ui32> UnconfirmedCount; TTxId LastTxId = 0; ui64 LastDatashardIdx = 0; diff --git a/ydb/core/tablet_flat/flat_executor_db_mon.cpp b/ydb/core/tablet_flat/flat_executor_db_mon.cpp index d5353747beb..ffba73d88c6 100644 --- a/ydb/core/tablet_flat/flat_executor_db_mon.cpp +++ b/ydb/core/tablet_flat/flat_executor_db_mon.cpp @@ -63,7 +63,7 @@ public: <label for='exact-checkbox' style='padding-left:5px'>Exact</label> </form> )___"; - TVector<ui32> columns; + TVector<ui32> columns; for (const auto& pr : tableInfo->Columns) { columns.push_back(pr.first); } diff --git a/ydb/core/tablet_flat/flat_executor_gclogic.cpp b/ydb/core/tablet_flat/flat_executor_gclogic.cpp index bded66353ec..5b0a6a9752f 100644 --- a/ydb/core/tablet_flat/flat_executor_gclogic.cpp +++ b/ydb/core/tablet_flat/flat_executor_gclogic.cpp @@ -132,7 +132,7 @@ void TExecutorGCLogic::ApplyLogEntry(TGCLogEntry& entry) { ApplyDelta(entry.Time, entry.Delta); } -void TExecutorGCLogic::ApplyLogSnapshot(TGCLogEntry &snapshot, const TVector<std::pair<ui32, ui64>> &barriers) { +void TExecutorGCLogic::ApplyLogSnapshot(TGCLogEntry &snapshot, const TVector<std::pair<ui32, ui64>> &barriers) { ApplyLogEntry(snapshot); for (auto &xpair : barriers) { const ui32 channel = xpair.first; @@ -201,32 +201,32 @@ void TExecutorGCLogic::TChannelInfo::ApplyDelta(TGCTime time, TGCBlobDelta& delt Y_VERIFY_DEBUG(delta.Created.empty() && delta.Deleted.empty()); } -void TExecutorGCLogic::MergeVectors(TVector<TLogoBlobID>& destination, const TVector<TLogoBlobID>& source) { +void TExecutorGCLogic::MergeVectors(TVector<TLogoBlobID>& destination, const TVector<TLogoBlobID>& source) { if (!source.empty()) { destination.insert(destination.end(), source.begin(), source.end()); } } -void TExecutorGCLogic::MergeVectors(THolder<TVector<TLogoBlobID>>& destination, const TVector<TLogoBlobID>& source) { +void TExecutorGCLogic::MergeVectors(THolder<TVector<TLogoBlobID>>& destination, const TVector<TLogoBlobID>& source) { if (!source.empty()) { if (!destination) { - destination.Reset(new TVector<TLogoBlobID>(source)); + destination.Reset(new TVector<TLogoBlobID>(source)); } else { MergeVectors(*destination.Get(), source); } } } -void DeduplicateGCKeepVectors(TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep, ui32 barrierGen, ui32 barrierStep) { +void DeduplicateGCKeepVectors(TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep, ui32 barrierGen, ui32 barrierStep) { if (keep && doNotKeep && !keep->empty() && !doNotKeep->empty()) { // vectors must be sorted! - TVector<TLogoBlobID>::const_iterator keepIt = keep->begin(); - TVector<TLogoBlobID>::const_iterator keepEnd = keep->end(); - TVector<TLogoBlobID>::const_iterator notIt = doNotKeep->begin(); - TVector<TLogoBlobID>::const_iterator notEnd = doNotKeep->end(); - TVector<TLogoBlobID>::iterator keepIns = keep->begin(); - TVector<TLogoBlobID>::iterator notIns = doNotKeep->begin(); + TVector<TLogoBlobID>::const_iterator keepIt = keep->begin(); + TVector<TLogoBlobID>::const_iterator keepEnd = keep->end(); + TVector<TLogoBlobID>::const_iterator notIt = doNotKeep->begin(); + TVector<TLogoBlobID>::const_iterator notEnd = doNotKeep->end(); + TVector<TLogoBlobID>::iterator keepIns = keep->begin(); + TVector<TLogoBlobID>::iterator notIns = doNotKeep->begin(); bool keepModified = false; bool notKeepModified = false; @@ -284,9 +284,9 @@ void DeduplicateGCKeepVectors(TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> * } } -TVector<TLogoBlobID>* TExecutorGCLogic::CreateVector(const TVector<TLogoBlobID>& source) { +TVector<TLogoBlobID>* TExecutorGCLogic::CreateVector(const TVector<TLogoBlobID>& source) { if (!source.empty()) { - return new TVector<TLogoBlobID>(source); + return new TVector<TLogoBlobID>(source); } else { return nullptr; } @@ -334,7 +334,7 @@ namespace { void TExecutorGCLogic::TChannelInfo::SendCollectGarbageEntry( const TActorContext &ctx, - TVector<TLogoBlobID> &&keep, TVector<TLogoBlobID> &¬Keep, + TVector<TLogoBlobID> &&keep, TVector<TLogoBlobID> &¬Keep, ui64 tabletid, ui32 channel, ui32 bsgroup, ui32 generation) { ValidateGCVector(tabletid, channel, "Keep", keep); @@ -345,8 +345,8 @@ void TExecutorGCLogic::TChannelInfo::SendCollectGarbageEntry( generation, GcCounter, channel, true, KnownGcBarrier.Generation, KnownGcBarrier.Step, - keep.empty() ? nullptr : new TVector<TLogoBlobID>(std::move(keep)), - notKeep.empty() ? nullptr : new TVector<TLogoBlobID>(std::move(notKeep)), + keep.empty() ? nullptr : new TVector<TLogoBlobID>(std::move(keep)), + notKeep.empty() ? nullptr : new TVector<TLogoBlobID>(std::move(notKeep)), TInstant::Max(), true); GcCounter += ev->PerGenerationCounterStepSize(); @@ -400,7 +400,7 @@ void TExecutorGCLogic::TChannelInfo::SendCollectGarbage(TGCTime uncommittedTime, SendCollectGarbageEntry(ctx, std::move(keep), std::move(notKeep), tabletStorageInfo->TabletID, channel, latestEntry->GroupID, generation); } else { // bloated case - spread among different groups - TMap<ui32, std::pair<TVector<TLogoBlobID>, TVector<TLogoBlobID>>> affectedGroups; + TMap<ui32, std::pair<TVector<TLogoBlobID>, TVector<TLogoBlobID>>> affectedGroups; { // mark every actual generation for update auto xit = UpperBound(channelInfo->History.begin(), channelInfo->History.end(), lastCommitedGcBarrier, TTabletChannelInfo::THistoryEntry::TCmp()); @@ -413,7 +413,7 @@ void TExecutorGCLogic::TChannelInfo::SendCollectGarbage(TGCTime uncommittedTime, ui32 activeGen = Max<ui32>(); ui32 activeGroup = Max<ui32>(); - TVector<TLogoBlobID> *vec = nullptr; + TVector<TLogoBlobID> *vec = nullptr; for (const auto &blobId : keep) { if (activeGen != blobId.Generation()) { diff --git a/ydb/core/tablet_flat/flat_executor_gclogic.h b/ydb/core/tablet_flat/flat_executor_gclogic.h index 9c1fa568a23..f8a1f0e68e3 100644 --- a/ydb/core/tablet_flat/flat_executor_gclogic.h +++ b/ydb/core/tablet_flat/flat_executor_gclogic.h @@ -44,7 +44,7 @@ public: void OnCommitLog(ui32 step, ui32 confirmedOnSend, const TActorContext &ctx); // notification about log commit - could send GC to blob storage void OnCollectGarbageResult(TEvBlobStorage::TEvCollectGarbageResult::TPtr& ev); // notification on any garbage collection results void ApplyLogEntry(TGCLogEntry &entry); // apply one log entry, used during recovery and also from WriteToLog - void ApplyLogSnapshot(TGCLogEntry &snapshot, const TVector<std::pair<ui32, ui64>> &barriers); + void ApplyLogSnapshot(TGCLogEntry &snapshot, const TVector<std::pair<ui32, ui64>> &barriers); void HoldBarrier(ui32 step); // holds GC on no more than this step for channels specified void ReleaseBarrier(ui32 step); ui32 GetActiveGcBarrier(); @@ -80,7 +80,7 @@ protected: NPageCollection::TSlicer Slicer; struct TChannelInfo { - TMap<TGCTime, TGCBlobDelta> CommittedDelta; // we don't really need per-step map, what we really need is distinction b/w sent and not-yet-sent idsets + TMap<TGCTime, TGCBlobDelta> CommittedDelta; // we don't really need per-step map, what we really need is distinction b/w sent and not-yet-sent idsets TGCTime CollectSent; TGCTime KnownGcBarrier; TGCTime CommitedGcBarrier; @@ -90,7 +90,7 @@ protected: inline TChannelInfo(); void ApplyDelta(TGCTime time, TGCBlobDelta &delta); void SendCollectGarbage(TGCTime uncommittedTime, const TTabletStorageInfo *tabletStorageInfo, ui32 channel, ui32 generation, const TActorContext& executor); - void SendCollectGarbageEntry(const TActorContext &ctx, TVector<TLogoBlobID> &&keep, TVector<TLogoBlobID> &¬Keep, ui64 tabletid, ui32 channel, ui32 bsgroup, ui32 generation); + void SendCollectGarbageEntry(const TActorContext &ctx, TVector<TLogoBlobID> &&keep, TVector<TLogoBlobID> &¬Keep, ui64 tabletid, ui32 channel, ui32 bsgroup, ui32 generation); void OnCollectGarbageSuccess(); void OnCollectGarbageFailure(); }; @@ -98,7 +98,7 @@ protected: ui32 SnapshotStep; ui32 PrevSnapshotStep; ui32 ConfirmedOnSendStep; - THashMap<ui32, TChannelInfo> ChannelInfo; + THashMap<ui32, TChannelInfo> ChannelInfo; TMap<TGCTime, TGCLogEntry> UncommittedDeltaLog; TSet<TGCTime> HoldBarriersSet; @@ -106,12 +106,12 @@ protected: void ApplyDelta(TGCTime time, TGCBlobDelta &delta); void SendCollectGarbage(const TActorContext& executor); - static inline void MergeVectors(THolder<TVector<TLogoBlobID>>& destination, const TVector<TLogoBlobID>& source); - static inline void MergeVectors(TVector<TLogoBlobID>& destination, const TVector<TLogoBlobID>& source); - static inline TVector<TLogoBlobID>* CreateVector(const TVector<TLogoBlobID>& source); + static inline void MergeVectors(THolder<TVector<TLogoBlobID>>& destination, const TVector<TLogoBlobID>& source); + static inline void MergeVectors(TVector<TLogoBlobID>& destination, const TVector<TLogoBlobID>& source); + static inline TVector<TLogoBlobID>* CreateVector(const TVector<TLogoBlobID>& source); }; -void DeduplicateGCKeepVectors(TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep, ui32 barrierGen, ui32 barrierStep); +void DeduplicateGCKeepVectors(TVector<TLogoBlobID> *keep, TVector<TLogoBlobID> *doNotKeep, ui32 barrierGen, ui32 barrierStep); } } diff --git a/ydb/core/tablet_flat/flat_executor_gclogic_ut.cpp b/ydb/core/tablet_flat/flat_executor_gclogic_ut.cpp index 8c0c5ac6f01..770c0d297f5 100644 --- a/ydb/core/tablet_flat/flat_executor_gclogic_ut.cpp +++ b/ydb/core/tablet_flat/flat_executor_gclogic_ut.cpp @@ -5,7 +5,7 @@ namespace NKikimr { namespace NTabletFlatExecutor { Y_UNIT_TEST_SUITE(TFlatTableExecutorGC) { - bool TestDeduplication(TVector<TLogoBlobID> keep, TVector<TLogoBlobID> dontkeep, ui32 gen, ui32 step, TVector<TLogoBlobID> expectKeep, TVector<TLogoBlobID> expectnot) { + bool TestDeduplication(TVector<TLogoBlobID> keep, TVector<TLogoBlobID> dontkeep, ui32 gen, ui32 step, TVector<TLogoBlobID> expectKeep, TVector<TLogoBlobID> expectnot) { DeduplicateGCKeepVectors(&keep, &dontkeep, gen, step); return (keep == expectKeep) && (dontkeep == expectnot); } diff --git a/ydb/core/tablet_flat/flat_executor_snapshot.h b/ydb/core/tablet_flat/flat_executor_snapshot.h index fae02f7fc89..df5c2623b68 100644 --- a/ydb/core/tablet_flat/flat_executor_snapshot.h +++ b/ydb/core/tablet_flat/flat_executor_snapshot.h @@ -25,7 +25,7 @@ namespace NTabletFlatExecutor { struct TFlush { ui32 Step = Max<ui32>(); TVector<TIntrusivePtr<TBarrier>> Barriers; - THashMap<TLogoBlobID, TSet<ui64>> Bundles; + THashMap<TLogoBlobID, TSet<ui64>> Bundles; TMap<ui32, ui32> Moved; }; @@ -90,7 +90,7 @@ namespace NTabletFlatExecutor { private: ui32 Pending = 0; - THashMap<ui32, TState> Tables; + THashMap<ui32, TState> Tables; TFlush Holds; }; diff --git a/ydb/core/tablet_flat/flat_executor_txloglogic.h b/ydb/core/tablet_flat/flat_executor_txloglogic.h index 1272c4f947b..3fa525ced07 100644 --- a/ydb/core/tablet_flat/flat_executor_txloglogic.h +++ b/ydb/core/tablet_flat/flat_executor_txloglogic.h @@ -45,7 +45,7 @@ class TLogicRedo { TCompletionEntry(TAutoPtr<TSeat> seat, ui32 step); }; - TDeque<TCompletionEntry> CompletionQueue; // would be graph once data-dependencies implemented + TDeque<TCompletionEntry> CompletionQueue; // would be graph once data-dependencies implemented ui32 PrevConfirmedStep = 0; public: diff --git a/ydb/core/tablet_flat/flat_fwd_cache.h b/ydb/core/tablet_flat/flat_fwd_cache.h index f5ff3f5033d..838f78bb49b 100644 --- a/ydb/core/tablet_flat/flat_fwd_cache.h +++ b/ydb/core/tablet_flat/flat_fwd_cache.h @@ -175,7 +175,7 @@ namespace NFwd { ui64 OnHold = 0; ui64 OnFetch = 0; ui32 Offset = 0; - TDeque<TPage> Pages; + TDeque<TPage> Pages; }; } } diff --git a/ydb/core/tablet_flat/flat_mem_warm.cpp b/ydb/core/tablet_flat/flat_mem_warm.cpp index df1cb798e23..00767a2f251 100644 --- a/ydb/core/tablet_flat/flat_mem_warm.cpp +++ b/ydb/core/tablet_flat/flat_mem_warm.cpp @@ -5,7 +5,7 @@ namespace NKikimr { namespace NTable { -TString PrintRow(const TDbTupleRef& row, const NScheme::TTypeRegistry& typeRegistry) { +TString PrintRow(const TDbTupleRef& row, const NScheme::TTypeRegistry& typeRegistry) { return DbgPrintTuple(row, typeRegistry); } @@ -43,7 +43,7 @@ void TMemTable::DebugDump(IOutputStream& str, const NScheme::TTypeRegistry& type for (it.SeekFirst(); it.IsValid(); it.Next()) { TDbTupleRef key(types.data(), it.GetKey(), types.size()); - TString keyStr = PrintRow(key, typeRegistry) + " -> "; + TString keyStr = PrintRow(key, typeRegistry) + " -> "; const auto *row = it.GetValue(); while (row) { str << keyStr diff --git a/ydb/core/tablet_flat/flat_page_writer.h b/ydb/core/tablet_flat/flat_page_writer.h index 005d3dd54c9..0dfa2d3b6d4 100644 --- a/ydb/core/tablet_flat/flat_page_writer.h +++ b/ydb/core/tablet_flat/flat_page_writer.h @@ -117,7 +117,7 @@ namespace NPage { } Offsets.clear(); if (Offsets.capacity() > 10240) { - TVector<TPgSize>().swap(Offsets); + TVector<TPgSize>().swap(Offsets); } return std::exchange(Blob, TSharedData{ }); @@ -282,7 +282,7 @@ namespace NPage { TSharedData Blob; char* Tail = nullptr; - TVector<TPgSize> Offsets; + TVector<TPgSize> Offsets; TVector<ui64> Deltas; ui64 PageBytes = Max<ui64>(); /* Max bytes per each page blob */ ui32 PageRows = Max<ui32>(); /* Max rows per each rows blob */ diff --git a/ydb/core/tablet_flat/flat_part_iface.h b/ydb/core/tablet_flat/flat_part_iface.h index 9be72fc735a..16bcae890cd 100644 --- a/ydb/core/tablet_flat/flat_part_iface.h +++ b/ydb/core/tablet_flat/flat_part_iface.h @@ -7,7 +7,7 @@ #include <ydb/core/base/shared_data.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/types.h> namespace NKikimr { diff --git a/ydb/core/tablet_flat/flat_part_scheme.h b/ydb/core/tablet_flat/flat_part_scheme.h index 06c3681ee22..0c8de7fc5f0 100644 --- a/ydb/core/tablet_flat/flat_part_scheme.h +++ b/ydb/core/tablet_flat/flat_part_scheme.h @@ -57,7 +57,7 @@ namespace NTable { */ TPinout MakePinout(const TTagsRef tags, ui32 group = Max<ui32>()) const { - TVector<TPinout::TPin> pins; + TVector<TPinout::TPin> pins; TVector<ui32> groups; if (tags) { @@ -120,7 +120,7 @@ namespace NTable { void FillKeySlots(); void FillHistoricSlots(); void InitGroup(TGroupInfo& group); - size_t InitInfo(TVector<TColumn>& cols, TPgSize header); + size_t InitInfo(TVector<TColumn>& cols, TPgSize header); public: TVector<TGroupInfo> Groups; diff --git a/ydb/core/tablet_flat/flat_part_screen.h b/ydb/core/tablet_flat/flat_part_screen.h index d66ad4e387f..5dca7342070 100644 --- a/ydb/core/tablet_flat/flat_part_screen.h +++ b/ydb/core/tablet_flat/flat_part_screen.h @@ -92,7 +92,7 @@ namespace NTable { }); } - using TVec = TVector<THole>; + using TVec = TVector<THole>; TScreen(TVec holes) : Holes(std::move(holes)) { } @@ -241,7 +241,7 @@ namespace NTable { } private: - const TVector<THole> Holes; + const TVector<THole> Holes; }; } diff --git a/ydb/core/tablet_flat/flat_part_store.h b/ydb/core/tablet_flat/flat_part_store.h index ee0bc2324bc..a16e47582ab 100644 --- a/ydb/core/tablet_flat/flat_part_store.h +++ b/ydb/core/tablet_flat/flat_part_store.h @@ -102,7 +102,7 @@ public: TAutoPtr<NPageCollection::TFetch> DataPages() const noexcept { - TVector<TPageId> pages; + TVector<TPageId> pages; pages.reserve(Index->End() - Index->Begin()); diff --git a/ydb/core/tablet_flat/flat_row_remap.h b/ydb/core/tablet_flat/flat_row_remap.h index 22f304131a1..6536d0a3384 100644 --- a/ydb/core/tablet_flat/flat_row_remap.h +++ b/ydb/core/tablet_flat/flat_row_remap.h @@ -30,7 +30,7 @@ namespace NTable { static TRemap Full(const TRowScheme& scheme) { - TVector<ui32> tags(scheme.Cols.size()); + TVector<ui32> tags(scheme.Cols.size()); for (auto &col: scheme.Cols) tags[col.Pos] = col.Tag; @@ -92,7 +92,7 @@ namespace NTable { TSmallVec<TPin> KeyPins_; TSmallVec<NScheme::TTypeId> Types_; TSmallVec<TCell> Nulls_; - THashMap<TTag, TPos> Tag2Pos; + THashMap<TTag, TPos> Tag2Pos; }; }} diff --git a/ydb/core/tablet_flat/flat_row_scheme.h b/ydb/core/tablet_flat/flat_row_scheme.h index fc750a12793..92059823ad9 100644 --- a/ydb/core/tablet_flat/flat_row_scheme.h +++ b/ydb/core/tablet_flat/flat_row_scheme.h @@ -33,8 +33,8 @@ namespace NTable { return TNullsType::Make(Types, Cells); } - TVector<TType> Types; - TVector<TCell> Cells; + TVector<TType> Types; + TVector<TCell> Cells; }; TRowScheme( @@ -57,7 +57,7 @@ namespace NTable { { size_t keyCount = 0; TSet<ui32> familySet; - TMap<ui32, const TColumn*> cols; /* order by tag */ + TMap<ui32, const TColumn*> cols; /* order by tag */ for (auto &it : cols_) { auto &meta = TGet::Do(it); @@ -69,7 +69,7 @@ namespace NTable { TNullsCook<TKeyNulls, NScheme::TTypeIdOrder> keys(keyCount); TNullsCook<TRowNulls, NScheme::TTypeId> vals(cols.size()); - TVector<TColInfo> info; + TVector<TColInfo> info; info.reserve(cols.size()); TVector<ui32> families(familySet.begin(), familySet.end()); @@ -150,13 +150,13 @@ namespace NTable { } public: - const TVector<TColInfo> Cols; + const TVector<TColInfo> Cols; const TIntrusiveConstPtr<TKeyNulls> Keys; const TIntrusiveConstPtr<TRowNulls> Nulls; const TVector<ui32> Families; // per-group families private: - THashMap<TTag, NTable::TPos> ByTag; + THashMap<TTag, NTable::TPos> ByTag; }; }} diff --git a/ydb/core/tablet_flat/flat_sausage_fetch.h b/ydb/core/tablet_flat/flat_sausage_fetch.h index 3654b9e745e..8b29593949f 100644 --- a/ydb/core/tablet_flat/flat_sausage_fetch.h +++ b/ydb/core/tablet_flat/flat_sausage_fetch.h @@ -26,7 +26,7 @@ namespace NPageCollection { const ui64 Cookie = Max<ui64>(); TIntrusiveConstPtr<IPageCollection> PageCollection; - TVector<ui32> Pages; + TVector<ui32> Pages; }; struct TLoadedPage { diff --git a/ydb/core/tablet_flat/flat_sausage_meta.h b/ydb/core/tablet_flat/flat_sausage_meta.h index bb23adc8244..e04ded79ab1 100644 --- a/ydb/core/tablet_flat/flat_sausage_meta.h +++ b/ydb/core/tablet_flat/flat_sausage_meta.h @@ -50,7 +50,7 @@ namespace NPageCollection { const TEntry *Index = nullptr; const TExtra *Extra = nullptr; const char *InboundData = nullptr; - TVector<ui64> Steps; /* Pages boundaries vector */ + TVector<ui64> Steps; /* Pages boundaries vector */ }; } diff --git a/ydb/core/tablet_flat/flat_sausage_record.h b/ydb/core/tablet_flat/flat_sausage_record.h index 73badbcd0e2..84f9a66abb6 100644 --- a/ydb/core/tablet_flat/flat_sausage_record.h +++ b/ydb/core/tablet_flat/flat_sausage_record.h @@ -110,12 +110,12 @@ namespace NPageCollection { const ui32 Group = TLargeGlobId::InvalidGroup; private: - TVector<TBlobId> Blobs; - TVector<TEntry> Index; - TVector<TExtra> Extra; + TVector<TBlobId> Blobs; + TVector<TEntry> Index; + TVector<TExtra> Extra; ui64 Offset = 0; - TString Inbound; + TString Inbound; }; } } diff --git a/ydb/core/tablet_flat/flat_sausage_writer.h b/ydb/core/tablet_flat/flat_sausage_writer.h index c7cda9e2a47..c8cdc072574 100644 --- a/ydb/core/tablet_flat/flat_sausage_writer.h +++ b/ydb/core/tablet_flat/flat_sausage_writer.h @@ -98,7 +98,7 @@ namespace NPageCollection { const ui32 Block = Max<ui32>(); const ui8 Channel = Max<ui8>(); private: - TString Buffer; + TString Buffer; TCookieAllocator &CookieAllocator; TVector<TGlob> Blobs; NPageCollection::TRecord Record; diff --git a/ydb/core/tablet_flat/flat_scan_lead.h b/ydb/core/tablet_flat/flat_scan_lead.h index 2a0c8123b3d..91323791cc4 100644 --- a/ydb/core/tablet_flat/flat_scan_lead.h +++ b/ydb/core/tablet_flat/flat_scan_lead.h @@ -37,7 +37,7 @@ namespace NTable { bool Valid = false; ESeek Relation = ESeek::Exact; - TVector<ui32> Tags; + TVector<ui32> Tags; TSerializedCellVec Key; TSerializedCellVec StopKey; bool StopKeyInclusive = true; diff --git a/ydb/core/tablet_flat/flat_stat_table.h b/ydb/core/tablet_flat/flat_stat_table.h index 8a892b8a67c..c27ee4217e7 100644 --- a/ydb/core/tablet_flat/flat_stat_table.h +++ b/ydb/core/tablet_flat/flat_stat_table.h @@ -104,7 +104,7 @@ private: TIntrusiveConstPtr<TKeyNulls> KeyColumns; THolderVector<TScreenedPartIndexIterator> Iterators; - TPriorityQueue<TScreenedPartIndexIterator*, TSmallVec<TScreenedPartIndexIterator*>, TIterKeyGreater> Heap; + TPriorityQueue<TScreenedPartIndexIterator*, TSmallVec<TScreenedPartIndexIterator*>, TIterKeyGreater> Heap; TSerializedCellVec CurrentKey; ui64 RowCount = 0; ui64 DataSize = 0; @@ -118,7 +118,7 @@ struct TBucket { ui64 Value; }; -using THistogram = TVector<TBucket>; +using THistogram = TVector<TBucket>; struct TStats { ui64 RowCount = 0; diff --git a/ydb/core/tablet_flat/flat_table_part.cpp b/ydb/core/tablet_flat/flat_table_part.cpp index 235229cc35e..3b32176f0ad 100644 --- a/ydb/core/tablet_flat/flat_table_part.cpp +++ b/ydb/core/tablet_flat/flat_table_part.cpp @@ -167,7 +167,7 @@ void TPartScheme::InitGroup(TGroupInfo& group) } } -size_t TPartScheme::InitInfo(TVector<TColumn>& cols, TPgSize headerSize) +size_t TPartScheme::InitInfo(TVector<TColumn>& cols, TPgSize headerSize) { size_t offset = 0; diff --git a/ydb/core/tablet_flat/shared_sausagecache.cpp b/ydb/core/tablet_flat/shared_sausagecache.cpp index c60c30202ba..646389c74cf 100644 --- a/ydb/core/tablet_flat/shared_sausagecache.cpp +++ b/ydb/core/tablet_flat/shared_sausagecache.cpp @@ -131,7 +131,7 @@ class TSharedPageCache : public TActor<TSharedPageCache> { TLogoBlobID MetaId; TSet<TActorId> Owners; TPageMap<TIntrusivePtr<TPage>> PageMap; - TMap<ui32, TExpectant> Expectants; + TMap<ui32, TExpectant> Expectants; TDeque<ui32> DroppedPages; }; @@ -146,7 +146,7 @@ class TSharedPageCache : public TActor<TSharedPageCache> { struct TByActorRequest { TIntrusiveList<TPagesToRequest> Listed; - THashMap<TLogoBlobID, TDeque<TPagesToRequest>> Index; + THashMap<TLogoBlobID, TDeque<TPagesToRequest>> Index; }; TMap<TActorId, TByActorRequest> Requests; @@ -161,7 +161,7 @@ class TSharedPageCache : public TActor<TSharedPageCache> { TActorId Owner; TAutoPtr<NUtil::ILogger> Logger; - THashMap<TLogoBlobID, TCollection> Collections; + THashMap<TLogoBlobID, TCollection> Collections; THashMap<TActorId, TCollectionsOwner> CollectionsOwners; TRequestQueue AsyncRequests; @@ -248,7 +248,7 @@ class TSharedPageCache : public TActor<TSharedPageCache> { TBlocks readyBlocks; readyBlocks.reserve(msg->Fetch->Pages.size()); - TVector<ui32> pagesToWait; + TVector<ui32> pagesToWait; if (logsat) pagesToWait.reserve(msg->Fetch->Pages.size()); @@ -327,8 +327,8 @@ class TSharedPageCache : public TActor<TSharedPageCache> { waitingRequest->ReadyBlocks = std::move(readyBlocks); if (pendingPages) { - TVector<ui32> pagesToKeep; - TVector<ui32> pagesToRequest; + TVector<ui32> pagesToKeep; + TVector<ui32> pagesToRequest; ui64 pagesToRequestBytes = 0; pagesToRequest.reserve(pagesToLoad); if (logsat) @@ -467,7 +467,7 @@ class TSharedPageCache : public TActor<TSharedPageCache> { if (nthToRequest != 0) { if (nthToLoad != 0) { - TVector<ui32> toLoad; + TVector<ui32> toLoad; toLoad.reserve(nthToLoad); for (ui32 pageId : wa.PagesToRequest) { auto* page = collection->PageMap[pageId].Get(); @@ -797,7 +797,7 @@ class TSharedPageCache : public TActor<TSharedPageCache> { StatBioReqs += 1; } - void DropCollection(THashMap<TLogoBlobID, TCollection>::iterator collectionIt, NKikimrProto::EReplyStatus blobStorageError) { + void DropCollection(THashMap<TLogoBlobID, TCollection>::iterator collectionIt, NKikimrProto::EReplyStatus blobStorageError) { // decline all pending requests TCollection &collection = collectionIt->second; const TLogoBlobID &pageCollectionId = collectionIt->first; @@ -1045,7 +1045,7 @@ IActor* CreateSharedPageCache(TSharedPageCacheConfig *config) { } template<> inline -void Out<TVector<ui32>>(IOutputStream& o, const TVector<ui32> &vec) { +void Out<TVector<ui32>>(IOutputStream& o, const TVector<ui32> &vec) { o << "[ "; for (const auto &x : vec) o << x << ' '; diff --git a/ydb/core/tablet_flat/tablet_flat_executed.cpp b/ydb/core/tablet_flat/tablet_flat_executed.cpp index 4b3c15490c5..e68121af050 100644 --- a/ydb/core/tablet_flat/tablet_flat_executed.cpp +++ b/ydb/core/tablet_flat/tablet_flat_executed.cpp @@ -171,7 +171,7 @@ void TTabletExecutedFlat::RenderHtmlPage(NMon::TEvRemoteHttpInfo::TPtr &ev, cons LOG_NOTICE_S(ctx, NKikimrServices::TABLET_EXECUTOR, "RenderHtmlPage for tablet " << TabletID()); auto cgi = ev->Get()->Cgi(); auto path = ev->Get()->PathInfo(); - TString queryString = cgi.Print(); + TString queryString = cgi.Print(); if (path == "/app") { OnRenderAppHtmlPage(ev, ctx); diff --git a/ydb/core/tablet_flat/tablet_flat_executor.h b/ydb/core/tablet_flat/tablet_flat_executor.h index 075ebce354b..d57f9912bea 100644 --- a/ydb/core/tablet_flat/tablet_flat_executor.h +++ b/ydb/core/tablet_flat/tablet_flat_executor.h @@ -309,7 +309,7 @@ struct TExecutorStats { bool IsAnyChannelYellowStop = false; ui64 TxInFly = 0; ui64 TxPending = 0; - const THashMap<TLogoBlobID, TCompactedPartLoans>* CompactedPartLoans = nullptr; + const THashMap<TLogoBlobID, TCompactedPartLoans>* CompactedPartLoans = nullptr; const bool* HasSharedBlobs = nullptr; TVector<ui32> YellowMoveChannels; @@ -503,7 +503,7 @@ namespace NFlatExecutorSetup { 3. [-inf, +inf), the complete set, is encoded as ({ }, { }). 4. May return empty blob on lack of some vital pages in cache. */ - virtual TString BorrowSnapshot(ui32 tableId, const TTableSnapshotContext&, TRawVals from, TRawVals to, ui64 loaner) const = 0; + virtual TString BorrowSnapshot(ui32 tableId, const TTableSnapshotContext&, TRawVals from, TRawVals to, ui64 loaner) const = 0; // Prepare snapshot which can later be used for scan task. virtual ui64 MakeScanSnapshot(ui32 table) = 0; virtual void DropScanSnapshot(ui64 snapId) = 0; diff --git a/ydb/core/tablet_flat/test/libs/rows/layout.h b/ydb/core/tablet_flat/test/libs/rows/layout.h index 36e64feac08..c93da310655 100644 --- a/ydb/core/tablet_flat/test/libs/rows/layout.h +++ b/ydb/core/tablet_flat/test/libs/rows/layout.h @@ -72,8 +72,8 @@ namespace NTest{ } private: - TVector<NTable::TColumn> Cols; - TVector<NTable::TTag> Tags_; + TVector<NTable::TColumn> Cols; + TVector<NTable::TTag> Tags_; TIntrusiveConstPtr<TRowScheme> Scheme; }; } diff --git a/ydb/core/tablet_flat/test/libs/rows/misc.h b/ydb/core/tablet_flat/test/libs/rows/misc.h index 955a34d4a7e..0961d9e6822 100644 --- a/ydb/core/tablet_flat/test/libs/rows/misc.h +++ b/ydb/core/tablet_flat/test/libs/rows/misc.h @@ -37,9 +37,9 @@ namespace NTest{ struct TRandomString { TRandomString(TGen &gen): Gen(gen) { } - TString Do(const size_t len) noexcept + TString Do(const size_t len) noexcept { - TString line; + TString line; line.reserve(len); diff --git a/ydb/core/tablet_flat/test/libs/table/test_comp.h b/ydb/core/tablet_flat/test/libs/table/test_comp.h index d6095c2a788..00f863f3a67 100644 --- a/ydb/core/tablet_flat/test/libs/table/test_comp.h +++ b/ydb/core/tablet_flat/test/libs/table/test_comp.h @@ -192,7 +192,7 @@ namespace NTest { ui32 Serial = 0; ui32 Failed = 0; TAutoPtr<IPages> Env; - TVector<ui32> Tags; + TVector<ui32> Tags; TAutoPtr<TPartWriter> Writer; }; diff --git a/ydb/core/tablet_flat/test/libs/table/test_iter.h b/ydb/core/tablet_flat/test/libs/table/test_iter.h index f4010ab2b61..b7c36b602ef 100644 --- a/ydb/core/tablet_flat/test/libs/table/test_iter.h +++ b/ydb/core/tablet_flat/test/libs/table/test_iter.h @@ -120,8 +120,8 @@ namespace NTest { return erased ? Is(EReady::Gone) : Is(row, true, ERowOp::Erase); } - template<typename TListType> - TChecker& IsTheSame(const TListType &list) + template<typename TListType> + TChecker& IsTheSame(const TListType &list) { Seek({ } , ESeek::Lower); diff --git a/ydb/core/tablet_flat/test/libs/table/test_pretty.h b/ydb/core/tablet_flat/test/libs/table/test_pretty.h index e5f5287d242..236771c83ea 100644 --- a/ydb/core/tablet_flat/test/libs/table/test_pretty.h +++ b/ydb/core/tablet_flat/test/libs/table/test_pretty.h @@ -8,7 +8,7 @@ namespace NKikimr { namespace NTable { - TString PrintRow(const TDbTupleRef& row); + TString PrintRow(const TDbTupleRef& row); TString PrintRow(const TMemIt&); } diff --git a/ydb/core/tablet_flat/test/libs/table/test_writer.h b/ydb/core/tablet_flat/test/libs/table/test_writer.h index 5df2014cd64..d3c17330e7b 100644 --- a/ydb/core/tablet_flat/test/libs/table/test_writer.h +++ b/ydb/core/tablet_flat/test/libs/table/test_writer.h @@ -316,7 +316,7 @@ namespace NTest { TPartCook& Add(const TRow &tagged, ERowOp rop = ERowOp::Upsert) { - TVector<TCell> key(Scheme->Keys->Types.size()); + TVector<TCell> key(Scheme->Keys->Types.size()); TRowState row(Remap.size()); row.Touch(rop); @@ -374,7 +374,7 @@ namespace NTest { private: TIntrusiveConstPtr<TRowScheme> Scheme; TWriterBundle Pages; - TMap<TTag, TPos> Remap; + TMap<TTag, TPos> Remap; TAutoPtr<TPartWriter> Writer; TOwnedCellVec LastKey; TRowVersion NextVersion = TRowVersion::Min(); diff --git a/ydb/core/tablet_flat/test/tool/perf/do_writes.h b/ydb/core/tablet_flat/test/tool/perf/do_writes.h index 3e94106b240..3fcf52feb86 100644 --- a/ydb/core/tablet_flat/test/tool/perf/do_writes.h +++ b/ydb/core/tablet_flat/test/tool/perf/do_writes.h @@ -24,8 +24,8 @@ namespace NTable { TMemTable table(lay.RowScheme(), 0); - TVector<TRawTypeValue> key; - TVector<TUpdateOp> ops; + TVector<TRawTypeValue> key; + TVector<TUpdateOp> ops; ui64 keyUi64 = 42; key.emplace_back(&keyUi64, sizeof(keyUi64), NScheme::NTypeIds::Uin> diff --git a/ydb/core/tablet_flat/ut/flat_test_db.cpp b/ydb/core/tablet_flat/ut/flat_test_db.cpp index b65757d4bbd..68133094eab 100644 --- a/ydb/core/tablet_flat/ut/flat_test_db.cpp +++ b/ydb/core/tablet_flat/ut/flat_test_db.cpp @@ -12,7 +12,7 @@ namespace NKikimr { namespace NTable { struct TFakeKey { - TVector<TFakeTableCell> Columns; + TVector<TFakeTableCell> Columns; }; struct TFakeKeyComparator { @@ -36,7 +36,7 @@ struct TFakeKeyComparator { struct TFakeVal { bool IsDeleted; - TMap<TTag, TFakeTableCell> Columns; + TMap<TTag, TFakeTableCell> Columns; void ApplyUpdate(const TFakeVal& other) { @@ -67,20 +67,20 @@ struct TFakeVal { } }; -typedef TMap<TFakeKey, TFakeVal, TFakeKeyComparator> TFakeTable; +typedef TMap<TFakeKey, TFakeVal, TFakeKeyComparator> TFakeTable; class TFakeDbIterator : public ITestIterator { - TVector<ui32> ValueTags; + TVector<ui32> ValueTags; TVector<const TColumn*> Cols; TFakeTable::const_iterator RowIt; TFakeTable::const_iterator RowEnd; - TVector<NScheme::TTypeId> KeyTypes; - TVector<TCell> KeyCells; + TVector<NScheme::TTypeId> KeyTypes; + TVector<TCell> KeyCells; - TVector<NScheme::TTypeId> ValueTypes; - TVector<TCell> ValueCells; + TVector<NScheme::TTypeId> ValueTypes; + TVector<TCell> ValueCells; bool First = true; public: @@ -179,7 +179,7 @@ private: } }; -// Simple test implementation of a DB using TMap<> +// Simple test implementation of a DB using TMap<> class TFakeDb : public ITestDb { private: TAutoPtr<TScheme> Scheme; @@ -227,7 +227,7 @@ public: } TxChanges.clear(); SchemeChanges.Flush(); - return TString(); + return TString(); } void Update(ui32 root, ERowOp rop, TRawVals key, TArrayRef<const TUpdateOp> ops) override @@ -325,8 +325,8 @@ private: } private: - THashMap<ui32, TFakeTable> Tables; - THashMap<ui32, TFakeTable> TxChanges; + THashMap<ui32, TFakeTable> Tables; + THashMap<ui32, TFakeTable> TxChanges; TAlter SchemeChanges; }; diff --git a/ydb/core/tablet_flat/ut/flat_test_db.h b/ydb/core/tablet_flat/ut/flat_test_db.h index ed0af81c68a..f5b41f8dc8a 100644 --- a/ydb/core/tablet_flat/ut/flat_test_db.h +++ b/ydb/core/tablet_flat/ut/flat_test_db.h @@ -33,7 +33,7 @@ public: virtual void Init(const TScheme& scheme) = 0; virtual const TScheme& GetScheme() const = 0; - virtual TString FinishTransaction(bool commit) = 0; + virtual TString FinishTransaction(bool commit) = 0; virtual void Update(ui32 root, ERowOp, TRawVals key, TArrayRef<const TUpdateOp> ops) = 0; virtual void Precharge(ui32 root, @@ -285,7 +285,7 @@ public: private: bool CompareTables(ui32 root) { - TVector<ui32> valTags; + TVector<ui32> valTags; for (const auto& ci : Db1->GetScheme().GetTableInfo(root)->Columns) { valTags.push_back(ci.first); } diff --git a/ydb/core/tablet_flat/ut/flat_test_db_helpers.h b/ydb/core/tablet_flat/ut/flat_test_db_helpers.h index ffc9a36daac..53880189888 100644 --- a/ydb/core/tablet_flat/ut/flat_test_db_helpers.h +++ b/ydb/core/tablet_flat/ut/flat_test_db_helpers.h @@ -16,7 +16,7 @@ struct TFakeTableCell { private: ECellOp Op = ECellOp::Set; TRawTypeValue Val; - TString Buf; + TString Buf; public: TFakeTableCell() {} @@ -32,7 +32,7 @@ public: void Set(const TRawTypeValue& v) { if (!v.IsEmpty()) { - Buf = TString((const char*)v.Data(), v.Size()); + Buf = TString((const char*)v.Data(), v.Size()); Val = TRawTypeValue(Buf.data(), Buf.size(), v.Type()); } else { Val = TRawTypeValue(); @@ -86,14 +86,14 @@ inline TFakeTableCell FromVal(NScheme::TTypeId, std::nullptr_t) { return MakeNull(ECellOp::Set); } -inline TFakeTableCell FromVal(NScheme::TTypeId t, TString val) { +inline TFakeTableCell FromVal(NScheme::TTypeId t, TString val) { TFakeTableCell c; c.Set(TRawTypeValue(val.data(), val.size(), t)); return c; } inline TFakeTableCell FromVal(NScheme::TTypeId t, const char* v) { - return FromVal(t, TString(v)); + return FromVal(t, TString(v)); } // Store table id and row key for an update operation @@ -102,7 +102,7 @@ protected: const TScheme& Scheme; private: ui32 Root; - TVector<TFakeTableCell> KeyCells; + TVector<TFakeTableCell> KeyCells; public: TDbRowOpBase(const TScheme& scheme, ui32 root) : Scheme(scheme) @@ -119,14 +119,14 @@ public: return Root; } - const TVector<TFakeTableCell>& GetKey() const { + const TVector<TFakeTableCell>& GetKey() const { return KeyCells; } }; // Accumulates row key and and a set of tag updates operations class TDbRowUpdate : public TDbRowOpBase { - TMap<ui32, TFakeTableCell> TagOps; + TMap<ui32, TFakeTableCell> TagOps; public: TDbRowUpdate(const TScheme& scheme, ui32 root) : TDbRowOpBase(scheme, root) @@ -139,7 +139,7 @@ public: } template<typename T> - TDbRowUpdate& Set(TString tagName, const T& val) { + TDbRowUpdate& Set(TString tagName, const T& val) { const TScheme::TTableInfo* tableInfo = Scheme.GetTableInfo(GetRoot()); Y_VERIFY(tableInfo, "Unknown table id %u", GetRoot()); const ui32* tagId = tableInfo->ColumnNames.FindPtr(tagName); @@ -151,7 +151,7 @@ public: return *this; } - TDbRowUpdate& Erase(TString tagName) { + TDbRowUpdate& Erase(TString tagName) { const TScheme::TTableInfo* tableInfo = Scheme.GetTableInfo(GetRoot()); Y_VERIFY(tableInfo, "Unknown table id %u", GetRoot()); const ui32* tagId = tableInfo->ColumnNames.FindPtr(tagName); @@ -162,7 +162,7 @@ public: return *this; } - const TMap<ui32, TFakeTableCell>& GetTagOps() const { + const TMap<ui32, TFakeTableCell>& GetTagOps() const { return TagOps; } }; @@ -171,13 +171,13 @@ typedef TDbRowOpBase TDbRowErase; template <typename... Tt> -void AppendKeyColumn(ui32 root, const TScheme& scheme, TVector<TFakeTableCell>& tuple) { +void AppendKeyColumn(ui32 root, const TScheme& scheme, TVector<TFakeTableCell>& tuple) { // Extend the key according to scheme tuple.resize(scheme.GetTableInfo(root)->KeyColumns.size()); } template <typename T, typename... Tt> -void AppendKeyColumn(ui32 root, const TScheme& scheme, TVector<TFakeTableCell>& tuple, T t, Tt... tt) { +void AppendKeyColumn(ui32 root, const TScheme& scheme, TVector<TFakeTableCell>& tuple, T t, Tt... tt) { ui32 pos = tuple.size(); ui32 tag = scheme.GetTableInfo(root)->KeyColumns[pos]; NScheme::TTypeId type = scheme.GetColumnInfo(root, tag)->PType; @@ -186,7 +186,7 @@ void AppendKeyColumn(ui32 root, const TScheme& scheme, TVector<TFakeTableCell>& } template <typename... Tt> -void AppendKeyColumn(ui32 root, const TScheme& scheme, TVector<TFakeTableCell>& tuple, nullptr_t, Tt... tt) { +void AppendKeyColumn(ui32 root, const TScheme& scheme, TVector<TFakeTableCell>& tuple, nullptr_t, Tt... tt) { tuple.push_back(MakeNull(ECellOp::Set)); AppendKeyColumn(root, scheme, tuple, tt...); } @@ -216,7 +216,7 @@ public: } void Apply(const TDbRowUpdate& update) { - TVector<TRawTypeValue> key; + TVector<TRawTypeValue> key; Y_VERIFY(!update.GetKey().empty()); for (const auto& col : update.GetKey()) { key.push_back(col.Get()); @@ -231,7 +231,7 @@ public: } void Apply(const TDbRowErase& erase) { - TVector<TRawTypeValue> key; + TVector<TRawTypeValue> key; Y_VERIFY(!erase.GetKey().empty()); for (const auto& col : erase.GetKey()) { key.push_back(col.Get()); diff --git a/ydb/core/tablet_flat/util_fmt_logger.h b/ydb/core/tablet_flat/util_fmt_logger.h index 784e1795fd5..a95c7ad3967 100644 --- a/ydb/core/tablet_flat/util_fmt_logger.h +++ b/ydb/core/tablet_flat/util_fmt_logger.h @@ -48,7 +48,7 @@ namespace NUtil { return conf && conf->Satisfies(prio, Comp, 0ull); } - void LogLn(ELnLev level, const TString &line) const noexcept override + void LogLn(ELnLev level, const TString &line) const noexcept override { /* Usage of time provider will be possible on complete migration to this logger. Legacy macros based logging takes just Now(). diff --git a/ydb/core/testlib/actors/test_runtime_ut.cpp b/ydb/core/testlib/actors/test_runtime_ut.cpp index fce7f192934..c6cc4a85937 100644 --- a/ydb/core/testlib/actors/test_runtime_ut.cpp +++ b/ydb/core/testlib/actors/test_runtime_ut.cpp @@ -233,7 +233,7 @@ Y_UNIT_TEST_SUITE(TActorTest) { public: TMyActor(TMutex *syncMutex) : TActor(&TMyActor::StateFunc) - , CurrentTime(TInstant::MicroSeconds(0)) + , CurrentTime(TInstant::MicroSeconds(0)) , SyncMutex(syncMutex) { } @@ -296,7 +296,7 @@ Y_UNIT_TEST_SUITE(TActorTest) { public: TMyActor() : TActor(&TThis::StateInit) - , CurrentTime(TInstant::MicroSeconds(0)) + , CurrentTime(TInstant::MicroSeconds(0)) { } @@ -441,7 +441,7 @@ Y_UNIT_TEST_SUITE(TActorTest) { TActorId sender = runtime.AllocateEdgeActor(); ui32 count = 1000; ui32 consumersCount = 4; - TVector<TConsumerActor*> consumers; + TVector<TConsumerActor*> consumers; TVector<TActorId> consumerIds; for (ui32 i = 0; i < consumersCount; ++i) { auto consumerActor = new TConsumerActor(count); diff --git a/ydb/core/testlib/fake_coordinator.h b/ydb/core/testlib/fake_coordinator.h index b3098d60a59..f3cd59d1cfe 100644 --- a/ydb/core/testlib/fake_coordinator.h +++ b/ydb/core/testlib/fake_coordinator.h @@ -12,8 +12,8 @@ namespace NKikimr { struct TState : TThrRefBase { ui64 CurrentStep = 5000000; ui64 FrontStep = 0; - TMap<std::pair<ui64, ui64>, TVector<TAutoPtr<TEvTxProcessing::TEvPlanStep>>> QueuedPlans; // shard+step->event - TMap<ui64, TSet<ui64>> TxIds; // txid -> list of shards + TMap<std::pair<ui64, ui64>, TVector<TAutoPtr<TEvTxProcessing::TEvPlanStep>>> QueuedPlans; // shard+step->event + TMap<ui64, TSet<ui64>> TxIds; // txid -> list of shards TState() = default; @@ -89,7 +89,7 @@ namespace NKikimr { } State->CurrentStep = Max(1 + State->CurrentStep, tx.GetMinStep()); - TSet<ui64> shards; + TSet<ui64> shards; for (auto shard : tx.GetAffectedSet()) { shards.insert(shard.GetTabletId()); } diff --git a/ydb/core/testlib/minikql_compile.h b/ydb/core/testlib/minikql_compile.h index 4d76ca8d735..68dd3db375e 100644 --- a/ydb/core/testlib/minikql_compile.h +++ b/ydb/core/testlib/minikql_compile.h @@ -24,7 +24,7 @@ public: return promise.GetFuture(); } - virtual NThreading::TFuture<TTableResults> ResolveTables(const TVector<TTable>& tables) override { + virtual NThreading::TFuture<TTableResults> ResolveTables(const TVector<TTable>& tables) override { TTableResults results; results.reserve(tables.size()); for (auto& table : tables) { @@ -71,12 +71,12 @@ public: private: TThreadPool MtpQueue; - THashMap<TString, IDbSchemeResolver::TTableResult> Tables; + THashMap<TString, IDbSchemeResolver::TTableResult> Tables; }; namespace NYql { -inline TExprContainer::TPtr ParseText(const TString& programText) { +inline TExprContainer::TPtr ParseText(const TString& programText) { TAstParseResult astRes = ParseAst(programText); astRes.Issues.PrintTo(Cerr); UNIT_ASSERT(astRes.IsOk()); diff --git a/ydb/core/testlib/tablet_helpers.cpp b/ydb/core/testlib/tablet_helpers.cpp index a853040b932..f2d20ce1926 100644 --- a/ydb/core/testlib/tablet_helpers.cpp +++ b/ydb/core/testlib/tablet_helpers.cpp @@ -93,7 +93,7 @@ namespace NKikimr { } private: - THashMap<ui64, TIntrusivePtr<TMediatorTimecastEntry>> Entries; + THashMap<ui64, TIntrusivePtr<TMediatorTimecastEntry>> Entries; }; void SetupMediatorTimecastProxy(TTestActorRuntime& runtime, ui32 nodeIndex, bool useFake = false) @@ -159,7 +159,7 @@ namespace NKikimr { class TTabletTracer : TNonCopyable { public: - TTabletTracer(bool& tracingActive, const TVector<ui64>& tabletIds) + TTabletTracer(bool& tracingActive, const TVector<ui64>& tabletIds) : TracingActive(tracingActive) , TabletIds(tabletIds) {} @@ -259,12 +259,12 @@ namespace NKikimr { TMap<TActorId, ui64> TabletRelatedActors; TSet<ui64> DeletedTablets; bool& TracingActive; - const TVector<ui64> TabletIds; + const TVector<ui64> TabletIds; }; class TRebootTabletObserver : public TTabletTracer { public: - TRebootTabletObserver(ui32 tabletEventCountBeforeReboot, ui64 tabletId, bool& tracingActive, const TVector<ui64>& tabletIds, + TRebootTabletObserver(ui32 tabletEventCountBeforeReboot, ui64 tabletId, bool& tracingActive, const TVector<ui64>& tabletIds, TTestActorRuntime::TEventFilter filter, bool killOnCommit) : TTabletTracer(tracingActive, tabletIds) , TabletEventCountBeforeReboot(tabletEventCountBeforeReboot) @@ -417,7 +417,7 @@ namespace NKikimr { class TDelayingObserver : public TTabletTracer { public: - TDelayingObserver(bool& tracingActive, double delayInjectionProbability, const TVector<ui64>& tabletIds) + TDelayingObserver(bool& tracingActive, double delayInjectionProbability, const TVector<ui64>& tabletIds) : TTabletTracer(tracingActive, tabletIds) , DelayInjectionProbability(delayInjectionProbability) , ExecutionCount(0) @@ -536,7 +536,7 @@ namespace NKikimr { private: const double DelayInjectionProbability; TAutoPtr<TDecisionTreeItem> Decisions; - TVector<TDecisionTreeItem*> CurrentItems; + TVector<TDecisionTreeItem*> CurrentItems; ui64 ExecutionCount; ui32 NormalStepsCount; TMersenne<ui64> Random; @@ -749,8 +749,8 @@ namespace NKikimr { UNIT_ASSERT(configureResponse->Record.GetResponse().GetSuccess()); } - void RunTestWithReboots(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory, - std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc, + void RunTestWithReboots(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory, + std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc, ui32 selectedReboot, ui64 selectedTablet, ui32 bucket, ui32 totalBuckets, bool killOnCommit) { bool activeZone = false; @@ -851,7 +851,7 @@ namespace NKikimr { } void RunTestWithPipeResets(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory, - std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc, + std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc, ui32 selectedReboot, ui32 bucket, ui32 totalBuckets) { bool activeZone = false; @@ -895,7 +895,7 @@ namespace NKikimr { continue; } - TString dispatchName = Sprintf("Pipe reset at event #%" PRIu32, eventCountBeforeReboot); + TString dispatchName = Sprintf("Pipe reset at event #%" PRIu32, eventCountBeforeReboot); if (ENABLE_REBOOT_DISPATCH_LOG) Cout << "===> BEGIN dispatch: " << dispatchName << "\n"; @@ -940,15 +940,15 @@ namespace NKikimr { } } - void RunTestWithDelays(const TRunWithDelaysConfig& config, const TVector<ui64>& tabletIds, - std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc) { + void RunTestWithDelays(const TRunWithDelaysConfig& config, const TVector<ui64>& tabletIds, + std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc) { if (SUPPRESS_DELAYS || GetEnv("FAST_UT")=="1") return; bool activeZone = false; TDelayingObserver delayingObserver(activeZone, config.DelayInjectionProbability, tabletIds); TTabletScheduledFilter scheduledFilter(delayingObserver); - TString dispatchName; + TString dispatchName; try { while (!delayingObserver.IsDone() && (delayingObserver.GetExecutionCount() < config.VariantsLimit)) { delayingObserver.PrepareExecution(); @@ -1051,7 +1051,7 @@ namespace NKikimr { //Cout << event->Answer << "\n"; ui64 totalFreeSize = 0; for (ui32 i = 0; i < 2; ++i) { - TString regex = Sprintf(".*sensor=%s:\\s(\\d+).*", i == 0 ? "FreeChunks" : "UntrimmedFreeChunks"); + TString regex = Sprintf(".*sensor=%s:\\s(\\d+).*", i == 0 ? "FreeChunks" : "UntrimmedFreeChunks"); TRegExBase matcher(regex); regmatch_t groups[2] = {}; matcher.Exec(event->Answer.data(), groups, 0, 2); @@ -1428,7 +1428,7 @@ namespace NKikimr { private: TState::TPtr State; TGetTabletCreationFunc GetTabletCreationFunc; - TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue; + TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue; }; void BootFakeHive(TTestActorRuntime& runtime, ui64 tabletId, TFakeHiveState::TPtr state, diff --git a/ydb/core/testlib/tablet_helpers.h b/ydb/core/testlib/tablet_helpers.h index 81a7c614aaa..71617aa7d3d 100644 --- a/ydb/core/testlib/tablet_helpers.h +++ b/ydb/core/testlib/tablet_helpers.h @@ -44,15 +44,15 @@ namespace NKikimr { i64 SetSplitMergePartCountLimit(TTestActorRuntime* runtime, i64 val); bool SetAllowServerlessStorageBilling(TTestActorRuntime* runtime, bool isAllow); - const TString INITIAL_TEST_DISPATCH_NAME = "Trace"; + const TString INITIAL_TEST_DISPATCH_NAME = "Trace"; - void RunTestWithReboots(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory, - std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc, + void RunTestWithReboots(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory, + std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc, ui32 selectedReboot = Max<ui32>(), ui64 selectedTablet = Max<ui64>(), ui32 bucket = 0, ui32 totalBuckets = 0, bool killOnCommit = false); // Resets pipe when receiving client events void RunTestWithPipeResets(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory, - std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc, + std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc, ui32 selectedReboot = Max<ui32>(), ui32 bucket = 0, ui32 totalBuckets = 0); struct TRunWithDelaysConfig { @@ -67,8 +67,8 @@ namespace NKikimr { {} }; - void RunTestWithDelays(const TRunWithDelaysConfig& config, const TVector<ui64>& tabletIds, - std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc); + void RunTestWithDelays(const TRunWithDelaysConfig& config, const TVector<ui64>& tabletIds, + std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc); class ITabletScheduledEventsGuard { public: @@ -129,8 +129,8 @@ namespace NKikimr { }; struct TFakeHiveState : TThrRefBase { - TMap<std::pair<ui64, ui64>, TFakeHiveTabletInfo> Tablets; - TMap<ui64, std::pair<ui64, ui64>> TabletIdToOwner; + TMap<std::pair<ui64, ui64>, TFakeHiveTabletInfo> Tablets; + TMap<ui64, std::pair<ui64, ui64>> TabletIdToOwner; TMap<ui64, ui64> TabletIdToHive; ui64 NextTabletId; ui64 NextHiveNextTabletId; diff --git a/ydb/core/testlib/test_client.cpp b/ydb/core/testlib/test_client.cpp index d4907c26f1e..395d596484d 100644 --- a/ydb/core/testlib/test_client.cpp +++ b/ydb/core/testlib/test_client.cpp @@ -1048,7 +1048,7 @@ namespace Tests { UNIT_ASSERT_VALUES_EQUAL(SyncCall(request, reply), NBus::MESSAGE_OK); } - TString TClient::StartTrace(const TString &path) { + TString TClient::StartTrace(const TString &path) { TAutoPtr<NMsgBusProxy::TBusMessageBusTraceRequest> request(new NMsgBusProxy::TBusMessageBusTraceRequest()); request->Record.SetCommand(NKikimrClient::TMessageBusTraceRequest::START); if (path) @@ -1523,7 +1523,7 @@ namespace Tests { return (NMsgBusProxy::EResponseStatus)response.GetStatus(); } - NMsgBusProxy::EResponseStatus TClient::AlterTable(const TString& parent, const TString& alter) { + NMsgBusProxy::EResponseStatus TClient::AlterTable(const TString& parent, const TString& alter) { NKikimrSchemeOp::TTableDescription table; bool parseOk = ::google::protobuf::TextFormat::ParseFromString(alter, &table); UNIT_ASSERT(parseOk); @@ -1543,7 +1543,7 @@ namespace Tests { return (NMsgBusProxy::EResponseStatus)response.GetStatus(); } - NMsgBusProxy::EResponseStatus TClient::DeleteTable(const TString& parent, const TString& name) { + NMsgBusProxy::EResponseStatus TClient::DeleteTable(const TString& parent, const TString& name) { TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation()); auto *op = request->Record.MutableTransaction()->MutableModifyScheme(); op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable); @@ -1569,7 +1569,7 @@ namespace Tests { return (NMsgBusProxy::EResponseStatus)response.GetStatus(); } - TAutoPtr<NMsgBusProxy::TBusResponse> TClient::TryDropPersQueueGroup(const TString& parent, const TString& name) { + TAutoPtr<NMsgBusProxy::TBusResponse> TClient::TryDropPersQueueGroup(const TString& parent, const TString& name) { TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation()); auto * op = request->Record.MutableTransaction()->MutableModifyScheme(); op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup); @@ -1685,7 +1685,7 @@ namespace Tests { UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK); } - void TClient::ModifyACL(const TString& parent, const TString& name, const TString& acl) { + void TClient::ModifyACL(const TString& parent, const TString& name, const TString& acl) { TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation()); auto *op = request->Record.MutableTransaction()->MutableModifyScheme(); op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL); @@ -1810,7 +1810,7 @@ namespace Tests { UNIT_ASSERT((NMsgBusProxy::EResponseStatus)responseDelete.GetStatus()); } - bool TClient::LocalQuery(const ui64 tabletId, const TString &pgmText, NKikimrMiniKQL::TResult& result) { + bool TClient::LocalQuery(const ui64 tabletId, const TString &pgmText, NKikimrMiniKQL::TResult& result) { TAutoPtr<NMsgBusProxy::TBusTabletLocalMKQL> request = new NMsgBusProxy::TBusTabletLocalMKQL(); request->Record.SetTabletID(ChangeStateStorage(tabletId, Domain)); request->Record.SetWithRetry(true); @@ -1831,7 +1831,7 @@ namespace Tests { } bool TClient::LocalSchemeTx(const ui64 tabletId, const NTabletFlatScheme::TSchemeChanges& changes, bool dryRun, - NTabletFlatScheme::TSchemeChanges& scheme, TString& err) { + NTabletFlatScheme::TSchemeChanges& scheme, TString& err) { TAutoPtr<NMsgBusProxy::TBusTabletLocalSchemeTx> request = new NMsgBusProxy::TBusTabletLocalSchemeTx(); request->Record.SetTabletID(ChangeStateStorage(tabletId, Domain)); request->Record.SetDryRun(dryRun); @@ -1851,14 +1851,14 @@ namespace Tests { return err.empty(); } - bool TClient::LocalSchemeTx(const ui64 tabletId, const TString &schemeChangesStr, bool dryRun, - NTabletFlatScheme::TSchemeChanges& scheme, TString& err) { + bool TClient::LocalSchemeTx(const ui64 tabletId, const TString &schemeChangesStr, bool dryRun, + NTabletFlatScheme::TSchemeChanges& scheme, TString& err) { NTabletFlatScheme::TSchemeChanges schemeChanges; ::google::protobuf::TextFormat::ParseFromString(schemeChangesStr, &schemeChanges); return LocalSchemeTx(tabletId, schemeChanges, dryRun, scheme, err); } - bool TClient::Compile(const TString &mkql, TString &compiled) { + bool TClient::Compile(const TString &mkql, TString &compiled) { TAutoPtr<NMsgBusProxy::TBusRequest> request = new NMsgBusProxy::TBusRequest(); auto* mkqlTx = request->Record.MutableTransaction()->MutableMiniKQLTransaction(); mkqlTx->MutableProgram()->SetText(mkql); @@ -1993,49 +1993,49 @@ namespace Tests { return FlatQuery(query, opts, result, expectedResponse); } - bool TClient::FlatQueryParams(const TString& mkql, const TString& params, bool queryCompiled, NKikimrMiniKQL::TResult &result) { + bool TClient::FlatQueryParams(const TString& mkql, const TString& params, bool queryCompiled, NKikimrMiniKQL::TResult &result) { TFlatQueryOptions opts; opts.Params = params; opts.IsQueryCompiled = queryCompiled; return FlatQuery(mkql, opts, result); } - bool TClient::FlatQuery(const TString& mkql, NKikimrMiniKQL::TResult& result) { + bool TClient::FlatQuery(const TString& mkql, NKikimrMiniKQL::TResult& result) { TFlatQueryOptions opts; return FlatQuery(mkql, opts, result); } - TString TClient::SendTabletMonQuery(TTestActorRuntime* runtime, ui64 tabletId, TString query) { + TString TClient::SendTabletMonQuery(TTestActorRuntime* runtime, ui64 tabletId, TString query) { TActorId sender = runtime->AllocateEdgeActor(0); ForwardToTablet(*runtime, tabletId, sender, new NActors::NMon::TEvRemoteHttpInfo(query), 0); TAutoPtr<IEventHandle> handle; // Timeout for DEBUG purposes only runtime->GrabEdgeEvent<NMon::TEvRemoteJsonInfoRes>(handle); - TString res = handle->Get<NMon::TEvRemoteJsonInfoRes>()->Json; + TString res = handle->Get<NMon::TEvRemoteJsonInfoRes>()->Json; #ifndef NDEBUG Cerr << res << Endl; #endif return res; } - TString TClient::MarkNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx, bool up) { + TString TClient::MarkNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx, bool up) { ui32 nodeId = runtime->GetNodeId(nodeIdx); ui64 hive = ChangeStateStorage(Tests::Hive, Domain); TInstant deadline = TInstant::Now() + TIMEOUT; while (TInstant::Now() <= deadline) { - TString res = SendTabletMonQuery(runtime, hive, TString("/app?page=SetDown&node=") + ToString(nodeId) + "&down=" + (up ? "0" : "1")); + TString res = SendTabletMonQuery(runtime, hive, TString("/app?page=SetDown&node=") + ToString(nodeId) + "&down=" + (up ? "0" : "1")); if (!res.empty() && !res.Contains("Error")) return res; } UNIT_ASSERT_C(false, "Failed to mark node in hive"); - return TString(); + return TString(); } - TString TClient::KickNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx) { + TString TClient::KickNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx) { ui32 nodeId = runtime->GetNodeId(nodeIdx); ui64 hive = ChangeStateStorage(Tests::Hive, Domain); - return SendTabletMonQuery(runtime, hive, TString("/app?page=KickNode&node=") + ToString(nodeId)); + return SendTabletMonQuery(runtime, hive, TString("/app?page=KickNode&node=") + ToString(nodeId)); } bool TClient::WaitForTabletAlive(TTestActorRuntime* runtime, ui64 tabletId, bool leader, TDuration timeout) { @@ -2195,7 +2195,7 @@ namespace Tests { void TClient::S3Listing(const TString& table, const TString& prefixColumnsPb, const TString& pathPrefix, const TString& pathDelimiter, const TString& startAfterSuffixColumnsPb, - const TVector<TString>& columnsToReturn, ui32 maxKeys, + const TVector<TString>& columnsToReturn, ui32 maxKeys, ui32 timeoutMillisec, NKikimrClient::TS3ListingResponse& res) { TAutoPtr<NMsgBusProxy::TBusS3ListingRequest> request = new NMsgBusProxy::TBusS3ListingRequest(); @@ -2279,7 +2279,7 @@ namespace Tests { if (address.empty() || !TryFromString(port, portValue)) ythrow TWithBackTrace<yexception>() << "Incorrect server redirect, expected 'IpAddress/Port'"; - return TServerSetup(TString(address), portValue); + return TServerSetup(TString(address), portValue); } TTenants::TTenants(TServer::TPtr server) @@ -2346,7 +2346,7 @@ namespace Tests { } bool TTenants::IsActive(const TString &name, ui32 nodeIdx) const { - const TVector<ui32>& nodes = List(name); + const TVector<ui32>& nodes = List(name); #ifndef NDEBUG Cerr << "IsActive: " << name << " -- " << nodeIdx << Endl; for (auto& x: nodes) { @@ -2357,7 +2357,7 @@ namespace Tests { return std::find(nodes.begin(), nodes.end(), nodeIdx) != nodes.end(); } - const TVector<ui32> &TTenants::List(const TString &name) const { + const TVector<ui32> &TTenants::List(const TString &name) const { Y_VERIFY(Tenants.contains(name)); return Tenants.at(name); @@ -2381,7 +2381,7 @@ namespace Tests { return Server->DynamicNodes(); } - TVector<ui32> &TTenants::Nodes(const TString &name) { + TVector<ui32> &TTenants::Nodes(const TString &name) { return Tenants[name]; } @@ -2394,7 +2394,7 @@ namespace Tests { } void TTenants::StopPaticularNode(const TString &name, ui32 nodeIdx) { - TVector<ui32>& nodes = Nodes(name); + TVector<ui32>& nodes = Nodes(name); auto subj = std::find(nodes.begin(), nodes.end(), nodeIdx); Y_VERIFY(subj != nodes.end()); @@ -2407,7 +2407,7 @@ namespace Tests { } void TTenants::StopNodes(const TString &name, ui32 count) { - TVector<ui32>& nodes = Nodes(name); + TVector<ui32>& nodes = Nodes(name); for (ui32 num = 0; num < count && nodes; ++num) { ui32 nodeIdx = nodes.back(); @@ -2418,7 +2418,7 @@ namespace Tests { } void TTenants::RunNodes(const TString &name, ui32 count) { - TVector<ui32>& nodes = Nodes(name); + TVector<ui32>& nodes = Nodes(name); for (ui32 num = 0; num < count; ++num) { ui32 nodeIdx = AllocNodeIdx(); diff --git a/ydb/core/testlib/test_client.h b/ydb/core/testlib/test_client.h index 2064752ab45..47f3dd3cc35 100644 --- a/ydb/core/testlib/test_client.h +++ b/ydb/core/testlib/test_client.h @@ -55,13 +55,13 @@ namespace Tests { const ui64 Hive = 0xA001; struct TServerSetup { - TString IpAddress; + TString IpAddress; ui16 Port = 0; TServerSetup() {} - TServerSetup(const TString& ipAddress, ui16 port) + TServerSetup(const TString& ipAddress, ui16 port) : IpAddress(ipAddress) , Port(port) {} @@ -263,7 +263,7 @@ namespace Tests { class TClient { public: struct TFlatQueryOptions { - TString Params; + TString Params; bool IsQueryCompiled = false; bool CollectStats = false; }; @@ -339,7 +339,7 @@ namespace Tests { void InitRootScheme(const TString& root); void ExecuteTraceCommand(NKikimrClient::TMessageBusTraceRequest::ECommand command, const TString &path = TString()); - TString StartTrace(const TString &path); + TString StartTrace(const TString &path); void StopTrace(); // Flat DB operations @@ -382,29 +382,29 @@ namespace Tests { NMsgBusProxy::EResponseStatus CreateSolomon(const TString& parent, const TString& name, ui32 parts = 4, ui32 channelProfile = 0); NMsgBusProxy::EResponseStatus StoreTableBackup(const TString& parent, const NKikimrSchemeOp::TBackupTask& task); NMsgBusProxy::EResponseStatus DeleteTopic(const TString& parent, const TString& name); - TAutoPtr<NMsgBusProxy::TBusResponse> TryDropPersQueueGroup(const TString& parent, const TString& name); - TAutoPtr<NMsgBusProxy::TBusResponse> Ls(const TString& path); + TAutoPtr<NMsgBusProxy::TBusResponse> TryDropPersQueueGroup(const TString& parent, const TString& name); + TAutoPtr<NMsgBusProxy::TBusResponse> Ls(const TString& path); static TPathVersion ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& describe); static TVector<ui64> ExtractTableShards(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp); - bool FlatQuery(const TString& mkql, NKikimrMiniKQL::TResult& result); - bool FlatQuery(const TString& mkql, TFlatQueryOptions& opts, NKikimrMiniKQL::TResult& result, + bool FlatQuery(const TString& mkql, NKikimrMiniKQL::TResult& result); + bool FlatQuery(const TString& mkql, TFlatQueryOptions& opts, NKikimrMiniKQL::TResult& result, const NKikimrClient::TResponse& expectedResponse); bool FlatQuery(const TString& mkql, TFlatQueryOptions& opts, NKikimrMiniKQL::TResult& result, ui32 expectedStatus = NMsgBusProxy::MSTATUS_OK); - bool FlatQueryParams(const TString &query, const TString ¶ms, bool queryCompiled, NKikimrMiniKQL::TResult &result); + bool FlatQueryParams(const TString &query, const TString ¶ms, bool queryCompiled, NKikimrMiniKQL::TResult &result); // returns NMsgBusProxy::MSTATUS_* and the raw response ui32 FlatQueryRaw(const TString &query, TFlatQueryOptions& opts, NKikimrClient::TResponse& response, int retryCnt = 10); - bool Compile(const TString &mkql, TString &compiled); - bool LocalQuery(ui64 tabletId, const TString &pgmText, NKikimrMiniKQL::TResult& result); + bool Compile(const TString &mkql, TString &compiled); + bool LocalQuery(ui64 tabletId, const TString &pgmText, NKikimrMiniKQL::TResult& result); bool LocalSchemeTx(const ui64 tabletId, const NTabletFlatScheme::TSchemeChanges& schemeChanges, bool dryRun, - NTabletFlatScheme::TSchemeChanges& scheme, TString& err); - bool LocalSchemeTx(const ui64 tabletId, const TString& schemeChanges, bool dryRun, - NTabletFlatScheme::TSchemeChanges& scheme, TString& err); - void SetSecurityToken(const TString& token) { SecurityToken = token; } + NTabletFlatScheme::TSchemeChanges& scheme, TString& err); + bool LocalSchemeTx(const ui64 tabletId, const TString& schemeChanges, bool dryRun, + NTabletFlatScheme::TSchemeChanges& scheme, TString& err); + void SetSecurityToken(const TString& token) { SecurityToken = token; } void ModifyOwner(const TString& parent, const TString& name, const TString& owner); - void ModifyACL(const TString& parent, const TString& name, const TString& acl); + void ModifyACL(const TString& parent, const TString& name, const TString& acl); TString CreateStoragePool(const TString& poolKind, const TString& partOfName, ui32 groups = 1); NKikimrBlobStorage::TDefineStoragePool DescribeStoragePool(const TString& name); void RemoveStoragePool(const TString& name); @@ -415,9 +415,9 @@ namespace Tests { // Helper functions - TString SendTabletMonQuery(TTestActorRuntime* runtime, ui64 tabletId, TString query); - TString MarkNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx, bool up); - TString KickNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx); + TString SendTabletMonQuery(TTestActorRuntime* runtime, ui64 tabletId, TString query); + TString MarkNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx, bool up); + TString KickNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx); bool WaitForTabletAlive(TTestActorRuntime* runtime, ui64 tabletId, bool leader, TDuration timeout); bool WaitForTabletDown(TTestActorRuntime* runtime, ui64 tabletId, bool leader, TDuration timeout); ui32 GetLeaderNode(TTestActorRuntime* runtime, ui64 tabletId); @@ -441,9 +441,9 @@ namespace Tests { protected: template <class TMsg> - TString PrintResult(NBus::TBusMessage* msg, size_t maxSz = 1000) { + TString PrintResult(NBus::TBusMessage* msg, size_t maxSz = 1000) { auto res = dynamic_cast<TMsg*>(msg); - TString s; + TString s; ::google::protobuf::TextFormat::PrintToString(res->Record, &s); if (s.size() > maxSz) { s.resize(maxSz); @@ -508,7 +508,7 @@ namespace Tests { using TStoragePoolKinds = TDomainsInfo::TDomain::TStoragePoolKinds; const ui32 Domain; - const TString DomainName; + const TString DomainName; const bool SupportsRedirect; const TStoragePoolKinds StoragePoolTypes; NScheme::TKikimrTypeRegistry TypeRegistry; @@ -518,15 +518,15 @@ namespace Tests { TMaybe<ui64> TypesEtag; NScheme::TTypeMetadataRegistry LoadedTypeMetadataRegistry; TIntrusivePtr<NMiniKQL::IFunctionRegistry> LoadedFunctionRegistry; - TString SecurityToken; + TString SecurityToken; }; struct TTenants { private: Tests::TServer::TPtr Server; - TVector<ui32> VacantNodes; - TMap<TString, TVector<ui32>> Tenants; + TVector<ui32> VacantNodes; + TMap<TString, TVector<ui32>> Tenants; public: TTenants(Tests::TServer::TPtr server); @@ -543,14 +543,14 @@ namespace Tests { void FreeNode(const TString &name, ui32 nodeIdx); bool IsStaticNode(ui32 nodeIdx) const; - const TVector<ui32>& List(const TString &name) const; + const TVector<ui32>& List(const TString &name) const; ui32 Size(const TString &name) const; ui32 Size() const; ui32 Availabe() const; ui32 Capacity() const; private: - TVector<ui32>& Nodes(const TString &name); + TVector<ui32>& Nodes(const TString &name); void StopNode(const TString /*name*/, ui32 nodeIdx); void RunNode(const TString &name, ui32 nodeIdx); void StopPaticularNode(const TString &name, ui32 nodeIdx); diff --git a/ydb/core/tx/balance_coverage/balance_coverage_builder.h b/ydb/core/tx/balance_coverage/balance_coverage_builder.h index c14eaaadd6c..d92c1c2958e 100644 --- a/ydb/core/tx/balance_coverage/balance_coverage_builder.h +++ b/ydb/core/tx/balance_coverage/balance_coverage_builder.h @@ -15,7 +15,7 @@ namespace NKikimr { struct TNode { const ui64 Tablet; bool HasResult; - TVector<TAutoPtr<TNode>> Children; + TVector<TAutoPtr<TNode>> Children; TNode(ui64 tablet) : Tablet(tablet) diff --git a/ydb/core/tx/coordinator/coordinator__check.h b/ydb/core/tx/coordinator/coordinator__check.h index 8277b0200be..64fffde804e 100644 --- a/ydb/core/tx/coordinator/coordinator__check.h +++ b/ydb/core/tx/coordinator/coordinator__check.h @@ -24,7 +24,7 @@ struct TTxCoordinator::TTxConsistencyCheck : public TTransactionBase<TTxCoordina TTxId txId = rowset.GetKey(); TTransaction& transaction = transactions[txId]; transaction.PlanOnStep = rowset.GetValue<Schema::Transaction::Plan>(); - TVector<TTabletId> affectedSet = rowset.GetValue<Schema::Transaction::AffectedSet>(); + TVector<TTabletId> affectedSet = rowset.GetValue<Schema::Transaction::AffectedSet>(); transaction.AffectedSet.reserve(affectedSet.size()); for (TTabletId id : affectedSet) transaction.AffectedSet.insert(id); @@ -41,7 +41,7 @@ struct TTxCoordinator::TTxConsistencyCheck : public TTransactionBase<TTxCoordina TTxId txId = rowset.GetValue<Schema::AffectedSet::TransactionID>(); auto itTransaction = transactions.find(txId); Y_ENSURE(itTransaction != transactions.end(), "Could not find mediator's transaction"); - THashSet<TTabletId>& unconfirmedAffectedSet = itTransaction->second.UnconfirmedAffectedSet[medId]; + THashSet<TTabletId>& unconfirmedAffectedSet = itTransaction->second.UnconfirmedAffectedSet[medId]; unconfirmedAffectedSet.insert(rowset.GetValue<Schema::AffectedSet::DataShardID>()); if (!rowset.Next()) return false; diff --git a/ydb/core/tx/coordinator/coordinator__configure.cpp b/ydb/core/tx/coordinator/coordinator__configure.cpp index 338432dbc35..e1f274ef7bd 100644 --- a/ydb/core/tx/coordinator/coordinator__configure.cpp +++ b/ydb/core/tx/coordinator/coordinator__configure.cpp @@ -7,7 +7,7 @@ struct TTxCoordinator::TTxConfigure : public TTransactionBase<TTxCoordinator> { TActorId AckTo; ui64 Version; ui64 Resolution; - TVector<TTabletId> Mediators; + TVector<TTabletId> Mediators; NKikimrSubDomains::TProcessingParams Config; TAutoPtr<TEvSubDomain::TEvConfigureStatus> Respond; bool ConfigurationApplied; @@ -36,13 +36,13 @@ struct TTxCoordinator::TTxConfigure : public TTransactionBase<TTxCoordinator> { return false; ui64 curVersion = 0; - TVector<TTabletId> curMediators; + TVector<TTabletId> curMediators; ui64 curResolution = 0; bool curHaveConfig = false; while (!rowset.EndOfSet()) { const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>(); - TVector<TTabletId> mediators = rowset.GetValue<Schema::DomainConfiguration::Mediators>(); + TVector<TTabletId> mediators = rowset.GetValue<Schema::DomainConfiguration::Mediators>(); ui64 resolution = rowset.GetValue<Schema::DomainConfiguration::Resolution>(); if (ver >= curVersion) { diff --git a/ydb/core/tx/coordinator/coordinator__init.cpp b/ydb/core/tx/coordinator/coordinator__init.cpp index beb9975b42c..52ca2e73d9c 100644 --- a/ydb/core/tx/coordinator/coordinator__init.cpp +++ b/ydb/core/tx/coordinator/coordinator__init.cpp @@ -8,7 +8,7 @@ namespace NFlatTxCoordinator { struct TTxCoordinator::TTxInit : public TTransactionBase<TTxCoordinator> { ui64 Version = 0; - TVector<TTabletId> Mediators; + TVector<TTabletId> Mediators; TVector<TTabletId> Coordinators; ui64 PlanResolution; ui64 LastPlanned = 0; @@ -39,7 +39,7 @@ struct TTxCoordinator::TTxInit : public TTransactionBase<TTxCoordinator> { while (!rowset.EndOfSet()) { const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>(); - TVector<TTabletId> mediators = rowset.GetValue<Schema::DomainConfiguration::Mediators>(); + TVector<TTabletId> mediators = rowset.GetValue<Schema::DomainConfiguration::Mediators>(); ui64 resolution = rowset.GetValue<Schema::DomainConfiguration::Resolution>(); if (ver >= Version) { diff --git a/ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp b/ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp index 28a644503d9..a01928657f9 100644 --- a/ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp +++ b/ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp @@ -42,9 +42,9 @@ struct TTxCoordinator::TTxMediatorConfirmations : public TTransactionBase<TTxCoo continue; } - THashSet<TTabletId>& mediatorAffectedSet = txit->second.UnconfirmedAffectedSet[mediatorId]; + THashSet<TTabletId>& mediatorAffectedSet = txit->second.UnconfirmedAffectedSet[mediatorId]; for (const TTabletId affected : txidsx.second) { - THashSet<TTabletId>::size_type result = mediatorAffectedSet.erase(affected); + THashSet<TTabletId>::size_type result = mediatorAffectedSet.erase(affected); db.Table<Schema::AffectedSet>().Key(mediatorId, txid, affected).Delete(); FLOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR, "at tablet# " << Self->TabletID() diff --git a/ydb/core/tx/coordinator/coordinator__monitoring.cpp b/ydb/core/tx/coordinator/coordinator__monitoring.cpp index 550c8ef2815..dadafab22a9 100644 --- a/ydb/core/tx/coordinator/coordinator__monitoring.cpp +++ b/ydb/core/tx/coordinator/coordinator__monitoring.cpp @@ -6,7 +6,7 @@ namespace NFlatTxCoordinator { struct TTxCoordinator::TTxMonitoring : public TTxCoordinator::TTxConsistencyCheck { TActorId ActorToRespond; - TString CheckResult; + TString CheckResult; TTxMonitoring(TSelf* self, const TActorId& actorToRespond) : TTxCoordinator::TTxConsistencyCheck(self) diff --git a/ydb/core/tx/coordinator/coordinator__plan_step.cpp b/ydb/core/tx/coordinator/coordinator__plan_step.cpp index c1fac2ffa58..af1d0febeef 100644 --- a/ydb/core/tx/coordinator/coordinator__plan_step.cpp +++ b/ydb/core/tx/coordinator/coordinator__plan_step.cpp @@ -20,9 +20,9 @@ struct TInFlyAccountant { struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> { const ui64 PlanOnStep; const bool Rapid; - TVector<TQueueType::TSlot> Slots; + TVector<TQueueType::TSlot> Slots; - TMap<ui64, std::pair<ui64, bool *>> StepsToConfirm; + TMap<ui64, std::pair<ui64, bool *>> StepsToConfirm; TAutoPtr<TCoordinatorStepConfirmations> ProxyPlanConfirmations; TInstant ExecStartMoment; @@ -30,7 +30,7 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> { ui64 DeclinedCounter; TInFlyAccountant InFlyAccountant; - TTxPlanStep(ui64 toPlan, TVector<TQueueType::TSlot> &slots, TSelf *coordinator, bool rapid) + TTxPlanStep(ui64 toPlan, TVector<TQueueType::TSlot> &slots, TSelf *coordinator, bool rapid) : TBase(coordinator) , PlanOnStep(toPlan) , Rapid(rapid) @@ -47,9 +47,9 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> { ExecStartMoment = ctx.Now(); const bool lowDiskSpace = Self->Executor()->GetStats().IsAnyChannelYellowStop; - THashSet<TTxId> newTransactions; - TVector<TAutoPtr<TMediatorStep>> mediatorSteps; - THashMap<TTabletId, TVector<TTabletId>> byMediatorAffected; + THashSet<TTxId> newTransactions; + TVector<TAutoPtr<TMediatorStep>> mediatorSteps; + THashMap<TTabletId, TVector<TTabletId>> byMediatorAffected; // first fill every mediator with something (every mediator must receive step) const ui32 mediatorsSize = Self->Config.Mediators->List().size(); @@ -61,8 +61,8 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> { // create mediator steps ProxyPlanConfirmations.Reset(new TCoordinatorStepConfirmations(PlanOnStep)); for (const auto &slot : Slots) { - TQueueType::TQ &queue = *slot.Queue; - TQueueType::TQ::TReadIterator iterator = queue.Iterator(); + TQueueType::TQ &queue = *slot.Queue; + TQueueType::TQ::TReadIterator iterator = queue.Iterator(); while (TTransactionProposal *proposal = iterator.Next()) { for (auto &x : byMediatorAffected) { x.second.clear(); @@ -142,7 +142,7 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> { byMediatorAffected[mediatorId].push_back(affectedTablet); } - TVector<TTabletId> affectedSet(transaction.AffectedSet.begin(), transaction.AffectedSet.end()); + TVector<TTabletId> affectedSet(transaction.AffectedSet.begin(), transaction.AffectedSet.end()); db.Table<Schema::Transaction>().Key(txId).Update( NIceDb::TUpdate<Schema::Transaction::Plan>(PlanOnStep), @@ -153,7 +153,7 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> { for (ui32 idx = 0; idx < mediatorsSize; ++idx) { TTabletId mediatorId = mediatorSteps[idx]->MediatorId; - TVector<TTabletId> &affected = byMediatorAffected[mediatorId]; + TVector<TTabletId> &affected = byMediatorAffected[mediatorId]; if (!affected.empty()) { mediatorSteps[idx]->Transactions.push_back(TMediatorStep::TTx(txId, &affected.front(), affected.size(), 0)); } diff --git a/ydb/core/tx/coordinator/coordinator__restart_mediator.cpp b/ydb/core/tx/coordinator/coordinator__restart_mediator.cpp index 673115d22b0..81e2c5a97dd 100644 --- a/ydb/core/tx/coordinator/coordinator__restart_mediator.cpp +++ b/ydb/core/tx/coordinator/coordinator__restart_mediator.cpp @@ -7,7 +7,7 @@ struct TTxCoordinator::TTxRestartMediatorQueue : public TTransactionBase<TTxCoor const TTabletId MediatorId; const ui64 GenCookie; - TVector<bool *> StepsToConfirm; + TVector<bool *> StepsToConfirm; TTxRestartMediatorQueue(ui64 mediatorId, ui64 genCookie, TSelf *coordinator) : TBase(coordinator) @@ -22,15 +22,15 @@ struct TTxCoordinator::TTxRestartMediatorQueue : public TTransactionBase<TTxCoor if (mediator.GenCookie != GenCookie) return true; - THashMap<TTxId,TVector<TTabletId>> pushToAffectedBuffer; - TVector<TAutoPtr<TMediatorStep>> mediatorSteps; + THashMap<TTxId,TVector<TTabletId>> pushToAffectedBuffer; + TVector<TAutoPtr<TMediatorStep>> mediatorSteps; if (!Self->RestoreMediatorInfo(MediatorId, mediatorSteps, txc, pushToAffectedBuffer)) return false; for (const auto& it : pushToAffectedBuffer) { TTransaction& transaction = Self->Transactions[it.first]; - THashSet<TTabletId>& unconfirmedAffectedSet = transaction.UnconfirmedAffectedSet[MediatorId]; + THashSet<TTabletId>& unconfirmedAffectedSet = transaction.UnconfirmedAffectedSet[MediatorId]; Y_VERIFY(unconfirmedAffectedSet.size() == it.second.size(), "Incosistent affected set in mem in DB for txId %" PRIu64, it.first); for (const TTabletId affectedTabletId : it.second) { @@ -65,7 +65,7 @@ ITransaction* TTxCoordinator::CreateTxRestartMediatorQueue(TTabletId mediatorId, return new TTxRestartMediatorQueue(mediatorId, genCookie, this); } -bool TTxCoordinator::RestoreMediatorInfo(TTabletId mediatorId, TVector<TAutoPtr<TMediatorStep>> &planned, TTransactionContext &txc, /*TKeyBuilder &kb, */THashMap<TTxId,TVector<TTabletId>> &pushToAffected) const { +bool TTxCoordinator::RestoreMediatorInfo(TTabletId mediatorId, TVector<TAutoPtr<TMediatorStep>> &planned, TTransactionContext &txc, /*TKeyBuilder &kb, */THashMap<TTxId,TVector<TTabletId>> &pushToAffected) const { NIceDb::TNiceDb db(txc.DB); pushToAffected.clear(); planned.clear(); @@ -75,7 +75,7 @@ bool TTxCoordinator::RestoreMediatorInfo(TTabletId mediatorId, TVector<TAutoPtr< return false; // Later we will need this to be sorted by stepId - TMap<TStepId, TAutoPtr<TMediatorStep>> mediatorSteps; + TMap<TStepId, TAutoPtr<TMediatorStep>> mediatorSteps; while (!rowset.EndOfSet()) { const TTxId txId = rowset.GetValue<Schema::AffectedSet::TransactionID>(); diff --git a/ydb/core/tx/coordinator/coordinator__restore_transaction.cpp b/ydb/core/tx/coordinator/coordinator__restore_transaction.cpp index 26a916bdff9..b30c31f3d89 100644 --- a/ydb/core/tx/coordinator/coordinator__restore_transaction.cpp +++ b/ydb/core/tx/coordinator/coordinator__restore_transaction.cpp @@ -26,7 +26,7 @@ struct TTxCoordinator::TTxRestoreTransactions : public TTransactionBase<TTxCoord TTxId txId = rowset.GetValue<Schema::Transaction::ID>(); TTransaction& transaction = transactions[txId]; transaction.PlanOnStep = rowset.GetValue<Schema::Transaction::Plan>(); - TVector<TTabletId> affectedSet = rowset.GetValue<Schema::Transaction::AffectedSet>(); + TVector<TTabletId> affectedSet = rowset.GetValue<Schema::Transaction::AffectedSet>(); transaction.AffectedSet.reserve(affectedSet.size()); for (TTabletId id : affectedSet) transaction.AffectedSet.insert(id); @@ -61,8 +61,8 @@ struct TTxCoordinator::TTxRestoreTransactions : public TTransactionBase<TTxCoord if (errors > 0) { // DB is corrupt. Make a dump and stop const NScheme::TTypeRegistry& tr = *AppData(ctx)->TypeRegistry; - TString dbDumpFile = Sprintf("/tmp/coordinator_db_dump_%" PRIu64 ".%" PRIi32, Self->TabletID(), getpid()); - TFixedBufferFileOutput out(dbDumpFile); + TString dbDumpFile = Sprintf("/tmp/coordinator_db_dump_%" PRIu64 ".%" PRIi32, Self->TabletID(), getpid()); + TFixedBufferFileOutput out(dbDumpFile); txc.DB.DebugDump(out, tr); out.Finish(); Cerr << "Coordinator DB dumped to " << dbDumpFile; diff --git a/ydb/core/tx/coordinator/coordinator_impl.cpp b/ydb/core/tx/coordinator/coordinator_impl.cpp index b4eeb184e29..c0900c9f68d 100644 --- a/ydb/core/tx/coordinator/coordinator_impl.cpp +++ b/ydb/core/tx/coordinator/coordinator_impl.cpp @@ -119,21 +119,21 @@ void TTxCoordinator::PlanTx(TAutoPtr<TTransactionProposal> &proposal, const TAct proposal->TxId, planStep, ctx, TabletID()); if (forRapidExecution) { - TQueueType::TSlot &rapidSlot = VolatileState.Queue.RapidSlot; + TQueueType::TSlot &rapidSlot = VolatileState.Queue.RapidSlot; rapidSlot.Queue->Push(proposal.Release()); ++rapidSlot.QueueSize; if (rapidSlot.QueueSize >= Config.RapidSlotFlushSize && !VolatileState.Queue.RapidFreeze) { - TVector<TQueueType::TSlot> slots; + TVector<TQueueType::TSlot> slots; slots.push_back(rapidSlot); - rapidSlot = TQueueType::TSlot(); + rapidSlot = TQueueType::TSlot(); VolatileState.LastPlanned = planStep; VolatileState.Queue.RapidFreeze = true; Execute(CreateTxPlanStep(planStep, slots, true), ctx); } } else { - TQueueType::TSlot &planSlot = VolatileState.Queue.LowSlot(planStep); + TQueueType::TSlot &planSlot = VolatileState.Queue.LowSlot(planStep); planSlot.Queue->Push(proposal.Release()); ++planSlot.QueueSize; } @@ -161,7 +161,7 @@ void TTxCoordinator::HandleEnqueue(TEvTxProxy::TEvProposeTransaction::TPtr &ev, } if (!VolatileState.Queue.Unsorted) - VolatileState.Queue.Unsorted.Reset(new TQueueType::TQ()); + VolatileState.Queue.Unsorted.Reset(new TQueueType::TQ()); VolatileState.Queue.Unsorted->Push(proposal.Release()); } @@ -186,12 +186,12 @@ void TTxCoordinator::Handle(TEvPrivate::TEvPlanTick::TPtr &ev, const TActorConte return SchedulePlanTick(ctx); } - TVector<TQueueType::TSlot> slots; + TVector<TQueueType::TSlot> slots; slots.reserve(1000); if (VolatileState.Queue.RapidSlot.QueueSize) { slots.push_back(VolatileState.Queue.RapidSlot); - VolatileState.Queue.RapidSlot = TQueueType::TSlot(); + VolatileState.Queue.RapidSlot = TQueueType::TSlot(); } while (!VolatileState.Queue.Low.empty()) { @@ -280,7 +280,7 @@ void TTxCoordinator::DoConfiguration(const TEvSubDomain::TEvConfigure &ev, const return; } - TVector<TTabletId> mediators; + TVector<TTabletId> mediators; mediators.reserve(record.MediatorsSize()); for (auto id: record.GetMediators()) { diff --git a/ydb/core/tx/coordinator/coordinator_impl.h b/ydb/core/tx/coordinator/coordinator_impl.h index 39018aff1e7..de03c9aa58f 100644 --- a/ydb/core/tx/coordinator/coordinator_impl.h +++ b/ydb/core/tx/coordinator/coordinator_impl.h @@ -49,7 +49,7 @@ struct TTransactionProposal { // reserved }; - TVector<TAffectedEntry> AffectedSet; + TVector<TAffectedEntry> AffectedSet; TInstant AcceptMoment; bool IgnoreLowDiskSpace; @@ -94,7 +94,7 @@ struct TMediatorStep { TTxId TxId; // todo: move to flat presentation (with buffer for all affected, instead of per-one) - TVector<TTabletId> PushToAffected; // filtered one (only entries which belong to this mediator) + TVector<TTabletId> PushToAffected; // filtered one (only entries which belong to this mediator) ui64 Moderator; @@ -116,7 +116,7 @@ struct TMediatorStep { const TTabletId MediatorId; const TStepId Step; bool Confirmed; - TVector<TTx> Transactions; + TVector<TTx> Transactions; TMediatorStep(TTabletId mediatorId, TStepId step) : MediatorId(mediatorId) @@ -128,7 +128,7 @@ struct TMediatorStep { struct TMediatorConfirmations { const TTabletId MediatorId; - THashMap<TTxId, THashSet<TTabletId>> Acks; + THashMap<TTxId, THashSet<TTabletId>> Acks; TMediatorConfirmations(TTabletId mediatorId) : MediatorId(mediatorId) @@ -153,7 +153,7 @@ do { \ if (mSettings && mSettings->Satisfies(mPriority, mComponent, sampleBy)) { \ TStringBuilder logStringBuilder; \ logStringBuilder << stream; \ - Self->DebugLog << (TString)logStringBuilder << Endl; \ + Self->DebugLog << (TString)logStringBuilder << Endl; \ } \ } while(0) \ /**/ @@ -182,7 +182,7 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat struct TEvAcquireReadStepFlush : public TEventLocal<TEvAcquireReadStepFlush, EvAcquireReadStepFlush> {}; }; - struct TQueueType { + struct TQueueType { typedef TOneOneQueueInplace<TTransactionProposal *, 512> TQ; struct TFlowEntry { @@ -205,7 +205,7 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat {} }; - typedef TMap<TStepId, TSlot> TSlotQueue; + typedef TMap<TStepId, TSlot> TSlotQueue; TSlotQueue Low; TSlot RapidSlot; // slot for entries with schedule on 'right now' moment (actually - with min-schedule time in past). @@ -214,15 +214,15 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat TAutoPtr<TQ, TQ::TPtrCleanDestructor> Unsorted; TSlot& LowSlot(TStepId step) { - TMap<TStepId, TSlot>::iterator it = Low.find(step); + TMap<TStepId, TSlot>::iterator it = Low.find(step); if (it != Low.end()) return it->second; - std::pair<TMap<TStepId, TSlot>::iterator, bool> xit = Low.insert(TSlotQueue::value_type(step, TSlot())); + std::pair<TMap<TStepId, TSlot>::iterator, bool> xit = Low.insert(TSlotQueue::value_type(step, TSlot())); TSlot &ret = xit.first->second; return ret; } - TQueueType() + TQueueType() : RapidFreeze(false) {} }; @@ -291,8 +291,8 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat struct TTransaction { TStepId PlanOnStep; - THashSet<TTabletId> AffectedSet; - THashMap<TTabletId, THashSet<TTabletId>> UnconfirmedAffectedSet; + THashSet<TTabletId> AffectedSet; + THashMap<TTabletId, THashSet<TTabletId>> UnconfirmedAffectedSet; TTransaction() : PlanOnStep(0) @@ -316,7 +316,7 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat ui64 LastEmptyStep = 0; TMonotonic LastEmptyPlanAt{ }; - TQueueType Queue; + TQueueType Queue; ui64 AcquireReadStepInFlight = 0; TMonotonic AcquireReadStepLast{ }; @@ -333,7 +333,7 @@ public: struct Transaction : Table<0> { struct ID : Column<0, NScheme::NTypeIds::Uint64> {}; // PK struct Plan : Column<1, NScheme::NTypeIds::Uint64> {}; - struct AffectedSet : Column<2, NScheme::NTypeIds::String> { using Type = TVector<TTabletId>; }; + struct AffectedSet : Column<2, NScheme::NTypeIds::String> { using Type = TVector<TTabletId>; }; using TKey = TableKey<ID>; using TColumns = TableColumns<ID, Plan, AffectedSet>; @@ -364,7 +364,7 @@ public: struct DomainConfiguration : Table<5> { struct Version : Column<1, NScheme::NTypeIds::Uint64> {}; - struct Mediators : Column<2, NScheme::NTypeIds::String> { using Type = TVector<TTabletId>; }; + struct Mediators : Column<2, NScheme::NTypeIds::String> { using Type = TVector<TTabletId>; }; struct Resolution : Column<3, NScheme::NTypeIds::Uint64> {}; struct Config : Column<4, NScheme::NTypeIds::String> {}; @@ -410,18 +410,18 @@ private: TTabletCountersBase* TabletCounters; TAutoPtr<TTabletCountersBase> TabletCountersPtr; - typedef THashMap<TTabletId, TMediator> TMediatorsIndex; + typedef THashMap<TTabletId, TMediator> TMediatorsIndex; TMediatorsIndex Mediators; - typedef THashMap<TTxId, TTransaction> TTransactions; + typedef THashMap<TTxId, TTransaction> TTransactions; TTransactions Transactions; bool Stopping = false; #ifdef COORDINATOR_LOG_TO_FILE // HACK - TString DebugName; - TFixedBufferFileOutput DebugLogFile; + TString DebugName; + TFixedBufferFileOutput DebugLogFile; TZLibCompress DebugLog; #endif @@ -485,7 +485,7 @@ private: void PlanTx(TAutoPtr<TTransactionProposal> &proposal, const TActorContext &ctx); void SchedulePlanTick(const TActorContext &ctx); - bool RestoreMediatorInfo(TTabletId mediatorId, TVector<TAutoPtr<TMediatorStep>> &planned, TTransactionContext &txc, /*TKeyBuilder &kb, */THashMap<TTxId,TVector<TTabletId>> &pushToAffected) const; + bool RestoreMediatorInfo(TTabletId mediatorId, TVector<TAutoPtr<TMediatorStep>> &planned, TTransactionContext &txc, /*TKeyBuilder &kb, */THashMap<TTxId,TVector<TTabletId>> &pushToAffected) const; void TryInitMonCounters(const TActorContext &ctx); bool OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev, const TActorContext &ctx) override; diff --git a/ydb/core/tx/datashard/datashard.h b/ydb/core/tx/datashard/datashard.h index 5a93c035026..e418db41105 100644 --- a/ydb/core/tx/datashard/datashard.h +++ b/ydb/core/tx/datashard/datashard.h @@ -666,7 +666,7 @@ struct TEvDataShard { struct TEvReturnBorrowedPart : public TEventPB<TEvReturnBorrowedPart, NKikimrTxDataShard::TEvReturnBorrowedPart, TEvDataShard::EvReturnBorrowedPart> { TEvReturnBorrowedPart() = default; - TEvReturnBorrowedPart(ui64 tabletId, const TVector<TLogoBlobID>& partMetaVec) { + TEvReturnBorrowedPart(ui64 tabletId, const TVector<TLogoBlobID>& partMetaVec) { Record.SetFromTabletId(tabletId); for (const auto& partMeta : partMetaVec) { LogoBlobIDFromLogoBlobID(partMeta, Record.AddPartMetadata()); @@ -676,7 +676,7 @@ struct TEvDataShard { struct TEvReturnBorrowedPartAck : public TEventPB<TEvReturnBorrowedPartAck, NKikimrTxDataShard::TEvReturnBorrowedPartAck, TEvDataShard::EvReturnBorrowedPartAck> { TEvReturnBorrowedPartAck() = default; - explicit TEvReturnBorrowedPartAck(const TVector<TLogoBlobID>& partMetaVec) { + explicit TEvReturnBorrowedPartAck(const TVector<TLogoBlobID>& partMetaVec) { for (const auto& partMeta : partMetaVec) { LogoBlobIDFromLogoBlobID(partMeta, Record.AddPartMetadata()); } diff --git a/ydb/core/tx/datashard/datashard__engine_host.cpp b/ydb/core/tx/datashard/datashard__engine_host.cpp index 876c3370933..fef84e74b40 100644 --- a/ydb/core/tx/datashard/datashard__engine_host.cpp +++ b/ydb/core/tx/datashard/datashard__engine_host.cpp @@ -61,7 +61,7 @@ struct TRowResultInfo { TStructType* RowType; TSmallVec<ItemInfo> ItemInfos; - TRowResultInfo(const TStructLiteral* columnIds, const THashMap<ui32, TSysTables::TTableColumnInfo>& columns, + TRowResultInfo(const TStructLiteral* columnIds, const THashMap<ui32, TSysTables::TTableColumnInfo>& columns, TOptionalType* returnType) { ResultType = AS_TYPE(TOptionalType, returnType); @@ -79,7 +79,7 @@ struct TRowResultInfo { } } - NUdf::TUnboxedValue CreateResult(TVector<TCell>&& inRow, const THolderFactory& holderFactory) const { + NUdf::TUnboxedValue CreateResult(TVector<TCell>&& inRow, const THolderFactory& holderFactory) const { if (inRow.empty()) { return NUdf::TUnboxedValuePod(); } @@ -106,16 +106,16 @@ struct TRangeResultInfo { TSmallVec<ItemInfo> ItemInfos; mutable ui64 Bytes = 0; TDefaultListRepresentation Rows; - TString FirstKey; + TString FirstKey; // optimisation: reuse vectors - TVector<TCell> TmpRow; - TVector<NScheme::TTypeId> TmpTypes; + TVector<TCell> TmpRow; + TVector<NScheme::TTypeId> TmpTypes; TListType* RowsListType() const { return AS_TYPE(TListType, ResultType->GetMemberType(0)); } TDataType* TruncType() const { return AS_TYPE(TDataType, ResultType->GetMemberType(1)); } - TRangeResultInfo(const TStructLiteral* columnIds, const THashMap<ui32, TSysTables::TTableColumnInfo>& columns, + TRangeResultInfo(const TStructLiteral* columnIds, const THashMap<ui32, TSysTables::TTableColumnInfo>& columns, TStructType* returnType) { ResultType = AS_TYPE(TStructType, returnType); @@ -137,18 +137,18 @@ struct TRangeResultInfo { } } - static TString Serialize(const TVector<TCell>& row, const TVector<NScheme::TTypeId>& types) { + static TString Serialize(const TVector<TCell>& row, const TVector<NScheme::TTypeId>& types) { Y_VERIFY(row.size() == types.size()); ui32 count = row.size(); - TString str((const char*)&count, sizeof(ui32)); + TString str((const char*)&count, sizeof(ui32)); str.append((const char*)&types[0], count * sizeof(NScheme::TTypeId)); TConstArrayRef<TCell> array(&row[0], row.size()); return str + TSerializedCellVec::Serialize(array); } - void AppendRow(const TVector<TCell>& inRow, const THolderFactory& holderFactory) { + void AppendRow(const TVector<TCell>& inRow, const THolderFactory& holderFactory) { if (inRow.empty()) return; @@ -248,8 +248,8 @@ public: private: const TTableId TableId; TDataShard* Self; - THashMap<ui32, TSysTables::TTableColumnInfo> Columns; - TVector<ui32> KeyTypes; + THashMap<ui32, TSysTables::TTableColumnInfo> Columns; + TVector<ui32> KeyTypes; }; @@ -611,7 +611,7 @@ TEngineBay::TSizes TEngineBay::CalcSizes(bool needsTotalKeysSize) const { Y_VERIFY(EngineHost); TSizes outSizes; - TVector<const TKeyDesc*> readKeys; + TVector<const TKeyDesc*> readKeys; readKeys.reserve(Info.ReadsCount); for (const TValidatedKey& validKey : Info.Keys) { if (validKey.IsWrite) diff --git a/ydb/core/tx/datashard/datashard__engine_host.h b/ydb/core/tx/datashard/datashard__engine_host.h index 8e3064c83d8..c63f35f9d43 100644 --- a/ydb/core/tx/datashard/datashard__engine_host.h +++ b/ydb/core/tx/datashard/datashard__engine_host.h @@ -33,7 +33,7 @@ public: struct TSizes { ui64 ReadSize = 0; ui64 ReplySize = 0; - THashMap<ui64, ui64> OutReadSetSize; + THashMap<ui64, ui64> OutReadSetSize; ui64 TotalKeysSize = 0; }; diff --git a/ydb/core/tx/datashard/datashard__init.cpp b/ydb/core/tx/datashard/datashard__init.cpp index dc12c49959b..810ed9a5bea 100644 --- a/ydb/core/tx/datashard/datashard__init.cpp +++ b/ydb/core/tx/datashard/datashard__init.cpp @@ -217,7 +217,7 @@ bool TDataShard::TTxInit::ReadEverything(TTransactionContext &txc) { ui64 tableId = rowset.GetValue<Schema::UserTables::Tid>(); ui32 localTid = rowset.GetValue<Schema::UserTables::LocalTid>(); ui32 shadowTid = rowset.GetValueOrDefault<Schema::UserTables::ShadowTid>(); - TString schema = rowset.GetValue<Schema::UserTables::Schema>(); + TString schema = rowset.GetValue<Schema::UserTables::Schema>(); NKikimrSchemeOp::TTableDescription descr; bool parseOk = ParseFromStringNoSizeLimit(descr, schema); Y_VERIFY(parseOk); @@ -253,7 +253,7 @@ bool TDataShard::TTxInit::ReadEverything(TTransactionContext &txc) { while (!rowset.EndOfSet()) { ui64 dstTablet = rowset.GetValue<Schema::SplitSrcSnapshots::DstTabletId>(); - TString snapBody = rowset.GetValue<Schema::SplitSrcSnapshots::SnapshotMeta>(); + TString snapBody = rowset.GetValue<Schema::SplitSrcSnapshots::SnapshotMeta>(); TAutoPtr<NKikimrTxDataShard::TEvSplitTransferSnapshot> snapshot = new NKikimrTxDataShard::TEvSplitTransferSnapshot; bool parseOk = ParseFromStringNoSizeLimit(*snapshot, snapBody); @@ -285,7 +285,7 @@ bool TDataShard::TTxInit::ReadEverything(TTransactionContext &txc) { // Split/Merge description on DST LOAD_SYS_UI64(db, Schema::Sys_DstSplitOpId, Self->DstSplitOpId); { - TString splitDescr; + TString splitDescr; LOAD_SYS_BYTES(db, Schema::Sys_DstSplitDescription, splitDescr); if (!splitDescr.empty()) { Self->DstSplitDescription = std::make_shared<NKikimrTxDataShard::TSplitMergeDescription>(); @@ -339,7 +339,7 @@ bool TDataShard::TTxInit::ReadEverything(TTransactionContext &txc) { // Split/Merge description on SRC LOAD_SYS_UI64(db, Schema::Sys_SrcSplitOpId, Self->SrcSplitOpId); { - TString splitDescr; + TString splitDescr; LOAD_SYS_BYTES(db, Schema::Sys_SrcSplitDescription, splitDescr); if (!splitDescr.empty()) { Self->SrcSplitDescription = std::make_shared<NKikimrTxDataShard::TSplitMergeDescription>(); diff --git a/ydb/core/tx/datashard/datashard__plan_step.cpp b/ydb/core/tx/datashard/datashard__plan_step.cpp index 6399598865a..657980b9e3b 100644 --- a/ydb/core/tx/datashard/datashard__plan_step.cpp +++ b/ydb/core/tx/datashard/datashard__plan_step.cpp @@ -28,7 +28,7 @@ bool TDataShard::TTxPlanStep::Execute(TTransactionContext &txc, const TActorCont const ui64 step = Ev->Get()->Record.GetStep(); Self->LastKnownMediator = Ev->Get()->Record.GetMediatorID(); - TVector<ui64> txIds; + TVector<ui64> txIds; txIds.reserve(Ev->Get()->Record.TransactionsSize()); for (const auto& tx : Ev->Get()->Record.GetTransactions()) { Y_VERIFY(tx.HasTxId()); diff --git a/ydb/core/tx/datashard/datashard__s3.cpp b/ydb/core/tx/datashard/datashard__s3.cpp index 2f7a74bbab6..578eaadaeca 100644 --- a/ydb/core/tx/datashard/datashard__s3.cpp +++ b/ydb/core/tx/datashard/datashard__s3.cpp @@ -60,7 +60,7 @@ public: const ui32 localTableId = tableInfo.LocalTid; - TVector<TRawTypeValue> key; + TVector<TRawTypeValue> key; TVector<TRawTypeValue> endKey; // TODO: check prefix column count against key column count diff --git a/ydb/core/tx/datashard/datashard_impl.h b/ydb/core/tx/datashard/datashard_impl.h index 11313474f80..f849cad6797 100644 --- a/ydb/core/tx/datashard/datashard_impl.h +++ b/ydb/core/tx/datashard/datashard_impl.h @@ -73,7 +73,7 @@ public: private: TStepOrder StepOrder; - TVector<ui32> Tables; + TVector<ui32> Tables; }; // For Split @@ -100,7 +100,7 @@ public: TRowVersion LowWatermark; private: - TVector<ui32> Tables; + TVector<ui32> Tables; }; // Base class for non-Transactional scans of DataShard data @@ -854,7 +854,7 @@ class TDataShard return true; } - inline static bool SysGetBytes(NIceDb::TNiceDb& db, ui64 row, TString& value) { + inline static bool SysGetBytes(NIceDb::TNiceDb& db, ui64 row, TString& value) { auto rowset = db.Table<Schema::Sys>().Key(row).Select<Schema::Sys::Bytes>(); if (!rowset.IsReady()) return false; @@ -1073,11 +1073,11 @@ public: const TActorContext& ctx); THolder<TEvTxProcessing::TEvReadSet> PrepareReadSet(ui64 step, ui64 txId, ui64 source, ui64 target, const TString& body, ui64 seqno); - void SendReadSet(const TActorContext& ctx, ui64 step, ui64 txId, ui64 source, ui64 target, const TString& body, ui64 seqno); + void SendReadSet(const TActorContext& ctx, ui64 step, ui64 txId, ui64 source, ui64 target, const TString& body, ui64 seqno); void SendReadSets(const TActorContext& ctx, TVector<THolder<TEvTxProcessing::TEvReadSet>> &&readsets); void ResendReadSet(const TActorContext& ctx, ui64 step, ui64 txId, ui64 source, ui64 target, const TString& body, ui64 seqno); - void SendDelayedAcks(const TActorContext& ctx, TVector<THolder<IEventHandle>>& delayedAcks) const; + void SendDelayedAcks(const TActorContext& ctx, TVector<THolder<IEventHandle>>& delayedAcks) const; void SendResult(const TActorContext &ctx, TOutputOpData::TResultPtr &result, const TActorId &target, @@ -1162,8 +1162,8 @@ public: TSysLocks& SysLocksTable() { return SysLocks; } - static const TString& GetUserTablePrefix() { - static TString prefix = Schema::UserTablePrefix; + static const TString& GetUserTablePrefix() { + static TString prefix = Schema::UserTablePrefix; return prefix; } @@ -1448,14 +1448,14 @@ private: class TLoanReturnTracker { struct TLoanReturnInfo { TActorId PipeToOwner; - THashSet<TLogoBlobID> PartMeta; + THashSet<TLogoBlobID> PartMeta; }; ui64 MyTabletID; // TabletID -> non-acked loans - THashMap<ui64, TLoanReturnInfo> LoanReturns; + THashMap<ui64, TLoanReturnInfo> LoanReturns; // part -> owner - THashMap<TLogoBlobID, ui64> LoanOwners; + THashMap<TLogoBlobID, ui64> LoanOwners; NTabletPipe::TClientRetryPolicy PipeRetryPolicy; public: @@ -1478,7 +1478,7 @@ private: LoanReturns.clear(); } - void ReturnLoan(ui64 ownerTabletId, const TVector<TLogoBlobID>& partMetaVec, const TActorContext& ctx) { + void ReturnLoan(ui64 ownerTabletId, const TVector<TLogoBlobID>& partMetaVec, const TActorContext& ctx) { TLoanReturnInfo& info = LoanReturns[ownerTabletId]; TVector<TLogoBlobID> partsToReturn(Reserve(partMetaVec.size())); @@ -1514,7 +1514,7 @@ private: if (!LoanReturns.contains(ownerTabletId)) return; - THashSet<TLogoBlobID> toResend; + THashSet<TLogoBlobID> toResend; toResend.swap(LoanReturns[ownerTabletId].PartMeta); LoanReturns.erase(ownerTabletId); @@ -1565,7 +1565,7 @@ private: Dst.insert(dstTabeltId); } - const THashSet<ui64>& GetDstSet() const { + const THashSet<ui64>& GetDstSet() const { return Dst; } @@ -1636,8 +1636,8 @@ private: private: TDataShard* Self; - THashSet<ui64> Dst; - THashMap<ui64, TAutoPtr<NKikimrTxDataShard::TEvSplitTransferSnapshot>> DataToSend; + THashSet<ui64> Dst; + THashMap<ui64, TAutoPtr<NKikimrTxDataShard::TEvSplitTransferSnapshot>> DataToSend; THashMap<ui64, TActorId> PipesToDstShards; }; @@ -1920,7 +1920,7 @@ private: bool SplitSnapshotStarted; // Non-persistent flag that is used to restart snapshot in case of datashard restart TSplitSrcSnapshotSender SplitSrcSnapshotSender; // TODO: make this persitent - THashSet<ui64> ReceiveSnapshotsFrom; + THashSet<ui64> ReceiveSnapshotsFrom; ui64 DstSplitOpId; ui64 SrcSplitOpId; bool DstSplitSchemaInitialized = false; diff --git a/ydb/core/tx/datashard/datashard_loans.cpp b/ydb/core/tx/datashard/datashard_loans.cpp index adbfc4769db..f8f0339d017 100644 --- a/ydb/core/tx/datashard/datashard_loans.cpp +++ b/ydb/core/tx/datashard/datashard_loans.cpp @@ -10,7 +10,7 @@ namespace NDataShard { // Find and return parts that are no longer needed on the target datashard class TDataShard::TTxInitiateBorrowedPartsReturn : public NTabletFlatExecutor::TTransactionBase<TDataShard> { private: - THashMap<TLogoBlobID, NTabletFlatExecutor::TCompactedPartLoans> PartsToReturn; + THashMap<TLogoBlobID, NTabletFlatExecutor::TCompactedPartLoans> PartsToReturn; public: TTxInitiateBorrowedPartsReturn(TDataShard* ds) @@ -29,7 +29,7 @@ public: void Complete(const TActorContext &ctx) override { // group parts by owner tablet - THashMap<ui64, TVector<TLogoBlobID>> perTabletParts; + THashMap<ui64, TVector<TLogoBlobID>> perTabletParts; for (const auto& p : PartsToReturn) { ui64 ownerTabletId = p.second.Lender; TLogoBlobID partMeta = p.second.MetaInfoId; @@ -59,7 +59,7 @@ void TDataShard::CompletedLoansChanged(const TActorContext &ctx) { class TDataShard::TTxReturnBorrowedPart : public NTabletFlatExecutor::TTransactionBase<TDataShard> { private: TEvDataShard::TEvReturnBorrowedPart::TPtr Ev; - TVector<TLogoBlobID> PartMetaVec; + TVector<TLogoBlobID> PartMetaVec; ui64 FromTabletId; public: TTxReturnBorrowedPart(TDataShard* ds, TEvDataShard::TEvReturnBorrowedPart::TPtr& ev) @@ -98,7 +98,7 @@ public: class TDataShard::TTxReturnBorrowedPartAck : public NTabletFlatExecutor::TTransactionBase<TDataShard> { private: TEvDataShard::TEvReturnBorrowedPartAck::TPtr Ev; - TVector<TLogoBlobID> PartMetaVec; + TVector<TLogoBlobID> PartMetaVec; public: TTxReturnBorrowedPartAck(TDataShard* ds, TEvDataShard::TEvReturnBorrowedPartAck::TPtr& ev) diff --git a/ydb/core/tx/datashard/datashard_locks.h b/ydb/core/tx/datashard/datashard_locks.h index 19c68c4d88d..11d386e6d27 100644 --- a/ydb/core/tx/datashard/datashard_locks.h +++ b/ydb/core/tx/datashard/datashard_locks.h @@ -177,7 +177,7 @@ private: TInstant CreationTime; THashSet<TPathId> AffectedTables; TVector<TPointKey> Points; - TVector<TRangeKey> Ranges; + TVector<TRangeKey> Ranges; bool ShardLock = false; std::optional<TRowVersion> BreakVersion; @@ -228,7 +228,7 @@ public: private: const TPathId TableId; - TVector<NScheme::TTypeId> KeyColumnTypes; + TVector<NScheme::TTypeId> KeyColumnTypes; TRangeTreap<TLockInfo*> Ranges; }; @@ -330,10 +330,10 @@ public: private: THolder<TLocksDataShard> Self; - THashMap<ui64, TLockInfo::TPtr> Locks; // key is LockId + THashMap<ui64, TLockInfo::TPtr> Locks; // key is LockId THashMap<TPathId, TTableLocks::TPtr> Tables; - THashSet<ui64> ShardLocks; - TVector<ui64> BrokenLocks; // LockIds of broken locks (optimisation) + THashSet<ui64> ShardLocks; + TVector<ui64> BrokenLocks; // LockIds of broken locks (optimisation) TVector<ui64> CleanupPending; // LockIds of broken locks with pending cleanup TPriorityQueue<TVersionedLockId> BrokenCandidates; TPriorityQueue<TVersionedLockId> CleanupCandidates; @@ -356,11 +356,11 @@ private: /// A portion of locks update struct TLocksUpdate { ui64 LockTxId = 0; - TVector<TPointKey> PointLocks; - TVector<TRangeKey> RangeLocks; - TVector<TPointKey> PointBreaks; + TVector<TPointKey> PointLocks; + TVector<TRangeKey> RangeLocks; + TVector<TPointKey> PointBreaks; THashSet<TPathId> AllBreaks; - TVector<ui64> Erases; + TVector<ui64> Erases; bool ShardLock = false; bool ShardBreak = false; THashSet<TPathId> AffectedTables; diff --git a/ydb/core/tx/datashard/datashard_outreadset.cpp b/ydb/core/tx/datashard/datashard_outreadset.cpp index 36ded0e8972..089b7b71e5e 100644 --- a/ydb/core/tx/datashard/datashard_outreadset.cpp +++ b/ydb/core/tx/datashard/datashard_outreadset.cpp @@ -171,7 +171,7 @@ bool TOutReadSets::ResendRS(NTabletFlatExecutor::TTransactionContext &txc, const ui64 txId = rowset.GetValue<Schema::OutReadSets::TxId>(); ui64 from = rowset.GetValue<Schema::OutReadSets::From>(); ui64 to = rowset.GetValue<Schema::OutReadSets::To>(); - TString body = rowset.GetValue<Schema::OutReadSets::Body>(); + TString body = rowset.GetValue<Schema::OutReadSets::Body>(); txc.DB.NoMoreReadsForTx(); diff --git a/ydb/core/tx/datashard/datashard_outreadset.h b/ydb/core/tx/datashard/datashard_outreadset.h index 901fd4d827a..86f76d66e55 100644 --- a/ydb/core/tx/datashard/datashard_outreadset.h +++ b/ydb/core/tx/datashard/datashard_outreadset.h @@ -75,8 +75,8 @@ private: TDataShard * Self; THashMap<ui64, TReadSetKey> CurrentReadSets; // SeqNo -> Info THashMap<TReadSetKey, ui64> CurrentReadSetInfos; // Info -> SeqNo - THashSet<ui64> AckedSeqno; - TVector<TIntrusivePtr<TEvTxProcessing::TEvReadSetAck>> ReadSetAcks; + THashSet<ui64> AckedSeqno; + TVector<TIntrusivePtr<TEvTxProcessing::TEvReadSetAck>> ReadSetAcks; }; }} diff --git a/ydb/core/tx/datashard/datashard_pipeline.cpp b/ydb/core/tx/datashard/datashard_pipeline.cpp index 3498162c17e..d544a29aad4 100644 --- a/ydb/core/tx/datashard/datashard_pipeline.cpp +++ b/ydb/core/tx/datashard/datashard_pipeline.cpp @@ -1024,7 +1024,7 @@ bool TPipeline::CancelPropose(NIceDb::TNiceDb& db, const TActorContext& ctx, ui6 ECleanupStatus TPipeline::CleanupOutdated(NIceDb::TNiceDb& db, const TActorContext& ctx, ui64 outdatedStep) { const ui32 OUTDATED_BATCH_SIZE = 100; - TVector<ui64> outdatedTxs; + TVector<ui64> outdatedTxs; auto status = Self->TransQueue.CleanupOutdated(db, outdatedStep, OUTDATED_BATCH_SIZE, outdatedTxs); switch (status) { case ECleanupStatus::None: diff --git a/ydb/core/tx/datashard/datashard_pipeline.h b/ydb/core/tx/datashard/datashard_pipeline.h index 67c35260b28..9a12146afcd 100644 --- a/ydb/core/tx/datashard/datashard_pipeline.h +++ b/ydb/core/tx/datashard/datashard_pipeline.h @@ -430,7 +430,7 @@ private: TSortedOps ActivePlannedOps; TSortedOps::iterator ActivePlannedOpsLogicallyCompleteEnd; TSortedOps::iterator ActivePlannedOpsLogicallyIncompleteEnd; - THashMap<ui64, TValidatedDataTx::TPtr> DataTxCache; + THashMap<ui64, TValidatedDataTx::TPtr> DataTxCache; TMap<TStepOrder, THolder<IEventHandle>> DelayedAcks; TStepOrder LastPlannedTx; TStepOrder LastCompleteTx; diff --git a/ydb/core/tx/datashard/datashard_split_dst.cpp b/ydb/core/tx/datashard/datashard_split_dst.cpp index 65750810013..ca97d6a5a7d 100644 --- a/ydb/core/tx/datashard/datashard_split_dst.cpp +++ b/ydb/core/tx/datashard/datashard_split_dst.cpp @@ -61,7 +61,7 @@ public: } // Persist split description - TString splitDescr; + TString splitDescr; bool serilaizeOk = Self->DstSplitDescription->SerializeToString(&splitDescr); Y_VERIFY(serilaizeOk, "Failed to serialize split/merge description"); Self->PersistSys(db, Schema::Sys_DstSplitDescription, splitDescr); @@ -133,7 +133,7 @@ public: NKikimrSchemeOp::TTableDescription newTableScheme(tableScheme); // Get this shard's range boundaries from the split/merge description - TString rangeBegin, rangeEnd; + TString rangeBegin, rangeEnd; for (ui32 di = 0; di < Self->DstSplitDescription->DestinationRangesSize(); ++di) { const auto& dstRange = Self->DstSplitDescription->GetDestinationRanges(di); if (dstRange.GetTabletID() != Self->TabletID()) diff --git a/ydb/core/tx/datashard/datashard_split_src.cpp b/ydb/core/tx/datashard/datashard_split_src.cpp index a7349fc9cf3..5217a805761 100644 --- a/ydb/core/tx/datashard/datashard_split_src.cpp +++ b/ydb/core/tx/datashard/datashard_split_src.cpp @@ -34,7 +34,7 @@ public: Self->SrcSplitDescription = std::make_shared<NKikimrTxDataShard::TSplitMergeDescription>(Ev->Get()->Record.GetSplitDescription()); // Persist split description - TString splitDescr; + TString splitDescr; bool serilaizeOk = Self->SrcSplitDescription->SerializeToString(&splitDescr); Y_VERIFY(serilaizeOk, "Failed to serialize split/merge description"); db.Table<Schema::Sys>().Key(Schema::Sys_SrcSplitDescription).Update(NIceDb::TUpdate<Schema::Sys::Bytes>(splitDescr)); @@ -254,14 +254,14 @@ public: tableInfo.GetSchema(*snapshot->MutableUserTableScheme()); for (ui32 localTableId : SnapContext->TablesToSnapshot()) { - TString snapBody; + TString snapBody; if (localTableId > Schema::MinLocalTid) { // Extract dst range from split/merge description to pass it to BorrowSnapshot TSerializedCellVec fromCells(dstRangeDescr.GetKeyRangeBegin()); TSerializedCellVec toCells(dstRangeDescr.GetKeyRangeEnd()); auto cellsToRawValues = [&tableInfo] (const TSerializedCellVec& cells) { - TVector<TRawTypeValue> rawVals; + TVector<TRawTypeValue> rawVals; ui32 ki = 0; for (; ki < cells.GetCells().size(); ++ki) { rawVals.push_back( diff --git a/ydb/core/tx/datashard/datashard_trans_queue.cpp b/ydb/core/tx/datashard/datashard_trans_queue.cpp index d7096c25b32..e9ebad70f99 100644 --- a/ydb/core/tx/datashard/datashard_trans_queue.cpp +++ b/ydb/core/tx/datashard/datashard_trans_queue.cpp @@ -46,7 +46,7 @@ bool TTransQueue::Load(NIceDb::TNiceDb& db) { TInstant now = AppData()->TimeProvider->Now(); - THashSet<ui64> schemaTxs; + THashSet<ui64> schemaTxs; { auto rowset = db.Table<Schema::TxMain>().Range().Select(); if (!rowset.IsReady()) diff --git a/ydb/core/tx/datashard/datashard_user_table.h b/ydb/core/tx/datashard/datashard_user_table.h index 0dab30cb84f..7890b751efb 100644 --- a/ydb/core/tx/datashard/datashard_user_table.h +++ b/ydb/core/tx/datashard/datashard_user_table.h @@ -232,12 +232,12 @@ struct TUserTable : public TThrRefBase { struct TUserColumn { NScheme::TTypeId Type; - TString Name; + TString Name; bool IsKey; ui32 Family = 0; bool NotNull = false; - TUserColumn(NScheme::TTypeId type, TString name, bool isKey = false) + TUserColumn(NScheme::TTypeId type, TString name, bool isKey = false) : Type(type) , Name(name) , IsKey(isKey) @@ -344,13 +344,13 @@ struct TUserTable : public TThrRefBase { ui32 LocalTid = Max<ui32>(); ui32 ShadowTid = 0; - TString Name; + TString Name; TString Path; TMap<ui32, TStorageRoom::TPtr> Rooms; - TMap<ui32, TUserFamily> Families; - TMap<ui32, TUserColumn> Columns; - TVector<NScheme::TTypeId> KeyColumnTypes; - TVector<ui32> KeyColumnIds; + TMap<ui32, TUserFamily> Families; + TMap<ui32, TUserColumn> Columns; + TVector<NScheme::TTypeId> KeyColumnTypes; + TVector<ui32> KeyColumnIds; TSerializedTableRange Range; bool IsBackup = false; diff --git a/ydb/core/tx/datashard/datashard_ut_common.cpp b/ydb/core/tx/datashard/datashard_ut_common.cpp index d754f7ad0e2..31859b7148c 100644 --- a/ydb/core/tx/datashard/datashard_ut_common.cpp +++ b/ydb/core/tx/datashard/datashard_ut_common.cpp @@ -326,7 +326,7 @@ ui32 TFakeProxyTx::SetProgram(TTester& tester, const TString& programText) { UNIT_ASSERT_EQUAL_C(result, IEngineFlat::EResult::Ok, Engine->GetErrors()); auto& dbKeys = Engine->GetDbKeys(); - TSet<ui64> resolvedShards; + TSet<ui64> resolvedShards; TTester::TKeyResolver keyResolver = tester.GetKeyResolver(); for (auto& dbKey : dbKeys) { keyResolver(*dbKey); @@ -490,7 +490,7 @@ void TFakeMiniKQLProxy::EnqueueScan(const TString& programText, std::function<bo } void TFakeMiniKQLProxy::ExecQueue() { - TMap<ui64, TFakeProxyTx::TPtr> needPlan; + TMap<ui64, TFakeProxyTx::TPtr> needPlan; for (auto& tx : TxQueue) { Propose(*tx, true); UNIT_ASSERT(tx->Immediate() || tx->GetStatus(true) == IEngineFlat::EStatus::Unknown); @@ -515,7 +515,7 @@ IEngineFlat::EStatus TFakeMiniKQLProxy::Execute(const TString& programText, NKikimrMiniKQL::TResult& out, bool waitForResult) { ui32 txId = ++LastTxId_; - TMap<ui64, TFakeProxyTx::TPtr> txs; + TMap<ui64, TFakeProxyTx::TPtr> txs; txs[txId] = std::make_shared<TFakeProxyTx>(txId, programText); TFakeProxyTx& tx = *(txs.begin()->second); @@ -534,7 +534,7 @@ IEngineFlat::EStatus TFakeMiniKQLProxy::Execute(const TString& programText, IEngineFlat::EStatus TFakeMiniKQLProxy::ExecSchemeCreateTable(const TString& tableDesc, const TVector<ui64>& shards) { ui64 txId = ++LastTxId_; ui64 stepId = ++LastStep_; - TMap<ui64, TFakeProxyTx::TPtr> txs; + TMap<ui64, TFakeProxyTx::TPtr> txs; txs[txId] = std::make_shared<TFakeProxyTx>(txId, tableDesc); TFakeProxyTx& tx = *(txs.begin()->second); tx.SetKindSchema(); @@ -635,7 +635,7 @@ void TFakeMiniKQLProxy::Propose(TFakeProxyTx& tx, bool holdImmediate) { if (holdImmediate && tx.Immediate()) return; - TSet<ui64> shards; + TSet<ui64> shards; for (ui32 i = 0; i < shardsCount; ++i) { TString txBody; ui32 shard = tx.GetShardProgram(i, txBody); @@ -665,7 +665,7 @@ void TFakeMiniKQLProxy::Propose(TFakeProxyTx& tx, bool holdImmediate) { } } -void TFakeMiniKQLProxy::ResolveShards(const TSet<ui64>& shards) { +void TFakeMiniKQLProxy::ResolveShards(const TSet<ui64>& shards) { for (ui64 shard : shards) { auto event = new TEvDataShard::TEvGetShardState(Tester.Sender); ForwardToTablet(Tester.Runtime, shard, Tester.Sender, event); @@ -693,13 +693,13 @@ ui64 TFakeMiniKQLProxy::Plan(ui64 stepId, const TMap<ui64, TFakeProxyTx::TPtr>& using TEvStreamQuotaResponse = TEvTxProcessing::TEvStreamQuotaResponse; using TEvStreamDataAck = TEvTxProcessing::TEvStreamDataAck; - TSet<ui64> immediateTxs; - THashMap<ui64, TVector<ui64>> plans; - THashMap<ui64, TVector<ui64>> imm2onlineTxs; - TSet<std::pair<ui64, ui64>> acks; - TSet<std::pair<ui64, ui64>> results; - TSet<std::pair<ui64, ui64>> streams; - TSet<std::pair<ui64, ui64>> scans; + TSet<ui64> immediateTxs; + THashMap<ui64, TVector<ui64>> plans; + THashMap<ui64, TVector<ui64>> imm2onlineTxs; + TSet<std::pair<ui64, ui64>> acks; + TSet<std::pair<ui64, ui64>> results; + TSet<std::pair<ui64, ui64>> streams; + TSet<std::pair<ui64, ui64>> scans; for (auto& pair : txs) { TFakeProxyTx::TPtr tx = pair.second; ui64 txId = tx->TxId(); @@ -735,7 +735,7 @@ ui64 TFakeMiniKQLProxy::Plan(ui64 stepId, const TMap<ui64, TFakeProxyTx::TPtr>& } // prepare immediate - TDeque<std::pair<ui64, THolder<TEvDataShard::TEvProposeTransaction>>> immEvents; + TDeque<std::pair<ui64, THolder<TEvDataShard::TEvProposeTransaction>>> immEvents; for (ui64 txId : immediateTxs) { TFakeProxyTx::TPtr tx = txs.find(txId)->second; UNIT_ASSERT_VALUES_EQUAL(tx->ShardsCount(), 1); @@ -1003,7 +1003,7 @@ TKeyExtractor::TKeyExtractor(TTester& tester, TString programText) { // -TDatashardInitialEventsFilter::TDatashardInitialEventsFilter(const TVector<ui64>& tabletIds) +TDatashardInitialEventsFilter::TDatashardInitialEventsFilter(const TVector<ui64>& tabletIds) : TabletIds(tabletIds) { } diff --git a/ydb/core/tx/datashard/datashard_ut_common.h b/ydb/core/tx/datashard/datashard_ut_common.h index 4b5d7fe4ea0..661a37c7e64 100644 --- a/ydb/core/tx/datashard/datashard_ut_common.h +++ b/ydb/core/tx/datashard/datashard_ut_common.h @@ -106,7 +106,7 @@ private: ui64 LastTxId; ui64 LastStep; TMockDbSchemeResolver DbSchemeResolver; - TString DispatchName = "NONE"; + TString DispatchName = "NONE"; bool AllowIncompleteResult = false; bool* ActiveZone = nullptr; TDuration Timeout = TDuration::Minutes(10); @@ -169,8 +169,8 @@ public: using IEngineFlat = NMiniKQL::IEngineFlat; using TPtr = std::shared_ptr<TFakeProxyTx>; - TVector<ui64> Shards; - TMap<ui64, TVector<NKikimrTxDataShard::TError>> Errors; + TVector<ui64> Shards; + TMap<ui64, TVector<NKikimrTxDataShard::TError>> Errors; ui64 MinStep = 0; ui64 MaxStep = Max<ui64>(); @@ -224,7 +224,7 @@ protected: TString TxBody_; ui32 TxFlags_; ui32 ShardsCount_; - THashMap<ui64, std::shared_ptr<TBalanceCoverageBuilder>> CoverageBuilders; // key - shard + THashMap<ui64, std::shared_ptr<TBalanceCoverageBuilder>> CoverageBuilders; // key - shard std::function<bool(TFakeProxyTx&)> Check; }; @@ -306,11 +306,11 @@ private: TTester& Tester; ui64& LastTxId_; ui64& LastStep_; - TVector<TFakeProxyTx::TPtr> TxQueue; + TVector<TFakeProxyTx::TPtr> TxQueue; TMap<ui64, TActorId> ShardActors; // - TVector<TExpectedReadSet> DelayedReadSets; - TVector<TExpectedReadSet::TWaitFor> DelayedData; + TVector<TExpectedReadSet> DelayedReadSets; + TVector<TExpectedReadSet::TWaitFor> DelayedData; bool RebootOnDelay; void Propose(TFakeProxyTx& tx, bool holdImmediate = false); @@ -318,13 +318,13 @@ private: void ProposeScheme(TFakeProxyTx& tx, const TVector<ui64>& shards, const std::function<NKikimrTxDataShard::TFlatSchemeTransaction(ui64)>& txBodyForShard); ui64 Plan(ui64 stepId, const TMap<ui64, TFakeProxyTx::TPtr>& txs, bool waitForResult = true); - void ResolveShards(const TSet<ui64>& shards); + void ResolveShards(const TSet<ui64>& shards); }; /// class TDatashardInitialEventsFilter { public: - TDatashardInitialEventsFilter(const TVector<ui64>& tabletIds); + TDatashardInitialEventsFilter(const TVector<ui64>& tabletIds); TTestActorRuntime::TEventFilter Prepare(); bool operator()(TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event); @@ -332,18 +332,18 @@ public: TDatashardInitialEventsFilter(TDatashardInitialEventsFilter&&) = default; static TDatashardInitialEventsFilter CreateDefault() { - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); tabletIds.push_back((ui64)TTestTxConfig::TxTablet2); return TDatashardInitialEventsFilter(tabletIds); } - const TVector<ui64> Tablets() const { return TabletIds; } + const TVector<ui64> Tablets() const { return TabletIds; } private: - const TVector<ui64> TabletIds; - TVector<ui64> RemainTablets; + const TVector<ui64> TabletIds; + TVector<ui64> RemainTablets; }; /// @@ -353,7 +353,7 @@ public: TKeyExtractor(TTester& tester, TString programText); - const TVector<TPKey>& GetKeys() const { return Engine->GetDbKeys(); } + const TVector<TPKey>& GetKeys() const { return Engine->GetDbKeys(); } }; THolder<NKqp::TEvKqp::TEvQueryRequest> MakeSQLRequest(const TString &sql, diff --git a/ydb/core/tx/datashard/datashard_ut_locks.cpp b/ydb/core/tx/datashard/datashard_ut_locks.cpp index 1d25c39f99d..aa131ed5994 100644 --- a/ydb/core/tx/datashard/datashard_ut_locks.cpp +++ b/ydb/core/tx/datashard/datashard_ut_locks.cpp @@ -246,7 +246,7 @@ namespace NTest { NTest::TFakeDataShard DataShard; TSysLocks Locks; TSysTables::TLocksTable::TLock TmpLock; - TVector<TCell> TmpLockVec; + TVector<TCell> TmpLockVec; ui64 LockId() const { return Locks.CurrentLockTxId(); } @@ -261,8 +261,8 @@ namespace NTest { template <typename T> static void EmulateTx(TLockTester& tester, ui64 lockTxId, - const TVector<T>& selects, const TVector<T>& updates, - const TVector<std::pair<T, T>>& rangeSelects, ui32 rangeFlags = 0) { + const TVector<T>& selects, const TVector<T>& updates, + const TVector<std::pair<T, T>>& rangeSelects, ui32 rangeFlags = 0) { TLocksUpdate txLocks; tester.StartTx(lockTxId, txLocks); @@ -283,7 +283,7 @@ namespace NTest { } template <typename T> - static void GeneratePoints(TVector<T>& points, ui32 numVals, T value, std::function<void (T&)> next) { + static void GeneratePoints(TVector<T>& points, ui32 numVals, T value, std::function<void (T&)> next) { points.reserve(points.size() + numVals); for (ui32 i = 0; i < numVals; ++i) { points.emplace_back(value); @@ -476,9 +476,9 @@ Y_UNIT_TEST(Points_OneTx) { ui32 numVals = 100 * 1000; ui64 txId = 100; - TVector<ui32> selects; - TVector<ui32> updates; - TVector<std::pair<ui32, ui32>> ranges; + TVector<ui32> selects; + TVector<ui32> updates; + TVector<std::pair<ui32, ui32>> ranges; std::function<void (ui32&)> fInc = [](ui32& val) { ++val; }; NTest::GeneratePoints(selects, numVals, 0u, fInc); @@ -491,9 +491,9 @@ Y_UNIT_TEST(Points_ManyTx) { ui32 numVals = 100 * 1000; ui64 txId = 100; - TVector<ui32> selects; - TVector<ui32> updates; - TVector<std::pair<ui32, ui32>> ranges; + TVector<ui32> selects; + TVector<ui32> updates; + TVector<std::pair<ui32, ui32>> ranges; selects.resize(1); for (ui32 i = 0; i < numVals; ++i, ++txId) { @@ -510,9 +510,9 @@ Y_UNIT_TEST(Points_ManyTx_BreakAll) { ui32 numVals = 100 * 1000; ui64 txId = 100; - TVector<ui32> selects; - TVector<ui32> updates; - TVector<std::pair<ui32, ui32>> ranges; + TVector<ui32> selects; + TVector<ui32> updates; + TVector<std::pair<ui32, ui32>> ranges; selects.resize(1); for (ui32 i = 0; i < numVals; ++i, ++txId) { @@ -534,9 +534,9 @@ Y_UNIT_TEST(Points_ManyTx_RemoveAll) { ui32 numVals = 100 * 1000; ui64 txId = 100; - TVector<ui32> selects; - TVector<ui32> updates; - TVector<std::pair<ui32, ui32>> ranges; + TVector<ui32> selects; + TVector<ui32> updates; + TVector<std::pair<ui32, ui32>> ranges; selects.resize(1); for (ui32 i = 0; i < numVals; ++i, ++txId) { @@ -557,9 +557,9 @@ Y_UNIT_TEST(Points_ManyTx_BreakHalf_RemoveHalf) { ui32 numVals = 100 * 1000; ui64 txId = 100; - TVector<ui32> selects; - TVector<ui32> updates; - TVector<std::pair<ui32, ui32>> ranges; + TVector<ui32> selects; + TVector<ui32> updates; + TVector<std::pair<ui32, ui32>> ranges; selects.resize(1); for (ui32 i = 0; i < numVals; ++i, ++txId) { diff --git a/ydb/core/tx/datashard/datashard_ut_minikql.cpp b/ydb/core/tx/datashard/datashard_ut_minikql.cpp index 7974e474861..aaba565254d 100644 --- a/ydb/core/tx/datashard/datashard_ut_minikql.cpp +++ b/ydb/core/tx/datashard/datashard_ut_minikql.cpp @@ -933,7 +933,7 @@ void CrossShard_1_Cycle_Impl(const TString& dispatchName, std::function<void (TT } Y_UNIT_TEST(CrossShard_1_Cycle) { - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); tabletIds.push_back((ui64)TTestTxConfig::TxTablet2); @@ -1010,7 +1010,7 @@ void CrossShard_2_SwapAndCopy_Impl(const TString& dispatchName, std::function<vo } Y_UNIT_TEST(CrossShard_2_SwapAndCopy) { - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); tabletIds.push_back((ui64)TTestTxConfig::TxTablet2); @@ -1088,7 +1088,7 @@ void CrossShard_3_AllToOne_Impl(const TString& dispatchName, std::function<void } Y_UNIT_TEST(CrossShard_3_AllToOne) { - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); tabletIds.push_back((ui64)TTestTxConfig::TxTablet2); @@ -1164,7 +1164,7 @@ void CrossShard_4_OneToAll_Impl(const TString& dispatchName, std::function<void } Y_UNIT_TEST(CrossShard_4_OneToAll) { - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); tabletIds.push_back((ui64)TTestTxConfig::TxTablet2); @@ -1276,7 +1276,7 @@ void CrossShard_5_AllToAll_Impl(const TString& dispatchName, std::function<void } Y_UNIT_TEST(CrossShard_5_AllToAll) { - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); tabletIds.push_back((ui64)TTestTxConfig::TxTablet2); @@ -1352,7 +1352,7 @@ void CrossShard_6_Local_Impl(const TString& dispatchName, std::function<void (TT } Y_UNIT_TEST(CrossShard_6_Local) { - TVector<ui64> tabletIds; + TVector<ui64> tabletIds; tabletIds.push_back((ui64)TTestTxConfig::TxTablet0); tabletIds.push_back((ui64)TTestTxConfig::TxTablet1); tabletIds.push_back((ui64)TTestTxConfig::TxTablet2); diff --git a/ydb/core/tx/datashard/datashard_ut_order.cpp b/ydb/core/tx/datashard/datashard_ut_order.cpp index 32472dce59e..df8f37f2a8b 100644 --- a/ydb/core/tx/datashard/datashard_ut_order.cpp +++ b/ydb/core/tx/datashard/datashard_ut_order.cpp @@ -223,7 +223,7 @@ Y_UNIT_TEST_WITH_MVCC(ZigZag) { } Y_UNIT_TEST_WITH_MVCC(ZigZag_oo) { - TVector<ui32> variants = {4, 8, 16}; + TVector<ui32> variants = {4, 8, 16}; for (ui32 var : variants) { TTester::TOptions opts; opts.EnableOutOfOrder(var); @@ -561,7 +561,7 @@ static inline bool HasFlag(ui32 flags, ui32 pos) { return (flags & (1 << pos)); } -static TString MkRandomTx(ui64 txId, ui32 points, ui32 rw, ui32 keysCount, TVector<ui32>& expected, bool range = false) +static TString MkRandomTx(ui64 txId, ui32 points, ui32 rw, ui32 keysCount, TVector<ui32>& expected, bool range = false) { UNIT_ASSERT(keysCount <= 32); Cout << "tx " << txId << ' ' << Bin(points) << ' ' << Bin(points & rw) << " (" << points << '/' << rw << ')' << Endl; @@ -612,7 +612,7 @@ static TString MkRandomTx(ui64 txId, ui32 points, ui32 rw, ui32 keysCount, TVect ))", remoteKey, (ui32)txId+100, body.data()); } -static void PrintRandomResults(const TVector<ui32>& result, const TString& prefix) { +static void PrintRandomResults(const TVector<ui32>& result, const TString& prefix) { Cerr << prefix; for (ui32 val : result) { if (val != Max<ui32>()) @@ -687,7 +687,7 @@ static void RandomTxDeps(const TTester::TOptions& opts, ui32 numTxs, ui32 maxKey proxy.DelayData({TTestTxConfig::TxTablet0, indepTxId}); } - TVector<ui32> expected(32, Max<ui32>()); + TVector<ui32> expected(32, Max<ui32>()); for (ui32 i = 0; i < numTxs; ++i) { ui32 count = minKeys + RandomNumber<ui32>(maxKeys-minKeys); if (counts.size() > i) @@ -707,11 +707,11 @@ static void RandomTxDeps(const TTester::TOptions& opts, ui32 numTxs, ui32 maxKey } ui64 pictureTxId = proxy.LastTxId() + 1; - TVector<ui32> actual(32, Max<ui32>()); - TVector<ui32> intermediate(32, Max<ui32>()); + TVector<ui32> actual(32, Max<ui32>()); + TVector<ui32> intermediate(32, Max<ui32>()); auto extractActual = [&](TFakeProxyTx& tx) -> bool { - TVector<ui32> * out = &actual; + TVector<ui32> * out = &actual; if (tx.TxId() != pictureTxId) { out = &intermediate; } @@ -816,7 +816,7 @@ Y_UNIT_TEST_WITH_MVCC(RandomPoints_DelayRS) { opts.EnableOutOfOrder(8); opts.EnableMvcc(WithMvcc); - TVector<std::pair<ui32, ui32>> variants; + TVector<std::pair<ui32, ui32>> variants; variants.push_back({8, 8}); variants.push_back({8, 16}); variants.push_back({8, 32}); @@ -840,7 +840,7 @@ Y_UNIT_TEST_WITH_MVCC(RandomDotRanges_DelayRS) { opts.EnableOutOfOrder(8); opts.EnableMvcc(WithMvcc); - TVector<std::pair<ui32, ui32>> variants; + TVector<std::pair<ui32, ui32>> variants; variants.push_back({8, 8}); variants.push_back({8, 16}); variants.push_back({8, 32}); @@ -865,7 +865,7 @@ Y_UNIT_TEST_WITH_MVCC(RandomPoints_DelayRS_Reboot) { opts.EnableOutOfOrder(8); opts.EnableMvcc(WithMvcc); - TVector<std::pair<ui32, ui32>> variants; + TVector<std::pair<ui32, ui32>> variants; variants.push_back({8, 8}); variants.push_back({8, 16}); variants.push_back({8, 32}); @@ -891,7 +891,7 @@ Y_UNIT_TEST_WITH_MVCC(RandomPoints_DelayRS_Reboot_Dirty) { opts.EnableOutOfOrder(8); opts.EnableMvcc(WithMvcc); - TVector<std::pair<ui32, ui32>> variants; + TVector<std::pair<ui32, ui32>> variants; variants.push_back({8, 8}); variants.push_back({8, 16}); variants.push_back({8, 32}); @@ -916,7 +916,7 @@ Y_UNIT_TEST_WITH_MVCC(RandomPoints_DelayData) { opts.EnableOutOfOrder(8); opts.EnableMvcc(WithMvcc); - TVector<std::pair<ui32, ui32>> variants; + TVector<std::pair<ui32, ui32>> variants; variants.push_back({8, 8}); variants.push_back({8, 16}); variants.push_back({8, 32}); @@ -1007,10 +1007,10 @@ public: } ui64 GetTxId() const { return TxId; } - const TMap<ui32, ui32>& GetResults() const { return Results; } + const TMap<ui32, ui32>& GetResults() const { return Results; } - void SetResults(const TVector<ui32>& kv) { - THashSet<ui32> points; + void SetResults(const TVector<ui32>& kv) { + THashSet<ui32> points; for (ui32 point : Reads) { points.insert(point); } @@ -1027,7 +1027,7 @@ public: } } - void ApplyWrites(TVector<ui32>& kv) const { + void ApplyWrites(TVector<ui32>& kv) const { for (ui32 point : Writes) { kv[point] = TxId; } @@ -1035,10 +1035,10 @@ public: private: ui64 TxId; - TVector<ui32> Writes; - TVector<ui32> Reads; - TVector<TSimpleRange> Ranges; - TMap<ui32, ui32> Results; + TVector<ui32> Writes; + TVector<ui32> Reads; + TVector<TSimpleRange> Ranges; + TMap<ui32, ui32> Results; static TString ProgramTextSwap(ui32 txId = 0) { ui32 point = txId % 1000; @@ -1071,17 +1071,17 @@ public: } private: - TVector<ui32> Points; + TVector<ui32> Points; }; -void Print(const TMap<ui32, ui32>& m) { +void Print(const TMap<ui32, ui32>& m) { for (auto& pair : m) Cerr << pair.first << ':' << pair.second << ' '; Cerr << Endl; } void RandomPointsAndRanges(TFakeMiniKQLProxy& proxy, ui32 numTxs, ui32 maxWrites, ui32 maxReads, ui32 maxRanges) { - TVector<std::shared_ptr<TSimpleTx>> txs; + TVector<std::shared_ptr<TSimpleTx>> txs; txs.reserve(numTxs); ui32 startTxId = proxy.LastTxId()+1; for (ui32 i = 0; i < numTxs; ++i) { @@ -1092,7 +1092,7 @@ void RandomPointsAndRanges(TFakeMiniKQLProxy& proxy, ui32 numTxs, ui32 maxWrites UNIT_ASSERT(!tx.Immediate()); auto& expected = txs[tx.TxId()-startTxId]->GetResults(); - TMap<ui32, ui32> actual; + TMap<ui32, ui32> actual; NKikimrMiniKQL::TResult res = tx.GetResult(); TValue value = TValue::Create(res.GetValue(), res.GetType()); @@ -1141,11 +1141,11 @@ Y_UNIT_TEST_WITH_MVCC(RandomPointsAndRanges) { opts.EnableOutOfOrder(8); opts.EnableMvcc(WithMvcc); - TVector<TVector<ui32>> variants; - variants.push_back(TVector<ui32>() = {100, 20, 20, 20}); - variants.push_back(TVector<ui32>() = {100, 50, 50, 50}); - variants.push_back(TVector<ui32>() = {100, 40, 30, 20}); - variants.push_back(TVector<ui32>() = {400, 20, 20, 20}); + TVector<TVector<ui32>> variants; + variants.push_back(TVector<ui32>() = {100, 20, 20, 20}); + variants.push_back(TVector<ui32>() = {100, 50, 50, 50}); + variants.push_back(TVector<ui32>() = {100, 40, 30, 20}); + variants.push_back(TVector<ui32>() = {400, 20, 20, 20}); for (auto& v : variants) { RandomPointsAndRanges(opts, v[0], v[1], v[2], v[3]); @@ -1165,7 +1165,7 @@ Y_UNIT_TEST_WITH_MVCC(ScanFollowedByUpdate) { TTester t(TTester::ESchema_MultiShardKV, opts); TFakeMiniKQLProxy proxy(t); - auto checkScanResult = [](const TFakeProxyTx &tx, TSet<TString> ref) -> bool { + auto checkScanResult = [](const TFakeProxyTx &tx, TSet<TString> ref) -> bool { const TFakeScanTx &scanTx = dynamic_cast<const TFakeScanTx &>(tx); YdbOld::ResultSet res = scanTx.GetScanResult(); //Cerr << res.DebugString() << Endl; @@ -1194,7 +1194,7 @@ Y_UNIT_TEST_WITH_MVCC(ScanFollowedByUpdate) { c.SetName("value"); c.SetTypeId(NScheme::NTypeIds::Utf8); - TSet<TString> ref1{"A", "B", "C"}; + TSet<TString> ref1{"A", "B", "C"}; proxy.EnqueueScan(dataTransaction.SerializeAsString(), [ref1, checkScanResult](TFakeProxyTx& tx) { return checkScanResult(tx, ref1); }, NDataShard::TTxFlags::Default); @@ -1222,7 +1222,7 @@ Y_UNIT_TEST_WITH_MVCC(ScanFollowedByUpdate) { proxy.ExecQueue(); - TSet<TString> ref2{"A" + ToString(N), "B" + ToString(N), "C" + ToString(N)}; + TSet<TString> ref2{"A" + ToString(N), "B" + ToString(N), "C" + ToString(N)}; proxy.EnqueueScan(dataTransaction.SerializeAsString(), [ref2, checkScanResult](TFakeProxyTx& tx) { return checkScanResult(tx, ref2); }, NDataShard::TTxFlags::Default); diff --git a/ydb/core/tx/datashard/sys_tables.h b/ydb/core/tx/datashard/sys_tables.h index e9887bd8dbb..036e609e619 100644 --- a/ydb/core/tx/datashard/sys_tables.h +++ b/ydb/core/tx/datashard/sys_tables.h @@ -73,7 +73,7 @@ struct TSysTables { static bool IsBroken(ui64 counter) { return (counter == ErrorBroken); } TVector<TCell> MakeRow(bool v2) const { - TVector<TCell> row; + TVector<TCell> row; MakeRow(row, v2); return row; } diff --git a/ydb/core/tx/mediator/execute_queue.cpp b/ydb/core/tx/mediator/execute_queue.cpp index 07740e9f826..85f2eb474c5 100644 --- a/ydb/core/tx/mediator/execute_queue.cpp +++ b/ydb/core/tx/mediator/execute_queue.cpp @@ -21,7 +21,7 @@ namespace NTxMediator { const ui64 HashRange; TTimeCastBuckets BucketSelector; - TVector<TBucket> Buckets; + TVector<TBucket> Buckets; TBucket& SelectBucket(TTabletId tablet) { const ui32 bucketIdx = BucketSelector.Select(tablet); @@ -30,7 +30,7 @@ namespace NTxMediator { } template<typename TEv> - void SendStepToBucket(TTabletId tablet, TStepId step, TVector<TTx> &tx, const TActorContext &ctx) { + void SendStepToBucket(TTabletId tablet, TStepId step, TVector<TTx> &tx, const TActorContext &ctx) { TBucket &bucket = SelectBucket(tablet); Sort(tx.begin(), tx.end(), TTx::TCmpOrderId()); @@ -40,7 +40,7 @@ namespace NTxMediator { for (const auto &x : tx) ss << " txid# " << x.TxId; ss << " marker# M2"; - return (TString)ss; + return (TString)ss; }()); LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR_EXEC_QUEUE, "Actor# " << ctx.SelfID.ToString() @@ -50,7 +50,7 @@ namespace NTxMediator { for (const auto &x : tx) ss << " txid# " << x.TxId; ss << " marker# M3"; - return (TString)ss; + return (TString)ss; }()); ctx.Send(bucket.ActiveActor, new TEv(step, tablet, tx)); } @@ -79,8 +79,8 @@ namespace NTxMediator { ui64 activeTablet = Max<ui64>(); ui64 lookupTablet = Max<ui64>(); - TVector<ui64> readPositions(totalCoordinators, 0); - TVector<TTx> currentTx; + TVector<ui64> readPositions(totalCoordinators, 0); + TVector<TTx> currentTx; do { for (ui64 ci = 0; ci != totalCoordinators; ++ci) { @@ -131,10 +131,10 @@ namespace NTxMediator { Sort(step->TabletsToTransaction.begin(), step->TabletsToTransaction.end(), TCoordinatorStep::TabletToTransactionCmp()); - TVector<TTx> currentTx; + TVector<TTx> currentTx; TTabletId activeTablet = 0; - for (TVector<std::pair<TTabletId, std::size_t>>::const_iterator it = step->TabletsToTransaction.begin(), end = step->TabletsToTransaction.end(); it != end; ++it) { + for (TVector<std::pair<TTabletId, std::size_t>>::const_iterator it = step->TabletsToTransaction.begin(), end = step->TabletsToTransaction.end(); it != end; ++it) { if (activeTablet != it->first) { if (activeTablet) SendStepToBucket<TEvTxMediator::TEvOoOTabletStep>(activeTablet, step->Step, currentTx, ctx); diff --git a/ydb/core/tx/mediator/mediator__configure.cpp b/ydb/core/tx/mediator/mediator__configure.cpp index 4a368e321f1..2a2af48b6e8 100644 --- a/ydb/core/tx/mediator/mediator__configure.cpp +++ b/ydb/core/tx/mediator/mediator__configure.cpp @@ -9,7 +9,7 @@ using NTabletFlatExecutor::TTransactionContext; struct TTxMediator::TTxConfigure : public TTransactionBase<TTxMediator> { TActorId AckTo; ui64 Version; - TVector<TCoordinatorId> Coordinators; + TVector<TCoordinatorId> Coordinators; ui32 TimeCastBuketsPerMediator; TAutoPtr<TEvSubDomain::TEvConfigureStatus> Respond; bool ConfigurationApplied; @@ -36,12 +36,12 @@ struct TTxMediator::TTxConfigure : public TTransactionBase<TTxMediator> { return false; ui32 curVersion = 0; - TVector<TCoordinatorId> curCoordinators; + TVector<TCoordinatorId> curCoordinators; ui32 curBuckets = 0; while (!rowset.EndOfSet()) { const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>(); - TVector<TCoordinatorId> coordinators = rowset.GetValue<Schema::DomainConfiguration::Coordinators>(); + TVector<TCoordinatorId> coordinators = rowset.GetValue<Schema::DomainConfiguration::Coordinators>(); ui32 buckets = rowset.GetValue<Schema::DomainConfiguration::TimeCastBuckets>(); if (ver >= curVersion) { diff --git a/ydb/core/tx/mediator/mediator__init.cpp b/ydb/core/tx/mediator/mediator__init.cpp index 51c566699c0..84f8d35c466 100644 --- a/ydb/core/tx/mediator/mediator__init.cpp +++ b/ydb/core/tx/mediator/mediator__init.cpp @@ -10,7 +10,7 @@ using NTabletFlatExecutor::TTransactionContext; struct TTxMediator::TTxInit : public TTransactionBase<TTxMediator> { ui64 Version; - TVector<TCoordinatorId> Coordinators; + TVector<TCoordinatorId> Coordinators; ui32 TimeCastBuketsPerMediator; TTxInit(TSelf *mediator) @@ -31,7 +31,7 @@ struct TTxMediator::TTxInit : public TTransactionBase<TTxMediator> { while (!rowset.EndOfSet()) { const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>(); - TVector<TCoordinatorId> coordinators = rowset.GetValue<Schema::DomainConfiguration::Coordinators>(); + TVector<TCoordinatorId> coordinators = rowset.GetValue<Schema::DomainConfiguration::Coordinators>(); ui32 buckets = rowset.GetValue<Schema::DomainConfiguration::TimeCastBuckets>(); if (ver >= Version) { diff --git a/ydb/core/tx/mediator/mediator_impl.cpp b/ydb/core/tx/mediator/mediator_impl.cpp index c4b202b8221..cb901e77055 100644 --- a/ydb/core/tx/mediator/mediator_impl.cpp +++ b/ydb/core/tx/mediator/mediator_impl.cpp @@ -117,7 +117,7 @@ void TTxMediator::DoConfigure(const TEvSubDomain::TEvConfigure &ev, const TActor return; } - TVector<TCoordinatorId> coordinators; + TVector<TCoordinatorId> coordinators; coordinators.reserve(record.CoordinatorsSize()); for (auto id: record.GetCoordinators()) { @@ -164,7 +164,7 @@ void TTxMediator::ReplyStep(const TActorId &sender, NKikimrTx::TEvCoordinatorSte ui64 TTxMediator::FindProgressCandidate() { // in perfect case here could be priority queue, but who cares? (domain coordinators count is bounded and steps are not so frequent). ui64 candidate = Max<ui64>(); - for (TMap<ui64, TCoordinatorInfo>::iterator it = VolatileState.Domain.begin(), end = VolatileState.Domain.end(); it != end; ++it) { + for (TMap<ui64, TCoordinatorInfo>::iterator it = VolatileState.Domain.begin(), end = VolatileState.Domain.end(); it != end; ++it) { const TCoordinatorInfo &info = it->second; if (info.Queue.empty()) // could not progress w/o info from any domain coordinator return Max<ui64>(); @@ -183,7 +183,7 @@ void TTxMediator::Progress(ui64 to, const TActorContext &ctx) { TAutoPtr<TMediateStep> mds(new TMediateStep(from, to)); ui64 txCount = 0; - for (TMap<ui64, TCoordinatorInfo>::iterator it = VolatileState.Domain.begin(), end = VolatileState.Domain.end(); it != end; ++it) { + for (TMap<ui64, TCoordinatorInfo>::iterator it = VolatileState.Domain.begin(), end = VolatileState.Domain.end(); it != end; ++it) { TCoordinatorInfo &info = it->second; Y_VERIFY(!info.Queue.empty() && info.Queue.front()->Step >= to); @@ -290,7 +290,7 @@ void TTxMediator::Handle(TEvTxCoordinator::TEvCoordinatorStep::TPtr &ev, const T } // is domain? - TMap<ui64, TCoordinatorInfo>::iterator domainIt = VolatileState.Domain.find(coordinator); + TMap<ui64, TCoordinatorInfo>::iterator domainIt = VolatileState.Domain.find(coordinator); if (domainIt != VolatileState.Domain.end()) return ProcessDomainStep(ev->Sender, record, coordinator, domainIt->second, ctx); diff --git a/ydb/core/tx/mediator/mediator_impl.h b/ydb/core/tx/mediator/mediator_impl.h index c98bd4246b0..8eeac28b284 100644 --- a/ydb/core/tx/mediator/mediator_impl.h +++ b/ydb/core/tx/mediator/mediator_impl.h @@ -44,7 +44,7 @@ namespace NTxMediator { } }; - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TTx Moderator# " << Moderator; str << " txid# " << TxId; @@ -58,9 +58,9 @@ namespace NTxMediator { const TStepId Step; const TStepId PrevStep; - TVector<TTx> Transactions; + TVector<TTx> Transactions; - TVector<std::pair<TTabletId, std::size_t>> TabletsToTransaction; // tablet -> tx index in Transactions + TVector<std::pair<TTabletId, std::size_t>> TabletsToTransaction; // tablet -> tx index in Transactions struct TabletToTransactionCmp { bool operator()(const std::pair<TTabletId, std::size_t> &left, const std::pair<TTabletId, std::size_t> &right) const { @@ -70,7 +70,7 @@ namespace NTxMediator { TCoordinatorStep(const NKikimrTx::TEvCoordinatorStep &record); - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TCoordinatorStep step# " << Step; str << " PrevStep# " << PrevStep; @@ -99,14 +99,14 @@ namespace NTxMediator { TStepId From; TStepId To; - TVector<TAutoPtr<TCoordinatorStep>> Steps; + TVector<TAutoPtr<TCoordinatorStep>> Steps; TMediateStep(TStepId from, TStepId to) : From(from) , To(to) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TMediateStep From " << From; str << " To# " << To; @@ -149,7 +149,7 @@ struct TEvTxMediator { : MediateStep(mds) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvCommitStep MediateStep: " << MediateStep->ToString(); str << "}"; @@ -166,7 +166,7 @@ struct TEvTxMediator { , AckTo(ackTo) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvRequestLostAcks CoordinatorStep: " << CoordinatorStep->ToString(); str << " AckTo# " << AckTo.ToString(); @@ -179,15 +179,15 @@ struct TEvTxMediator { struct TEvCommitTabletStep : public TEventLocal<TEvCommitTabletStep, EvCommitTabletStep> { const TStepId Step; const TTabletId TabletId; - TVector<NTxMediator::TTx> Transactions; // todo: inplace placing + TVector<NTxMediator::TTx> Transactions; // todo: inplace placing - TEvCommitTabletStep(TStepId step, TTabletId tabletId, TVector<NTxMediator::TTx> &transactions) + TEvCommitTabletStep(TStepId step, TTabletId tabletId, TVector<NTxMediator::TTx> &transactions) : Step(step) , TabletId(tabletId) , Transactions(transactions.begin(), transactions.end()) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvCommitTabletStep step# " << Step; str << " TabletId# " << TabletId; @@ -207,7 +207,7 @@ struct TEvTxMediator { : Step(step) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvStepPlanComplete step# " << Step; str << "}"; @@ -218,15 +218,15 @@ struct TEvTxMediator { struct TEvOoOTabletStep : public TEventLocal<TEvOoOTabletStep, EvOoOTabletStep> { const TStepId Step; const TTabletId TabletId; - TVector<NTxMediator::TTx> Transactions; + TVector<NTxMediator::TTx> Transactions; - TEvOoOTabletStep(TStepId step, TTabletId tabletId, TVector<NTxMediator::TTx> &transactions) + TEvOoOTabletStep(TStepId step, TTabletId tabletId, TVector<NTxMediator::TTx> &transactions) : Step(step) , TabletId(tabletId) , Transactions(transactions.begin(), transactions.end()) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvOoOTabletStep step# " << Step; str << " TabletId# " << TabletId; @@ -246,7 +246,7 @@ struct TEvTxMediator { : Source(source) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvWatchBucket Source# " << Source.ToString(); str << "}"; @@ -276,10 +276,10 @@ class TTxMediator : public TActor<TTxMediator>, public NTabletFlatExecutor::TTab }; struct TCoordinatorInfo { - typedef TDeque<TAutoPtr<TCoordinatorStep>> TQueueType; // todo: list/queue + typedef TDeque<TAutoPtr<TCoordinatorStep>> TQueueType; // todo: list/queue ui64 KnownPrevStep; - TQueueType Queue; + TQueueType Queue; ui64 ActiveCoordinatorGeneration; TActorId AckTo; @@ -291,8 +291,8 @@ class TTxMediator : public TActor<TTxMediator>, public NTabletFlatExecutor::TTab }; struct TVolatileState { - TMap<ui64, TCoordinatorInfo> Domain; - TMap<ui64, TCoordinatorInfo> Foreign; + TMap<ui64, TCoordinatorInfo> Domain; + TMap<ui64, TCoordinatorInfo> Foreign; ui64 CompleteStep; ui64 LatestKnownStep; @@ -320,7 +320,7 @@ class TTxMediator : public TActor<TTxMediator>, public NTabletFlatExecutor::TTab TActorId ExecQueue; THashMap<TActorId, NKikimrTx::TEvCoordinatorSync> CoordinatorsSyncEnqueued; - TVector<TEvMediatorTimecast::TEvWatch::TPtr> WatchEnqueued; + TVector<TEvMediatorTimecast::TEvWatch::TPtr> WatchEnqueued; void Die(const TActorContext &ctx) override; void OnActivateExecutor(const TActorContext &ctx) override; @@ -372,7 +372,7 @@ public: struct DomainConfiguration : Table<2> { struct Version : Column<1, NScheme::NTypeIds::Uint64> {}; - struct Coordinators : Column<2, NScheme::NTypeIds::String> { using Type = TVector<TCoordinatorId>; }; + struct Coordinators : Column<2, NScheme::NTypeIds::String> { using Type = TVector<TCoordinatorId>; }; struct TimeCastBuckets : Column<3, NScheme::NTypeIds::Uint32> { static constexpr ui32 Default = TDomainsInfo::TDomain::TimecastBucketsPerMediator; }; using TKey = TableKey<Version>; diff --git a/ydb/core/tx/mediator/tablet_queue.cpp b/ydb/core/tx/mediator/tablet_queue.cpp index b28179517ca..66722427e7e 100644 --- a/ydb/core/tx/mediator/tablet_queue.cpp +++ b/ydb/core/tx/mediator/tablet_queue.cpp @@ -38,26 +38,26 @@ class TTxMediatorTabletQueue : public TActor<TTxMediatorTabletQueue> { struct TStep { TStepEntry * const StepRef; - TVector<TTx> Transactions; + TVector<TTx> Transactions; TStep(TStepEntry *stepRef) : StepRef(stepRef) {} }; - typedef TOneOneQueueInplace<TStep *, 32> TQueueType; + typedef TOneOneQueueInplace<TStep *, 32> TQueueType; EState State; - TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> Queue; - TMap<TStepId, TVector<TTx>> OutOfOrder; // todo: replace TVector<> with chunked queue to conserve copying + TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> Queue; + TMap<TStepId, TVector<TTx>> OutOfOrder; // todo: replace TVector<> with chunked queue to conserve copying TTabletEntry() : State(StateInit) - , Queue(new TQueueType()) + , Queue(new TQueueType()) {} void MergeOutOfOrder(TStep *x); - void MergeToOutOfOrder(TStepId step, TVector<TTx> &update); + void MergeToOutOfOrder(TStepId step, TVector<TTx> &update); }; const TActorId Owner; @@ -65,7 +65,7 @@ class TTxMediatorTabletQueue : public TActor<TTxMediatorTabletQueue> { const ui64 HashRange; const ui64 HashBucket; - THashMap<TTabletId, TTabletEntry> PerTabletPlanQueue; // by tablet entries + THashMap<TTabletId, TTabletEntry> PerTabletPlanQueue; // by tablet entries typedef TOneOneQueueInplace<TStepEntry *, 512> TStepCommitQueue; TAutoPtr<TStepCommitQueue, TStepCommitQueue::TPtrCleanDestructor> StepCommitQueue; @@ -212,7 +212,7 @@ class TTxMediatorTabletQueue : public TActor<TTxMediatorTabletQueue> { } tabletEntry.State = TTabletEntry::StateConnected; - TTabletEntry::TQueueType::TReadIterator it = tabletEntry.Queue->Iterator(); + TTabletEntry::TQueueType::TReadIterator it = tabletEntry.Queue->Iterator(); while (TTabletEntry::TStep *sx = it.Next()) { tabletEntry.MergeOutOfOrder(sx); SendToTablet(sx, tablet, ctx); @@ -300,7 +300,7 @@ class TTxMediatorTabletQueue : public TActor<TTxMediatorTabletQueue> { TimecastWatches.erase(ev->Sender); } - void AckOoO(TTabletId tablet, TStepId step, const TVector<TTx> &transactions, const TActorContext &ctx) { + void AckOoO(TTabletId tablet, TStepId step, const TVector<TTx> &transactions, const TActorContext &ctx) { TMap<TActorId, TAutoPtr<TEvTxProcessing::TEvPlanStepAck>> acks; for (const TTx &tx : transactions) { TAutoPtr<TEvTxProcessing::TEvPlanStepAck> &ack = acks[tx.AckTo]; @@ -370,7 +370,7 @@ public: } }; -TString yvector2str(const TVector<TTx>& v) { +TString yvector2str(const TVector<TTx>& v) { TStringStream stream; stream << '{'; for (auto it = v.begin(); it != v.end(); ++it) { @@ -387,7 +387,7 @@ void TTxMediatorTabletQueue::TTabletEntry::MergeOutOfOrder(TStep *sx) { const TStepId step = sx->StepRef->Step; const auto ox = OutOfOrder.find(step); if (ox != OutOfOrder.end()) { - const TVector<TTx> &o = ox->second; + const TVector<TTx> &o = ox->second; Y_VERIFY_DEBUG( IsSorted(sx->Transactions.begin(), sx->Transactions.end(), TTx::TCmpOrderId()), "%s", @@ -396,10 +396,10 @@ void TTxMediatorTabletQueue::TTabletEntry::MergeOutOfOrder(TStep *sx) { Y_VERIFY_DEBUG(IsSorted(o.begin(), o.end(), TTx::TCmpOrderId()), "%s", yvector2str(o).c_str()); // // ok, now merge sorted arrays replacing ack-to - TVector<TTx>::iterator planIt = sx->Transactions.begin(); - TVector<TTx>::iterator planEnd = sx->Transactions.end(); - TVector<TTx>::const_iterator oooIt = o.begin(); - TVector<TTx>::const_iterator oooEnd = o.end(); + TVector<TTx>::iterator planIt = sx->Transactions.begin(); + TVector<TTx>::iterator planEnd = sx->Transactions.end(); + TVector<TTx>::const_iterator oooIt = o.begin(); + TVector<TTx>::const_iterator oooEnd = o.end(); while (oooIt != oooEnd && planIt != planEnd) { if (planIt->TxId < oooIt->TxId) { ++planIt; @@ -415,21 +415,21 @@ void TTxMediatorTabletQueue::TTabletEntry::MergeOutOfOrder(TStep *sx) { } } -void TTxMediatorTabletQueue::TTabletEntry::MergeToOutOfOrder(TStepId step, TVector<TTx> &update) { - TVector<TTx> ¤t = OutOfOrder[step]; +void TTxMediatorTabletQueue::TTabletEntry::MergeToOutOfOrder(TStepId step, TVector<TTx> &update) { + TVector<TTx> ¤t = OutOfOrder[step]; if (current.empty()) { current.swap(update); } else { - TVector<TTx> old; + TVector<TTx> old; old.swap(current); Y_VERIFY_DEBUG(IsSorted(old.begin(), old.end(), TTx::TCmpOrderId()), "%s", yvector2str(old).c_str()); Y_VERIFY_DEBUG(IsSorted(update.begin(), update.end(), TTx::TCmpOrderId()), "%s", yvector2str(update).c_str()); // // now merge old with update - TVector<TTx>::const_iterator oldIt = old.begin(); - TVector<TTx>::const_iterator oldEnd = old.end(); - TVector<TTx>::const_iterator updIt = update.begin(); - TVector<TTx>::const_iterator updEnd = update.end(); + TVector<TTx>::const_iterator oldIt = old.begin(); + TVector<TTx>::const_iterator oldEnd = old.end(); + TVector<TTx>::const_iterator updIt = update.begin(); + TVector<TTx>::const_iterator updEnd = update.end(); while (oldIt != oldEnd && updIt != updEnd) { if (oldIt->TxId < updIt->TxId) { diff --git a/ydb/core/tx/scheme_cache/scheme_cache.h b/ydb/core/tx/scheme_cache/scheme_cache.h index 26a07897a11..86239ef7130 100644 --- a/ydb/core/tx/scheme_cache/scheme_cache.h +++ b/ydb/core/tx/scheme_cache/scheme_cache.h @@ -24,7 +24,7 @@ struct TSchemeCacheConfig : public TThrRefBase { struct TTagEntry { ui32 Tag = 0; ui64 RootSchemeShard = 0; - TString Name; + TString Name; explicit TTagEntry(ui32 tag, ui64 rootSchemeShard, const TString& name) : Tag(tag) @@ -36,7 +36,7 @@ struct TSchemeCacheConfig : public TThrRefBase { TSchemeCacheConfig() = default; explicit TSchemeCacheConfig(const TAppData* appData, NMonitoring::TDynamicCounterPtr counters); - TVector<TTagEntry> Roots; + TVector<TTagEntry> Roots; NMonitoring::TDynamicCounterPtr Counters; }; @@ -229,7 +229,7 @@ struct TSchemeCacheNavigate { // table specific THashMap<TString, TString> Attributes; - THashMap<ui32, TSysTables::TTableColumnInfo> Columns; + THashMap<ui32, TSysTables::TTableColumnInfo> Columns; THashSet<TString> NotNullColumns; TVector<NKikimrSchemeOp::TIndexDescription> Indexes; TVector<NKikimrSchemeOp::TCdcStreamDescription> CdcStreams; @@ -250,7 +250,7 @@ struct TSchemeCacheNavigate { TString ToString(const NScheme::TTypeRegistry& typeRegistry) const; }; - using TResultSet = TVector<TEntry>; + using TResultSet = TVector<TEntry>; TResultSet ResultSet; TAutoPtr<const NACLib::TUserToken> UserToken; @@ -321,7 +321,7 @@ struct TSchemeCacheRequest { TString ToString(const NScheme::TTypeRegistry& typeRegistry) const; }; - using TResultSet = TVector<TEntry>; + using TResultSet = TVector<TEntry>; TResultSet ResultSet; TAutoPtr<const NACLib::TUserToken> UserToken; diff --git a/ydb/core/tx/schemeshard/schemeshard.h b/ydb/core/tx/schemeshard/schemeshard.h index d33173508ce..26650bb126e 100644 --- a/ydb/core/tx/schemeshard/schemeshard.h +++ b/ydb/core/tx/schemeshard/schemeshard.h @@ -78,7 +78,7 @@ struct TEvSchemeShard { Record.SetTabletId(tabletId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvModifySchemeTransaction"; if (Record.HasTxId()) { @@ -154,7 +154,7 @@ struct TEvSchemeShard { } } - void SetError(EStatus status, const TString& errStr) { + void SetError(EStatus status, const TString& errStr) { Record.SetStatus(status); Record.SetReason(errStr); } @@ -163,7 +163,7 @@ struct TEvSchemeShard { void SetPathDropTxId(ui64 txId) { Record.SetPathDropTxId(txId); } void SetPathId(ui64 pathId) { Record.SetPathId(pathId); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvModifySchemeTransactionResult"; if (Record.HasStatus()) { @@ -222,7 +222,7 @@ struct TEvSchemeShard { Record.CopyFrom(describePath); } - TEvDescribeScheme(const TString& path) + TEvDescribeScheme(const TString& path) { Record.SetPath(path); } diff --git a/ydb/core/tx/schemeshard/schemeshard__init.cpp b/ydb/core/tx/schemeshard/schemeshard__init.cpp index 650506549e0..e2c4fef2180 100644 --- a/ydb/core/tx/schemeshard/schemeshard__init.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__init.cpp @@ -2006,7 +2006,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> { << ", at schemeshard: " << Self->TabletID()); TPathId prevTableId; - TVector<TTableShardInfo> partitions; + TVector<TTableShardInfo> partitions; const auto now = ctx.Now(); for (auto& rec: tablePartitions) { diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp index 0715543a229..61657cadd8d 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp @@ -1936,7 +1936,7 @@ void TSchemeShard::PersistTxState(NIceDb::TNiceDb& db, const TOperationId opId) Y_VERIFY(txState.TxType != TTxState::TxInvalid); Y_VERIFY(txState.State != TTxState::Invalid); - TString extraData; + TString extraData; if (txState.TxType == TTxState::TxSplitTablePartition || txState.TxType == TTxState::TxMergeTablePartition) { Y_VERIFY(txState.SplitDescription, "Split Tx must have non-empty split description"); bool serializeRes = txState.SplitDescription->SerializeToString(&extraData); @@ -2168,7 +2168,7 @@ void TSchemeShard::PersistTableAlterVersion(NIceDb::TNiceDb& db, const TPathId p } void TSchemeShard::PersistTableAltered(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) { - TString partitionConfig; + TString partitionConfig; Y_PROTOBUF_SUPPRESS_NODISCARD tableInfo->PartitionConfig().SerializeToString(&partitionConfig); TString ttlSettings; diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h index e1a1d08b9a6..8f63bf1a241 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.h +++ b/ydb/core/tx/schemeshard/schemeshard_impl.h @@ -146,10 +146,10 @@ public: TVector<TString> RootPathElemets; - THashMap<TPathId, TPathElement::TPtr> PathsById; + THashMap<TPathId, TPathElement::TPtr> PathsById; TLocalPathId NextLocalPathId = 0; - THashMap<TPathId, TTableInfo::TPtr> Tables; + THashMap<TPathId, TTableInfo::TPtr> Tables; THashMap<TPathId, TTableInfo::TPtr> TTLEnabledTables; THashMap<TPathId, TTableIndexInfo::TPtr> Indexes; @@ -163,7 +163,7 @@ public: THashMap<TPathId, TTxId> LockedPaths; - THashMap<TPathId, TPersQueueGroupInfo::TPtr> PersQueueGroups; + THashMap<TPathId, TPersQueueGroupInfo::TPtr> PersQueueGroups; THashMap<TPathId, TRtmrVolumeInfo::TPtr> RtmrVolumes; THashMap<TPathId, TSolomonVolumeInfo::TPtr> SolomonVolumes; THashMap<TPathId, TSubDomainInfo::TPtr> SubDomains; @@ -719,11 +719,11 @@ public: bool rangeBeginInclusive, bool rangeEndInclusive, bool newTable = false); void FillTableDescription(TPathId tableId, ui32 partitionIdx, ui64 schemaVersion, NKikimrSchemeOp::TTableDescription* tableDescr); - static bool FillUniformPartitioning(TVector<TString>& rangeEnds, ui32 keySize, NScheme::TTypeId firstKeyColType, - ui32 partitionCount, const NScheme::TTypeRegistry* typeRegistry, TString& errStr); - static bool FillSplitPartitioning(TVector<TString>& rangeEnds, const TConstArrayRef<NScheme::TTypeId>& keyColTypes, + static bool FillUniformPartitioning(TVector<TString>& rangeEnds, ui32 keySize, NScheme::TTypeId firstKeyColType, + ui32 partitionCount, const NScheme::TTypeRegistry* typeRegistry, TString& errStr); + static bool FillSplitPartitioning(TVector<TString>& rangeEnds, const TConstArrayRef<NScheme::TTypeId>& keyColTypes, const ::google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary>& boundaries, - TString& errStr); + TString& errStr); TString FillAlterTableTxBody(TPathId tableId, TShardIdx shardIdx, TMessageSeqNo seqNo) const; TString FillBackupTxBody(TPathId pathId, const NKikimrSchemeOp::TBackupTask& task, ui32 shardNum, TMessageSeqNo seqNo) const; diff --git a/ydb/core/tx/schemeshard/ut_base.cpp b/ydb/core/tx/schemeshard/ut_base.cpp index a76dcf9d5bb..2c8922f28d8 100644 --- a/ydb/core/tx/schemeshard/ut_base.cpp +++ b/ydb/core/tx/schemeshard/ut_base.cpp @@ -2798,7 +2798,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TTestEnv env(runtime); ui64 txId = 123; - TString tableConfig = "Name: \"NilNoviSubLuna\"" + TString tableConfig = "Name: \"NilNoviSubLuna\"" "Columns { Name: \"key\" Type: \"Uint64\"}" "Columns { Name: \"value\" Type: \"Uint64\"}" "KeyColumnNames: [\"key\"]" @@ -3167,7 +3167,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { UNIT_ASSERT_VALUES_EQUAL(*(const ui32*)cells.GetCells()[0].Data(), val); }; - TVector<ui32> expectedBoundaries = {200, 4000}; + TVector<ui32> expectedBoundaries = {200, 4000}; TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable", true), {NLs::PartitionCount(expectedBoundaries.size()+1), @@ -3765,9 +3765,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TTestEnv env(runtime); ui64 txId = 100; - TSet<TString> cols = {"key1", "key2", "value"}; + TSet<TString> cols = {"key1", "key2", "value"}; TSet<TString> keyCol = {"key1", "key2"}; - TSet<TString> dropCols; + TSet<TString> dropCols; TestCreateTable(runtime, ++txId, "/MyRoot", R"(Name: "Table" @@ -4063,9 +4063,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TTestEnv env(runtime); ui64 txId = 100; - TSet<TString> cols = {"key1", "key2", "value"}; + TSet<TString> cols = {"key1", "key2", "value"}; TSet<TString> keyCol = {"key1", "key2"}; - TSet<TString> dropCols; + TSet<TString> dropCols; TestCreateTable(runtime, ++txId, "/MyRoot", R"(Name: "Table" @@ -6241,12 +6241,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TTestEnv env(runtime); ui64 txId = 1000; - TString tcfg1 = "Name: \"Table\"" + TString tcfg1 = "Name: \"Table\"" "Columns { Name: \"RowId\" Type: \"Uint64\"}" "Columns { Name: \"Value\" Type: \"Utf8\"}" "KeyColumnNames: [\"RowId\"]"; - TString tcfg2 = "Name: \"PartTable\"" + TString tcfg2 = "Name: \"PartTable\"" "Columns { Name: \"key1\" Type: \"Uint32\"}" "Columns { Name: \"key2\" Type: \"Utf8\"}" "Columns { Name: \"key3\" Type: \"Uint64\"}" @@ -6303,7 +6303,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TTestEnv env(runtime); ui64 txId = 1000; - TString tcfg = "Name: \"Table\"" + TString tcfg = "Name: \"Table\"" "Columns { Name: \"RowId\" Type: \"Uint64\"}" "Columns { Name: \"Value\" Type: \"Utf8\"}" "KeyColumnNames: [\"RowId\"]"; @@ -6333,22 +6333,22 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TTestEnv env(runtime); ui64 txId = 1000; - TString tableConfig = "Name: \"DropMeBaby\"" + TString tableConfig = "Name: \"DropMeBaby\"" "Columns { Name: \"RowId\" Type: \"Uint64\"}" "Columns { Name: \"Value\" Type: \"Utf8\"}" "KeyColumnNames: [\"RowId\"]"; - TString pqGroupConfig = "Name: \"DropMeBaby\"" + TString pqGroupConfig = "Name: \"DropMeBaby\"" "TotalGroupCount: 100 " "PartitionPerTablet: 10 " "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"; - TString pqGroupConfig1 = "Name: \"DropMeBaby\"" + TString pqGroupConfig1 = "Name: \"DropMeBaby\"" "TotalGroupCount: 2 " "PartitionPerTablet: 1 " "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"; - TString pqGroupAlter = "Name: \"DropMeBaby\"" + TString pqGroupAlter = "Name: \"DropMeBaby\"" "TotalGroupCount: 3 "; TestMkDir(runtime, ++txId, "/MyRoot", "Ops"); @@ -6455,12 +6455,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TTestEnv env(runtime); ui64 txId = 1000; - TString pqGroupConfig = "Name: \"Isolda\"" + TString pqGroupConfig = "Name: \"Isolda\"" "TotalGroupCount: 40 " "PartitionPerTablet: 10 " "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"; - TString pqGroupAlter = "Name: \"Isolda\"" + TString pqGroupAlter = "Name: \"Isolda\"" "TotalGroupCount: 100 "; Cdbg << "Create + Drop + Create" << Endl; @@ -6608,17 +6608,17 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { const TString basePath = "/MyRoot/A/B/C/D/I/F"; const TString pqPath = basePath + "/Isolda"; - TString pqGroupConfig = "Name: \"Isolda\"" + TString pqGroupConfig = "Name: \"Isolda\"" "TotalGroupCount: 1 " "PartitionPerTablet: 10 " "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"; - TString pqGroupBigConfig = "Name: \"Isolda\"" + TString pqGroupBigConfig = "Name: \"Isolda\"" "TotalGroupCount: 1000 " "PartitionPerTablet: 10 " "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"; - TString pqGroupBigAlter = "Name: \"Isolda\"" + TString pqGroupBigAlter = "Name: \"Isolda\"" "TotalGroupCount: 1000 "; AsyncMkDir(runtime, ++txId, "/MyRoot", "A"); @@ -6970,7 +6970,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { ui64 num = 500; ui64 txId = 123; - TSet<ui64> ids; + TSet<ui64> ids; for (ui32 id = 0; id < num; ++id) { AsyncMkDir(runtime, ++txId, "/MyRoot", Sprintf("Dir_%u", id)); @@ -7002,7 +7002,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { TSchemeLimits limits; TString path = "/MyRoot"; - TSet<ui64> ids; + TSet<ui64> ids; for (ui32 i = 1; i < limits.MaxDepth; ++i) { TString name = Sprintf("%u", i); TestMkDir(runtime, ++txId, path, name); @@ -7022,14 +7022,14 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { UNIT_ASSERT_VALUES_EQUAL_C(a.IsNull(), b.IsNull(), "NULL/not-NULL mismatch"); UNIT_ASSERT_VALUES_EQUAL_C(a.Size(), b.Size(), "size mismatch"); if (!a.IsNull()) { - TString aVal(a.Data(), a.Size()); - TString bVal(b.Data(), b.Size()); + TString aVal(a.Data(), a.Size()); + TString bVal(b.Data(), b.Size()); // Cdbg << aVal << Endl; UNIT_ASSERT_VALUES_EQUAL_C(aVal, bVal, "data mismatch"); } } - void TestSerializedCellVec(TVector<TCell>& cells) { + void TestSerializedCellVec(TVector<TCell>& cells) { TString serialized = TSerializedCellVec::Serialize(TArrayRef<const TCell>(cells)); UNIT_ASSERT_VALUES_EQUAL_C(cells.empty(), serialized.empty(), "Empty/non-empty mismatch"); TSerializedCellVec deserialized(serialized); @@ -7040,7 +7040,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) { } Y_UNIT_TEST(SerializedCellVec) { //+ - TVector<TCell> cells; + TVector<TCell> cells; TestSerializedCellVec(cells); for (size_t i = 0; i < 100; ++i) { diff --git a/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp b/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp index 6f999b268bb..6fda9c11800 100644 --- a/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp +++ b/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp @@ -320,7 +320,7 @@ namespace NSchemeShardUT_Private { } void TestCopyTable(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId, - const TString& dstPath, const TString& dstName, const TString& srcFullName, + const TString& dstPath, const TString& dstName, const TString& srcFullName, TEvSchemeShard::EStatus expectedResult) { AsyncCopyTable(runtime, schemeShardId, txId, dstPath, dstName, srcFullName); TestModificationResult(runtime, txId, expectedResult); @@ -332,7 +332,7 @@ namespace NSchemeShardUT_Private { TestCopyTable(runtime, TTestTxConfig::SchemeShard, txId, dstPath, dstName, srcFullName, expectedResult); } - TString TestDescribe(TTestActorRuntime& runtime, const TString& path) { + TString TestDescribe(TTestActorRuntime& runtime, const TString& path) { return TestLs(runtime, path, true); } @@ -1146,7 +1146,7 @@ namespace NSchemeShardUT_Private { } NKikimrProto::EReplyStatus LocalSchemeTx(TTestActorRuntime& runtime, ui64 tabletId, const TString& schemeChangesStr, bool dryRun, - NTabletFlatScheme::TSchemeChanges& scheme, TString& err) { + NTabletFlatScheme::TSchemeChanges& scheme, TString& err) { TActorId sender = runtime.AllocateEdgeActor(); auto evTx = new TEvTablet::TEvLocalSchemeTx; diff --git a/ydb/core/tx/time_cast/time_cast.h b/ydb/core/tx/time_cast/time_cast.h index 1202d5a7991..0f1c5126614 100644 --- a/ydb/core/tx/time_cast/time_cast.h +++ b/ydb/core/tx/time_cast/time_cast.h @@ -51,7 +51,7 @@ struct TEvMediatorTimecast { , ProcessingParams(processing) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvRegisterTablet"; str << " TabletId# " << TabletId; @@ -72,7 +72,7 @@ struct TEvMediatorTimecast { , Entry(entry) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvRegisterTabletResult"; str << " TabletId# " << TabletId; @@ -93,7 +93,7 @@ struct TEvMediatorTimecast { : TabletId(tabletId) {} - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvUnregisterTablet"; str << " TabletId# " << TabletId; @@ -147,7 +147,7 @@ struct TEvMediatorTimecast { Record.AddBucket(bucket); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvWatch"; for (size_t i = 0; i < Record.BucketSize(); ++i) { @@ -159,7 +159,7 @@ struct TEvMediatorTimecast { }; struct TEvUpdate : public TEventPB<TEvUpdate, NKikimrTxMediatorTimecast::TEvUpdate, EvUpdate> { - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvUpdate "; if (Record.HasMediator()) { diff --git a/ydb/core/tx/tx.h b/ydb/core/tx/tx.h index bacde442371..d8eceeaaf56 100644 --- a/ydb/core/tx/tx.h +++ b/ydb/core/tx/tx.h @@ -84,7 +84,7 @@ struct TExecLevelHierarchy { ui64 ReversedDomainMask; }; - TVector<TEntry> Entries; + TVector<TEntry> Entries; ui32 Select(ui64 mask) const { for (ui32 i = 0, e = Entries.size(); i != e; ++i) { diff --git a/ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp b/ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp index 95566493b6f..89295ecf082 100644 --- a/ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp +++ b/ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp @@ -4,7 +4,7 @@ namespace NTxAllocatorUT_Private { const TDuration TTestEnv::SimTimeOut = TDuration::Seconds(1u); -void CheckExpectedStatus(const TVector<TResultStatus> &expected, TResultStatus result) { +void CheckExpectedStatus(const TVector<TResultStatus> &expected, TResultStatus result) { bool isExpectedStatus = false; for (auto exp : expected) { Cerr << "expected " << exp <<'\n'; @@ -15,7 +15,7 @@ void CheckExpectedStatus(const TVector<TResultStatus> &expected, TResultStatus r } void CheckExpectedStatus(TResultStatus expected, TResultStatus result) { - const TVector<TResultStatus> temp = {expected}; + const TVector<TResultStatus> temp = {expected}; CheckExpectedStatus(temp, result); } @@ -44,7 +44,7 @@ void AsyncAllocate(NActors::TTestActorRuntime &runtime, ui64 size) { runtime.SendToPipe(TTestEnv::TxAllocatorTablet, sender, ev, 0, NKikimr::NTabletPipe::TClientConfig(), TActorId(), SomeCockie(size)); } -void AllocateAndCheck(NActors::TTestActorRuntime &runtime, ui64 size, const TVector<TResultStatus> &expected) { +void AllocateAndCheck(NActors::TTestActorRuntime &runtime, ui64 size, const TVector<TResultStatus> &expected) { AsyncAllocate(runtime, size); TAnswerWithCookie result = GrabAnswer(runtime); NKikimrTx::TEvTxAllocateResult &event = result.first; @@ -54,7 +54,7 @@ void AllocateAndCheck(NActors::TTestActorRuntime &runtime, ui64 size, const TVec } void AllocateAndCheck(NActors::TTestActorRuntime &runtime, ui64 size, TResultStatus expected) { - const TVector<TResultStatus> temp = {expected}; + const TVector<TResultStatus> temp = {expected}; AllocateAndCheck(runtime, size, temp); } diff --git a/ydb/core/tx/tx_allocator/txallocator_ut_helpers.h b/ydb/core/tx/tx_allocator/txallocator_ut_helpers.h index 1d90e633760..51ad3b28cb9 100644 --- a/ydb/core/tx/tx_allocator/txallocator_ut_helpers.h +++ b/ydb/core/tx/tx_allocator/txallocator_ut_helpers.h @@ -39,7 +39,7 @@ public: class TIntersectionChecker { private: typedef std::pair<ui64, ui64> TAllocation; - TVector<TAllocation> Responses; + TVector<TAllocation> Responses; public: void Add(ui64 begin, ui64 end) { @@ -50,13 +50,13 @@ public: }; typedef NKikimrTx::TEvTxAllocateResult::EStatus TResultStatus; - void CheckExpectedStatus(const TVector<TResultStatus> &expected, TResultStatus result); + void CheckExpectedStatus(const TVector<TResultStatus> &expected, TResultStatus result); void CheckExpectedStatus(TResultStatus expected, TResultStatus result); void CheckExpectedCookie(NKikimrTx::TEvTxAllocateResult result, ui64 cockie); typedef std::pair<NKikimrTx::TEvTxAllocateResult, ui64> TAnswerWithCookie; TAnswerWithCookie GrabAnswer(TTestActorRuntime &runtime); - void AllocateAndCheck(TTestActorRuntime &runtime, ui64 size, const TVector<TResultStatus> &expected); + void AllocateAndCheck(TTestActorRuntime &runtime, ui64 size, const TVector<TResultStatus> &expected); void AllocateAndCheck(TTestActorRuntime &runtime, ui64 size, TResultStatus expected); void AsyncAllocate(TTestActorRuntime &runtime, ui64 size); } diff --git a/ydb/core/tx/tx_processing.h b/ydb/core/tx/tx_processing.h index 72276c1af3d..f6658987120 100644 --- a/ydb/core/tx/tx_processing.h +++ b/ydb/core/tx/tx_processing.h @@ -40,7 +40,7 @@ struct TEvTxProcessing { Record.SetTabletID(tablet); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvPlanStep step# " << Record.GetStep(); str << " MediatorId# " << Record.GetMediatorID(); @@ -74,7 +74,7 @@ struct TEvTxProcessing { } } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvPlanStepAck TabletId# " << Record.GetTabletId(); str << " step# " << Record.GetStep(); @@ -96,7 +96,7 @@ struct TEvTxProcessing { Record.SetStep(step); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvPlanStepAccepted TabletId# " << Record.GetTabletId(); str << " step# " << Record.GetStep(); @@ -109,7 +109,7 @@ struct TEvTxProcessing { TEvReadSet() {} - TEvReadSet(ui64 step, ui64 orderId, ui64 tabletSource, ui64 tabletDest, ui64 tabletProducer, const TString &readSet, ui64 seqno = 0) + TEvReadSet(ui64 step, ui64 orderId, ui64 tabletSource, ui64 tabletDest, ui64 tabletProducer, const TString &readSet, ui64 seqno = 0) { Record.SetStep(step); Record.SetTxId(orderId); @@ -120,7 +120,7 @@ struct TEvTxProcessing { Record.SetSeqno(seqno); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvReadSet step# " << Record.GetStep(); str << " txid# " << Record.GetTxId(); @@ -161,7 +161,7 @@ struct TEvTxProcessing { Record.SetSeqno(evReadSet.Record.GetSeqno()); } - TString ToString() const { + TString ToString() const { TStringStream str; str << "{TEvReadSet step# " << Record.GetStep(); str << " txid# " << Record.GetTxId(); diff --git a/ydb/core/tx/tx_proxy/datareq.cpp b/ydb/core/tx/tx_proxy/datareq.cpp index af48b42d60f..9cb938c69b0 100644 --- a/ydb/core/tx/tx_proxy/datareq.cpp +++ b/ydb/core/tx/tx_proxy/datareq.cpp @@ -57,11 +57,11 @@ struct TFlatMKQLRequest : public TThrRefBase { NKikimrTxUserProxy::TMiniKQLTransaction::TLimits Limits; TRowVersion Snapshot = TRowVersion::Min(); - TMap<ui64, TAutoPtr<TBalanceCoverageBuilder>> BalanceCoverageBuilders; + TMap<ui64, TAutoPtr<TBalanceCoverageBuilder>> BalanceCoverageBuilders; NMiniKQL::IEngineFlat::EResult EngineResultStatusCode; NMiniKQL::IEngineFlat::EStatus EngineResponseStatus; - TString EngineResponse; + TString EngineResponse; NKikimrMiniKQL::TResult EngineEvaluatedResponse; TFlatMKQLRequest() @@ -92,7 +92,7 @@ public: void Initialize(bool ordered, TConstArrayRef<NScheme::TTypeId> keyTypes, const TTableRange &range); - const TVector<NScheme::TTypeId> &GetKeyTypes() { return KeyTypes; } + const TVector<NScheme::TTypeId> &GetKeyTypes() { return KeyTypes; } void AddRange(const NKikimrTx::TKeyRange &range, ui64 shard); bool IsFull() const; @@ -117,19 +117,19 @@ private: TRange &operator=(const TRange &other) = default; - TVector<ui64> Shards; + TVector<ui64> Shards; }; - using TRanges = TList<TRange>; + using TRanges = TList<TRange>; bool IsGreater(const TConstArrayRef<TCell> &lhs, const TConstArrayRef<TCell> &rhs) const; void TryToMergeRange(TRanges::iterator it); bool TryToMergeWithPrev(TRanges::iterator it); - TVector<NScheme::TTypeId> KeyTypes; + TVector<NScheme::TTypeId> KeyTypes; TSerializedTableRange SpaceRange; TRanges Ranges; bool OrderedQueue; - TQueue<ui64> ShardsQueue; + TQueue<ui64> ShardsQueue; TSerializedCellVec QueuePoint; }; @@ -143,7 +143,7 @@ struct TReadTableRequest : public TThrRefBase { TTableId TableId; bool Ordered; bool AllowDuplicates; - TVector<TTableColumnInfo> Columns; + TVector<TTableColumnInfo> Columns; NKikimrTxUserProxy::TKeyRange Range; TString ResponseData; ui64 ResponseDataFrom; @@ -310,12 +310,12 @@ private: TIntrusivePtr<TFlatMKQLRequest> FlatMKQLRequest; TIntrusivePtr<TReadTableRequest> ReadTableRequest; - TString DatashardErrors; - TVector<ui64> ComplainingDatashards; - TVector<TString> UnresolvedKeys; + TString DatashardErrors; + TVector<ui64> ComplainingDatashards; + TVector<TString> UnresolvedKeys; TAutoPtr<const NACLib::TUserToken> UserToken; - THashMap<ui64, TPerTablet> PerTablet; + THashMap<ui64, TPerTablet> PerTablet; NYql::TIssueManager IssueManager; TTablePathHashSet InvalidatedTables; ui64 TabletsLeft; // todo: add scale modifiers @@ -432,7 +432,7 @@ private: void ExtractDatashardErrors(const NKikimrTxDataShard::TEvProposeTransactionResult & record); void CancelProposal(ui64 exceptTablet); - void FailProposedRequest(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, TString errMsg, const TActorContext &ctx); + void FailProposedRequest(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, TString errMsg, const TActorContext &ctx); void SendStreamClearanceResponse(ui64 shard, bool cleared, const TActorContext &ctx); void ProcessNextStreamClearance(bool cleared, const TActorContext &ctx); @@ -469,11 +469,11 @@ public: , ResultsReceivedCount(0) , ResultsReceivedSize(0) , RequestControls(requestControls) - , WallClockAccepted(TInstant::MicroSeconds(0)) - , WallClockResolveStarted(TInstant::MicroSeconds(0)) - , WallClockResolved(TInstant::MicroSeconds(0)) - , WallClockPrepared(TInstant::MicroSeconds(0)) - , WallClockPlanned(TInstant::MicroSeconds(0)) + , WallClockAccepted(TInstant::MicroSeconds(0)) + , WallClockResolveStarted(TInstant::MicroSeconds(0)) + , WallClockResolved(TInstant::MicroSeconds(0)) + , WallClockPrepared(TInstant::MicroSeconds(0)) + , WallClockPlanned(TInstant::MicroSeconds(0)) , TxProxyMon(mon) { ++*TxProxyMon->DataReqInFly; @@ -994,7 +994,7 @@ void TDataReq::ProcessFlatMKQLResolve(NSchemeCache::TSchemeCacheRequest *cacheRe dataTransaction.SetLlvmRuntime(true); if (FlatMKQLRequest->PerShardKeysSizeLimitBytes) dataTransaction.SetPerShardKeysSizeLimitBytes(*FlatMKQLRequest->PerShardKeysSizeLimitBytes); - const TString transactionBuffer = dataTransaction.SerializeAsString(); + const TString transactionBuffer = dataTransaction.SerializeAsString(); if (transactionBuffer.size() > MaxDatashardProgramSize) { TString error = TStringBuilder() << "Datashard program size limit exceeded (" @@ -1322,8 +1322,8 @@ void TDataReq::Handle(TEvTxProxyReq::TEvMakeRequest::TPtr &ev, const TActorConte FlatMKQLRequest->Engine = NMiniKQL::CreateEngineFlat(settings); FlatMKQLRequest->Engine->SetStepTxId({ 0, TxId }); - TString program = mkqlTxBody.GetProgram().GetBin(); - TString params = mkqlTxBody.GetParams().GetBin(); + TString program = mkqlTxBody.GetProgram().GetBin(); + TString params = mkqlTxBody.GetParams().GetBin(); resolveReq = PrepareFlatMKQLRequest(program, params, ctx); FlatMKQLRequest->RequestAdditionResults(TxId); @@ -1399,7 +1399,7 @@ void TDataReq::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, Y_VERIFY(ReadTableRequest); bool projection = !ReadTableRequest->Columns.empty(); - TMap<TString, size_t> colNames; + TMap<TString, size_t> colNames; for (size_t i = 0; i < ReadTableRequest->Columns.size(); ++i) { auto &col = ReadTableRequest->Columns[i]; if (colNames.contains(col.Name)) { @@ -1426,8 +1426,8 @@ void TDataReq::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, return Die(ctx); } - TVector<NScheme::TTypeId> keyColumnTypes(res.Columns.size()); - TVector<TKeyDesc::TColumnOp> columns(res.Columns.size()); + TVector<NScheme::TTypeId> keyColumnTypes(res.Columns.size()); + TVector<TKeyDesc::TColumnOp> columns(res.Columns.size()); size_t keySize = 0; size_t no = 0; @@ -1958,7 +1958,7 @@ void TDataReq::CancelProposal(ui64 exceptTablet) { } void TDataReq::ExtractDatashardErrors(const NKikimrTxDataShard::TEvProposeTransactionResult & record) { - TString allErrors; + TString allErrors; for (const auto &er : record.GetError()) { allErrors += Sprintf("[%s] %s\n", NKikimrTxDataShard::TError_EKind_Name(er.GetKind()).data(), er.GetReason().data()); } @@ -2741,7 +2741,7 @@ ui64 TDataReq::SelectCoordinator(NSchemeCache::TSchemeCacheRequest &cacheRequest return 0; } -void TDataReq::FailProposedRequest(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, TString errMsg, const TActorContext &ctx) { +void TDataReq::FailProposedRequest(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, TString errMsg, const TActorContext &ctx) { LOG_ERROR_S_SAMPLED_BY(ctx, NKikimrServices::TX_PROXY, TxId, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId << " FailProposedRequest: " << errMsg << " Status# " << status); @@ -2781,7 +2781,7 @@ void TDataReq::RegisterPlan(const TActorContext &ctx) { Y_VERIFY(domainsInfo); ui64 totalReadSize = 0; - TSet<ui32> affectedDomains; + TSet<ui32> affectedDomains; for (const auto &xp : PerTablet) { const ui32 tabletDomain = domainsInfo->GetDomainUidByTabletId(xp.first); Y_VERIFY(tabletDomain != Max<ui32>()); @@ -2937,7 +2937,7 @@ bool TDataReq::ParseRangeKey(const NKikimrMiniKQL::TParams &proto, TSerializedCellVec &buf, EParseRangeKeyExp exp) { - TVector<TCell> key; + TVector<TCell> key; if (proto.HasValue()) { if (!proto.HasType()) { UnresolvedKeys.push_back("No type was specified in the range key tuple"); diff --git a/ydb/core/tx/tx_proxy/describe.cpp b/ydb/core/tx/tx_proxy/describe.cpp index deb38ca2b7d..fc736183ec6 100644 --- a/ydb/core/tx/tx_proxy/describe.cpp +++ b/ydb/core/tx/tx_proxy/describe.cpp @@ -27,7 +27,7 @@ class TDescribeReq : public TActor<TDescribeReq> { TAutoPtr<const NACLib::TUserToken> UserToken; - TString TextPath; + TString TextPath; void Die(const TActorContext &ctx) override { --*TxProxyMon->NavigateReqInFly; diff --git a/ydb/core/tx/tx_proxy/proxy.cpp b/ydb/core/tx/tx_proxy/proxy.cpp index 55962e7d06f..4df5e4a839b 100644 --- a/ydb/core/tx/tx_proxy/proxy.cpp +++ b/ydb/core/tx/tx_proxy/proxy.cpp @@ -9,7 +9,7 @@ TActorId MakeTxProxyID() { } -TString NKikimr::TEvTxUserProxy::TEvProposeTransactionStatus::ToString() const { +TString NKikimr::TEvTxUserProxy::TEvProposeTransactionStatus::ToString() const { TStringStream str; str << "{TEvProposeTransactionStatus"; // Transaction diff --git a/ydb/core/tx/tx_proxy/proxy.h b/ydb/core/tx/tx_proxy/proxy.h index 86d4f1ac79e..646127f05a3 100644 --- a/ydb/core/tx/tx_proxy/proxy.h +++ b/ydb/core/tx/tx_proxy/proxy.h @@ -158,7 +158,7 @@ struct TEvTxUserProxy { return static_cast<EStatus>(Record.GetStatus()); } - TString ToString() const; + TString ToString() const; }; struct TEvInvalidateTable : public TEventPB<TEvInvalidateTable, NKikimrTxUserProxy::TEvInvalidateTable, EvInvalidateTable> { @@ -310,7 +310,7 @@ namespace NTxProxy { IActor* CreateTxProxyCommitWritesReq(const TTxProxyServices &services, const ui64 txid, TEvTxUserProxy::TEvProposeTransaction::TPtr&& ev, const TIntrusivePtr<TTxProxyMon>& mon); } -IActor* CreateTxProxy(const TVector<ui64> &allocators); +IActor* CreateTxProxy(const TVector<ui64> &allocators); TActorId MakeTxProxyID(); } diff --git a/ydb/core/tx/tx_proxy/proxy_impl.cpp b/ydb/core/tx/tx_proxy/proxy_impl.cpp index 20dc8cce176..f72d7bc70ac 100644 --- a/ydb/core/tx/tx_proxy/proxy_impl.cpp +++ b/ydb/core/tx/tx_proxy/proxy_impl.cpp @@ -34,12 +34,12 @@ struct TDelayedQueue { } }; typedef TAutoPtr<TRequest> TRequestPtr; - typedef TOneOneQueueInplace<TRequest*, 64> TQueueType; - typedef TAutoPtr<TQueueType, typename TQueueType::TPtrCleanDestructor> TSafeQueue; + typedef TOneOneQueueInplace<TRequest*, 64> TQueueType; + typedef TAutoPtr<TQueueType, typename TQueueType::TPtrCleanDestructor> TSafeQueue; TSafeQueue Queue; TDelayedQueue() - : Queue(new TQueueType()) + : Queue(new TQueueType()) {} }; @@ -490,7 +490,7 @@ const TDuration TTxProxy::TimeoutDelayedRequest = TDuration::Seconds(15); } -IActor* CreateTxProxy(const TVector<ui64> &allocators) { +IActor* CreateTxProxy(const TVector<ui64> &allocators) { return new NTxProxy::TTxProxy(allocators); } diff --git a/ydb/core/util/blob_data_stream.h b/ydb/core/util/blob_data_stream.h index dac5c0234bd..cf741cea8c5 100644 --- a/ydb/core/util/blob_data_stream.h +++ b/ydb/core/util/blob_data_stream.h @@ -42,7 +42,7 @@ public: // TFlatBlobDataOutputStream() {} - TFlatBlobDataOutputStream(TString bufferToGrab) + TFlatBlobDataOutputStream(TString bufferToGrab) : Buffer(bufferToGrab) {} ~TFlatBlobDataOutputStream() {} @@ -74,7 +74,7 @@ public: return TStringBuf(Buffer.data(), Buffer.size()); } - const TString& GetBuffer() const { + const TString& GetBuffer() const { return Buffer; } @@ -152,7 +152,7 @@ public: private: // - TString Buffer; + TString Buffer; }; //////////////////////////////////////////// diff --git a/ydb/core/util/cache.h b/ydb/core/util/cache.h index 916701ebc71..195b22f3224 100644 --- a/ydb/core/util/cache.h +++ b/ydb/core/util/cache.h @@ -401,9 +401,9 @@ private: }; template <typename TKey, typename TValue, typename TStatisticsPolicy = TDefaultStatisticsPolicy> -class TUnboundedCacheOnMap : public TUnboundedCacheBase<TKey, TValue, TMap<TKey, TValue>, TStatisticsPolicy> { +class TUnboundedCacheOnMap : public TUnboundedCacheBase<TKey, TValue, TMap<TKey, TValue>, TStatisticsPolicy> { public: - using TBase = TUnboundedCacheBase<TKey, TValue, TMap<TKey, TValue>, TStatisticsPolicy>; + using TBase = TUnboundedCacheBase<TKey, TValue, TMap<TKey, TValue>, TStatisticsPolicy>; using TMeasureCallback = typename TBase::TMeasureCallback; TUnboundedCacheOnMap() {} @@ -414,9 +414,9 @@ public: }; template <typename TKey, typename TValue, typename TKeyHash = ::THash<TKey>, typename TStatisticsPolicy = TDefaultStatisticsPolicy> -class TUnboundedCacheOnHash : public TUnboundedCacheBase<TKey, TValue, THashMap<TKey, TValue, TKeyHash>, TStatisticsPolicy> { +class TUnboundedCacheOnHash : public TUnboundedCacheBase<TKey, TValue, THashMap<TKey, TValue, TKeyHash>, TStatisticsPolicy> { public: - using TBase = TUnboundedCacheBase<TKey, TValue, THashMap<TKey, TValue, TKeyHash>, TStatisticsPolicy>; + using TBase = TUnboundedCacheBase<TKey, TValue, THashMap<TKey, TValue, TKeyHash>, TStatisticsPolicy>; using TMeasureCallback = typename TBase::TMeasureCallback; TUnboundedCacheOnHash() {} @@ -493,8 +493,8 @@ public: }; }; - typedef TIntrusiveList<TItem> TListType; - typedef THashSet<TItem, typename TItem::THash> TIndex; + typedef TIntrusiveList<TItem> TListType; + typedef THashSet<TItem, typename TItem::THash> TIndex; bool DoFind(const TKey& key, TValue*& value) { TItem tmpItem(key); @@ -570,7 +570,7 @@ private: } private: - TListType List; + TListType List; TIndex Index; }; @@ -592,7 +592,7 @@ public: typedef T2QCache<TKey, TValue, TKeyHash, TStatisticsPolicy> TSelf; typedef typename TBase::TMeasureCallback TMeasureCallback; typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TItem TItem; - typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TListType TListType; + typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TListType TListType; typedef typename TLruCache<TKey, TValue, TKeyHash, TStatisticsPolicy>::TIndex TIndex; struct TItemKey : public TIntrusiveListItem <TItemKey> { @@ -623,7 +623,7 @@ public: }; typedef TIntrusiveList<TItemKey> TKeyList; - typedef THashSet<TItemKey, typename TItemKey::THash> TKeyIndex; + typedef THashSet<TItemKey, typename TItemKey::THash> TKeyIndex; explicit T2QCache(const TIntrusivePtr<T2QCacheConfig>& config) : T2QCache(config, &TBase::DefaultMeasureCallback) @@ -797,9 +797,9 @@ private: private: const TIntrusivePtr<T2QCacheConfig> Config; TIndex MainIndex; - TListType MainList; + TListType MainList; TIndex InIndex; - TListType InList; + TListType InList; ui64 InSize; TKeyIndex OutIndex; TKeyList OutList; diff --git a/ydb/core/util/cache_ut.cpp b/ydb/core/util/cache_ut.cpp index 1cc902e089e..41c315d16b8 100644 --- a/ydb/core/util/cache_ut.cpp +++ b/ydb/core/util/cache_ut.cpp @@ -25,8 +25,8 @@ ui64 TDtorTracer::InstanceCount = 0; Y_UNIT_TEST_SUITE(TCacheTest) { Y_UNIT_TEST(TestUnboundedMapCache) { - TUnboundedCacheOnMap<ui32, TString> cache; - TString* tmp; + TUnboundedCacheOnMap<ui32, TString> cache; + TString* tmp; UNIT_ASSERT_EQUAL(cache.GetCount(), 0); UNIT_ASSERT(!cache.Find(1, tmp)); UNIT_ASSERT(!cache.FindWithoutPromote(1, tmp)); @@ -79,10 +79,10 @@ Y_UNIT_TEST_SUITE(TCacheTest) { } Y_UNIT_TEST(TestSizeBasedOverflowCallback) { - TUnboundedCacheOnMap<ui32, TString> cache; - TSizeBasedOverflowCallback<ui32, TString> overflowCallback(2); - cache.SetOverflowCallback([&](const ICache<ui32, TString>& cache) { return overflowCallback(cache); }); - TString* tmp; + TUnboundedCacheOnMap<ui32, TString> cache; + TSizeBasedOverflowCallback<ui32, TString> overflowCallback(2); + cache.SetOverflowCallback([&](const ICache<ui32, TString>& cache) { return overflowCallback(cache); }); + TString* tmp; cache.Insert(1, "a", tmp); UNIT_ASSERT(!cache.IsOverflow()); cache.Insert(2, "b", tmp); @@ -96,10 +96,10 @@ Y_UNIT_TEST_SUITE(TCacheTest) { } Y_UNIT_TEST(TestLruCache) { - TLruCache<ui32, TString> cache; - TString* tmp; - TSizeBasedOverflowCallback<ui32, TString> overflowCallback(2); - cache.SetOverflowCallback([&](const ICache<ui32, TString>& cache) { return overflowCallback(cache); }); + TLruCache<ui32, TString> cache; + TString* tmp; + TSizeBasedOverflowCallback<ui32, TString> overflowCallback(2); + cache.SetOverflowCallback([&](const ICache<ui32, TString>& cache) { return overflowCallback(cache); }); UNIT_ASSERT(cache.Insert(1, "a", tmp)); UNIT_ASSERT(cache.Insert(2, "b", tmp)); UNIT_ASSERT_EQUAL(cache.GetUsedSize(), 2); @@ -146,9 +146,9 @@ Y_UNIT_TEST_SUITE(TCacheTest) { Y_UNIT_TEST(Test2QCache) { TIntrusivePtr<T2QCacheConfig> config(new T2QCacheConfig); - T2QCache<ui32, TString> cache(config); - TString lastEvicted; - cache.SetEvictionCallback([&](const ui32& key, TString& value, ui64 size){ + T2QCache<ui32, TString> cache(config); + TString lastEvicted; + cache.SetEvictionCallback([&](const ui32& key, TString& value, ui64 size){ Y_UNUSED(key); Y_UNUSED(size); lastEvicted = value; @@ -159,9 +159,9 @@ Y_UNIT_TEST_SUITE(TCacheTest) { lastEvictedKey = key; }); - TString* tmp; - TSizeBasedOverflowCallback<ui32, TString> overflowCallback(4); - cache.SetOverflowCallback([&](const ICache<ui32, TString>& cache) { return overflowCallback(cache); }); + TString* tmp; + TSizeBasedOverflowCallback<ui32, TString> overflowCallback(4); + cache.SetOverflowCallback([&](const ICache<ui32, TString>& cache) { return overflowCallback(cache); }); UNIT_ASSERT(cache.Insert(1, "a", tmp)); UNIT_ASSERT(!cache.Insert(1, "a", tmp)); UNIT_ASSERT(cache.Insert(2, "b", tmp)); @@ -251,12 +251,12 @@ Y_UNIT_TEST_SUITE(TCacheTest) { } Y_UNIT_TEST(TestUpdateItemSize) { - TUnboundedCacheOnMap<ui32, TString> cache([](const ui32& key, const TString& value) { + TUnboundedCacheOnMap<ui32, TString> cache([](const ui32& key, const TString& value) { Y_UNUSED(key); return value.size(); }); - TString* tmp; + TString* tmp; ui32 key1 = 1; ui32 key2 = 2; UNIT_ASSERT_EQUAL(cache.GetCount(), 0); diff --git a/ydb/core/util/defs.h b/ydb/core/util/defs.h index 77c876c9c13..03c12bd1041 100644 --- a/ydb/core/util/defs.h +++ b/ydb/core/util/defs.h @@ -10,7 +10,7 @@ #include <util/generic/bt_exception.h> #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> #include <util/system/atomic.h> #include <util/system/align.h> diff --git a/ydb/core/util/failure_injection.cpp b/ydb/core/util/failure_injection.cpp index 9eeaaa968ba..fe699a8f77c 100644 --- a/ydb/core/util/failure_injection.cpp +++ b/ydb/core/util/failure_injection.cpp @@ -18,16 +18,16 @@ namespace NKikimr { class TFailureInjectionManager { struct TFailureQueueItem { - TString Name; + TString Name; TMaybe<TParams> Params; ui32 HitCount; }; - TDeque<TFailureQueueItem> FailureQ; + TDeque<TFailureQueueItem> FailureQ; TMutex Mutex; volatile bool Committed = false; public: - void Inject(const TString& name, const TParams& params) { + void Inject(const TString& name, const TParams& params) { if (Committed) { with_lock (Mutex) { if (FailureQ) { @@ -43,7 +43,7 @@ namespace NKikimr { } } - void EnqueueFailureItem(const TString& name, const TMaybe<TParams>& params, ui32 hitCount = 1) { + void EnqueueFailureItem(const TString& name, const TMaybe<TParams>& params, ui32 hitCount = 1) { with_lock (Mutex) { FailureQ.push_back(TFailureQueueItem{name, params, hitCount}); } @@ -96,10 +96,10 @@ namespace NKikimr { class TTraceActionExecutor : public TCustomActionExecutor { TFailureInjectionManager *Manager = nullptr; - TString Name; + TString Name; public: - TTraceActionExecutor(TProbe *probe, TFailureInjectionManager *manager, TString name) + TTraceActionExecutor(TProbe *probe, TFailureInjectionManager *manager, TString name) : TCustomActionExecutor(probe, true /*destructive*/) , Manager(manager) , Name(std::move(name)) @@ -114,7 +114,7 @@ namespace NKikimr { class TFailureInjectionActor : public TActorBootstrapped<TFailureInjectionActor> { TManager TraceManager; - TVector<TString> Probes; + TVector<TString> Probes; TFailureInjectionManager Manager; bool Enabled = false; @@ -129,9 +129,9 @@ namespace NKikimr { void Bootstrap(const TActorContext& /*ctx*/) { struct TCallback { - TVector<TString>& Probes; + TVector<TString>& Probes; - TCallback(TVector<TString>& probes) + TCallback(TVector<TString>& probes) : Probes(probes) {} @@ -151,8 +151,8 @@ namespace NKikimr { void Enable() { if (!Enabled) { TQuery query; - for (const TString& name : Probes) { - TString actionName = "FailureInjection_" + name; + for (const TString& name : Probes) { + TString actionName = "FailureInjection_" + name; auto& block = *query.AddBlocks(); auto& desc = *block.MutableProbeDesc(); @@ -184,16 +184,16 @@ namespace NKikimr { const auto& params = ev->Get()->Request.GetParams(); if (params.Has("queue")) { - TString queue = params.Get("queue"); + TString queue = params.Get("queue"); if (queue) { ProcessQueue(str, queue); } } if (params.Has("probe")) { - TString probe = params.Get("probe"); + TString probe = params.Get("probe"); if (probe) { try { - TString hc = params.Has("hitcount") ? params.Get("hitcount") : TString(); + TString hc = params.Has("hitcount") ? params.Get("hitcount") : TString(); ui32 hitCount = hc ? FromString<ui32>(hc) : 1; Manager.EnqueueFailureItem(probe, {}, hitCount); } catch (const yexception& ex) { @@ -221,7 +221,7 @@ namespace NKikimr { } DIV_CLASS("controls") { str << "<select id=\"probe\" name=\"probe\">"; - for (const TString& probe : Probes) { + for (const TString& probe : Probes) { str << "<option value=\"" << probe << "\">" << probe << "</option>"; } str << "</select>"; @@ -252,12 +252,12 @@ namespace NKikimr { } void ProcessQueue(IOutputStream& str, const TString& queue) { - TVector<std::tuple<TString, TMaybe<TParams>, ui32>> items; + TVector<std::tuple<TString, TMaybe<TParams>, ui32>> items; HTML(str) { size_t pos = 0; for (;;) { - TString probe; + TString probe; for (; pos < queue.size() && queue[pos] != ';' && queue[pos] != '#'; ++pos) { probe.append(queue[pos]); } diff --git a/ydb/core/util/fragmented_buffer.cpp b/ydb/core/util/fragmented_buffer.cpp index 6da04399b60..3c93dec8010 100644 --- a/ydb/core/util/fragmented_buffer.cpp +++ b/ydb/core/util/fragmented_buffer.cpp @@ -106,7 +106,7 @@ void TFragmentedBuffer::Read(i32 begin, char* buffer, i32 size) const { } } -TString TFragmentedBuffer::Print() const { +TString TFragmentedBuffer::Print() const { TStringStream str; str << "{"; for (auto it = BufferForOffset.begin(); it != BufferForOffset.end(); it++) { diff --git a/ydb/core/util/fragmented_buffer.h b/ydb/core/util/fragmented_buffer.h index 0e7ce9f8425..36faf477168 100644 --- a/ydb/core/util/fragmented_buffer.h +++ b/ydb/core/util/fragmented_buffer.h @@ -19,7 +19,7 @@ public: void Write(i32 begin, const char* buffer, i32 size); void Read(i32 begin, char* buffer, i32 size) const; - TString Print() const; + TString Print() const; std::pair<const char*, i32> Get(i32 begin) const; void CopyFrom(const TFragmentedBuffer& from, const TIntervalSet<i32>& range); diff --git a/ydb/core/util/interval_set_ut.cpp b/ydb/core/util/interval_set_ut.cpp index c1df7015fd1..5c097e9705f 100644 --- a/ydb/core/util/interval_set_ut.cpp +++ b/ydb/core/util/interval_set_ut.cpp @@ -212,7 +212,7 @@ Y_UNIT_TEST_SUITE(TIntervalSetTest) { sets.emplace_back(50, 80); sets.emplace_back(90, 100); - TVector<ui32> counters; + TVector<ui32> counters; counters.resize(sets.size() * 2 / 3); for (ui32 i = 0; i < counters.size(); ++i) { counters[i] = 0; diff --git a/ydb/core/util/intrusive_fixed_hash_set.h b/ydb/core/util/intrusive_fixed_hash_set.h index 09a255b7d6e..c143d1cc355 100644 --- a/ydb/core/util/intrusive_fixed_hash_set.h +++ b/ydb/core/util/intrusive_fixed_hash_set.h @@ -16,7 +16,7 @@ namespace NKikimr { template <class T, T* T::*N, ui64 (*H)(const T&), bool (*E)(const T&, const T&)> class TIntrusiveFixedHashSet { - TVector<T*> Table; + TVector<T*> Table; public: TIntrusiveFixedHashSet(ui64 size) { Table.resize(size, nullptr); diff --git a/ydb/core/util/intrusive_fixed_hash_set_ut.cpp b/ydb/core/util/intrusive_fixed_hash_set_ut.cpp index 434aca6b9b6..edd09e12a35 100644 --- a/ydb/core/util/intrusive_fixed_hash_set_ut.cpp +++ b/ydb/core/util/intrusive_fixed_hash_set_ut.cpp @@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(TIntrusiveFixedHashSetTest) { Y_UNIT_TEST(TestPushFindClear) { TIntrusiveFixedHashSet<TSimpleItem, &TSimpleItem::Next, &TSimpleItem::Hash, &TSimpleItem::Equals> set(100); - TDeque<TSimpleItem> items; + TDeque<TSimpleItem> items; for (ui64 i = 0; i < 100; ++i) { items.emplace_back(i /2, i); set.Push(&items.back()); diff --git a/ydb/core/util/intrusive_stack_ut.cpp b/ydb/core/util/intrusive_stack_ut.cpp index 61e544b4adf..41b198a0469 100644 --- a/ydb/core/util/intrusive_stack_ut.cpp +++ b/ydb/core/util/intrusive_stack_ut.cpp @@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(TIntrusiveStackTest) { Y_UNIT_TEST(TestPushPop) { TIntrusiveStack<TSimpleItem, &TSimpleItem::Next> stack; - TVector<TSimpleItem> items; + TVector<TSimpleItem> items; items.resize(100); for (i64 i = 0; i < 100; ++i) { stack.Push(&items[i]); diff --git a/ydb/core/util/metrics.h b/ydb/core/util/metrics.h index cae931733fa..ea825a2f3c1 100644 --- a/ydb/core/util/metrics.h +++ b/ydb/core/util/metrics.h @@ -84,7 +84,7 @@ public: LastUpdate = FirstUpdate = to; return; } else { - from = TInstant::MicroSeconds(std::max(LastUpdate.GetValue(), to.GetValue() - (DurationToStore - BUCKET_DURATION))); + from = TInstant::MicroSeconds(std::max(LastUpdate.GetValue(), to.GetValue() - (DurationToStore - BUCKET_DURATION))); } int bucketFrom = TimeToBucket(from); if (bucketFrom == bucketTo) { @@ -103,12 +103,12 @@ public: if (FirstUpdate == TInstant()) { FirstUpdate = to; } else { - FirstUpdate = TInstant::MicroSeconds(std::max(FirstUpdate.GetValue(), to.GetValue() - GetBucketSizeTo(to) - (DurationToStore - BUCKET_DURATION))); + FirstUpdate = TInstant::MicroSeconds(std::max(FirstUpdate.GetValue(), to.GetValue() - GetBucketSizeTo(to) - (DurationToStore - BUCKET_DURATION))); } } TDuration GetStoredDuration() const { - return TDuration::MicroSeconds(LastUpdate.GetValue() - FirstUpdate.GetValue()); + return TDuration::MicroSeconds(LastUpdate.GetValue() - FirstUpdate.GetValue()); } ValueType GetValueAveragePerDuration(TDuration duration) const { diff --git a/ydb/core/util/pb.h b/ydb/core/util/pb.h index 81bf964f214..5350fe3495d 100644 --- a/ydb/core/util/pb.h +++ b/ydb/core/util/pb.h @@ -11,7 +11,7 @@ namespace NKikimr { template<typename T> bool ParsePBFromFile(const TString &path, T *pb, bool allowUnknown = false) { TAutoPtr<TMappedFileInput> fileInput(new TMappedFileInput(path)); - const TString content = fileInput->ReadAll(); + const TString content = fileInput->ReadAll(); if (!allowUnknown) return ::google::protobuf::TextFormat::ParseFromString(content, pb); @@ -21,9 +21,9 @@ bool ParsePBFromFile(const TString &path, T *pb, bool allowUnknown = false) { } template<typename T> -bool ParseBinPBFromFile(const TString &path, T *pb) { +bool ParseBinPBFromFile(const TString &path, T *pb) { TAutoPtr<TMappedFileInput> fileInput(new TMappedFileInput(path)); - const TString content = fileInput->ReadAll(); + const TString content = fileInput->ReadAll(); const bool ok = pb->ParseFromString(content); return ok; } diff --git a/ydb/core/util/queue_inplace_ut.cpp b/ydb/core/util/queue_inplace_ut.cpp index fb2d511d048..5175e6ad57a 100644 --- a/ydb/core/util/queue_inplace_ut.cpp +++ b/ydb/core/util/queue_inplace_ut.cpp @@ -28,8 +28,8 @@ Y_UNIT_TEST_SUITE(TQueueInplaceTests) { }; Y_UNIT_TEST(TestSimpleInplace) { - using TQueueType = TQueueInplace<TStruct, 32>; // 3 values per chunk - TQueueType queue; + using TQueueType = TQueueInplace<TStruct, 32>; // 3 values per chunk + TQueueType queue; UNIT_ASSERT(queue.Head() == nullptr); @@ -60,7 +60,7 @@ Y_UNIT_TEST_SUITE(TQueueInplaceTests) { UNIT_ASSERT_VALUES_EQUAL(1u, p.use_count()); { - TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> queue(new TQueueType()); + TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> queue(new TQueueType()); queue->Push(new std::shared_ptr<bool>(p)); queue->Push(new std::shared_ptr<bool>(p)); queue->Push(new std::shared_ptr<bool>(p)); diff --git a/ydb/core/util/queue_oneone_inplace_ut.cpp b/ydb/core/util/queue_oneone_inplace_ut.cpp index ac60a69f3dd..504feac585f 100644 --- a/ydb/core/util/queue_oneone_inplace_ut.cpp +++ b/ydb/core/util/queue_oneone_inplace_ut.cpp @@ -9,8 +9,8 @@ Y_UNIT_TEST_SUITE(TOneOneQueueTests) { Y_UNIT_TEST(TestSimpleEnqueueDequeue) { - using TQueueType = TOneOneQueueInplace<ui64, 32>; // 3 values per chunk - TQueueType queue; + using TQueueType = TOneOneQueueInplace<ui64, 32>; // 3 values per chunk + TQueueType queue; UNIT_ASSERT(queue.Pop() == 0); UNIT_ASSERT(queue.Head() == 0); @@ -43,7 +43,7 @@ Y_UNIT_TEST_SUITE(TOneOneQueueTests) { UNIT_ASSERT_VALUES_EQUAL(1u, p.use_count()); { - TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> queue(new TQueueType()); + TAutoPtr<TQueueType, TQueueType::TPtrCleanDestructor> queue(new TQueueType()); queue->Push(new std::shared_ptr<bool>(p)); queue->Push(new std::shared_ptr<bool>(p)); queue->Push(new std::shared_ptr<bool>(p)); @@ -56,8 +56,8 @@ Y_UNIT_TEST_SUITE(TOneOneQueueTests) { } Y_UNIT_TEST(ReadIterator) { - using TQueueType = TOneOneQueueInplace<int, 32>; - TQueueType queue; + using TQueueType = TOneOneQueueInplace<int, 32>; + TQueueType queue; queue.Push(10); queue.Push(11); diff --git a/ydb/core/util/throughput_meter.h b/ydb/core/util/throughput_meter.h index 935dae21783..f23e9c3d361 100644 --- a/ydb/core/util/throughput_meter.h +++ b/ydb/core/util/throughput_meter.h @@ -9,17 +9,17 @@ namespace NKikimr { { const ui64 UpdateDivisionFactor; const ui64 WindowUpdateTimeoutNs; - TVector<std::pair<float, NMonitoring::TDynamicCounters::TCounterPtr>> Counters; + TVector<std::pair<float, NMonitoring::TDynamicCounters::TCounterPtr>> Counters; ui64 CumTimeNs = 0; ui64 CumBytes = 0; THPTimer Timer; ui64 WindowNs = 0; - TVector<ui64> Histogram; + TVector<ui64> Histogram; public: TThroughputMeter(ui64 updateDivisionFactor, const TIntrusivePtr<NMonitoring::TDynamicCounters>& counters, - const TString& group, const TString& subgroup, const TString& name, const TVector<float>& thresholds, + const TString& group, const TString& subgroup, const TString& name, const TVector<float>& thresholds, const TDuration& windowUpdateTimeout = TDuration::MilliSeconds(10)) : UpdateDivisionFactor(updateDivisionFactor) , WindowUpdateTimeoutNs(windowUpdateTimeout.NanoSeconds()) diff --git a/ydb/core/viewer/browse.h b/ydb/core/viewer/browse.h index c5716f46a76..d45dd8e7c53 100644 --- a/ydb/core/viewer/browse.h +++ b/ydb/core/viewer/browse.h @@ -375,20 +375,20 @@ protected: using TBase = TActorBootstrapped<TBrowseTabletsCommon>; TActorId Owner; THashMap<TTabletId, TActorId> PipeClients; - TSet<TString> Consumers; - TVector<ui64> Tablets; + TSet<TString> Consumers; + TVector<ui64> Tablets; ui32 Requests = 0; ui32 Responses = 0; THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult; TString Path; IViewer::TBrowseContext BrowseContext; - TMap<TTabletId, THolder<TEvTablet::TEvGetCountersResponse>> TabletCountersResults; - THashMap<ui32, THolder<NKikimrBlobStorage::TEvResponseBSControllerInfo::TBSGroupInfo>> GroupInfo; - THashSet<ui32> ErasureSpecies; - THashSet<ui64> PDiskCategories; - THashSet<ui64> VDiskCategories; - THashSet<TNodeId> Nodes; - THashSet<ui32> PDisks; + TMap<TTabletId, THolder<TEvTablet::TEvGetCountersResponse>> TabletCountersResults; + THashMap<ui32, THolder<NKikimrBlobStorage::TEvResponseBSControllerInfo::TBSGroupInfo>> GroupInfo; + THashSet<ui32> ErasureSpecies; + THashSet<ui64> PDiskCategories; + THashSet<ui64> VDiskCategories; + THashSet<TNodeId> Nodes; + THashSet<ui32> PDisks; public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { diff --git a/ydb/core/viewer/browse_db.h b/ydb/core/viewer/browse_db.h index fe7b5d31408..893b5427021 100644 --- a/ydb/core/viewer/browse_db.h +++ b/ydb/core/viewer/browse_db.h @@ -38,7 +38,7 @@ public: if (pbRecord.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) { if (pbRecord.HasPathDescription()) { const auto& pbPathDescription(pbRecord.GetPathDescription()); - TVector<ui64> tablets; + TVector<ui64> tablets; tablets.reserve(pbPathDescription.TablePartitionsSize()); for (const auto& partition : pbPathDescription.GetTablePartitions()) { tablets.emplace_back(partition.GetDatashardId()); @@ -63,7 +63,7 @@ public: } } - void SendTabletRequests(const TVector<TTabletId>& tablets, const TActorContext& ctx) { + void SendTabletRequests(const TVector<TTabletId>& tablets, const TActorContext& ctx) { TDomainsInfo* domainsInfo = AppData(ctx)->DomainsInfo.Get(); for (auto tabletId : tablets) { TActorId pipeClient = GetTabletPipe(tabletId, ctx); diff --git a/ydb/core/viewer/browse_pq.h b/ydb/core/viewer/browse_pq.h index 3e3b32a21e3..8b0149b0caf 100644 --- a/ydb/core/viewer/browse_pq.h +++ b/ydb/core/viewer/browse_pq.h @@ -48,15 +48,15 @@ protected: using TThis = TBrowseCommon; using TBase = TBrowseTabletsCommon; const TString PQ_ROOT_PATH; - TSet<TString> Consumers; + TSet<TString> Consumers; struct TTopicInfo : NKikimrViewer::TMetaTopicInfo { - TMap<i32, THolder<TEvPersQueue::TEvPartitionClientInfoResponse>> PartitionResults; - TMap<i32, NKikimrViewer::TMetaTopicPartitionInfo> PartitionInfo; + TMap<i32, THolder<TEvPersQueue::TEvPartitionClientInfoResponse>> PartitionResults; + TMap<i32, NKikimrViewer::TMetaTopicPartitionInfo> PartitionInfo; }; - TMap<TString, TTopicInfo> Topics; - TMultiMap<TTabletId, i32> TabletPartitions; - TMap<TTabletId, TTopicInfo*> TabletTopic; - THashMap<TString, NKikimrViewer::TMetaTopicConsumerInfo> ConsumerInfo; + TMap<TString, TTopicInfo> Topics; + TMultiMap<TTabletId, i32> TabletPartitions; + TMap<TTabletId, TTopicInfo*> TabletTopic; + THashMap<TString, NKikimrViewer::TMetaTopicConsumerInfo> ConsumerInfo; TString FilterTopic; TString FilterConsumer; TActorId TxProxy = MakeTxProxyID(); @@ -75,7 +75,7 @@ public: if (pbRecord.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) { if (pbRecord.HasPathDescription()) { const auto& pbPathDescription(pbRecord.GetPathDescription()); - TVector<ui64> tablets; + TVector<ui64> tablets; if (pbPathDescription.HasPersQueueGroup()) { const auto& pbPersQueueGroup = pbPathDescription.GetPersQueueGroup(); TTopicInfo* topicInfo = &Topics[GetTopicName(pbRecord.GetPath())]; @@ -127,7 +127,7 @@ public: } } - void SendTabletRequests(const TVector<TTabletId>& tablets, const TActorContext& ctx) { + void SendTabletRequests(const TVector<TTabletId>& tablets, const TActorContext& ctx) { TDomainsInfo* domainsInfo = AppData(ctx)->DomainsInfo.Get(); for (auto tabletId : tablets) { TActorId pipeClient = GetTabletPipe(tabletId, ctx); diff --git a/ydb/core/viewer/json_browse.h b/ydb/core/viewer/json_browse.h index cba672826ee..6228e71ea15 100644 --- a/ydb/core/viewer/json_browse.h +++ b/ydb/core/viewer/json_browse.h @@ -59,7 +59,7 @@ class TJsonBrowse : public TActorBootstrapped<TJsonBrowse> { } }; - TVector<TPathStateInfo> Paths; + TVector<TPathStateInfo> Paths; using TBrowseRequestKey = std::tuple<TActorId, TTabletId, ui32>; std::unordered_multiset<TBrowseRequestKey> BrowseRequestsInFlight; @@ -215,7 +215,7 @@ public: template <> struct TJsonRequestSchema<TJsonBrowse> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<NKikimrViewer::TBrowseInfo>(stream); return stream.Str(); @@ -224,7 +224,7 @@ struct TJsonRequestSchema<TJsonBrowse> { template <> struct TJsonRequestParameters<TJsonBrowse> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"path","in":"query","description":"schema path","required":true,"type":"string"}, {"name":"enums","in":"query","description":"convert enums to strings","required":false,"type":"boolean"}, {"name":"ui64","in":"query","description":"return ui64 as number","required":false,"type":"boolean"}, @@ -234,14 +234,14 @@ struct TJsonRequestParameters<TJsonBrowse> { template <> struct TJsonRequestSummary<TJsonBrowse> { - static TString GetSummary() { + static TString GetSummary() { return "\"Schema information\""; } }; template <> struct TJsonRequestDescription<TJsonBrowse> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns brief information about schema object\""; } }; diff --git a/ydb/core/viewer/json_bscontrollerinfo.h b/ydb/core/viewer/json_bscontrollerinfo.h index 5df47ed5531..8a2f4c3a759 100644 --- a/ydb/core/viewer/json_bscontrollerinfo.h +++ b/ydb/core/viewer/json_bscontrollerinfo.h @@ -74,7 +74,7 @@ public: template <> struct TJsonRequestSchema<TJsonBSControllerInfo> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<TEvBlobStorage::TEvResponseControllerInfo::ProtoRecordType>(stream); return stream.Str(); @@ -83,7 +83,7 @@ struct TJsonRequestSchema<TJsonBSControllerInfo> { template <> struct TJsonRequestParameters<TJsonBSControllerInfo> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"controller_id","in":"query","description":"storage controller identifier (tablet id)","required":true,"type":"string"}, {"name":"enums","in":"query","description":"convert enums to strings","required":false,"type":"boolean"}, {"name":"ui64","in":"query","description":"return ui64 as number","required":false,"type":"boolean"}, @@ -93,14 +93,14 @@ struct TJsonRequestParameters<TJsonBSControllerInfo> { template <> struct TJsonRequestSummary<TJsonBSControllerInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"Storage controller information\""; } }; template <> struct TJsonRequestDescription<TJsonBSControllerInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns information about storage controller\""; } }; diff --git a/ydb/core/viewer/json_bsgroupinfo.h b/ydb/core/viewer/json_bsgroupinfo.h index 7a95f443b7c..9aa918824ed 100644 --- a/ydb/core/viewer/json_bsgroupinfo.h +++ b/ydb/core/viewer/json_bsgroupinfo.h @@ -56,14 +56,14 @@ using TJsonBSGroupInfo = TJsonWhiteboardRequest<TEvWhiteboard::TEvBSGroupStateRe template <> struct TJsonRequestSummary<TJsonBSGroupInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"Storage groups information\""; } }; template <> struct TJsonRequestDescription<TJsonBSGroupInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns information about storage groups\""; } }; diff --git a/ydb/core/viewer/json_cluster.h b/ydb/core/viewer/json_cluster.h index 36b5362a452..ddd61f4a084 100644 --- a/ydb/core/viewer/json_cluster.h +++ b/ydb/core/viewer/json_cluster.h @@ -249,8 +249,8 @@ public: THolder<TEvWhiteboard::TEvVDiskStateResponse> MergedVDiskInfo; THolder<TEvWhiteboard::TEvPDiskStateResponse> MergedPDiskInfo; THolder<TEvWhiteboard::TEvTabletStateResponse> MergedTabletInfo; - TMap<NKikimrBlobStorage::TVDiskID, const NKikimrWhiteboard::TVDiskStateInfo&> VDisksIndex; - TMap<std::pair<ui32, ui32>, const NKikimrWhiteboard::TPDiskStateInfo&> PDisksIndex; + TMap<NKikimrBlobStorage::TVDiskID, const NKikimrWhiteboard::TVDiskStateInfo&> VDisksIndex; + TMap<std::pair<ui32, ui32>, const NKikimrWhiteboard::TPDiskStateInfo&> PDisksIndex; void ReplyAndDie(const TActorContext& ctx) { TStringStream json; @@ -321,8 +321,8 @@ public: } ui32 numberOfCpus = 0; double loadAverage = 0; - THashSet<TString> dataCenters; - THashSet<TString> versions; + THashSet<TString> dataCenters; + THashSet<TString> versions; THashSet<TString> hosts; THashMap<TString, int> names; for (const auto& pr : SystemInfo) { @@ -402,7 +402,7 @@ public: template <> struct TJsonRequestSchema<TJsonCluster> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<NKikimrViewer::TClusterInfo>(stream); return stream.Str(); @@ -411,7 +411,7 @@ struct TJsonRequestSchema<TJsonCluster> { template <> struct TJsonRequestParameters<TJsonCluster> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"enums","in":"query","description":"convert enums to strings","required":false,"type":"boolean"}, {"name":"tablets","in":"query","description":"return system tablets state","required":false,"type":"boolean"}, {"name":"ui64","in":"query","description":"return ui64 as number","required":false,"type":"boolean"}, @@ -421,14 +421,14 @@ struct TJsonRequestParameters<TJsonCluster> { template <> struct TJsonRequestSummary<TJsonCluster> { - static TString GetSummary() { + static TString GetSummary() { return "\"Cluster information\""; } }; template <> struct TJsonRequestDescription<TJsonCluster> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns information about cluster\""; } }; diff --git a/ydb/core/viewer/json_config.h b/ydb/core/viewer/json_config.h index 7e501d5afbf..3fb3cf54856 100644 --- a/ydb/core/viewer/json_config.h +++ b/ydb/core/viewer/json_config.h @@ -42,7 +42,7 @@ public: template <> struct TJsonRequestSchema<TJsonConfig> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<NKikimrConfig::TAppConfig>(stream); return stream.Str(); @@ -51,14 +51,14 @@ struct TJsonRequestSchema<TJsonConfig> { template <> struct TJsonRequestSummary<TJsonConfig> { - static TString GetSummary() { + static TString GetSummary() { return "\"Configuration\""; } }; template <> struct TJsonRequestDescription<TJsonConfig> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns configuration\""; } }; diff --git a/ydb/core/viewer/json_counters.h b/ydb/core/viewer/json_counters.h index cac1e0885c4..3fdc4b74de9 100644 --- a/ydb/core/viewer/json_counters.h +++ b/ydb/core/viewer/json_counters.h @@ -21,10 +21,10 @@ class TJsonCounters : public TActorBootstrapped<TJsonCounters> { ui32 Requested; ui32 Received; THolder<TEvInterconnect::TEvNodesInfo> NodesInfo; - TMap<ui32, THolder<TEvWhiteboard::TEvVDiskStateResponse>> VDiskInfo; - TMap<ui32, THolder<TEvWhiteboard::TEvPDiskStateResponse>> PDiskInfo; - TMap<ui32, THolder<TEvWhiteboard::TEvTabletStateResponse>> TabletInfo; - TMap<ui32, THolder<TEvWhiteboard::TEvBSGroupStateResponse>> BSGroupInfo; + TMap<ui32, THolder<TEvWhiteboard::TEvVDiskStateResponse>> VDiskInfo; + TMap<ui32, THolder<TEvWhiteboard::TEvPDiskStateResponse>> PDiskInfo; + TMap<ui32, THolder<TEvWhiteboard::TEvTabletStateResponse>> TabletInfo; + TMap<ui32, THolder<TEvWhiteboard::TEvBSGroupStateResponse>> BSGroupInfo; public: static constexpr NKikimrServices::TActivity::EType ActorActivityType() { @@ -174,14 +174,14 @@ public: void RenderStats(TStringStream& json, THolder<ResponseType>& response, const TEvInterconnect::TNodeInfo& nodeInfo, - const TString& subsystem, - const TVector<const FieldDescriptor*>& groupFields) { + const TString& subsystem, + const TVector<const FieldDescriptor*>& groupFields) { THolder<ResponseType> groupedResponse = TWhiteboardGrouper<ResponseType>::GroupResponse(response, groupFields, true); auto* stateInfo = TWhiteboardInfo<ResponseType>::GetElementsField(groupedResponse.Get()); TStringBuf host(nodeInfo.Host); size_t pos = host.find('.'); - if (pos != TString::npos) { + if (pos != TString::npos) { host = host.substr(0, pos); } for (typename TWhiteboardInfo<ResponseType>::TElementType& info : *stateInfo) { @@ -209,7 +209,7 @@ public: const TEvInterconnect::TNodeInfo& nodeInfo) { if (response == nullptr) return; - static TVector<const FieldDescriptor*> groupFields + static TVector<const FieldDescriptor*> groupFields = TWhiteboardGrouper<TEvWhiteboard::TEvVDiskStateResponse>::GetProtoFields("VDiskState"); RenderStats(json, response, nodeInfo, "VDisk", groupFields); } @@ -219,7 +219,7 @@ public: const TEvInterconnect::TNodeInfo& nodeInfo) { if (response == nullptr) return; - static TVector<const FieldDescriptor*> groupFields + static TVector<const FieldDescriptor*> groupFields = TWhiteboardGrouper<TEvWhiteboard::TEvPDiskStateResponse>::GetProtoFields("State"); RenderStats(json, response, nodeInfo, "PDisk", groupFields); } @@ -229,7 +229,7 @@ public: const TEvInterconnect::TNodeInfo& nodeInfo) { if (response == nullptr) return; - static TVector<const FieldDescriptor*> groupFields + static TVector<const FieldDescriptor*> groupFields = TWhiteboardGrouper<TEvWhiteboard::TEvTabletStateResponse>::GetProtoFields("State"); RenderStats(json, response, nodeInfo, "Tablet", groupFields); } diff --git a/ydb/core/viewer/json_describe.h b/ydb/core/viewer/json_describe.h index 05ef441f8f6..893e9d8fc8d 100644 --- a/ydb/core/viewer/json_describe.h +++ b/ydb/core/viewer/json_describe.h @@ -113,7 +113,7 @@ public: template <> struct TJsonRequestSchema<TJsonDescribe> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::ProtoRecordType>(stream); return stream.Str(); @@ -122,7 +122,7 @@ struct TJsonRequestSchema<TJsonDescribe> { template <> struct TJsonRequestParameters<TJsonDescribe> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"path","in":"query","description":"schema path","required":false,"type":"string"}, {"name":"schemeshard_id","in":"query","description":"schemeshard identifier (tablet id)","required":false,"type":"integer"}, {"name":"path_id","in":"query","description":"path id","required":false,"type":"integer"}, @@ -141,14 +141,14 @@ struct TJsonRequestParameters<TJsonDescribe> { template <> struct TJsonRequestSummary<TJsonDescribe> { - static TString GetSummary() { + static TString GetSummary() { return "\"Schema detailed information\""; } }; template <> struct TJsonRequestDescription<TJsonDescribe> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns detailed information about schema object\""; } }; diff --git a/ydb/core/viewer/json_hiveinfo.h b/ydb/core/viewer/json_hiveinfo.h index f4d04ddfaf6..aff07b9b9b0 100644 --- a/ydb/core/viewer/json_hiveinfo.h +++ b/ydb/core/viewer/json_hiveinfo.h @@ -103,7 +103,7 @@ public: template <> struct TJsonRequestSchema<TJsonHiveInfo> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<TEvHive::TEvResponseHiveInfo::ProtoRecordType>(stream); return stream.Str(); @@ -112,7 +112,7 @@ struct TJsonRequestSchema<TJsonHiveInfo> { template <> struct TJsonRequestParameters<TJsonHiveInfo> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"hive_id","in":"query","description":"hive identifier (tablet id)","required":true,"type":"string"}, {"name":"tablet_id","in":"query","description":"tablet id filter","required":false,"type":"string"}, {"name":"tablet_type","in":"query","description":"tablet type filter","required":false,"type":"string"}, @@ -126,14 +126,14 @@ struct TJsonRequestParameters<TJsonHiveInfo> { template <> struct TJsonRequestSummary<TJsonHiveInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"Hive information\""; } }; template <> struct TJsonRequestDescription<TJsonHiveInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns information about tablets from Hive\""; } }; diff --git a/ydb/core/viewer/json_hivestats.h b/ydb/core/viewer/json_hivestats.h index 7f24693d635..ab4a58fd2ea 100644 --- a/ydb/core/viewer/json_hivestats.h +++ b/ydb/core/viewer/json_hivestats.h @@ -81,7 +81,7 @@ public: template <> struct TJsonRequestSchema<TJsonHiveStats> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<TEvHive::TEvResponseHiveDomainStats::ProtoRecordType>(stream); return stream.Str(); @@ -90,7 +90,7 @@ struct TJsonRequestSchema<TJsonHiveStats> { template <> struct TJsonRequestParameters<TJsonHiveStats> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"hive_id","in":"query","description":"hive identifier (tablet id)","required":true,"type":"string"}, {"name":"followers","in":"query","description":"return followers","required":false,"type":"boolean"}, {"name":"metrics","in":"query","description":"return tablet metrics","required":false,"type":"boolean"}, @@ -102,14 +102,14 @@ struct TJsonRequestParameters<TJsonHiveStats> { template <> struct TJsonRequestSummary<TJsonHiveStats> { - static TString GetSummary() { + static TString GetSummary() { return "\"Hive statistics\""; } }; template <> struct TJsonRequestDescription<TJsonHiveStats> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns information about Hive statistics\""; } }; diff --git a/ydb/core/viewer/json_metainfo.h b/ydb/core/viewer/json_metainfo.h index 54064d74037..304f23d9018 100644 --- a/ydb/core/viewer/json_metainfo.h +++ b/ydb/core/viewer/json_metainfo.h @@ -130,7 +130,7 @@ public: template <> struct TJsonRequestSchema<TJsonMetaInfo> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<NKikimrViewer::TMetaInfo>(stream); return stream.Str(); @@ -139,7 +139,7 @@ struct TJsonRequestSchema<TJsonMetaInfo> { template <> struct TJsonRequestParameters<TJsonMetaInfo> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"path","in":"query","description":"schema path","required":false,"type":"string"}, {"name":"tablet_id","in":"query","description":"tablet identifier","required":false,"type":"integer"}, {"name":"enums","in":"query","description":"convert enums to strings","required":false,"type":"boolean"}, @@ -151,14 +151,14 @@ struct TJsonRequestParameters<TJsonMetaInfo> { template <> struct TJsonRequestSummary<TJsonMetaInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"Schema meta information\""; } }; template <> struct TJsonRequestDescription<TJsonMetaInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns meta information about schema path\""; } }; diff --git a/ydb/core/viewer/json_nodeinfo.h b/ydb/core/viewer/json_nodeinfo.h index 60245326fa6..7d26a96c9ac 100644 --- a/ydb/core/viewer/json_nodeinfo.h +++ b/ydb/core/viewer/json_nodeinfo.h @@ -14,7 +14,7 @@ template <> struct TWhiteboardInfo<TEvWhiteboard::TEvNodeStateResponse> { using TResponseType = TEvWhiteboard::TEvNodeStateResponse; using TElementType = NKikimrWhiteboard::TNodeStateInfo; - using TElementKeyType = TString; + using TElementKeyType = TString; static constexpr bool StaticNodesOnly = false; @@ -22,7 +22,7 @@ struct TWhiteboardInfo<TEvWhiteboard::TEvNodeStateResponse> { return response->Record.MutableNodeStateInfo(); } - static const TString& GetElementKey(const TElementType& type) { + static const TString& GetElementKey(const TElementType& type) { return type.GetPeerName(); } @@ -46,14 +46,14 @@ using TJsonNodeInfo = TJsonWhiteboardRequest<TEvWhiteboard::TEvNodeStateRequest, template <> struct TJsonRequestSummary<TJsonNodeInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"Interconnect information\""; } }; template <> struct TJsonRequestDescription<TJsonNodeInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns information about node connections\""; } }; diff --git a/ydb/core/viewer/json_nodelist.h b/ydb/core/viewer/json_nodelist.h index 504ed152d8d..4f4384ca3f9 100644 --- a/ydb/core/viewer/json_nodelist.h +++ b/ydb/core/viewer/json_nodelist.h @@ -85,21 +85,21 @@ public: template <> struct TJsonRequestSchema<TJsonNodeList> { - static TString GetSchema() { + static TString GetSchema() { return R"___({"type":"array","title":"TEvNodeListResponse","items":{"type":"object","title":"TNodeInfo","properties":{"Id":{"type":"integer"},"Host":{"type":"string"},"Address":{"type":"string"},"Port":{"type":"integer"}},"required":["Id","Address","Port"]}})___"; } }; template <> struct TJsonRequestSummary<TJsonNodeList> { - static TString GetSummary() { + static TString GetSummary() { return "\"Nodes list\""; } }; template <> struct TJsonRequestDescription<TJsonNodeList> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns list of nodes\""; } }; diff --git a/ydb/core/viewer/json_pdiskinfo.h b/ydb/core/viewer/json_pdiskinfo.h index 881c108e513..aea0ef4a83a 100644 --- a/ydb/core/viewer/json_pdiskinfo.h +++ b/ydb/core/viewer/json_pdiskinfo.h @@ -42,14 +42,14 @@ using TJsonPDiskInfo = TJsonWhiteboardRequest<TEvWhiteboard::TEvPDiskStateReques template <> struct TJsonRequestSummary<TJsonPDiskInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"PDisk information\""; } }; template <> struct TJsonRequestDescription<TJsonPDiskInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns PDisk information\""; } }; diff --git a/ydb/core/viewer/json_storage.h b/ydb/core/viewer/json_storage.h index 76e5d2f5e8b..34cc950f102 100644 --- a/ydb/core/viewer/json_storage.h +++ b/ydb/core/viewer/json_storage.h @@ -28,9 +28,9 @@ class TJsonStorage : public TViewerPipeClient<TJsonStorage> { TActorId Initiator; NMon::TEvHttpInfo::TPtr Event; THolder<TEvInterconnect::TEvNodesInfo> NodesInfo; - TMap<ui32, THolder<TEvWhiteboard::TEvVDiskStateResponse>> VDiskInfo; - TMap<ui32, THolder<TEvWhiteboard::TEvPDiskStateResponse>> PDiskInfo; - TMap<ui32, THolder<TEvWhiteboard::TEvBSGroupStateResponse>> BSGroupInfo; + TMap<ui32, THolder<TEvWhiteboard::TEvVDiskStateResponse>> VDiskInfo; + TMap<ui32, THolder<TEvWhiteboard::TEvPDiskStateResponse>> PDiskInfo; + TMap<ui32, THolder<TEvWhiteboard::TEvBSGroupStateResponse>> BSGroupInfo; THashMap<TString, THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeResult; THashMap<TTabletId, THolder<TEvHive::TEvResponseHiveStorageStats>> HiveStorageStats; THolder<TEvBlobStorage::TEvControllerConfigResponse> BaseConfig; @@ -303,8 +303,8 @@ public: THolder<TEvWhiteboard::TEvPDiskStateResponse> MergedPDiskInfo; TMap<TString, const NKikimrWhiteboard::TBSGroupStateInfo&> BSGroupIndex; TMap<TString, NKikimrHive::THiveStorageGroupStats> BSGroupHiveIndex; - TMap<NKikimrBlobStorage::TVDiskID, const NKikimrWhiteboard::TVDiskStateInfo&> VDisksIndex; - TMap<std::pair<ui32, ui32>, const NKikimrWhiteboard::TPDiskStateInfo&> PDisksIndex; + TMap<NKikimrBlobStorage::TVDiskID, const NKikimrWhiteboard::TVDiskStateInfo&> VDisksIndex; + TMap<std::pair<ui32, ui32>, const NKikimrWhiteboard::TPDiskStateInfo&> PDisksIndex; TMap<TString, TString> BSGroupOverall; THashSet<TString> BSGroupWithMissingDisks; THashSet<TString> BSGroupWithSpaceProblems; @@ -566,7 +566,7 @@ public: template <> struct TJsonRequestSchema<TJsonStorage> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<NKikimrViewer::TStorageInfo>(stream); return stream.Str(); @@ -575,7 +575,7 @@ struct TJsonRequestSchema<TJsonStorage> { template <> struct TJsonRequestParameters<TJsonStorage> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"enums","in":"query","description":"convert enums to strings","required":false,"type":"boolean"}, {"name":"ui64","in":"query","description":"return ui64 as number","required":false,"type":"boolean"}, {"name":"tenant","in":"query","description":"tenant name","required":false,"type":"string"}, @@ -590,14 +590,14 @@ struct TJsonRequestParameters<TJsonStorage> { template <> struct TJsonRequestSummary<TJsonStorage> { - static TString GetSummary() { + static TString GetSummary() { return "\"Storage information\""; } }; template <> struct TJsonRequestDescription<TJsonStorage> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns information about storage\""; } }; diff --git a/ydb/core/viewer/json_sysinfo.h b/ydb/core/viewer/json_sysinfo.h index 05a477c2df2..191aad30481 100644 --- a/ydb/core/viewer/json_sysinfo.h +++ b/ydb/core/viewer/json_sysinfo.h @@ -56,14 +56,14 @@ using TJsonSysInfo = TJsonWhiteboardRequest<TEvWhiteboard::TEvSystemStateRequest template <> struct TJsonRequestSummary<TJsonSysInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"System information\""; } }; template <> struct TJsonRequestDescription<TJsonSysInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns system information\""; } }; diff --git a/ydb/core/viewer/json_tabletcounters.h b/ydb/core/viewer/json_tabletcounters.h index 7f399104410..3376b5f3448 100644 --- a/ydb/core/viewer/json_tabletcounters.h +++ b/ydb/core/viewer/json_tabletcounters.h @@ -21,8 +21,8 @@ class TJsonTabletCounters : public TActorBootstrapped<TJsonTabletCounters> { IViewer* Viewer; NMon::TEvHttpInfo::TPtr Event; TVector<TActorId> PipeClients; - TVector<ui64> Tablets; - TMap<TTabletId, THolder<TEvTablet::TEvGetCountersResponse>> Results; + TVector<ui64> Tablets; + TMap<TTabletId, THolder<TEvTablet::TEvGetCountersResponse>> Results; THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult; TJsonSettings JsonSettings; ui32 Timeout = 0; @@ -169,7 +169,7 @@ public: template <> struct TJsonRequestSchema<TJsonTabletCounters> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<TEvTablet::TEvGetCountersResponse::ProtoRecordType>(stream); return stream.Str(); @@ -178,7 +178,7 @@ struct TJsonRequestSchema<TJsonTabletCounters> { template <> struct TJsonRequestParameters<TJsonTabletCounters> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"path","in":"query","description":"schema path","required":false,"type":"string"}, {"name":"tablet_id","in":"query","description":"tablet identifier","required":false,"type":"integer"}, {"name":"enums","in":"query","description":"convert enums to strings","required":false,"type":"boolean"}, @@ -190,14 +190,14 @@ struct TJsonRequestParameters<TJsonTabletCounters> { template <> struct TJsonRequestSummary<TJsonTabletCounters> { - static TString GetSummary() { + static TString GetSummary() { return "\"Tablet counters information\""; } }; template <> struct TJsonRequestDescription<TJsonTabletCounters> { - static TString GetDescription() { + static TString GetDescription() { return "\"Returns information about tablet counters\""; } }; diff --git a/ydb/core/viewer/json_tabletinfo.h b/ydb/core/viewer/json_tabletinfo.h index 32546865a15..efe5d5e7c87 100644 --- a/ydb/core/viewer/json_tabletinfo.h +++ b/ydb/core/viewer/json_tabletinfo.h @@ -53,7 +53,7 @@ class TJsonTabletInfo : public TJsonWhiteboardRequest<TEvWhiteboard::TEvTabletSt static const bool WithRetry = false; using TBase = TJsonWhiteboardRequest<TEvWhiteboard::TEvTabletStateRequest, TEvWhiteboard::TEvTabletStateResponse>; using TThis = TJsonTabletInfo; - TVector<ui64> Tablets; + TVector<ui64> Tablets; public: TJsonTabletInfo(IViewer *viewer, NMon::TEvHttpInfo::TPtr &ev) : TJsonWhiteboardRequest(viewer, ev) @@ -146,7 +146,7 @@ public: template <> struct TJsonRequestParameters<TJsonTabletInfo> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"node_id","in":"query","description":"node identifier","required":false,"type":"integer"},)___" R"___({"name":"path","in":"query","description":"schema path","required":false,"type":"string"},)___" R"___({"name":"merge","in":"query","description":"merge information from nodes","required":false,"type":"boolean"},)___" @@ -166,7 +166,7 @@ struct TJsonRequestParameters<TJsonTabletInfo> { template <> struct TJsonRequestSchema<TJsonTabletInfo> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<NKikimrWhiteboard::TEvTabletStateResponse>(stream); return stream.Str(); @@ -175,14 +175,14 @@ struct TJsonRequestSchema<TJsonTabletInfo> { template <> struct TJsonRequestSummary<TJsonTabletInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"Информация о таблетках\""; } }; template <> struct TJsonRequestDescription<TJsonTabletInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Возвращает информацию о статусе таблеток в кластере\""; } }; diff --git a/ydb/core/viewer/json_topicinfo.h b/ydb/core/viewer/json_topicinfo.h index cbf42ee7279..5df7ac37c82 100644 --- a/ydb/core/viewer/json_topicinfo.h +++ b/ydb/core/viewer/json_topicinfo.h @@ -18,8 +18,8 @@ class TJsonTopicInfo : public TActorBootstrapped<TJsonTopicInfo> { NMon::TEvHttpInfo::TPtr Event; NKikimrTabletCountersAggregator::TEvTabletLabeledCountersResponse TopicInfoResult; TJsonSettings JsonSettings; - TString Topic; - TString Client; + TString Topic; + TString Client; TString GroupNames; bool ShowAll = false; ui32 Timeout = 0; @@ -44,7 +44,7 @@ public: GroupNames = params.Get("group_names"); ShowAll = FromStringWithDefault<bool>(params.Get("all"), false); size_t pos = Topic.rfind('/'); - if (pos != TString::npos) + if (pos != TString::npos) Topic = Topic.substr(pos + 1); //proxy is not used CreateClusterLabeledCountersAggregator(ctx.SelfID, TTabletTypes::PERSQUEUE, ctx); @@ -94,7 +94,7 @@ public: template <> struct TJsonRequestSchema<TJsonTopicInfo> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<TEvTabletCounters::TEvTabletLabeledCountersResponse::ProtoRecordType>(stream); return stream.Str(); @@ -103,7 +103,7 @@ struct TJsonRequestSchema<TJsonTopicInfo> { template <> struct TJsonRequestParameters<TJsonTopicInfo> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"path","in":"query","description":"schema path","required":true,"type":"string"}, {"name":"client","in":"query","description":"client name","required":false,"type":"string","default":"total"}, {"name":"enums","in":"query","description":"convert enums to strings","required":false,"type":"boolean"}, @@ -115,14 +115,14 @@ struct TJsonRequestParameters<TJsonTopicInfo> { template <> struct TJsonRequestSummary<TJsonTopicInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"PQ topic information\""; } }; template <> struct TJsonRequestDescription<TJsonTopicInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"Information about PQ topic\""; } }; diff --git a/ydb/core/viewer/json_vdiskinfo.h b/ydb/core/viewer/json_vdiskinfo.h index db681f044b5..f911709b8c2 100644 --- a/ydb/core/viewer/json_vdiskinfo.h +++ b/ydb/core/viewer/json_vdiskinfo.h @@ -79,14 +79,14 @@ using TJsonVDiskInfo = TJsonWhiteboardRequest<TEvWhiteboard::TEvVDiskStateReques template <> struct TJsonRequestSummary<TJsonVDiskInfo> { - static TString GetSummary() { + static TString GetSummary() { return "\"VDisk information\""; } }; template <> struct TJsonRequestDescription<TJsonVDiskInfo> { - static TString GetDescription() { + static TString GetDescription() { return "\"VDisk information\""; } }; diff --git a/ydb/core/viewer/json_wb_req.h b/ydb/core/viewer/json_wb_req.h index f04c85688f4..71eec368cab 100644 --- a/ydb/core/viewer/json_wb_req.h +++ b/ydb/core/viewer/json_wb_req.h @@ -49,8 +49,8 @@ protected: TMap<TNodeId, THolder<ResponseType>> PerNodeStateInfo; // map instead of unordered_map only for sorting reason std::unordered_map<TNodeId, TString> NodeErrors; TInstant NodesRequestedTime; - TString GroupFields; - TString FilterFields; + TString GroupFields; + TString FilterFields; TString MergeFields; TJsonSettings JsonSettings; bool AllEnums = false; @@ -186,8 +186,8 @@ public: } static TNodeId GetNodeIdFromPeerName(const TString& peerName) { - TString::size_type colonPos = peerName.find(':'); - if (colonPos != TString::npos) { + TString::size_type colonPos = peerName.find(':'); + if (colonPos != TString::npos) { return FromStringWithDefault<TNodeId>(peerName.substr(0, colonPos), 0); } return 0; @@ -364,7 +364,7 @@ public: template <typename RequestType, typename ResponseType> struct TJsonRequestParameters<TJsonWhiteboardRequest<RequestType, ResponseType>> { - static TString GetParameters() { + static TString GetParameters() { return R"___([{"name":"node_id","in":"query","description":"node identifier","required":false,"type":"integer"},)___" R"___({"name":"merge","in":"query","description":"merge information from nodes","required":false,"type":"boolean"},)___" R"___({"name":"group","in":"query","description":"group information by field","required":false,"type":"string"},)___" @@ -383,7 +383,7 @@ struct TJsonRequestParameters<TJsonWhiteboardRequest<RequestType, ResponseType>> template <typename RequestType, typename ResponseType> struct TJsonRequestSchema<TJsonWhiteboardRequest<RequestType, ResponseType>> { - static TString GetSchema() { + static TString GetSchema() { TStringStream stream; TProtoToJson::ProtoToJsonSchema<typename ResponseType::ProtoRecordType>(stream); return stream.Str(); diff --git a/ydb/core/viewer/viewer.cpp b/ydb/core/viewer/viewer.cpp index f1124115bf7..af769a042d4 100644 --- a/ydb/core/viewer/viewer.cpp +++ b/ydb/core/viewer/viewer.cpp @@ -58,10 +58,10 @@ class TJsonHandlerBase { public: virtual ~TJsonHandlerBase() = default; virtual IActor* CreateRequestActor(IViewer* viewer, NMon::TEvHttpInfo::TPtr& event) = 0; - virtual TString GetResponseJsonSchema() = 0; - virtual TString GetRequestSummary() { return TString(); } - virtual TString GetRequestDescription() { return TString(); } - virtual TString GetRequestParameters() { return TString(); } + virtual TString GetResponseJsonSchema() = 0; + virtual TString GetRequestSummary() { return TString(); } + virtual TString GetRequestDescription() { return TString(); } + virtual TString GetRequestParameters() { return TString(); } }; template <typename ActorRequestType> @@ -71,23 +71,23 @@ public: return new ActorRequestType(viewer, event); } - TString GetResponseJsonSchema() override { - static TString jsonSchema = TJsonRequestSchema<ActorRequestType>::GetSchema(); + TString GetResponseJsonSchema() override { + static TString jsonSchema = TJsonRequestSchema<ActorRequestType>::GetSchema(); return jsonSchema; } - TString GetRequestSummary() override { - static TString jsonSummary = TJsonRequestSummary<ActorRequestType>::GetSummary(); + TString GetRequestSummary() override { + static TString jsonSummary = TJsonRequestSummary<ActorRequestType>::GetSummary(); return jsonSummary; } - TString GetRequestDescription() override { - static TString jsonDescription = TJsonRequestDescription<ActorRequestType>::GetDescription(); + TString GetRequestDescription() override { + static TString jsonDescription = TJsonRequestDescription<ActorRequestType>::GetDescription(); return jsonDescription; } - TString GetRequestParameters() override { - static TString jsonParameters = TJsonRequestParameters<ActorRequestType>::GetParameters(); + TString GetRequestParameters() override { + static TString jsonParameters = TJsonRequestParameters<ActorRequestType>::GetParameters(); return jsonParameters; } }; @@ -219,8 +219,8 @@ public: VirtualHandlersByParentType.insert(std::make_pair(parentObjectType, TVirtualHandler(handler))); } - TVector<const TVirtualHandler*> GetVirtualHandlers(NKikimrViewer::EObjectType type, const TString&/* path*/) const override { - TVector<const TVirtualHandler*> handlers; + TVector<const TVirtualHandler*> GetVirtualHandlers(NKikimrViewer::EObjectType type, const TString&/* path*/) const override { + TVector<const TVirtualHandler*> handlers; auto its = VirtualHandlersByParentType.equal_range(type); for (auto it = its.first; it != its.second; ++it) { handlers.push_back(&it->second); @@ -242,7 +242,7 @@ public: } private: - THashMap<TString, TAutoPtr<TJsonHandlerBase>> JsonHandlers; + THashMap<TString, TAutoPtr<TJsonHandlerBase>> JsonHandlers; const TKikimrRunConfig KikimrRunConfig; std::unordered_multimap<NKikimrViewer::EObjectType, TVirtualHandler> VirtualHandlersByParentType; std::unordered_map<NKikimrViewer::EObjectType, TContentHandler> ContentHandlers; @@ -253,7 +253,7 @@ private: } } - TString GetSwaggerJson(NMon::TEvHttpInfo::TPtr &ev) { + TString GetSwaggerJson(NMon::TEvHttpInfo::TPtr &ev) { TStringStream json; TString basepath = ev->Get()->Request.GetParams().Get("basepath"); if (basepath.empty()) { @@ -284,26 +284,26 @@ private: if (itJson != JsonHandlers.begin()) { json << ','; } - TString name = itJson->first; + TString name = itJson->first; json << '"' << name << '"' << ":{"; json << "\"get\":{"; json << "\"tags\":[\"viewer\"],"; json << "\"produces\":[\"application/json\"],"; - TString summary = itJson->second->GetRequestSummary(); + TString summary = itJson->second->GetRequestSummary(); if (!summary.empty()) { json << "\"summary\":" << summary << ','; } - TString description = itJson->second->GetRequestDescription(); + TString description = itJson->second->GetRequestDescription(); if (!description.empty()) { json << "\"description\":" << description << ','; } - TString parameters = itJson->second->GetRequestParameters(); + TString parameters = itJson->second->GetRequestParameters(); if (!parameters.empty()) { json << "\"parameters\":" << parameters << ','; } json << "\"responses\":{"; json << "\"200\":{"; - TString schema = itJson->second->GetResponseJsonSchema(); + TString schema = itJson->second->GetResponseJsonSchema(); if (!schema.empty()) { json << "\"schema\":" << schema; } @@ -321,7 +321,7 @@ private: } bool ReplyWithSwaggerJson(NMon::TEvHttpInfo::TPtr &ev, const TActorContext &ctx) { - TString json(GetSwaggerJson(ev)); + TString json(GetSwaggerJson(ev)); TStringStream response; response << "HTTP/1.1 200 Ok\r\n"; response << "Content-Type: application/json\r\n"; @@ -332,16 +332,16 @@ private: return true; } - bool ReplyWithFile(NMon::TEvHttpInfo::TPtr &ev, const TActorContext &ctx, const TString& name) { + bool ReplyWithFile(NMon::TEvHttpInfo::TPtr &ev, const TActorContext &ctx, const TString& name) { if (name == "/api/viewer.json") { return ReplyWithSwaggerJson(ev, ctx); } TString filename("content" + name); - TString blob; - TString type; + TString blob; + TString type; TFileStat fstat(filename); if (fstat.IsFile()) { - blob = TUnbufferedFileInput(filename).ReadAll(); + blob = TUnbufferedFileInput(filename).ReadAll(); if (!blob.empty()) { type = mimetypeByExt(filename.c_str()); } @@ -409,7 +409,7 @@ private: ctx.ExecutorThread.RegisterActor(itJson->second->CreateRequestActor(this, ev)); } catch (const std::exception& e) { - ctx.Send(ev->Sender, new NMon::TEvHttpInfoRes(TString("HTTP/1.1 400 Bad Request\r\n\r\n") + e.what(), 0, NMon::IEvHttpInfoRes::EContentType::Custom)); + ctx.Send(ev->Sender, new NMon::TEvHttpInfoRes(TString("HTTP/1.1 400 Bad Request\r\n\r\n") + e.what(), 0, NMon::IEvHttpInfoRes::EContentType::Custom)); return; } } else { diff --git a/ydb/core/viewer/viewer.h b/ydb/core/viewer/viewer.h index ab34762e3ed..87ae4d08d96 100644 --- a/ydb/core/viewer/viewer.h +++ b/ydb/core/viewer/viewer.h @@ -29,7 +29,7 @@ public: }; TString Path; - TVector<TPathEntry> Paths; + TVector<TPathEntry> Paths; TActorId Owner; TString UserToken; @@ -103,7 +103,7 @@ public: using TContentHandler = std::function<IActor*(const TActorId&, const TContentRequestContext&)>; virtual const TKikimrRunConfig& GetKikimrRunConfig() const = 0; - virtual TVector<const TVirtualHandler*> GetVirtualHandlers(NKikimrViewer::EObjectType type, const TString& path) const = 0; + virtual TVector<const TVirtualHandler*> GetVirtualHandlers(NKikimrViewer::EObjectType type, const TString& path) const = 0; virtual void RegisterVirtualHandler(NKikimrViewer::EObjectType parentObjectType, TVirtualHandlerType handler) = 0; // returns nullptr if no such handler @@ -123,22 +123,22 @@ void SetupKqpContentHandler(IViewer* viewer); template <typename RequestType> struct TJsonRequestSchema { - static TString GetSchema() { return TString(); } + static TString GetSchema() { return TString(); } }; template <typename RequestType> struct TJsonRequestSummary { - static TString GetSummary() { return TString(); } + static TString GetSummary() { return TString(); } }; template <typename RequestType> struct TJsonRequestDescription { - static TString GetDescription() { return TString(); } + static TString GetDescription() { return TString(); } }; template <typename RequestType> struct TJsonRequestParameters { - static TString GetParameters() { return TString(); } + static TString GetParameters() { return TString(); } }; static const char HTTPOKJSON[] = "HTTP/1.1 200 Ok\r\nAccess-Control-Allow-Origin: *\r\nContent-Type: application/json; charset=utf-8\r\nConnection: Close\r\n\r\n"; diff --git a/ydb/core/viewer/wb_aggregate.h b/ydb/core/viewer/wb_aggregate.h index 7d09f1565f6..091a2a6e69b 100644 --- a/ydb/core/viewer/wb_aggregate.h +++ b/ydb/core/viewer/wb_aggregate.h @@ -18,7 +18,7 @@ class TWhiteboardAggregator { public: using TResponseType = ResponseType; - static THolder<TResponseType> AggregateResponses(TVector<THolder<TResponseType>>& responses) { + static THolder<TResponseType> AggregateResponses(TVector<THolder<TResponseType>>& responses) { THolder<TResponseType> result = MakeHolder<TResponseType>(); for (const auto& response : responses) { AggregateMessage(result->Record, response->Record); @@ -26,7 +26,7 @@ public: return result; } - static THolder<TResponseType> AggregateResponses(TMap<TTabletId, THolder<TResponseType>>& responses) { + static THolder<TResponseType> AggregateResponses(TMap<TTabletId, THolder<TResponseType>>& responses) { THolder<TResponseType> result = MakeHolder<TResponseType>(); for (const auto& response : responses) { AggregateMessage(result->Record, response.second->Record); @@ -36,12 +36,12 @@ public: }; template <typename ResponseType> -THolder<ResponseType> AggregateWhiteboardResponses(TVector<THolder<ResponseType>>& responses) { +THolder<ResponseType> AggregateWhiteboardResponses(TVector<THolder<ResponseType>>& responses) { return TWhiteboardAggregator<ResponseType>::AggregateResponses(responses); } template <typename ResponseType> -THolder<ResponseType> AggregateWhiteboardResponses(TMap<TTabletId, THolder<ResponseType>>& responses) { +THolder<ResponseType> AggregateWhiteboardResponses(TMap<TTabletId, THolder<ResponseType>>& responses) { return TWhiteboardAggregator<ResponseType>::AggregateResponses(responses); } diff --git a/ydb/core/viewer/wb_filter.cpp b/ydb/core/viewer/wb_filter.cpp index d7899f5edfb..1054660ff82 100644 --- a/ydb/core/viewer/wb_filter.cpp +++ b/ydb/core/viewer/wb_filter.cpp @@ -39,7 +39,7 @@ bool TFieldProtoValueExtractor<bool>::ExtractValue(const Reflection& reflection, } template <> -TString TFieldProtoValueExtractor<TString>::ExtractValue(const Reflection& reflection, const Message& element) const { +TString TFieldProtoValueExtractor<TString>::ExtractValue(const Reflection& reflection, const Message& element) const { return reflection.GetString(element, Field); } diff --git a/ydb/core/viewer/wb_filter.h b/ydb/core/viewer/wb_filter.h index 99c279b4fa1..271e63d9565 100644 --- a/ydb/core/viewer/wb_filter.h +++ b/ydb/core/viewer/wb_filter.h @@ -13,10 +13,10 @@ template <typename ResponseType> struct TWhiteboardInfo; struct TEnumValue { - TString Name; + TString Name; int Value; - TEnumValue(const TString& string) { + TEnumValue(const TString& string) { if (!TryFromString<int>(string, Value)) { Name = string; } @@ -228,7 +228,7 @@ public: CppType Value; }; - static THolder<ResponseType> FilterResponse(THolder<TResponseType>& source, const TVector<THolder<IFieldProtoFilter>>& filters) { + static THolder<ResponseType> FilterResponse(THolder<TResponseType>& source, const TVector<THolder<IFieldProtoFilter>>& filters) { THolder<TResponseType> result = MakeHolder<TResponseType>(); auto* field = TWhiteboardInfo<ResponseType>::GetElementsField(result.Get()); auto* sourceField = TWhiteboardInfo<ResponseType>::GetElementsField(source.Get()); @@ -268,21 +268,21 @@ public: return result; } - static TVector<THolder<IFieldProtoFilter>> GetProtoFilters(TString filters) { + static TVector<THolder<IFieldProtoFilter>> GetProtoFilters(TString filters) { // TODO: convert to StringBuf operations? const Descriptor& descriptor = *TElementType::descriptor(); - TVector<TString> requestedFilters; - TVector<THolder<IFieldProtoFilter>> foundFilters; + TVector<TString> requestedFilters; + TVector<THolder<IFieldProtoFilter>> foundFilters; if (filters.StartsWith('(') && filters.EndsWith(')')) { filters = filters.substr(1, filters.size() - 2); } StringSplitter(filters).Split(';').SkipEmpty().Collect(&requestedFilters); - for (const TString& str : requestedFilters) { + for (const TString& str : requestedFilters) { size_t opFirstPos = str.find_first_of("!><="); // TODO: replace with error reporting - //Y_VERIFY(opPos != TString::npos); + //Y_VERIFY(opPos != TString::npos); THolder<IFieldProtoFilter> filter; - TString field = str.substr(0, opFirstPos); + TString field = str.substr(0, opFirstPos); size_t opEndPos = str.find_first_not_of("!><=", opFirstPos); if (opEndPos != TString::npos) { TString op = str.substr(opFirstPos, opEndPos - opFirstPos); @@ -545,8 +545,8 @@ public: }; template <typename ResponseType> -THolder<ResponseType> FilterWhiteboardResponses(THolder<ResponseType>& response, const TString& filters) { - TVector<THolder<typename TWhiteboardFilter<ResponseType>::IFieldProtoFilter>> filterFilters = +THolder<ResponseType> FilterWhiteboardResponses(THolder<ResponseType>& response, const TString& filters) { + TVector<THolder<typename TWhiteboardFilter<ResponseType>::IFieldProtoFilter>> filterFilters = TWhiteboardFilter<ResponseType>::GetProtoFilters(filters); return TWhiteboardFilter<ResponseType>::FilterResponse(response, filterFilters); } diff --git a/ydb/core/viewer/wb_group.h b/ydb/core/viewer/wb_group.h index 9735d8f29ec..fd25d5c8b75 100644 --- a/ydb/core/viewer/wb_group.h +++ b/ydb/core/viewer/wb_group.h @@ -136,7 +136,7 @@ public: class TPartProtoKeyEnum { public: - TPartProtoKeyEnum(const TVector<const FieldDescriptor*>& fields) + TPartProtoKeyEnum(const TVector<const FieldDescriptor*>& fields) { for (const FieldDescriptor* field : fields) { const EnumDescriptor* enumDescriptor = field->enum_type(); @@ -159,13 +159,13 @@ public: return false; } - TVector<const EnumDescriptor*> Fields; - TVector<const EnumValueDescriptor*> Values; + TVector<const EnumDescriptor*> Fields; + TVector<const EnumValueDescriptor*> Values; }; class TPartProtoKey { public: - TPartProtoKey(TElementType& element, const TVector<const FieldDescriptor*>& fields) + TPartProtoKey(TElementType& element, const TVector<const FieldDescriptor*>& fields) : Element(element) , Fields(fields) {} @@ -230,10 +230,10 @@ public: protected: TElementType& Element; - const TVector<const FieldDescriptor*>& Fields; + const TVector<const FieldDescriptor*>& Fields; }; - static bool IsEnum(const TVector<const FieldDescriptor*>& fields) { + static bool IsEnum(const TVector<const FieldDescriptor*>& fields) { for (const FieldDescriptor* field : fields) { if (field->cpp_type() != FieldDescriptor::CPPTYPE_ENUM) { return false; @@ -242,12 +242,12 @@ public: return true; } - static THolder<ResponseType> GroupResponse(THolder<TResponseType>& source, const TVector<const FieldDescriptor*>& groupFields, bool allEnums = false) { + static THolder<ResponseType> GroupResponse(THolder<TResponseType>& source, const TVector<const FieldDescriptor*>& groupFields, bool allEnums = false) { THolder<TResponseType> result = MakeHolder<TResponseType>(); TElementsFieldType* field = TWhiteboardInfo<ResponseType>::GetElementsField(result.Get()); bool allKeys = allEnums && IsEnum(groupFields); - TMap<TPartProtoKey, ui32> counters; - TMap<TPartProtoKey, TElementType*> elements; + TMap<TPartProtoKey, ui32> counters; + TMap<TPartProtoKey, TElementType*> elements; if (allKeys) { TPartProtoKeyEnum keyEnum(groupFields); do { @@ -280,12 +280,12 @@ public: return result; } - static TVector<const FieldDescriptor*> GetProtoFields(const TString& fields) { + static TVector<const FieldDescriptor*> GetProtoFields(const TString& fields) { const Descriptor& descriptor = *TElementType::descriptor(); - TVector<TString> requestedFields; - TVector<const FieldDescriptor*> foundFields; + TVector<TString> requestedFields; + TVector<const FieldDescriptor*> foundFields; StringSplitter(fields).Split(',').SkipEmpty().Collect(&requestedFields); - for (const TString& str : requestedFields) { + for (const TString& str : requestedFields) { const FieldDescriptor* fieldDescriptor = descriptor.FindFieldByName(str); if (fieldDescriptor != nullptr) { foundFields.push_back(fieldDescriptor); @@ -298,8 +298,8 @@ public: }; template <typename ResponseType> -THolder<ResponseType> GroupWhiteboardResponses(THolder<ResponseType>& response, const TString& fields, bool allEnums = false) { - TVector<const FieldDescriptor*> groupFields = TWhiteboardGrouper<ResponseType>::GetProtoFields(fields); +THolder<ResponseType> GroupWhiteboardResponses(THolder<ResponseType>& response, const TString& fields, bool allEnums = false) { + TVector<const FieldDescriptor*> groupFields = TWhiteboardGrouper<ResponseType>::GetProtoFields(fields); return TWhiteboardGrouper<ResponseType>::GroupResponse(response, groupFields, allEnums); } diff --git a/ydb/core/ymq/actor/executor.h b/ydb/core/ymq/actor/executor.h index 5dd51c6da23..35ad6143c1c 100644 --- a/ydb/core/ymq/actor/executor.h +++ b/ydb/core/ymq/actor/executor.h @@ -226,7 +226,7 @@ private: const TSqsEvents::TExecutedCallback Cb_; THolder<TRequest> Request_; TString MkqlProgramText_; - THashMap<TString, ui64> CompileResolveCookies_; + THashMap<TString, ui64> CompileResolveCookies_; bool CompilationPending_ = false; size_t CompilationRetries_ = 3; TMaybe<EQueryId> QueryId_; // information for logging diff --git a/ydb/core/ymq/client/bin/main.cpp b/ydb/core/ymq/client/bin/main.cpp index cb7dbd2a2c6..707c8ecbc28 100644 --- a/ydb/core/ymq/client/bin/main.cpp +++ b/ydb/core/ymq/client/bin/main.cpp @@ -366,7 +366,7 @@ static int HandleRead(int argc, const char* argv[]) { << resp.GetError().GetMessage() << Endl; return 1; } else if (resp.MessagesSize()) { - TVector<TString> receipts; + TVector<TString> receipts; for (size_t i = 0; i < resp.MessagesSize(); ++i) { const auto& msg = resp.GetMessages(i); diff --git a/ydb/core/ymq/http/http.cpp b/ydb/core/ymq/http/http.cpp index 5d0963bfb2e..ba15c49b065 100644 --- a/ydb/core/ymq/http/http.cpp +++ b/ydb/core/ymq/http/http.cpp @@ -275,7 +275,7 @@ TString THttpRequest::GetRequestPathPart(TStringBuf path, size_t partIdx) const path.SkipPrefix(PRIVATE_REQUEST_PATH_PREFIX); } - TVector<TStringBuf> items; + TVector<TStringBuf> items; StringSplitter(path).Split('/').AddTo(&items); if (items.size() > partIdx) { return TString(items[partIdx]); diff --git a/ydb/core/yql_testlib/yql_testlib.cpp b/ydb/core/yql_testlib/yql_testlib.cpp index 35838c40f6a..4e40fc40bba 100644 --- a/ydb/core/yql_testlib/yql_testlib.cpp +++ b/ydb/core/yql_testlib/yql_testlib.cpp @@ -40,9 +40,9 @@ private: const NKikimr::NUdf::IValueBuilder* valueBuilder, const NKikimr::NUdf::TUnboxedValuePod* args) const override { - TString orig(args[0].AsStringRef()); + TString orig(args[0].AsStringRef()); ui64 times = args[1].Get<ui64>(); - TString res = ""; + TString res = ""; for (ui64 i = 0; i < times; i++) { res += orig; } @@ -189,7 +189,7 @@ void TYqlServer::Initialize() { } -void MakeGatewaysConfig(const THashMap<TString, TString>& clusterMapping, NYql::TGatewaysConfig& gatewaysConfig) { +void MakeGatewaysConfig(const THashMap<TString, TString>& clusterMapping, NYql::TGatewaysConfig& gatewaysConfig) { for (auto& x : clusterMapping) { if (x.second == NYql::YtProviderName) { auto cluster = gatewaysConfig.MutableYt()->AddClusterMapping(); diff --git a/ydb/core/yql_testlib/yql_testlib.h b/ydb/core/yql_testlib/yql_testlib.h index 39176df699b..7c16abcbf8d 100644 --- a/ydb/core/yql_testlib/yql_testlib.h +++ b/ydb/core/yql_testlib/yql_testlib.h @@ -37,7 +37,7 @@ protected: NThreading::TPromise<void> ResumeYqlExecutionPromise; }; -void MakeGatewaysConfig(const THashMap<TString, TString>& clusterMapping, NYql::TGatewaysConfig& gatewaysConfig); +void MakeGatewaysConfig(const THashMap<TString, TString>& clusterMapping, NYql::TGatewaysConfig& gatewaysConfig); } } diff --git a/ydb/library/aclib/aclib.cpp b/ydb/library/aclib/aclib.cpp index 946497ea303..9fd31a9f451 100644 --- a/ydb/library/aclib/aclib.cpp +++ b/ydb/library/aclib/aclib.cpp @@ -62,7 +62,7 @@ TUserToken::TUserToken(NACLibProto::TUserToken&& token) { Swap(&token); } -TUserToken::TUserToken(const TString& token) { +TUserToken::TUserToken(const TString& token) { Y_VERIFY(ParseFromString(token)); } @@ -85,8 +85,8 @@ TSID TUserToken::GetUserSID() const { return NACLibProto::TUserToken::GetUserSID(); } -TVector<TSID> TUserToken::GetGroupSIDs() const { - TVector<TSID> groupSIDs; +TVector<TSID> TUserToken::GetGroupSIDs() const { + TVector<TSID> groupSIDs; for (const auto& bucket : NACLibProto::TUserToken::GetGroupSIDs().GetBuckets()) { for (const TString& value : bucket.GetValues()) { groupSIDs.emplace_back(value); @@ -99,7 +99,7 @@ TString TUserToken::GetOriginalUserToken() const { return NACLibProto::TUserToken::GetOriginalUserToken(); } -TString TUserToken::SerializeAsString() const { +TString TUserToken::SerializeAsString() const { return NACLibProto::TUserToken::SerializeAsString(); } @@ -361,7 +361,7 @@ void TACL::SortACL() { Sort(*(MutableACE()), [](const NACLibProto::TACE& a, const NACLibProto::TACE& b) -> bool { return a.GetAccessType() < b.GetAccessType(); }); } -TACL::TACL(const TString& string) { +TACL::TACL(const TString& string) { Y_VERIFY(ParseFromString(string)); } @@ -391,7 +391,7 @@ NACLibProto::TACL TACL::GetImmediateACL() const { return immediateACL; } -TString TACL::ToString(const NACLibProto::TACE& ace) { +TString TACL::ToString(const NACLibProto::TACE& ace) { TStringStream str; switch (static_cast<EAccessType>(ace.GetAccessType())) { case EAccessType::Allow: @@ -422,7 +422,7 @@ TString TACL::ToString(const NACLibProto::TACE& ace) { str << 'U'; break; default: { - TVector<TStringBuf> rights; + TVector<TStringBuf> rights; if (ar & EAccessRights::SelectRow) rights.emplace_back("SR"); if (ar & EAccessRights::UpdateRow) @@ -483,7 +483,7 @@ TString TACL::ToString(const NACLibProto::TACE& ace) { return str.Str(); } -TString TACL::ToString() const { +TString TACL::ToString() const { TStringStream str; bool inherited = false; const auto& acl = GetACE(); @@ -547,7 +547,7 @@ ui32 TACL::SpecialRightsFromString(const TString& string) { return result; } -void TACL::FromString(NACLibProto::TACE& ace, const TString& string) { +void TACL::FromString(NACLibProto::TACE& ace, const TString& string) { auto it = string.begin(); switch (*it) { case '+': @@ -607,7 +607,7 @@ void TACL::FromString(NACLibProto::TACE& ace, const TString& string) { } auto start_pos = it - string.begin(); auto end_pos = string.find(':', start_pos); - ace.SetSID(string.substr(start_pos, end_pos == TString::npos ? end_pos : end_pos - start_pos)); + ace.SetSID(string.substr(start_pos, end_pos == TString::npos ? end_pos : end_pos - start_pos)); if (end_pos == TString::npos) { ace.SetInheritanceType(EInheritanceType::InheritContainer | EInheritanceType::InheritObject); return; @@ -636,21 +636,21 @@ void TACL::FromString(NACLibProto::TACE& ace, const TString& string) { } } -void TACL::FromString(const TString& string) { +void TACL::FromString(const TString& string) { auto& acl = *MutableACE(); acl.Clear(); for (auto it = string.begin(); it != string.end(); ++it) { auto& ace = *acl.Add(); auto start_pos = it - string.begin(); auto end_pos = string.find(';', start_pos); - FromString(ace, string.substr(start_pos, end_pos == TString::npos ? end_pos : end_pos - start_pos)); - if (end_pos == TString::npos) + FromString(ace, string.substr(start_pos, end_pos == TString::npos ? end_pos : end_pos - start_pos)); + if (end_pos == TString::npos) break; it = string.begin() + end_pos; } } -TDiffACL::TDiffACL(const TString& string) { +TDiffACL::TDiffACL(const TString& string) { Y_VERIFY(ParseFromString(string)); } @@ -707,7 +707,7 @@ TString AccessRightsToString(ui32 accessRights) { case EAccessRights::GenericManage: return "Manage"; case EAccessRights::GenericUse: return "Use"; } - TVector<TStringBuf> rights; + TVector<TStringBuf> rights; if (accessRights & EAccessRights::SelectRow) rights.emplace_back("SelectRow"); if (accessRights & EAccessRights::UpdateRow) diff --git a/ydb/library/aclib/aclib.h b/ydb/library/aclib/aclib.h index 655ca4b6693..b117f777e63 100644 --- a/ydb/library/aclib/aclib.h +++ b/ydb/library/aclib/aclib.h @@ -59,7 +59,7 @@ enum class EDiffType : ui32 { Remove, }; -using TSID = TString; +using TSID = TString; class TUserToken : protected NACLibProto::TUserToken, public TThrRefBase { public: @@ -72,16 +72,16 @@ public: TUserToken(TUserTokenInitFields fields); TUserToken(const TVector<TSID>& userAndGroupSIDs); - TUserToken(const TSID& userSID, const TVector<TSID>& groupSIDs); + TUserToken(const TSID& userSID, const TVector<TSID>& groupSIDs); TUserToken(const TString& originalUserToken, const TSID& userSID, const TVector<TSID>& groupSIDs); TUserToken(const NACLibProto::TUserToken& token); TUserToken(NACLibProto::TUserToken&& token); - TUserToken(const TString& token); + TUserToken(const TString& token); bool IsExist(const TSID& someSID) const; // check for presence of SID specified in the token TSID GetUserSID() const; - TVector<TSID> GetGroupSIDs() const; + TVector<TSID> GetGroupSIDs() const; TString GetOriginalUserToken() const; - TString SerializeAsString() const; + TString SerializeAsString() const; void AddGroupSID(const TSID& groupSID); using NACLibProto::TUserToken::ShortDebugString; @@ -95,17 +95,17 @@ protected: class TACL : public NACLibProto::TACL { public: TACL() = default; - TACL(const TString& string); // proto format + TACL(const TString& string); // proto format std::pair<ui32, ui32> AddAccess(EAccessType type, ui32 access, const TSID& sid, ui32 inheritance = InheritObject | InheritContainer); std::pair<ui32, ui32> RemoveAccess(NACLib::EAccessType type, ui32 access, const NACLib::TSID& sid, ui32 inheritance = InheritObject | InheritContainer); std::pair<ui32, ui32> RemoveAccess(const NACLibProto::TACE& filter); std::pair<ui32, ui32> ClearAccess(); std::pair<ui32, ui32> ApplyDiff(const NACLibProto::TDiffACL& diffACL); NACLibProto::TACL GetImmediateACL() const; - TString ToString() const; // simple text format - void FromString(const TString& string); // simple text format - static TString ToString(const NACLibProto::TACE& ace); - static void FromString(NACLibProto::TACE& ace, const TString& string); + TString ToString() const; // simple text format + void FromString(const TString& string); // simple text format + static TString ToString(const NACLibProto::TACE& ace); + static void FromString(NACLibProto::TACE& ace, const TString& string); protected: static ui32 SpecialRightsFromString(const TString& string); @@ -116,7 +116,7 @@ protected: class TDiffACL : public NACLibProto::TDiffACL { public: TDiffACL() = default; - TDiffACL(const TString& string); + TDiffACL(const TString& string); void AddAccess(EAccessType type, ui32 access, const TSID& sid, ui32 inheritance = InheritObject | InheritContainer); void RemoveAccess(NACLib::EAccessType type, ui32 access, const NACLib::TSID& sid, ui32 inheritance = InheritObject | InheritContainer); void AddAccess(const NACLibProto::TACE& access); diff --git a/ydb/library/aclib/aclib_ut.cpp b/ydb/library/aclib/aclib_ut.cpp index c5828f86244..80c941f4f7a 100644 --- a/ydb/library/aclib/aclib_ut.cpp +++ b/ydb/library/aclib/aclib_ut.cpp @@ -5,12 +5,12 @@ using namespace NACLib; Y_UNIT_TEST_SUITE(ACLib) { - static const TString James = "james@bookstore"; - static const TVector<TString> JamesGroups = {"Humans", "Administrators"}; - static const TString Cat = "cat@bookstore"; - static const TVector<TString> CatGroups = {"Animals", "Cats", "Readers"}; - static const TString Dog = "dog@bookstore"; - static const TVector<TString> DogGroups = {"Animals", "Dogs", "Writers"}; + static const TString James = "james@bookstore"; + static const TVector<TString> JamesGroups = {"Humans", "Administrators"}; + static const TString Cat = "cat@bookstore"; + static const TVector<TString> CatGroups = {"Animals", "Cats", "Readers"}; + static const TString Dog = "dog@bookstore"; + static const TVector<TString> DogGroups = {"Animals", "Dogs", "Writers"}; Y_UNIT_TEST(TestUsers) { TSecurityObject rootACL(James, true); @@ -18,9 +18,9 @@ Y_UNIT_TEST_SUITE(ACLib) { rootACL.AddAccess(EAccessType::Allow, EAccessRights::GenericRead, Cat, EInheritanceType::InheritContainer); rootACL.AddAccess(EAccessType::Allow, EAccessRights::GenericFull, Dog, EInheritanceType::InheritContainer); - TUserToken jamesToken(James, TVector<TSID>()); - TUserToken catToken(Cat, TVector<TSID>()); - TUserToken dogToken(Dog, TVector<TSID>()); + TUserToken jamesToken(James, TVector<TSID>()); + TUserToken catToken(Cat, TVector<TSID>()); + TUserToken dogToken(Dog, TVector<TSID>()); UNIT_ASSERT(rootACL.CheckAccess(EAccessRights::SelectRow, jamesToken) == true); UNIT_ASSERT(rootACL.CheckAccess(EAccessRights::SelectRow, catToken) == true); diff --git a/ydb/library/backup/ut/ya.make b/ydb/library/backup/ut/ya.make index 2819acff50a..27125b62243 100644 --- a/ydb/library/backup/ut/ya.make +++ b/ydb/library/backup/ut/ya.make @@ -11,9 +11,9 @@ TIMEOUT(60) SRC(ut.cpp) -PEERDIR( +PEERDIR( library/cpp/string_utils/quote ydb/library/backup -) - +) + END() diff --git a/ydb/library/schlab/schine/cbs.h b/ydb/library/schlab/schine/cbs.h index c71073200be..efb1635d568 100644 --- a/ydb/library/schlab/schine/cbs.h +++ b/ydb/library/schlab/schine/cbs.h @@ -28,7 +28,7 @@ public: static const ui64 InvalidIdx = 65535; - typedef TList<TIntrusivePtr<TJob>> TJobs; + typedef TList<TIntrusivePtr<TJob>> TJobs; TJobs Jobs; ui64 JobsSize; ui64 JobsCost; diff --git a/ydb/library/schlab/schine/scheduler.h b/ydb/library/schlab/schine/scheduler.h index 684b9110ed9..d6bde0141ec 100644 --- a/ydb/library/schlab/schine/scheduler.h +++ b/ydb/library/schlab/schine/scheduler.h @@ -39,17 +39,17 @@ struct TGateRecord { }; struct TOwnerRecord { - TVector<TGateRecord> Gates; + TVector<TGateRecord> Gates; }; class TScheduler { - TVector<TCbs> Cbs; + TVector<TCbs> Cbs; TNameTable NameTable; ui64 TotalWeight = 0; ui32 FirstEmptyCbs = 0; - TVector<TOwnerRecord> Owners; + TVector<TOwnerRecord> Owners; ui64 NextJobId = 0; - TVector<TIntrusivePtr<TJob>> EdfJobs; + TVector<TIntrusivePtr<TJob>> EdfJobs; TReallyFastRng32 Rng; TSchLog SchLog; diff --git a/ydb/library/schlab/schoot/schoot_gen.h b/ydb/library/schlab/schoot/schoot_gen.h index 576e3b10398..97a5a738753 100644 --- a/ydb/library/schlab/schoot/schoot_gen.h +++ b/ydb/library/schlab/schoot/schoot_gen.h @@ -24,7 +24,7 @@ public: }; class TSchOotGenSet { - TVector<TSchOotGen> Gen; + TVector<TSchOotGen> Gen; public: TSchOotGenSet(const TSchOotGenCfgSet &cfgSet); diff --git a/ydb/library/schlab/schoot/schoot_gen_cfg.h b/ydb/library/schlab/schoot/schoot_gen_cfg.h index 9d6d3aef219..7287c1d51eb 100644 --- a/ydb/library/schlab/schoot/schoot_gen_cfg.h +++ b/ydb/library/schlab/schoot/schoot_gen_cfg.h @@ -19,7 +19,7 @@ struct TSchOotGenCfg { }; struct TSchOotGenCfgSet { - TDeque<TSchOotGenCfg> Cfg; + TDeque<TSchOotGenCfg> Cfg; bool IsValid; TString ErrorDetails; diff --git a/ydb/library/yql/ast/yql_ast.cpp b/ydb/library/yql/ast/yql_ast.cpp index 16e521d9010..712e8b7cd36 100644 --- a/ydb/library/yql/ast/yql_ast.cpp +++ b/ydb/library/yql/ast/yql_ast.cpp @@ -146,7 +146,7 @@ namespace { } private: - inline void AddError(const TString& message) { + inline void AddError(const TString& message) { Issues_.AddIssue(Ctx_.Position(), message); } @@ -292,7 +292,7 @@ namespace { continue; } - TString token; + TString token; if (!TryParseMultilineToken(token)) { return nullptr; } @@ -381,7 +381,7 @@ namespace { return TAstNode::NewAtom(resPosition, Ctx_.GetToken(atomStart, Ctx_.Offset()), Ctx_.Pool()); } - bool TryParseMultilineToken(TString& token) { + bool TryParseMultilineToken(TString& token) { Ctx_.Next(); // skip second '@' ui32 start = Ctx_.Offset(); @@ -444,7 +444,7 @@ namespace { void MultilineAtomPrint(IOutputStream& out, const TStringBuf& str) { out << TStringBuf("@@"); size_t idx = str.find('@'); - if (idx == TString::npos) { + if (idx == TString::npos) { out << str; } else { const char* begin = str.data(); @@ -463,7 +463,7 @@ namespace { } } idx = str.find('@', idx); - } while (idx != TString::npos); + } while (idx != TString::npos); out.Write(begin, str.end() - begin); } out << TStringBuf("@@"); diff --git a/ydb/library/yql/ast/yql_ast.h b/ydb/library/yql/ast/yql_ast.h index 887b53dbc5d..d2b8e9eefec 100644 --- a/ydb/library/yql/ast/yql_ast.h +++ b/ydb/library/yql/ast/yql_ast.h @@ -5,7 +5,7 @@ #include <library/cpp/deprecated/enum_codegen/enum_codegen.h> #include <util/generic/ptr.h> #include <util/generic/strbuf.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/vector.h> #include <util/stream/output.h> #include <util/stream/str.h> @@ -39,13 +39,13 @@ struct TAstNode { void PrintTo(IOutputStream& out) const; void PrettyPrintTo(IOutputStream& out, ui32 prettyFlags) const; - inline TString ToString() const { + inline TString ToString() const { TStringStream str; PrintTo(str); return str.Str(); } - inline TString ToString(ui32 prettyFlags) const { + inline TString ToString(ui32 prettyFlags) const { TStringStream str; PrettyPrintTo(str, prettyFlags); return str.Str(); @@ -219,7 +219,7 @@ private: ui32 Flags; }; - struct TListType { + struct TListType { TAstNode** Children; }; @@ -229,7 +229,7 @@ private: union { TAtom A; - TListType L; + TListType L; TSmallList S; } Data; }; diff --git a/ydb/library/yql/ast/yql_ast_annotation.h b/ydb/library/yql/ast/yql_ast_annotation.h index c909ce9df4d..5b0b96e508d 100644 --- a/ydb/library/yql/ast/yql_ast_annotation.h +++ b/ydb/library/yql/ast/yql_ast_annotation.h @@ -14,7 +14,7 @@ TAstNode* ApplyPositionAnnotations(TAstNode& root, ui32 annotationIndex, TMemory // returns false in case of error bool ApplyPositionAnnotationsInplace(TAstNode& root, ui32 annotationIndex); -typedef THashMap<const TAstNode*, TVector<const TAstNode*>> TAnnotationNodeMap; +typedef THashMap<const TAstNode*, TVector<const TAstNode*>> TAnnotationNodeMap; // returns nullptr in case of error TAstNode* ExtractAnnotations(TAstNode& root, TAnnotationNodeMap& annotations, TMemoryPool& pool); diff --git a/ydb/library/yql/ast/yql_ast_ut.cpp b/ydb/library/yql/ast/yql_ast_ut.cpp index 23e140653d7..8a8d520b45c 100644 --- a/ydb/library/yql/ast/yql_ast_ut.cpp +++ b/ydb/library/yql/ast/yql_ast_ut.cpp @@ -52,8 +52,8 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { TAstParseResult ast = ParseAst(TEST_PROGRAM); UNIT_ASSERT(ast.IsOk()); - TString printedProgram = ast.Root->ToString(); - UNIT_ASSERT(printedProgram.find('\n') == TString::npos); + TString printedProgram = ast.Root->ToString(); + UNIT_ASSERT(printedProgram.find('\n') == TString::npos); TAstParseResult parsedAst = ParseAst(printedProgram); UNIT_ASSERT(parsedAst.IsOk()); @@ -73,11 +73,11 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { for (ui32 i = 0; i < Y_ARRAY_SIZE(testFlags); ++i) { ui32 prettyFlags = testFlags[i]; - TString printedProgram1 = ast.Root->ToString(prettyFlags); + TString printedProgram1 = ast.Root->ToString(prettyFlags); TAstParseResult parsedAst = ParseAst(printedProgram1); UNIT_ASSERT(parsedAst.IsOk()); - TString printedProgram2 = parsedAst.Root->ToString(prettyFlags); + TString printedProgram2 = parsedAst.Root->ToString(prettyFlags); UNIT_ASSERT_STRINGS_EQUAL(printedProgram1, printedProgram2); } } @@ -101,7 +101,7 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { removedAnn.Root = RemoveAnnotations(*annRes.Root, pool); UNIT_ASSERT(!!removedAnn.Root); - TString strOriginal = ast.Root->ToString(); + TString strOriginal = ast.Root->ToString(); TString strAnnRemoved = removedAnn.Root->ToString(); UNIT_ASSERT_VALUES_EQUAL(strOriginal, strAnnRemoved); @@ -119,7 +119,7 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { template <typename TCharType> void TestGoodArbitraryAtom( - const TString& program, + const TString& program, const TBasicStringBuf<TCharType>& expectedValue) { TAstParseResult ast = ParseAst(program); @@ -178,8 +178,8 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { } void TestBadArbitraryAtom( - const TString& program, - const TString& expectedError) + const TString& program, + const TString& expectedError) { TAstParseResult ast = ParseAst(program); UNIT_ASSERT(false == ast.IsOk()); @@ -230,11 +230,11 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { TestBadArbitraryAtom("(x\"abcd", "Unexpected end of atom"); } - void ParseAndPrint(const TString& program, const TString& expected) { + void ParseAndPrint(const TString& program, const TString& expected) { TAstParseResult ast = ParseAst(program); UNIT_ASSERT_C(ast.IsOk(), program); - TString result = ast.Root->ToString(); + TString result = ast.Root->ToString(); UNIT_ASSERT_STRINGS_EQUAL_C(result, expected, program); } @@ -265,11 +265,11 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { ParseAndPrint("(x\"ab12cd\" x)", "(x\"AB12CD\" x)"); } - void ParseAndAdaptPrint(const TString& program, const TString& expected) { + void ParseAndAdaptPrint(const TString& program, const TString& expected) { TAstParseResult ast = ParseAst(program); UNIT_ASSERT_C(ast.IsOk(), program); - TString result = ast.Root->ToString( + TString result = ast.Root->ToString( TAstPrintFlags::ShortQuote | TAstPrintFlags::PerLine | TAstPrintFlags::AdaptArbitraryContent); @@ -286,7 +286,7 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { ParseAndAdaptPrint("(\"\")", "(\"\")"); } - void ParseError(const TString& program) { + void ParseError(const TString& program) { TAstParseResult ast = ParseAst(program); UNIT_ASSERT_C(!ast.IsOk(), program); } @@ -329,22 +329,22 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { } Y_UNIT_TEST(MultilineAtom) { - TString s1 = "(@@multi \n" + TString s1 = "(@@multi \n" "line \n" "string@@)"; ParseAndPrint(s1, s1); - TString s2 = "(@@multi \n" + TString s2 = "(@@multi \n" "l@ine \n" "string@@)"; ParseAndPrint(s2, s2); - TString s3 = "(@@multi \n" + TString s3 = "(@@multi \n" "l@@@ine \n" "string@@)"; ParseError(s3); - TString s4 = "(@@multi \n" + TString s4 = "(@@multi \n" "l@@@@ine \n" "string@@)"; ParseAndPrint(s4, s4); @@ -365,7 +365,7 @@ Y_UNIT_TEST_SUITE(TParseYqlAst) { UNIT_ASSERT(atom->IsAtom()); UNIT_ASSERT(atom->GetFlags() & TNodeFlags::MultilineContent); - TString expected = "\n" + TString expected = "\n" "one@\n" "two@@\n" "four@@@@\n" diff --git a/ydb/library/yql/ast/yql_expr.cpp b/ydb/library/yql/ast/yql_expr.cpp index 82f6c5812ac..8817950bd88 100644 --- a/ydb/library/yql/ast/yql_expr.cpp +++ b/ydb/library/yql/ast/yql_expr.cpp @@ -90,12 +90,12 @@ namespace { struct TContext { struct TFrame { THashMap<TString, TExprNode::TListType> Bindings; - THashMap<TString, TString> Imports; + THashMap<TString, TString> Imports; TExprNode::TListType Return; }; TExprContext& Expr; - TVector<TFrame> Frames; + TVector<TFrame> Frames; TLibraryCohesion Cohesion; TNodeOnNodeOwnedMap DeepClones; @@ -111,7 +111,7 @@ namespace { { } - void AddError(const TAstNode& node, const TString& message) { + void AddError(const TAstNode& node, const TString& message) { Expr.AddError(TIssue(node.GetPosition(), message)); } @@ -141,14 +141,14 @@ namespace { return {}; } - TString FindImport(const TStringBuf& name) const { + TString FindImport(const TStringBuf& name) const { for (auto it = Frames.crbegin(); it != Frames.crend(); ++it) { const auto r = it->Imports.find(name); if (it->Imports.cend() != r) return r->second; } - return TString(); + return TString(); } const TTypeAnnotationNode* CompileTypeAnnotation(const TAstNode& node) { @@ -253,7 +253,7 @@ namespace { return Expr.MakeType<TStreamExprType>(r); } else if (content == TStringBuf("Struct")) { - TVector<const TItemExprType*> children; + TVector<const TItemExprType*> children; for (size_t index = 1; index < node.GetChildrenCount(); ++index) { auto r = CompileTypeAnnotationNode(*node.GetChild(index)); if (!r) @@ -290,7 +290,7 @@ namespace { return ann; } else if (content == TStringBuf("Tuple")) { - TTypeAnnotationNode::TListType children; + TTypeAnnotationNode::TListType children; for (size_t index = 1; index < node.GetChildrenCount(); ++index) { auto r = CompileTypeAnnotationNode(*node.GetChild(index)); if (!r) @@ -315,7 +315,7 @@ namespace { if (!r) return nullptr; - return Expr.MakeType<TItemExprType>(TString(node.GetChild(1)->GetContent()), r); + return Expr.MakeType<TItemExprType>(TString(node.GetChild(1)->GetContent()), r); } else if (content == TStringBuf("Optional")) { if (node.GetChildrenCount() != 2) { AddError(node, "Bad optional type annotation"); @@ -366,9 +366,9 @@ namespace { return nullptr; } - TVector<TCallableExprType::TArgumentInfo> args; + TVector<TCallableExprType::TArgumentInfo> args; size_t optCount = 0; - TString payload; + TString payload; if (!node.GetChild(1)->IsList()) { AddError(node, "Bad callable annotation - expected list"); return nullptr; @@ -465,7 +465,7 @@ namespace { return nullptr; } - return Expr.MakeType<TResourceExprType>(TString(node.GetChild(1)->GetContent())); + return Expr.MakeType<TResourceExprType>(TString(node.GetChild(1)->GetContent())); } else if (content == TStringBuf("Tagged")) { if (node.GetChildrenCount() != 3 || !node.GetChild(2)->IsAtom()) { AddError(node, "Bad tagged type annotation"); @@ -476,7 +476,7 @@ namespace { if (!type) return nullptr; - TString tag(node.GetChild(2)->GetContent()); + TString tag(node.GetChild(2)->GetContent()); auto ann = Expr.MakeType<TTaggedExprType>(type, tag); if (!ann->Validate(node.GetPosition(), Expr)) { return nullptr; @@ -817,9 +817,9 @@ namespace { TExprNode::TPtr CompileQuote(const TAstNode& node, TContext& ctx) { if (node.IsAtom()) { - return ctx.ProcessNode(node, ctx.Expr.NewAtom(node.GetPosition(), TString(node.GetContent()), node.GetFlags())); + return ctx.ProcessNode(node, ctx.Expr.NewAtom(node.GetPosition(), TString(node.GetContent()), node.GetFlags())); } else { - TExprNode::TListType children; + TExprNode::TListType children; children.reserve(node.GetChildrenCount()); for (ui32 index = 0; index < node.GetChildrenCount(); ++index) { auto r = Compile(*node.GetChild(index), ctx); @@ -855,10 +855,10 @@ namespace { } ctx.PushFrame(); - TExprNode::TListType argNodes; + TExprNode::TListType argNodes; for (ui32 index = 0; index < params->GetChildrenCount(); ++index) { auto arg = params->GetChild(index); - auto lambdaArg = ctx.ProcessNode(*arg, ctx.Expr.NewArgument(arg->GetPosition(), TString(arg->GetContent()))); + auto lambdaArg = ctx.ProcessNode(*arg, ctx.Expr.NewArgument(arg->GetPosition(), TString(arg->GetContent()))); argNodes.push_back(lambdaArg); auto& binding = ctx.Frames.back().Bindings[arg->GetContent()]; if (!binding.empty()) { @@ -967,7 +967,7 @@ namespace { } else { const auto stub = ctx.Expr.NewAtom(node.GetPosition(), "stub"); ctx.Frames.back().Bindings[name->GetContent()] = {stub}; - ctx.Cohesion.Imports[stub.Get()] = std::make_pair(import, TString(aliasValue)); + ctx.Cohesion.Imports[stub.Get()] = std::make_pair(import, TString(aliasValue)); return stub; } } @@ -1371,7 +1371,7 @@ namespace { return CompileFunction(*quotedList->GetChild(1), ctx); } - TExprNode::TListType children; + TExprNode::TListType children; children.reserve(node.GetChildrenCount() - 1U); for (auto index = 1U; index < node.GetChildrenCount(); ++index) { auto r = Compile(*node.GetChild(index), ctx); @@ -1389,7 +1389,7 @@ namespace { size_t Parent = 0; std::map<size_t, const TExprNode*> Nodes; std::vector<const TExprNode*> TopoSortedNodes; - TNodeMap<TString> Bindings; + TNodeMap<TString> Bindings; }; struct TVisitNodeContext { @@ -1412,14 +1412,14 @@ namespace { TNodeMap<TCounters> References; - const TString& FindBinding(const TExprNode* node) const { + const TString& FindBinding(const TExprNode* node) const { for (const auto* frame = CurrentFrame; frame; frame = frame->Index > 0 ? &Frames[frame->Parent] : nullptr) { const auto it = frame->Bindings.find(node); if (frame->Bindings.cend() != it) return it->second; } - static const TString stub; + static const TString stub; return stub; } @@ -2170,7 +2170,7 @@ TExprNode::TPtr DoReplace(const TExprNode::TPtr& start, const TNodeOnNodeOwnedMa } const auto& args = start->Head(); - TExprNode::TListType newArgsList; + TExprNode::TListType newArgsList; newArgsList.reserve(args.ChildrenSize()); args.ForEachChild([&](const TExprNode& arg) { const auto argIt = newReplaces.find(&arg); @@ -2192,7 +2192,7 @@ TExprNode::TPtr DoReplace(const TExprNode::TPtr& start, const TNodeOnNodeOwnedMa return target; } else { bool replaced = false; - TExprNode::TListType newChildren; + TExprNode::TListType newChildren; newChildren.reserve(start->ChildrenSize()); for (const auto& child : start->Children()) { auto newChild = DoReplace<KeepTypeAnns>(child, replaces, localReplaces, changes, processed, ctx); @@ -2308,7 +2308,7 @@ TExprNode::TPtr TExprContext::ReplaceNode(TExprNode::TPtr&& start, const TExprNo } if (argIndex) { - TExprNode::TListType newArgNodes; + TExprNode::TListType newArgNodes; newArgNodes.reserve(args.ChildrenSize()); TNodeOnNodeOwnedMap replaces(args.ChildrenSize()); @@ -2420,7 +2420,7 @@ TAstParseResult ConvertToAst(const TExprNode& root, TExprContext& exprContext, u return ConvertToAst(root, exprContext, settings); } -TString TExprNode::Dump() const { +TString TExprNode::Dump() const { TNodeSet visited; TStringStream out; DumpNode(*this, out, 0, visited); @@ -2444,7 +2444,7 @@ TExprNode::TPtr TExprContext::ShallowCopy(const TExprNode& node) { return newNode; } -TExprNode::TPtr TExprContext::ChangeChildren(const TExprNode& node, TExprNode::TListType&& children) { +TExprNode::TPtr TExprContext::ChangeChildren(const TExprNode& node, TExprNode::TListType&& children) { const auto newNode = node.ChangeChildren(AllocateNextUniqueId(), std::move(children)); ExprNodes.emplace_back(newNode.Get()); return newNode; @@ -2456,7 +2456,7 @@ TExprNode::TPtr TExprContext::ChangeChild(const TExprNode& node, ui32 index, TEx return newNode; } -TExprNode::TPtr TExprContext::ExactChangeChildren(const TExprNode& node, TExprNode::TListType&& children) { +TExprNode::TPtr TExprContext::ExactChangeChildren(const TExprNode& node, TExprNode::TListType&& children) { const auto newNode = node.ChangeChildren(AllocateNextUniqueId(), std::move(children)); newNode->SetTypeAnn(node.GetTypeAnn()); newNode->CopyConstraints(node); @@ -2513,7 +2513,7 @@ TExprNode::TPtr TExprContext::DeepCopyLambda(const TExprNode& node, TExprNode::T TNodeOnNodeOwnedMap replaces(prevArgs.ChildrenSize()); - TExprNode::TListType newArgNodes; + TExprNode::TListType newArgNodes; newArgNodes.reserve(prevArgs.ChildrenSize()); prevArgs.ForEachChild([&](const TExprNode& arg) { auto newArg = ShallowCopy(arg); @@ -2724,7 +2724,7 @@ bool TStructExprType::Validate(TPosition position, TExprContext& ctx) const { return false; } - TString lastName; + TString lastName; for (auto& item : Items) { if (!item->Validate(position, ctx)) { return false; @@ -3064,14 +3064,14 @@ const TDataExprParamsType* TMakeTypeImpl<TDataExprParamsType>::Make(TExprContext } const TCallableExprType* TMakeTypeImpl<TCallableExprType>::Make( - TExprContext& ctx, const TTypeAnnotationNode* returnType, const TVector<TCallableExprType::TArgumentInfo>& arguments, + TExprContext& ctx, const TTypeAnnotationNode* returnType, const TVector<TCallableExprType::TArgumentInfo>& arguments, size_t optionalArgumentsCount, const TStringBuf& payload) { const auto hash = TCallableExprType::MakeHash(returnType, arguments, optionalArgumentsCount, payload); TCallableExprType sample(hash, returnType, arguments, optionalArgumentsCount, payload); if (const auto found = FindType(sample, ctx)) return found; - TVector<TCallableExprType::TArgumentInfo> newArgs; + TVector<TCallableExprType::TArgumentInfo> newArgs; newArgs.reserve(arguments.size()); for (const auto& x : arguments) { TCallableExprType::TArgumentInfo arg; @@ -3104,7 +3104,7 @@ const TTaggedExprType* TMakeTypeImpl<TTaggedExprType>::Make( } const TStructExprType* TMakeTypeImpl<TStructExprType>::Make( - TExprContext& ctx, const TVector<const TItemExprType*>& items) { + TExprContext& ctx, const TVector<const TItemExprType*>& items) { if (items.empty()) return MakeSinglethonType<TStructExprType>(ctx, items); @@ -3130,7 +3130,7 @@ const TMultiExprType* TMakeTypeImpl<TMultiExprType>::Make(TExprContext& ctx, con return AddType<TMultiExprType>(ctx, hash, items); } -const TTupleExprType* TMakeTypeImpl<TTupleExprType>::Make(TExprContext& ctx, const TTypeAnnotationNode::TListType& items) { +const TTupleExprType* TMakeTypeImpl<TTupleExprType>::Make(TExprContext& ctx, const TTypeAnnotationNode::TListType& items) { if (items.empty()) return MakeSinglethonType<TTupleExprType>(ctx, items); diff --git a/ydb/library/yql/ast/yql_expr.h b/ydb/library/yql/ast/yql_expr.h index d6eb544f9af..5e367ddc402 100644 --- a/ydb/library/yql/ast/yql_expr.h +++ b/ydb/library/yql/ast/yql_expr.h @@ -253,7 +253,7 @@ public: } }; - typedef std::vector<const TTypeAnnotationNode*> TListType; + typedef std::vector<const TTypeAnnotationNode*> TListType; typedef std::span<const TTypeAnnotationNode*> TSpanType; protected: template <typename T> @@ -296,13 +296,13 @@ class TTupleExprType : public TTypeAnnotationNode { public: static constexpr ETypeAnnotationKind KindValue = ETypeAnnotationKind::Tuple; - TTupleExprType(ui64 hash, const TTypeAnnotationNode::TListType& items) + TTupleExprType(ui64 hash, const TTypeAnnotationNode::TListType& items) : TTypeAnnotationNode(KindValue, CombineFlags(items), hash) , Items(items) { } - static ui64 MakeHash(const TTypeAnnotationNode::TListType& items) { + static ui64 MakeHash(const TTypeAnnotationNode::TListType& items) { ui64 hash = TypeHashMagic | (ui64)ETypeAnnotationKind::Tuple; hash = StreamHash(items.size(), hash); for (const auto& item : items) { @@ -316,7 +316,7 @@ public: return Items.size(); } - const TTypeAnnotationNode::TListType& GetItems() const { + const TTypeAnnotationNode::TListType& GetItems() const { return Items; } @@ -338,7 +338,7 @@ public: bool Validate(TPositionHandle position, TExprContext& ctx) const; private: - TTypeAnnotationNode::TListType Items; + TTypeAnnotationNode::TListType Items; }; class TMultiExprType : public TTypeAnnotationNode { @@ -452,13 +452,13 @@ public: }; }; - TStructExprType(ui64 hash, const TVector<const TItemExprType*>& items) + TStructExprType(ui64 hash, const TVector<const TItemExprType*>& items) : TTypeAnnotationNode(KindValue, TypeNonComparable | CombineFlags(items), hash) , Items(items) { } - static ui64 MakeHash(const TVector<const TItemExprType*>& items) { + static ui64 MakeHash(const TVector<const TItemExprType*>& items) { Y_VERIFY_DEBUG(IsSorted(items.begin(), items.end(), TItemLess())); ui64 hash = TypeHashMagic | (ui64)ETypeAnnotationKind::Struct; hash = StreamHash(items.size(), hash); @@ -476,7 +476,7 @@ public: return Items.size(); } - const TVector<const TItemExprType*>& GetItems() const { + const TVector<const TItemExprType*>& GetItems() const { return Items; } @@ -522,7 +522,7 @@ public: } private: - TVector<const TItemExprType*> Items; + TVector<const TItemExprType*> Items; }; class TListExprType : public TTypeAnnotationNode { @@ -910,7 +910,7 @@ public: } }; - TCallableExprType(ui64 hash, const TTypeAnnotationNode* returnType, const TVector<TArgumentInfo>& arguments + TCallableExprType(ui64 hash, const TTypeAnnotationNode* returnType, const TVector<TArgumentInfo>& arguments , size_t optionalArgumentsCount, const TStringBuf& payload) : TTypeAnnotationNode(KindValue, MakeFlags(returnType), hash) , ReturnType(returnType) @@ -926,7 +926,7 @@ public: } } - static ui64 MakeHash(const TTypeAnnotationNode* returnType, const TVector<TArgumentInfo>& arguments + static ui64 MakeHash(const TTypeAnnotationNode* returnType, const TVector<TArgumentInfo>& arguments , size_t optionalArgumentsCount, const TStringBuf& payload) { ui64 hash = TypeHashMagic | (ui64)ETypeAnnotationKind::Callable; hash = StreamHash(returnType->GetHash(), hash); @@ -960,7 +960,7 @@ public: return Arguments.size(); } - const TVector<TArgumentInfo>& GetArguments() const { + const TVector<TArgumentInfo>& GetArguments() const { return Arguments; } @@ -1007,10 +1007,10 @@ private: private: const TTypeAnnotationNode* ReturnType; - TVector<TArgumentInfo> Arguments; + TVector<TArgumentInfo> Arguments; const size_t OptionalArgumentsCount; const TStringBuf Payload; - THashMap<TStringBuf, ui32> IndexByName; + THashMap<TStringBuf, ui32> IndexByName; }; class TGenericExprType : public TTypeAnnotationNode { @@ -1319,7 +1319,7 @@ private: public: typedef TIntrusivePtr<TExprNode> TPtr; - typedef std::vector<TPtr> TListType; + typedef std::vector<TPtr> TListType; typedef TArrayRef<const TPtr> TChildrenType; struct TPtrHash : private std::hash<const TExprNode*> { @@ -1393,7 +1393,7 @@ public: } template <class TKey> - bool IsCallable(const THashSet<TKey>& names) const { + bool IsCallable(const THashSet<TKey>& names) const { ENSURE_NOT_DELETED return Type() == TExprNode::Callable && names.contains(Content()); } @@ -1474,7 +1474,7 @@ public: return ret; } - TString Dump() const; + TString Dump() const; bool StartsExecution() const { ENSURE_NOT_DELETED @@ -1526,7 +1526,7 @@ public: return (EType)Type_; } - TListType::size_type ChildrenSize() const { + TListType::size_type ChildrenSize() const { ENSURE_NOT_DELETED return Children_.size(); } @@ -1721,7 +1721,7 @@ public: } static TPtr NewLambda(ui64 uniqueId, TPositionHandle pos, TPtr&& args, TPtr&& body) { - TListType children(body ? 2 : 1); + TListType children(body ? 2 : 1); children.front() = std::move(args); if (body) { children.back() = std::move(body); @@ -1753,10 +1753,10 @@ public: TPtr ChangeContent(ui64 newUniqueId, const TStringBuf& content) const { ENSURE_NOT_DELETED - return Make(Position_, (EType)Type_, TListType(Children_), content, Flags_, newUniqueId); + return Make(Position_, (EType)Type_, TListType(Children_), content, Flags_, newUniqueId); } - TPtr ChangeChildren(ui64 newUniqueId, TListType&& children) const { + TPtr ChangeChildren(ui64 newUniqueId, TListType&& children) const { ENSURE_NOT_DELETED return Make(Position_, (EType)Type_, std::move(children), Content(), Flags_, newUniqueId); } @@ -1764,7 +1764,7 @@ public: TPtr ChangeChild(ui64 newUniqueId, ui32 index, TPtr&& child) const { ENSURE_NOT_DELETED Y_ENSURE(index < Children_.size(), "index out of range"); - TListType newChildren(Children_); + TListType newChildren(Children_); newChildren[index] = std::move(child); return Make(Position_, (EType)Type_, std::move(newChildren), Content(), Flags_, newUniqueId); } @@ -2161,7 +2161,7 @@ struct TMakeTypeImpl<TDataExprParamsType> { template <> struct TMakeTypeImpl<TCallableExprType> { static const TCallableExprType* Make( - TExprContext& ctx, const TTypeAnnotationNode* returnType, const TVector<TCallableExprType::TArgumentInfo>& arguments, + TExprContext& ctx, const TTypeAnnotationNode* returnType, const TVector<TCallableExprType::TArgumentInfo>& arguments, size_t optionalArgumentsCount, const TStringBuf& payload); }; @@ -2177,12 +2177,12 @@ struct TMakeTypeImpl<TTaggedExprType> { template <> struct TMakeTypeImpl<TStructExprType> { - static const TStructExprType* Make(TExprContext& ctx, const TVector<const TItemExprType*>& items); + static const TStructExprType* Make(TExprContext& ctx, const TVector<const TItemExprType*>& items); }; template <> struct TMakeTypeImpl<TTupleExprType> { - static const TTupleExprType* Make(TExprContext& ctx, const TTypeAnnotationNode::TListType& items); + static const TTupleExprType* Make(TExprContext& ctx, const TTypeAnnotationNode::TListType& items); }; template <> @@ -2301,11 +2301,11 @@ struct TExprContext : private TNonCopyable { [[nodiscard]] TExprNode::TPtr ShallowCopy(const TExprNode& node); [[nodiscard]] - TExprNode::TPtr ChangeChildren(const TExprNode& node, TExprNode::TListType&& children); + TExprNode::TPtr ChangeChildren(const TExprNode& node, TExprNode::TListType&& children); [[nodiscard]] TExprNode::TPtr ChangeChild(const TExprNode& node, ui32 index, TExprNode::TPtr&& child); [[nodiscard]] - TExprNode::TPtr ExactChangeChildren(const TExprNode& node, TExprNode::TListType&& children); + TExprNode::TPtr ExactChangeChildren(const TExprNode& node, TExprNode::TListType&& children); [[nodiscard]] TExprNode::TPtr ExactShallowCopy(const TExprNode& node); [[nodiscard]] @@ -2531,7 +2531,7 @@ bool CompileExpr(TAstNode& astRoot, TExprNode::TPtr& exprRoot, TExprContext& ctx struct TLibraryCohesion { TExportTable Exports; - TNodeMap<std::pair<TString, TString>> Imports; + TNodeMap<std::pair<TString, TString>> Imports; }; bool CompileExpr(TAstNode& astRoot, TLibraryCohesion& cohesion, TExprContext& ctx, ui16 syntaxVersion = 0); diff --git a/ydb/library/yql/ast/yql_expr_ut.cpp b/ydb/library/yql/ast/yql_expr_ut.cpp index 06550f2507d..a7281b9a230 100644 --- a/ydb/library/yql/ast/yql_expr_ut.cpp +++ b/ydb/library/yql/ast/yql_expr_ut.cpp @@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TCompileYqlExpr) { UNIT_ASSERT(success); } - static bool ParseAndCompile(const TString& program) { + static bool ParseAndCompile(const TString& program) { TAstParseResult astRes = ParseAstWithCheck(program); TExprContext exprCtx; TExprNode::TPtr exprRoot; @@ -130,7 +130,7 @@ Y_UNIT_TEST_SUITE(TCompileYqlExpr) { auto ast = ConvertToAst(*exprRoot, exprCtx, TExprAnnotationFlags::None, true); TAstNode* xValue = ast.Root->GetChild(0)->GetChild(1)->GetChild(1); - UNIT_ASSERT_STRINGS_EQUAL(HexEncode(TString(xValue->GetContent())), "0123456789ABCDEF"); + UNIT_ASSERT_STRINGS_EQUAL(HexEncode(TString(xValue->GetContent())), "0123456789ABCDEF"); UNIT_ASSERT(xValue->GetFlags() & TNodeFlags::ArbitraryContent); } @@ -150,7 +150,7 @@ Y_UNIT_TEST_SUITE(TCompileYqlExpr) { auto ast = ConvertToAst(*exprRoot, exprCtx, TExprAnnotationFlags::None, true); TAstNode* xValue = ast.Root->GetChild(0)->GetChild(2)->GetChild(1); - UNIT_ASSERT_STRINGS_EQUAL(HexEncode(TString(xValue->GetContent())), "FEDCBA9876543210"); + UNIT_ASSERT_STRINGS_EQUAL(HexEncode(TString(xValue->GetContent())), "FEDCBA9876543210"); UNIT_ASSERT(xValue->GetFlags() & TNodeFlags::BinaryContent); } @@ -306,7 +306,7 @@ Y_UNIT_TEST_SUITE(TCompileYqlExpr) { } Y_UNIT_TEST_SUITE(TCompareExprTrees) { - void CompileAndCompare(const TString& one, const TString& two, const std::pair<TPosition, TPosition> *const diffPositions = nullptr) { + void CompileAndCompare(const TString& one, const TString& two, const std::pair<TPosition, TPosition> *const diffPositions = nullptr) { const auto progOne(ParseAst(one)), progTwo(ParseAst(two)); UNIT_ASSERT(progOne.IsOk() && progTwo.IsOk()); @@ -1008,7 +1008,7 @@ Y_UNIT_TEST_SUITE(TConvertToAst) { )"; const auto disassembled = CompileAndDisassemble(program); - UNIT_ASSERT(TString::npos != disassembled.find("'('key 'subkey 'value)")); + UNIT_ASSERT(TString::npos != disassembled.find("'('key 'subkey 'value)")); UNIT_ASSERT_EQUAL(disassembled.find("'('key 'subkey 'value)"), disassembled.rfind("'('key 'subkey 'value)")); } @@ -1025,7 +1025,7 @@ Y_UNIT_TEST_SUITE(TConvertToAst) { )"; const auto disassembled = CompileAndDisassemble(program); - UNIT_ASSERT(TString::npos != disassembled.find("(+ (Int64 '40) (Int64 '2))")); + UNIT_ASSERT(TString::npos != disassembled.find("(+ (Int64 '40) (Int64 '2))")); UNIT_ASSERT_EQUAL(disassembled.find("(+ (Int64 '40) (Int64 '2))"), disassembled.rfind("(+ (Int64 '40) (Int64 '2))")); } diff --git a/ydb/library/yql/ast/yql_type_string.cpp b/ydb/library/yql/ast/yql_type_string.cpp index af9af93259d..900961a8d93 100644 --- a/ydb/library/yql/ast/yql_type_string.cpp +++ b/ydb/library/yql/ast/yql_type_string.cpp @@ -95,7 +95,7 @@ bool IsTypeKeyword(int token) EToken TokenTypeFromStr(TStringBuf str) { - static const THashMap<TStringBuf, EToken> map = { + static const THashMap<TStringBuf, EToken> map = { { TStringBuf("String"), TOKEN_STRING }, { TStringBuf("Bool"), TOKEN_BOOL }, { TStringBuf("Int32"), TOKEN_INT32 }, @@ -305,7 +305,7 @@ private: if (Identifier.empty()) { return AddError("Expected type"); } - return AddError(TString("Unknown type: '") + Identifier + "\'"); + return AddError(TString("Unknown type: '") + Identifier + "\'"); } if (type) { @@ -532,7 +532,7 @@ private: if (Identifier == TStringBuf("AutoMap")) { argFlags |= TArgumentFlags::AutoMap; } else { - AddError(TString("Unknown flag name: ") + Identifier); + AddError(TString("Unknown flag name: ") + Identifier); return false; } GetNextToken(); // eat flag name @@ -711,7 +711,7 @@ private: } TAstNode* ParseStructTypeImpl() { - TMap<TString, TAstNode*> members; + TMap<TString, TAstNode*> members; if (Token != '>') { for (;;) { TString name; @@ -888,7 +888,7 @@ private: return MakeList(items.data(), items.size()); } - TAstNode* MakeStructType(const TMap<TString, TAstNode*>& members) { + TAstNode* MakeStructType(const TMap<TString, TAstNode*>& members) { TSmallVec<TAstNode*> items; items.push_back(MakeLiteralAtom(TStringBuf("StructType"))); @@ -1078,7 +1078,7 @@ private: } } - TAstNode* AddError(const TString& message) { + TAstNode* AddError(const TString& message) { Issues.AddIssue(TIssue(TokenBegin, message)); return nullptr; } @@ -1089,7 +1089,7 @@ private: TPosition TokenBegin, Position; size_t Index; int Token; - TString UnescapedIdentifier; + TString UnescapedIdentifier; TStringBuf Identifier; TMemoryPool& Pool; }; @@ -1359,7 +1359,7 @@ TAstNode* ParseType(TStringBuf str, TMemoryPool& pool, TIssues& issues, return parser.ParseTopLevelType(); } -TString FormatType(const TTypeAnnotationNode* typeNode) +TString FormatType(const TTypeAnnotationNode* typeNode) { TStringStream ss; TTypePrinter printer(ss); diff --git a/ydb/library/yql/ast/yql_type_string.h b/ydb/library/yql/ast/yql_type_string.h index 95c1908b9f6..675921c6b24 100644 --- a/ydb/library/yql/ast/yql_type_string.h +++ b/ydb/library/yql/ast/yql_type_string.h @@ -10,6 +10,6 @@ class TTypeAnnotationNode; TAstNode* ParseType(TStringBuf str, TMemoryPool& pool, TIssues& issues, TPosition position = {1, 1}); -TString FormatType(const TTypeAnnotationNode* typeNode); +TString FormatType(const TTypeAnnotationNode* typeNode); } // namespace NYql diff --git a/ydb/library/yql/ast/yql_type_string_ut.cpp b/ydb/library/yql/ast/yql_type_string_ut.cpp index 2f22c42258a..c03c8bae154 100644 --- a/ydb/library/yql/ast/yql_type_string_ut.cpp +++ b/ydb/library/yql/ast/yql_type_string_ut.cpp @@ -14,7 +14,7 @@ Y_UNIT_TEST_SUITE(TTypeString) auto res = ParseType(prog, pool, errors); UNIT_ASSERT(res == nullptr); UNIT_ASSERT(!errors.Empty()); - errors.PrintWithProgramTo(Cerr, "-memory-", TString(prog)); + errors.PrintWithProgramTo(Cerr, "-memory-", TString(prog)); UNIT_ASSERT_STRINGS_EQUAL(errors.begin()->Message, expectedError); UNIT_ASSERT_VALUES_EQUAL(errors.begin()->Position.Column, column); } @@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(TTypeString) TIssues errors; auto res = ParseType(prog, pool, errors); if (!res) { - errors.PrintWithProgramTo(Cerr, "-memory-", TString(prog)); + errors.PrintWithProgramTo(Cerr, "-memory-", TString(prog)); UNIT_FAIL(TStringBuilder() << "Parsing failed:" << Endl << prog); } UNIT_ASSERT_STRINGS_EQUAL(res->ToString(), expectedType); @@ -509,7 +509,7 @@ Y_UNIT_TEST_SUITE(TTypeString) TestOk("Struct<>", "(StructType)"); } - void TestFormat(const TString& yql, const TString& expectedTypeStr) { + void TestFormat(const TString& yql, const TString& expectedTypeStr) { TMemoryPool pool(4096); TAstParseResult astRes = ParseAst(yql, &pool); @@ -525,7 +525,7 @@ Y_UNIT_TEST_SUITE(TTypeString) UNIT_FAIL("Can't compile types"); } - TString typeStr = FormatType(type); + TString typeStr = FormatType(type); UNIT_ASSERT_STRINGS_EQUAL(typeStr, expectedTypeStr); } diff --git a/ydb/library/yql/core/common_opt/yql_co.h b/ydb/library/yql/core/common_opt/yql_co.h index b8f2719037a..0abcb6d5329 100644 --- a/ydb/library/yql/core/common_opt/yql_co.h +++ b/ydb/library/yql/core/common_opt/yql_co.h @@ -3,8 +3,8 @@ #include <ydb/library/yql/core/yql_type_annotation.h> #include <ydb/library/yql/core/expr_nodes/yql_expr_nodes.h> -#include <string_view> - +#include <string_view> + namespace NYql { struct TOptimizeContext { diff --git a/ydb/library/yql/core/common_opt/yql_co_flow2.cpp b/ydb/library/yql/core/common_opt/yql_co_flow2.cpp index 88f91400319..3f47ccc759a 100644 --- a/ydb/library/yql/core/common_opt/yql_co_flow2.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_flow2.cpp @@ -195,7 +195,7 @@ void GatherKeyAliases(const TExprNode::TPtr& joinTree, TMap<TString, TSet<TStrin } } -void MakeTransitiveClosure(TMap<TString, TSet<TString>>& aliases) { +void MakeTransitiveClosure(TMap<TString, TSet<TString>>& aliases) { for (;;) { bool hasChanges = false; for (auto& x : aliases) { @@ -217,7 +217,7 @@ void MakeTransitiveClosure(TMap<TString, TSet<TString>>& aliases) { } void GatherOptionalKeyColumnsFromEquality(TExprNode::TPtr columns, const TJoinLabels& labels, ui32 inputIndex, - TSet<TString>& optionalKeyColumns) { + TSet<TString>& optionalKeyColumns) { for (ui32 i = 0; i < columns->ChildrenSize(); i += 2) { auto table = columns->Child(i)->Content(); auto column = columns->Child(i + 1)->Content(); @@ -231,7 +231,7 @@ void GatherOptionalKeyColumnsFromEquality(TExprNode::TPtr columns, const TJoinLa } void GatherOptionalKeyColumns(TExprNode::TPtr joinTree, const TJoinLabels& labels, ui32 inputIndex, - TSet<TString>& optionalKeyColumns) { + TSet<TString>& optionalKeyColumns) { auto left = joinTree->Child(1); auto right = joinTree->Child(2); if (!left->IsAtom()) { @@ -253,14 +253,14 @@ void GatherOptionalKeyColumns(TExprNode::TPtr joinTree, const TJoinLabels& label } TExprNode::TPtr SingleInputPredicatePushdownOverEquiJoin(TExprNode::TPtr equiJoin, TExprNode::TPtr predicate, - const TSet<TStringBuf>& usedFields, TExprNode::TPtr args, const TJoinLabels& labels, + const TSet<TStringBuf>& usedFields, TExprNode::TPtr args, const TJoinLabels& labels, ui32 firstCandidate, const TMap<TStringBuf, TVector<TStringBuf>>& renameMap, bool ordered, TExprContext& ctx) { auto inputsCount = equiJoin->ChildrenSize() - 2; auto joinTree = equiJoin->Child(inputsCount); - TMap<TString, TSet<TString>> aliases; + TMap<TString, TSet<TString>> aliases; GatherKeyAliases(joinTree, aliases, labels); MakeTransitiveClosure(aliases); - TSet<ui32> candidates; + TSet<ui32> candidates; candidates.insert(firstCandidate); // check whether some used fields are not aliased bool onlyKeys = true; @@ -271,7 +271,7 @@ TExprNode::TPtr SingleInputPredicatePushdownOverEquiJoin(TExprNode::TPtr equiJoi } } - THashMap<ui32, THashMap<TString, TString>> aliasedKeys; + THashMap<ui32, THashMap<TString, TString>> aliasedKeys; if (onlyKeys) { // try to extend inputs for (ui32 i = 0; i < inputsCount; ++i) { @@ -279,7 +279,7 @@ TExprNode::TPtr SingleInputPredicatePushdownOverEquiJoin(TExprNode::TPtr equiJoi continue; } - TSet<TString> coveredKeys; + TSet<TString> coveredKeys; for (auto field : labels.Inputs[i].EnumerateAllColumns()) { if (auto aliasSet = aliases.FindPtr(field)) { for (auto alias : *aliasSet) { @@ -312,7 +312,7 @@ TExprNode::TPtr SingleInputPredicatePushdownOverEquiJoin(TExprNode::TPtr equiJoi auto newInput = prevInput; if (x.second) { // skip null key columns - TSet<TString> optionalKeyColumns; + TSet<TString> optionalKeyColumns; GatherOptionalKeyColumns(joinTree, labels, inputIndex, optionalKeyColumns); newInput = FilterOutNullJoinColumns(predicate->Pos(), prevInput, labels.Inputs[inputIndex], optionalKeyColumns, ctx); @@ -330,7 +330,7 @@ TExprNode::TPtr SingleInputPredicatePushdownOverEquiJoin(TExprNode::TPtr equiJoi ui32 index = 0; const auto& label = labels.Inputs[inputIndex]; for (auto column : label.EnumerateAllColumns()) { - TVector<TString> targetColumns; + TVector<TString> targetColumns; targetColumns.push_back(column); if (onlyKeys && inputIndex != firstCandidate) { if (auto aliasedKey = aliasedKeys[inputIndex].FindPtr(column)) { @@ -399,16 +399,16 @@ TExprNode::TPtr FlatMapOverEquiJoin(const TCoFlatMapBase& node, TExprContext& ct joinSettings = RemoveSetting(*joinSettings, "rename", ctx); auto structType = equiJoin.Ref().GetTypeAnn()->Cast<TListExprType>()->GetItemType() ->Cast<TStructExprType>(); - THashSet<TStringBuf> usedFields; - TMap<TStringBuf, TVector<TStringBuf>> memberUsageMap; + THashSet<TStringBuf> usedFields; + TMap<TStringBuf, TVector<TStringBuf>> memberUsageMap; for (auto& child : structNode->Children()) { auto item = child->Child(1); usedFields.insert(item->Child(1)->Content()); memberUsageMap[item->Child(1)->Content()].push_back(child->Child(0)->Content()); } - TMap<TStringBuf, TStringBuf> reversedRenameMap; - TMap<TStringBuf, TVector<TStringBuf>> newRenameMap; + TMap<TStringBuf, TStringBuf> reversedRenameMap; + TMap<TStringBuf, TVector<TStringBuf>> newRenameMap; for (auto& x : renameMap) { if (!x.second.empty()) { for (auto& y : x.second) { @@ -452,7 +452,7 @@ TExprNode::TPtr FlatMapOverEquiJoin(const TCoFlatMapBase& node, TExprContext& ct return ret; } - TSet<TStringBuf> usedFields; + TSet<TStringBuf> usedFields; auto& arg = node.Lambda().Args().Arg(0).Ref(); auto body = node.Lambda().Body().Ptr(); if (HaveFieldsSubset(body, arg, usedFields, parentsMap)) { @@ -498,13 +498,13 @@ TExprNode::TPtr FlatMapOverEquiJoin(const TCoFlatMapBase& node, TExprContext& ct } } - TExprNode::TListType andTerms; + TExprNode::TListType andTerms; GatherAndTerms(std::move(predicate), andTerms); TExprNode::TPtr ret; TExprNode::TPtr extraPredicate; auto joinSettings = equiJoin.Ref().Child(equiJoin.Ref().ChildrenSize() - 1); auto renameMap = LoadJoinRenameMap(*joinSettings); - THashMap<TString, TString> backRenameMap; + THashMap<TString, TString> backRenameMap; for (auto& x : renameMap) { if (!x.second.empty()) { for (auto& y : x.second) { @@ -520,8 +520,8 @@ TExprNode::TPtr FlatMapOverEquiJoin(const TCoFlatMapBase& node, TExprContext& ct continue; } - TSet<TStringBuf> usedFields; - TSet<ui32> inputs; + TSet<TStringBuf> usedFields; + TSet<ui32> inputs; if (!HaveFieldsSubset(andTerm, row, usedFields, parentsMap, false)) { continue; } @@ -655,7 +655,7 @@ TExprNode::TPtr FlatMapSubsetFields(const TCoFlatMapBase& node, TExprContext& ct } TExprNode::TPtr RenameJoinTable(TPositionHandle pos, TExprNode::TPtr table, - const THashMap<TString, TString>& upstreamTablesRename, TExprContext& ctx) + const THashMap<TString, TString>& upstreamTablesRename, TExprContext& ctx) { if (auto renamed = upstreamTablesRename.FindPtr(table->Content())) { return ctx.NewAtom(pos, *renamed); @@ -665,7 +665,7 @@ TExprNode::TPtr RenameJoinTable(TPositionHandle pos, TExprNode::TPtr table, } TExprNode::TPtr RenameEqualityTables(TPositionHandle pos, TExprNode::TPtr columns, - const THashMap<TString, TString>& upstreamTablesRename, TExprContext& ctx) + const THashMap<TString, TString>& upstreamTablesRename, TExprContext& ctx) { TExprNode::TListType newChildren(columns->ChildrenList()); for (ui32 i = 0; i < newChildren.size(); i += 2) { @@ -676,7 +676,7 @@ TExprNode::TPtr RenameEqualityTables(TPositionHandle pos, TExprNode::TPtr column return ret; } -TExprNode::TPtr RenameJoinTree(TExprNode::TPtr joinTree, const THashMap<TString, TString>& upstreamTablesRename, +TExprNode::TPtr RenameJoinTree(TExprNode::TPtr joinTree, const THashMap<TString, TString>& upstreamTablesRename, TExprContext& ctx) { TExprNode::TPtr left; @@ -706,8 +706,8 @@ TExprNode::TPtr RenameJoinTree(TExprNode::TPtr joinTree, const THashMap<TString, } TExprNode::TPtr ReassembleJoinEquality(TExprNode::TPtr columns, const TStringBuf& upstreamLabel, - const THashMap<TString, TString>& upstreamTablesRename, - const THashMap<TString, TString>& upstreamColumnsBackRename, TExprContext& ctx) + const THashMap<TString, TString>& upstreamTablesRename, + const THashMap<TString, TString>& upstreamColumnsBackRename, TExprContext& ctx) { TExprNode::TListType newChildren(columns->ChildrenList()); for (ui32 i = 0; i < columns->ChildrenSize(); i += 2) { @@ -740,7 +740,7 @@ TExprNode::TPtr ReassembleJoinEquality(TExprNode::TPtr columns, const TStringBuf } TExprNode::TPtr FuseJoinTree(TExprNode::TPtr downstreamJoinTree, TExprNode::TPtr upstreamJoinTree, const TStringBuf& upstreamLabel, - const THashMap<TString, TString>& upstreamTablesRename, const THashMap<TString, TString>& upstreamColumnsBackRename, + const THashMap<TString, TString>& upstreamTablesRename, const THashMap<TString, TString>& upstreamColumnsBackRename, TExprContext& ctx) { TExprNode::TPtr left; @@ -795,7 +795,7 @@ TExprNode::TPtr FuseEquiJoins(const TExprNode::TPtr& node, ui32 upstreamIndex, T ui32 downstreamInputs = node->ChildrenSize() - 2; auto upstreamList = node->Child(upstreamIndex)->Child(0); auto upstreamLabel = node->Child(upstreamIndex)->Child(1); - THashSet<TStringBuf> downstreamLabels; + THashSet<TStringBuf> downstreamLabels; for (ui32 i = 0; i < downstreamInputs; ++i) { auto label = node->Child(i)->Child(1); if (!label->IsAtom()) { @@ -805,9 +805,9 @@ TExprNode::TPtr FuseEquiJoins(const TExprNode::TPtr& node, ui32 upstreamIndex, T downstreamLabels.insert(label->Content()); } - THashMap<TString, TString> upstreamTablesRename; // rename of conflicted upstream tables - THashMap<TString, TString> upstreamColumnsBackRename; // renamed of columns under upstreamLabel to full name inside upstream - TMap<TString, TVector<TString>> upstreamColumnsRename; + THashMap<TString, TString> upstreamTablesRename; // rename of conflicted upstream tables + THashMap<TString, TString> upstreamColumnsBackRename; // renamed of columns under upstreamLabel to full name inside upstream + TMap<TString, TVector<TString>> upstreamColumnsRename; ui32 upstreamInputs = upstreamList->ChildrenSize() - 2; THashSet<TStringBuf> upstreamLabels; for (ui32 i = 0; i < upstreamInputs; ++i) { @@ -837,7 +837,7 @@ TExprNode::TPtr FuseEquiJoins(const TExprNode::TPtr& node, ui32 upstreamIndex, T } } - TExprNode::TListType equiJoinChildren; + TExprNode::TListType equiJoinChildren; for (ui32 i = 0; i < downstreamInputs; ++i) { if (i != upstreamIndex) { equiJoinChildren.push_back(node->Child(i)); @@ -858,7 +858,7 @@ TExprNode::TPtr FuseEquiJoins(const TExprNode::TPtr& node, ui32 upstreamIndex, T auto downstreamJoinTree = node->Child(downstreamInputs); auto downstreamSettings = node->Children().back(); auto upstreamJoinTree = upstreamList->Child(upstreamInputs); - TExprNode::TListType settingsChildren; + TExprNode::TListType settingsChildren; for (auto& setting : upstreamList->Children().back()->Children()) { if (setting->Child(0)->Content() != "rename") { @@ -1643,15 +1643,15 @@ void RegisterCoFlowCallables2(TCallableOptimizerMap& map) { auto& arg = self.Lambda().Args().Arg(0).Ref(); auto body = self.Lambda().Body().Ptr(); - TSet<TStringBuf> usedFields; + TSet<TStringBuf> usedFields; if (HaveFieldsSubset(body, arg, usedFields, *optCtx.ParentsMap)) { YQL_CLOG(DEBUG, Core) << "FieldsSubset in " << node->Content() << " over " << self.Input().Ref().Content(); - TSet<TString> fields; + TSet<TString> fields; for (auto& x : usedFields) { fields.emplace(TString(x)); } - TExprNode::TListType filteredInputs; + TExprNode::TListType filteredInputs; for (ui32 index = 0; index < self.Input().Ref().ChildrenSize(); ++index) { auto x = self.Input().Ref().ChildPtr(index); if (!self.Input().Maybe<TCoExtendBase>() && index > 0) { diff --git a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp index a32a6c3dabe..eab0f7f2d8c 100644 --- a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp @@ -207,7 +207,7 @@ TExprNode::TPtr ExpandPositionalUnionAll(const TExprNode& node, const TVector<TC TExprNode::TPtr ExpandFlattenEquiJoin(const TExprNode::TPtr& node, TExprContext& ctx) { auto settings = node->Children().back(); - TExprNode::TListType settingsChildren; + TExprNode::TListType settingsChildren; bool hasFlatten = false; for (auto& child : settings->Children()) { if (child->ChildrenSize() > 0 && child->Head().Content() == "flatten") { @@ -237,7 +237,7 @@ TExprNode::TPtr ExpandFlattenEquiJoin(const TExprNode::TPtr& node, TExprContext& auto joins = node->Child(node->ChildrenSize() - 2); auto columnTypes = GetJoinColumnTypes(*joins, labels, ctx); - TMap<TString, std::pair<bool, TVector<TString>>> remap; // column -> isOptional, list of columns + TMap<TString, std::pair<bool, TVector<TString>>> remap; // column -> isOptional, list of columns for (auto it : labels.Inputs) { for (auto item : it.InputType->GetItems()) { TString fullName = it.FullName(item->GetName()); @@ -260,13 +260,13 @@ TExprNode::TPtr ExpandFlattenEquiJoin(const TExprNode::TPtr& node, TExprContext& } remap.emplace(TString(columnName), std::make_pair((*type)->GetKind() == ETypeAnnotationKind::Optional, - TVector<TString>(1, fullName))); + TVector<TString>(1, fullName))); } } } auto lambdaArg = ctx.NewArgument(node->Pos(), "row"); - TExprNode::TListType remapItems; + TExprNode::TListType remapItems; for (auto& x : remap) { TExprNode::TPtr value; if (x.second.second.size() == 1) { @@ -277,7 +277,7 @@ TExprNode::TPtr ExpandFlattenEquiJoin(const TExprNode::TPtr& node, TExprContext& .Seal() .Build(); } else { - TExprNode::TListType values; + TExprNode::TListType values; for (auto& column : x.second.second) { values.push_back(ctx.Builder(node->Pos()) .Callable("Member") @@ -301,7 +301,7 @@ TExprNode::TPtr ExpandFlattenEquiJoin(const TExprNode::TPtr& node, TExprContext& return ctx.NewCallable(node->Pos(), "Map", { std::move(newJoin), std::move(mapLambda) }); } -void GatherEquiJoinKeyColumnsFromEquality(TExprNode::TPtr columns, THashSet<TString>& keyColumns) { +void GatherEquiJoinKeyColumnsFromEquality(TExprNode::TPtr columns, THashSet<TString>& keyColumns) { for (ui32 i = 0; i < columns->ChildrenSize(); i += 2) { auto table = columns->Child(i)->Content(); auto column = columns->Child(i + 1)->Content(); @@ -309,7 +309,7 @@ void GatherEquiJoinKeyColumnsFromEquality(TExprNode::TPtr columns, THashSet<TStr } } -void GatherEquiJoinKeyColumns(TExprNode::TPtr joinTree, THashSet<TString>& keyColumns) { +void GatherEquiJoinKeyColumns(TExprNode::TPtr joinTree, THashSet<TString>& keyColumns) { auto left = joinTree->Child(1); if (!left->IsAtom()) { GatherEquiJoinKeyColumns(left, keyColumns); @@ -326,7 +326,7 @@ void GatherEquiJoinKeyColumns(TExprNode::TPtr joinTree, THashSet<TString>& keyCo GatherEquiJoinKeyColumnsFromEquality(rightColumns, keyColumns); } -void GatherDroppedSingleTableColumns(TExprNode::TPtr joinTree, const TJoinLabels& labels, TSet<TString>& drops) { +void GatherDroppedSingleTableColumns(TExprNode::TPtr joinTree, const TJoinLabels& labels, TSet<TString>& drops) { auto left = joinTree->Child(1); auto right = joinTree->Child(2); if (!left->IsAtom()) { @@ -358,7 +358,7 @@ void GatherDroppedSingleTableColumns(TExprNode::TPtr joinTree, const TJoinLabels TExprNode::TPtr RemoveDeadPayloadColumns(const TExprNode::TPtr& node, TExprContext& ctx) { auto settings = node->Children().back(); - TSet<TString> drops; + TSet<TString> drops; for (auto& setting : settings->Children()) { auto name = setting->Head().Content(); if (name == "rename") { @@ -394,7 +394,7 @@ TExprNode::TPtr RemoveDeadPayloadColumns(const TExprNode::TPtr& node, TExprConte return node; } - THashSet<TString> keyColumns; + THashSet<TString> keyColumns; GatherEquiJoinKeyColumns(joinTree, keyColumns); for (auto& keyColumn : keyColumns) { drops.erase(keyColumn); @@ -439,7 +439,7 @@ TExprNode::TPtr RemoveDeadPayloadColumns(const TExprNode::TPtr& node, TExprConte nodeChildren[j] = ctx.ChangeChildren(*nodeChildren[j], std::move(dropChildren)); } - TExprNode::TListType settingsChildren; + TExprNode::TListType settingsChildren; for (const auto& setting : settings->Children()) { auto name = setting->Head().Content(); if (name != "rename" || !setting->Child(2)->Content().empty() || !drops.contains(setting->Child(1)->Content())) { @@ -655,12 +655,12 @@ TExprNode::TPtr ExpandUnionAll(const TExprNode::TPtr& node, TExprContext& ctx, T } auto resultStructType = node->GetTypeAnn()->Cast<TListExprType>()->GetItemType()->Cast<TStructExprType>(); - TVector<TExprNode::TPtr> nulls(resultStructType->GetSize()); + TVector<TExprNode::TPtr> nulls(resultStructType->GetSize()); auto remapList = [&ctx, &nulls, resultStructType](TExprNode::TPtr input, const TTypeAnnotationNode* inputType) -> TExprNode::TPtr { auto pos = input->Pos(); auto arg = ctx.NewArgument(pos, "item"); auto inputStructType = inputType->Cast<TListExprType>()->GetItemType()->Cast<TStructExprType>(); - TExprNode::TListType bodyItems; + TExprNode::TListType bodyItems; ui32 resultIndex = 0; for (auto& item : resultStructType->GetItems()) { auto resultType = item->GetItemType(); @@ -711,7 +711,7 @@ TExprNode::TPtr ExpandUnionAll(const TExprNode::TPtr& node, TExprContext& ctx, T ) }); }; - TExprNode::TListType remappedList; + TExprNode::TListType remappedList; // group children by ann type and preserve order for stability in tests std::vector<TExprNode::TListType> groups = GroupNodeChildrenByType(node); for (auto& group : groups) { @@ -738,7 +738,7 @@ TExprNode::TPtr ExpandUnionAll(const TExprNode::TPtr& node, TExprContext& ctx, T } TExprNode::TPtr RemoveNothingFromCoalesce(const TExprNode& node, TExprContext& ctx) { - TExprNode::TListType newChildren(node.Children().begin() + 1, node.Children().end()); + TExprNode::TListType newChildren(node.Children().begin() + 1, node.Children().end()); return ctx.ChangeChildren(node, std::move(newChildren)); } @@ -3455,7 +3455,7 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) { return node; } - TSet<TStringBuf> members; + TSet<TStringBuf> members; for (const auto& member : skipNullMembers.Members().Cast()) { members.insert(member.Value()); @@ -3465,7 +3465,7 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) { members.insert(member.Value()); } - TExprNode::TListType membersList; + TExprNode::TListType membersList; for (const auto& memberName : members) { membersList.push_back(ctx.NewAtom(innerSkip.Pos(), memberName)); } @@ -3562,7 +3562,7 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) { if (node->Head().IsCallable({"Just", "AsList"})) { YQL_CLOG(DEBUG, Core) << "Move " << node->Content() << " over " << node->Head().Content(); - TSet<TString> fields; + TSet<TString> fields; node->Tail().ForEachChild([&fields](const TExprNode& child) { fields.emplace(child.Content()); }); @@ -3790,7 +3790,7 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) { } // fuse [i..j) - TExprNode::TListType fusedChildren; + TExprNode::TListType fusedChildren; for (ui32 listIndex = i; listIndex < j; ++listIndex) { fusedChildren.insert(fusedChildren.end(), node->Child(listIndex)->Children().begin(), node->Child(listIndex)->Children().end()); } diff --git a/ydb/library/yql/core/common_opt/yql_co_simple2.cpp b/ydb/library/yql/core/common_opt/yql_co_simple2.cpp index 6d59989b6a4..c4418552304 100644 --- a/ydb/library/yql/core/common_opt/yql_co_simple2.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_simple2.cpp @@ -91,7 +91,7 @@ TExprNode::TPtr DeduplicateAggregateSameTraits(const TExprNode::TPtr& node, TExp // keep index of main handler or Max if this handler is the main one std::vector<ui32> handlersMapping(self.Handlers().Size(), Max<ui32>()); TNodeMap<ui32> nonDistinctHandlers; // map trait->handler index - THashMap<std::pair<TStringBuf, const TExprNode*>, ui32> distinctHandlers; // map column name+trait->handler index + THashMap<std::pair<TStringBuf, const TExprNode*>, ui32> distinctHandlers; // map column name+trait->handler index ui32 duplicatesCount = 0; for (ui32 index = 0; index < self.Handlers().Size(); ++index) { auto& handler = self.Handlers().Item(index).Ref(); @@ -122,7 +122,7 @@ TExprNode::TPtr DeduplicateAggregateSameTraits(const TExprNode::TPtr& node, TExp return node; } - TExprNode::TListType filteredHandlers; + TExprNode::TListType filteredHandlers; filteredHandlers.reserve(handlersMapping.size() - duplicatesCount); for (ui32 index = 0; index < handlersMapping.size(); ++index) { if (handlersMapping[index] == Max<ui32>()) { @@ -208,7 +208,7 @@ TExprNode::TPtr DeduplicateAggregateSameTraits(const TExprNode::TPtr& node, TExp } TExprNode::TPtr SimplifySync(const TExprNode::TPtr& node, TExprContext& ctx) { - TExprNode::TListType ordered; + TExprNode::TListType ordered; TNodeOnNodeOwnedMap realWorlds; bool flatten = false; for (auto child : node->Children()) { diff --git a/ydb/library/yql/core/expr_nodes/yql_expr_nodes.h b/ydb/library/yql/core/expr_nodes/yql_expr_nodes.h index 01cc7771185..14e0b4d8ba3 100644 --- a/ydb/library/yql/core/expr_nodes/yql_expr_nodes.h +++ b/ydb/library/yql/core/expr_nodes/yql_expr_nodes.h @@ -165,7 +165,7 @@ public: { Y_VERIFY_DEBUG(!this->ArgsHolder.IsValid()); - TExprNode::TListType argNodes; + TExprNode::TListType argNodes; for (auto name : list) { auto argName = this->Ctx.AppendString(name); auto argNode = this->Ctx.NewArgument(this->Pos, argName); @@ -183,7 +183,7 @@ public: { Y_VERIFY_DEBUG(!this->ArgsHolder.IsValid()); - TExprNode::TListType argNodes; + TExprNode::TListType argNodes; for (auto arg : list) { argNodes.push_back(arg.Ptr()); } diff --git a/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.h b/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.h index 0974e8d2d34..2794a3b38c1 100644 --- a/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.h +++ b/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.h @@ -179,8 +179,8 @@ private: } TExprNode::TPtr CurNode; - TExprNode::TListType::const_iterator CurIt; - TExprNode::TListType::const_iterator EndIt; + TExprNode::TListType::const_iterator CurIt; + TExprNode::TListType::const_iterator EndIt; }; template<typename TItem> @@ -427,7 +427,7 @@ protected: : TNodeBuilderBase(ctx, pos, getArgFunc) , BuildFunc(buildFunc) {} - TVector<TExprBase> Items; + TVector<TExprBase> Items; BuildFuncType BuildFunc; public: @@ -479,21 +479,21 @@ public: template <typename T, typename = std::enable_if_t<!std::is_same<T, TExprBase>::value && std::is_same<T, TItem>::value>> - TNodeBuilder<TParent, TDerived>& Add(const TVector<T>& list) { + TNodeBuilder<TParent, TDerived>& Add(const TVector<T>& list) { for (auto item : list) { Items.push_back(item); } return *static_cast<TNodeBuilder<TParent, TDerived>*>(this); } - TNodeBuilder<TParent, TDerived>& Add(const TVector<TExprBase>& list) { + TNodeBuilder<TParent, TDerived>& Add(const TVector<TExprBase>& list) { for (auto item : list) { Items.push_back(item); } return *static_cast<TNodeBuilder<TParent, TDerived>*>(this); } - TNodeBuilder<TParent, TDerived>& Add(const TExprNode::TListType& list) { + TNodeBuilder<TParent, TDerived>& Add(const TExprNode::TListType& list) { for (auto item : list) { Items.push_back(TExprBase(item)); } @@ -501,20 +501,20 @@ public: } TNodeBuilder<TParent, TDerived>& Add(std::initializer_list<TExprBase> list) { - return Add(TVector<TExprBase>(list)); + return Add(TVector<TExprBase>(list)); } }; template<typename TParent> -class TNodeBuilder<TParent, TVector<TExprBase>> : public TListBuilderBase<TParent, TVector<TExprBase>, TExprBase> { +class TNodeBuilder<TParent, TVector<TExprBase>> : public TListBuilderBase<TParent, TVector<TExprBase>, TExprBase> { public: - typedef std::function<TParent& (const TVector<TExprBase>&)> BuildFuncType; + typedef std::function<TParent& (const TVector<TExprBase>&)> BuildFuncType; TNodeBuilder<TParent, TVector<TExprBase>>(TExprContext& ctx, TPositionHandle pos, BuildFuncType buildFunc, TNodeBuilderBase::GetArgFuncType getArgFunc) - : TListBuilderBase<TParent, TVector<TExprBase>, TExprBase>(ctx, pos, buildFunc, getArgFunc) {} + : TListBuilderBase<TParent, TVector<TExprBase>, TExprBase>(ctx, pos, buildFunc, getArgFunc) {} - TVector<TExprBase> DoBuild() { + TVector<TExprBase> DoBuild() { return this->Items; } }; @@ -525,12 +525,12 @@ protected: TFreeArgCallableBuilderBase(TExprContext& ctx, TPositionHandle pos, GetArgFuncType getArgFunc) : TNodeBuilderBase(ctx, pos, getArgFunc) {} - TVector<TExprBase> FreeArgsHolder; + TVector<TExprBase> FreeArgsHolder; public: - TNodeBuilder<TNodeBuilder<TParent, TDerived>, TVector<TExprBase>> FreeArgs() { - return TNodeBuilder<TNodeBuilder<TParent, TDerived>, TVector<TExprBase>>(this->Ctx, this->Pos, - [this] (const TVector<TExprBase>& freeArgs) mutable -> TNodeBuilder<TParent, TDerived>& { + TNodeBuilder<TNodeBuilder<TParent, TDerived>, TVector<TExprBase>> FreeArgs() { + return TNodeBuilder<TNodeBuilder<TParent, TDerived>, TVector<TExprBase>>(this->Ctx, this->Pos, + [this] (const TVector<TExprBase>& freeArgs) mutable -> TNodeBuilder<TParent, TDerived>& { FreeArgsHolder = freeArgs; return *static_cast<TNodeBuilder<TParent, TDerived>*>(this); }, GetArgFunc); diff --git a/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj b/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj index 4b5733693f4..f15f2a2c496 100644 --- a/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj +++ b/ydb/library/yql/core/expr_nodes_gen/yql_expr_nodes_gen.jnj @@ -67,7 +67,7 @@ public: {% elif node.Match.Type == "NodeType" %} return node->Type() == TExprNode::{{ node.Match.TypeName }}; {% elif node.Match.Type == "CallableBase" %} - static THashSet<TStringBuf> namesToMatch = { + static THashSet<TStringBuf> namesToMatch = { {%- for name in node.aux.namesToMatch %} TStringBuf("{{ name }}"), {%- endfor %} @@ -322,7 +322,7 @@ class UnknownBuilder { {% endif %} {{ node.Name }} DoBuild() { {%- if node.Match and (node.Match.Type == "Callable" or node.Match.Type == "CallableBase") %} - TExprNode::TListType argsList; + TExprNode::TListType argsList; {%- if node.Builder.Kind == "List" %} for (auto child : this->Items) { argsList.push_back(child.Ptr()); @@ -349,7 +349,7 @@ class UnknownBuilder { {%- endif %} return {{ node.Name }}(node); {%- elif node.Match and node.Match.Type == "Tuple"%} - TExprNode::TListType tupleItems; + TExprNode::TListType tupleItems; {%- for child in node.aux.allChildren %} if (this->{{ child.aux.holderName }}) { YQL_ENSURE(tupleItems.size() == {{ child.Index }}); @@ -359,7 +359,7 @@ class UnknownBuilder { auto node = this->Ctx.NewList(this->Pos, std::move(tupleItems)); return {{ node.Name }}(node); {%- elif node.ListBase and node.Builder.Kind == "List"%} - TExprNode::TListType nodeChildren; + TExprNode::TListType nodeChildren; for (auto child : this->Items) { nodeChildren.push_back(child.Ptr()); } diff --git a/ydb/library/yql/core/facade/yql_facade.cpp b/ydb/library/yql/core/facade/yql_facade.cpp index b74abc1c34c..a6513ff9d81 100644 --- a/ydb/library/yql/core/facade/yql_facade.cpp +++ b/ydb/library/yql/core/facade/yql_facade.cpp @@ -115,7 +115,7 @@ TProgramFactory::TProgramFactory( bool useRepeatableRandomAndTimeProviders, const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry, ui64 nextUniqueId, - const TVector<TDataProviderInitializer>& dataProvidersInit, + const TVector<TDataProviderInitializer>& dataProvidersInit, const TString& runner) : UseRepeatableRandomAndTimeProviders_(useRepeatableRandomAndTimeProviders) , FunctionRegistry_(functionRegistry) @@ -174,16 +174,16 @@ void TProgramFactory::SetFileStorage(TFileStoragePtr fileStorage) { TProgramPtr TProgramFactory::Create( const TFile& file, - const TString& sessionId) + const TString& sessionId) { - TString sourceCode = TFileInput(file).ReadAll(); + TString sourceCode = TFileInput(file).ReadAll(); return Create(file.GetName(), sourceCode, sessionId); } TProgramPtr TProgramFactory::Create( - const TString& filename, - const TString& sourceCode, - const TString& sessionId) + const TString& filename, + const TString& sourceCode, + const TString& sessionId) { auto randomProvider = UseRepeatableRandomAndTimeProviders_ && !UseUnrepeatableRandom ? CreateDeterministicRandomProvider(1) : CreateDefaultRandomProvider(); @@ -209,9 +209,9 @@ TProgram::TProgram( const TIntrusivePtr<IRandomProvider> randomProvider, const TIntrusivePtr<ITimeProvider> timeProvider, ui64 nextUniqueId, - const TVector<TDataProviderInitializer>& dataProvidersInit, + const TVector<TDataProviderInitializer>& dataProvidersInit, const TUserDataTable& userDataTable, - const TVector<TCredentialTablePtr>& credentialTables, + const TVector<TCredentialTablePtr>& credentialTables, const TUserCredentials& userCredentials, const IModuleResolver::TPtr& modules, const IUdfResolver::TPtr& udfResolver, @@ -219,8 +219,8 @@ TProgram::TProgram( const TUdfIndexPackageSet::TPtr& udfIndexPackageSet, const TFileStoragePtr& fileStorage, const TGatewaysConfig* gatewaysConfig, - const TString& filename, - const TString& sourceCode, + const TString& filename, + const TString& sourceCode, const TString& sessionId, const TString& runner, bool enableRangeComputeFor @@ -398,7 +398,7 @@ bool TProgram::ParseYql() { bool TProgram::ParseSql() { YQL_PROFILE_FUNC(TRACE); - static const THashMap<TString, TString> clusters = { + static const THashMap<TString, TString> clusters = { { "plato", TString(YtProviderName) } }; @@ -598,7 +598,7 @@ TProgram::TFutureStatus TProgram::ValidateAsync(const TString& username, IOutput } TProgram::TStatus TProgram::Optimize( - const TString& username, + const TString& username, IOutputStream* traceOut, IOutputStream* tracePlan, IOutputStream* exprOut, @@ -610,7 +610,7 @@ TProgram::TStatus TProgram::Optimize( } TProgram::TFutureStatus TProgram::OptimizeAsync( - const TString& username, + const TString& username, IOutputStream* traceOut, IOutputStream* tracePlan, IOutputStream* exprOut, @@ -670,7 +670,7 @@ TProgram::TFutureStatus TProgram::OptimizeAsync( } TProgram::TStatus TProgram::OptimizeWithConfig( - const TString& username, const IPipelineConfigurator& pipelineConf) + const TString& username, const IPipelineConfigurator& pipelineConf) { YQL_PROFILE_FUNC(TRACE); auto m = &TProgram::OptimizeAsyncWithConfig; @@ -678,7 +678,7 @@ TProgram::TStatus TProgram::OptimizeWithConfig( } TProgram::TFutureStatus TProgram::OptimizeAsyncWithConfig( - const TString& username, const IPipelineConfigurator& pipelineConf) + const TString& username, const IPipelineConfigurator& pipelineConf) { if (!ProvideAnnotationContext(username)->Initialize(*ExprCtx_) || !CollectUsedClusters()) { return NThreading::MakeFuture<TStatus>(IGraphTransformer::TStatus::Error); @@ -739,7 +739,7 @@ TProgram::TFutureStatus TProgram::OptimizeAsyncWithConfig( } TProgram::TStatus TProgram::Run( - const TString& username, + const TString& username, IOutputStream* traceOut, IOutputStream* tracePlan, IOutputStream* exprOut, @@ -751,7 +751,7 @@ TProgram::TStatus TProgram::Run( } TProgram::TFutureStatus TProgram::RunAsync( - const TString& username, + const TString& username, IOutputStream* traceOut, IOutputStream* tracePlan, IOutputStream* exprOut, @@ -821,7 +821,7 @@ TProgram::TFutureStatus TProgram::RunAsync( } TProgram::TStatus TProgram::RunWithConfig( - const TString& username, const IPipelineConfigurator& pipelineConf) + const TString& username, const IPipelineConfigurator& pipelineConf) { YQL_PROFILE_FUNC(TRACE); auto m = &TProgram::RunAsyncWithConfig; @@ -829,7 +829,7 @@ TProgram::TStatus TProgram::RunWithConfig( } TProgram::TFutureStatus TProgram::RunAsyncWithConfig( - const TString& username, const IPipelineConfigurator& pipelineConf) + const TString& username, const IPipelineConfigurator& pipelineConf) { if (!ProvideAnnotationContext(username)->Initialize(*ExprCtx_) || !CollectUsedClusters()) { return NThreading::MakeFuture<TStatus>(IGraphTransformer::TStatus::Error); @@ -1229,7 +1229,7 @@ void TProgram::CloseLastSession() { } } -TString TProgram::ResultsAsString() const { +TString TProgram::ResultsAsString() const { if (!ResultProviderConfig_) return ""; @@ -1267,7 +1267,7 @@ TTypeAnnotationContextPtr TProgram::BuildTypeAnnotationContext(const TString& us } PlanBuilder_ = CreatePlanBuilder(*typeAnnotationContext); - THashSet<TString> providerNames; + THashSet<TString> providerNames; TVector<TString> fullResultDataSinks; TVector<std::function<TMaybe<TString>(const TString& url)>> tokenResolvers; for (const auto& dpi : DataProvidersInit_) { @@ -1301,13 +1301,13 @@ TTypeAnnotationContextPtr TProgram::BuildTypeAnnotationContext(const TString& us } } - TVector<TString> resultProviderDataSources; + TVector<TString> resultProviderDataSources; if (providerNames.contains(YtProviderName)) { resultProviderDataSources.push_back(TString(YtProviderName)); } if (providerNames.contains(KikimrProviderName)) { - resultProviderDataSources.push_back(TString(KikimrProviderName)); + resultProviderDataSources.push_back(TString(KikimrProviderName)); } if (providerNames.contains(RtmrProviderName)) { @@ -1347,9 +1347,9 @@ TTypeAnnotationContextPtr TProgram::BuildTypeAnnotationContext(const TString& us return typeAnnotationContext; } -TFuture<void> TProgram::OpenSession(const TString& username) +TFuture<void> TProgram::OpenSession(const TString& username) { - TVector<TFuture<void>> openFutures; + TVector<TFuture<void>> openFutures; for (const auto& dp : DataProviders_) { if (dp.OpenSession) { auto future = dp.OpenSession(SessionId_, username, ProgressWriter_, OperationOptions_, @@ -1362,7 +1362,7 @@ TFuture<void> TProgram::OpenSession(const TString& username) } void TProgram::Print(IOutputStream* exprOut, IOutputStream* planOut, bool cleanPlan) { - TVector<TTransformStage> printTransformers; + TVector<TTransformStage> printTransformers; const auto issueCode = TIssuesIds::DEFAULT_ERROR; if (exprOut) { printTransformers.push_back(TTransformStage( diff --git a/ydb/library/yql/core/facade/yql_facade.h b/ydb/library/yql/core/facade/yql_facade.h index 1f8f47681da..9c28771dd2b 100644 --- a/ydb/library/yql/core/facade/yql_facade.h +++ b/ydb/library/yql/core/facade/yql_facade.h @@ -41,7 +41,7 @@ public: bool useRepeatableRandomAndTimeProviders, const NKikimr::NMiniKQL::IFunctionRegistry* functionRegistry, ui64 nextUniqueId, - const TVector<TDataProviderInitializer>& dataProvidersInit, + const TVector<TDataProviderInitializer>& dataProvidersInit, const TString& runner); void AddUserDataTable(const TUserDataTable& userDataTable); @@ -56,12 +56,12 @@ public: TProgramPtr Create( const TFile& file, - const TString& sessionId = TString()); + const TString& sessionId = TString()); TProgramPtr Create( - const TString& filename, - const TString& sourceCode, - const TString& sessionId = TString()); + const TString& filename, + const TString& sourceCode, + const TString& sessionId = TString()); void UnrepeatableRandom(); private: @@ -69,9 +69,9 @@ private: bool UseUnrepeatableRandom = false; const NKikimr::NMiniKQL::IFunctionRegistry* FunctionRegistry_; const ui64 NextUniqueId_; - TVector<TDataProviderInitializer> DataProvidersInit_; + TVector<TDataProviderInitializer> DataProvidersInit_; TUserDataTable UserDataTable_; - TVector<TCredentialTablePtr> CredentialTables_; + TVector<TCredentialTablePtr> CredentialTables_; TUserCredentials UserCredentials_; const TGatewaysConfig* GatewaysConfig_; IModuleResolver::TPtr Modules_; @@ -111,47 +111,47 @@ public: TFutureStatus ValidateAsync(const TString& username, IOutputStream* exprOut = nullptr, bool withTypes = false); TStatus Optimize( - const TString& username, + const TString& username, IOutputStream* traceOut = nullptr, IOutputStream* tracePlan = nullptr, IOutputStream* exprOut = nullptr, bool withTypes = false); TFutureStatus OptimizeAsync( - const TString& username, + const TString& username, IOutputStream* traceOut = nullptr, IOutputStream* tracePlan = nullptr, IOutputStream* exprOut = nullptr, bool withTypes = false); TStatus Run( - const TString& username, + const TString& username, IOutputStream* traceOut = nullptr, IOutputStream* tracePlan = nullptr, IOutputStream* exprOut = nullptr, bool withTypes = false); TFutureStatus RunAsync( - const TString& username, + const TString& username, IOutputStream* traceOut = nullptr, IOutputStream* tracePlan = nullptr, IOutputStream* exprOut = nullptr, bool withTypes = false); TStatus OptimizeWithConfig( - const TString& username, + const TString& username, const IPipelineConfigurator& pipelineConf); TFutureStatus OptimizeAsyncWithConfig( - const TString& username, + const TString& username, const IPipelineConfigurator& pipelineConf); TStatus RunWithConfig( - const TString& username, + const TString& username, const IPipelineConfigurator& pipelineConf); TFutureStatus RunAsyncWithConfig( - const TString& username, + const TString& username, const IPipelineConfigurator& pipelineConf); TFutureStatus ContinueAsync(); @@ -201,7 +201,7 @@ public: !ResultProviderConfig_->CommittedResults.empty(); } - inline const TVector<TString>& Results() const { + inline const TVector<TString>& Results() const { return ResultProviderConfig_->CommittedResults; } @@ -221,7 +221,7 @@ public: TMaybe<TString> GetDiscoveredData(); - TString ResultsAsString() const; + TString ResultsAsString() const; void ConfigureYsonResultFormat(NYson::EYsonFormat format); inline IOutputStream* ExprStream() const { return ExprStream_; } @@ -244,7 +244,7 @@ public: OperationOptions_.AuthenticatedUser = user; } - void SetOperationId(const TString& id) { + void SetOperationId(const TString& id) { Y_ENSURE(!TypeCtx_, "TypeCtx_ already created"); OperationOptions_.Id = id; } @@ -254,7 +254,7 @@ public: OperationOptions_.SharedId = id; } - void SetOperationTitle(const TString& title) { + void SetOperationTitle(const TString& title) { Y_ENSURE(!TypeCtx_, "TypeCtx_ already created"); if (!title.Contains("YQL")) { ythrow yexception() << "Please mention YQL in the title '" << title << "'"; @@ -273,7 +273,7 @@ public: OperationOptions_.QueryName = name; } - void SetOperationAttrsYson(const TString& attrs) { + void SetOperationAttrsYson(const TString& attrs) { Y_ENSURE(!TypeCtx_, "TypeCtx_ already created"); OperationOptions_.AttrsYson = attrs; } @@ -298,9 +298,9 @@ private: const TIntrusivePtr<IRandomProvider> randomProvider, const TIntrusivePtr<ITimeProvider> timeProvider, ui64 nextUniqueId, - const TVector<TDataProviderInitializer>& dataProvidersInit, + const TVector<TDataProviderInitializer>& dataProvidersInit, const TUserDataTable& userDataTable, - const TVector<TCredentialTablePtr>& credentialTables, + const TVector<TCredentialTablePtr>& credentialTables, const TUserCredentials& userCredentials, const IModuleResolver::TPtr& modules, const IUdfResolver::TPtr& udfResolver, @@ -308,8 +308,8 @@ private: const TUdfIndexPackageSet::TPtr& udfIndexPackageSet, const TFileStoragePtr& fileStorage, const TGatewaysConfig* gatewaysConfig, - const TString& filename, - const TString& sourceCode, + const TString& filename, + const TString& sourceCode, const TString& sessionId, const TString& runner, bool enableRangeComputeFor); @@ -319,7 +319,7 @@ private: TTypeAnnotationContextPtr ProvideAnnotationContext(const TString& username); bool CollectUsedClusters(); - NThreading::TFuture<void> OpenSession(const TString& username); + NThreading::TFuture<void> OpenSession(const TString& username); void CleanupLastSession(); void CloseLastSession(); @@ -339,10 +339,10 @@ private: const TIntrusivePtr<IRandomProvider> RandomProvider_; const TIntrusivePtr<ITimeProvider> TimeProvider_; const ui64 NextUniqueId_; - TVector<TDataProviderInitializer> DataProvidersInit_; - TVector<TDataProviderInfo> DataProviders_; + TVector<TDataProviderInitializer> DataProvidersInit_; + TVector<TDataProviderInfo> DataProviders_; TYqlOperationOptions OperationOptions_; - TVector<TCredentialTablePtr> CredentialTables_; + TVector<TCredentialTablePtr> CredentialTables_; TUserCredentials UserCredentials_; const IUdfResolver::TPtr UdfResolver_; const TUdfIndex::TPtr UdfIndex_; @@ -350,8 +350,8 @@ private: const TFileStoragePtr FileStorage_; const TUserDataStorage::TPtr UserDataStorage_; const TGatewaysConfig* GatewaysConfig_; - TString Filename_; - TString SourceCode_; + TString Filename_; + TString SourceCode_; ESourceSyntax SourceSyntax_; ui16 SyntaxVersion_; @@ -362,7 +362,7 @@ private: TExprNode::TPtr ExprRoot_; TExprNode::TPtr SavedExprRoot_; mutable TAdaptiveLock SessionIdLock_; - TString SessionId_; + TString SessionId_; TTypeAnnotationContextPtr TypeCtx_; TAutoPtr<IPlanBuilder> PlanBuilder_; TAutoPtr<IGraphTransformer> Transformer_; @@ -374,8 +374,8 @@ private: NUdf::EValidateMode ValidateMode_ = NUdf::EValidateMode::None; bool DisableNativeUdfSupport_ = false; bool UseTableMetaFromGraph_ = false; - TMaybe<TSet<TString>> UsedClusters_; - TMaybe<TSet<TString>> UsedProviders_; + TMaybe<TSet<TString>> UsedClusters_; + TMaybe<TSet<TString>> UsedProviders_; TMaybe<TString> ExternalQueryAst_; TMaybe<TString> ExternalQueryPlan_; TMaybe<TString> ExternalDiagnostics_; diff --git a/ydb/library/yql/core/file_storage/file_storage.h b/ydb/library/yql/core/file_storage/file_storage.h index 9133d57b1b3..08d53099feb 100644 --- a/ydb/library/yql/core/file_storage/file_storage.h +++ b/ydb/library/yql/core/file_storage/file_storage.h @@ -7,7 +7,7 @@ #include <util/folder/path.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <functional> #include <unordered_map> @@ -28,7 +28,7 @@ struct IFileStorage: public TThrRefBase { virtual void AddDownloader(IDownloaderPtr downloader) = 0; virtual TFileLinkPtr PutFile(const TString& file, const TString& outFileName = {}) = 0; virtual TFileLinkPtr PutFileStripped(const TString& file, const TString& originalMd5 = {}) = 0; - virtual TFileLinkPtr PutInline(const TString& data) = 0; + virtual TFileLinkPtr PutInline(const TString& data) = 0; virtual TFileLinkPtr PutUrl(const TString& url, const TString& oauthToken) = 0; // async versions virtual NThreading::TFuture<TFileLinkPtr> PutFileAsync(const TString& file, const TString& outFileName = {}) = 0; diff --git a/ydb/library/yql/core/file_storage/sized_cache.cpp b/ydb/library/yql/core/file_storage/sized_cache.cpp index fe17d895d05..7ab64a3ae10 100644 --- a/ydb/library/yql/core/file_storage/sized_cache.cpp +++ b/ydb/library/yql/core/file_storage/sized_cache.cpp @@ -14,7 +14,7 @@ TSizedCache::TSizedCache(size_t maxEntries, ui64 maxSize) } void TSizedCache::Put(const TIntrusivePtr<ICacheObj>& obj, bool lock) { - const TString name = obj->GetName(); + const TString name = obj->GetName(); const ui64 size = obj->GetSize(); auto guard = Guard(Lock); @@ -34,7 +34,7 @@ void TSizedCache::Put(const TIntrusivePtr<ICacheObj>& obj, bool lock) { } } -void TSizedCache::Release(const TString& name, bool remove) { +void TSizedCache::Release(const TString& name, bool remove) { auto guard = Guard(Lock); auto it = Cache.FindWithoutPromote(name); if (it == Cache.End()) { @@ -50,7 +50,7 @@ void TSizedCache::Release(const TString& name, bool remove) { } } -TIntrusivePtr<TSizedCache::ICacheObj> TSizedCache::Get(const TString& name) { +TIntrusivePtr<TSizedCache::ICacheObj> TSizedCache::Get(const TString& name) { auto guard = Guard(Lock); auto it = Cache.Find(name); TIntrusivePtr<TSizedCache::ICacheObj> res; @@ -60,7 +60,7 @@ TIntrusivePtr<TSizedCache::ICacheObj> TSizedCache::Get(const TString& name) { return res; } -TIntrusivePtr<TSizedCache::ICacheObj> TSizedCache::Revoke(const TString& name) { +TIntrusivePtr<TSizedCache::ICacheObj> TSizedCache::Revoke(const TString& name) { auto guard = Guard(Lock); auto it = Cache.FindWithoutPromote(name); TIntrusivePtr<TSizedCache::ICacheObj> res; @@ -73,7 +73,7 @@ TIntrusivePtr<TSizedCache::ICacheObj> TSizedCache::Revoke(const TString& name) { return res; } -TMaybe<ui32> TSizedCache::GetLocks(const TString& name) const { +TMaybe<ui32> TSizedCache::GetLocks(const TString& name) const { auto guard = Guard(Lock); auto it = Cache.FindWithoutPromote(name); TMaybe<ui32> res; diff --git a/ydb/library/yql/core/file_storage/sized_cache.h b/ydb/library/yql/core/file_storage/sized_cache.h index a08095cab7b..c3bd94cca2e 100644 --- a/ydb/library/yql/core/file_storage/sized_cache.h +++ b/ydb/library/yql/core/file_storage/sized_cache.h @@ -3,7 +3,7 @@ #include <library/cpp/cache/cache.h> #include <util/system/spinlock.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ylimits.h> #include <util/generic/ptr.h> #include <util/generic/maybe.h> @@ -21,7 +21,7 @@ class TSizedCache { public: struct ICacheObj: public TThrRefBase { // Unique object identifier - virtual TString GetName() = 0; + virtual TString GetName() = 0; // Object size virtual ui64 GetSize() = 0; // Called when object is removed from the cache. Should cleanup occupied resources @@ -38,13 +38,13 @@ public: void Put(const TIntrusivePtr<ICacheObj>& obj, bool lock = true); // Decrements object lock count. If lock count becomes zero and total count/size exceeds the limit // then object is removed from the cache immediately - void Release(const TString& name, bool remove = false); + void Release(const TString& name, bool remove = false); // Returns the object if it exists in the cache - TIntrusivePtr<ICacheObj> Get(const TString& name); + TIntrusivePtr<ICacheObj> Get(const TString& name); // Removes and returns the object if it exists in the cache - TIntrusivePtr<ICacheObj> Revoke(const TString& name); + TIntrusivePtr<ICacheObj> Revoke(const TString& name); // Returns count of object locks, or empty if object doesn't belong to the cache - TMaybe<ui32> GetLocks(const TString& name) const; + TMaybe<ui32> GetLocks(const TString& name) const; // Total size of all objects in the cache ui64 GetOccupiedSize() const { return CurrentSize; @@ -58,7 +58,7 @@ private: TIntrusivePtr<ICacheObj> Obj; ui32 Locks; }; - using TCache = TLRUCache<TString, TEntry>; + using TCache = TLRUCache<TString, TEntry>; void Remove(TCache::TIterator it); diff --git a/ydb/library/yql/core/file_storage/sized_cache_ut.cpp b/ydb/library/yql/core/file_storage/sized_cache_ut.cpp index b0e41e5c62b..b3f5d0c6abf 100644 --- a/ydb/library/yql/core/file_storage/sized_cache_ut.cpp +++ b/ydb/library/yql/core/file_storage/sized_cache_ut.cpp @@ -5,7 +5,7 @@ using namespace NYql; struct TTestCacheObj: public TSizedCache::ICacheObj { - TTestCacheObj(const TString& name, ui64 size) + TTestCacheObj(const TString& name, ui64 size) : Name(name) , Size(size) , Dismissed(false) @@ -22,7 +22,7 @@ struct TTestCacheObj: public TSizedCache::ICacheObj { Dismissed = true; } - TString Name; + TString Name; ui64 Size; bool Dismissed; }; diff --git a/ydb/library/yql/core/file_storage/storage.cpp b/ydb/library/yql/core/file_storage/storage.cpp index 247bff52422..31f6563d846 100644 --- a/ydb/library/yql/core/file_storage/storage.cpp +++ b/ydb/library/yql/core/file_storage/storage.cpp @@ -34,12 +34,12 @@ namespace NYql { namespace { struct TFileObject { - TString Name; + TString Name; time_t MTime; ui64 Size; }; -TFsPath ToFilePath(const TString& path) +TFsPath ToFilePath(const TString& path) { if (path.empty()) { char tempDir[MAX_PATH]; @@ -149,7 +149,7 @@ public: TMutex Mutex; }; - TImpl(size_t maxFiles, ui64 maxSize, const TString& storagePath) + TImpl(size_t maxFiles, ui64 maxSize, const TString& storagePath) : StorageDir(ToFilePath(storagePath)) , ProcessTempDir(StorageDir / ToString(GetPID())) // must be subfolder for fast hardlinking , IsTemp(storagePath.empty()) @@ -322,7 +322,7 @@ public: private: void LoadStats() { - TVector<TString> names; + TVector<TString> names; StorageDir.ListNames(names); ui64 actualFiles = 0; @@ -330,7 +330,7 @@ private: ui32 oldPid; - for (const TString& name: names) { + for (const TString& name: names) { TFsPath childPath(StorageDir / name); TFileStat stat(childPath, true); if (stat.IsFile()) { @@ -375,16 +375,16 @@ private: } with_lock (CleanupLock) { - TVector<TString> names; + TVector<TString> names; StorageDir.ListNames(names); - TVector<TFileObject> files; + TVector<TFileObject> files; files.reserve(names.size()); ui64 actualFiles = 0; ui64 actualSize = 0; - for (const TString& name: names) { + for (const TString& name: names) { TFsPath childPath(StorageDir / name); TFileStat stat(childPath, true); if (stat.IsFile()) { @@ -446,7 +446,7 @@ private: TRandGuid Rnd; }; -TStorage::TStorage(size_t maxFiles, ui64 maxSize, const TString& storagePath) +TStorage::TStorage(size_t maxFiles, ui64 maxSize, const TString& storagePath) : Impl(new TImpl(maxFiles, maxSize, storagePath)) { } diff --git a/ydb/library/yql/core/file_storage/storage.h b/ydb/library/yql/core/file_storage/storage.h index 8ab42a69a11..0704d65f472 100644 --- a/ydb/library/yql/core/file_storage/storage.h +++ b/ydb/library/yql/core/file_storage/storage.h @@ -2,7 +2,7 @@ #include <util/folder/path.h> #include <util/generic/ptr.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/maybe.h> #include <functional> @@ -14,7 +14,7 @@ public: TFileLink(const TFsPath& path, const TString& storageFileName, ui64 size, const TString& md5, bool deleteOnDestroy = true); ~TFileLink(); - const TString& GetStorageFileName() const { return StorageFileName; } + const TString& GetStorageFileName() const { return StorageFileName; } const TFsPath& GetPath() const { return Path; } ui64 GetSize() const { return Size; } const TString& GetMd5() const { return Md5; } @@ -45,7 +45,7 @@ public: /* Constructs the storage with the specified limits. storagePath can be empty - a temporary directory will be used in this case. */ - TStorage(size_t maxFiles, ui64 maxSize, const TString& storagePath = {}); + TStorage(size_t maxFiles, ui64 maxSize, const TString& storagePath = {}); ~TStorage(); // Returns root storage directory diff --git a/ydb/library/yql/core/file_storage/storage_ut.cpp b/ydb/library/yql/core/file_storage/storage_ut.cpp index 4229abd2199..e85405476e2 100644 --- a/ydb/library/yql/core/file_storage/storage_ut.cpp +++ b/ydb/library/yql/core/file_storage/storage_ut.cpp @@ -14,7 +14,7 @@ using namespace NYql; using namespace NThreading; -static TString DATA = "1234567890"; +static TString DATA = "1234567890"; static TString DATA_MD5 = "e807f1fcf82d132f9bb018ca6738a19f"; Y_UNIT_TEST_SUITE(TStorageTests) { @@ -24,11 +24,11 @@ Y_UNIT_TEST_SUITE(TStorageTests) { TFsPath Path_; public: - TTestDir(const TString& name) { + TTestDir(const TString& name) { Y_ENSURE(name.length() > 0, "have to specify name"); - Y_ENSURE(name.find('.') == TString::npos, "must be simple name"); - Y_ENSURE(name.find('/') == TString::npos, "must be simple name"); - Y_ENSURE(name.find('\\') == TString::npos, "must be simple name"); + Y_ENSURE(name.find('.') == TString::npos, "must be simple name"); + Y_ENSURE(name.find('/') == TString::npos, "must be simple name"); + Y_ENSURE(name.find('\\') == TString::npos, "must be simple name"); Path_ = TFsPath(name); Path_.ForceDelete(); @@ -52,7 +52,7 @@ Y_UNIT_TEST_SUITE(TStorageTests) { }); } - TFileLinkPtr PutFileWithSleep(const TString& name, TStorage& storage) { + TFileLinkPtr PutFileWithSleep(const TString& name, TStorage& storage) { return PutFile(name, storage, {}, 1); } @@ -76,7 +76,7 @@ Y_UNIT_TEST_SUITE(TStorageTests) { TThreadPool queue; queue.Start(10); - TVector<TFuture<TFileLinkPtr>> res; + TVector<TFuture<TFileLinkPtr>> res; res.reserve(10); for (size_t i = 0; i < 10; ++i) { res.emplace_back(Async([&]() { @@ -130,7 +130,7 @@ Y_UNIT_TEST_SUITE(TStorageTests) { UNIT_ASSERT(file2->GetPath().Exists()); UNIT_ASSERT(file3->GetPath().Exists()); - TVector<TString> filesInStorage; + TVector<TString> filesInStorage; storage->GetRoot().ListNames(filesInStorage); UNIT_ASSERT_EQUAL(filesInStorage.size(), 2); // 1 file + 1 hardlink directory @@ -167,7 +167,7 @@ Y_UNIT_TEST_SUITE(TStorageTests) { UNIT_ASSERT(file2->GetPath().Exists()); UNIT_ASSERT(file3->GetPath().Exists()); - TVector<TString> filesInStorage; + TVector<TString> filesInStorage; storage->GetRoot().ListNames(filesInStorage); UNIT_ASSERT_EQUAL(filesInStorage.size(), 2); // 1 file + 1 hardlink directory diff --git a/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp b/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp index ce22b125714..b9cdb9eb034 100644 --- a/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp +++ b/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp @@ -100,7 +100,7 @@ TExprNode::TPtr SplitEquiJoinToPairsRecursive(const TExprNode& node, const TExpr } else { leftList = SplitEquiJoinToPairsRecursive(node, *leftSubtree, ctx, leftListLabels, ctx.NewList(node.Pos(), {})); - TExprNode::TListType leftLabelsChildren; + TExprNode::TListType leftLabelsChildren; for (auto& label : leftListLabels) { leftLabelsChildren.push_back(ctx.NewAtom(node.Pos(), label)); } @@ -144,7 +144,7 @@ TExprNode::TPtr SplitEquiJoinToPairsRecursive(const TExprNode& node, const TExpr } else { rightList = SplitEquiJoinToPairsRecursive(node, *rightSubtree, ctx, rightListLabels, ctx.NewList(node.Pos(), {})); - TExprNode::TListType rightLabelsChildren; + TExprNode::TListType rightLabelsChildren; for (auto& label : rightListLabels) { rightLabelsChildren.push_back(ctx.NewAtom(node.Pos(), label)); } @@ -528,7 +528,7 @@ TExprNode::TPtr PeepHoleExpandExtractItems(const TExprNode::TPtr& node, TExprCon const auto& input = extract.Input(); const auto& members = extract.Members(); auto arg = ctx.NewArgument(extract.Pos(), "arg"); - TExprNode::TListType fields; + TExprNode::TListType fields; for (const auto& x : members) { fields.emplace_back(ctx.Builder(extract.Pos()) .List() diff --git a/ydb/library/yql/core/services/yql_plan.cpp b/ydb/library/yql/core/services/yql_plan.cpp index 4d7cfffaf5a..a7ae8c9c67e 100644 --- a/ydb/library/yql/core/services/yql_plan.cpp +++ b/ydb/library/yql/core/services/yql_plan.cpp @@ -24,9 +24,9 @@ struct TNodeInfo { const TExprNode* const Node; IDataProvider* Provider; bool IsVisible; - TExprNode::TListType Dependencies; - TVector<TPinAttrs> Inputs; - TVector<TPinAttrs> Outputs; + TExprNode::TListType Dependencies; + TVector<TPinAttrs> Inputs; + TVector<TPinAttrs> Outputs; ui32 InputsCount = 0; ui32 OutputsCount = 0; @@ -48,7 +48,7 @@ struct TBasicNode { Output }; - TString DisplayName; + TString DisplayName; EType Type = EType::Unknown; }; @@ -84,8 +84,8 @@ struct TBasicLink { struct TLevelContext { TBasicNode* const Node; - TVector<ui64> Inputs; - TVector<ui64> Outputs; + TVector<ui64> Inputs; + TVector<ui64> Outputs; TLevelContext() : Node(nullptr) @@ -110,7 +110,7 @@ struct TProviderInfo { {} }; -using TProviderInfoMap = TMap<TString, TProviderInfo>; +using TProviderInfoMap = TMap<TString, TProviderInfo>; void WriteProviders(const TString& tag, const TProviderInfoMap& providers, NYson::TYsonWriter& writer) { writer.OnKeyedItem(tag); @@ -141,7 +141,7 @@ void WriteProviders(const TString& tag, const TProviderInfoMap& providers, NYson writer.OnEndList(); } -ui32 FillLevels(THashMap<ui32, TLevelContext>& basicNodesMap, ui32 current, THashSet<ui32>& visited) { +ui32 FillLevels(THashMap<ui32, TLevelContext>& basicNodesMap, ui32 current, THashSet<ui32>& visited) { if (visited.contains(current)) { return 0; } @@ -190,7 +190,7 @@ public: } TNodeMap<TNodeInfo> nodes; - TExprNode::TListType order; + TExprNode::TListType order; TProviderInfoMap providers; writer.OnBeginMap(); @@ -200,9 +200,9 @@ public: writer.OnBeginList(); VisitNode(root, nodes, order); ui32 lastId = 0; - TVector<TBasicNode> basicNodes; - TVector<TBasicLink> basicLinks; - TMap<TString, ui32> opStats; + TVector<TBasicNode> basicNodes; + TVector<TBasicLink> basicLinks; + TMap<TString, ui32> opStats; for (auto node : order) { auto& info = nodes.find(node.Get())->second; if (!info.IsVisible) { @@ -218,8 +218,8 @@ public: writer.OnStringScalar(node->Content()); opStats[TString(node->Content())] += 1; if (info.Provider) { - TVector<TPinInfo> inputs; - TVector<TPinInfo> outputs; + TVector<TPinInfo> inputs; + TVector<TPinInfo> outputs; info.Provider->GetPlanFormatter().GetInputs(*node, inputs); info.Provider->GetPlanFormatter().GetOutputs(*node, outputs); if (inputs.size()) { @@ -247,7 +247,7 @@ public: info.Provider->GetPlanFormatter().WritePlanDetails(*info.Node, writer); } - TSet<ui64> dependsOn; + TSet<ui64> dependsOn; for (auto child : info.Dependencies) { GatherDependencies(*child, nodes, dependsOn); } @@ -330,7 +330,7 @@ public: writer.OnEndMap(); } - void VisitCallable(const TExprNode::TPtr& node, TNodeMap<TNodeInfo>& nodes, TExprNode::TListType& order) { + void VisitCallable(const TExprNode::TPtr& node, TNodeMap<TNodeInfo>& nodes, TExprNode::TListType& order) { if (nodes.cend() != nodes.find(node.Get())) { return; } @@ -341,7 +341,7 @@ public: } auto& info = nodes.emplace(node.Get(), TNodeInfo(translatedId, node.Get())).first->second; - TExprNode::TListType& dependencies = info.Dependencies; + TExprNode::TListType& dependencies = info.Dependencies; if (node->Content() == CommitName) { dependencies.push_back(node->Child(0)); auto dataSinkName = node->Child(1)->Child(0)->Content(); @@ -387,7 +387,7 @@ public: } void VisitNode(const TExprNode::TPtr& node, TNodeMap<TNodeInfo>& nodes, - TExprNode::TListType& order) { + TExprNode::TListType& order) { switch (node->Type()) { case TExprNode::Atom: case TExprNode::List: @@ -403,7 +403,7 @@ public: } void GatherDependencies(const TExprNode& node, - const TNodeMap<TNodeInfo>& nodes, TSet<ui64>& dependsOn) { + const TNodeMap<TNodeInfo>& nodes, TSet<ui64>& dependsOn) { const auto info = nodes.find(&node); if (nodes.cend() == info) return; @@ -419,10 +419,10 @@ public: } void BuildBasicGraph( - const TNodeMap<TNodeInfo>& nodes, const TExprNode::TListType& order, - ui32 root, TVector<TBasicNode>& basicNodes, TVector<TBasicLink>& basicLinks) { - THashMap<TPinKey, ui32, TPinKey::THash> allInputs; - THashMap<TPinKey, ui32, TPinKey::THash> allOutputs; + const TNodeMap<TNodeInfo>& nodes, const TExprNode::TListType& order, + ui32 root, TVector<TBasicNode>& basicNodes, TVector<TBasicLink>& basicLinks) { + THashMap<TPinKey, ui32, TPinKey::THash> allInputs; + THashMap<TPinKey, ui32, TPinKey::THash> allOutputs; for (auto node : order) { auto& info = nodes.find(node.Get())->second; if (!info.IsVisible) { @@ -519,7 +519,7 @@ public: } } - TSet<ui64> dependsOn; + TSet<ui64> dependsOn; for (auto child : info.Dependencies) { GatherDependencies(*child, nodes, dependsOn); } @@ -529,7 +529,7 @@ public: } } - THashMap<ui32, TLevelContext> basicNodesMap; + THashMap<ui32, TLevelContext> basicNodesMap; for (auto& node : basicNodes) { basicNodesMap.insert({ node.Id, TLevelContext(&node) }); } @@ -544,7 +544,7 @@ public: } if (root) { - THashSet<ui32> visited; + THashSet<ui32> visited; FillLevels(basicNodesMap, root, visited); } } @@ -566,7 +566,7 @@ public: providers.insert(std::make_pair(path, TProviderInfo(providerId, node, provider))); } - void UpdateProviders(TProviderInfoMap& providers, const TVector<TPinInfo>& pins) { + void UpdateProviders(TProviderInfoMap& providers, const TVector<TPinInfo>& pins) { for (auto& pin : pins) { if (pin.DataSource) { auto providerName = pin.DataSource->Child(0)->Content(); @@ -625,7 +625,7 @@ public: } void WritePins(const TString& tag, const TVector<TPinInfo>& pins, NYson::TYsonWriter& writer, - TVector<TPinAttrs>& pinAttrs, TProviderInfoMap& providers) { + TVector<TPinAttrs>& pinAttrs, TProviderInfoMap& providers) { if (!pins.empty()) { UpdateProviders(providers, pins); writer.OnKeyedItem(tag); @@ -666,8 +666,8 @@ public: private: TTypeAnnotationContext& Types_; - THashMap<TPinKey, ui32, TPinKey::THash> PinMap_; - TMap<TString, ui32> ProviderIds_; + THashMap<TPinKey, ui32, TPinKey::THash> PinMap_; + TMap<TString, ui32> ProviderIds_; ui32 NextId_ = 0; }; diff --git a/ydb/library/yql/core/services/yql_transform_pipeline.h b/ydb/library/yql/core/services/yql_transform_pipeline.h index 7e2f5c911e6..a4fa6fde011 100644 --- a/ydb/library/yql/core/services/yql_transform_pipeline.h +++ b/ydb/library/yql/core/services/yql_transform_pipeline.h @@ -54,7 +54,7 @@ public: private: TIntrusivePtr<TTypeAnnotationContext> TypeAnnotationContext_; - TVector<TTransformStage> Transformers_; + TVector<TTransformStage> Transformers_; }; struct IPipelineConfigurator diff --git a/ydb/library/yql/core/type_ann/type_ann_core.cpp b/ydb/library/yql/core/type_ann/type_ann_core.cpp index 5846e6cb108..0c02f465a10 100644 --- a/ydb/library/yql/core/type_ann/type_ann_core.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_core.cpp @@ -86,7 +86,7 @@ namespace NTypeAnnImpl { if (!isValid) { ctx.AddError(TIssue(ctx.GetPosition(atomNode.Pos()), TStringBuilder() << "Bad atom format for type: " - << type << ", value: " << TString(atomNode.Content()).Quote())); + << type << ", value: " << TString(atomNode.Content()).Quote())); } return isValid; @@ -520,11 +520,11 @@ namespace NTypeAnnImpl { struct TSyncFunctionsMap { TSyncFunctionsMap(); - THashMap<TString, TAnnotationFunc> Functions; - THashMap<TString, TExtendedAnnotationFunc> ExtFunctions; + THashMap<TString, TAnnotationFunc> Functions; + THashMap<TString, TExtendedAnnotationFunc> ExtFunctions; THashMap<TString, TExtendedAnnotationFunc> ColumnOrderFunctions; - THashMap<TString, ETypeAnnotationKind> TypeKinds; - THashSet<TString> AllNames; + THashMap<TString, ETypeAnnotationKind> TypeKinds; + THashSet<TString> AllNames; static const TSyncFunctionsMap& Instance() { return *Singleton<TSyncFunctionsMap>(); @@ -1170,7 +1170,7 @@ namespace NTypeAnnImpl { IGraphTransformer::TStatus FlattenMembersWrapper(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { Y_UNUSED(output); - TVector<const TItemExprType*> allItems; + TVector<const TItemExprType*> allItems; for (auto& child : input->Children()) { if (!EnsureTupleSize(*child, 2, ctx.Expr)) { return IGraphTransformer::TStatus::Error; @@ -1197,7 +1197,7 @@ namespace NTypeAnnImpl { itemType = ctx.Expr.MakeType<TOptionalExprType>(itemType); } auto newField = ctx.Expr.MakeType<TItemExprType>( - TString::Join(prefix->Content(), field->GetName()), + TString::Join(prefix->Content(), field->GetName()), itemType ); allItems.push_back(newField); @@ -1218,7 +1218,7 @@ namespace NTypeAnnImpl { return IGraphTransformer::TStatus::Error; } - TVector<const TItemExprType*> allItems; + TVector<const TItemExprType*> allItems; if (!EnsureStructType(input->Head(), ctx.Expr)) { return IGraphTransformer::TStatus::Error; } @@ -1316,7 +1316,7 @@ namespace NTypeAnnImpl { if (optional) { type = type->Cast<TOptionalExprType>()->GetItemType(); } - TVector<const TItemExprType*> allItems; + TVector<const TItemExprType*> allItems; auto structExprType = type->Cast<TStructExprType>(); for (auto& field: structExprType->GetItems()) { const auto& fieldName = field->GetName(); @@ -1362,7 +1362,7 @@ namespace NTypeAnnImpl { if (optional) { type = type->Cast<TOptionalExprType>()->GetItemType(); } - TVector<const TItemExprType*> allItems; + TVector<const TItemExprType*> allItems; auto structExprType = type->Cast<TStructExprType>(); for (auto& field: structExprType->GetItems()) { const auto& fieldName = field->GetName(); @@ -1414,11 +1414,11 @@ namespace NTypeAnnImpl { if (!EnsureStructOrOptionalStructType(*structObj, ctx.Expr)) { return IGraphTransformer::TStatus::Error; } - TSet<TString> aliases; - TMap<TString, TString> flattenByColumns; + TSet<TString> aliases; + TMap<TString, TString> flattenByColumns; for (++iter; iter != input->Children().end(); ++iter) { const auto& child = *iter; - TString alias; + TString alias; const auto& argType = child->Type(); if (argType != TExprNode::List && argType != TExprNode::Atom) { ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(child->Pos()), TStringBuilder() << "Expected atom or tuple, but got: " << argType)); @@ -1450,7 +1450,7 @@ namespace NTypeAnnImpl { return IGraphTransformer::TStatus::Error; } auto columnName = columnNameNode->Content(); - if (!flattenByColumns.emplace(TString(columnName), alias).second) { + if (!flattenByColumns.emplace(TString(columnName), alias).second) { ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(columnNameNode->Pos()), TStringBuilder() << "Duplicate flatten field found: " << columnName)); return IGraphTransformer::TStatus::Error; @@ -1468,7 +1468,7 @@ namespace NTypeAnnImpl { } bool allFieldOptional = true; - TVector<const TItemExprType*> allItems; + TVector<const TItemExprType*> allItems; for (auto& field: type->Cast<TStructExprType>()->GetItems()) { const auto& fieldName = field->GetName(); auto flattenIter = flattenByColumns.find(fieldName); @@ -1554,7 +1554,7 @@ namespace NTypeAnnImpl { auto dictType = fieldType->Cast<TDictExprType>(); const auto keyType = dictType->GetKeyType(); const auto payloadType = dictType->GetPayloadType(); - flattenItemType = ctx.Expr.MakeType<TTupleExprType>(TTypeAnnotationNode::TListType({keyType, payloadType})); + flattenItemType = ctx.Expr.MakeType<TTupleExprType>(TTypeAnnotationNode::TListType({keyType, payloadType})); } else { ctx.Expr.AddError(TIssue(ctx.Expr.GetPosition(structObj->Pos()), TStringBuilder() << "Expected list, dict or optional types in field of struct: '" << fieldName << @@ -3302,12 +3302,12 @@ namespace NTypeAnnImpl { } auto structType = type->Cast<TStructExprType>(); - THashMap<TStringBuf, const TItemExprType*> expectedMembers; + THashMap<TStringBuf, const TItemExprType*> expectedMembers; for (auto& item : structType->GetItems()) { expectedMembers[item->GetName()] = item; } - THashSet<TStringBuf> foundMembers; + THashSet<TStringBuf> foundMembers; for (size_t i = 1; i < input->ChildrenSize(); ++i) { if (!EnsureTupleSize(*input->Child(i), 2, ctx.Expr)) { return IGraphTransformer::TStatus::Error; @@ -5262,7 +5262,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> return IGraphTransformer::TStatus::Repeat; } else if (Mode == EDictItems::Both) { - TTypeAnnotationNode::TListType items; + TTypeAnnotationNode::TListType items; items.push_back(dictType->GetKeyType()); items.push_back(dictType->GetPayloadType()); auto tupleType = ctx.Expr.MakeType<TTupleExprType>(items); @@ -5286,7 +5286,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> return IGraphTransformer::TStatus::Repeat; } - TVector<const TItemExprType*> items; + TVector<const TItemExprType*> items; for (auto& child : input->Children()) { if (!EnsureTupleSize(*child, 2, ctx.Expr)) { return IGraphTransformer::TStatus::Error; @@ -5433,7 +5433,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> return IGraphTransformer::TStatus::Error; } - TExprNode::TListType newChildren; + TExprNode::TListType newChildren; IGraphTransformer::TStatus totalStatus = IGraphTransformer::TStatus::Ok; for (size_t i = 0; i < keysListNode->ChildrenSize(); ++i) { newChildren.push_back(keysListNode->ChildPtr(i)); @@ -5714,7 +5714,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> if (isTuple) { auto tupleType = input->Head().GetTypeAnn()->Cast<TTupleExprType>(); - TExprNode::TListType children; + TExprNode::TListType children; for (ui32 pos = 0; pos < tupleType->GetSize(); ++pos) { children.push_back(ctx.Expr.Builder(input->Pos()) .Apply(input->Child(1)) @@ -5731,7 +5731,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> output = ctx.Expr.NewList(input->Pos(), std::move(children)); } else { auto structType = input->Head().GetTypeAnn()->Cast<TStructExprType>(); - TExprNode::TListType children; + TExprNode::TListType children; for (auto item : structType->GetItems()) { children.push_back(ctx.Expr.Builder(input->Pos()) .List() @@ -7050,7 +7050,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> } auto combinedStatus = IGraphTransformer::TStatus(IGraphTransformer::TStatus::Ok); - TVector<ui32> autoMapArgs; + TVector<ui32> autoMapArgs; for (ui32 i = 1; i < input->ChildrenSize(); ++i) { const auto& arg = type->GetArguments()[i - 1]; const bool isAutoMap = arg.Flags & NKikimr::NUdf::ICallablePayload::TArgumentFlags::AutoMap; @@ -7104,7 +7104,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> if (!autoMapArgs.empty()) { // build output - TExprNode::TListType args; + TExprNode::TListType args; for (ui32 i = 0; i < autoMapArgs.size(); ++i) { args.push_back(ctx.Expr.NewArgument(input->Pos(), TStringBuilder() << "automap_" << i)); } @@ -7185,12 +7185,12 @@ template <NKikimr::NUdf::EDataSlot DataSlot> return IGraphTransformer::TStatus::Error; } - TTypeAnnotationNode::TListType expectedTupleTypeItems; + TTypeAnnotationNode::TListType expectedTupleTypeItems; for (ui32 i = 0; i < tupleType->GetSize(); ++i) { expectedTupleTypeItems.push_back(type->GetArguments()[i].Type); } - TVector<ui32> tupleAutoMaps; + TVector<ui32> tupleAutoMaps; auto expectedTupleType = ctx.Expr.MakeType<TTupleExprType>(expectedTupleTypeItems); auto convertStatus = TrySilentConvertTo(input->ChildRef(1), *expectedTupleType, ctx.Expr); if (convertStatus.Level == IGraphTransformer::TStatus::Error) { @@ -7229,8 +7229,8 @@ template <NKikimr::NUdf::EDataSlot DataSlot> return convertStatus; } - TVector<const TItemExprType*> expectedStructTypeItems; - TSet<ui32> usedIndices; + TVector<const TItemExprType*> expectedStructTypeItems; + TSet<ui32> usedIndices; for (const auto& structItem : structType->GetItems()) { auto foundIndex = type->ArgumentIndexByName(structItem->GetName()); if (!foundIndex) { @@ -7272,7 +7272,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> } convertStatus = TrySilentConvertTo(input->ChildRef(2), *expectedStructType, ctx.Expr); - TVector<ui32> structAutoMaps; + TVector<ui32> structAutoMaps; if (convertStatus.Level == IGraphTransformer::TStatus::Error) { bool hasError = false; for (ui32 i = 0; i < structType->GetSize(); ++i) { @@ -7312,9 +7312,9 @@ template <NKikimr::NUdf::EDataSlot DataSlot> if (!tupleAutoMaps.empty() || !structAutoMaps.empty()) { auto totalAutoMapArgs = tupleAutoMaps.size() + structAutoMaps.size(); // build output - TExprNode::TListType args; - TExprNode::TListType inputArgs; - TMap<ui32, ui32> indexToTupleIndex; + TExprNode::TListType args; + TExprNode::TListType inputArgs; + TMap<ui32, ui32> indexToTupleIndex; for (ui32 i = 0; i < totalAutoMapArgs; ++i) { args.push_back(ctx.Expr.NewArgument(input->Pos(), TStringBuilder() << "automap_" << i)); } @@ -7326,7 +7326,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> ctx.Expr.NewAtom(input->Pos(), ToString(tupleAutoMaps[i])) })); } - TMap<ui32, ui32> indexToStructIndex; + TMap<ui32, ui32> indexToStructIndex; for (ui32 i = 0; i < structAutoMaps.size(); ++i) { auto name = structType->GetItems()[structAutoMaps[i]]->GetName(); indexToStructIndex[structAutoMaps[i]] = i + tupleAutoMaps.size(); @@ -7338,7 +7338,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> auto newChildren = input->ChildrenList(); if (!tupleAutoMaps.empty()) { // update tuple arg - TExprNode::TListType newTupleItems; + TExprNode::TListType newTupleItems; for (ui32 i = 0; i < tupleType->GetSize(); ++i) { auto it = indexToTupleIndex.find(i); if (it == indexToTupleIndex.end()) { @@ -7356,7 +7356,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> if (!structAutoMaps.empty()) { // update struct arg - TExprNode::TListType newStructItems; + TExprNode::TListType newStructItems; for (ui32 i = 0; i < structType->GetSize(); ++i) { auto name = structType->GetItems()[i]->GetName(); auto it = indexToStructIndex.find(i); @@ -7595,7 +7595,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> return IGraphTransformer::TStatus::Error; } - TTypeAnnotationNode::TListType tupleItems(2); + TTypeAnnotationNode::TListType tupleItems(2); tupleItems[0] = ctx.Expr.MakeType<TDataExprType>(EDataSlot::Uint64); tupleItems[1] = input->Head().GetTypeAnn(); input->SetTypeAnn(ctx.Expr.MakeType<TTupleExprType>(tupleItems)); @@ -7769,7 +7769,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> } auto variantType = input->Head().GetTypeAnn()->Cast<TVariantExprType>(); - TVector<bool> usedFields; + TVector<bool> usedFields; ui32 usedCount = 0; const TTupleExprType* tupleType = nullptr; const TStructExprType* structType = nullptr; @@ -13266,7 +13266,7 @@ template <NKikimr::NUdf::EDataSlot DataSlot> for (ui32 k = (ui32)ETypeAnnotationKind::Unit; k < (ui32)ETypeAnnotationKind::LastType; ++k) { const ETypeAnnotationKind kind = (ETypeAnnotationKind)k; - TypeKinds.insert(std::pair<TString, ETypeAnnotationKind>(TStringBuilder() << kind, kind)); + TypeKinds.insert(std::pair<TString, ETypeAnnotationKind>(TStringBuilder() << kind, kind)); } for (auto& func : Functions) { @@ -13436,7 +13436,7 @@ TAutoPtr<IGraphTransformer> CreateExtCallableTypeAnnotationTransformer(TTypeAnno return new NTypeAnnImpl::TExtCallableTypeAnnotationTransformer(types, instantOnly); } -const THashSet<TString>& GetBuiltinFunctions() { +const THashSet<TString>& GetBuiltinFunctions() { return NTypeAnnImpl::TSyncFunctionsMap::Instance().AllNames; } diff --git a/ydb/library/yql/core/type_ann/type_ann_core.h b/ydb/library/yql/core/type_ann/type_ann_core.h index 8396222009e..b9c9bb4dc0a 100644 --- a/ydb/library/yql/core/type_ann/type_ann_core.h +++ b/ydb/library/yql/core/type_ann/type_ann_core.h @@ -14,6 +14,6 @@ IGraphTransformer::TStatus ValidateProviders(const TExprNode::TPtr& node, TExprN TAutoPtr<IGraphTransformer> CreateIntentDeterminationTransformer(const TTypeAnnotationContext& types); TAutoPtr<IGraphTransformer> CreateExtCallableTypeAnnotationTransformer(TTypeAnnotationContext& types, bool instantOnly = false); -const THashSet<TString>& GetBuiltinFunctions(); +const THashSet<TString>& GetBuiltinFunctions(); } // namespace NYql diff --git a/ydb/library/yql/core/type_ann/type_ann_expr.cpp b/ydb/library/yql/core/type_ann/type_ann_expr.cpp index f67d3b41200..e7f7c7c7802 100644 --- a/ydb/library/yql/core/type_ann/type_ann_expr.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_expr.cpp @@ -66,7 +66,7 @@ public: NThreading::TFuture<void> DoGetAsyncFuture(const TExprNode& input) final { YQL_PROFILE_SCOPE(DEBUG, "TypeAnnotationTransformer::DoGetAsyncFuture"); Y_UNUSED(input); - TVector<NThreading::TFuture<void>> futures; + TVector<NThreading::TFuture<void>> futures; for (const auto& callable : CallableInputs) { futures.push_back(CallableTransformer->GetAsyncFuture(*callable)); } @@ -105,7 +105,7 @@ private: return; } - TVector<std::pair<TString, ui64>> values; + TVector<std::pair<TString, ui64>> values; for (const auto& x : RepeatCallableCount) { values.push_back({ x.first, x.second }); } @@ -259,7 +259,7 @@ private: case TExprNode::List: { TStatus combinedStatus = TStatus::Ok; - TExprNode::TListType newChildren; + TExprNode::TListType newChildren; newChildren.reserve(input->ChildrenSize()); bool updatedChildren = false; for (ui32 i = 0; i < input->ChildrenSize(); ++i) { @@ -284,7 +284,7 @@ private: break; } - TTypeAnnotationNode::TListType children; + TTypeAnnotationNode::TListType children; children.reserve(input->ChildrenSize()); bool isUnit = false; for (auto& child : input->Children()) { @@ -388,7 +388,7 @@ private: { TStatus combinedStatus = TStatus::Ok; { - TExprNode::TListType newChildren; + TExprNode::TListType newChildren; newChildren.reserve(input->ChildrenSize()); bool updatedChildren = false; for (ui32 i = 0; i < input->ChildrenSize(); ++i) { @@ -544,10 +544,10 @@ private: private: TAutoPtr<IGraphTransformer> CallableTransformer; TTypeAnnotationContext& Types; - TDeque<TExprNode::TPtr> CallableInputs; + TDeque<TExprNode::TPtr> CallableInputs; TNodeOnNodeOwnedMap Processed; bool HasRenames = false; - THashMap<TString, ui64> RepeatCallableCount; + THashMap<TString, ui64> RepeatCallableCount; TStack<std::pair<TStringBuf, bool>> CurrentFunctions; THashMap<TStringBuf, std::pair<ui64, ui64>> CallableTimes; }; @@ -574,7 +574,7 @@ TAutoPtr<IGraphTransformer> CreateFullTypeAnnotationTransformer( bool wholeProgram, TTypeAnnotationContext& typeAnnotationContext) { - TVector<TTransformStage> transformers; + TVector<TTransformStage> transformers; auto issueCode = TIssuesIds::CORE_PRE_TYPE_ANN; transformers.push_back(TTransformStage( CreateFunctorTransformer(&ExpandApply), diff --git a/ydb/library/yql/core/type_ann/type_ann_join.cpp b/ydb/library/yql/core/type_ann/type_ann_join.cpp index 18516a8ab8b..d197a1c07b5 100644 --- a/ydb/library/yql/core/type_ann/type_ann_join.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_join.cpp @@ -111,7 +111,7 @@ namespace NTypeAnnImpl { return IGraphTransformer::TStatus::Error; } - TTypeAnnotationNode::TListType tupleItems(2); + TTypeAnnotationNode::TListType tupleItems(2); tupleItems[0] = leftItemType; tupleItems[1] = rightItemType; if (joinKind == "Right" || joinKind == "Full") { diff --git a/ydb/library/yql/core/type_ann/type_ann_list.cpp b/ydb/library/yql/core/type_ann/type_ann_list.cpp index b145cde3893..1791153a118 100644 --- a/ydb/library/yql/core/type_ann/type_ann_list.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_list.cpp @@ -2043,7 +2043,7 @@ namespace { inputStreamsCount = inputStreams->GetSize(); } - TVector<const TTypeAnnotationNode*> outputStreamItems; + TVector<const TTypeAnnotationNode*> outputStreamItems; for (ui32 i = 2; i < input->ChildrenSize(); i += 2) { if (!EnsureTuple(*input->Child(i), ctx.Expr)) { return IGraphTransformer::TStatus::Error; @@ -2241,7 +2241,7 @@ namespace { auto tmpArg1 = ctx.Expr.NewArgument(input->Pos(), "tmp1"); auto tmpArg2 = ctx.Expr.NewArgument(input->Pos(), "tmp2"); - THashMap<TStringBuf, std::pair<const TTypeAnnotationNode*, ui32>> members; + THashMap<TStringBuf, std::pair<const TTypeAnnotationNode*, ui32>> members; ui32 inputsCount = input->ChildrenSize(); auto checkStructType = [&members, &ctx, tmpArg1, tmpArg2, inputsCount, pos = input->Pos()](TExprNode& input) -> const TStructExprType* { if (!EnsureListType(input, ctx.Expr)) { @@ -2288,7 +2288,7 @@ namespace { return structType; }; - TVector<const TStructExprType*> structTypes; + TVector<const TStructExprType*> structTypes; for (auto child : input->Children()) { auto structType = checkStructType(*child); if (!structType) { @@ -2298,8 +2298,8 @@ namespace { structTypes.push_back(structType); } - TVector<const TItemExprType*> resultItems; - THashSet<TStringBuf> addedMembers; + TVector<const TItemExprType*> resultItems; + THashSet<TStringBuf> addedMembers; auto addResultItems = [&resultItems, &members, &ctx, &addedMembers, inputsCount](const TStructExprType* structType) { for (auto item: structType->GetItems()) { const TTypeAnnotationNode* memberType = nullptr; @@ -3069,7 +3069,7 @@ namespace { } auto& lambdaListHandler = input->ChildRef(4); - TTypeAnnotationNode::TListType tupleItems = { + TTypeAnnotationNode::TListType tupleItems = { lambdaKeySelector->GetTypeAnn(), ctx.Expr.MakeType<TStreamExprType>(itemType) }; @@ -3664,7 +3664,7 @@ namespace { } } - TTypeAnnotationNode::TListType tupleItems; + TTypeAnnotationNode::TListType tupleItems; bool hasEmpty = false; for (auto& child : input->Children()) { hasEmpty = hasEmpty || child->GetTypeAnn()->GetKind() != ETypeAnnotationKind::List; @@ -3694,7 +3694,7 @@ namespace { } } - TTypeAnnotationNode::TListType tupleItems; + TTypeAnnotationNode::TListType tupleItems; for (auto& child : input->Children()) { auto itemType = child->GetTypeAnn()->GetKind() == ETypeAnnotationKind::List ? child->GetTypeAnn()->Cast<TListExprType>()->GetItemType() : @@ -3752,7 +3752,7 @@ namespace { } } - TTypeAnnotationNode::TListType tupleItems(2); + TTypeAnnotationNode::TListType tupleItems(2); tupleItems[0] = expectedType; tupleItems[1] = input->Head().GetTypeAnn()->Cast<TListExprType>()->GetItemType(); auto retTuple = ctx.Expr.MakeType<TTupleExprType>(tupleItems); @@ -3988,7 +3988,7 @@ namespace { } const auto structType = inputItemType->Cast<TStructExprType>(); - TVector<const TItemExprType*> resItems; + TVector<const TItemExprType*> resItems; for (auto& x : input->Tail().Children()) { YQL_ENSURE(x->IsAtom()); auto pos = FindOrReportMissingMember(x->Content(), input->Head().Pos(), *structType, ctx); @@ -4683,7 +4683,7 @@ namespace { } } - TVector<const TItemExprType*> items; + TVector<const TItemExprType*> items; for (auto& pair : columnTypes) { items.push_back(ctx.Expr.MakeType<TItemExprType>(pair.first, pair.second)); } diff --git a/ydb/library/yql/core/type_ann/type_ann_types.cpp b/ydb/library/yql/core/type_ann/type_ann_types.cpp index c27c0c433fd..379c86f8cdd 100644 --- a/ydb/library/yql/core/type_ann/type_ann_types.cpp +++ b/ydb/library/yql/core/type_ann/type_ann_types.cpp @@ -306,7 +306,7 @@ namespace NTypeAnnImpl { template <> IGraphTransformer::TStatus TypeWrapper<ETypeAnnotationKind::Tuple>(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { Y_UNUSED(output); - TTypeAnnotationNode::TListType items; + TTypeAnnotationNode::TListType items; for (size_t i = 0; i < input->ChildrenSize(); ++i) { auto& child = input->ChildRef(i); if (auto status = EnsureTypeRewrite(child, ctx.Expr); status != IGraphTransformer::TStatus::Ok) { @@ -351,7 +351,7 @@ namespace NTypeAnnImpl { template <> IGraphTransformer::TStatus TypeWrapper<ETypeAnnotationKind::Struct>(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { Y_UNUSED(output); - TVector<const TItemExprType*> items; + TVector<const TItemExprType*> items; for (size_t i = 0; i < input->ChildrenSize(); ++i) { auto& child = input->ChildRef(i); if (!EnsureTupleSize(*child, 2, ctx.Expr)) { @@ -739,7 +739,7 @@ namespace NTypeAnnImpl { } } - TString payload; + TString payload; if (input->Child(0)->ChildrenSize() > 1) { if (!EnsureAtom(*input->Child(0)->Child(1), ctx.Expr)) { return IGraphTransformer::TStatus::Error; @@ -749,7 +749,7 @@ namespace NTypeAnnImpl { } const TTypeAnnotationNode* resultType = nullptr; - TVector<TCallableExprType::TArgumentInfo> arguments; + TVector<TCallableExprType::TArgumentInfo> arguments; for (ui32 index = 1; index < input->ChildrenSize(); ++index) { auto child = input->Child(index); if (!EnsureTupleMinSize(*child, 1, ctx.Expr)) { @@ -992,7 +992,7 @@ namespace NTypeAnnImpl { } auto structType = type->Cast<TStructExprType>(); - TVector<const TItemExprType*> items = structType->GetItems(); + TVector<const TItemExprType*> items = structType->GetItems(); auto newItem = ctx.Expr.MakeType<TItemExprType>(input->Child(1)->Content(), input->Child(2)->GetTypeAnn()->Cast<TTypeExprType>()->GetType()); if (!newItem->Validate(input->Pos(), ctx.Expr)) { @@ -1033,7 +1033,7 @@ namespace NTypeAnnImpl { } auto structType = type->Cast<TStructExprType>(); - TVector<const TItemExprType*> items; + TVector<const TItemExprType*> items; items.reserve(Max<ui64>(structType->GetSize(), 1) - 1); bool found = false; for (auto& item : structType->GetItems()) { @@ -1072,7 +1072,7 @@ namespace NTypeAnnImpl { template <> IGraphTransformer::TStatus TypeArgWrapper<ETypeArgument::FlattenMembers>(const TExprNode::TPtr& input, TExprNode::TPtr& output, TContext& ctx) { - TVector<const TItemExprType*> allItems; + TVector<const TItemExprType*> allItems; for (auto& child : input->Children()) { if (!EnsureTupleSize(*child, 2, ctx.Expr)) { return IGraphTransformer::TStatus::Error; @@ -1107,7 +1107,7 @@ namespace NTypeAnnImpl { itemType = ctx.Expr.MakeType<TOptionalExprType>(itemType); } auto newField = ctx.Expr.MakeType<TItemExprType>( - TString::Join(prefix->Content(), field->GetName()), + TString::Join(prefix->Content(), field->GetName()), itemType ); allItems.push_back(newField); diff --git a/ydb/library/yql/core/user_data/yql_user_data.cpp b/ydb/library/yql/core/user_data/yql_user_data.cpp index 11db9c779e4..bcd02a3ad21 100644 --- a/ydb/library/yql/core/user_data/yql_user_data.cpp +++ b/ydb/library/yql/core/user_data/yql_user_data.cpp @@ -5,8 +5,8 @@ namespace NYql { namespace NUserData { void TUserData::UserDataToLibraries( - const TVector<TUserData>& userData, - THashMap<TString,TString>& modules + const TVector<TUserData>& userData, + THashMap<TString,TString>& modules ) { for (const TUserData& item : userData) { if (item.Type_ == EType::LIBRARY) { diff --git a/ydb/library/yql/core/user_data/yql_user_data.h b/ydb/library/yql/core/user_data/yql_user_data.h index 8153f8253ed..0908daa68a4 100644 --- a/ydb/library/yql/core/user_data/yql_user_data.h +++ b/ydb/library/yql/core/user_data/yql_user_data.h @@ -29,8 +29,8 @@ struct TUserData { TString Content_; static void UserDataToLibraries( - const TVector<TUserData>& userData, - THashMap<TString,TString>& libraries + const TVector<TUserData>& userData, + THashMap<TString,TString>& libraries ); static void FillFromFolder( diff --git a/ydb/library/yql/core/yql_csv.cpp b/ydb/library/yql/core/yql_csv.cpp index 259b6144f1b..1cf11742dcf 100644 --- a/ydb/library/yql/core/yql_csv.cpp +++ b/ydb/library/yql/core/yql_csv.cpp @@ -82,10 +82,10 @@ TCsvInputStream::TCsvInputStream(IInputStream& slave, char delimiter) { } -TVector<TString> TCsvInputStream::ReadLine() +TVector<TString> TCsvInputStream::ReadLine() { - TVector<TString> parts; - TString line; + TVector<TString> parts; + TString line; if (Slave_.ReadLine(line)) { TCsvLineParser lineParser(line, Delim_); @@ -98,16 +98,16 @@ TVector<TString> TCsvInputStream::ReadLine() return parts; } -TVector<TString> TCsvInputStream::ReadLineWithEscaping() +TVector<TString> TCsvInputStream::ReadLineWithEscaping() { - TVector<TString> parts; - TString line; + TVector<TString> parts; + TString line; if (Slave_.ReadLine(line)) { TCsvLineParser lineParser(line, Delim_); TStringBuf token; while (lineParser.Next(token)) { - parts.push_back(TString(token)); + parts.push_back(TString(token)); } } @@ -123,9 +123,9 @@ TCsvInputBuffer::TCsvInputBuffer(const TStringBuf& buffer, char delimiter) { } -TVector<TString> TCsvInputBuffer::ReadLine() +TVector<TString> TCsvInputBuffer::ReadLine() { - TVector<TString> parts; + TVector<TString> parts; TStringBuf line; if (Buffer_.ReadLine(line)) { @@ -139,9 +139,9 @@ TVector<TString> TCsvInputBuffer::ReadLine() return parts; } -TVector<TString> TCsvInputBuffer::ReadLineWithEscaping() +TVector<TString> TCsvInputBuffer::ReadLineWithEscaping() { - TVector<TString> parts; + TVector<TString> parts; TStringBuf line; if (Buffer_.ReadLine(line)) { diff --git a/ydb/library/yql/core/yql_csv.h b/ydb/library/yql/core/yql_csv.h index 6e3e48b816f..86f6f8aea3a 100644 --- a/ydb/library/yql/core/yql_csv.h +++ b/ydb/library/yql/core/yql_csv.h @@ -14,8 +14,8 @@ class TCsvInputStream { public: TCsvInputStream(IInputStream& slave, char delimiter = ';'); - TVector<TString> ReadLine(); - TVector<TString> ReadLineWithEscaping(); + TVector<TString> ReadLine(); + TVector<TString> ReadLineWithEscaping(); private: IInputStream& Slave_; @@ -30,8 +30,8 @@ class TCsvInputBuffer { public: TCsvInputBuffer(const TStringBuf& buffer, char delimiter = ';'); - TVector<TString> ReadLine(); - TVector<TString> ReadLineWithEscaping(); + TVector<TString> ReadLine(); + TVector<TString> ReadLineWithEscaping(); private: TStringBuf Buffer_; @@ -47,7 +47,7 @@ public: TCsvOutputStream(IOutputStream& slave, char delimiter = ';', bool quoteItems = true); // hack for output empty values - inline TCsvOutputStream& operator<<(const TString& value) { + inline TCsvOutputStream& operator<<(const TString& value) { DoWrite(value.data(), value.size()); return *this; } @@ -58,8 +58,8 @@ public: return *this; } - inline TCsvOutputStream& operator<<(const TVector<TString>& values) { - for(const TString& value: values) { + inline TCsvOutputStream& operator<<(const TVector<TString>& values) { + for(const TString& value: values) { (*this) << value; } (*this) << Endl; diff --git a/ydb/library/yql/core/yql_data_provider.h b/ydb/library/yql/core/yql_data_provider.h index 3ffbdc041da..5ec5af1c507 100644 --- a/ydb/library/yql/core/yql_data_provider.h +++ b/ydb/library/yql/core/yql_data_provider.h @@ -29,11 +29,11 @@ struct TPinInfo { const TExprNode* DataSource; const TExprNode* DataSink; const TExprNode* Key; - TString DisplayName; + TString DisplayName; bool HideInBasicPlan; TPinInfo(const TExprNode* dataSource, const TExprNode* dataSink, - const TExprNode* key, const TString& displayName, bool hideInBasicPlan) + const TExprNode* key, const TString& displayName, bool hideInBasicPlan) : DataSource(dataSource) , DataSink(dataSink) , Key(key) @@ -48,15 +48,15 @@ public: virtual void WriteDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; // returns visibility of node - virtual bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) = 0; + virtual bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) = 0; virtual void GetResultDependencies(const TExprNode::TPtr& node, TExprNode::TListType& children, bool compact) = 0; - virtual void GetInputs(const TExprNode& node, TVector<TPinInfo>& inputs) = 0; - virtual void GetOutputs(const TExprNode& node, TVector<TPinInfo>& outputs) = 0; - virtual TString GetProviderPath(const TExprNode& node) = 0; + virtual void GetInputs(const TExprNode& node, TVector<TPinInfo>& inputs) = 0; + virtual void GetOutputs(const TExprNode& node, TVector<TPinInfo>& outputs) = 0; + virtual TString GetProviderPath(const TExprNode& node) = 0; virtual void WritePlanDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; virtual void WritePullDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; virtual void WritePinDetails(const TExprNode& node, NYson::TYsonWriter& writer) = 0; - virtual TString GetOperationDisplayName(const TExprNode& node) = 0; + virtual TString GetOperationDisplayName(const TExprNode& node) = 0; }; class ITrackableNodeProcessor { @@ -94,7 +94,7 @@ public: TMaybe<ui64> AllResultsBytesLimit = 100000; TMaybe<ui64> RowsLimitPerWrite = 1000; // only if list is written EResultFormat Format; - TString FormatDetails; + TString FormatDetails; bool Discard = false; }; @@ -149,7 +149,7 @@ public: //-- execution virtual bool CanExecute(const TExprNode& node) = 0; - virtual void GetRequiredChildren(const TExprNode& node, TExprNode::TListType& children) = 0; + virtual void GetRequiredChildren(const TExprNode& node, TExprNode::TListType& children) = 0; virtual IGraphTransformer& GetCallableExecutionTransformer() = 0; //-- finalizing @@ -194,7 +194,7 @@ struct TDataProviderInfo { TIntrusivePtr<IDataProvider> Sink; bool SupportFullResultDataSink = false; - std::function<TMaybe<TString>(const TMaybe<TSet<TString>>& usedClusters, const TMaybe<TSet<TString>>& usedProviders, + std::function<TMaybe<TString>(const TMaybe<TSet<TString>>& usedClusters, const TMaybe<TSet<TString>>& usedProviders, ESourceSyntax syntax)> RemoteClusterProvider; std::function<TFutureStatus(const TString& cluster, ESourceSyntax sourceSyntax, const TString& sourceCode, diff --git a/ydb/library/yql/core/yql_execution.cpp b/ydb/library/yql/core/yql_execution.cpp index eb138b1b4f3..20dc796db1f 100644 --- a/ydb/library/yql/core/yql_execution.cpp +++ b/ydb/library/yql/core/yql_execution.cpp @@ -26,8 +26,8 @@ public: IDataProvider* DataProvider = nullptr; }; - using TQueueType = TIntrusiveListWithAutoDelete<TState::TItem, TDelete>; - TQueueType Completed; + using TQueueType = TIntrusiveListWithAutoDelete<TState::TItem, TDelete>; + TQueueType Completed; NThreading::TPromise<void> Promise; bool HasResult = false; }; @@ -104,7 +104,7 @@ public: TStatus combinedStatus = TStatus::Ok; - TState::TQueueType completed; + TState::TQueueType completed; auto newPromise = NThreading::NewPromise(); { TGuard<TAdaptiveLock> guard(State->Lock); @@ -302,7 +302,7 @@ public: TStatus ExecuteChildren(const TExprNode::TPtr& node, TExprNode::TPtr& output, TExprContext& ctx, ui32 depth) { TStatus combinedStatus = TStatus::Ok; - TExprNode::TListType newChildren; + TExprNode::TListType newChildren; bool newNode = false; for (auto& child : node->Children()) { auto newChild = child; @@ -486,7 +486,7 @@ public: auto publicId = Types.TranslateOperationId(node.UniqueId()); if (publicId) { auto x = Progresses.insert({ *publicId, - TOperationProgress(TString(category), *publicId, TOperationProgress::EState::Started) }); + TOperationProgress(TString(category), *publicId, TOperationProgress::EState::Started) }); if (x.second) { Writer(x.first->second); } @@ -709,7 +709,7 @@ IGraphTransformer::TStatus ValidateCallable(const TExprNode::TPtr& node, TExprCo return TStatus::Error; } - TExprNode::TListType childrenToCheck; + TExprNode::TListType childrenToCheck; dataProvider->GetRequiredChildren(*node, childrenToCheck); IGraphTransformer::TStatus combinedStatus = IGraphTransformer::TStatus::Ok; for (ui32 i = 0; i < childrenToCheck.size(); ++i) { @@ -787,10 +787,10 @@ TAutoPtr<IGraphTransformer> CreateCheckExecutionTransformer(const TTypeAnnotatio } TParentsMap parentsMap; - THashSet<TExprNode*> overWinNodes; + THashSet<TExprNode*> overWinNodes; GatherParents(*input, parentsMap); bool hasErrors = false; - THashSet<TIssue> added; + THashSet<TIssue> added; auto funcCheckExecution = [&](const THashSet<TStringBuf>& notAllowList, bool collectCalcOverWindow, const TExprNode::TPtr& node) { if (node->IsCallable("ErrorType")) { hasErrors = true; @@ -849,7 +849,7 @@ TAutoPtr<IGraphTransformer> CreateCheckExecutionTransformer(const TTypeAnnotatio return true; }; static const THashSet<TStringBuf> noExecutionList = {"InstanceOf", "Lag", "Lead", "Rank", "DenseRank", "RowNumber"}; - static const THashSet<TStringBuf> noExecutionListForCalcOverWindow = {"InstanceOf"}; + static const THashSet<TStringBuf> noExecutionListForCalcOverWindow = {"InstanceOf"}; VisitExpr(input, [funcCheckExecution](const TExprNode::TPtr& node) { bool collectCalcOverWindow = true; return funcCheckExecution(noExecutionList, collectCalcOverWindow, node); diff --git a/ydb/library/yql/core/yql_execution.h b/ydb/library/yql/core/yql_execution.h index cb38d913fa6..950b5d3c716 100644 --- a/ydb/library/yql/core/yql_execution.h +++ b/ydb/library/yql/core/yql_execution.h @@ -18,14 +18,14 @@ namespace NYql { YQL_OPERATION_PROGRESS_STATE_MAP(ENUM_VALUE_GEN) }; - TString Category; + TString Category; ui32 Id; EState State; using TStage = std::pair<TString, TInstant>; TStage Stage; - TString RemoteId; + TString RemoteId; struct TCounters { ui64 Completed = 0ULL; diff --git a/ydb/library/yql/core/yql_expr_optimize.cpp b/ydb/library/yql/core/yql_expr_optimize.cpp index 677ca7fa53a..8192d436b33 100644 --- a/ydb/library/yql/core/yql_expr_optimize.cpp +++ b/ydb/library/yql/core/yql_expr_optimize.cpp @@ -56,7 +56,7 @@ namespace { return memoization->second; } - TExprNode::TListType newChildren; + TExprNode::TListType newChildren; bool hasRemaps = false; for (const auto& child : node->Children()) { auto newChild = ApplyRemaps(child, ctx); @@ -148,7 +148,7 @@ namespace { } } } else { - TExprNode::TListType newChildren; + TExprNode::TListType newChildren; newChildren.reserve(current->ChildrenSize()); bool hasRenames = false; for (auto& child : current->Children()) { @@ -260,7 +260,7 @@ namespace { } } } else { - TExprNode::TListType newChildren; + TExprNode::TListType newChildren; newChildren.reserve(node->ChildrenSize()); bool hasRenames = false; @@ -651,7 +651,7 @@ IGraphTransformer::TStatus ExpandApply(const TExprNode::TPtr& input, TExprNode:: } ui32 flags = 0U; - TString content; + TString content; for (const auto& child : node->Children()) { if (!EnsureAtom(*child, ctx)) { return nullptr; @@ -822,8 +822,8 @@ TExprNode::TPtr ApplySyncListToWorld(const TExprNode::TPtr& main, const TSyncMap } using TPair = std::pair<TExprNode::TPtr, ui64>; - TVector<TPair> sortedList(syncList.cbegin(), syncList.cend()); - TExprNode::TListType syncChildren; + TVector<TPair> sortedList(syncList.cbegin(), syncList.cend()); + TExprNode::TListType syncChildren; syncChildren.push_back(main); Sort(sortedList, [](const TPair& x, const TPair& y) { return x.second < y.second; }); for (auto x : sortedList) { diff --git a/ydb/library/yql/core/yql_expr_type_annotation.cpp b/ydb/library/yql/core/yql_expr_type_annotation.cpp index f2b793af8d3..21537c263dd 100644 --- a/ydb/library/yql/core/yql_expr_type_annotation.cpp +++ b/ydb/library/yql/core/yql_expr_type_annotation.cpp @@ -369,7 +369,7 @@ IGraphTransformer::TStatus TryConvertToImpl(TExprContext& ctx, TExprNode::TPtr& else if (expectedType.GetKind() == ETypeAnnotationKind::Struct && node->IsCallable({"Struct", "AsStruct"})) { auto from = sourceType.Cast<TStructExprType>(); auto to = expectedType.Cast<TStructExprType>(); - THashMap<TString, TExprNode::TPtr> columnTransforms; + THashMap<TString, TExprNode::TPtr> columnTransforms; ui32 usedFields = 0; for (auto newField : to->GetItems()) { auto pos = from->FindItem(newField->GetName()); @@ -408,7 +408,7 @@ IGraphTransformer::TStatus TryConvertToImpl(TExprContext& ctx, TExprNode::TPtr& return IGraphTransformer::TStatus::Error; } - TExprNode::TListType nodeChildren; + TExprNode::TListType nodeChildren; for (auto& child : columnTransforms) { nodeChildren.push_back(ctx.NewList(node->Pos(), { ctx.NewAtom(node->Pos(), child.first), child.second })); @@ -420,7 +420,7 @@ IGraphTransformer::TStatus TryConvertToImpl(TExprContext& ctx, TExprNode::TPtr& else if (expectedType.GetKind() == ETypeAnnotationKind::Struct && sourceType.GetKind() == ETypeAnnotationKind::Struct) { auto from = sourceType.Cast<TStructExprType>(); auto to = expectedType.Cast<TStructExprType>(); - THashMap<TString, TExprNode::TPtr> columnTransforms; + THashMap<TString, TExprNode::TPtr> columnTransforms; ui32 usedFields = 0; for (auto newField : to->GetItems()) { auto pos = from->FindItem(newField->GetName()); @@ -463,7 +463,7 @@ IGraphTransformer::TStatus TryConvertToImpl(TExprContext& ctx, TExprNode::TPtr& return IGraphTransformer::TStatus::Error; } - TExprNode::TListType nodeChildren; + TExprNode::TListType nodeChildren; for (auto& child : columnTransforms) { nodeChildren.push_back(ctx.NewList(node->Pos(), { ctx.NewAtom(node->Pos(), child.first), child.second })); @@ -680,7 +680,7 @@ IGraphTransformer::TStatus TryConvertToImpl(TExprContext& ctx, TExprNode::TPtr& auto from = sourceType.Cast<TTupleExprType>(); auto to = expectedType.Cast<TTupleExprType>(); if (from->GetSize() <= to->GetSize()) { - TExprNode::TListType valueTransforms; + TExprNode::TListType valueTransforms; valueTransforms.reserve(to->GetSize()); for (ui32 i = 0; i < from->GetSize(); ++i) { const auto oldType = from->GetItems()[i]; @@ -714,7 +714,7 @@ IGraphTransformer::TStatus TryConvertToImpl(TExprContext& ctx, TExprNode::TPtr& const auto from = sourceType.Cast<TTupleExprType>(); const auto to = expectedType.Cast<TTupleExprType>(); if (from->GetSize() <= to->GetSize()) { - TExprNode::TListType valueTransforms; + TExprNode::TListType valueTransforms; valueTransforms.reserve(to->GetSize()); for (ui32 i = 0; i < from->GetSize(); ++i) { const auto oldType = from->GetItems()[i]; @@ -757,7 +757,7 @@ IGraphTransformer::TStatus TryConvertToImpl(TExprContext& ctx, TExprNode::TPtr& auto oldItemType = from->GetItemType(); auto newItemType = to->GetItemType(); - TExprNode::TListType valueTransforms; + TExprNode::TListType valueTransforms; if (node->IsCallable("List")) { valueTransforms.push_back(ExpandType(node->Pos(), *to, ctx)); } @@ -2131,13 +2131,13 @@ IGraphTransformer::TStatus ConvertToLambda(TExprNode::TPtr& node, TExprContext& return IGraphTransformer::TStatus::Error; } - TExprNode::TListType args; + TExprNode::TListType args; args.push_back(node); for (ui32 index = 0; index < (minArgumentsCount != Max<ui32>() ? minArgumentsCount : callableType->GetArgumentsSize()); ++index) { args.push_back(ctx.NewArgument(node->Pos(), Sprintf("arg%" PRIu32, index))); } - auto body = ctx.NewCallable(node->Pos(), "Apply", TExprNode::TListType(args)); + auto body = ctx.NewCallable(node->Pos(), "Apply", TExprNode::TListType(args)); args.erase(args.begin()); auto arguments = ctx.NewArguments(node->Pos(), std::move(args)); node = ctx.NewLambda(node->Pos(), std::move(arguments), std::move(body)); @@ -2834,7 +2834,7 @@ static bool EnsureKeyProperty(TPositionHandle position, const TTypeAnnotationNod return false; } - TTypeAnnotationNode::TListType keyTypes; + TTypeAnnotationNode::TListType keyTypes; if (keyType->GetKind() != ETypeAnnotationKind::Tuple) { keyTypes.push_back(keyType); } @@ -3664,9 +3664,9 @@ IGraphTransformer::TStatus SilentInferCommonType(TExprNode::TPtr& node1, const T auto tupleType1 = type1.Cast<TTupleExprType>(); auto tupleType2 = type2.Cast<TTupleExprType>(); if (tupleType1->GetSize() == tupleType2->GetSize()) { - TVector<const TTypeAnnotationNode*> commonItemTypes; - TExprNode::TListType leftItems; - TExprNode::TListType rightItems; + TVector<const TTypeAnnotationNode*> commonItemTypes; + TExprNode::TListType leftItems; + TExprNode::TListType rightItems; bool hasError = false; for (ui32 i = 0; i < tupleType1->GetSize(); ++i) { auto item1type = tupleType1->GetItems()[i]; @@ -3697,7 +3697,7 @@ IGraphTransformer::TStatus SilentInferCommonType(TExprNode::TPtr& node1, const T if (type1.GetKind() == ETypeAnnotationKind::Struct && type2.GetKind() == ETypeAnnotationKind::Struct) { auto structType1 = type1.Cast<TStructExprType>(); auto structType2 = type2.Cast<TStructExprType>(); - TSet<TStringBuf> allFields; + TSet<TStringBuf> allFields; for (const auto& x : structType1->GetItems()) { allFields.emplace(x->GetName()); } @@ -3706,9 +3706,9 @@ IGraphTransformer::TStatus SilentInferCommonType(TExprNode::TPtr& node1, const T allFields.emplace(x->GetName()); } - TVector<const TItemExprType*> commonItemTypes; - TExprNode::TListType leftItems; - TExprNode::TListType rightItems; + TVector<const TItemExprType*> commonItemTypes; + TExprNode::TListType leftItems; + TExprNode::TListType rightItems; bool hasError = false; for (const auto& x: allFields) { auto pos1 = structType1->FindItem(x); @@ -4190,7 +4190,7 @@ bool IsPureIsolatedLambda(const TExprNode& lambdaBody) { return IsPureIsolatedLambdaImpl(lambdaBody, visited); } -TString GetIntegralAtomValue(ui64 value, bool hasSign) { +TString GetIntegralAtomValue(ui64 value, bool hasSign) { return (hasSign) ? "-" + ToString(value) : ToString(value); } @@ -4512,8 +4512,8 @@ TMaybe<TIssue> NormalizeName(TPosition position, TString& name) { return Nothing(); } -TString NormalizeName(const TStringBuf& name) { - TString result(name); +TString NormalizeName(const TStringBuf& name) { + TString result(name); TMaybe<TIssue> error = NormalizeName(TPosition(), result); YQL_ENSURE(error.Empty(), "" << error->Message); return result; @@ -4564,7 +4564,7 @@ bool IsEmptyList(const TTypeAnnotationNode& type) { } static TString GetStructDiff(const TStructExprType& left, const TStructExprType& right) { - THashMap<TStringBuf, const TItemExprType*> rightItems; + THashMap<TStringBuf, const TItemExprType*> rightItems; for (auto item: right.GetItems()) { rightItems.insert({item->GetName(), item}); } @@ -4644,7 +4644,7 @@ TExprNode::TPtr ExpandTypeNoCache(TPositionHandle position, const TTypeAnnotatio } case ETypeAnnotationKind::Tuple: { - TExprNode::TListType tupleItems; + TExprNode::TListType tupleItems; for (auto& child : type.Cast<TTupleExprType>()->GetItems()) { tupleItems.push_back(ExpandType(position, *child, ctx)); } @@ -4655,7 +4655,7 @@ TExprNode::TPtr ExpandTypeNoCache(TPositionHandle position, const TTypeAnnotatio case ETypeAnnotationKind::Struct: { - TExprNode::TListType structItems; + TExprNode::TListType structItems; for (auto& child : type.Cast<TStructExprType>()->GetItems()) { structItems.push_back( ctx.NewList(position, { @@ -4722,8 +4722,8 @@ TExprNode::TPtr ExpandTypeNoCache(TPositionHandle position, const TTypeAnnotatio { auto callableType = type.Cast<TCallableExprType>(); - TExprNode::TListType callableArgs; - TExprNode::TListType mainSettings; + TExprNode::TListType callableArgs; + TExprNode::TListType mainSettings; if (callableType->GetOptionalArgumentsCount() != 0 || !callableType->GetPayload().empty()) { mainSettings.push_back(ctx.NewAtom(position, ToString(callableType->GetOptionalArgumentsCount()))); } @@ -4734,12 +4734,12 @@ TExprNode::TPtr ExpandTypeNoCache(TPositionHandle position, const TTypeAnnotatio callableArgs.push_back(ctx.NewList(position, std::move(mainSettings))); - TExprNode::TListType retSettings; + TExprNode::TListType retSettings; retSettings.push_back(ExpandType(position, *callableType->GetReturnType(), ctx)); callableArgs.push_back(ctx.NewList(position, std::move(retSettings))); for (const auto& child : callableType->GetArguments()) { - TExprNode::TListType argSettings; + TExprNode::TListType argSettings; argSettings.push_back(ExpandType(position, *child.Type, ctx)); if (!child.Name.empty() || child.Flags != 0) { argSettings.push_back(ctx.NewAtom(position, child.Name)); diff --git a/ydb/library/yql/core/yql_expr_type_annotation.h b/ydb/library/yql/core/yql_expr_type_annotation.h index a865aa27cd9..5b01c30ebd8 100644 --- a/ydb/library/yql/core/yql_expr_type_annotation.h +++ b/ydb/library/yql/core/yql_expr_type_annotation.h @@ -45,7 +45,7 @@ T FromString(const TExprNode& node, NKikimr::NUdf::EDataSlot slot) { } const auto typeName = NKikimr::NUdf::GetDataTypeInfo(slot).Name; - ythrow TNodeException(node) << "Bad atom format for type: " << typeName << ", value: " << TString(node.Content()).Quote(); + ythrow TNodeException(node) << "Bad atom format for type: " << typeName << ", value: " << TString(node.Content()).Quote(); } IGraphTransformer::TStatus CheckWholeProgramType(const TExprNode::TPtr& input, TExprNode::TPtr& output, TExprContext& ctx); @@ -245,16 +245,16 @@ EDataSlot GetNumericDataTypeByLevel(ui32 level); ui32 GetDateTypeLevel(EDataSlot dataSlot); EDataSlot GetDateTypeByLevel(ui32 level); bool IsPureIsolatedLambda(const TExprNode& lambdaBody); -TString GetIntegralAtomValue(ui64 value, bool hasSign); +TString GetIntegralAtomValue(ui64 value, bool hasSign); bool AllowIntegralConversion(NNodes::TCoIntegralCtor node, bool negate, EDataSlot toType, - TString* atomValue = nullptr); + TString* atomValue = nullptr); void ExtractIntegralValue(const TExprNode& constructor, bool negate, bool& hasSign, bool& isSigned, ui64& value); bool IsDataTypeString(EDataSlot dataSlot); bool EnsureComparableDataType(TPositionHandle position, EDataSlot dataSlot, TExprContext& ctx); bool EnsureEquatableDataType(TPositionHandle position, EDataSlot dataSlot, TExprContext& ctx); bool EnsureHashableDataType(TPositionHandle position, EDataSlot dataSlot, TExprContext& ctx); TMaybe<TIssue> NormalizeName(TPosition position, TString& name); -TString NormalizeName(const TStringBuf& name); +TString NormalizeName(const TStringBuf& name); bool HasError(const TTypeAnnotationNode* type, TExprContext& ctx); bool HasError(const TTypeAnnotationNode* type, TIssue& errIssue); diff --git a/ydb/library/yql/core/yql_graph_transformer.cpp b/ydb/library/yql/core/yql_graph_transformer.cpp index 26193c4c400..673bf1917f3 100644 --- a/ydb/library/yql/core/yql_graph_transformer.cpp +++ b/ydb/library/yql/core/yql_graph_transformer.cpp @@ -134,7 +134,7 @@ private: } protected: - TVector<TTransformStage> Stages; + TVector<TTransformStage> Stages; const bool UseIssueScopes; const bool DoCheckArguments; size_t Index = 0; @@ -151,7 +151,7 @@ void AddTooManyTransformationsError(TPositionHandle pos, const TStringBuf& where } -TAutoPtr<IGraphTransformer> CreateCompositeGraphTransformer(const TVector<TTransformStage>& stages, bool useIssueScopes) { +TAutoPtr<IGraphTransformer> CreateCompositeGraphTransformer(const TVector<TTransformStage>& stages, bool useIssueScopes) { return new TCompositeGraphTransformer(stages, useIssueScopes, /* doCheckArguments = */ true); } diff --git a/ydb/library/yql/core/yql_graph_transformer.h b/ydb/library/yql/core/yql_graph_transformer.h index 60d87727dd8..04b6b31d7c8 100644 --- a/ydb/library/yql/core/yql_graph_transformer.h +++ b/ydb/library/yql/core/yql_graph_transformer.h @@ -79,7 +79,7 @@ public: ui32 Repeats; ui32 Restarts; - TVector<std::pair<TString, TStatistics>> Stages; + TVector<std::pair<TString, TStatistics>> Stages; TStatistics() : TransformDuration(TDuration::Zero()) @@ -217,7 +217,7 @@ private: const TAutoPtr<IGraphTransformer> Transformer; }; -TAutoPtr<IGraphTransformer> CreateCompositeGraphTransformer(const TVector<TTransformStage>& stages, bool useIssueScopes); +TAutoPtr<IGraphTransformer> CreateCompositeGraphTransformer(const TVector<TTransformStage>& stages, bool useIssueScopes); TAutoPtr<IGraphTransformer> CreateCompositeGraphTransformerWithNoArgChecks(const TVector<TTransformStage>& stages, bool useIssueScopes); TAutoPtr<IGraphTransformer> CreateChoiceGraphTransformer( diff --git a/ydb/library/yql/core/yql_join.cpp b/ydb/library/yql/core/yql_join.cpp index 9a9ded7a327..f6bb0dca78d 100644 --- a/ydb/library/yql/core/yql_join.cpp +++ b/ydb/library/yql/core/yql_join.cpp @@ -436,7 +436,7 @@ TMaybe<TIssue> TJoinLabel::Parse(TExprContext& ctx, TExprNode& node, const TStru for (auto column : InputType->GetItems()) { auto name = column->GetName(); auto pos = name.find('.'); - if (pos == TString::npos) { + if (pos == TString::npos) { return TIssue(ctx.GetPosition(node.Pos()), TStringBuilder() << "Expected columns name as table.name, but got: " << name); } @@ -470,17 +470,17 @@ TMaybe<TIssue> TJoinLabel::ValidateLabel(TExprContext& ctx, const TCoAtom& label return {}; } -TString TJoinLabel::FullName(const TStringBuf& column) const { +TString TJoinLabel::FullName(const TStringBuf& column) const { if (AddLabel) { return FullColumnName(Tables[0], column); } else { - return TString(column); + return TString(column); } } TStringBuf TJoinLabel::ColumnName(const TStringBuf& column) const { auto pos = column.find('.'); - if (pos == TString::npos) { + if (pos == TString::npos) { return column; } @@ -489,7 +489,7 @@ TStringBuf TJoinLabel::ColumnName(const TStringBuf& column) const { TStringBuf TJoinLabel::TableName(const TStringBuf& column) const { auto pos = column.find('.'); - if (pos == TString::npos) { + if (pos == TString::npos) { YQL_ENSURE(AddLabel); return Tables[0]; } @@ -510,12 +510,12 @@ TMaybe<const TTypeAnnotationNode*> TJoinLabel::FindColumn(const TStringBuf& tabl return InputType->GetItems()[*pos]->GetItemType(); } -TString TJoinLabel::MemberName(const TStringBuf& table, const TStringBuf& column) const { - return AddLabel ? TString(column) : FullColumnName(table, column); +TString TJoinLabel::MemberName(const TStringBuf& table, const TStringBuf& column) const { + return AddLabel ? TString(column) : FullColumnName(table, column); } -TVector<TString> TJoinLabel::EnumerateAllColumns() const { - TVector<TString> result; +TVector<TString> TJoinLabel::EnumerateAllColumns() const { + TVector<TString> result; if (AddLabel) { // add label to all columns for (auto& x : InputType->GetItems()) { @@ -523,17 +523,17 @@ TVector<TString> TJoinLabel::EnumerateAllColumns() const { } } else { for (auto& x : InputType->GetItems()) { - result.push_back(TString(x->GetName())); + result.push_back(TString(x->GetName())); } } return result; } -TVector<TString> TJoinLabel::EnumerateAllMembers() const { - TVector<TString> result; +TVector<TString> TJoinLabel::EnumerateAllMembers() const { + TVector<TString> result; for (auto& x : InputType->GetItems()) { - result.push_back(TString(x->GetName())); + result.push_back(TString(x->GetName())); } return result; @@ -592,8 +592,8 @@ TMaybe<const TTypeAnnotationNode*> TJoinLabels::FindColumn(const TStringBuf& ful return FindColumn(part1, part2); } -TVector<TString> TJoinLabels::EnumerateColumns(const TStringBuf& table) const { - TVector<TString> result; +TVector<TString> TJoinLabels::EnumerateColumns(const TStringBuf& table) const { + TVector<TString> result; auto tableIndex = InputByTable.FindPtr(table); Y_ENSURE(tableIndex, "Unknown table:" << table); auto& label = Inputs[*tableIndex]; @@ -610,7 +610,7 @@ TVector<TString> TJoinLabels::EnumerateColumns(const TStringBuf& table) const { TStringBuf part2; SplitTableName(x->GetName(), part1, part2); if (part1 == table) { - result.push_back(TString(x->GetName())); + result.push_back(TString(x->GetName())); } } } @@ -862,7 +862,7 @@ TExprNode::TPtr FilterOutNullJoinColumns(TPositionHandle pos, const TExprNode::T return input; } - TExprNode::TListType optColumns; + TExprNode::TListType optColumns; for (auto fullColumnName : optionalKeyColumns) { TStringBuf table; TStringBuf column; @@ -880,8 +880,8 @@ TExprNode::TPtr FilterOutNullJoinColumns(TPositionHandle pos, const TExprNode::T .Build(); } -TMap<TStringBuf, TVector<TStringBuf>> LoadJoinRenameMap(const TExprNode& settings) { - TMap<TStringBuf, TVector<TStringBuf>> res; +TMap<TStringBuf, TVector<TStringBuf>> LoadJoinRenameMap(const TExprNode& settings) { + TMap<TStringBuf, TVector<TStringBuf>> res; for (const auto& child : settings.Children()) { if (child->Child(0)->Content() == "rename") { auto& v = res[child->Child(1)->Content()]; @@ -908,16 +908,16 @@ TSet<TVector<TStringBuf>> LoadJoinSortSets(const TExprNode& settings) { return res; } -THashMap<TString, const TTypeAnnotationNode*> GetJoinColumnTypes(const TExprNode& joins, +THashMap<TString, const TTypeAnnotationNode*> GetJoinColumnTypes(const TExprNode& joins, const TJoinLabels& labels, TExprContext& ctx) { return GetJoinColumnTypes(joins, labels, joins.Child(0)->Content(), ctx); } -THashMap<TString, const TTypeAnnotationNode*> GetJoinColumnTypes(const TExprNode& joins, +THashMap<TString, const TTypeAnnotationNode*> GetJoinColumnTypes(const TExprNode& joins, const TJoinLabels& labels, const TStringBuf& joinType, TExprContext& ctx) { - THashMap<TString, const TTypeAnnotationNode*> finalType; - THashMap<TString, const TTypeAnnotationNode*> leftType; - THashMap<TString, const TTypeAnnotationNode*> rightType; + THashMap<TString, const TTypeAnnotationNode*> finalType; + THashMap<TString, const TTypeAnnotationNode*> leftType; + THashMap<TString, const TTypeAnnotationNode*> rightType; bool isLeftOptional = IsLeftJoinSideOptional(joinType); bool isRightOptional = IsRightJoinSideOptional(joinType); if (joins.Child(1)->IsAtom()) { @@ -1040,7 +1040,7 @@ std::pair<bool, bool> IsRequiredSide(const TExprNode::TPtr& joinTree, const TJoi } void AppendEquiJoinRenameMap(TPositionHandle pos, const TMap<TStringBuf, TVector<TStringBuf>>& newRenameMap, - TExprNode::TListType& joinSettingNodes, TExprContext& ctx) { + TExprNode::TListType& joinSettingNodes, TExprContext& ctx) { for (auto& x : newRenameMap) { if (x.second.empty()) { joinSettingNodes.push_back(ctx.Builder(pos) @@ -1090,13 +1090,13 @@ void AppendEquiJoinSortSets(TPositionHandle pos, const TSet<TVector<TStringBuf>> } } -TMap<TStringBuf, TVector<TStringBuf>> UpdateUsedFieldsInRenameMap( - const TMap<TStringBuf, TVector<TStringBuf>>& renameMap, - const TSet<TStringBuf>& usedFields, +TMap<TStringBuf, TVector<TStringBuf>> UpdateUsedFieldsInRenameMap( + const TMap<TStringBuf, TVector<TStringBuf>>& renameMap, + const TSet<TStringBuf>& usedFields, const TStructExprType* structType ) { - TMap<TStringBuf, TStringBuf> reversedRenameMap; - TMap<TStringBuf, TVector<TStringBuf>> newRenameMap; + TMap<TStringBuf, TStringBuf> reversedRenameMap; + TMap<TStringBuf, TVector<TStringBuf>> newRenameMap; for (auto& x : renameMap) { if (!x.second.empty()) { for (auto& y : x.second) { diff --git a/ydb/library/yql/core/yql_join.h b/ydb/library/yql/core/yql_join.h index b01b950c2d6..bf328784a8b 100644 --- a/ydb/library/yql/core/yql_join.h +++ b/ydb/library/yql/core/yql_join.h @@ -10,13 +10,13 @@ namespace NYql { -inline TString FullColumnName(const TStringBuf& table, const TStringBuf& column) { - return TString::Join(table, ".", column); +inline TString FullColumnName(const TStringBuf& table, const TStringBuf& column) { + return TString::Join(table, ".", column); } inline void SplitTableName(const TStringBuf& fullName, TStringBuf& table, TStringBuf& column) { auto pos = fullName.find('.'); - Y_ENSURE(pos != TString::npos, "Expected full column name: " << fullName); + Y_ENSURE(pos != TString::npos, "Expected full column name: " << fullName); table = fullName.substr(0, pos); column = fullName.substr(pos + 1); } @@ -24,18 +24,18 @@ inline void SplitTableName(const TStringBuf& fullName, TStringBuf& table, TStrin struct TJoinLabel { TMaybe<TIssue> Parse(TExprContext& ctx, TExprNode& node, const TStructExprType* structType); TMaybe<TIssue> ValidateLabel(TExprContext& ctx, const NNodes::TCoAtom& label); - TString FullName(const TStringBuf& column) const; + TString FullName(const TStringBuf& column) const; TStringBuf ColumnName(const TStringBuf& column) const; TStringBuf TableName(const TStringBuf& column) const; bool HasTable(const TStringBuf& table) const; TMaybe<const TTypeAnnotationNode*> FindColumn(const TStringBuf& table, const TStringBuf& column) const; - TString MemberName(const TStringBuf& table, const TStringBuf& column) const; - TVector<TString> EnumerateAllColumns() const; - TVector<TString> EnumerateAllMembers() const; + TString MemberName(const TStringBuf& table, const TStringBuf& column) const; + TVector<TString> EnumerateAllColumns() const; + TVector<TString> EnumerateAllMembers() const; bool AddLabel = false; const TStructExprType* InputType; - TVector<TStringBuf> Tables; + TVector<TStringBuf> Tables; }; struct TJoinLabels { @@ -44,10 +44,10 @@ struct TJoinLabels { TMaybe<ui32> FindInputIndex(const TStringBuf& table) const; TMaybe<const TTypeAnnotationNode*> FindColumn(const TStringBuf& table, const TStringBuf& column) const; TMaybe<const TTypeAnnotationNode*> FindColumn(const TStringBuf& fullName) const; - TVector<TString> EnumerateColumns(const TStringBuf& table) const; + TVector<TString> EnumerateColumns(const TStringBuf& table) const; - TVector<TJoinLabel> Inputs; - THashMap<TStringBuf, ui32> InputByTable; + TVector<TJoinLabel> Inputs; + THashMap<TStringBuf, ui32> InputByTable; }; struct TJoinOptions { @@ -83,13 +83,13 @@ bool IsRightJoinSideOptional(const TStringBuf& joinType); TExprNode::TPtr FilterOutNullJoinColumns(TPositionHandle pos, const TExprNode::TPtr& input, const TJoinLabel& label, const TSet<TString>& optionalKeyColumns, TExprContext& ctx); -TMap<TStringBuf, TVector<TStringBuf>> LoadJoinRenameMap(const TExprNode& settings); +TMap<TStringBuf, TVector<TStringBuf>> LoadJoinRenameMap(const TExprNode& settings); TSet<TVector<TStringBuf>> LoadJoinSortSets(const TExprNode& settings); -THashMap<TString, const TTypeAnnotationNode*> GetJoinColumnTypes(const TExprNode& joins, +THashMap<TString, const TTypeAnnotationNode*> GetJoinColumnTypes(const TExprNode& joins, const TJoinLabels& labels, TExprContext& ctx); -THashMap<TString, const TTypeAnnotationNode*> GetJoinColumnTypes(const TExprNode& joins, +THashMap<TString, const TTypeAnnotationNode*> GetJoinColumnTypes(const TExprNode& joins, const TJoinLabels& labels, const TStringBuf& joinType, TExprContext& ctx); bool AreSameJoinKeys(const TExprNode& joins, const TStringBuf& table1, const TStringBuf& column1, const TStringBuf& table2, const TStringBuf& column2); @@ -97,14 +97,14 @@ bool AreSameJoinKeys(const TExprNode& joins, const TStringBuf& table1, const TSt std::pair<bool, bool> IsRequiredSide(const TExprNode::TPtr& joinTree, const TJoinLabels& labels, ui32 inputIndex); void AppendEquiJoinRenameMap(TPositionHandle pos, const TMap<TStringBuf, TVector<TStringBuf>>& newRenameMap, - TExprNode::TListType& joinSettingNodes, TExprContext& ctx); + TExprNode::TListType& joinSettingNodes, TExprContext& ctx); void AppendEquiJoinSortSets(TPositionHandle pos, const TSet<TVector<TStringBuf>>& newSortSets, TExprNode::TListType& joinSettingNodes, TExprContext& ctx); -TMap<TStringBuf, TVector<TStringBuf>> UpdateUsedFieldsInRenameMap( - const TMap<TStringBuf, TVector<TStringBuf>>& renameMap, - const TSet<TStringBuf>& usedFields, +TMap<TStringBuf, TVector<TStringBuf>> UpdateUsedFieldsInRenameMap( + const TMap<TStringBuf, TVector<TStringBuf>>& renameMap, + const TSet<TStringBuf>& usedFields, const TStructExprType* structType ); diff --git a/ydb/library/yql/core/yql_library_compiler.cpp b/ydb/library/yql/core/yql_library_compiler.cpp index 79296792e65..b80a5c69427 100644 --- a/ydb/library/yql/core/yql_library_compiler.cpp +++ b/ydb/library/yql/core/yql_library_compiler.cpp @@ -48,14 +48,14 @@ bool ReplaceNodes(TExprNode& node, const TNodeOnNodeOwnedMap& replaces, bool& ha return ReplaceNodes(node, replaces, hasChanges, visited, parents); } -TString Load(const TString& path) +TString Load(const TString& path) { TFile file(path, EOpenModeFlag::RdOnly); if (file.GetLength() <= 0) - return TString(); - std::vector<TString::value_type> buffer(file.GetLength()); + return TString(); + std::vector<TString::value_type> buffer(file.GetLength()); file.Load(buffer.data(), buffer.size()); - return TString(buffer.data(), buffer.size()); + return TString(buffer.data(), buffer.size()); } } @@ -190,10 +190,10 @@ bool LinkLibraries(THashMap<TString, TLibraryCohesion>& libs, TExprContext& ctx, bool CompileLibraries(const TUserDataTable& userData, TExprContext& ctx, TModulesTable& modules, bool optimize) { - THashMap<TString, TLibraryCohesion> libs; + THashMap<TString, TLibraryCohesion> libs; for (const auto& data : userData) { if (data.first.IsFile() && data.second.Usage.Test(EUserDataBlockUsage::Library)) { - TString libraryData; + TString libraryData; const TString& alias = data.first.Alias(); if (data.second.Type == EUserDataType::PATH) { libraryData = Load(data.second.Data); diff --git a/ydb/library/yql/core/yql_opt_proposed_by_data.cpp b/ydb/library/yql/core/yql_opt_proposed_by_data.cpp index 23a912303fb..6bac5b68b88 100644 --- a/ydb/library/yql/core/yql_opt_proposed_by_data.cpp +++ b/ydb/library/yql/core/yql_opt_proposed_by_data.cpp @@ -98,7 +98,7 @@ private: } NThreading::TFuture<void> DoGetAsyncFuture(const TExprNode& input) final { - TVector<NThreading::TFuture<void>> futures; + TVector<NThreading::TFuture<void>> futures; for (auto& x : PendingProviders) { futures.push_back(GetTransformer(x).GetAsyncFuture(input)); } @@ -142,9 +142,9 @@ private: const TTypeAnnotationContext& Types; TGetTransformer GetTransformer; TFinish Finish; - TVector<IDataProvider*> PendingProviders; + TVector<IDataProvider*> PendingProviders; bool HasRepeats = false; - TExprNode::TListType NewRoots; + TExprNode::TListType NewRoots; }; template <ESource Source, typename TGetTransformer, typename TFinish> diff --git a/ydb/library/yql/core/yql_opt_utils.cpp b/ydb/library/yql/core/yql_opt_utils.cpp index 69aa84a500f..746959584cb 100644 --- a/ydb/library/yql/core/yql_opt_utils.cpp +++ b/ydb/library/yql/core/yql_opt_utils.cpp @@ -268,7 +268,7 @@ TExprNode::TPtr FilterByFields(TPositionHandle position, const TExprNode::TPtr& return ctx.NewCallable(position, "AsStruct", std::move(structItems)); } - TExprNode::TListType fields; + TExprNode::TListType fields; for (auto& x : subsetFields) { fields.emplace_back(ctx.NewAtom(position, x)); } @@ -364,7 +364,7 @@ bool HasAnySetting(const TExprNode& settings, const THashSet<TString>& names) { } TExprNode::TPtr RemoveSetting(const TExprNode& settings, const TStringBuf& name, TExprContext& ctx) { - TExprNode::TListType children; + TExprNode::TListType children; for (auto setting : settings.Children()) { if (setting->ChildrenSize() != 0 && setting->Head().Content() == name) { continue; @@ -470,7 +470,7 @@ TExprNode::TPtr MakeSingleGroupRow(const TExprNode& aggregateNode, TExprNode::TP auto pos = aggregateNode.Pos(); auto aggregatedColumns = aggregateNode.Child(2); auto opt = ctx.NewCallable(pos, "ToOptional", { reduced }); - TExprNode::TListType finalRowNodes; + TExprNode::TListType finalRowNodes; for (ui32 index = 0; index < aggregatedColumns->ChildrenSize(); ++index) { auto column = aggregatedColumns->Child(index); auto trait = column->Child(1); diff --git a/ydb/library/yql/core/yql_type_annotation.h b/ydb/library/yql/core/yql_type_annotation.h index 1a1f1fb4766..717b6b7f64c 100644 --- a/ydb/library/yql/core/yql_type_annotation.h +++ b/ydb/library/yql/core/yql_type_annotation.h @@ -112,11 +112,11 @@ private: // -- credentials -- struct TCredential { - const TString Category; - const TString Subcategory; - const TString Content; + const TString Category; + const TString Subcategory; + const TString Content; - TCredential(const TString& category, const TString& subcategory, const TString& content) + TCredential(const TString& category, const TString& subcategory, const TString& content) : Category(category) , Subcategory(subcategory) , Content(content) @@ -124,7 +124,7 @@ struct TCredential { } }; -using TCredentialTable = THashMap<TString, TCredential>; +using TCredentialTable = THashMap<TString, TCredential>; using TCredentialTablePtr = std::shared_ptr<TCredentialTable>; struct TUserCredentials { @@ -134,17 +134,17 @@ struct TUserCredentials { bool SplitUdfName(TStringBuf name, TStringBuf& moduleName, TStringBuf& funcName); -using TUdfModulesTable = THashMap<TString, TString>; // external module name -> alias of file +using TUdfModulesTable = THashMap<TString, TString>; // external module name -> alias of file struct TYqlOperationOptions { TString Runner; TMaybe<TString> AuthenticatedUser; - TMaybe<TString> Id; + TMaybe<TString> Id; TMaybe<TString> SharedId; TMaybe<TString> QueryName; - TMaybe<TString> Title; + TMaybe<TString> Title; TMaybe<TString> Url; - TMaybe<TString> AttrsYson; + TMaybe<TString> AttrsYson; TMaybe<NYT::TNode> ParametersYson; }; @@ -182,15 +182,15 @@ struct TTypeAnnotationContext: public TThrRefBase { TUdfIndex::TPtr UdfIndex; TUdfIndexPackageSet::TPtr UdfIndexPackageSet; IUdfResolver::TPtr UdfResolver; - THashMap<TString, IUdfResolver::TImport> UdfImports; // aliases of files that was imported => list of module names + THashMap<TString, IUdfResolver::TImport> UdfImports; // aliases of files that was imported => list of module names TUdfModulesTable UdfModules; - TString PureResultDataSource; - TVector<TString> AvailablePureResultDataSources; + TString PureResultDataSource; + TVector<TString> AvailablePureResultDataSources; TString FullResultDataSink; TUserDataStorage::TPtr UserDataStorage; TUserDataTable UserDataStorageCrutches; TYqlOperationOptions OperationOptions; - TVector<TCredentialTablePtr> Credentials; + TVector<TCredentialTablePtr> Credentials; TUserCredentials UserCredentials; IModuleResolver::TPtr Modules; NUdf::EValidateMode ValidateMode = NUdf::EValidateMode::None; diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_queue.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_queue.cpp index 49cc897f0e2..f1d794e9116 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_queue.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_queue.cpp @@ -110,7 +110,7 @@ private: } const TComputationNodePtrVector DependentNodes; - const TString Name; + const TString Name; const TMaybe<ui64> Capacity; const ui64 InitSize; }; diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp index 2e299e487da..b9dee7e4635 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_todict.cpp @@ -22,7 +22,7 @@ using NYql::EnsureDynamicCast; namespace { class THashedMultiMapAccumulator { - using TMapType = std::unordered_map< + using TMapType = std::unordered_map< NUdf::TUnboxedValue, TUnboxedValueVector, NYql::TVaryingHash<NUdf::TUnboxedValue, TValueHasher>, @@ -35,7 +35,7 @@ class THashedMultiMapAccumulator { bool IsTuple; std::optional<TValuePacker> Packer; - TMapType Map; + TMapType Map; public: THashedMultiMapAccumulator(TType* keyType, TType* payloadType, const TKeyTypes& keyTypes, bool isTuple, bool encoded, TComputationContext& ctx, ui64 itemsCountHint) @@ -86,7 +86,7 @@ public: }; class THashedMapAccumulator { - using TMapType = TValuesDictHashMap; + using TMapType = TValuesDictHashMap; TComputationContext& Ctx; TType* KeyType; @@ -94,7 +94,7 @@ class THashedMapAccumulator { const bool IsTuple; std::optional<TValuePacker> Packer; - TMapType Map; + TMapType Map; public: THashedMapAccumulator(TType* keyType, TType* payloadType, const TKeyTypes& keyTypes, bool isTuple, bool encoded, TComputationContext& ctx, ui64 itemsCountHint) @@ -119,7 +119,7 @@ public: NUdf::TUnboxedValue Build() { - const auto filler = [this](TMapType& targetMap) { + const auto filler = [this](TMapType& targetMap) { targetMap = std::move(Map); }; @@ -129,7 +129,7 @@ public: template<typename T> class THashedSingleFixedMultiMapAccumulator { - using TMapType = std::unordered_map< + using TMapType = std::unordered_map< T, TUnboxedValueVector, NYql::TVaryingHash<T, TMyHash<T>>, @@ -138,7 +138,7 @@ class THashedSingleFixedMultiMapAccumulator { TComputationContext& Ctx; const TKeyTypes& KeyTypes; - TMapType Map; + TMapType Map; public: THashedSingleFixedMultiMapAccumulator(TType* keyType, TType* payloadType, const TKeyTypes& keyTypes, bool isTuple, bool encoded, TComputationContext& ctx, ui64 itemsCountHint) @@ -186,10 +186,10 @@ public: template<typename T> class THashedSingleFixedMapAccumulator { - using TMapType = TValuesDictHashSingleFixedMap<T>; + using TMapType = TValuesDictHashSingleFixedMap<T>; TComputationContext& Ctx; - TMapType Map; + TMapType Map; public: THashedSingleFixedMapAccumulator(TType* keyType, TType* payloadType, const TKeyTypes& keyTypes, bool isTuple, bool encoded, TComputationContext& ctx, ui64 itemsCountHint) @@ -215,14 +215,14 @@ public: }; class THashedSetAccumulator { - using TSetType = TValuesDictHashSet; + using TSetType = TValuesDictHashSet; TComputationContext& Ctx; TType* KeyType; const TKeyTypes& KeyTypes; bool IsTuple; std::optional<TValuePacker> Packer; - TSetType Set; + TSetType Set; public: THashedSetAccumulator(TType* keyType, const TKeyTypes& keyTypes, bool isTuple, bool encoded, TComputationContext& ctx, ui64 itemsCountHint) @@ -246,7 +246,7 @@ public: NUdf::TUnboxedValue Build() { - const auto filler = [this](TSetType& targetSet) { + const auto filler = [this](TSetType& targetSet) { targetSet = std::move(Set); }; @@ -256,10 +256,10 @@ public: template <typename T> class THashedSingleFixedSetAccumulator { - using TSetType = TValuesDictHashSingleFixedSet<T>; + using TSetType = TValuesDictHashSingleFixedSet<T>; TComputationContext& Ctx; - TSetType Set; + TSetType Set; public: THashedSingleFixedSetAccumulator(TType* keyType, const TKeyTypes& keyTypes, bool isTuple, bool encoded, TComputationContext& ctx, ui64 itemsCountHint) @@ -285,11 +285,11 @@ public: template <typename T> class THashedSingleFixedCompactSetAccumulator { - using TSetType = TValuesDictHashSingleFixedCompactSet<T>; + using TSetType = TValuesDictHashSingleFixedCompactSet<T>; TComputationContext& Ctx; TPagedArena Pool; - TSetType Set; + TSetType Set; public: THashedSingleFixedCompactSetAccumulator(TType* keyType, const TKeyTypes& keyTypes, bool isTuple, bool encoded, TComputationContext& ctx, ui64 itemsCountHint) @@ -314,11 +314,11 @@ public: }; class THashedCompactSetAccumulator { - using TSetType = TValuesDictHashCompactSet; + using TSetType = TValuesDictHashCompactSet; TComputationContext& Ctx; TPagedArena Pool; - TSetType Set; + TSetType Set; TType *KeyType; TValuePacker KeyPacker; @@ -349,11 +349,11 @@ class THashedCompactMapAccumulator; template <> class THashedCompactMapAccumulator<false> { - using TMapType = TValuesDictHashCompactMap; + using TMapType = TValuesDictHashCompactMap; TComputationContext& Ctx; TPagedArena Pool; - TMapType Map; + TMapType Map; TType *KeyType, *PayloadType; TValuePacker KeyPacker, PayloadPacker; @@ -381,11 +381,11 @@ public: template <> class THashedCompactMapAccumulator<true> { - using TMapType = TValuesDictHashCompactMultiMap; + using TMapType = TValuesDictHashCompactMultiMap; TComputationContext& Ctx; TPagedArena Pool; - TMapType Map; + TMapType Map; TType *KeyType, *PayloadType; TValuePacker KeyPacker, PayloadPacker; @@ -416,11 +416,11 @@ class THashedSingleFixedCompactMapAccumulator; template <typename T> class THashedSingleFixedCompactMapAccumulator<T, false> { - using TMapType = TValuesDictHashSingleFixedCompactMap<T>; + using TMapType = TValuesDictHashSingleFixedCompactMap<T>; TComputationContext& Ctx; TPagedArena Pool; - TMapType Map; + TMapType Map; TType *PayloadType; TValuePacker PayloadPacker; @@ -449,11 +449,11 @@ public: template <typename T> class THashedSingleFixedCompactMapAccumulator<T, true> { - using TMapType = TValuesDictHashSingleFixedCompactMultiMap<T>; + using TMapType = TValuesDictHashSingleFixedCompactMultiMap<T>; TComputationContext& Ctx; TPagedArena Pool; - TMapType Map; + TMapType Map; TType *PayloadType; TValuePacker PayloadPacker; diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp index 893cb08456e..49f045852f2 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_udf.cpp @@ -58,7 +58,7 @@ public: TUdfWrapper( TComputationMutables& mutables, IComputationNode* functionImpl, - TString&& functionName, + TString&& functionName, IComputationNode* runConfigNode, const TCallableType* callableType) : TBaseComputation(mutables, EValueRepresentation::Boxed) @@ -110,7 +110,7 @@ private: } IComputationNode* const FunctionImpl; - const TString FunctionName; + const TString FunctionName; IComputationNode* const RunConfigNode; const TCallableType* const CallableType; }; diff --git a/ydb/library/yql/minikql/comp_nodes/ut/mkql_computation_node_ut.cpp b/ydb/library/yql/minikql/comp_nodes/ut/mkql_computation_node_ut.cpp index 19f82aae4ed..6a68fe0ecf2 100644 --- a/ydb/library/yql/minikql/comp_nodes/ut/mkql_computation_node_ut.cpp +++ b/ydb/library/yql/minikql/comp_nodes/ut/mkql_computation_node_ut.cpp @@ -4009,12 +4009,12 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { using TTriple = std::tuple<ui32, ui32, ui32>; TRuntimeNode TupleOrder(TProgramBuilder& pb, bool asc1, bool asc2, bool asc3) { - TVector<TRuntimeNode> ascending(3); + TVector<TRuntimeNode> ascending(3); ascending[0] = pb.NewDataLiteral(asc1); ascending[1] = pb.NewDataLiteral(asc2); ascending[2] = pb.NewDataLiteral(asc3); - TVector<TType*> tupleTypes(3); + TVector<TType*> tupleTypes(3); tupleTypes[0] = pb.NewDataType(NUdf::TDataType<bool>::Id); tupleTypes[1] = pb.NewDataType(NUdf::TDataType<bool>::Id); tupleTypes[2] = pb.NewDataType(NUdf::TDataType<bool>::Id); @@ -4023,14 +4023,14 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { } template<bool LLVM> - TVector<TTriple> SortTuples(TSetup<LLVM>& setup, TRuntimeNode list, TRuntimeNode order) + TVector<TTriple> SortTuples(TSetup<LLVM>& setup, TRuntimeNode list, TRuntimeNode order) { auto& pb = *setup.PgmBuilder; const auto pgmReturn = pb.Sort(list, order, [](TRuntimeNode item) { return item; }); const auto graph = setup.BuildGraph(pgmReturn); const auto iterator = graph->GetValue().GetListIterator(); - TVector<TTriple> result; + TVector<TTriple> result; for (NUdf::TUnboxedValue value; iterator.Next(value);) { ui32 first = value.GetElement(0).template Get<ui32>(); ui32 second = value.GetElement(1).template Get<ui32>(); @@ -4056,16 +4056,16 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { { 2, 1, 0 }, }; - TVector<TRuntimeNode> tuplesList; + TVector<TRuntimeNode> tuplesList; for (ui32 i = 0; i < Y_ARRAY_SIZE(testData); i++) { - TVector<TRuntimeNode> elements(3); + TVector<TRuntimeNode> elements(3); elements[0] = pb.NewDataLiteral(std::get<0>(testData[i])); elements[1] = pb.NewDataLiteral(std::get<1>(testData[i])); elements[2] = pb.NewDataLiteral(std::get<2>(testData[i])); tuplesList.push_back(pb.NewTuple(elements)); } - TVector<TType*> tupleTypes(3); + TVector<TType*> tupleTypes(3); tupleTypes[0] = pb.NewDataType(NUdf::TDataType<ui32>::Id); tupleTypes[1] = pb.NewDataType(NUdf::TDataType<ui32>::Id); tupleTypes[2] = pb.NewDataType(NUdf::TDataType<ui32>::Id); @@ -4084,7 +4084,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { { 2, 1, 0 }, }; TVector<TTriple> expected(expectedData, expectedData + sizeof(expectedData) / sizeof(*expectedData)); - TVector<TTriple> result = SortTuples<LLVM>(setup, listMaker(), order); + TVector<TTriple> result = SortTuples<LLVM>(setup, listMaker(), order); UNIT_ASSERT_EQUAL(result, expected); } @@ -4099,7 +4099,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { { 1, 1, 1 }, }; TVector<TTriple> expected(expectedData, expectedData + sizeof(expectedData) / sizeof(*expectedData)); - TVector<TTriple> result = SortTuples<LLVM>(setup, listMaker(), order); + TVector<TTriple> result = SortTuples<LLVM>(setup, listMaker(), order); UNIT_ASSERT_EQUAL(result, expected); } @@ -4114,7 +4114,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { { 2, 0, 1 }, }; TVector<TTriple> expected(expectedData, expectedData + sizeof(expectedData) / sizeof(*expectedData)); - TVector<TTriple> result = SortTuples<LLVM>(setup, listMaker(), order); + TVector<TTriple> result = SortTuples<LLVM>(setup, listMaker(), order); UNIT_ASSERT_EQUAL(result, expected); } @@ -4129,7 +4129,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { { 1, 3, 0 }, }; TVector<TTriple> expected(expectedData, expectedData + sizeof(expectedData) / sizeof(*expectedData)); - TVector<TTriple> result = SortTuples<LLVM>(setup, listMaker(), order); + TVector<TTriple> result = SortTuples<LLVM>(setup, listMaker(), order); UNIT_ASSERT_EQUAL(result, expected); } } @@ -4467,7 +4467,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { TSetup<LLVM> setup; TProgramBuilder& pb = *setup.PgmBuilder; - TVector<TRuntimeNode> tupleItems; + TVector<TRuntimeNode> tupleItems; const auto data1 = pb.NewDataLiteral<NUdf::EDataSlot::String>("234"); tupleItems.push_back(pb.StrictFromString(data1, pb.NewDataType(NUdf::TDataType<ui32>::Id))); const auto data2 = pb.NewDataLiteral<NUdf::EDataSlot::String>("-1"); @@ -4503,7 +4503,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { TSetup<LLVM> setup; TProgramBuilder& pb = *setup.PgmBuilder; - TVector<TRuntimeNode> tupleItems; + TVector<TRuntimeNode> tupleItems; const auto data1 = pb.NewDataLiteral<NUdf::EDataSlot::String>(TString("\xEA\x00\x00\x00", 4)); tupleItems.push_back(pb.FromBytes(data1, NUdf::TDataType<ui32>::Id)); const auto data2 = pb.NewEmptyOptionalDataLiteral(NUdf::TDataType<const char*>::Id); @@ -4562,7 +4562,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { const auto rnd1 = pb.Random({}); const auto rnd2 = pb.RandomNumber({}); - TVector<TRuntimeNode> args; + TVector<TRuntimeNode> args; args.push_back(rnd1); args.push_back(rnd2); const auto pgmReturn = pb.NewTuple(args); @@ -4580,7 +4580,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLComputationNodeTest) { const ui64 expectedValue = 10000000000000; const auto ts = pb.Now({}); - TVector<TRuntimeNode> args; + TVector<TRuntimeNode> args; args.push_back(ts); const auto pgmReturn = pb.NewTuple(args); diff --git a/ydb/library/yql/minikql/comp_nodes/ut/mkql_dict_ut.cpp b/ydb/library/yql/minikql/comp_nodes/ut/mkql_dict_ut.cpp index ac6d4c356b2..65a8f3913b1 100644 --- a/ydb/library/yql/minikql/comp_nodes/ut/mkql_dict_ut.cpp +++ b/ydb/library/yql/minikql/comp_nodes/ut/mkql_dict_ut.cpp @@ -17,7 +17,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLDictRelatedNodesTest) { const auto payload1 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("A"); const auto payload2 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("B"); const auto payload3 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("C"); - TVector<std::pair<TRuntimeNode, TRuntimeNode>> dictItems; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> dictItems; dictItems.push_back(std::make_pair(key1, payload1)); dictItems.push_back(std::make_pair(key2, payload2)); dictItems.push_back(std::make_pair(key3, payload3)); @@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLDictRelatedNodesTest) { const auto payload1 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("A"); const auto payload2 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("B"); const auto payload3 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("C"); - TVector<std::pair<TRuntimeNode, TRuntimeNode>> dictItems; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> dictItems; dictItems.push_back(std::make_pair(key1, payload1)); dictItems.push_back(std::make_pair(key2, payload2)); dictItems.push_back(std::make_pair(key3, payload3)); @@ -79,7 +79,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLDictRelatedNodesTest) { const auto payload1 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("A"); const auto payload2 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("B"); const auto payload3 = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("C"); - TVector<std::pair<TRuntimeNode, TRuntimeNode>> dictItems; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> dictItems; dictItems.push_back(std::make_pair(key1, payload1)); dictItems.push_back(std::make_pair(key2, payload2)); dictItems.push_back(std::make_pair(key3, payload3)); diff --git a/ydb/library/yql/minikql/compact_hash.cpp b/ydb/library/yql/minikql/compact_hash.cpp index 17810ccacbf..ddfb5ca72da 100644 --- a/ydb/library/yql/minikql/compact_hash.cpp +++ b/ydb/library/yql/minikql/compact_hash.cpp @@ -15,7 +15,7 @@ void TListPoolBase::FreeListPage(TListHeader* p) { } size_t TListPoolBase::TUsedPages::PrintStat(const TStringBuf& header, IOutputStream& out) const { - TMap<ui32, ui64> counts; + TMap<ui32, ui64> counts; size_t pages = 0; for (auto& p: FullPages) { ++pages; diff --git a/ydb/library/yql/minikql/compact_hash.h b/ydb/library/yql/minikql/compact_hash.h index a9586db4640..2f0300d205f 100644 --- a/ydb/library/yql/minikql/compact_hash.h +++ b/ydb/library/yql/minikql/compact_hash.h @@ -239,7 +239,7 @@ public: } protected: - using TListType = TIntrusiveList<TPageListItem>; + using TListType = TIntrusiveList<TPageListItem>; struct TUsedPages { TUsedPages() = default; TUsedPages(const TUsedPages&) = delete; @@ -266,9 +266,9 @@ protected: size_t PrintStat(const TStringBuf& header, IOutputStream& out) const; TString DebugInfo() const; - std::array<TListType, MAX_SMALL_LIST_SIZE - 1> SmallPages; // 2-16 sizes - std::array<TListType, MAX_MEDIUM_LIST_INDEX> MediumPages; // 32,64,128,...,16384. Indexed by pow2 - TListType FullPages; + std::array<TListType, MAX_SMALL_LIST_SIZE - 1> SmallPages; // 2-16 sizes + std::array<TListType, MAX_MEDIUM_LIST_INDEX> MediumPages; // 32,64,128,...,16384. Indexed by pow2 + TListType FullPages; }; public: @@ -557,7 +557,7 @@ private: template <size_t PoolNdx, typename T> TListHeader* GetSmallListPage(size_t size) { Y_ASSERT(size > 1 && size <= MAX_SMALL_LIST_SIZE); - TListType& pages = Pools[PoolNdx].SmallPages[size - 2]; + TListType& pages = Pools[PoolNdx].SmallPages[size - 2]; if (!pages.Empty()) { return pages.Front()->As<TListHeader>(); } @@ -573,7 +573,7 @@ private: Y_ASSERT(size > MAX_SMALL_LIST_SIZE && size <= TListPoolBase::GetMaxListSize<T>()); size_t index = MostSignificantBit((size - 1) >> MostSignificantBitCT(MAX_SMALL_LIST_SIZE)); Y_ASSERT(index < Pools[PoolNdx].MediumPages.size()); - TListType& pages = Pools[PoolNdx].MediumPages[index]; + TListType& pages = Pools[PoolNdx].MediumPages[index]; if (!pages.Empty()) { return pages.Front()->As<TListHeader>(); } diff --git a/ydb/library/yql/minikql/compact_hash_ut.cpp b/ydb/library/yql/minikql/compact_hash_ut.cpp index 02278f64cb7..3e994080baf 100644 --- a/ydb/library/yql/minikql/compact_hash_ut.cpp +++ b/ydb/library/yql/minikql/compact_hash_ut.cpp @@ -21,7 +21,7 @@ Y_UNIT_TEST_SUITE(TCompactHashTest) { TPool pool(pagePool); UNIT_ASSERT(countOfLists > 1); - THashSet<TItem*> lists; + THashSet<TItem*> lists; void* pageAddr = nullptr; for (size_t i = 0; i < countOfLists / 2; ++i) { @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(TCompactHashTest) { pool.ReturnList(l); } - THashSet<TItem*> lists2; + THashSet<TItem*> lists2; for (size_t i = 0; i < countOfLists; ++i) { TItem* l = pool.template GetList<TItem>(listSize); // All lists are from the same page @@ -159,7 +159,7 @@ Y_UNIT_TEST_SUITE(TCompactHashTest) { TAlignedPagePool pagePool; TCompactHash<TItem, TItem, TItemHash> hash(pagePool); - TVector<TItem> elements(elementsCount); + TVector<TItem> elements(elementsCount); std::iota(elements.begin(), elements.end(), 0); Shuffle(elements.begin(), elements.end()); for (TItem i: elements) { @@ -204,7 +204,7 @@ Y_UNIT_TEST_SUITE(TCompactHashTest) { TAlignedPagePool pagePool; TCompactMultiHash<TItem, TItem, TItemHash> hash(pagePool); - TVector<TItem> keys(keysCount); + TVector<TItem> keys(keysCount); std::iota(keys.begin(), keys.end(), 0); Shuffle(keys.begin(), keys.end()); @@ -305,7 +305,7 @@ Y_UNIT_TEST_SUITE(TCompactHashTest) { TAlignedPagePool pagePool; TCompactHashSet<TItem, TItemHash> hash(pagePool); - TVector<TItem> elements(elementsCount); + TVector<TItem> elements(elementsCount); std::iota(elements.begin(), elements.end(), 0); Shuffle(elements.begin(), elements.end()); for (TItem i: elements) { diff --git a/ydb/library/yql/minikql/computation/mkql_computation_list_adapter.h b/ydb/library/yql/minikql/computation/mkql_computation_list_adapter.h index 2b3b7fb8865..9c4dc2587c5 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_list_adapter.h +++ b/ydb/library/yql/minikql/computation/mkql_computation_list_adapter.h @@ -6,17 +6,17 @@ namespace NKikimr { namespace NMiniKQL { -template <typename TVectorType> -class TVectorListAdapter : public TComputationValue<TVectorListAdapter<TVectorType>> { +template <typename TVectorType> +class TVectorListAdapter : public TComputationValue<TVectorListAdapter<TVectorType>> { public: - typedef typename TVectorType::value_type TItem; - typedef TVectorListAdapter<TVectorType> TSelf; + typedef typename TVectorType::value_type TItem; + typedef TVectorListAdapter<TVectorType> TSelf; typedef std::function<NUdf::TUnboxedValue(const TItem&)> TItemFactory; - typedef TComputationValue<TVectorListAdapter<TVectorType>> TBase; + typedef TComputationValue<TVectorListAdapter<TVectorType>> TBase; class TIterator: public TComputationValue<TIterator> { public: - TIterator(TMemoryUsageInfo* memInfo, const TVectorType& list, TItemFactory itemFactory, ui64 start, ui64 finish, bool reversed) + TIterator(TMemoryUsageInfo* memInfo, const TVectorType& list, TItemFactory itemFactory, ui64 start, ui64 finish, bool reversed) : TComputationValue<TIterator>(memInfo) , List(list) , ItemFactory(itemFactory) @@ -49,7 +49,7 @@ public: return true; } - const TVectorType& List; + const TVectorType& List; const TItemFactory ItemFactory; const ui64 Start; const ui64 Finish; @@ -99,7 +99,7 @@ public: TVectorListAdapter( TMemoryUsageInfo* memInfo, - const TVectorType& list, + const TVectorType& list, TItemFactory itemFactory, ui64 start, ui64 finish, bool reversed) @@ -200,47 +200,47 @@ private: } private: - const TVectorType& List; + const TVectorType& List; const TItemFactory ItemFactory; const ui64 Start; const ui64 Finish; const bool Reversed; }; -template <typename TVectorType> -class TOwningVectorListAdapter : private TVectorType, public TVectorListAdapter<TVectorType> { +template <typename TVectorType> +class TOwningVectorListAdapter : private TVectorType, public TVectorListAdapter<TVectorType> { public: - using TAdapterBase = TVectorListAdapter<TVectorType>; + using TAdapterBase = TVectorListAdapter<TVectorType>; TOwningVectorListAdapter( TMemoryUsageInfo* memInfo, - TVectorType&& list, + TVectorType&& list, typename TAdapterBase::TItemFactory itemFactory, ui64 start, ui64 finish, bool reversed) - : TVectorType(std::move(list)) + : TVectorType(std::move(list)) , TAdapterBase(memInfo, *this, itemFactory, start, finish, reversed) {} TOwningVectorListAdapter( TMemoryUsageInfo* memInfo, - const TVectorType& list, + const TVectorType& list, typename TAdapterBase::TItemFactory itemFactory, ui64 start, ui64 finish, bool reversed) - : TVectorType(list) + : TVectorType(list) , TAdapterBase(memInfo, *this, itemFactory, start, finish, reversed) {} }; -template<typename TVectorType> +template<typename TVectorType> NUdf::TUnboxedValue CreateOwningVectorListAdapter( - TVectorType&& list, + TVectorType&& list, typename TVectorListAdapter<std::remove_reference_t<TVectorType>>::TItemFactory itemFactory, ui64 start, ui64 finish, bool reversed, TMemoryUsageInfo& memInfo) { return NUdf::TUnboxedValuePod(new TOwningVectorListAdapter<std::remove_reference_t<TVectorType>>( - &memInfo, std::forward<TVectorType>(list), itemFactory, start, finish, reversed)); + &memInfo, std::forward<TVectorType>(list), itemFactory, start, finish, reversed)); } } diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node.h b/ydb/library/yql/minikql/computation/mkql_computation_node.h index a5d11b180b0..47f336c08c1 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_node.h +++ b/ydb/library/yql/minikql/computation/mkql_computation_node.h @@ -134,7 +134,7 @@ public: virtual void PrepareStageOne() = 0; virtual void PrepareStageTwo() = 0; - virtual TString DebugString() const = 0; + virtual TString DebugString() const = 0; virtual void Ref() = 0; virtual void UnRef() = 0; diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_graph_saveload.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_graph_saveload.cpp index c481a5815e9..8c40d29cddf 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_node_graph_saveload.cpp +++ b/ydb/library/yql/minikql/computation/mkql_computation_node_graph_saveload.cpp @@ -9,8 +9,8 @@ namespace NMiniKQL { namespace { -void TraverseGraph(const NUdf::TUnboxedValue* roots, ui32 rootCount, TVector<NUdf::TUnboxedValue>& values) { - THashSet<NUdf::IBoxedValue*> dedup; +void TraverseGraph(const NUdf::TUnboxedValue* roots, ui32 rootCount, TVector<NUdf::TUnboxedValue>& values) { + THashSet<NUdf::IBoxedValue*> dedup; for (ui32 i = 0; i < rootCount; ++i) { const auto& value = roots[i]; @@ -51,7 +51,7 @@ void SaveGraphState(const NUdf::TUnboxedValue* roots, ui32 rootCount, ui64 hash, out.clear(); out.AppendNoAlias((const char*)&hash, sizeof(hash)); - TVector<NUdf::TUnboxedValue> values; + TVector<NUdf::TUnboxedValue> values; TraverseGraph(roots, rootCount, values); for (ui32 i = 0; i < values.size(); ++i) { @@ -74,7 +74,7 @@ void LoadGraphState(const NUdf::TUnboxedValue* roots, ui32 rootCount, ui64 hash, MKQL_ENSURE(hash == storedHash, "Unable to load graph state, different hashes"); - TVector<NUdf::TUnboxedValue> values; + TVector<NUdf::TUnboxedValue> values; TraverseGraph(roots, rootCount, values); for (ui32 i = 0; i < values.size(); ++i) { diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp index 67a7cfb3028..eadf9edf19f 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp +++ b/ydb/library/yql/minikql/computation/mkql_computation_node_holders.cpp @@ -1299,7 +1299,7 @@ private: template <typename T> class THashedSingleFixedSetHolder : public TComputationValue<THashedSingleFixedSetHolder<T>> { public: - using TSetType = TValuesDictHashSingleFixedSet<T>; + using TSetType = TValuesDictHashSingleFixedSet<T>; class TIterator : public TComputationValue<TIterator> { public: @@ -1341,12 +1341,12 @@ public: } const NUdf::TRefCountedPtr<THashedSingleFixedSetHolder> Parent; - typename TSetType::const_iterator Iterator; - typename TSetType::const_iterator End; + typename TSetType::const_iterator Iterator; + typename TSetType::const_iterator End; bool AtStart; }; - THashedSingleFixedSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set) + THashedSingleFixedSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set) : TComputationValue<THashedSingleFixedSetHolder>(memInfo) , Set(std::move(set)) { @@ -1399,7 +1399,7 @@ private: template <typename T> class THashedSingleFixedCompactSetHolder : public TComputationValue<THashedSingleFixedCompactSetHolder<T>> { public: - using TSetType = TValuesDictHashSingleFixedCompactSet<T>; + using TSetType = TValuesDictHashSingleFixedCompactSet<T>; class TIterator : public TComputationValue<TIterator> { public: @@ -1440,11 +1440,11 @@ public: } const NUdf::TRefCountedPtr<THashedSingleFixedCompactSetHolder> Parent; - typename TSetType::TIterator Iterator; + typename TSetType::TIterator Iterator; bool AtStart; }; - THashedSingleFixedCompactSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set) + THashedSingleFixedCompactSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set) : TComputationValue<THashedSingleFixedCompactSetHolder>(memInfo) , Set(std::move(set)) { @@ -1494,7 +1494,7 @@ private: class THashedCompactSetHolder : public TComputationValue<THashedCompactSetHolder> { public: - using TSetType = TValuesDictHashCompactSet; + using TSetType = TValuesDictHashCompactSet; class TIterator : public TComputationValue<TIterator> { public: @@ -1535,11 +1535,11 @@ public: } const NUdf::TRefCountedPtr<THashedCompactSetHolder> Parent; - typename TSetType::TIterator Iterator; + typename TSetType::TIterator Iterator; bool AtStart; }; - THashedCompactSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set, TPagedArena&& pool, TType* keyType, TComputationContext* ctx) + THashedCompactSetHolder(TMemoryUsageInfo* memInfo, TSetType&& set, TPagedArena&& pool, TType* keyType, TComputationContext* ctx) : TComputationValue(memInfo) , Pool(std::move(pool)) , Set(std::move(set)) @@ -1600,7 +1600,7 @@ private: class THashedCompactMapHolder : public TComputationValue<THashedCompactMapHolder> { public: - using TMapType = TValuesDictHashCompactMap; + using TMapType = TValuesDictHashCompactMap; template <bool NoSwap> class TIterator : public TComputationValue<TIterator<NoSwap>> { @@ -1646,11 +1646,11 @@ public: } const NUdf::TRefCountedPtr<THashedCompactMapHolder> Parent; - typename TMapType::TIterator Iterator; + typename TMapType::TIterator Iterator; bool AtStart; }; - THashedCompactMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, + THashedCompactMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, TType* keyType, TType* payloadType, TComputationContext* ctx) : TComputationValue(memInfo) , Pool(std::move(pool)) @@ -1710,8 +1710,8 @@ private: class THashedCompactMultiMapHolder : public TComputationValue<THashedCompactMultiMapHolder> { public: - using TMapType = TValuesDictHashCompactMultiMap; - using TMapIterator = typename TMapType::TIterator; + using TMapType = TValuesDictHashCompactMultiMap; + using TMapIterator = typename TMapType::TIterator; class TPayloadList: public TCustomListValue { public: @@ -1833,7 +1833,7 @@ public: TMapIterator Iterator; }; - THashedCompactMultiMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, + THashedCompactMultiMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, TType* keyType, TType* payloadType, TComputationContext* ctx) : TComputationValue(memInfo) , Pool(std::move(pool)) @@ -2046,7 +2046,7 @@ private: template <typename T> class THashedSingleFixedMapHolder : public TComputationValue<THashedSingleFixedMapHolder<T>> { public: - using TMapType = TValuesDictHashSingleFixedMap<T>; + using TMapType = TValuesDictHashSingleFixedMap<T>; template <bool NoSwap> class TIterator : public TComputationValue<TIterator<NoSwap>> { @@ -2090,8 +2090,8 @@ public: } const NUdf::TRefCountedPtr<THashedSingleFixedMapHolder> Parent; - typename TMapType::const_iterator Iterator; - typename TMapType::const_iterator End; + typename TMapType::const_iterator Iterator; + typename TMapType::const_iterator End; bool AtStart; }; @@ -2143,7 +2143,7 @@ private: template <typename T> class THashedSingleFixedCompactMapHolder : public TComputationValue<THashedSingleFixedCompactMapHolder<T>> { public: - using TMapType = TValuesDictHashSingleFixedCompactMap<T>; + using TMapType = TValuesDictHashSingleFixedCompactMap<T>; template <bool NoSwap> class TIterator : public TComputationValue<TIterator<NoSwap>> { @@ -2187,11 +2187,11 @@ public: } const NUdf::TRefCountedPtr<THashedSingleFixedCompactMapHolder> Parent; - typename TMapType::TIterator Iterator; + typename TMapType::TIterator Iterator; bool AtStart; }; - THashedSingleFixedCompactMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, + THashedSingleFixedCompactMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, TType* payloadType, TComputationContext* ctx) : TComputationValue<THashedSingleFixedCompactMapHolder>(memInfo) , Pool(std::move(pool)) @@ -2247,8 +2247,8 @@ private: template <typename T> class THashedSingleFixedCompactMultiMapHolder : public TComputationValue<THashedSingleFixedCompactMultiMapHolder<T>> { public: - using TMapType = TValuesDictHashSingleFixedCompactMultiMap<T>; - using TMapIterator = typename TMapType::TIterator; + using TMapType = TValuesDictHashSingleFixedCompactMultiMap<T>; + using TMapIterator = typename TMapType::TIterator; class TPayloadList: public TCustomListValue { public: @@ -2369,7 +2369,7 @@ public: TMapIterator Iterator; }; - THashedSingleFixedCompactMultiMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, + THashedSingleFixedCompactMultiMapHolder(TMemoryUsageInfo* memInfo, TMapType&& map, TPagedArena&& pool, TType* payloadType, TComputationContext* ctx) : TComputationValue<THashedSingleFixedCompactMultiMapHolder>(memInfo) , Pool(std::move(pool)) diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_impl.h b/ydb/library/yql/minikql/computation/mkql_computation_node_impl.h index 0a63ca9d349..7eb84a8e059 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_node_impl.h +++ b/ydb/library/yql/minikql/computation/mkql_computation_node_impl.h @@ -1020,7 +1020,7 @@ private: } public: - TString DebugString() const { + TString DebugString() const { return TypeName<TDerived>(); } diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp index 625a269eaf6..849a25f6501 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp +++ b/ydb/library/yql/minikql/computation/mkql_computation_node_pack.cpp @@ -116,7 +116,7 @@ T GetRawData(TStringBuf& buf) { namespace { #ifndef MKQL_DISABLE_CODEGEN - TString MakeName(const TStringBuf& common, const TType* type) { + TString MakeName(const TStringBuf& common, const TType* type) { TStringStream out; out << common << intptr_t(type); return out.Str(); @@ -239,7 +239,7 @@ namespace { const auto choise = SwitchInst::Create(index, exit, size, block); for (ui32 i = 0; i < size; ++i) { - const auto var = BasicBlock::Create(context, (TString("case_") += ToString(i)).c_str(), pack); + const auto var = BasicBlock::Create(context, (TString("case_") += ToString(i)).c_str(), pack); choise->addCase(ConstantInt::get(Type::getInt32Ty(context), i), var); const auto done = CreatePackBlock(typeGetter(i), useTopLength, module, context, pack, var, variant, buffer, mask); BranchInst::Create(exit, done); diff --git a/ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp b/ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp index 6a47b518294..ac39df3e3d1 100644 --- a/ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp +++ b/ydb/library/yql/minikql/computation/mkql_computation_node_pack_ut.cpp @@ -290,7 +290,7 @@ protected: TestVariantTypeImpl(PgmBuilder.NewVariantType(tupleType)); } - void ValidateEmbeddedLength(const TStringBuf& buf, const TString& info) { + void ValidateEmbeddedLength(const TStringBuf& buf, const TString& info) { if (buf.size() > 8) { UNIT_ASSERT_VALUES_EQUAL_C(*(const ui32*)buf.data() + 4, buf.size(), info); } else { @@ -326,8 +326,8 @@ protected: } template <typename T> - void TestNumericValue(T value, TValuePacker& packer, const TString& typeDesc) { - TString additionalMsg = TStringBuilder() << typeDesc << ", Value:" << value; + void TestNumericValue(T value, TValuePacker& packer, const TString& typeDesc) { + TString additionalMsg = TStringBuilder() << typeDesc << ", Value:" << value; auto uValue = TestPackUnpack(packer, NUdf::TUnboxedValuePod(value), additionalMsg); UNIT_ASSERT_VALUES_EQUAL_C(uValue.template Get<T>(), value, additionalMsg); } @@ -347,7 +347,7 @@ protected: void TestOptionalNumericValue(std::optional<T> value, TValuePacker& packer, const TString& typeDesc, const std::optional<ui32>& expectedLength = {}) { - TString additionalMsg = TStringBuilder() << typeDesc << "), Value:" << (value ? ToString(*value) : TString("null")); + TString additionalMsg = TStringBuilder() << typeDesc << "), Value:" << (value ? ToString(*value) : TString("null")); const auto v = value ? NUdf::TUnboxedValuePod(*value) : NUdf::TUnboxedValuePod(); const auto uValue = TestPackUnpack(packer, v, additionalMsg, expectedLength); if (value) { @@ -369,7 +369,7 @@ protected: } void TestStringValue(const std::string_view& value, TValuePacker& packer, const TString& typeDesc, ui32 expectedLength) { - TString additionalMsg = TStringBuilder() << typeDesc << ", Value:" << value; + TString additionalMsg = TStringBuilder() << typeDesc << ", Value:" << value; const auto v = NUdf::TUnboxedValue(MakeString(value)); const auto uValue = TestPackUnpack(packer, v, additionalMsg, expectedLength); UNIT_ASSERT_VALUES_EQUAL_C(std::string_view(uValue.AsStringRef()), value, additionalMsg); @@ -393,7 +393,7 @@ protected: } void TestOptionalStringValue(std::optional<std::string_view> value, TValuePacker& packer, const TString& typeDesc, ui32 expectedLength) { - TString additionalMsg = TStringBuilder() << typeDesc << "), Value:" << (value ? *value : TString("null")); + TString additionalMsg = TStringBuilder() << typeDesc << "), Value:" << (value ? *value : TString("null")); const auto v = value ? NUdf::TUnboxedValue(MakeString(*value)) : NUdf::TUnboxedValue(); const auto uValue = TestPackUnpack(packer, v, additionalMsg, expectedLength); if (value) { @@ -415,7 +415,7 @@ protected: } void TestVariantTypeImpl(TType* variantType) { - TString descr = TStringBuilder() << "Type:Variant(" + TString descr = TStringBuilder() << "Type:Variant(" << static_cast<TVariantType*>(variantType)->GetUnderlyingType()->GetKindAsStr() << ')'; { const NUdf::TUnboxedValue value = HolderFactory.CreateVariantHolder(MakeString("01234567890123456789"), 0); diff --git a/ydb/library/yql/minikql/computation/mkql_validate.cpp b/ydb/library/yql/minikql/computation/mkql_validate.cpp index b238b28aee1..346b207ff09 100644 --- a/ydb/library/yql/minikql/computation/mkql_validate.cpp +++ b/ydb/library/yql/minikql/computation/mkql_validate.cpp @@ -10,7 +10,7 @@ namespace NMiniKQL { namespace { -static const TString VERIFY_DELIMITER = "\n - "; +static const TString VERIFY_DELIMITER = "\n - "; using namespace NUdf; diff --git a/ydb/library/yql/minikql/computation/mkql_validate_impl.h b/ydb/library/yql/minikql/computation/mkql_validate_impl.h index c4e10ac4b10..9d64584c2a7 100644 --- a/ydb/library/yql/minikql/computation/mkql_validate_impl.h +++ b/ydb/library/yql/minikql/computation/mkql_validate_impl.h @@ -11,7 +11,7 @@ struct TUdfValidateException: public yexception { }; struct TValidateErrorPolicyThrow { - static void Generate(const TString& message) { + static void Generate(const TString& message) { GenerateExc(TUdfValidateException() << message); } @@ -23,7 +23,7 @@ struct TValidateErrorPolicyThrow { }; struct TValidateErrorPolicyFail { - static void Generate(const TString& message) { + static void Generate(const TString& message) { Y_FAIL("value verify failed: %s", message.c_str()); } diff --git a/ydb/library/yql/minikql/computation/mkql_validate_ut.cpp b/ydb/library/yql/minikql/computation/mkql_validate_ut.cpp index ed2f12303a1..ade9ed4b339 100644 --- a/ydb/library/yql/minikql/computation/mkql_validate_ut.cpp +++ b/ydb/library/yql/minikql/computation/mkql_validate_ut.cpp @@ -103,8 +103,8 @@ namespace NUdf { static ui32 MetaIndexes[MEMBERS_COUNT]; static ui32 MetaBackIndexes[MEMBERS_COUNT]; - TString FirstName; - TString LastName; + TString FirstName; + TString LastName; ui32 Age; NUdf::TUnboxedValue GetByIndex(ui32 index) const { @@ -126,8 +126,8 @@ namespace NUdf { static ui32 MetaIndexes[MEMBERS_COUNT]; static ui32 MetaBackIndexes[MEMBERS_COUNT]; - TString FirstName; - TString LastName; + TString FirstName; + TString LastName; ui32 Age; typedef std::vector<ui32> TTagList; TTagList Tags; @@ -385,7 +385,7 @@ namespace { } }; - SIMPLE_UDF(TException, NUdf::TListType<ui32>()) { + SIMPLE_UDF(TException, NUdf::TListType<ui32>()) { Y_UNUSED(valueBuilder); Y_UNUSED(args); return NUdf::TUnboxedValuePod(new TThrowerValue); @@ -438,7 +438,7 @@ namespace { return NUdf::TUnboxedValuePod(backResult); } - SIMPLE_UDF(TSeqList, NUdf::TListType<ui32>(ui32)) { + SIMPLE_UDF(TSeqList, NUdf::TListType<ui32>(ui32)) { const ui32 size = args[0].Get<ui32>(); std::vector<NUdf::TUnboxedValue> res; res.resize(size); @@ -448,7 +448,7 @@ namespace { return valueBuilder->NewList(res.data(), res.size()); } - SIMPLE_UDF_RUN(TSeqListWithHole, NUdf::TListType<ui32>(ui32, ui32), NUdf::TOptional<void>) { + SIMPLE_UDF_RUN(TSeqListWithHole, NUdf::TListType<ui32>(ui32, ui32), NUdf::TOptional<void>) { Y_UNUSED(valueBuilder); const ui32 size = args[0].Get<ui32>(); const ui32 hole = args[1].Get<ui32>(); @@ -456,7 +456,7 @@ namespace { return NUdf::TUnboxedValuePod(std::move(boxed)); } - static const auto TUPLE = std::make_tuple(ui8(33), TString("world"), ui64(0xFEEDB00B2A115E), TString("funny bunny")); + static const auto TUPLE = std::make_tuple(ui8(33), TString("world"), ui64(0xFEEDB00B2A115E), TString("funny bunny")); typedef NUdf::TTuple<ui8, char*, ui64, char*> NUdfTuple; @@ -550,14 +550,14 @@ namespace { return valueBuilder->ToIndexDict(NUdf::TUnboxedValuePod(std::move(boxed))); } - SIMPLE_UDF(TListOfPersonStruct, NUdf::TListType<NUdf::PersonStructWithOptList>(ui32)) { + SIMPLE_UDF(TListOfPersonStruct, NUdf::TListType<NUdf::PersonStructWithOptList>(ui32)) { Y_UNUSED(valueBuilder); Y_UNUSED(args); NUdf::IBoxedValuePtr boxed(new NUdf::TListRef<decltype(LIST_OF_STRUCT_PERSON)>(LIST_OF_STRUCT_PERSON)); return NUdf::TUnboxedValuePod(std::move(boxed)); } - SIMPLE_UDF(TListOfPersonStructWithBrokenIndexToDict, NUdf::TListType<NUdf::PersonStructWithOptList>()) { + SIMPLE_UDF(TListOfPersonStructWithBrokenIndexToDict, NUdf::TListType<NUdf::PersonStructWithOptList>()) { Y_UNUSED(valueBuilder); Y_UNUSED(args); NUdf::IBoxedValuePtr boxed(new NUdf::TListRef<decltype(LIST_OF_STRUCT_PERSON), RAW_BROKEN_INDEX_LIST_TO_DICT>( @@ -1042,9 +1042,9 @@ Y_UNIT_TEST_SUITE(TMiniKQLValidateTest) { const auto person = value.Lookup(NUdf::TUnboxedValuePod(ui64(lookupIndex))); UNIT_ASSERT(person); auto firstName = person.GetElement(NUdf::PersonStructWithOptList::MetaIndexes[0]); - UNIT_ASSERT_VALUES_EQUAL(TString(firstName.AsStringRef()), LIST_OF_STRUCT_PERSON[lookupIndex].FirstName); + UNIT_ASSERT_VALUES_EQUAL(TString(firstName.AsStringRef()), LIST_OF_STRUCT_PERSON[lookupIndex].FirstName); auto lastName = person.GetElement(NUdf::PersonStructWithOptList::MetaIndexes[1]); - UNIT_ASSERT_VALUES_EQUAL(TString(lastName.AsStringRef()), LIST_OF_STRUCT_PERSON[lookupIndex].LastName); + UNIT_ASSERT_VALUES_EQUAL(TString(lastName.AsStringRef()), LIST_OF_STRUCT_PERSON[lookupIndex].LastName); UNIT_ASSERT_VALUES_EQUAL(person.GetElement(NUdf::PersonStructWithOptList::MetaIndexes[2]).Get<ui32>(), LIST_OF_STRUCT_PERSON[lookupIndex].Age); UNIT_ASSERT(!person.GetElement(NUdf::PersonStructWithOptList::MetaIndexes[3])); auto dictIter = value.GetDictIterator(); @@ -1121,9 +1121,9 @@ Y_UNIT_TEST_SUITE(TMiniKQLValidateTest) { UNIT_ASSERT_VALUES_EQUAL(key.Get<ui32>(), MAKE_DICT_DIGIT2PERSON()[index].first); auto person = payload; auto firstName = person.GetElement(NUdf::PersonStruct::MetaIndexes[0]); - UNIT_ASSERT_VALUES_EQUAL(TString(firstName.AsStringRef()), DICT_DIGIT2PERSON_BROKEN_CONTENT_BY_INDEX[index]->FirstName); + UNIT_ASSERT_VALUES_EQUAL(TString(firstName.AsStringRef()), DICT_DIGIT2PERSON_BROKEN_CONTENT_BY_INDEX[index]->FirstName); auto lastName = person.GetElement(NUdf::PersonStruct::MetaIndexes[1]); - UNIT_ASSERT_VALUES_EQUAL(TString(lastName.AsStringRef()), DICT_DIGIT2PERSON_BROKEN_CONTENT_BY_INDEX[index]->LastName); + UNIT_ASSERT_VALUES_EQUAL(TString(lastName.AsStringRef()), DICT_DIGIT2PERSON_BROKEN_CONTENT_BY_INDEX[index]->LastName); UNIT_ASSERT_VALUES_EQUAL(person.GetElement(NUdf::PersonStruct::MetaIndexes[2]).Get<ui32>(), DICT_DIGIT2PERSON_BROKEN_CONTENT_BY_INDEX[index]->Age); } }; diff --git a/ydb/library/yql/minikql/computation/mkql_value_builder.cpp b/ydb/library/yql/minikql/computation/mkql_value_builder.cpp index ad476617158..1594b81bfa0 100644 --- a/ydb/library/yql/minikql/computation/mkql_value_builder.cpp +++ b/ydb/library/yql/minikql/computation/mkql_value_builder.cpp @@ -32,7 +32,7 @@ void TDefaultValueBuilder::SetCalleePositionHolder(const NUdf::TSourcePosition*& void TDefaultValueBuilder::Terminate(const char* message) const { TStringBuf reason = (message ? TStringBuf(message) : TStringBuf("(unknown)")); - TString fullMessage = TStringBuilder() << + TString fullMessage = TStringBuilder() << "Terminate was called, reason(" << reason.size() << "): " << reason << Endl; HolderFactory_.CleanupModulesOnTerminate(); if (Policy_ == NUdf::EValidatePolicy::Exception) { diff --git a/ydb/library/yql/minikql/defs.h b/ydb/library/yql/minikql/defs.h index 3e332363c6c..4c3b83f92c6 100644 --- a/ydb/library/yql/minikql/defs.h +++ b/ydb/library/yql/minikql/defs.h @@ -3,7 +3,7 @@ // unique tag to fix pragma once gcc glueing: ./ydb/library/yql/minikql/defs.h #include <util/system/compiler.h> -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/yexception.h> #define THROW ::NKikimr::TThrowable() , __LOCATION__ + diff --git a/ydb/library/yql/minikql/mkql_function_registry.cpp b/ydb/library/yql/minikql/mkql_function_registry.cpp index d3545ad138d..bd69224397e 100644 --- a/ydb/library/yql/minikql/mkql_function_registry.cpp +++ b/ydb/library/yql/minikql/mkql_function_registry.cpp @@ -30,11 +30,11 @@ const char* SetBackTraceCallbackName = "SetBackTraceCallback"; class TMutableFunctionRegistry: public IMutableFunctionRegistry { struct TUdfModule { - TString LibraryPath; + TString LibraryPath; std::shared_ptr<NUdf::IUdfModule> Impl; }; - using TUdfModulesMap = THashMap<TString, TUdfModule>; + using TUdfModulesMap = THashMap<TString, TUdfModule>; struct TUdfLibrary: public TThrRefBase { ui32 AbiVersion = 0; @@ -49,7 +49,7 @@ class TMutableFunctionRegistry: public IMutableFunctionRegistry public: TUdfModuleLoader( TUdfModulesMap& modulesMap, - const TString& libraryPath, + const TString& libraryPath, const TUdfModuleRemappings& remappings, ui32 abiVersion) : ModulesMap(modulesMap) @@ -71,8 +71,8 @@ class TMutableFunctionRegistry: public IMutableFunctionRegistry m.Impl.reset(module.Release()); auto it = Remappings.find(name); - const TString& newName = (it == Remappings.end()) - ? TString(name) + const TString& newName = (it == Remappings.end()) + ? TString(name) : it->second; auto i = ModulesMap.insert({ newName, std::move(m) }); @@ -87,15 +87,15 @@ class TMutableFunctionRegistry: public IMutableFunctionRegistry } } - const TString& GetError() const { return Error; } + const TString& GetError() const { return Error; } bool HasError() const { return !Error.empty(); } private: TUdfModulesMap& ModulesMap; - const TString LibraryPath; + const TString LibraryPath; const TUdfModuleRemappings& Remappings; - const TString AbiVersion; - TString Error; + const TString AbiVersion; + TString Error; }; public: @@ -119,7 +119,7 @@ public: } void LoadUdfs( - const TString& libraryPath, + const TString& libraryPath, const TUdfModuleRemappings& remmapings, ui32 flags /* = 0 */) override { @@ -191,7 +191,7 @@ public: const TStringBuf& moduleName, NUdf::TUniquePtr<NUdf::IUdfModule> module) override { - TString libraryPathStr(libraryPath); + TString libraryPathStr(libraryPath); auto inserted = LoadedLibraries_.insert({ libraryPathStr, nullptr }); if (!inserted.second) { return; @@ -278,12 +278,12 @@ public: << "But get " << name; } - TMaybe<TString> FindUdfPath(const TStringBuf& moduleName) const override { + TMaybe<TString> FindUdfPath(const TStringBuf& moduleName) const override { if (const TUdfModule* udf = UdfModules_.FindPtr(moduleName)) { return udf->LibraryPath; } - if (const TString* path = SystemModulePaths_.FindPtr(moduleName)) { + if (const TString* path = SystemModulePaths_.FindPtr(moduleName)) { return *path; } @@ -294,8 +294,8 @@ public: return UdfModules_.contains(moduleName); } - THashSet<TString> GetAllModuleNames() const override { - THashSet<TString> names; + THashSet<TString> GetAllModuleNames() const override { + THashSet<TString> names; names.reserve(UdfModules_.size()); for (const auto& module: UdfModules_) { names.insert(module.first); @@ -359,7 +359,7 @@ public: private: const IBuiltinFunctionRegistry::TPtr Builtins_; - THashMap<TString, TUdfLibraryPtr> LoadedLibraries_; + THashMap<TString, TUdfLibraryPtr> LoadedLibraries_; TUdfModulesMap UdfModules_; THolder<TMemoryUsageInfo> UdfMemoryInfo_; TUdfModulePathsMap SystemModulePaths_; @@ -410,7 +410,7 @@ public: return TStatus::Error(TStringBuf("Unsupported access to builtins registry")); } - TMaybe<TString> FindUdfPath( + TMaybe<TString> FindUdfPath( const TStringBuf& /* moduleName */) const override { return{}; @@ -420,7 +420,7 @@ public: return false; } - THashSet<TString> GetAllModuleNames() const override { + THashSet<TString> GetAllModuleNames() const override { return {}; } @@ -452,7 +452,7 @@ private: namespace NKikimr { namespace NMiniKQL { -void FindUdfsInDir(const TString& dirPath, TVector<TString>* paths) +void FindUdfsInDir(const TString& dirPath, TVector<TString>* paths) { static const TStringBuf libPrefix = TStringBuf(MKQL_UDF_LIB_PREFIX); static const TStringBuf libSuffix = TStringBuf(MKQL_UDF_LIB_SUFFIX); @@ -498,9 +498,9 @@ bool SplitModuleAndFuncName(const TStringBuf& name, TStringBuf& module, TStringB return name.TrySplit(MODULE_NAME_DELIMITER, module, func); } -TString FullName(const TStringBuf& module, const TStringBuf& func) +TString FullName(const TStringBuf& module, const TStringBuf& func) { - TString fullName; + TString fullName; fullName.reserve(module.size() + func.size() + 1); fullName.append(module); fullName.append(MODULE_NAME_DELIMITER); @@ -528,7 +528,7 @@ TIntrusivePtr<IFunctionRegistry> CreateFunctionRegistry( // system UDFs loaded with default names TUdfModuleRemappings remappings; - for (const TString& udfPath: udfsPaths) { + for (const TString& udfPath: udfsPaths) { registry->LoadUdfs(udfPath, remappings, flags); } diff --git a/ydb/library/yql/minikql/mkql_function_registry.h b/ydb/library/yql/minikql/mkql_function_registry.h index f18152cb24e..c765a85ac2a 100644 --- a/ydb/library/yql/minikql/mkql_function_registry.h +++ b/ydb/library/yql/minikql/mkql_function_registry.h @@ -42,8 +42,8 @@ namespace NKikimr { namespace NKikimr { namespace NMiniKQL { -using TUdfModuleRemappings = THashMap<TString, TString>; // old => new -using TUdfModulePathsMap = THashMap<TString, TString>; // module name => udf path +using TUdfModuleRemappings = THashMap<TString, TString>; // old => new +using TUdfModulePathsMap = THashMap<TString, TString>; // module name => udf path ////////////////////////////////////////////////////////////////////////////// // IFunctionRegistry @@ -71,11 +71,11 @@ public: const NUdf::ISecureParamsProvider* secureParamsProvider, TFunctionTypeInfo* funcInfo) const = 0; - virtual TMaybe<TString> FindUdfPath(const TStringBuf& moduleName) const = 0; + virtual TMaybe<TString> FindUdfPath(const TStringBuf& moduleName) const = 0; virtual bool IsLoadedUdfModule(const TStringBuf& moduleName) const = 0; - virtual THashSet<TString> GetAllModuleNames() const = 0; + virtual THashSet<TString> GetAllModuleNames() const = 0; virtual void PrintInfoTo(IOutputStream& out) const = 0; @@ -101,7 +101,7 @@ public: virtual void SetBackTraceCallback(NUdf::TBackTraceCallback callback) = 0; virtual void LoadUdfs( - const TString& libraryPath, + const TString& libraryPath, const TUdfModuleRemappings& remmapings, ui32 flags = 0) = 0; @@ -122,17 +122,17 @@ TIntrusivePtr<IFunctionRegistry> CreateFunctionRegistry( NKikimr::NUdf::TBackTraceCallback backtraceCallback, IBuiltinFunctionRegistry::TPtr&& builtins, bool allowUdfPatch, - const TVector<TString>& udfsPaths, + const TVector<TString>& udfsPaths, ui32 flags = 0); // see NUdf::IRegistrator::TFlags ////////////////////////////////////////////////////////////////////////////// // helper functions ////////////////////////////////////////////////////////////////////////////// -void FindUdfsInDir(const TString& dirPath, TVector<TString>* paths); +void FindUdfsInDir(const TString& dirPath, TVector<TString>* paths); bool SplitModuleAndFuncName( const TStringBuf& name, TStringBuf& module, TStringBuf& func); -TString FullName(const TStringBuf& module, const TStringBuf& func); +TString FullName(const TStringBuf& module, const TStringBuf& func); inline TStringBuf ModuleName(const TStringBuf& name) { TStringBuf moduleName, _; diff --git a/ydb/library/yql/minikql/mkql_mem_info.h b/ydb/library/yql/minikql/mkql_mem_info.h index 8e880d1db30..e70a68b2c00 100644 --- a/ydb/library/yql/minikql/mkql_mem_info.h +++ b/ydb/library/yql/minikql/mkql_mem_info.h @@ -35,7 +35,7 @@ class TMemoryUsageInfo : public TThrRefBase { struct TAllocationInfo { ui64 Size; - TString Location; + TString Location; bool IsDeleted; }; public: @@ -175,7 +175,7 @@ public: } private: - const TString Title_; + const TString Title_; ui64 Allocated_; ui64 Freed_; ui64 Peak_; diff --git a/ydb/library/yql/minikql/mkql_node.cpp b/ydb/library/yql/minikql/mkql_node.cpp index 4c6f3e45ad4..968bb5926ce 100644 --- a/ydb/library/yql/minikql/mkql_node.cpp +++ b/ydb/library/yql/minikql/mkql_node.cpp @@ -116,7 +116,7 @@ bool TNode::Equals(const TNode& nodeToCompare) const { } } -void TNode::UpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TNode::UpdateLinks(const THashMap<TNode*, TNode*>& links) { const auto kind = Type->GetKind(); switch (kind) { case TType::EKind::Type: @@ -226,7 +226,7 @@ void TType::Accept(INodeVisitor& visitor) { } } -void TType::UpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TType::UpdateLinks(const THashMap<TNode*, TNode*>& links) { switch (Kind) { #define APPLY(kind, type) \ @@ -333,7 +333,7 @@ bool TTypeType::IsConvertableTo(const TTypeType& typeToCompare, bool ignoreTagge return IsSameType(typeToCompare); } -void TTypeType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TTypeType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { Y_UNUSED(links); } @@ -372,7 +372,7 @@ bool TDataType::IsConvertableTo(const TDataType& typeToCompare, bool ignoreTagge return IsSameType(typeToCompare); } -void TDataType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TDataType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { Y_UNUSED(links); } @@ -417,7 +417,7 @@ TDataLiteral* TDataLiteral::Create(const NUdf::TUnboxedValuePod& value, TDataTyp return ::new(env.Allocate<TDataLiteral>()) TDataLiteral(value, type); } -void TDataLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TDataLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto typeIt = links.find(Type); if (typeIt != links.end()) { TNode* newNode = typeIt->second; @@ -483,7 +483,7 @@ TStructType::TStructType(ui32 membersCount, std::pair<TInternName, TType*>* memb } } -TStructType* TStructType::Create(const std::pair<TString, TType*>* members, ui32 membersCount, const TTypeEnvironment& env) { +TStructType* TStructType::Create(const std::pair<TString, TType*>* members, ui32 membersCount, const TTypeEnvironment& env) { std::pair<TInternName, TType*>* allocatedMembers = nullptr; if (membersCount) { allocatedMembers = static_cast<std::pair<TInternName, TType*>*>(env.AllocateBuffer(membersCount * sizeof(*allocatedMembers))); @@ -541,7 +541,7 @@ bool TStructType::IsConvertableTo(const TStructType& typeToCompare, bool ignoreT return true; } -void TStructType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TStructType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { for (ui32 i = 0; i < MembersCount; ++i) { auto& member = Members[i]; auto memberIt = links.find(member.second); @@ -648,7 +648,7 @@ TStructLiteral* TStructLiteral::Create(ui32 valuesCount, const TRuntimeNode* val return ::new(env.Allocate<TStructLiteral>()) TStructLiteral(allocatedValues, type); } -void TStructLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TStructLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto typeIt = links.find(Type); if (typeIt != links.end()) { TNode* newNode = typeIt->second; @@ -739,7 +739,7 @@ bool TListType::IsConvertableTo(const TListType& typeToCompare, bool ignoreTagge return GetItemType()->IsConvertableTo(*typeToCompare.GetItemType(), ignoreTagged); } -void TListType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TListType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto itemTypeIt = links.find(GetItemType()); if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; @@ -794,7 +794,7 @@ TListLiteral* TListLiteral::Create(TRuntimeNode* items, ui32 count, TListType* t return ::new(env.Allocate<TListLiteral>()) TListLiteral(allocatedItems, count, type, env); } -void TListLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TListLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto typeIt = links.find(Type); if (typeIt != links.end()) { TNode* newNode = typeIt->second; @@ -830,7 +830,7 @@ TNode* TListLiteral::DoCloneOnCallableWrite(const TTypeEnvironment& env) const { if (!needClone) return const_cast<TListLiteral*>(this); - TVector<TRuntimeNode> newList; + TVector<TRuntimeNode> newList; newList.reserve(Count); for (ui32 i = 0; i < Count; ++i) { auto newNode = (TNode*)Items[i].GetNode()->GetCookie(); @@ -910,7 +910,7 @@ bool TStreamType::IsConvertableTo(const TStreamType& typeToCompare, bool ignoreT return GetItemType()->IsConvertableTo(*typeToCompare.GetItemType(), ignoreTagged); } -void TStreamType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TStreamType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto itemTypeIt = links.find(GetItemType()); if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; @@ -990,7 +990,7 @@ bool TOptionalType::IsConvertableTo(const TOptionalType& typeToCompare, bool ign return GetItemType()->IsConvertableTo(*typeToCompare.GetItemType(), ignoreTagged); } -void TOptionalType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TOptionalType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto itemTypeIt = links.find(GetItemType()); if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; @@ -1081,7 +1081,7 @@ TOptionalLiteral* TOptionalLiteral::Create(TRuntimeNode item, TOptionalType* typ return ::new(env.Allocate<TOptionalLiteral>()) TOptionalLiteral(item, type); } -void TOptionalLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TOptionalLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto typeIt = links.find(Type); if (typeIt != links.end()) { TNode* newNode = typeIt->second; @@ -1144,7 +1144,7 @@ bool TDictType::IsConvertableTo(const TDictType& typeToCompare, bool ignoreTagge && PayloadType->IsConvertableTo(*typeToCompare.PayloadType, ignoreTagged); } -void TDictType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TDictType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto keyTypeIt = links.find(KeyType); if (keyTypeIt != links.end()) { TNode* newNode = keyTypeIt->second; @@ -1230,7 +1230,7 @@ TDictLiteral* TDictLiteral::Create(ui32 itemsCount, const std::pair<TRuntimeNode return ::new(env.Allocate<TDictLiteral>()) TDictLiteral(itemsCount, allocatedItems, type); } -void TDictLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TDictLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto typeIt = links.find(Type); if (typeIt != links.end()) { TNode* newNode = typeIt->second; @@ -1332,7 +1332,7 @@ TCallableType::TCallableType(const TInternName &name, TType* returnType, ui32 ar { } -TCallableType* TCallableType::Create(const TString& name, TType* returnType, +TCallableType* TCallableType::Create(const TString& name, TType* returnType, ui32 argumentsCount, TType** arguments, TNode* payload, const TTypeEnvironment& env) { auto internedName = env.InternName(name); TType** allocatedArguments = nullptr; @@ -1430,7 +1430,7 @@ void TCallableType::SetOptionalArgumentsCount(ui32 count) { } } -void TCallableType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TCallableType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto returnTypeIt = links.find(ReturnType); if (returnTypeIt != links.end()) { TNode* newNode = returnTypeIt->second; @@ -1556,7 +1556,7 @@ TCallable* TCallable::Create(TRuntimeNode result, TCallableType* type, const TTy return ::new(env.Allocate<TCallable>()) TCallable(result, type); } -void TCallable::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TCallable::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto typeIt = links.find(Type); if (typeIt != links.end()) { TNode* newNode = typeIt->second; @@ -1845,7 +1845,7 @@ bool TTupleType::IsConvertableTo(const TTupleType& typeToCompare, bool ignoreTag return true; } -void TTupleType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TTupleType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { for (ui32 i = 0; i < ElementsCount; ++i) { auto& element = Elements[i]; auto elementIt = links.find(element); @@ -1925,7 +1925,7 @@ TTupleLiteral* TTupleLiteral::Create(ui32 valuesCount, const TRuntimeNode* value return ::new(env.Allocate<TTupleLiteral>()) TTupleLiteral(allocatedValues, type); } -void TTupleLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TTupleLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto typeIt = links.find(Type); if (typeIt != links.end()) { TNode* newNode = typeIt->second; @@ -2005,7 +2005,7 @@ bool TResourceType::IsConvertableTo(const TResourceType& typeToCompare, bool ign return IsSameType(typeToCompare); } -void TResourceType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TResourceType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { Y_UNUSED(links); } @@ -2050,7 +2050,7 @@ TVariantType::TVariantType(TType* underlyingType, const TTypeEnvironment& env, b } } -void TVariantType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TVariantType::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto itemTypeIt = links.find(GetUnderlyingType()); if (itemTypeIt != links.end()) { TNode* newNode = itemTypeIt->second; @@ -2105,7 +2105,7 @@ bool TVariantLiteral::Equals(const TVariantLiteral& nodeToCompare) const { return Item.GetNode()->Equals(*nodeToCompare.GetItem().GetNode()); } -void TVariantLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { +void TVariantLiteral::DoUpdateLinks(const THashMap<TNode*, TNode*>& links) { auto typeIt = links.find(Type); if (typeIt != links.end()) { TNode* newNode = typeIt->second; diff --git a/ydb/library/yql/minikql/mkql_node.h b/ydb/library/yql/minikql/mkql_node.h index ee74455ea69..9962e2b4af2 100644 --- a/ydb/library/yql/minikql/mkql_node.h +++ b/ydb/library/yql/minikql/mkql_node.h @@ -108,7 +108,7 @@ public: void Accept(INodeVisitor& visitor); bool Equals(const TNode& nodeToCompare) const; - void UpdateLinks(const THashMap<TNode*, TNode*>& links); + void UpdateLinks(const THashMap<TNode*, TNode*>& links); // replace map stored in cookies TNode* CloneOnCallableWrite(const TTypeEnvironment& env) const; void Freeze(const TTypeEnvironment& env); @@ -173,7 +173,7 @@ public: bool IsSameType(const TType& typeToCompare) const; bool IsConvertableTo(const TType& typeToCompare, bool ignoreTagged = false) const; void Accept(INodeVisitor& visitor); - void UpdateLinks(const THashMap<TNode*, TNode*>& links); + void UpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* CloneOnCallableWrite(const TTypeEnvironment& env) const; void Freeze(const TTypeEnvironment& env); @@ -205,7 +205,7 @@ private: { } - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -228,7 +228,7 @@ private: : TType(SingularKind, type) {} - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -473,7 +473,7 @@ private: TScopedAlloc& Alloc; mutable TPagedArena Arena; mutable std::stack<NUdf::TStringValue> Strings; - mutable THashSet<TStringBuf> NamesPool; + mutable THashSet<TStringBuf> NamesPool; mutable std::vector<TNode*> Stack; TTypeType* TypeOfType; @@ -535,7 +535,7 @@ public: protected: TDataType(NUdf::TDataTypeId schemeType, const TTypeEnvironment& env); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -579,7 +579,7 @@ private: using TNode::Equals; bool Equals(const TDataLiteral& nodeToCompare) const; - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); }; @@ -610,7 +610,7 @@ struct TStructMember { class TStructType : public TType { friend class TType; public: - static TStructType* Create(const std::pair<TString, TType*>* members, ui32 membersCount, const TTypeEnvironment& env); + static TStructType* Create(const std::pair<TString, TType*>* members, ui32 membersCount, const TTypeEnvironment& env); static TStructType* Create(ui32 membersCount, const TStructMember* members, const TTypeEnvironment& env); using TType::IsSameType; @@ -644,7 +644,7 @@ public: private: TStructType(ui32 membersCount, std::pair<TInternName, TType*>* members, const TTypeEnvironment& env, bool validate = true); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -675,7 +675,7 @@ private: using TNode::Equals; bool Equals(const TStructLiteral& nodeToCompare) const; - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -705,7 +705,7 @@ public: private: TListType(TType* itemType, const TTypeEnvironment& env, bool validate = true); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -736,7 +736,7 @@ private: using TNode::Equals; bool Equals(const TListLiteral& nodeToCompare) const; - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -763,7 +763,7 @@ public: private: TStreamType(TType* itemType, const TTypeEnvironment& env, bool validate = true); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -815,7 +815,7 @@ public: private: TOptionalType(TType* itemType, const TTypeEnvironment& env, bool validate = true); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -848,7 +848,7 @@ private: using TNode::Equals; bool Equals(const TOptionalLiteral& nodeToCompare) const; - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -880,7 +880,7 @@ public: private: TDictType(TType* keyType, TType* payloadType, const TTypeEnvironment& env, bool validate = true); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -911,7 +911,7 @@ private: using TNode::Equals; bool Equals(const TDictLiteral& nodeToCompare) const; - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -923,7 +923,7 @@ private: class TCallableType : public TType { friend class TType; public: - static TCallableType* Create(const TString& name, TType* returnType, ui32 argumentsCount, + static TCallableType* Create(const TString& name, TType* returnType, ui32 argumentsCount, TType** arguments, TNode* payload, const TTypeEnvironment& env); static TCallableType* Create(TType* returnType, const TStringBuf& name, ui32 argumentsCount, TType** arguments, TNode* payload, const TTypeEnvironment& env); @@ -975,7 +975,7 @@ private: TCallableType(const TInternName& name, TType* returnType, ui32 argumentsCount, TType** arguments, TNode* payload, const TTypeEnvironment& env); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -1031,7 +1031,7 @@ private: using TNode::Equals; bool Equals(const TCallable& nodeToCompare) const; - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -1139,7 +1139,7 @@ public: private: TTupleType(ui32 elemntsCount, TType** elements, const TTypeEnvironment& env, bool validate = true); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -1170,7 +1170,7 @@ private: using TNode::Equals; bool Equals(const TTupleLiteral& nodeToCompare) const; - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -1204,7 +1204,7 @@ private: , Tag(tag) {} - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -1282,7 +1282,7 @@ public: private: TVariantType(TType* underlyingType, const TTypeEnvironment& env, bool validate = true); - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); @@ -1312,7 +1312,7 @@ private: using TNode::Equals; bool Equals(const TVariantLiteral& nodeToCompare) const; - void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); + void DoUpdateLinks(const THashMap<TNode*, TNode*>& links); TNode* DoCloneOnCallableWrite(const TTypeEnvironment& env) const; void DoFreeze(const TTypeEnvironment& env); diff --git a/ydb/library/yql/minikql/mkql_node_builder.cpp b/ydb/library/yql/minikql/mkql_node_builder.cpp index 34466b89446..fff28a71430 100644 --- a/ydb/library/yql/minikql/mkql_node_builder.cpp +++ b/ydb/library/yql/minikql/mkql_node_builder.cpp @@ -9,15 +9,15 @@ namespace NMiniKQL { using namespace NDetail; namespace { - TNode* BuildCallableTypePayload(const TVector<TStringBuf>& argNames, - const TVector<ui64>& argFlags, TStringBuf payload, const TTypeEnvironment& env) { + TNode* BuildCallableTypePayload(const TVector<TStringBuf>& argNames, + const TVector<ui64>& argFlags, TStringBuf payload, const TTypeEnvironment& env) { TStructTypeBuilder itemTypeBuilder(env); itemTypeBuilder.Add("Name", TDataType::Create(NUdf::TDataType<char*>::Id, env)); itemTypeBuilder.Add("Flags", TDataType::Create(NUdf::TDataType<ui64>::Id, env)); TType* itemType = itemTypeBuilder.Build(); bool startedNames = false; - THashSet<TStringBuf> usedNames; + THashSet<TStringBuf> usedNames; TListLiteralBuilder argsListBuilder(env, itemType); for (ui32 i = 0; i < argNames.size(); ++i) { TStructLiteralBuilder itemBuilder(env); @@ -151,7 +151,7 @@ TStructLiteral* TStructLiteralBuilder::Build() { if (Members.empty()) return Env->GetEmptyStruct(); - TVector<std::pair<TStringBuf, ui32>> sortedIndicies(Members.size()); + TVector<std::pair<TStringBuf, ui32>> sortedIndicies(Members.size()); for (ui32 i = 0, e = Members.size(); i < e; ++i) { sortedIndicies[i] = std::make_pair(Members[i].Name, i); } @@ -161,8 +161,8 @@ TStructLiteral* TStructLiteralBuilder::Build() { return x.first < y.first; }); - TVector<TStructMember> sortedMembers(Members.size()); - TVector<TRuntimeNode> sortedValues(Members.size()); + TVector<TStructMember> sortedMembers(Members.size()); + TVector<TRuntimeNode> sortedValues(Members.size()); for (ui32 i = 0, e = Members.size(); i < e; ++i) { sortedMembers[i] = Members[sortedIndicies[i].second]; diff --git a/ydb/library/yql/minikql/mkql_node_builder.h b/ydb/library/yql/minikql/mkql_node_builder.h index 46a43dc3529..50c8abfe926 100644 --- a/ydb/library/yql/minikql/mkql_node_builder.h +++ b/ydb/library/yql/minikql/mkql_node_builder.h @@ -36,7 +36,7 @@ public: private: const TTypeEnvironment* Env; - TVector<TStructMember> Members; + TVector<TStructMember> Members; }; class TListLiteralBuilder { @@ -51,7 +51,7 @@ public: private: const TTypeEnvironment* Env; TType* Type; - TVector<TRuntimeNode> Items; + TVector<TRuntimeNode> Items; }; class TStructLiteralBuilder { @@ -66,8 +66,8 @@ public: private: const TTypeEnvironment* Env; - TVector<TStructMember> Members; - TVector<TRuntimeNode> Values; + TVector<TStructMember> Members; + TVector<TRuntimeNode> Values; }; class TDictLiteralBuilder { @@ -84,7 +84,7 @@ private: const TTypeEnvironment* Env; TType* KeyType; TType* PayloadType; - TVector<std::pair<TRuntimeNode, TRuntimeNode>> Items; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> Items; }; class TCallableTypeBuilder { @@ -105,10 +105,10 @@ private: const TTypeEnvironment* Env; TInternName Name; TType* ReturnType; - TVector<TType*> Arguments; + TVector<TType*> Arguments; ui32 OptionalArgsCount; - TVector<TStringBuf> ArgNames; - TVector<ui64> ArgFlags; + TVector<TStringBuf> ArgNames; + TVector<ui64> ArgFlags; TStringBuf FuncPayload; bool HasPayload; }; @@ -133,11 +133,11 @@ private: TInternName Name; TType* ReturnType; bool DisableMerge; - TVector<TType*> Arguments; - TVector<TRuntimeNode> Inputs; + TVector<TType*> Arguments; + TVector<TRuntimeNode> Inputs; ui32 OptionalArgsCount; - TVector<TStringBuf> ArgNames; - TVector<ui64> ArgFlags; + TVector<TStringBuf> ArgNames; + TVector<ui64> ArgFlags; TStringBuf FuncPayload; bool HasPayload; }; diff --git a/ydb/library/yql/minikql/mkql_node_printer.cpp b/ydb/library/yql/minikql/mkql_node_printer.cpp index f7515a30050..fda2e0056ed 100644 --- a/ydb/library/yql/minikql/mkql_node_printer.cpp +++ b/ydb/library/yql/minikql/mkql_node_printer.cpp @@ -793,7 +793,7 @@ namespace { WriteNewline(); } - TString ToString() { + TString ToString() { return Out.Str(); } diff --git a/ydb/library/yql/minikql/mkql_node_printer.h b/ydb/library/yql/minikql/mkql_node_printer.h index edabcf76692..0cae92f47cf 100644 --- a/ydb/library/yql/minikql/mkql_node_printer.h +++ b/ydb/library/yql/minikql/mkql_node_printer.h @@ -6,7 +6,7 @@ namespace NKikimr { namespace NMiniKQL { -TString PrintNode(const TNode* node, bool singleLine = false); +TString PrintNode(const TNode* node, bool singleLine = false); } } diff --git a/ydb/library/yql/minikql/mkql_node_printer_ut.cpp b/ydb/library/yql/minikql/mkql_node_printer_ut.cpp index ec8c5d1afe7..3625fd7380e 100644 --- a/ydb/library/yql/minikql/mkql_node_printer_ut.cpp +++ b/ydb/library/yql/minikql/mkql_node_printer_ut.cpp @@ -12,7 +12,7 @@ namespace { TStructLiteralBuilder structBuilder(env); TDataType* dtype1 = TDataType::Create(NUdf::TDataType<ui32>::Id, env); TDataType* dtype2 = TDataType::Create(NUdf::TDataType<char*>::Id, env); - TVector<TType*> callableTypes; + TVector<TType*> callableTypes; callableTypes.push_back(env.GetVoid()->GetGenericType()); TCallableType* ctype1 = TCallableType::Create("ret data", dtype1, callableTypes.size(), callableTypes.data(), nullptr, env); TListType* ltype1 = TListType::Create(dtype1, env); @@ -22,13 +22,13 @@ namespace { structBuilder.Add("03", TRuntimeNode(dtype1, true)); structBuilder.Add("04", TRuntimeNode(TDataType::Create(NUdf::TDataType<ui32>::Id, env), true)); structBuilder.Add("12", TRuntimeNode(env.GetEmptyStruct()->GetType(), true)); - TVector<std::pair<TString, TType*>> smallMembers; + TVector<std::pair<TString, TType*>> smallMembers; smallMembers.push_back(std::make_pair("Embedded member", env.GetVoid()->GetGenericType())); structBuilder.Add("13", TRuntimeNode(TStructType::Create(smallMembers.data(), smallMembers.size(), env), true)); structBuilder.Add("14", TRuntimeNode(TListType::Create(dtype1, env), true)); structBuilder.Add("15", TRuntimeNode(TOptionalType::Create(dtype2, env), true)); structBuilder.Add("16", TRuntimeNode(TDictType::Create(dtype1, dtype2, env), true)); - TVector<TType*> smallTypes; + TVector<TType*> smallTypes; smallTypes.push_back(dtype1); structBuilder.Add("17", TRuntimeNode(TCallableType::Create("My callable", dtype2, smallTypes.size(), smallTypes.data(), nullptr, env), true)); @@ -37,7 +37,7 @@ namespace { structBuilder.Add("19", TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod(u), dtype1, env), true)); auto v = TRuntimeNode(env.GetVoid(), true); structBuilder.Add("26", TRuntimeNode(TListLiteral::Create(nullptr, 0, ltype1, env), true)); - TVector<TRuntimeNode> litems; + TVector<TRuntimeNode> litems; litems.push_back(TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod(u), dtype1, env), true)); u = 789; litems.push_back(TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod(u), dtype1, env), true)); @@ -46,11 +46,11 @@ namespace { structBuilder.Add("29", TRuntimeNode(TOptionalLiteral::Create(litems[0], otype1, env), true)); auto ditype1 = TDictType::Create(dtype1, dtype2, env); - TVector<std::pair<TRuntimeNode, TRuntimeNode>> ditems; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> ditems; ditems.push_back(std::make_pair(TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod((ui32)456), dtype1, env), true), TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod::Embedded("aaaa"), dtype2, env), true))); structBuilder.Add("30", TRuntimeNode(TDictLiteral::Create(ditems.size(), ditems.data(), ditype1, env), true)); - TVector<TRuntimeNode> callableArgs; + TVector<TRuntimeNode> callableArgs; callableArgs.push_back(TRuntimeNode(env.GetVoid(), true)); TCallable* callable = TCallable::Create(callableArgs.size(), callableArgs.data(), ctype1, env); callable->SetResult(TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod(u), dtype1, env), true), env); @@ -63,9 +63,9 @@ namespace { structBuilder.Add("35", TRuntimeNode(TCallableType::Create("My callable 2", dtype2, callableArgs.size(), smallTypes.data(), env.GetVoid(), env), true)); - TVector<TType*> tupleTypes; + TVector<TType*> tupleTypes; tupleTypes.push_back(dtype1); - TVector<TRuntimeNode> tupleValues; + TVector<TRuntimeNode> tupleValues; tupleValues.push_back(TRuntimeNode(TDataLiteral::Create(NUdf::TUnboxedValuePod((ui32)456), dtype1, env), true)); auto tupleType = TTupleType::Create(tupleTypes.size(), tupleTypes.data(), env); structBuilder.Add("36", TRuntimeNode(tupleType, true)); @@ -87,12 +87,12 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodePrinterTest) { TScopedAlloc alloc; TTypeEnvironment env(alloc); auto node = BuildGraph(env); - TString s = PrintNode(node); + TString s = PrintNode(node); //Cout << s << Endl; auto serialized = SerializeNode(node, env); TNode* node2 = DeserializeNode(serialized, env); - TString s2 = PrintNode(node2, false); + TString s2 = PrintNode(node2, false); UNIT_ASSERT_EQUAL(s2, s); } diff --git a/ydb/library/yql/minikql/mkql_node_serialization.cpp b/ydb/library/yql/minikql/mkql_node_serialization.cpp index e314f38cd61..0a2da4e22d0 100644 --- a/ydb/library/yql/minikql/mkql_node_serialization.cpp +++ b/ydb/library/yql/minikql/mkql_node_serialization.cpp @@ -71,7 +71,7 @@ namespace { AddName(name); } - THashMap<TInternName, ui32>& GetNames() { + THashMap<TInternName, ui32>& GetNames() { return Names; } @@ -90,7 +90,7 @@ namespace { } private: - THashMap<TInternName, ui32> Names; + THashMap<TInternName, ui32> Names; TVector<TInternName> NameOrder; }; @@ -877,7 +877,7 @@ namespace { End(); } - TString GetOutput() const { + TString GetOutput() const { return Out; } @@ -957,11 +957,11 @@ namespace { } private: - TString Out; + TString Out; ui32 ReferenceCount = 0; - THashMap<TInternName, ui32> Names; + THashMap<TInternName, ui32> Names; TVector<TInternName> NameOrder; - TVector<std::pair<TNode*, bool>> Stack; + TVector<std::pair<TNode*, bool>> Stack; }; class TReader { @@ -1792,7 +1792,7 @@ namespace { ThrowCorrupted(); auto listType = static_cast<TListType*>(type); - TVector<TRuntimeNode> items; + TVector<TRuntimeNode> items; items.reserve(itemsCount); for (ui32 i = 0; i < itemsCount; ++i) { auto item = PopNode(); @@ -2035,18 +2035,18 @@ namespace { const char* Current; const char* const End; const TTypeEnvironment& Env; - TVector<TNode*> Nodes; - TVector<TStringBuf> Names; - TVector<TNodeContext> CtxStack; - TVector<std::pair<TNode*, const char*>> NodeStack; + TVector<TNode*> Nodes; + TVector<TStringBuf> Names; + TVector<TNodeContext> CtxStack; + TVector<std::pair<TNode*, const char*>> NodeStack; }; } -TString SerializeNode(TNode* node, const TTypeEnvironment& env) noexcept{ +TString SerializeNode(TNode* node, const TTypeEnvironment& env) noexcept{ return SerializeRuntimeNode(TRuntimeNode(node, true), env); } -TString SerializeRuntimeNode(TExploringNodeVisitor& explorer, TRuntimeNode node, const TTypeEnvironment& env) noexcept{ +TString SerializeRuntimeNode(TExploringNodeVisitor& explorer, TRuntimeNode node, const TTypeEnvironment& env) noexcept{ Y_UNUSED(env); TPrepareWriteNodeVisitor preparer; for (auto node : explorer.GetNodes()) { @@ -2064,7 +2064,7 @@ TString SerializeRuntimeNode(TExploringNodeVisitor& explorer, TRuntimeNode node, return writer.GetOutput(); } -TString SerializeRuntimeNode(TRuntimeNode node, const TTypeEnvironment& env) noexcept{ +TString SerializeRuntimeNode(TRuntimeNode node, const TTypeEnvironment& env) noexcept{ TExploringNodeVisitor explorer; explorer.Walk(node.GetNode(), env); return SerializeRuntimeNode(explorer, node, env); diff --git a/ydb/library/yql/minikql/mkql_node_serialization.h b/ydb/library/yql/minikql/mkql_node_serialization.h index a074d192a47..d6c4df6cea1 100644 --- a/ydb/library/yql/minikql/mkql_node_serialization.h +++ b/ydb/library/yql/minikql/mkql_node_serialization.h @@ -6,9 +6,9 @@ namespace NKikimr { namespace NMiniKQL { -TString SerializeNode(TNode* node, const TTypeEnvironment& env) noexcept; -TString SerializeRuntimeNode(TRuntimeNode node, const TTypeEnvironment& env) noexcept; -TString SerializeRuntimeNode(TExploringNodeVisitor& explorer, TRuntimeNode node, const TTypeEnvironment& env) noexcept; +TString SerializeNode(TNode* node, const TTypeEnvironment& env) noexcept; +TString SerializeRuntimeNode(TRuntimeNode node, const TTypeEnvironment& env) noexcept; +TString SerializeRuntimeNode(TExploringNodeVisitor& explorer, TRuntimeNode node, const TTypeEnvironment& env) noexcept; TNode* DeserializeNode(const TStringBuf& buffer, const TTypeEnvironment& env); TRuntimeNode DeserializeRuntimeNode(const TStringBuf& buffer, const TTypeEnvironment& env); diff --git a/ydb/library/yql/minikql/mkql_node_ut.cpp b/ydb/library/yql/minikql/mkql_node_ut.cpp index 16126272462..eb3714ea6b3 100644 --- a/ydb/library/yql/minikql/mkql_node_ut.cpp +++ b/ydb/library/yql/minikql/mkql_node_ut.cpp @@ -72,14 +72,14 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT_EQUAL(sempty->GetKind(), TType::EKind::Struct); UNIT_ASSERT_EQUAL(sempty->GetMembersCount(), 0); - TVector<std::pair<TString, TType*>> s1members; + TVector<std::pair<TString, TType*>> s1members; s1members.push_back(std::make_pair("aaa", env.GetVoid()->GetGenericType())); TStructType* s1 = TStructType::Create(s1members.data(), s1members.size(), env); UNIT_ASSERT_EQUAL(s1->GetMembersCount(), 1); UNIT_ASSERT_EQUAL(s1->GetMemberName(0), "aaa"); UNIT_ASSERT_EQUAL(s1->GetMemberType(0)->GetKind(), TType::EKind::Void); - TVector<std::pair<TString, TType*>> s2members; + TVector<std::pair<TString, TType*>> s2members; s2members.push_back(std::make_pair("bbb", env.GetEmptyStruct()->GetGenericType())); s2members.push_back(std::make_pair("ccc", env.GetTypeOfVoid())); TStructType* s2 = TStructType::Create(s2members.data(), s2members.size(), env); @@ -89,7 +89,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT_EQUAL(s2->GetMemberName(1), "ccc"); UNIT_ASSERT_EQUAL(s2->GetMemberType(1)->GetKind(), TType::EKind::Void); - TVector<std::pair<TString, TType*>> s3members; + TVector<std::pair<TString, TType*>> s3members; s3members.push_back(std::make_pair("", env.GetEmptyStruct()->GetGenericType())); UNIT_ASSERT_EXCEPTION(TStructType::Create(s3members.data(), s3members.size(), env), yexception); @@ -101,7 +101,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { Reverse(s2members.begin(), s2members.end()); UNIT_ASSERT_EXCEPTION(TStructType::Create(s2members.data(), s2members.size(), env), yexception); - TVector<std::pair<TString, TType*>> duplicatedMembers; + TVector<std::pair<TString, TType*>> duplicatedMembers; duplicatedMembers.push_back(std::make_pair("aaa", env.GetEmptyStruct()->GetGenericType())); duplicatedMembers.push_back(std::make_pair("aaa", env.GetTypeOfVoid())); UNIT_ASSERT_EXCEPTION(TStructType::Create(duplicatedMembers.data(), duplicatedMembers.size(), env), yexception); @@ -114,11 +114,11 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { TStructLiteral* sempty = TStructLiteral::Create(0, nullptr, semptyType, env); UNIT_ASSERT_EQUAL(sempty->GetValuesCount(), 0); - TVector<std::pair<TString, TType*>> s1members; + TVector<std::pair<TString, TType*>> s1members; s1members.push_back(std::make_pair("aaa", env.GetVoid()->GetGenericType())); TStructType* s1type = TStructType::Create(s1members.data(), s1members.size(), env); - TVector<TRuntimeNode> s1values; + TVector<TRuntimeNode> s1values; s1values.push_back(TRuntimeNode(env.GetVoid(), true)); TStructLiteral* s1 = TStructLiteral::Create(s1values.size(), s1values.data(), s1type, env); UNIT_ASSERT_EQUAL(s1->GetValuesCount(), 1); @@ -126,13 +126,13 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT_EXCEPTION(TStructLiteral::Create(s1values.size(), s1values.data(), semptyType, env), yexception); - TVector<std::pair<TString, TType*>> s2members; + TVector<std::pair<TString, TType*>> s2members; s2members.push_back(std::make_pair("aaa", env.GetEmptyTuple()->GetGenericType())); TStructType* s2type = TStructType::Create(s2members.data(), s2members.size(), env); UNIT_ASSERT_EXCEPTION(TStructLiteral::Create(s1values.size(), s1values.data(), s2type, env), yexception); TStructType* s1typeDyn = TStructType::Create(s1members.data(), s1members.size(), env); - TVector<TRuntimeNode> s1DynValues; + TVector<TRuntimeNode> s1DynValues; TCallableType* ctype = TCallableType::Create("c1", env.GetVoid()->GetGenericType(), 0, nullptr, nullptr, env); s1DynValues.push_back(TRuntimeNode(TCallable::Create(0, nullptr, ctype, env), false)); @@ -171,8 +171,8 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT_NO_EXCEPTION(TListLiteral::Create(nullptr, 0, list1type, env)); - TString u = "34567"; - TVector<TRuntimeNode> someItems; + TString u = "34567"; + TVector<TRuntimeNode> someItems; someItems.push_back(TRuntimeNode(TDataLiteral::Create( NUdf::TUnboxedValue::Embedded(u), dtype1, env), true)); u = "878"; @@ -190,7 +190,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { TListType* list2typeDyn = TListType::Create(dtype1, env); UNIT_ASSERT_NO_EXCEPTION(TListLiteral::Create(someItems.data(), someItems.size(), list2typeDyn, env)); - TVector<TRuntimeNode> someDynItems; + TVector<TRuntimeNode> someDynItems; TCallableType* ctype = TCallableType::Create("c1", dtype1, 0, nullptr, nullptr, env); someDynItems.push_back(TRuntimeNode(TCallable::Create(0, nullptr, ctype, env), false)); @@ -218,7 +218,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { TOptionalLiteral* emptyOpt = TOptionalLiteral::Create(opt1type, env); UNIT_ASSERT(!emptyOpt->HasItem()); - TString u = "34567"; + TString u = "34567"; auto item1 = TRuntimeNode(TDataLiteral::Create( NUdf::TUnboxedValuePod::Embedded(u), dtype1, env), true); @@ -260,7 +260,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT_EQUAL(ctype1->GetArgumentsCount(), 0); UNIT_ASSERT_EQUAL(ctype1->GetReturnType()->GetKind(), TType::EKind::Void); - TVector<TType*> types; + TVector<TType*> types; types.push_back(env.GetVoid()->GetGenericType()); types.push_back(env.GetEmptyStruct()->GetGenericType()); TCallableType* ctype2 = TCallableType::Create("c2", env.GetVoid()->GetGenericType(), types.size(), types.data(), nullptr, env); @@ -275,13 +275,13 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT(ctype2->IsSameType(*ctype2Cloned)); UNIT_ASSERT(!ctype2->IsSameType(*ctype1)); - TVector<TType*> types2; + TVector<TType*> types2; types2.push_back(env.GetEmptyStruct()->GetGenericType()); types2.push_back(env.GetVoid()->GetGenericType()); TCallableType* ctype2rev = TCallableType::Create("c2", env.GetVoid()->GetGenericType(), types2.size(), types2.data(), nullptr, env); UNIT_ASSERT(!ctype2->IsSameType(*ctype2rev)); - TVector<TType*> types3; + TVector<TType*> types3; types3.push_back(env.GetVoid()->GetGenericType()); types3.push_back(env.GetEmptyStruct()->GetGenericType()); TCallableType* ctype2withPayload1 = TCallableType::Create("c2", env.GetVoid()->GetGenericType(), types.size(), types.data(), env.GetEmptyStruct(), env); @@ -311,11 +311,11 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { TDictType* dict1Type = TDictType::Create(dtype1, env.GetVoid()->GetGenericType(), env); TDictType* dict2Type = TDictType::Create(dtype1, dtype2, env); - TVector<std::pair<TRuntimeNode, TRuntimeNode>> emptyItems; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> emptyItems; UNIT_ASSERT_NO_EXCEPTION(TDictLiteral::Create(emptyItems.size(), emptyItems.data(), dict1Type, env)); - TString u = "34567"; - TVector<std::pair<TRuntimeNode, TRuntimeNode>> someItems; + TString u = "34567"; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> someItems; someItems.push_back(std::make_pair(TRuntimeNode(TDataLiteral::Create( NUdf::TUnboxedValuePod::Embedded(u), dtype1, env), true), TRuntimeNode(TDataLiteral::Create( @@ -340,7 +340,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { TDictType* dict2TypeDyn = TDictType::Create(dtype1, dtype2, env); UNIT_ASSERT_NO_EXCEPTION(TDictLiteral::Create(someItems.size(), someItems.data(), dict2TypeDyn, env)); - TVector<std::pair<TRuntimeNode, TRuntimeNode>> someDynItems; + TVector<std::pair<TRuntimeNode, TRuntimeNode>> someDynItems; TCallableType* ctype = TCallableType::Create("c1", dtype1, 0, nullptr, nullptr, env); someDynItems.push_back(std::make_pair( TRuntimeNode(TCallable::Create(0, nullptr, ctype, env), false), @@ -361,7 +361,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT(c1->HasResult()); UNIT_ASSERT_EQUAL(c1->GetResult().GetStaticType()->GetKind(), TType::EKind::Void); - TVector<TType*> ctype2args; + TVector<TType*> ctype2args; TDataType* dtype1 = TDataType::Create(NUdf::TDataType<char*>::Id, env); ctype2args.push_back(dtype1); ctype2args.push_back(dtype1); @@ -373,7 +373,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { TCallableType* ctype3 = TCallableType::Create("c1", dtype1, 0, nullptr, nullptr, env); - TVector<TRuntimeNode> c2args; + TVector<TRuntimeNode> c2args; c2args.push_back(TRuntimeNode(TDataLiteral::Create( NUdf::TUnboxedValuePod::Embedded("abc"), dtype1, env), true)); c2args.push_back(TRuntimeNode(TCallable::Create(0, nullptr, ctype3, env), false)); @@ -445,13 +445,13 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT_EQUAL(tempty->GetKind(), TType::EKind::Tuple); UNIT_ASSERT_EQUAL(tempty->GetElementsCount(), 0); - TVector<TType*> t1elems; + TVector<TType*> t1elems; t1elems.push_back(env.GetVoid()->GetGenericType()); TTupleType* t1 = TTupleType::Create(t1elems.size(), t1elems.data(), env); UNIT_ASSERT_EQUAL(t1->GetElementsCount(), 1); UNIT_ASSERT_EQUAL(t1->GetElementType(0)->GetKind(), TType::EKind::Void); - TVector<TType*> t2elems; + TVector<TType*> t2elems; t2elems.push_back(env.GetEmptyStruct()->GetGenericType()); t2elems.push_back(env.GetTypeOfVoid()); TTupleType* t2 = TTupleType::Create(t2elems.size(), t2elems.data(), env); @@ -472,11 +472,11 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { TTupleLiteral* tempty = TTupleLiteral::Create(0, nullptr, temptyType, env); UNIT_ASSERT_EQUAL(tempty->GetValuesCount(), 0); - TVector<TType*> t1elems; + TVector<TType*> t1elems; t1elems.push_back(env.GetVoid()->GetGenericType()); TTupleType* t1type = TTupleType::Create(t1elems.size(), t1elems.data(), env); - TVector<TRuntimeNode> t1values; + TVector<TRuntimeNode> t1values; t1values.push_back(TRuntimeNode(env.GetVoid(), true)); TTupleLiteral* t1 = TTupleLiteral::Create(t1values.size(), t1values.data(), t1type, env); UNIT_ASSERT_EQUAL(t1->GetValuesCount(), 1); @@ -484,13 +484,13 @@ Y_UNIT_TEST_SUITE(TMiniKQLNodeTest) { UNIT_ASSERT_EXCEPTION(TTupleLiteral::Create(t1values.size(), t1values.data(), temptyType, env), yexception); - TVector<TType*> t2elems; + TVector<TType*> t2elems; t2elems.push_back(env.GetEmptyStruct()->GetGenericType()); TTupleType* t2type = TTupleType::Create(t2elems.size(), t2elems.data(), env); UNIT_ASSERT_EXCEPTION(TTupleLiteral::Create(t1values.size(), t1values.data(), t2type, env), yexception); TTupleType* t1typeDyn = TTupleType::Create(t1elems.size(), t1elems.data(), env); - TVector<TRuntimeNode> t1DynValues; + TVector<TRuntimeNode> t1DynValues; TCallableType* ctype = TCallableType::Create("c1", env.GetVoid()->GetGenericType(), 0, nullptr, nullptr, env); t1DynValues.push_back(TRuntimeNode(TCallable::Create(0, nullptr, ctype, env), false)); diff --git a/ydb/library/yql/minikql/mkql_opt_literal.cpp b/ydb/library/yql/minikql/mkql_opt_literal.cpp index 832a87ea80c..cdd7ef55039 100644 --- a/ydb/library/yql/minikql/mkql_opt_literal.cpp +++ b/ydb/library/yql/minikql/mkql_opt_literal.cpp @@ -31,12 +31,12 @@ TNode* LiteralAddMember( MKQL_ENSURE(positionValue <= oldStruct.GetType()->GetMembersCount(), "Bad member index"); for (ui32 i = 0; i < positionValue; ++i) { - resultBuilder.Add(TString(oldStruct.GetType()->GetMemberName(i)), oldStruct.GetValue(i)); + resultBuilder.Add(TString(oldStruct.GetType()->GetMemberName(i)), oldStruct.GetValue(i)); } - resultBuilder.Add(TString(newStructType.GetMemberName(positionValue)), newMember); + resultBuilder.Add(TString(newStructType.GetMemberName(positionValue)), newMember); for (ui32 i = positionValue; i < oldStruct.GetValuesCount(); ++i) { - resultBuilder.Add(TString(oldStruct.GetType()->GetMemberName(i)), oldStruct.GetValue(i)); + resultBuilder.Add(TString(oldStruct.GetType()->GetMemberName(i)), oldStruct.GetValue(i)); } return resultBuilder.Build(); @@ -54,11 +54,11 @@ TNode* LiteralRemoveMember( MKQL_ENSURE(positionValue < oldStruct.GetType()->GetMembersCount(), "Bad member index"); for (ui32 i = 0; i < positionValue; ++i) { - resultBuilder.Add(TString(oldStruct.GetType()->GetMemberName(i)), oldStruct.GetValue(i)); + resultBuilder.Add(TString(oldStruct.GetType()->GetMemberName(i)), oldStruct.GetValue(i)); } for (ui32 i = positionValue + 1; i < oldStruct.GetValuesCount(); ++i) { - resultBuilder.Add(TString(oldStruct.GetType()->GetMemberName(i)), oldStruct.GetValue(i)); + resultBuilder.Add(TString(oldStruct.GetType()->GetMemberName(i)), oldStruct.GetValue(i)); } return resultBuilder.Build(); @@ -311,7 +311,7 @@ TRuntimeNode OptimizeExtend(TCallable& callable, const TTypeEnvironment& env) { } struct TOptimizationFuncMapFiller { - THashMap<TString, TCallableVisitFunc> Map; + THashMap<TString, TCallableVisitFunc> Map; TCallableVisitFuncProvider Provider; TOptimizationFuncMapFiller() diff --git a/ydb/library/yql/minikql/mkql_opt_literal_ut.cpp b/ydb/library/yql/minikql/mkql_opt_literal_ut.cpp index c1c0a5b79da..6757b6b369d 100644 --- a/ydb/library/yql/minikql/mkql_opt_literal_ut.cpp +++ b/ydb/library/yql/minikql/mkql_opt_literal_ut.cpp @@ -143,7 +143,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLLPOTest) { TTypeEnvironment env(alloc); TProgramBuilder pgmBuilder(env, *functionRegistry); - TVector<TRuntimeNode> items; + TVector<TRuntimeNode> items; items.push_back(pgmBuilder.NewDataLiteral<ui32>(1)); items.push_back(pgmBuilder.NewDataLiteral<ui32>(2)); auto list = pgmBuilder.AsList(items); @@ -165,7 +165,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLLPOTest) { TTypeEnvironment env(alloc); TProgramBuilder pgmBuilder(env, *functionRegistry); - TVector<TRuntimeNode> items; + TVector<TRuntimeNode> items; items.push_back(pgmBuilder.NewDataLiteral<ui32>(1)); items.push_back(pgmBuilder.NewDataLiteral<ui32>(2)); auto list = pgmBuilder.AsList(items); @@ -187,7 +187,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLLPOTest) { TTypeEnvironment env(alloc); TProgramBuilder pgmBuilder(env, *functionRegistry); - TVector<TRuntimeNode> items; + TVector<TRuntimeNode> items; items.push_back(pgmBuilder.NewDataLiteral<ui32>(1)); items.push_back(pgmBuilder.NewDataLiteral<ui32>(2)); auto list = pgmBuilder.AsList(items); @@ -209,7 +209,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLLPOTest) { TTypeEnvironment env(alloc); TProgramBuilder pgmBuilder(env, *functionRegistry); - TVector<TRuntimeNode> items; + TVector<TRuntimeNode> items; items.push_back(pgmBuilder.NewDataLiteral<ui32>(1)); items.push_back(pgmBuilder.NewDataLiteral<ui32>(2)); auto list = pgmBuilder.AsList(items); @@ -231,7 +231,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLLPOTest) { TTypeEnvironment env(alloc); TProgramBuilder pgmBuilder(env, *functionRegistry); - TVector<TRuntimeNode> items; + TVector<TRuntimeNode> items; items.push_back(pgmBuilder.NewDataLiteral<ui32>(1)); items.push_back(pgmBuilder.NewDataLiteral<ui32>(2)); auto list = pgmBuilder.AsList(items); @@ -291,7 +291,7 @@ Y_UNIT_TEST_SUITE(TMiniKQLLPOTest) { TTypeEnvironment env(alloc); TProgramBuilder pgmBuilder(env, *functionRegistry); - TVector<TRuntimeNode> elements(2); + TVector<TRuntimeNode> elements(2); elements[0] = pgmBuilder.NewDataLiteral<NUdf::EDataSlot::String>("34"); elements[1] = pgmBuilder.NewDataLiteral<ui32>(56); auto tuple = pgmBuilder.NewTuple(elements); diff --git a/ydb/library/yql/minikql/mkql_stats_registry.cpp b/ydb/library/yql/minikql/mkql_stats_registry.cpp index 431737731ac..b34f94705c6 100644 --- a/ydb/library/yql/minikql/mkql_stats_registry.cpp +++ b/ydb/library/yql/minikql/mkql_stats_registry.cpp @@ -49,13 +49,13 @@ private: } private: - TVector<i64> Values_; + TVector<i64> Values_; }; /** * Key names set to prevent keys accidental duplication. */ -class TKeyNames: private THashSet<TStringBuf> { +class TKeyNames: private THashSet<TStringBuf> { public: bool AddIfNotExists(TStringBuf name) { return insert(name).second; diff --git a/ydb/library/yql/minikql/mkql_stats_registry_ut.cpp b/ydb/library/yql/minikql/mkql_stats_registry_ut.cpp index 0504fb2986b..e82a9ea4931 100644 --- a/ydb/library/yql/minikql/mkql_stats_registry_ut.cpp +++ b/ydb/library/yql/minikql/mkql_stats_registry_ut.cpp @@ -59,7 +59,7 @@ Y_UNIT_TEST_SUITE(TStatsRegistryTest) { } Y_UNIT_TEST(DuplicateKeys) { - TString error; + TString error; try { static TStatKey key("my_key", false), sameKey("my_key", false); // avoid variables elimitation diff --git a/ydb/library/yql/minikql/mkql_type_builder.cpp b/ydb/library/yql/minikql/mkql_type_builder.cpp index 4aecb564bf7..9144756b4a6 100644 --- a/ydb/library/yql/minikql/mkql_type_builder.cpp +++ b/ydb/library/yql/minikql/mkql_type_builder.cpp @@ -13,7 +13,7 @@ namespace NKikimr { namespace { -static const TString UdfName("UDF"); +static const TString UdfName("UDF"); class TCallablePayload : public NUdf::ICallablePayload { public: @@ -51,8 +51,8 @@ public: private: NUdf::TStringRef Payload_; - TVector<NUdf::TStringRef> ArgsNames_; - TVector<ui64> ArgsFlags_; + TVector<NUdf::TStringRef> ArgsNames_; + TVector<ui64> ArgsFlags_; }; ///////////////////////////////////////////////////////////////////////////// @@ -426,7 +426,7 @@ public: private: const NMiniKQL::TFunctionTypeInfoBuilder& Parent_; - TVector<NMiniKQL::TType*> ElementTypes_; + TVector<NMiniKQL::TType*> ElementTypes_; }; ///////////////////////////////////////////////////////////////////////////// @@ -541,7 +541,7 @@ public: private: const NMiniKQL::TTypeEnvironment& Env_; NMiniKQL::TType* ReturnType_; - TVector<NMiniKQL::TType*> ArgsTypes_; + TVector<NMiniKQL::TType*> ArgsTypes_; ui32 OptionalArgs_; }; @@ -553,7 +553,7 @@ class TFunctionArgTypesBuilder: public NUdf::IFunctionArgTypesBuilder public: explicit TFunctionArgTypesBuilder( NMiniKQL::TFunctionTypeInfoBuilder& parent, - TVector<NMiniKQL::TArgInfo>& args) + TVector<NMiniKQL::TArgInfo>& args) : NUdf::IFunctionArgTypesBuilder(parent) , Env_(parent.Env()) , Args_(args) @@ -595,7 +595,7 @@ public: private: const NMiniKQL::TTypeEnvironment& Env_; - TVector<NMiniKQL::TArgInfo>& Args_; + TVector<NMiniKQL::TArgInfo>& Args_; }; ////////////////////////////////////////////////////////////////////////////// diff --git a/ydb/library/yql/minikql/mkql_type_builder.h b/ydb/library/yql/minikql/mkql_type_builder.h index a93fb41cee3..ead9a506552 100644 --- a/ydb/library/yql/minikql/mkql_type_builder.h +++ b/ydb/library/yql/minikql/mkql_type_builder.h @@ -69,7 +69,7 @@ public: void SetError(const NUdf::TStringRef& error) override; inline bool HasError() const { return !Error_.empty(); } - inline const TString& GetError() const { return Error_; } + inline const TString& GetError() const { return Error_; } void Build(TFunctionTypeInfo* funcInfo); @@ -126,10 +126,10 @@ private: const TType* ReturnType_; const TType* RunConfigType_; const TType* UserType_; - TVector<TArgInfo> Args_; - TString Error_; + TVector<TArgInfo> Args_; + TString Error_; ui32 OptionalArgs_ = 0; - TString Payload_; + TString Payload_; NUdf::ITypeInfoHelper::TPtr TypeInfoHelper_; TStringBuf ModuleName_; NUdf::ICountersProvider* CountersProvider_; diff --git a/ydb/library/yql/minikql/mkql_utils.h b/ydb/library/yql/minikql/mkql_utils.h index 0c22d2857c5..6bf5db44bad 100644 --- a/ydb/library/yql/minikql/mkql_utils.h +++ b/ydb/library/yql/minikql/mkql_utils.h @@ -15,10 +15,10 @@ public: inline static TStatus Error(const TStringBuf& error) { Y_VERIFY_DEBUG(!error.empty()); - return TStatus(TString(error)); + return TStatus(TString(error)); } - inline static TStatus Error(TString&& error) { + inline static TStatus Error(TString&& error) { Y_VERIFY_DEBUG(!error.empty()); return TStatus(std::move(error)); } @@ -37,20 +37,20 @@ public: return Error_.empty(); } - inline const TString& GetError() const { + inline const TString& GetError() const { return Error_; } private: inline TStatus() = default; - inline TStatus(TString&& error) + inline TStatus(TString&& error) : Error_(std::move(error)) { } private: - TString Error_; + TString Error_; }; } // namespace NMiniKQL diff --git a/ydb/library/yql/parser/proto_ast/proto_ast.cpp b/ydb/library/yql/parser/proto_ast/proto_ast.cpp index 097ba08c854..adf6bd48206 100644 --- a/ydb/library/yql/parser/proto_ast/proto_ast.cpp +++ b/ydb/library/yql/parser/proto_ast/proto_ast.cpp @@ -12,7 +12,7 @@ IErrorCollector::~IErrorCollector() { } -void IErrorCollector::Error(ui32 line, ui32 col, const TString& message) { +void IErrorCollector::Error(ui32 line, ui32 col, const TString& message) { if (NumErrors + 1 == MaxErrors) { AddError(0, 0, "Too many errors"); ++NumErrors; @@ -37,7 +37,7 @@ TErrorOutput::~TErrorOutput() { } -void TErrorOutput::AddError(ui32 line, ui32 col, const TString& message) { +void TErrorOutput::AddError(ui32 line, ui32 col, const TString& message) { if (!Name.empty()) { Err << "Query " << Name << ": "; } diff --git a/ydb/library/yql/parser/proto_ast/proto_ast.h b/ydb/library/yql/parser/proto_ast/proto_ast.h index 5bb8a9f5f9c..fcbf78ebf16 100644 --- a/ydb/library/yql/parser/proto_ast/proto_ast.h +++ b/ydb/library/yql/parser/proto_ast/proto_ast.h @@ -41,10 +41,10 @@ namespace NProtoAST { virtual ~IErrorCollector(); // throws TTooManyErrors - void Error(ui32 line, ui32 col, const TString& message); + void Error(ui32 line, ui32 col, const TString& message); private: - virtual void AddError(ui32 line, ui32 col, const TString& message) = 0; + virtual void AddError(ui32 line, ui32 col, const TString& message) = 0; protected: const size_t MaxErrors; @@ -61,7 +61,7 @@ namespace NProtoAST { public: IOutputStream& Err; - TString Name; + TString Name; }; template <typename TParser, typename TLexer> @@ -92,7 +92,7 @@ namespace NProtoAST { } private: - TString QueryName; + TString QueryName; typename TLexer::InputStreamType InputStream; TLexer Lexer; diff --git a/ydb/library/yql/providers/common/codec/yql_codec.cpp b/ydb/library/yql/providers/common/codec/yql_codec.cpp index 7587e188fab..8a1e4ea76c0 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec.cpp +++ b/ydb/library/yql/providers/common/codec/yql_codec.cpp @@ -245,7 +245,7 @@ void WriteYsonValue(NYson::TYsonConsumerBase& writer, const NUdf::TUnboxedValueP WriteYsonValueImpl(resultWriter, value, type, structPositions); } -TString WriteYsonValue(const NUdf::TUnboxedValuePod& value, TType* type, const TVector<ui32>* structPositions, +TString WriteYsonValue(const NUdf::TUnboxedValuePod& value, TType* type, const TVector<ui32>* structPositions, NYson::EYsonFormat format) { TStringStream str; NYson::TYsonWriter writer(&str, format); @@ -264,13 +264,13 @@ TCodecContext::TCodecContext( { } -TMaybe<TVector<ui32>> CreateStructPositions(TType* inputType, const TVector<TString>* columns) { +TMaybe<TVector<ui32>> CreateStructPositions(TType* inputType, const TVector<TString>* columns) { if (inputType->GetKind() != TType::EKind::Struct) { return Nothing(); } auto inputStruct = AS_TYPE(TStructType, inputType); - TMap<TStringBuf, ui32> members; - TVector<ui32> structPositions(inputStruct->GetMembersCount(), Max<ui32>()); + TMap<TStringBuf, ui32> members; + TVector<ui32> structPositions(inputStruct->GetMembersCount(), Max<ui32>()); for (ui32 i = 0; i < inputStruct->GetMembersCount(); ++i) { if (columns) { members.insert(std::make_pair(inputStruct->GetMemberName(i), i)); @@ -322,9 +322,9 @@ NYT::TNode DataValueToNode(const NKikimr::NUdf::TUnboxedValuePod& value, NKikimr case NUdf::TDataType<NUdf::TUtf8>::Id: case NUdf::TDataType<NUdf::TJson>::Id: case NUdf::TDataType<NUdf::TUuid>::Id: - return NYT::TNode(TString(value.AsStringRef())); + return NYT::TNode(TString(value.AsStringRef())); case NUdf::TDataType<NUdf::TYson>::Id: - return NYT::NodeFromYsonString(TString(value.AsStringRef())); + return NYT::NodeFromYsonString(TString(value.AsStringRef())); case NUdf::TDataType<NUdf::TDate>::Id: return NYT::TNode((ui64)value.Get<ui16>()); case NUdf::TDataType<NUdf::TDatetime>::Id: diff --git a/ydb/library/yql/providers/common/codec/yql_codec.h b/ydb/library/yql/providers/common/codec/yql_codec.h index 512e01224c4..49315d08f3e 100644 --- a/ydb/library/yql/providers/common/codec/yql_codec.h +++ b/ydb/library/yql/providers/common/codec/yql_codec.h @@ -31,16 +31,16 @@ void WriteYsonValue( const TVector<ui32>* structPositions = nullptr ); -TString WriteYsonValue( +TString WriteYsonValue( const NKikimr::NUdf::TUnboxedValuePod& value, NKikimr::NMiniKQL::TType* type, - const TVector<ui32>* structPositions = nullptr, + const TVector<ui32>* structPositions = nullptr, NYson::EYsonFormat format = NYson::EYsonFormat::Binary ); -TMaybe<TVector<ui32>> CreateStructPositions( +TMaybe<TVector<ui32>> CreateStructPositions( NKikimr::NMiniKQL::TType* inputType, - const TVector<TString>* columns = nullptr + const TVector<TString>* columns = nullptr ); NYT::TNode ValueToNode(const NKikimr::NUdf::TUnboxedValuePod& value, NKikimr::NMiniKQL::TType* type); diff --git a/ydb/library/yql/providers/common/config/yql_dispatch.h b/ydb/library/yql/providers/common/config/yql_dispatch.h index 7389cbf082b..2d32f03cc53 100644 --- a/ydb/library/yql/providers/common/config/yql_dispatch.h +++ b/ydb/library/yql/providers/common/config/yql_dispatch.h @@ -64,9 +64,9 @@ TParser<TInstant> GetDefaultParser<TInstant>(); XX(TDuration) #define YQL_CONTAINER_SETTING_PARSER_TYPES(XX) \ - XX(TVector<TString>) \ - XX(TSet<TString>) \ - XX(THashSet<TString>) + XX(TVector<TString>) \ + XX(TSet<TString>) \ + XX(THashSet<TString>) #define YQL_DECLARE_SETTING_PARSER(type) \ template<> \ @@ -203,7 +203,7 @@ public: template <class TContainer> TSettingHandlerImpl& Enum(const TContainer& container) { - THashSet<TType> allowed(container.cbegin(), container.cend()); + THashSet<TType> allowed(container.cbegin(), container.cend()); Validators_.push_back([allowed = std::move(allowed)](const TString&, TType value) { if (!allowed.has(value)) { throw yexception() << "Value " << value << " is not in set of allowed values: " << JoinSeq(TStringBuf(","), allowed); @@ -213,7 +213,7 @@ public: } TSettingHandlerImpl& Enum(std::initializer_list<TType> list) { - THashSet<TType> allowed(list); + THashSet<TType> allowed(list); Validators_.push_back([allowed = std::move(allowed)](const TString&, TType value) { if (!allowed.contains(value)) { throw yexception() << "Value " << value << " is not in set of allowed values: " << JoinSeq(TStringBuf(","), allowed); @@ -295,7 +295,7 @@ public: TMaybe<TConfSetting<TType, RUNTIME>> Defaul_; ::NYql::NPrivate::TParser<TType> Parser_; TValueCallback ValueSetter_; - TVector<TValueCallback> Validators_; + TVector<TValueCallback> Validators_; }; TSettingDispatcher() = default; @@ -358,8 +358,8 @@ protected: static bool Allow(const TActivation& activation, const TString& userName); protected: - THashSet<TString> ValidClusters; - THashMap<TString, TSettingHandler::TPtr> Handlers; + THashSet<TString> ValidClusters; + THashMap<TString, TSettingHandler::TPtr> Handlers; }; } // namespace NCommon diff --git a/ydb/library/yql/providers/common/metrics/metrics_registry.cpp b/ydb/library/yql/providers/common/metrics/metrics_registry.cpp index 1fb7bdcbba7..8a510aef9f7 100644 --- a/ydb/library/yql/providers/common/metrics/metrics_registry.cpp +++ b/ydb/library/yql/providers/common/metrics/metrics_registry.cpp @@ -28,7 +28,7 @@ public: private: void OnCounter( - const TString& labelName, const TString& labelValue, + const TString& labelName, const TString& labelValue, const TSensorCounter* counter) override { HasAnyCounters_ = true; @@ -67,7 +67,7 @@ private: } void OnGroupBegin( - const TString& labelName, const TString& labelValue, + const TString& labelName, const TString& labelValue, const TSensorsGroup*) override { if (labelName.empty() && labelValue.empty()) { @@ -88,7 +88,7 @@ private: } private: - TStack<NProto::TCounterGroup*> GroupsProto_; + TStack<NProto::TCounterGroup*> GroupsProto_; bool HasAnyCounters_; bool Invalidate_; }; @@ -100,7 +100,7 @@ class TMetricsRegistryImpl final: public IMetricsRegistry { public: TMetricsRegistryImpl( TSensorsGroupPtr sensors, - TMaybe<TString> userName) + TMaybe<TString> userName) : Sensors_(std::move(sensors)) , UserName_(std::move(userName)) { @@ -130,8 +130,8 @@ public: } void IncCounter( - const TString& labelName, - const TString& labelValue, + const TString& labelName, + const TString& labelValue, bool derivative) override { // total aggregate counter @@ -175,7 +175,7 @@ public: bool TakeSnapshot(NProto::TMetricsRegistrySnapshot* snapshot) const override { bool hasRootGroupBefore = snapshot->HasRootGroup(); TCountersPhotographer photographer(snapshot->MutableRootGroup(), snapshot->GetDontIncrement() == false); - Sensors_->Accept(TString(), TString(), photographer); + Sensors_->Accept(TString(), TString(), photographer); if (!photographer.HasAnyCounters() && !hasRootGroupBefore) { // remove prematurely allocated group snapshot->ClearRootGroup(); @@ -209,16 +209,16 @@ public: private: TSensorCounterPtr GetCounter( - const TString& labelName, - const TString& labelValue, - const TString* userName, + const TString& labelName, + const TString& labelValue, + const TString* userName, bool derivative) { - static const TString USER("user"); - static const TString USER_ABSOLUTE("user_absolute"); - static const TString TOTAL("total"); + static const TString USER("user"); + static const TString USER_ABSOLUTE("user_absolute"); + static const TString TOTAL("total"); - const TString& userGroup = derivative ? USER : USER_ABSOLUTE; + const TString& userGroup = derivative ? USER : USER_ABSOLUTE; return Sensors_ ->GetSubgroup(userGroup, userName ? *userName : TOTAL) ->GetNamedCounter(labelName, labelValue, derivative); @@ -273,7 +273,7 @@ private: private: TSensorsGroupPtr Sensors_; - const TMaybe<TString> UserName_; + const TMaybe<TString> UserName_; THashMap<NMonitoring::THistogramPtr, NMonitoring::IHistogramCollector*> Histograms; }; diff --git a/ydb/library/yql/providers/common/metrics/metrics_registry.h b/ydb/library/yql/providers/common/metrics/metrics_registry.h index d344ba9dd98..98343e98e14 100644 --- a/ydb/library/yql/providers/common/metrics/metrics_registry.h +++ b/ydb/library/yql/providers/common/metrics/metrics_registry.h @@ -14,7 +14,7 @@ struct IMetricsRegistry; using IMetricsRegistryPtr = TIntrusivePtr<IMetricsRegistry>; using TMetricsDecorator = std::function<IMetricsRegistryPtr( - const IMetricsRegistryPtr& old, const TString& username)>; + const IMetricsRegistryPtr& old, const TString& username)>; ////////////////////////////////////////////////////////////////////////////// // IYqlMetricsRegistry @@ -28,8 +28,8 @@ struct IMetricsRegistry: public TThrRefBase { bool derivative = false) = 0; virtual void IncCounter( - const TString& labelName, - const TString& labelValue, + const TString& labelName, + const TString& labelValue, bool derivative = true) = 0; virtual void AddCounter( @@ -46,7 +46,7 @@ struct IMetricsRegistry: public TThrRefBase { const NProto::TMetricsRegistrySnapshot& snapshot) = 0; virtual IMetricsRegistryPtr Personalized( - const TString& userName) const = 0; + const TString& userName) const = 0; virtual void Flush() = 0; diff --git a/ydb/library/yql/providers/common/metrics/sensors_group.h b/ydb/library/yql/providers/common/metrics/sensors_group.h index 956a0c6fe22..4e3ab324291 100644 --- a/ydb/library/yql/providers/common/metrics/sensors_group.h +++ b/ydb/library/yql/providers/common/metrics/sensors_group.h @@ -5,10 +5,10 @@ namespace NYql { namespace NSensorComponent { - static const TString kExecutor = "executor"; - static const TString kWorkerServer = "worker_server"; - static const TString kDataServer = "data_server"; - static const TString kInspectorClient = "inspector_client"; + static const TString kExecutor = "executor"; + static const TString kWorkerServer = "worker_server"; + static const TString kDataServer = "data_server"; + static const TString kInspectorClient = "inspector_client"; static const TString kDq = "dq"; } // namspace NSensorComponent @@ -22,8 +22,8 @@ using TSensorCounterPtr = TIntrusivePtr<TSensorCounter>; TSensorsGroupPtr GetSensorsRootGroup(); -inline TSensorsGroupPtr GetSensorsGroupFor(const TString& compName) { - static TString compLabel("component"); +inline TSensorsGroupPtr GetSensorsGroupFor(const TString& compName) { + static TString compLabel("component"); return GetSensorsRootGroup()->GetSubgroup(compLabel, compName); } diff --git a/ydb/library/yql/providers/common/mkql/yql_provider_mkql.h b/ydb/library/yql/providers/common/mkql/yql_provider_mkql.h index a25c03b488e..2c3a95861d0 100644 --- a/ydb/library/yql/providers/common/mkql/yql_provider_mkql.h +++ b/ydb/library/yql/providers/common/mkql/yql_provider_mkql.h @@ -64,7 +64,7 @@ public: virtual void OverrideCallable(const std::string_view& name, TCompiler compiler); private: - THashMap<TString, TCompiler> Callables; + THashMap<TString, TCompiler> Callables; protected: void AddSimpleCallables(const std::initializer_list<std::pair<std::string_view, NKikimr::NMiniKQL::TProgramBuilder::UnaryFunctionMethod>>& callables); diff --git a/ydb/library/yql/providers/common/mkql/yql_type_mkql.cpp b/ydb/library/yql/providers/common/mkql/yql_type_mkql.cpp index 4ba0e6d7402..d0575cf7aab 100644 --- a/ydb/library/yql/providers/common/mkql/yql_type_mkql.cpp +++ b/ydb/library/yql/providers/common/mkql/yql_type_mkql.cpp @@ -66,7 +66,7 @@ NKikimr::NMiniKQL::TType* BuildType(const TTypeAnnotationNode& annotation, NKiki case ETypeAnnotationKind::Tuple: { auto tuple = annotation.Cast<TTupleExprType>(); - TVector<NKikimr::NMiniKQL::TType*> elements; + TVector<NKikimr::NMiniKQL::TType*> elements; elements.reserve(tuple->GetItems().size()); for (auto& child : tuple->GetItems()) { elements.push_back(BuildType(*child, pgmBuilder, err, withTagged)); @@ -242,7 +242,7 @@ const TTypeAnnotationNode* ConvertMiniKQLType(TPosition position, NKikimr::NMini case TType::EKind::Struct: { - TVector<const TItemExprType*> items; + TVector<const TItemExprType*> items; auto structType = static_cast<TStructType*>(type); for (ui32 index = 0; index < structType->GetMembersCount(); ++index) { auto memberType = ConvertMiniKQLType(position, structType->GetMemberType(index), ctx); @@ -282,9 +282,9 @@ const TTypeAnnotationNode* ConvertMiniKQLType(TPosition position, NKikimr::NMini case TType::EKind::Callable: { - TVector<TCallableExprType::TArgumentInfo> arguments; + TVector<TCallableExprType::TArgumentInfo> arguments; auto callableType = static_cast<TCallableType*>(type); - TString payload; + TString payload; for (ui32 index = 0; index < callableType->GetArgumentsCount(); ++index) { auto argType = ConvertMiniKQLType(position, callableType->GetArgumentType(index), ctx); TCallableExprType::TArgumentInfo arg; @@ -313,7 +313,7 @@ const TTypeAnnotationNode* ConvertMiniKQLType(TPosition position, NKikimr::NMini case TType::EKind::Tuple: { - TTypeAnnotationNode::TListType elements; + TTypeAnnotationNode::TListType elements; auto tupleType = static_cast<TTupleType*>(type); for (ui32 index = 0; index < tupleType->GetElementsCount(); ++index) { auto elementType = ConvertMiniKQLType(position, tupleType->GetElementType(index), ctx); diff --git a/ydb/library/yql/providers/common/provider/yql_provider.cpp b/ydb/library/yql/providers/common/provider/yql_provider.cpp index aa782ee93ff..e6757ba3c61 100644 --- a/ydb/library/yql/providers/common/provider/yql_provider.cpp +++ b/ydb/library/yql/providers/common/provider/yql_provider.cpp @@ -49,9 +49,9 @@ bool TCommitSettings::EnsureOtherEmpty(TExprContext& ctx) { } TCoNameValueTupleList TCommitSettings::BuildNode(TExprContext& ctx) const { - TVector<TExprBase> settings; + TVector<TExprBase> settings; - auto addSettings = [this, &settings, &ctx] (const TString& name, TMaybeNode<TExprBase> value) { + auto addSettings = [this, &settings, &ctx] (const TString& name, TMaybeNode<TExprBase> value) { if (value) { auto node = Build<TCoNameValueTuple>(ctx, Pos) @@ -79,7 +79,7 @@ TCoNameValueTupleList TCommitSettings::BuildNode(TExprContext& ctx) const { } const TStructExprType* BuildCommonTableListType(TExprContext& ctx) { - TVector<const TItemExprType*> items; + TVector<const TItemExprType*> items; auto stringType = ctx.MakeType<TDataExprType>(EDataSlot::String); auto listOfString = ctx.MakeType<TListExprType>(stringType); @@ -106,8 +106,8 @@ bool HasResOrPullOption(const TExprNode& node, const TStringBuf& option) { return false; } -TVector<TString> GetResOrPullColumnHints(const TExprNode& node) { - TVector<TString> columns; +TVector<TString> GetResOrPullColumnHints(const TExprNode& node) { + TVector<TString> columns; auto setting = GetSetting(*node.Child(4), "columns"); if (setting) { auto type = node.Head().GetTypeAnn(); @@ -122,7 +122,7 @@ TVector<TString> GetResOrPullColumnHints(const TExprNode& node) { return columns; } -TString FullTableName(const TStringBuf& cluster, const TStringBuf& table) { +TString FullTableName(const TStringBuf& cluster, const TStringBuf& table) { return TStringBuilder() << cluster << ".[" << table << "]"; } @@ -322,7 +322,7 @@ TCommitSettings ParseCommitSettings(NNodes::TCoCommit node, TExprContext& ctx) { TMaybeNode<TCoAtom> mode; TMaybeNode<TCoAtom> epoch; - TVector<TExprBase> other; + TVector<TExprBase> other; if (node.Settings()) { auto settings = node.Settings().Cast(); @@ -351,15 +351,15 @@ TCommitSettings ParseCommitSettings(NNodes::TCoCommit node, TExprContext& ctx) { return ret; } -TVector<TString> GetStructFields(const TTypeAnnotationNode* type) { - TVector<TString> fields; +TVector<TString> GetStructFields(const TTypeAnnotationNode* type) { + TVector<TString> fields; if (type->GetKind() == ETypeAnnotationKind::List) { type = type->Cast<TListExprType>()->GetItemType(); } if (type->GetKind() == ETypeAnnotationKind::Struct) { auto structType = type->Cast<TStructExprType>(); for (auto& member : structType->GetItems()) { - fields.push_back(TString(member->GetName())); + fields.push_back(TString(member->GetName())); } } return fields; diff --git a/ydb/library/yql/providers/common/provider/yql_provider.h b/ydb/library/yql/providers/common/provider/yql_provider.h index 9e80cfd1355..fed5dfabf89 100644 --- a/ydb/library/yql/providers/common/provider/yql_provider.h +++ b/ydb/library/yql/providers/common/provider/yql_provider.h @@ -10,7 +10,7 @@ #include <library/cpp/yson/writer.h> #include <util/generic/hash_set.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <utility> @@ -83,7 +83,7 @@ TExprNode::TPtr BuildTypeExpr(TPositionHandle pos, const TTypeAnnotationNode& an bool HasResOrPullOption(const TExprNode& node, const TStringBuf& option); -TVector<TString> GetResOrPullColumnHints(const TExprNode& node); +TVector<TString> GetResOrPullColumnHints(const TExprNode& node); TWriteTableSettings ParseWriteTableSettings(NNodes::TExprList node, TExprContext& ctx); @@ -91,12 +91,12 @@ TWriteRoleSettings ParseWriteRoleSettings(NNodes::TExprList node, TExprContext& TCommitSettings ParseCommitSettings(NNodes::TCoCommit node, TExprContext& ctx); -TString FullTableName(const TStringBuf& cluster, const TStringBuf& table); +TString FullTableName(const TStringBuf& cluster, const TStringBuf& table); IDataProvider::TFillSettings GetFillSettings(const TExprNode& node); NYson::EYsonFormat GetYsonFormat(const IDataProvider::TFillSettings& fillSettings); -TVector<TString> GetStructFields(const TTypeAnnotationNode* type); +TVector<TString> GetStructFields(const TTypeAnnotationNode* type); void TransformerStatsToYson(const TString& name, const IGraphTransformer::TStatistics& stats, NYson::TYsonWriter& writer); diff --git a/ydb/library/yql/providers/common/provider/yql_table_lookup.cpp b/ydb/library/yql/providers/common/provider/yql_table_lookup.cpp index 93b84f6db00..39c7fa4545a 100644 --- a/ydb/library/yql/providers/common/provider/yql_table_lookup.cpp +++ b/ydb/library/yql/providers/common/provider/yql_table_lookup.cpp @@ -11,7 +11,7 @@ using namespace NNodes; namespace { template<typename TCompare> -TExprBase BuildColumnCompare(TExprBase row, const TString& columnName, TExprBase value, TExprContext& ctx) { +TExprBase BuildColumnCompare(TExprBase row, const TString& columnName, TExprBase value, TExprContext& ctx) { auto compare = Build<TCompare>(ctx, row.Pos()) .template Left<TCoMember>() .Struct(row) @@ -62,7 +62,7 @@ TMaybeNode<TExprBase> CombinePredicatesOr(TMaybeNode<TExprBase> left, TMaybeNode } template<typename TItem, typename TFunc> -TMaybeNode<TExprBase> CombinePredicateListOr(const TVector<TItem>& list, TExprContext& ctx, +TMaybeNode<TExprBase> CombinePredicateListOr(const TVector<TItem>& list, TExprContext& ctx, TFunc getPredicateFunc) { if (list.empty()) { @@ -78,7 +78,7 @@ TMaybeNode<TExprBase> CombinePredicateListOr(const TVector<TItem>& list, TExprCo return residualPredicate; } -TMaybeNode<TExprBase> BuildColumnRangePredicate(const TString& column, const TColumnRange& range, +TMaybeNode<TExprBase> BuildColumnRangePredicate(const TString& column, const TColumnRange& range, TExprBase row, TExprContext& ctx) { if (range.IsNull()) { @@ -123,7 +123,7 @@ TMaybeNode<TExprBase> BuildColumnRangePredicate(const TString& column, const TCo return TMaybeNode<TExprBase>(); } -TMaybeNode<TExprBase> BuildKeyRangePredicate(const TVector<TString>& columns, const TKeyRange& keyRange, +TMaybeNode<TExprBase> BuildKeyRangePredicate(const TVector<TString>& columns, const TKeyRange& keyRange, TExprBase row, TExprContext& ctx) { YQL_ENSURE(columns.size() == keyRange.GetColumnRangesCount()); @@ -229,7 +229,7 @@ TColumnRange MakeColumnRange(TRangeBound left, TRangeBound right, const TLookupC class TKeyRangeBuilder { public: - TKeyRangeBuilder(const TVector<TString>& keyColumns) + TKeyRangeBuilder(const TVector<TString>& keyColumns) : KeyColumns(keyColumns) { for (auto& keyColumn : keyColumns) { @@ -244,12 +244,12 @@ public: bool IsFullScan() const { return std::find_if(ColumnRanges.begin(), ColumnRanges.end(), - [] (const std::pair<TString, TColumnRange>& pair) { + [] (const std::pair<TString, TColumnRange>& pair) { return pair.second.IsDefined(); }) == ColumnRanges.end(); } - const TVector<TString>& GetKeyColumns() const { + const TVector<TString>& GetKeyColumns() const { return KeyColumns; } @@ -280,7 +280,7 @@ public: ResidualPredicate = predicate; } - TMaybeNode<TExprBase> BuildPredicate(const TVector<TString>& columns, + TMaybeNode<TExprBase> BuildPredicate(const TVector<TString>& columns, TExprBase row, TExprContext& ctx) const { auto keyRange = BuildKeyRange(row, ctx); @@ -293,10 +293,10 @@ public: } auto newResidualPredicate = ResidualPredicate; - TVector<TColumnRange> newColumnRanges; + TVector<TColumnRange> newColumnRanges; bool keyRangeFinished = false; - for (const TString& column : KeyColumns) { + for (const TString& column : KeyColumns) { auto columnRange = GetColumnRange(column); if (keyRangeFinished) { @@ -315,22 +315,22 @@ public: } private: - TVector<TString> KeyColumns; - THashMap<TString, TColumnRange> ColumnRanges; + TVector<TString> KeyColumns; + THashMap<TString, TColumnRange> ColumnRanges; TMaybeNode<TExprBase> ResidualPredicate; }; class TTableLookupBuilder { public: - TTableLookupBuilder(const TVector<TString>& keyColumns, const TVector<TKeyRangeBuilder>& keyRangeBuilders) + TTableLookupBuilder(const TVector<TString>& keyColumns, const TVector<TKeyRangeBuilder>& keyRangeBuilders) : KeyColumns(keyColumns) , KeyRangeBuilders(keyRangeBuilders) {} - TTableLookupBuilder(const TVector<TString>& keyColumns) + TTableLookupBuilder(const TVector<TString>& keyColumns) : TTableLookupBuilder(keyColumns, {}) {} - TTableLookupBuilder(const TVector<TString>& keyColumns, const TKeyRangeBuilder& keyRangeBuilder) - : TTableLookupBuilder(keyColumns, TVector<TKeyRangeBuilder>{keyRangeBuilder}) {} + TTableLookupBuilder(const TVector<TString>& keyColumns, const TKeyRangeBuilder& keyRangeBuilder) + : TTableLookupBuilder(keyColumns, TVector<TKeyRangeBuilder>{keyRangeBuilder}) {} bool IsSingleRange() const { return KeyRangeBuilders.size() == 1; @@ -346,7 +346,7 @@ public: return false; } - const TVector<TKeyRangeBuilder>& GetKeyRangeBuilders() const { + const TVector<TKeyRangeBuilder>& GetKeyRangeBuilders() const { return KeyRangeBuilders; } @@ -356,7 +356,7 @@ public: } TTableLookup BuildTableLookup(TExprBase row, const TLookupContext& ctx) const { - TVector<TKeyRange> keyRanges; + TVector<TKeyRange> keyRanges; for (auto& keyRangeBuilder : KeyRangeBuilders) { keyRanges.push_back(keyRangeBuilder.BuildKeyRange(row, ctx.ExprCtx)); } @@ -378,7 +378,7 @@ public: } private: - static bool TryBuildPointRanges(TVector<TKeyRange>& keyRanges, const TLookupContext& ctx) { + static bool TryBuildPointRanges(TVector<TKeyRange>& keyRanges, const TLookupContext& ctx) { YQL_ENSURE(keyRanges.size() > 1); const auto& firstRange = keyRanges[0]; @@ -448,7 +448,7 @@ private: return true; } - static bool CheckIndependentRanges(TVector<TKeyRange>& keyRanges, const TLookupContext& ctx) { + static bool CheckIndependentRanges(TVector<TKeyRange>& keyRanges, const TLookupContext& ctx) { for (auto& keyRange : keyRanges) { for (auto& columnRange : keyRange.GetColumnRanges()) { if (columnRange.GetFrom().IsDefined() && !ctx.CanCompareFunc(columnRange.GetFrom().GetValue())) { @@ -476,7 +476,7 @@ private: return true; } - TKeyRange BuildBoundingKeyRange(const TVector<TKeyRange> &keyRanges, + TKeyRange BuildBoundingKeyRange(const TVector<TKeyRange> &keyRanges, TExprBase row, TExprContext& ctx) const { YQL_ENSURE(keyRanges.size() > 0); @@ -491,8 +491,8 @@ private: } private: - TVector<TString> KeyColumns; - TVector<TKeyRangeBuilder> KeyRangeBuilders; + TVector<TString> KeyColumns; + TVector<TKeyRangeBuilder> KeyRangeBuilders; }; TKeyRangeBuilder CombineKeyRangesAnd(TExprBase row, const TVector<TString>& keyColumns, const TKeyRangeBuilder& left, @@ -502,7 +502,7 @@ TKeyRangeBuilder CombineKeyRangesAnd(TExprBase row, const TVector<TString>& keyC auto rp = CombinePredicatesAnd(left.GetResidualPredicate(), right.GetResidualPredicate(), ctx.ExprCtx); - for (const TString& column : left.GetKeyColumns()) { + for (const TString& column : left.GetKeyColumns()) { auto columnLeft = left.GetColumnRange(column); auto columnRight = right.GetColumnRange(column); @@ -563,7 +563,7 @@ TKeyRangeBuilder CombineKeyRangesAnd(TExprBase row, const TVector<TString>& keyC return combinedLookup; } -TTableLookupBuilder CombineLookupsAnd(TExprBase row, const TVector<TString>& keyColumns, +TTableLookupBuilder CombineLookupsAnd(TExprBase row, const TVector<TString>& keyColumns, const TTableLookupBuilder* builders, size_t size, const TLookupContext& ctx) { switch (size) { @@ -623,7 +623,7 @@ TTableLookupBuilder CombineLookupsOr(TExprBase, const TVector<TString>& keyColum } TTableLookupBuilder CollectLookups(TExprBase row, TExprBase predicate, - const TVector<TString>& keyColumns, const TLookupContext& ctx) + const TVector<TString>& keyColumns, const TLookupContext& ctx) { if (const auto maybeAnd = predicate.Maybe<TCoAnd>()) { const auto size = maybeAnd.Cast().Args().size(); @@ -783,7 +783,7 @@ TTableLookupBuilder CollectLookups(TExprBase row, TExprBase predicate, return fullScan; } - TVector<TKeyRangeBuilder> keyRanges; + TVector<TKeyRangeBuilder> keyRanges; keyRanges.reserve(size); for (const auto& key : collection->Children()) { auto maybeValue = ctx.GetValueFunc(TExprBase(key), member.Ref().GetTypeAnn(), ctx.ExprCtx); @@ -1041,7 +1041,7 @@ bool KeyTupleLess(const TKeyTuple& left, const TKeyTuple& right, const TTableLoo TTableLookup ExtractTableLookup( TExprBase row, TExprBase predicate, - const TVector<TString>& keyColumns, + const TVector<TString>& keyColumns, TTableLookup::TGetValueFunc getValueFunc, TTableLookup::TCanCompareFunc canCompareFunc, TTableLookup::TCompareFunc compareFunc, diff --git a/ydb/library/yql/providers/common/provider/yql_table_lookup.h b/ydb/library/yql/providers/common/provider/yql_table_lookup.h index 988fb5b4baa..c38386528e8 100644 --- a/ydb/library/yql/providers/common/provider/yql_table_lookup.h +++ b/ydb/library/yql/providers/common/provider/yql_table_lookup.h @@ -115,7 +115,7 @@ public: private: TExprContext* Ctx; - TVector<NNodes::TMaybeNode<NNodes::TExprBase>> Values; + TVector<NNodes::TMaybeNode<NNodes::TExprBase>> Values; bool From; bool Inclusive; }; @@ -135,7 +135,7 @@ public: return ColumnRanges[index]; } - const TVector<TColumnRange>& GetColumnRanges() const { + const TVector<TColumnRange>& GetColumnRanges() const { return ColumnRanges; } @@ -171,7 +171,7 @@ public: private: TExprContext* Ctx; - TVector<TColumnRange> ColumnRanges; + TVector<TColumnRange> ColumnRanges; NNodes::TMaybeNode<NNodes::TExprBase> ResidualPredicate; bool EquiRange; size_t NumDefined; @@ -206,15 +206,15 @@ public: typedef std::function<bool(NNodes::TExprBase)> TCanCompareFunc; typedef std::function<TCompareResult(NNodes::TExprBase, NNodes::TExprBase)> TCompareFunc; - TTableLookup(const TVector<TString>& keyColumns, const TVector<TKeyRange>& keyRanges) + TTableLookup(const TVector<TString>& keyColumns, const TVector<TKeyRange>& keyRanges) : KeyColumns(keyColumns) , KeyRanges(keyRanges) {} - const TVector<TString>& GetKeyColumns() const { + const TVector<TString>& GetKeyColumns() const { return KeyColumns; } - const TVector<TKeyRange>& GetKeyRanges() const { + const TVector<TKeyRange>& GetKeyRanges() const { return KeyRanges; } @@ -229,14 +229,14 @@ public: void Print(IOutputStream& output) const; private: - TVector<TString> KeyColumns; - TVector<TKeyRange> KeyRanges; + TVector<TString> KeyColumns; + TVector<TKeyRange> KeyRanges; }; TTableLookup ExtractTableLookup( NNodes::TExprBase row, NNodes::TExprBase predicate, - const TVector<TString>& keyColumns, + const TVector<TString>& keyColumns, TTableLookup::TGetValueFunc getValueFunc, TTableLookup::TCanCompareFunc canCompareFunc, TTableLookup::TCompareFunc compareFunc, diff --git a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp index 0bbaf5c3395..2291241de2b 100644 --- a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp +++ b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.cpp @@ -306,7 +306,7 @@ struct TExprTypeLoader { return Ctx.MakeType<TErrorExprType>(TIssue(TPosition(column, row, file), msg)); } TMaybe<TType> LoadStructType(const TVector<std::pair<TString, TType>>& members, ui32 /*level*/) { - TVector<const TItemExprType*> items; + TVector<const TItemExprType*> items; for (auto& member: members) { items.push_back(Ctx.MakeType<TItemExprType>(member.first, member.second)); } @@ -336,7 +336,7 @@ struct TExprTypeLoader { TMaybe<TType> LoadCallableType(TType returnType, const TVector<TType>& argTypes, const TVector<TString>& argNames, const TVector<ui64>& argFlags, size_t optionalCount, const TString& payload, ui32 /*level*/) { YQL_ENSURE(argTypes.size() == argNames.size() && argTypes.size() == argFlags.size()); - TVector<TCallableExprType::TArgumentInfo> args; + TVector<TCallableExprType::TArgumentInfo> args; for (size_t i = 0; i < argTypes.size(); ++i) { args.emplace_back(); args.back().Type = argTypes[i]; @@ -352,7 +352,7 @@ struct TExprTypeLoader { YQL_ENSURE(ret->Validate(TPosition(), Ctx)); return ret; } - void Error(const TString& info) { + void Error(const TString& info) { Ctx.AddError(TIssue(Pos, info)); } }; diff --git a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h index 397063052f1..e52dcfe9bff 100644 --- a/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h +++ b/ydb/library/yql/providers/common/schema/expr/yql_expr_schema.h @@ -37,7 +37,7 @@ const TTypeAnnotationNode* ParseTypeFromYson(const NYT::TNode& node, TExprContex const TTypeAnnotationNode* ParseOrderAwareTypeFromYson(const NYT::TNode& node, TVector<TString>& topLevelColumns, TExprContext& ctx, const TPosition& pos = TPosition()); void WriteResOrPullType(NYson::TYsonConsumerBase& writer, const TTypeAnnotationNode* type, - const TVector<TString>& columns); + const TVector<TString>& columns); } // namespace NCommon } // namespace NYql diff --git a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp index 0a341057146..bc84594c395 100644 --- a/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp +++ b/ydb/library/yql/providers/common/schema/mkql/yql_mkql_schema.cpp @@ -287,7 +287,7 @@ struct TRuntimeTypeLoader { TMaybe<TType> LoadVariantType(TType underlyingType, ui32 /*level*/) { return Builder.NewVariantType(underlyingType); } - void Error(const TString& info) { + void Error(const TString& info) { Err << info; } }; diff --git a/ydb/library/yql/providers/common/transform/yql_exec.cpp b/ydb/library/yql/providers/common/transform/yql_exec.cpp index f771ae2b18c..2a9f2add0d7 100644 --- a/ydb/library/yql/providers/common/transform/yql_exec.cpp +++ b/ydb/library/yql/providers/common/transform/yql_exec.cpp @@ -75,7 +75,7 @@ TExecTransformerBase::TPrerequisite TExecTransformerBase::RequireFirst() { } TExecTransformerBase::TPrerequisite TExecTransformerBase::RequireAllOf(std::initializer_list<size_t> children) { - return [required = TVector<size_t>(children)] (const TExprNode::TPtr& input) { + return [required = TVector<size_t>(children)] (const TExprNode::TPtr& input) { TStatus combinedStatus = TStatus::Ok; for (size_t i: required) { YQL_ENSURE(i < input->ChildrenSize()); @@ -86,7 +86,7 @@ TExecTransformerBase::TPrerequisite TExecTransformerBase::RequireAllOf(std::init } TExecTransformerBase::TPrerequisite TExecTransformerBase::RequireSequenceOf(std::initializer_list<size_t> children) { - return [required = TVector<size_t>(children)] (const TExprNode::TPtr& input) -> TStatus { + return [required = TVector<size_t>(children)] (const TExprNode::TPtr& input) -> TStatus { for (size_t i: required) { YQL_ENSURE(i < input->ChildrenSize()); auto status = RequireChild(*input, (ui32)i); diff --git a/ydb/library/yql/providers/common/transform/yql_exec.h b/ydb/library/yql/providers/common/transform/yql_exec.h index 0f134e56887..1f80b9dd331 100644 --- a/ydb/library/yql/providers/common/transform/yql_exec.h +++ b/ydb/library/yql/providers/common/transform/yql_exec.h @@ -64,7 +64,7 @@ protected: TPrerequisite Prerequisite; THandler Handler; }; - THashMap<TStringBuf, THandlerInfo> Handlers; + THashMap<TStringBuf, THandlerInfo> Handlers; }; } // NYql diff --git a/ydb/library/yql/providers/common/transform/yql_optimize.cpp b/ydb/library/yql/providers/common/transform/yql_optimize.cpp index ef29baa8ffe..a48dbe92b8c 100644 --- a/ydb/library/yql/providers/common/transform/yql_optimize.cpp +++ b/ydb/library/yql/providers/common/transform/yql_optimize.cpp @@ -167,7 +167,7 @@ TOptimizeTransformerBase::TFilter TOptimizeTransformerBase::Any() { } TOptimizeTransformerBase::TFilter TOptimizeTransformerBase::Names(std::initializer_list<TStringBuf> names) { - return [filter = THashSet<TStringBuf>(names)] (const TExprNode* node) { + return [filter = THashSet<TStringBuf>(names)] (const TExprNode* node) { return node->IsCallable(filter); }; } diff --git a/ydb/library/yql/providers/common/transform/yql_optimize.h b/ydb/library/yql/providers/common/transform/yql_optimize.h index d4d65b84f1c..71bbade55ba 100644 --- a/ydb/library/yql/providers/common/transform/yql_optimize.h +++ b/ydb/library/yql/providers/common/transform/yql_optimize.h @@ -102,13 +102,13 @@ protected: }; struct TStep { TProcessedNodesSet ProcessedNodes; - TVector<TOptInfo> Optimizers; + TVector<TOptInfo> Optimizers; bool Global = false; }; TTypeAnnotationContext* Types; const NLog::EComponent LogComponent; TSet<TString> DisabledOpts; - TVector<TStep> Steps; + TVector<TStep> Steps; }; } // NYql diff --git a/ydb/library/yql/providers/common/transform/yql_visit.h b/ydb/library/yql/providers/common/transform/yql_visit.h index 5e6212579ec..57bfa743221 100644 --- a/ydb/library/yql/providers/common/transform/yql_visit.h +++ b/ydb/library/yql/providers/common/transform/yql_visit.h @@ -65,7 +65,7 @@ protected: protected: const bool FailOnUnknown; - THashMap<TStringBuf, THandler> Handlers; + THashMap<TStringBuf, THandler> Handlers; }; } // NYql diff --git a/ydb/library/yql/providers/common/udf_resolve/yql_outproc_udf_resolver.cpp b/ydb/library/yql/providers/common/udf_resolve/yql_outproc_udf_resolver.cpp index dc31e0ef300..06bed80068e 100644 --- a/ydb/library/yql/providers/common/udf_resolve/yql_outproc_udf_resolver.cpp +++ b/ydb/library/yql/providers/common/udf_resolve/yql_outproc_udf_resolver.cpp @@ -160,7 +160,7 @@ public: } TResolve request; - THashMap<TString, TImport*> importMap; + THashMap<TString, TImport*> importMap; THoldingFileStorage holdingFileStorage(FileStorage_); THolder<TFilesBox> filesBox = CreateFilesBoxOverFileStorageTemp(); @@ -380,8 +380,8 @@ private: }; void LoadSystemModulePaths( - const TString& resolverPath, - const TString& dir, + const TString& resolverPath, + const TString& dir, TUdfModulePathsMap* paths) { const TList<TString> args = { TString("--list"), dir }; diff --git a/ydb/library/yql/providers/common/udf_resolve/yql_outproc_udf_resolver.h b/ydb/library/yql/providers/common/udf_resolve/yql_outproc_udf_resolver.h index 5659a833e41..a38d03bd2b9 100644 --- a/ydb/library/yql/providers/common/udf_resolve/yql_outproc_udf_resolver.h +++ b/ydb/library/yql/providers/common/udf_resolve/yql_outproc_udf_resolver.h @@ -6,14 +6,14 @@ #include <ydb/library/yql/providers/common/proto/udf_resolver.pb.h> #include <util/generic/map.h> -#include <util/generic/string.h> +#include <util/generic/string.h> namespace NYql { namespace NCommon { void LoadSystemModulePaths( - const TString& resolverPath, - const TString& dir, + const TString& resolverPath, + const TString& dir, NKikimr::NMiniKQL::TUdfModulePathsMap* paths); IUdfResolver::TPtr CreateOutProcUdfResolver( diff --git a/ydb/library/yql/providers/common/udf_resolve/yql_simple_udf_resolver.cpp b/ydb/library/yql/providers/common/udf_resolve/yql_simple_udf_resolver.cpp index 3aac3487c09..2d6f5d5f2e6 100644 --- a/ydb/library/yql/providers/common/udf_resolve/yql_simple_udf_resolver.cpp +++ b/ydb/library/yql/providers/common/udf_resolve/yql_simple_udf_resolver.cpp @@ -12,7 +12,7 @@ #include <util/generic/vector.h> #include <util/generic/hash_set.h> #include <util/generic/hash.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/system/guard.h> #include <util/system/spinlock.h> @@ -43,7 +43,7 @@ public: with_lock(Lock_) { bool hasErrors = false; - THashSet<TString> requiredModules; + THashSet<TString> requiredModules; for (auto udfPtr : functions) { auto& udf = *udfPtr; TStringBuf moduleName, funcName; @@ -52,13 +52,13 @@ public: "Incorrect format of function name: " << udf.Name)); hasErrors = true; } else { - requiredModules.insert(TString(moduleName)); + requiredModules.insert(TString(moduleName)); } } THoldingFileStorage holdingFileStorage(FileStorage_); auto newRegistry = FunctionRegistry_->Clone(); - THashMap<TString, TImport*> path2import; + THashMap<TString, TImport*> path2import; for (auto import: imports) { if (import->Modules) { bool needLibrary = false; diff --git a/ydb/library/yql/providers/config/yql_config_provider.cpp b/ydb/library/yql/providers/config/yql_config_provider.cpp index 6952e96cf07..497c72e21fe 100644 --- a/ydb/library/yql/providers/config/yql_config_provider.cpp +++ b/ydb/library/yql/providers/config/yql_config_provider.cpp @@ -121,7 +121,7 @@ namespace { class TConfigProvider : public TDataProviderBase { public: struct TFunctions { - THashSet<TStringBuf> Names; + THashSet<TStringBuf> Names; TFunctions() { Names.insert(ConfReadName); @@ -312,7 +312,7 @@ namespace { auto stringAnnotation = ctx.MakeType<TDataExprType>(EDataSlot::String); auto listOfString = ctx.MakeType<TListExprType>(stringAnnotation); - TTypeAnnotationNode::TListType children; + TTypeAnnotationNode::TListType children; children.push_back(input->Child(0)->GetTypeAnn()); if (tag == "data_sources" || tag == "data_sinks") { children.push_back(listOfString); @@ -344,7 +344,7 @@ namespace { TExprNode::TPtr RewriteIO(const TExprNode::TPtr& node, TExprContext& ctx) override { auto read = node->Child(0); - TString newName; + TString newName; if (read->Content() == ReadName) { newName = ConfReadName; } @@ -390,7 +390,7 @@ namespace { return *CallableExecutionTransformer; } - bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override { + bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override { Y_UNUSED(compact); if (CanExecute(node)) { children.push_back(node.ChildPtr(0)); @@ -406,7 +406,7 @@ namespace { writer.OnStringScalar(node.Child(0)->Content()); } - TString GetProviderPath(const TExprNode& node) override { + TString GetProviderPath(const TExprNode& node) override { Y_UNUSED(node); return "config"; } @@ -1004,7 +1004,7 @@ TIntrusivePtr<IDataProvider> CreateConfigProvider(TTypeAnnotationContext& types, return new TConfigProvider(types, config, policy); } -const THashSet<TStringBuf>& ConfigProviderFunctions() { +const THashSet<TStringBuf>& ConfigProviderFunctions() { return Singleton<TConfigProvider::TFunctions>()->Names; } diff --git a/ydb/library/yql/providers/config/yql_config_provider.h b/ydb/library/yql/providers/config/yql_config_provider.h index ea1f47508ac..57cd9b3d8be 100644 --- a/ydb/library/yql/providers/config/yql_config_provider.h +++ b/ydb/library/yql/providers/config/yql_config_provider.h @@ -15,6 +15,6 @@ using TAllowSettingPolicy = std::function<bool(TStringBuf settingName)>; TIntrusivePtr<IDataProvider> CreateConfigProvider(TTypeAnnotationContext& types, const TGatewaysConfig* config, const TAllowSettingPolicy& policy = TAllowSettingPolicy()); // allow all settings by default -const THashSet<TStringBuf>& ConfigProviderFunctions(); +const THashSet<TStringBuf>& ConfigProviderFunctions(); } // namespace NYql diff --git a/ydb/library/yql/providers/result/provider/yql_result_provider.cpp b/ydb/library/yql/providers/result/provider/yql_result_provider.cpp index 13bfd5e0f74..8f0846638b1 100644 --- a/ydb/library/yql/providers/result/provider/yql_result_provider.cpp +++ b/ydb/library/yql/providers/result/provider/yql_result_provider.cpp @@ -145,10 +145,10 @@ namespace { } auto structType = itemType->Cast<TStructExprType>(); - TSet<TString> usedFields; - TExprNode::TListType orderedFields; + TSet<TString> usedFields; + TExprNode::TListType orderedFields; for (auto& child : columns->Children()) { - TVector<TStringBuf> names; + TVector<TStringBuf> names; if (child->IsAtom()) { orderedFields.push_back(child); if (!structType->FindItem(child->Content())) { @@ -157,7 +157,7 @@ namespace { return IGraphTransformer::TStatus::Error; } - if (!usedFields.insert(TString(child->Content())).second) { + if (!usedFields.insert(TString(child->Content())).second) { ctx.AddError(TIssue(ctx.GetPosition(child->Pos()), TStringBuilder() << "Duplicate field in hint: " << child->Content())); return IGraphTransformer::TStatus::Error; @@ -167,7 +167,7 @@ namespace { for (auto& x : structType->GetItems()) { if (x->GetName().StartsWith(prefix)) { orderedFields.push_back(ctx.NewAtom(child->Pos(), x->GetName())); - if (!usedFields.insert(TString(x->GetName())).second) { + if (!usedFields.insert(TString(x->GetName())).second) { ctx.AddError(TIssue(ctx.GetPosition(child->Pos()), TStringBuilder() << "Duplicate field in hint: " << x->GetName())); return IGraphTransformer::TStatus::Error; @@ -862,7 +862,7 @@ namespace { class TResultProvider : public TDataProviderBase { public: struct TFunctions { - THashSet<TStringBuf> Names; + THashSet<TStringBuf> Names; TFunctions() { Names.insert(TResWrite::CallableName()); @@ -1387,7 +1387,7 @@ namespace { Config->CommittedResults.clear(); } - bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override { + bool GetDependencies(const TExprNode& node, TExprNode::TListType& children, bool compact) override { if (CanExecute(node)) { children.push_back(node.ChildPtr(0)); if (auto resPull = TMaybeNode<TResPull>(&node)) { @@ -1422,14 +1422,14 @@ namespace { } } - TString GetProviderPath(const TExprNode& node) override { + TString GetProviderPath(const TExprNode& node) override { Y_UNUSED(node); return "result"; } - TString GetOperationDisplayName(const TExprNode& node) override { + TString GetOperationDisplayName(const TExprNode& node) override { if (node.Content() == CommitName) { - return TString::Join(node.Content(), " on result"); + return TString::Join(node.Content(), " on result"); } if (auto maybeResFor = TMaybeNode<TResFor>(&node)) { @@ -1445,7 +1445,7 @@ namespace { return res; } - return TString(node.Content()); + return TString(node.Content()); } ITrackableNodeProcessor& GetTrackableNodeProcessor() override { @@ -1469,7 +1469,7 @@ TIntrusivePtr<IDataProvider> CreateResultProvider(const TIntrusivePtr<TResultPro return new TResultProvider(config); } -const THashSet<TStringBuf>& ResultProviderFunctions() { +const THashSet<TStringBuf>& ResultProviderFunctions() { return Singleton<TResultProvider::TFunctions>()->Names; } diff --git a/ydb/library/yql/providers/result/provider/yql_result_provider.h b/ydb/library/yql/providers/result/provider/yql_result_provider.h index ee5bb5a9f6b..6051fb05041 100644 --- a/ydb/library/yql/providers/result/provider/yql_result_provider.h +++ b/ydb/library/yql/providers/result/provider/yql_result_provider.h @@ -39,11 +39,11 @@ struct TResultProviderConfig : TThrRefBase { const NKikimr::NMiniKQL::IFunctionRegistry& FunctionRegistry; IDataProvider::TFillSettings FillSettings; TResultWriterFactory WriterFactory; - TVector<TString> CommittedResults; + TVector<TString> CommittedResults; bool SupportsResultPosition = false; }; TIntrusivePtr<IDataProvider> CreateResultProvider(const TIntrusivePtr<TResultProviderConfig>& config); -const THashSet<TStringBuf>& ResultProviderFunctions(); +const THashSet<TStringBuf>& ResultProviderFunctions(); } diff --git a/ydb/library/yql/public/issue/yql_issue.cpp b/ydb/library/yql/public/issue/yql_issue.cpp index 3b89156874b..a7016d17a32 100644 --- a/ydb/library/yql/public/issue/yql_issue.cpp +++ b/ydb/library/yql/public/issue/yql_issue.cpp @@ -113,10 +113,10 @@ Y_NO_INLINE void Indent(IOutputStream& out, ui32 indentation) { void ProgramLinesWithErrors( const TString& programText, - const TVector<TIssue>& errors, - TMap<ui32, TStringBuf>& lines) + const TVector<TIssue>& errors, + TMap<ui32, TStringBuf>& lines) { - TVector<ui32> rows; + TVector<ui32> rows; for (const auto& topIssue: errors) { WalkThroughIssues(topIssue, false, [&](const TIssue& issue, ui16 /*level*/) { for (ui32 row = issue.Position.Row; row <= issue.EndPosition.Row; row++) { @@ -185,7 +185,7 @@ void TIssues::PrintWithProgramTo( { using namespace NColorizer; - TMap<ui32, TStringBuf> lines; + TMap<ui32, TStringBuf> lines; ProgramLinesWithErrors(programText, Issues_, lines); for (const TIssue& topIssue: Issues_) { diff --git a/ydb/library/yql/public/issue/yql_issue.h b/ydb/library/yql/public/issue/yql_issue.h index 7b97674c9df..8ece894634c 100644 --- a/ydb/library/yql/public/issue/yql_issue.h +++ b/ydb/library/yql/public/issue/yql_issue.h @@ -108,7 +108,7 @@ struct TRange { class TIssue; using TIssuePtr = TIntrusivePtr<TIssue>; class TIssue: public TThrRefBase { - TVector<TIntrusivePtr<TIssue>> Children_; + TVector<TIntrusivePtr<TIssue>> Children_; public: TPosition Position; TPosition EndPosition; @@ -183,7 +183,7 @@ public: return *this; } - const TVector<TIntrusivePtr<TIssue>>& GetSubIssues() const { + const TVector<TIntrusivePtr<TIssue>>& GetSubIssues() const { return Children_; } @@ -205,7 +205,7 @@ class TIssues { public: TIssues() = default; - inline TIssues(const TVector<TIssue>& issues) + inline TIssues(const TVector<TIssue>& issues) : Issues_(issues) { } @@ -303,7 +303,7 @@ public: } private: - TVector<TIssue> Issues_; + TVector<TIssue> Issues_; }; class TErrorException : public yexception { diff --git a/ydb/library/yql/public/issue/yql_issue_id.h b/ydb/library/yql/public/issue/yql_issue_id.h index 9f4300f06be..bbd3922f59a 100644 --- a/ydb/library/yql/public/issue/yql_issue_id.h +++ b/ydb/library/yql/public/issue/yql_issue_id.h @@ -40,8 +40,8 @@ inline TString IssueCodeToString(TIssueCode id) { template<typename TProto, const char* ResourceName> class TIssueId { TProto ProtoIssues_; - THashMap<TIssueCode, NYql::TSeverityIds::ESeverityId> IssuesMap_; - THashMap<TIssueCode, TString> IssuesFormatMap_; + THashMap<TIssueCode, NYql::TSeverityIds::ESeverityId> IssuesMap_; + THashMap<TIssueCode, TString> IssuesFormatMap_; const google::protobuf::Descriptor* GetProtoDescriptor() const { auto ret = ProtoIssues_.GetDescriptor(); diff --git a/ydb/library/yql/public/issue/yql_issue_manager.h b/ydb/library/yql/public/issue/yql_issue_manager.h index 9ad5ac7bb40..16241a0c227 100644 --- a/ydb/library/yql/public/issue/yql_issue_manager.h +++ b/ydb/library/yql/public/issue/yql_issue_manager.h @@ -49,7 +49,7 @@ private: return *l == *r; } }; - TStack<std::pair<TMaybe<TIssuePtr>, std::function<TIssuePtr()>>> RawIssues_; + TStack<std::pair<TMaybe<TIssuePtr>, std::function<TIssuePtr()>>> RawIssues_; TIssues CompletedIssues_; TMaybe<TString> WarningToErrorTreatMessage_; TWarningPolicy WarningPolicy_; diff --git a/ydb/library/yql/public/udf/udf_string_ref.h b/ydb/library/yql/public/udf/udf_string_ref.h index 75a82b81e6a..2654462d66f 100644 --- a/ydb/library/yql/public/udf/udf_string_ref.h +++ b/ydb/library/yql/public/udf/udf_string_ref.h @@ -5,7 +5,7 @@ #include <util/generic/strbuf.h> #include <algorithm> -#include <string_view> +#include <string_view> #include <type_traits> namespace NYql { @@ -79,7 +79,7 @@ public: : TBase(buf.Data(), buf.Size()) {} - template <typename TStringType> + template <typename TStringType> inline constexpr TStringRef(const TStringType& buf) noexcept : TBase(TGetData<TStringType>::Get(buf), TGetSize<TStringType>::Get(buf)) {} diff --git a/ydb/library/yql/public/udf/udf_type_builder.h b/ydb/library/yql/public/udf/udf_type_builder.h index 8bfc73a449d..f363d196579 100644 --- a/ydb/library/yql/public/udf/udf_type_builder.h +++ b/ydb/library/yql/public/udf/udf_type_builder.h @@ -34,7 +34,7 @@ template <typename T, const char* Name> struct TNamedArg { using ItemType = T; }; template <typename T> -struct TListType { using ItemType = T; }; +struct TListType { using ItemType = T; }; template <typename TKey, typename TValue> struct TDict { @@ -763,7 +763,7 @@ struct TTypeBuilderHelper<TResource<Tag>> { }; template <typename T> -struct TTypeBuilderHelper<TListType<T>> { +struct TTypeBuilderHelper<TListType<T>> { static TType* Build(const IFunctionTypeInfoBuilder& builder) { return builder.List()-> Item(TTypeBuilderHelper<T>::Build(builder)) diff --git a/ydb/library/yql/public/udf/udf_validate.cpp b/ydb/library/yql/public/udf/udf_validate.cpp index be61b79cf29..405b91b895c 100644 --- a/ydb/library/yql/public/udf/udf_validate.cpp +++ b/ydb/library/yql/public/udf/udf_validate.cpp @@ -8,7 +8,7 @@ namespace NUdf { #define SWITCH_ENUM_TYPE_TO_STR(name, val) \ case val: return TStringBuf(#name); -TString ValidateModeAvailables() { +TString ValidateModeAvailables() { return Join(", ", ValidateModeAsStr(EValidateMode::None), ValidateModeAsStr(EValidateMode::Lazy), @@ -24,10 +24,10 @@ TStringBuf ValidateModeAsStr(EValidateMode validateMode) { return TStringBuf("unknown"); } -EValidateMode ValidateModeByStr(const TString& validateModeStr) { - const TString lowerValidateModeStr = to_lower(validateModeStr); +EValidateMode ValidateModeByStr(const TString& validateModeStr) { + const TString lowerValidateModeStr = to_lower(validateModeStr); for (auto val = EValidateMode::None; val < EValidateMode::Max; val = static_cast<EValidateMode>(static_cast<ui8>(val) + 1)) { - if (lowerValidateModeStr == to_lower(TString(ValidateModeAsStr(val)))) { + if (lowerValidateModeStr == to_lower(TString(ValidateModeAsStr(val)))) { return val; } } @@ -42,10 +42,10 @@ TStringBuf ValidatePolicyAsStr(EValidatePolicy validatePolicy) { return TStringBuf("unknown"); } -EValidatePolicy ValidatePolicyByStr(const TString& validatePolicyStr) { - const TString lowerValidatePolicyStr = to_lower(validatePolicyStr); +EValidatePolicy ValidatePolicyByStr(const TString& validatePolicyStr) { + const TString lowerValidatePolicyStr = to_lower(validatePolicyStr); for (auto val = EValidatePolicy::Fail; val < EValidatePolicy::Max; val = static_cast<EValidatePolicy>(static_cast<ui8>(val) + 1)) { - if (lowerValidatePolicyStr == to_lower(TString(ValidatePolicyAsStr(val)))) { + if (lowerValidatePolicyStr == to_lower(TString(ValidatePolicyAsStr(val)))) { return val; } } diff --git a/ydb/library/yql/public/udf/udf_validate.h b/ydb/library/yql/public/udf/udf_validate.h index 6e9957ec251..e948e1b07f6 100644 --- a/ydb/library/yql/public/udf/udf_validate.h +++ b/ydb/library/yql/public/udf/udf_validate.h @@ -1,5 +1,5 @@ #pragma once -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/strbuf.h> #include <library/cpp/deprecated/enum_codegen/enum_codegen.h> @@ -25,11 +25,11 @@ enum class EValidatePolicy : ui8 { UDF_VALIDATE_POLICY(ENUM_VALUE_GEN) }; -TString ValidateModeAvailables(); +TString ValidateModeAvailables(); TStringBuf ValidateModeAsStr(EValidateMode validateMode); -EValidateMode ValidateModeByStr(const TString& verifyModeStr); +EValidateMode ValidateModeByStr(const TString& verifyModeStr); TStringBuf ValidatePolicyAsStr(EValidatePolicy verifyPolicy); -EValidatePolicy ValidatePolicyByStr(const TString& verifyPolicy); +EValidatePolicy ValidatePolicyByStr(const TString& verifyPolicy); } // namspace NUdf } // namspace NYql diff --git a/ydb/library/yql/public/udf/udf_version.cpp b/ydb/library/yql/public/udf/udf_version.cpp index f900f99b4b7..fd411848eea 100644 --- a/ydb/library/yql/public/udf/udf_version.cpp +++ b/ydb/library/yql/public/udf/udf_version.cpp @@ -6,7 +6,7 @@ namespace NYql { namespace NUdf { -TString AbiVersionToStr(ui32 version) +TString AbiVersionToStr(ui32 version) { TStringBuilder sb; sb << (version / 10000) << '.' diff --git a/ydb/library/yql/public/udf/udf_version.h b/ydb/library/yql/public/udf/udf_version.h index e31e518d44f..3def947df47 100644 --- a/ydb/library/yql/public/udf/udf_version.h +++ b/ydb/library/yql/public/udf/udf_version.h @@ -68,7 +68,7 @@ constexpr bool IsAbiCompatible(ui32 version) (version / 100) % 100 <= UDF_ABI_VERSION_MINOR; } -TString AbiVersionToStr(ui32 version); +TString AbiVersionToStr(ui32 version); } // namspace NUdf } // namspace NYql diff --git a/ydb/library/yql/sql/v0/aggregation.cpp b/ydb/library/yql/sql/v0/aggregation.cpp index 64406048811..154a0d193b0 100644 --- a/ydb/library/yql/sql/v0/aggregation.cpp +++ b/ydb/library/yql/sql/v0/aggregation.cpp @@ -172,7 +172,7 @@ public: ctx.Error(Pos) << "Expected aggregation function: " << GetName() << " only as window function. You may have forgotten OVER instruction."; return false; } - TVector<TNodePtr> exprsAuto; + TVector<TNodePtr> exprsAuto; if (!exprs) { auto winNamePtr = src->GetWindowName(); YQL_ENSURE(winNamePtr); @@ -212,7 +212,7 @@ TAggregationPtr BuildFactoryAggregationWinAutoarg(TPosition pos, const TString& class TKeyPayloadAggregationFactory final : public TAggregationFactory { public: - TKeyPayloadAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TKeyPayloadAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -293,13 +293,13 @@ private: TNodePtr Key, Payload, Limit; }; -TAggregationPtr BuildKeyPayloadFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildKeyPayloadFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TKeyPayloadAggregationFactory(pos, name, factory, aggMode); } class TPayloadPredicateAggregationFactory final : public TAggregationFactory { public: - TPayloadPredicateAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TPayloadPredicateAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -369,13 +369,13 @@ private: TNodePtr Payload, Predicate; }; -TAggregationPtr BuildPayloadPredicateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildPayloadPredicateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TPayloadPredicateAggregationFactory(pos, name, factory, aggMode); } class TTwoArgsAggregationFactory final : public TAggregationFactory { public: - TTwoArgsAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TTwoArgsAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -441,13 +441,13 @@ private: TNodePtr One, Two; }; -TAggregationPtr BuildTwoArgsFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildTwoArgsFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TTwoArgsAggregationFactory(pos, name, factory, aggMode); } class THistogramAggregationFactory final : public TAggregationFactory { public: - THistogramAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + THistogramAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) , FakeSource(BuildFakeSource(pos)) , Weight(Y("Double", Q("1.0"))) @@ -540,13 +540,13 @@ private: TNodePtr Weight, Intervals; }; -TAggregationPtr BuildHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new THistogramAggregationFactory(pos, name, factory, aggMode); } class TLinearHistogramAggregationFactory final : public TAggregationFactory { public: - TLinearHistogramAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TLinearHistogramAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) , FakeSource(BuildFakeSource(pos)) , BinSize(Y("Double", Q("10.0"))) @@ -611,19 +611,19 @@ private: TNodePtr BinSize, Minimum, Maximum; }; -TAggregationPtr BuildLinearHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildLinearHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TLinearHistogramAggregationFactory(pos, name, factory, aggMode); } class TPercentileFactory final : public TAggregationFactory { public: - TPercentileFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TPercentileFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) , FakeSource(BuildFakeSource(pos)) {} private: - const TString* GetGenericKey() const final { + const TString* GetGenericKey() const final { return Column; } @@ -727,18 +727,18 @@ private: } TSourcePtr FakeSource; - std::multimap<TString, TNodePtr> Percentiles; + std::multimap<TString, TNodePtr> Percentiles; TNodePtr FactoryPercentile; const TString* Column = nullptr; }; -TAggregationPtr BuildPercentileFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildPercentileFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TPercentileFactory(pos, name, factory, aggMode); } class TTopFreqFactory final : public TAggregationFactory { public: - TTopFreqFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TTopFreqFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -854,11 +854,11 @@ private: return TAggregationFactory::DoInit(ctx, src); } - std::multimap<TString, TPair> TopFreqs; + std::multimap<TString, TPair> TopFreqs; TPair TopFreqFactoryParams; }; -TAggregationPtr BuildTopFreqFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildTopFreqFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TTopFreqFactory(pos, name, factory, aggMode); } @@ -1106,7 +1106,7 @@ TAggregationPtr BuildListFactoryAggregation(TPosition pos, const TString& name, class TUserDefinedAggregationFactory final : public TAggregationFactory { public: - TUserDefinedAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TUserDefinedAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -1164,13 +1164,13 @@ private: TNodePtr DefVal; }; -TAggregationPtr BuildUserDefinedFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildUserDefinedFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TUserDefinedAggregationFactory(pos, name, factory, aggMode); } class TCountAggregation final : public TAggregationFactory { public: - TCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) + TCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) : TAggregationFactory(pos, name, func, aggMode) {} @@ -1197,7 +1197,7 @@ private: } }; -TAggregationPtr BuildCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) { +TAggregationPtr BuildCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) { return new TCountAggregation(pos, name, func, aggMode); } diff --git a/ydb/library/yql/sql/v0/builtin.cpp b/ydb/library/yql/sql/v0/builtin.cpp index a0945f9d05e..981168913e6 100644 --- a/ydb/library/yql/sql/v0/builtin.cpp +++ b/ydb/library/yql/sql/v0/builtin.cpp @@ -24,7 +24,7 @@ namespace NSQLTranslationV0 { class TGroupingNode final: public TAstListNode { public: - TGroupingNode(TPosition pos, const TVector<TNodePtr>& args) + TGroupingNode(TPosition pos, const TVector<TNodePtr>& args) : TAstListNode(pos) , Args(args) {} @@ -34,7 +34,7 @@ public: ctx.Error(Pos) << "Grouping function should have source"; return false; } - TVector<TString> columns; + TVector<TString> columns; columns.reserve(Args.size()); for (const auto& node: Args) { auto namePtr = node->GetColumnName(); @@ -64,19 +64,19 @@ public: } private: - const TVector<TNodePtr> Args; + const TVector<TNodePtr> Args; }; class TBasicAggrFunc final: public TAstListNode { public: - TBasicAggrFunc(TPosition pos, const TString& name, TAggregationPtr aggr, const TVector<TNodePtr>& args) + TBasicAggrFunc(TPosition pos, const TString& name, TAggregationPtr aggr, const TVector<TNodePtr>& args) : TAstListNode(pos) , Name(name) , Aggr(aggr) , Args(args) {} - TCiString GetName() const { + TCiString GetName() const { return Name; } @@ -115,9 +115,9 @@ private: } protected: - const TString Name; + const TString Name; TAggregationPtr Aggr; - TVector<TNodePtr> Args; + TVector<TNodePtr> Args; }; class TBasicAggrFactory final : public TAstListNode { @@ -186,7 +186,7 @@ typedef THolder<TBasicAggrFunc> TAggrFuncPtr; class TLiteralStringAtom: public INode { public: - TLiteralStringAtom(TPosition pos, TNodePtr node, const TString& info) + TLiteralStringAtom(TPosition pos, TNodePtr node, const TString& info) : INode(pos) , Node(node) , Info(info) @@ -219,12 +219,12 @@ public: private: TNodePtr Node; TNodePtr Atom; - TString Info; + TString Info; }; class TYqlAsAtom: public TLiteralStringAtom { public: - TYqlAsAtom(TPosition pos, const TVector<TNodePtr>& args) + TYqlAsAtom(TPosition pos, const TVector<TNodePtr>& args) : TLiteralStringAtom(pos, args.size() == 1 ? args[0] : nullptr, "Literal string is required as argument") { } @@ -232,7 +232,7 @@ public: class TYqlData: public TCallNode { public: - TYqlData(TPosition pos, const TString& type, const TVector<TNodePtr>& args) + TYqlData(TPosition pos, const TString& type, const TVector<TNodePtr>& args) : TCallNode(pos, type, 1, 1, args) { } @@ -401,7 +401,7 @@ private: class TYqlParseType final : public INode { public: - TYqlParseType(TPosition pos, const TVector<TNodePtr>& args) + TYqlParseType(TPosition pos, const TVector<TNodePtr>& args) : INode(pos) , Args(args) {} @@ -432,7 +432,7 @@ public: } private: - TVector<TNodePtr> Args; + TVector<TNodePtr> Args; }; class TYqlAddTimezone: public TCallNode { @@ -507,7 +507,7 @@ public: class TFromBytes final : public TCallNode { public: - TFromBytes(TPosition pos, const TVector<TNodePtr>& args) + TFromBytes(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "FromBytes", 2, 2, args) {} @@ -531,7 +531,7 @@ public: class TYqlTaggedBase : public TCallNode { public: - TYqlTaggedBase(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) + TYqlTaggedBase(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, 2, 2, args) {} @@ -551,7 +551,7 @@ public: class TYqlAsTagged final : public TYqlTaggedBase { public: - TYqlAsTagged(TPosition pos, const TVector<TNodePtr>& args) + TYqlAsTagged(TPosition pos, const TVector<TNodePtr>& args) : TYqlTaggedBase(pos, "AsTagged", args) {} @@ -562,7 +562,7 @@ public: class TYqlUntag final : public TYqlTaggedBase { public: - TYqlUntag(TPosition pos, const TVector<TNodePtr>& args) + TYqlUntag(TPosition pos, const TVector<TNodePtr>& args) : TYqlTaggedBase(pos, "Untag", args) {} @@ -573,7 +573,7 @@ public: class TYqlVariant final : public TCallNode { public: - TYqlVariant(TPosition pos, const TVector<TNodePtr>& args) + TYqlVariant(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "Variant", 3, 3, args) {} @@ -735,11 +735,11 @@ static const TSet<TString> AvailableDataTypes = {"Bool", "String", "Uint32", "Ui "Date", "Datetime", "Timestamp", "Interval", "Uint8", "Int8", "Uint16", "Int16", "TzDate", "TzDatetime", "TzTimestamp", "Uuid", "Decimal"}; TNodePtr GetDataTypeStringNode(TContext& ctx, TCallNode& node, unsigned argNum, TString* outTypeStrPtr = nullptr) { auto errMsgFunc = [&node, argNum]() { - static std::array<TString, 2> numToName = {{"first", "second"}}; + static std::array<TString, 2> numToName = {{"first", "second"}}; TStringBuilder sb; sb << "At " << numToName.at(argNum) << " argument of " << node.GetOpName() << " expected type string, available one of: " << JoinRange(", ", AvailableDataTypes.begin(), AvailableDataTypes.end()) << ";"; - return TString(sb); + return TString(sb); }; auto typeStringNode = node.GetArgs().at(argNum); auto typeStringPtr = typeStringNode->GetLiteral("String"); @@ -763,7 +763,7 @@ TNodePtr GetDataTypeStringNode(TContext& ctx, TCallNode& node, unsigned argNum, class TYqlParseFileOp final: public TCallNode { public: - TYqlParseFileOp(TPosition pos, const TVector<TNodePtr>& args) + TYqlParseFileOp(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "ParseFile", 2, 2, args) {} @@ -788,7 +788,7 @@ public: return TCallNode::DoInit(ctx, src); } - TString GetOpName() const override { + TString GetOpName() const override { return "ParseFile"; } @@ -799,7 +799,7 @@ public: class TYqlDataType final : public TCallNode { public: - TYqlDataType(TPosition pos, const TVector<TNodePtr>& args) + TYqlDataType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "DataType", 1, 1, args) {} @@ -831,7 +831,7 @@ TNodePtr TryBuildDataType(TPosition pos, const TString& stringType) { class TYqlResourceType final : public TCallNode { public: - TYqlResourceType(TPosition pos, const TVector<TNodePtr>& args) + TYqlResourceType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "ResourceType", 1, 1, args) {} @@ -855,7 +855,7 @@ public: class TYqlTaggedType final : public TCallNode { public: - TYqlTaggedType(TPosition pos, const TVector<TNodePtr>& args) + TYqlTaggedType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "TaggedType", 2, 2, args) {} @@ -879,7 +879,7 @@ public: class TYqlCallableType final : public TCallNode { public: - TYqlCallableType(TPosition pos, const TVector<TNodePtr>& args) + TYqlCallableType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "CallableType", 2, -1, args) {} @@ -918,7 +918,7 @@ public: class TYqlTupleElementType final : public TCallNode { public: - TYqlTupleElementType(TPosition pos, const TVector<TNodePtr>& args) + TYqlTupleElementType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "TupleElementType", 2, 2, args) {} @@ -942,7 +942,7 @@ public: class TYqlStructMemberType final : public TCallNode { public: - TYqlStructMemberType(TPosition pos, const TVector<TNodePtr>& args) + TYqlStructMemberType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "StructMemberType", 2, 2, args) {} @@ -966,7 +966,7 @@ public: class TYqlCallableArgumentType final : public TCallNode { public: - TYqlCallableArgumentType(TPosition pos, const TVector<TNodePtr>& args) + TYqlCallableArgumentType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "CallableArgumentType", 2, 2, args) {} @@ -992,7 +992,7 @@ public: class TStructTypeNode : public TAstListNode { public: - TStructTypeNode(TPosition pos, const TVector<TNodePtr>& exprs) + TStructTypeNode(TPosition pos, const TVector<TNodePtr>& exprs) : TAstListNode(pos) , Exprs(exprs) {} @@ -1015,13 +1015,13 @@ public: } private: - const TVector<TNodePtr> Exprs; + const TVector<TNodePtr> Exprs; }; template <bool IsStrict> class TYqlIf final: public TCallNode { public: - TYqlIf(TPosition pos, const TVector<TNodePtr>& args) + TYqlIf(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, IsStrict ? "IfStrict" : "If", 2, 3, args) {} @@ -1045,7 +1045,7 @@ private: class TYqlSubstring final: public TCallNode { public: - TYqlSubstring(TPosition pos, const TVector<TNodePtr>& args) + TYqlSubstring(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "Substring", 2, 3, args) {} @@ -1064,7 +1064,7 @@ private: class TYqlIn final: public TCallNode { public: - TYqlIn(TPosition pos, const TVector<TNodePtr>& args) + TYqlIn(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "IN", 3, 3, args) {} @@ -1150,8 +1150,8 @@ protected: {} private: - static TVector<TNodePtr> UdfArgs(TPosition pos, const TString& name, const TVector<TNodePtr>* args = nullptr) { - TVector<TNodePtr> res = { BuildQuotedAtom(pos, name) }; + static TVector<TNodePtr> UdfArgs(TPosition pos, const TString& name, const TVector<TNodePtr>* args = nullptr) { + TVector<TNodePtr> res = { BuildQuotedAtom(pos, name) }; if (args) { res.insert(res.end(), args->begin(), args->end()); } @@ -1223,7 +1223,7 @@ private: class TWeakFieldOp final: public TCallNode { public: - TWeakFieldOp(TPosition pos, const TVector<TNodePtr>& args) + TWeakFieldOp(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "WeakField", 2, 3, args) {} @@ -1241,7 +1241,7 @@ public: PrecacheState(); const auto memberPos = Args[0]->GetPos(); - TVector<TNodePtr> repackArgs = {BuildAtom(memberPos, "row", NYql::TNodeFlags::Default)}; + TVector<TNodePtr> repackArgs = {BuildAtom(memberPos, "row", NYql::TNodeFlags::Default)}; if (auto literal = Args[1]->GetLiteral("String")) { TString targetType; if (!GetDataTypeStringNode(ctx, *this, 1, &targetType)) { @@ -1253,7 +1253,7 @@ public: repackArgs.push_back(Args[1]); } - TVector<TNodePtr> column; + TVector<TNodePtr> column; auto namePtr = Args[0]->GetColumnName(); if (!namePtr || !*namePtr) { ctx.Error(Pos) << GetCallExplain() << " expect as first argument column name"; @@ -1292,7 +1292,7 @@ public: class TTableRow final : public TAstAtomNode { public: - TTableRow(TPosition pos, const TVector<TNodePtr>& args) + TTableRow(TPosition pos, const TVector<TNodePtr>& args) : TTableRow(pos, args.size()) {} @@ -1328,13 +1328,13 @@ private: ui32 ArgsCount; }; -TNodePtr BuildUdfUserTypeArg(TPosition pos, const TVector<TNodePtr>& args, TNodePtr customUserType) { - TVector<TNodePtr> argsTypeItems; +TNodePtr BuildUdfUserTypeArg(TPosition pos, const TVector<TNodePtr>& args, TNodePtr customUserType) { + TVector<TNodePtr> argsTypeItems; for (auto& arg : args) { - argsTypeItems.push_back(new TCallNodeImpl(pos, "TypeOf", TVector<TNodePtr>(1, arg))); + argsTypeItems.push_back(new TCallNodeImpl(pos, "TypeOf", TVector<TNodePtr>(1, arg))); } - TVector<TNodePtr> userTypeItems; + TVector<TNodePtr> userTypeItems; userTypeItems.push_back(new TCallNodeImpl(pos, "TupleType", argsTypeItems)); userTypeItems.push_back(new TCallNodeImpl(pos, "StructType", {})); if (customUserType) { @@ -1347,7 +1347,7 @@ TNodePtr BuildUdfUserTypeArg(TPosition pos, const TVector<TNodePtr>& args, TNode } TNodePtr BuildUdfUserTypeArg(TPosition pos, TNodePtr positionalArgs, TNodePtr namedArgs, TNodePtr customUserType) { - TVector<TNodePtr> userTypeItems; + TVector<TNodePtr> userTypeItems; userTypeItems.reserve(3); userTypeItems.push_back(positionalArgs->Y("TypeOf", positionalArgs)); userTypeItems.push_back(positionalArgs->Y("TypeOf", namedArgs)); @@ -1360,12 +1360,12 @@ TNodePtr BuildUdfUserTypeArg(TPosition pos, TNodePtr positionalArgs, TNodePtr na return new TCallNodeImpl(pos, "TupleType", userTypeItems); } -TVector<TNodePtr> BuildUdfArgs(const TContext& ctx, TPosition pos, const TVector<TNodePtr>& args, +TVector<TNodePtr> BuildUdfArgs(const TContext& ctx, TPosition pos, const TVector<TNodePtr>& args, TNodePtr positionalArgs, TNodePtr namedArgs, TNodePtr customUserType) { if (!ctx.Settings.EnableGenericUdfs) { return {}; } - TVector<TNodePtr> udfArgs; + TVector<TNodePtr> udfArgs; udfArgs.push_back(new TAstListNodeImpl(pos)); udfArgs[0]->Add(new TAstAtomNodeImpl(pos, "Void", 0)); if (namedArgs) { @@ -1378,7 +1378,7 @@ TVector<TNodePtr> BuildUdfArgs(const TContext& ctx, TPosition pos, const TVector class TCallableNode final: public INode { public: - TCallableNode(TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args) + TCallableNode(TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args) : INode(pos) , Module(module) , Name(name) @@ -1446,17 +1446,17 @@ public: } private: - TCiString Module; - TString Name; - TVector<TNodePtr> Args; + TCiString Module; + TString Name; + TVector<TNodePtr> Args; TNodePtr Node; }; -TNodePtr BuildCallable(TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args) { +TNodePtr BuildCallable(TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args) { return new TCallableNode(pos, module, name, args); } -TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args) { +TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args) { auto fullName = module + "." + name; if (!args.empty()) { return new TYqlUdf(pos, fullName, args, args.size() + 1); @@ -1469,7 +1469,7 @@ TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TSt class TScriptUdf final: public INode { public: - TScriptUdf(TPosition pos, const TString& moduleName, const TString& funcName, const TVector<TNodePtr>& args) + TScriptUdf(TPosition pos, const TString& moduleName, const TString& funcName, const TVector<TNodePtr>& args) : INode(pos) , ModuleName(moduleName) , FuncName(funcName) @@ -1546,16 +1546,16 @@ public: return new TScriptUdf(GetPos(), ModuleName, FuncName, CloneContainer(Args)); } private: - TString ModuleName; - TString FuncName; - TVector<TNodePtr> Args; + TString ModuleName; + TString FuncName; + TVector<TNodePtr> Args; TNodePtr Node; }; template <bool Sorted> class TYqlToDict final: public TCallNode { public: - TYqlToDict(TPosition pos, const TString& mode, const TVector<TNodePtr>& args) + TYqlToDict(TPosition pos, const TString& mode, const TVector<TNodePtr>& args) : TCallNode(pos, "ToDict", 4, 4, args) , Mode(mode) {} @@ -1576,7 +1576,7 @@ private: return TCallNode::DoInit(ctx, src); } private: - TString Mode; + TString Mode; }; template <bool IsStart> @@ -1622,7 +1622,7 @@ private: class TInvalidBuiltin final: public INode { public: - TInvalidBuiltin(TPosition pos, const TString& info) + TInvalidBuiltin(TPosition pos, const TString& info) : INode(pos) , Info(info) { @@ -1641,7 +1641,7 @@ public: return {}; } private: - TString Info; + TString Info; }; enum EAggrFuncTypeCallback { @@ -1669,19 +1669,19 @@ struct TCoreFuncInfo { }; using TAggrFuncFactoryCallback = std::function<INode::TPtr(TPosition pos, const TVector<TNodePtr>& args, EAggregateMode aggMode, bool isFactory)>; -using TAggrFuncFactoryCallbackMap = std::unordered_map<TString, TAggrFuncFactoryCallback, THash<TString>>; -using TBuiltinFactoryCallback = std::function<TNodePtr(TPosition pos, const TVector<TNodePtr>& args)>; -using TBuiltinFactoryCallbackMap = std::unordered_map<TString, TBuiltinFactoryCallback, THash<TString>>; +using TAggrFuncFactoryCallbackMap = std::unordered_map<TString, TAggrFuncFactoryCallback, THash<TString>>; +using TBuiltinFactoryCallback = std::function<TNodePtr(TPosition pos, const TVector<TNodePtr>& args)>; +using TBuiltinFactoryCallbackMap = std::unordered_map<TString, TBuiltinFactoryCallback, THash<TString>>; using TCoreFuncMap = std::unordered_map<TString, TCoreFuncInfo, THash<TString>>; TAggrFuncFactoryCallback BuildAggrFuncFactoryCallback( - const TString& functionName, - const TString& factoryName, + const TString& functionName, + const TString& factoryName, EAggrFuncTypeCallback type = NORMAL, const TString& functionNameOverride = TString(), const TVector<EAggregateMode>& validModes = {}) { - const TString realFunctionName = functionNameOverride.empty() ? functionName : functionNameOverride; + const TString realFunctionName = functionNameOverride.empty() ? functionName : functionNameOverride; return [functionName, realFunctionName, factoryName, type, validModes] (TPosition pos, const TVector<TNodePtr>& args, EAggregateMode aggMode, bool isFactory) -> INode::TPtr { if (!validModes.empty()) { if (!IsIn(validModes, aggMode)) { @@ -1759,54 +1759,54 @@ TAggrFuncFactoryCallback BuildAggrFuncFactoryCallback( template<typename TType> TBuiltinFactoryCallback BuildSimpleBuiltinFactoryCallback() { - return [] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { + return [] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, args); }; } template<typename TType> -TBuiltinFactoryCallback BuildNamedBuiltinFactoryCallback(const TString& name) { - return [name] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { +TBuiltinFactoryCallback BuildNamedBuiltinFactoryCallback(const TString& name) { + return [name] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, name, args); }; } template<typename TType> TBuiltinFactoryCallback BuildArgcBuiltinFactoryCallback(i32 minArgs, i32 maxArgs) { - return [minArgs, maxArgs] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { + return [minArgs, maxArgs] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, minArgs, maxArgs, args); }; } template<typename TType> -TBuiltinFactoryCallback BuildNamedArgcBuiltinFactoryCallback(const TString& name, i32 minArgs, i32 maxArgs) { - return [name, minArgs, maxArgs] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { +TBuiltinFactoryCallback BuildNamedArgcBuiltinFactoryCallback(const TString& name, i32 minArgs, i32 maxArgs) { + return [name, minArgs, maxArgs] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, name, minArgs, maxArgs, args); }; } template<typename TType> -TBuiltinFactoryCallback BuildNamedDepsArgcBuiltinFactoryCallback(ui32 reqArgsCount, const TString& name, i32 minArgs, i32 maxArgs) { - return [reqArgsCount, name, minArgs, maxArgs](TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { +TBuiltinFactoryCallback BuildNamedDepsArgcBuiltinFactoryCallback(ui32 reqArgsCount, const TString& name, i32 minArgs, i32 maxArgs) { + return [reqArgsCount, name, minArgs, maxArgs](TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(reqArgsCount, pos, name, minArgs, maxArgs, args); }; } template<typename TType> TBuiltinFactoryCallback BuildBoolBuiltinFactoryCallback(bool arg) { - return [arg] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { + return [arg] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, args, arg); }; } template<typename TType> -TBuiltinFactoryCallback BuildFoldBuiltinFactoryCallback(const TString& name, const TString& defaultValue) { - return [name, defaultValue] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { +TBuiltinFactoryCallback BuildFoldBuiltinFactoryCallback(const TString& name, const TString& defaultValue) { + return [name, defaultValue] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, name, "Bool", defaultValue, 1, args); }; } -TNodePtr MakePair(TPosition pos, const TVector<TNodePtr>& args) { +TNodePtr MakePair(TPosition pos, const TVector<TNodePtr>& args) { TNodePtr list = new TAstListNodeImpl(pos, { args[0], args.size() > 1 ? args[1] : new TAstListNodeImpl(pos,{ new TAstAtomNodeImpl(pos, "Null", TNodeFlags::Default) }) @@ -2189,7 +2189,7 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec } } - TString normalizedName(name); + TString normalizedName(name); TString ns = to_lower(nameSpace); if (ns.empty()) { TMaybe<TIssue> error = NormalizeName(pos, normalizedName); @@ -2300,7 +2300,7 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec return new TCallNodeImpl(pos, namedArgs ? "NamedApply" : "Apply", applyArgs); } else if (moduleResource) { auto exportName = ns == "core" ? name : "$" + name; - TVector<TNodePtr> applyArgs = { + TVector<TNodePtr> applyArgs = { new TCallNodeImpl(pos, "bind", { BuildAtom(pos, ns + "_module", 0), BuildQuotedAtom(pos, exportName) }) @@ -2308,7 +2308,7 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec applyArgs.insert(applyArgs.end(), args.begin(), args.end()); return new TCallNodeImpl(pos, "Apply", applyArgs); } else if (ns == "hyperscan" || ns == "pcre" || ns == "pire" || ns.StartsWith("re2")) { - TString moduleName(nameSpace); + TString moduleName(nameSpace); moduleName.to_title(); if ((args.size() == 1 || args.size() == 2) && (name.StartsWith("Multi") || (ns.StartsWith("re2") && name == "Capture"))) { TVector<TNodePtr> multiArgs{ @@ -2460,7 +2460,7 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec *mustUseNamed = false; } - TVector<TNodePtr> reuseArgs; + TVector<TNodePtr> reuseArgs; if (!namedArgs && args && funcPrepareNameNode) { TString reusedBaseName = TStringBuilder() << "Arg" << to_title(nameSpace) << to_title(name); reuseArgs.reserve(args.size()); @@ -2488,7 +2488,7 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec const auto& udfArgs = BuildUdfArgs(ctx, pos, usedArgs, positionalArgs, namedArgs, customUserType); TNodePtr udfNode = BuildUdf(ctx, pos, nameSpace, name, udfArgs); - TVector<TNodePtr> applyArgs = { udfNode }; + TVector<TNodePtr> applyArgs = { udfNode }; applyArgs.insert(applyArgs.end(), usedArgs.begin(), usedArgs.end()); return new TCallNodeImpl(pos, namedArgs ? "NamedApply" : "Apply", applyArgs); } diff --git a/ydb/library/yql/sql/v0/context.cpp b/ydb/library/yql/sql/v0/context.cpp index a3a9013f2b7..d0ca2dac0ed 100644 --- a/ydb/library/yql/sql/v0/context.cpp +++ b/ydb/library/yql/sql/v0/context.cpp @@ -81,7 +81,7 @@ const NYql::TPosition& TContext::Pos() const { return Position; } -TString TContext::MakeName(const TString& name) { +TString TContext::MakeName(const TString& name) { auto iter = GenIndexes.find(name); if (iter == GenIndexes.end()) { iter = GenIndexes.emplace(name, 0).first; @@ -145,7 +145,7 @@ IOutputStream& TContext::MakeIssue(ESeverity severity, TIssueCode code, NYql::TP return *IssueMsgHolder; } -bool TContext::SetPathPrefix(const TString& value, TMaybe<TString> arg) { +bool TContext::SetPathPrefix(const TString& value, TMaybe<TString> arg) { if (arg.Defined()) { if (*arg == YtProviderName || *arg == KikimrProviderName @@ -190,7 +190,7 @@ TNodePtr TContext::GetPrefixedPath(const TString& cluster, const TDeferredAtom& } } -TNodePtr TContext::UniversalAlias(const TString& baseName, TNodePtr&& node) { +TNodePtr TContext::UniversalAlias(const TString& baseName, TNodePtr&& node) { auto alias = MakeName(baseName); UniversalAliases.emplace(alias, node); return BuildAtom(node->GetPos(), alias, TNodeFlags::Default); @@ -274,7 +274,7 @@ bool TContext::DeclareVariable(const TString& varName, const TNodePtr& typeNode) return true; } -bool TContext::AddExports(const TVector<TString>& symbols) { +bool TContext::AddExports(const TVector<TString>& symbols) { for (const auto& symbol: symbols) { if (Exports.contains(symbol)) { Error() << "Duplicate export symbol: " << symbol; @@ -289,7 +289,7 @@ bool TContext::AddExports(const TVector<TString>& symbols) { return true; } -TString TContext::AddImport(const TVector<TString>& modulePath) { +TString TContext::AddImport(const TVector<TString>& modulePath) { YQL_ENSURE(!modulePath.empty()); const TString path = JoinRange("/", modulePath.cbegin(), modulePath.cend()); auto iter = ImportModuleAliases.find(path); @@ -350,7 +350,7 @@ IOutputStream& TTranslation::Error() { return Ctx.Error(); } -TNodePtr TTranslation::GetNamedNode(const TString& name) { +TNodePtr TTranslation::GetNamedNode(const TString& name) { auto mapIt = Ctx.NamedNodes.find(name); if (mapIt == Ctx.NamedNodes.end()) { Ctx.Error() << "Unknown name: " << name; @@ -360,11 +360,11 @@ TNodePtr TTranslation::GetNamedNode(const TString& name) { return mapIt->second.top()->Clone(); } -void TTranslation::PushNamedNode(const TString& name, TNodePtr node) { +void TTranslation::PushNamedNode(const TString& name, TNodePtr node) { Y_VERIFY_DEBUG(node); auto mapIt = Ctx.NamedNodes.find(name); if (mapIt == Ctx.NamedNodes.end()) { - auto result = Ctx.NamedNodes.insert(std::make_pair(name, TStack<TNodePtr>())); + auto result = Ctx.NamedNodes.insert(std::make_pair(name, TStack<TNodePtr>())); Y_VERIFY_DEBUG(result.second); mapIt = result.first; } @@ -372,7 +372,7 @@ void TTranslation::PushNamedNode(const TString& name, TNodePtr node) { mapIt->second.push(node); } -void TTranslation::PopNamedNode(const TString& name) { +void TTranslation::PopNamedNode(const TString& name) { auto mapIt = Ctx.NamedNodes.find(name); Y_VERIFY_DEBUG(mapIt != Ctx.NamedNodes.end()); Y_VERIFY_DEBUG(mapIt->second.size() > 0); @@ -382,16 +382,16 @@ void TTranslation::PopNamedNode(const TString& name) { } } -TString GetDescription(const google::protobuf::Message& node, const google::protobuf::FieldDescriptor* d) { +TString GetDescription(const google::protobuf::Message& node, const google::protobuf::FieldDescriptor* d) { const auto& field = node.GetReflection()->GetMessage(node, d); return field.GetReflection()->GetString(field, d->message_type()->FindFieldByName("Descr")); } -TString TTranslation::AltDescription(const google::protobuf::Message& node, ui32 altCase, const google::protobuf::Descriptor* descr) const { +TString TTranslation::AltDescription(const google::protobuf::Message& node, ui32 altCase, const google::protobuf::Descriptor* descr) const { return GetDescription(node, descr->FindFieldByNumber(altCase)); } -void TTranslation::AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr) { +void TTranslation::AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr) { Error() << ruleName << ": alternative is not implemented yet: " << GetDescription(node, descr->FindFieldByNumber(altCase)); } diff --git a/ydb/library/yql/sql/v0/context.h b/ydb/library/yql/sql/v0/context.h index 45f40fae61c..2110f86fe0a 100644 --- a/ydb/library/yql/sql/v0/context.h +++ b/ydb/library/yql/sql/v0/context.h @@ -18,7 +18,7 @@ namespace NSQLTranslationV0 { - typedef TMap<TString, TNodePtr> TNamedNodesMap; + typedef TMap<TString, TNodePtr> TNamedNodesMap; class TContext { public: @@ -30,7 +30,7 @@ namespace NSQLTranslationV0 { const NYql::TPosition& Pos() const; void ClearBlockScope(); - TString MakeName(const TString& name); + TString MakeName(const TString& name); IOutputStream& Error(); IOutputStream& Error(NYql::TPosition pos); @@ -38,7 +38,7 @@ namespace NSQLTranslationV0 { IOutputStream& Info(NYql::TPosition pos); template <typename TToken> - const TString& Token(const TToken& token) { + const TString& Token(const TToken& token) { Position.Row = token.GetLine(); Position.Column = token.GetColumn() + 1; return token.GetValue(); @@ -52,7 +52,7 @@ namespace NSQLTranslationV0 { return pos; } - inline void IncrementMonCounter(const TString& name, const TString& value) { + inline void IncrementMonCounter(const TString& name, const TString& value) { if (IncrementMonCounterFunction) { IncrementMonCounterFunction(name, value); } @@ -62,7 +62,7 @@ namespace NSQLTranslationV0 { return GetClusterProvider(cluster).Defined(); } - TMaybe<TString> GetClusterProvider(const TString& cluster) const { + TMaybe<TString> GetClusterProvider(const TString& cluster) const { TString unusedNormalizedClusterName; return GetClusterProvider(cluster, unusedNormalizedClusterName); } @@ -84,11 +84,11 @@ namespace NSQLTranslationV0 { bool UseUnordered(const ISource& source) const; bool UseUnordered(const TTableRef& table) const; - bool SetPathPrefix(const TString& value, TMaybe<TString> arg = TMaybe<TString>()); + bool SetPathPrefix(const TString& value, TMaybe<TString> arg = TMaybe<TString>()); TNodePtr GetPrefixedPath(const TString& cluster, const TDeferredAtom& path); - TNodePtr UniversalAlias(const TString& baseName, TNodePtr&& node); + TNodePtr UniversalAlias(const TString& baseName, TNodePtr&& node); TString HasBlockShortcut(const TNodePtr& baseNode); TString RegisterBlockShortcut(const TNodePtr& baseNode, const TNodePtr& node, const TString& baseName); @@ -109,8 +109,8 @@ namespace NSQLTranslationV0 { bool DeclareVariable(const TString& varName, const TNodePtr& typeNode); - bool AddExports(const TVector<TString>& symbols); - TString AddImport(const TVector<TString>& modulePath); + bool AddExports(const TVector<TString>& symbols); + TString AddImport(const TVector<TString>& modulePath); TString AddSimpleUdf(const TString& udf); private: IOutputStream& MakeIssue(NYql::ESeverity severity, NYql::TIssueCode code, NYql::TPosition pos); @@ -119,25 +119,25 @@ namespace NSQLTranslationV0 { NYql::TPosition Position; THolder<TStringOutput> IssueMsgHolder; NSQLTranslation::TClusterMapping ClusterMapping; - TString PathPrefix; + TString PathPrefix; THashMap<TString, TString> ProviderPathPrefixes; THashMap<TString, TString> ClusterPathPrefixes; bool IntoHeading = true; public: - THashMap<TString, TNodePtr> Variables; + THashMap<TString, TNodePtr> Variables; NSQLTranslation::TTranslationSettings Settings; std::unique_ptr<TMemoryPool> Pool; NYql::TIssues& Issues; - TMap<TString, TStack<TNodePtr>> NamedNodes; - TMap<TString, TNodePtr> UniversalAliases; - THashSet<TString> Exports; - THashMap<TString, TString> ImportModuleAliases; - TMap<TString, TString> SimpleUdfs; + TMap<TString, TStack<TNodePtr>> NamedNodes; + TMap<TString, TNodePtr> UniversalAliases; + THashSet<TString> Exports; + THashMap<TString, TString> ImportModuleAliases; + TMap<TString, TString> SimpleUdfs; NSQLTranslation::TIncrementMonCounterFunction IncrementMonCounterFunction; - TString CurrCluster; + TString CurrCluster; bool HasPendingErrors; - THashMap<TString, ui32> GenIndexes; + THashMap<TString, ui32> GenIndexes; bool PragmaRefSelect = false; bool PragmaSampleSelect = false; bool PragmaAllowDotInAlias = false; @@ -156,21 +156,21 @@ namespace NSQLTranslationV0 { ui32 PragmaGroupByCubeLimit = 5; THashSet<TString> Libraries; NYql::TWarningPolicy WarningPolicy; - TVector<TString> AllResults; - TSet<TString> UsedClusters; + TVector<TString> AllResults; + TSet<TString> UsedClusters; struct ShortcutStore { - THashMap<INode*, TString> BaseMap; - TVector<std::pair<TString, TNodePtr>> Goal; + THashMap<INode*, TString> BaseMap; + TVector<std::pair<TString, TNodePtr>> Goal; }; - THashMap<ui32, ShortcutStore> Shortcuts; + THashMap<ui32, ShortcutStore> Shortcuts; ui32 ShortcutCurrentLevel = 0; }; class TTranslation { protected: - typedef TSet<ui32> TSetType; + typedef TSet<ui32> TSetType; protected: TTranslation(TContext& ctx); @@ -180,36 +180,36 @@ namespace NSQLTranslationV0 { IOutputStream& Error(); template <typename TToken> - const TString& Token(const TToken& token) { + const TString& Token(const TToken& token) { return Ctx.Token(token); } template <typename TToken> - TString Identifier(const TToken& token) { + TString Identifier(const TToken& token) { return IdContent(Ctx, Token(token)); } - TString Identifier(const TString& str) const { + TString Identifier(const TString& str) const { return IdContent(Ctx, str); } - TNodePtr GetNamedNode(const TString& name); - void PushNamedNode(const TString& name, TNodePtr node); - void PopNamedNode(const TString& name); + TNodePtr GetNamedNode(const TString& name); + void PushNamedNode(const TString& name, TNodePtr node); + void PopNamedNode(const TString& name); template <typename TNode> - void AltNotImplemented(const TString& ruleName, const TNode& node) { + void AltNotImplemented(const TString& ruleName, const TNode& node) { AltNotImplemented(ruleName, node.Alt_case(), node, TNode::descriptor()); } template <typename TNode> - TString AltDescription(const TNode& node) const { + TString AltDescription(const TNode& node) const { return AltDescription(node, node.Alt_case(), TNode::descriptor()); } protected: - void AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr); - TString AltDescription(const google::protobuf::Message& node, ui32 altCase, const google::protobuf::Descriptor* descr) const; + void AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr); + TString AltDescription(const google::protobuf::Message& node, ui32 altCase, const google::protobuf::Descriptor* descr) const; protected: TContext& Ctx; diff --git a/ydb/library/yql/sql/v0/insert.cpp b/ydb/library/yql/sql/v0/insert.cpp index 1d8aec71349..5cc6d22ae59 100644 --- a/ydb/library/yql/sql/v0/insert.cpp +++ b/ydb/library/yql/sql/v0/insert.cpp @@ -7,7 +7,7 @@ using namespace NYql; namespace NSQLTranslationV0 { -static const TMap<ESQLWriteColumnMode, EWriteColumnMode> sqlIntoMode2WriteColumn = { +static const TMap<ESQLWriteColumnMode, EWriteColumnMode> sqlIntoMode2WriteColumn = { {ESQLWriteColumnMode::InsertInto, EWriteColumnMode::Insert}, {ESQLWriteColumnMode::InsertOrAbortInto, EWriteColumnMode::InsertOrAbort}, {ESQLWriteColumnMode::InsertOrIgnoreInto, EWriteColumnMode::InsertOrIgnore}, @@ -21,7 +21,7 @@ static const TMap<ESQLWriteColumnMode, EWriteColumnMode> sqlIntoMode2WriteColumn class TModifySourceBase: public ISource { public: - TModifySourceBase(TPosition pos, const TVector<TString>& columnsHint) + TModifySourceBase(TPosition pos, const TVector<TString>& columnsHint) : ISource(pos) , ColumnsHint(columnsHint) { @@ -33,7 +33,7 @@ public: return false; } - bool AddGroupKey(TContext& ctx, const TString& column) override { + bool AddGroupKey(TContext& ctx, const TString& column) override { Y_UNUSED(column); ctx.Error(Pos) << "Source does not allow grouping"; return false; @@ -52,19 +52,19 @@ public: return nullptr; } - TNodePtr BuildAggregation(const TString& label) override { + TNodePtr BuildAggregation(const TString& label) override { Y_UNUSED(label); return nullptr; } protected: - TVector<TString> ColumnsHint; - TString OperationHumanName; + TVector<TString> ColumnsHint; + TString OperationHumanName; }; class TUpdateByValues: public TModifySourceBase { public: - TUpdateByValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) + TUpdateByValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) : TModifySourceBase(pos, columnsHint) , OperationHumanName(operationHumanName) , Values(values) @@ -89,7 +89,7 @@ public: auto structObj = Y("AsStruct"); for (size_t i = 0; i < Values.size(); ++i) { - TString column = ColumnsHint[i]; + TString column = ColumnsHint[i]; TNodePtr value = Values[i]; structObj = L(structObj, Q(Y(Q(column), value))); @@ -103,15 +103,15 @@ public: return new TUpdateByValues(Pos, OperationHumanName, ColumnsHint, CloneContainer(Values)); } private: - TString OperationHumanName; + TString OperationHumanName; protected: - TVector<TNodePtr> Values; + TVector<TNodePtr> Values; }; class TModifyByValues: public TModifySourceBase { public: - TModifyByValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values) + TModifyByValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values) : TModifySourceBase(pos, columnsHint) , OperationHumanName(operationHumanName) , Values(values) @@ -159,7 +159,7 @@ public: } TNodePtr DoClone() const final { - TVector<TVector<TNodePtr>> clonedValues; + TVector<TVector<TNodePtr>> clonedValues; clonedValues.reserve(Values.size()); for (auto cur: Values) { clonedValues.push_back(CloneContainer(cur)); @@ -168,14 +168,14 @@ public: } private: - TString OperationHumanName; - TVector<TVector<TNodePtr>> Values; + TString OperationHumanName; + TVector<TVector<TNodePtr>> Values; TSourcePtr FakeSource; }; class TModifyBySource: public TModifySourceBase { public: - TModifyBySource(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, TSourcePtr source) + TModifyBySource(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, TSourcePtr source) : TModifySourceBase(pos, columnsHint) , OperationHumanName(operationHumanName) , Source(std::move(source)) @@ -246,23 +246,23 @@ public: } private: - TString OperationHumanName; + TString OperationHumanName; TSourcePtr Source; }; -TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values) { +TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values) { return new TModifyByValues(pos, operationHumanName, columnsHint, values); } -TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) { +TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) { return new TModifyByValues(pos, operationHumanName, columnsHint, {values}); } -TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, TSourcePtr source) { +TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, TSourcePtr source) { return new TModifyBySource(pos, operationHumanName, columnsHint, std::move(source)); } -TSourcePtr BuildUpdateValues(TPosition pos, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) { +TSourcePtr BuildUpdateValues(TPosition pos, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) { return new TUpdateByValues(pos, "UPDATE", columnsHint, values); } diff --git a/ydb/library/yql/sql/v0/join.cpp b/ydb/library/yql/sql/v0/join.cpp index 78f5affb49a..1a1971d1b5d 100644 --- a/ydb/library/yql/sql/v0/join.cpp +++ b/ydb/library/yql/sql/v0/join.cpp @@ -17,8 +17,8 @@ namespace { } -TString NormalizeJoinOp(const TString& joinOp) { - TVector<TString> joinOpsParts; +TString NormalizeJoinOp(const TString& joinOp) { + TVector<TString> joinOpsParts; Split(joinOp, " ", joinOpsParts); for (auto&x : joinOpsParts) { x.to_title(); @@ -28,23 +28,23 @@ TString NormalizeJoinOp(const TString& joinOp) { } struct TJoinDescr { - TString Op; + TString Op; struct TFullColumn { ui32 Source; TNodePtr Column; }; - TVector<std::pair<TFullColumn, TFullColumn>> Keys; + TVector<std::pair<TFullColumn, TFullColumn>> Keys; - TJoinDescr(const TString& op) + TJoinDescr(const TString& op) : Op(op) {} }; class TJoinBase: public IJoin { public: - TJoinBase(TPosition pos, TVector<TSourcePtr>&& sources) + TJoinBase(TPosition pos, TVector<TSourcePtr>&& sources) : IJoin(pos) , Sources(std::move(sources)) { @@ -99,7 +99,7 @@ public: unsigned acceptedColumns = 0; TIntrusivePtr<TColumnNode> tryColumn = static_cast<TColumnNode*>(column.Clone().Get()); tryColumn->SetAsNotReliable(); - TString lastAcceptedColumnSource; + TString lastAcceptedColumnSource; for (auto& source: Sources) { if (source->AddColumn(ctx, *tryColumn)) { ++acceptedColumns; @@ -139,12 +139,12 @@ public: TNodePtr BuildJoinKeys(TContext& ctx, const TVector<TDeferredAtom>& names) override { const size_t n = JoinOps.size(); - TString what(Sources[n]->GetLabel()); - static const TSet<TString> noRightSourceJoinOps = {"LeftOnly", "LeftSemi"}; + TString what(Sources[n]->GetLabel()); + static const TSet<TString> noRightSourceJoinOps = {"LeftOnly", "LeftSemi"}; for (size_t nn = n; nn > 0 && noRightSourceJoinOps.contains(JoinOps[nn-1]); --nn) { what = Sources[nn-1]->GetLabel(); } - const TString with(Sources[n + 1]->GetLabel()); + const TString with(Sources[n + 1]->GetLabel()); for (auto index = n; index <= n + 1; ++index) { const auto& label = Sources[index]->GetLabel(); @@ -184,23 +184,23 @@ public: bool DoInit(TContext& ctx, ISource* src) override; - void SetupJoin(const TString& opName, TNodePtr expr) override { + void SetupJoin(const TString& opName, TNodePtr expr) override { JoinOps.push_back(opName); JoinExprs.push_back(expr); } protected: - static TString FullColumnName(const TColumnNode& column) { + static TString FullColumnName(const TColumnNode& column) { auto sourceName = *column.GetSourceName(); auto columnName = *column.GetColumnName(); return sourceName ? DotJoin(sourceName, columnName) : columnName; } bool InitKeysOrFilters(TContext& ctx, ui32 joinIdx, TNodePtr expr) { - const TString joinOp(JoinOps[joinIdx]); + const TString joinOp(JoinOps[joinIdx]); const TCallNode* op = nullptr; if (expr) { - const TString opName(expr->GetOpName()); + const TString opName(expr->GetOpName()); if (opName != "==") { ctx.Error(expr->GetPos()) << "JOIN ON expression must be a conjunction of equality predicates"; return false; @@ -212,7 +212,7 @@ protected: } ui32 idx = 0; - THashMap<TString, ui32> sources; + THashMap<TString, ui32> sources; for (auto& source: Sources) { sources.insert({ source->GetLabel(), idx }); ++idx; @@ -227,10 +227,10 @@ protected: ui32 rightArg = 0; ui32 leftSourceIdx = 0; ui32 rightSourceIdx = 0; - const TString* leftSource = nullptr; - const TString* rightSource = nullptr; + const TString* leftSource = nullptr; + const TString* rightSource = nullptr; const TString* sameColumnNamePtr = nullptr; - TSet<TString> joinedSources; + TSet<TString> joinedSources; if (op) { const TString* columnNamePtr = nullptr; for (auto& arg : op->GetArgs()) { @@ -339,12 +339,12 @@ protected: } protected: - TVector<TString> JoinOps; - TVector<TNodePtr> JoinExprs; - TVector<TJoinDescr> JoinDescrs; + TVector<TString> JoinOps; + TVector<TNodePtr> JoinExprs; + TVector<TJoinDescr> JoinDescrs; TNodePtr KeysGround; - THashMap<TString, THashSet<TString>> SameKeyMap; - TVector<TSourcePtr> Sources; + THashMap<TString, THashSet<TString>> SameKeyMap; + TVector<TSourcePtr> Sources; TColumns JoinedColumns; bool KeysInitializing = false; bool IsColumnDone = false; @@ -396,7 +396,7 @@ bool TJoinBase::DoInit(TContext& ctx, ISource* src) { YQL_ENSURE(JoinOps.size() == JoinExprs.size(), "Invalid join exprs number"); - const TSet<TString> allowedJoinOps = {"Inner", "Left", "Right", "Full", "LeftOnly", "RightOnly", "Exclusion", "LeftSemi", "RightSemi", "Cross"}; + const TSet<TString> allowedJoinOps = {"Inner", "Left", "Right", "Full", "LeftOnly", "RightOnly", "Exclusion", "LeftSemi", "RightSemi", "Cross"}; for (auto& opName: JoinOps) { if (!allowedJoinOps.contains(opName)) { ctx.Error(Pos) << "Invalid join op: " << opName; @@ -407,7 +407,7 @@ bool TJoinBase::DoInit(TContext& ctx, ISource* src) { ui32 idx = 0; for (auto expr: JoinExprs) { if (expr) { - TDeque<TNodePtr> conjQueue; + TDeque<TNodePtr> conjQueue; conjQueue.push_back(expr); while (!conjQueue.empty()) { TNodePtr cur = conjQueue.front(); @@ -428,7 +428,7 @@ bool TJoinBase::DoInit(TContext& ctx, ISource* src) { ++idx; } - TSet<ui32> joinedSources; + TSet<ui32> joinedSources; for (auto& descr: JoinDescrs) { for (auto& key : descr.Keys) { joinedSources.insert(key.first.Source); @@ -447,13 +447,13 @@ bool TJoinBase::DoInit(TContext& ctx, ISource* src) { class TEquiJoin: public TJoinBase { public: - TEquiJoin(TPosition pos, TVector<TSourcePtr>&& sources) + TEquiJoin(TPosition pos, TVector<TSourcePtr>&& sources) : TJoinBase(pos, std::move(sources)) { } TNodePtr Build(TContext& ctx) override { - TMap<std::pair<TString, TString>, TNodePtr> extraColumns; + TMap<std::pair<TString, TString>, TNodePtr> extraColumns; TNodePtr joinTree; for (auto& descr: JoinDescrs) { auto leftBranch = joinTree; @@ -536,12 +536,12 @@ public: return equiJoin; } - const THashMap<TString, THashSet<TString>>& GetSameKeysMap() const override { + const THashMap<TString, THashSet<TString>>& GetSameKeysMap() const override { return SameKeyMap; } - const TSet<TString> GetJoinLabels() const override { - TSet<TString> labels; + const TSet<TString> GetJoinLabels() const override { + TSet<TString> labels; for (auto& source: Sources) { const auto label = source->GetLabel(); YQL_ENSURE(label); @@ -551,7 +551,7 @@ public: } TPtr DoClone() const final { - TVector<TSourcePtr> clonedSources; + TVector<TSourcePtr> clonedSources; for (auto& cur: Sources) { clonedSources.push_back(cur->CloneSource()); } @@ -564,15 +564,15 @@ public: private: TNodePtr GetColumnNames( TContext& ctx, - TMap<std::pair<TString, TString>, TNodePtr>& extraColumns, - const TVector<std::pair<TJoinDescr::TFullColumn, TJoinDescr::TFullColumn>>& keys, + TMap<std::pair<TString, TString>, TNodePtr>& extraColumns, + const TVector<std::pair<TJoinDescr::TFullColumn, TJoinDescr::TFullColumn>>& keys, bool left ) { Y_UNUSED(ctx); auto res = Y(); for (auto& it: keys) { auto tableName = Sources[left ? it.first.Source : it.second.Source]->GetLabel(); - TString columnName; + TString columnName; auto column = left ? it.first.Column : it.second.Column; if (!column) { continue; @@ -595,7 +595,7 @@ private: } }; -TSourcePtr BuildEquiJoin(TPosition pos, TVector<TSourcePtr>&& sources) { +TSourcePtr BuildEquiJoin(TPosition pos, TVector<TSourcePtr>&& sources) { return new TEquiJoin(pos, std::move(sources)); } diff --git a/ydb/library/yql/sql/v0/list_builtin.cpp b/ydb/library/yql/sql/v0/list_builtin.cpp index 64b016610dd..e8e3ba1a916 100644 --- a/ydb/library/yql/sql/v0/list_builtin.cpp +++ b/ydb/library/yql/sql/v0/list_builtin.cpp @@ -86,9 +86,9 @@ TNodePtr TListProcessBuiltin::PrepareResult() { TNodePtr result; if (OpLiteral) { size_t modulePos = OpLiteral->find("::"); - if (modulePos != TString::npos) { - const TString& module = OpLiteral->substr(0, modulePos); - const TString& function = OpLiteral->substr(modulePos + 2); + if (modulePos != TString::npos) { + const TString& module = OpLiteral->substr(0, modulePos); + const TString& function = OpLiteral->substr(modulePos + 2); auto udf = Y("Udf", Q(module + "." + function)); result = Y("Apply", udf, "item"); } else { diff --git a/ydb/library/yql/sql/v0/list_builtin.h b/ydb/library/yql/sql/v0/list_builtin.h index 9fc4f22ce62..2afe7b4efe8 100644 --- a/ydb/library/yql/sql/v0/list_builtin.h +++ b/ydb/library/yql/sql/v0/list_builtin.h @@ -17,8 +17,8 @@ namespace NSQLTranslationV0 { class TListBuiltin: public TCallNode { public: TListBuiltin(TPosition pos, - const TString& opName, - const TVector<TNodePtr>& args) + const TString& opName, + const TVector<TNodePtr>& args) : TCallNode(pos, opName, args.size(), args.size(), args) , OpName(opName) , Args(args) @@ -29,8 +29,8 @@ public: TAstNode* Translate(TContext& ctx) const override; protected: - const TString OpName; - TVector<TNodePtr> Args; + const TString OpName; + TVector<TNodePtr> Args; TNodePtr Node; inline TNodePtr GetIdentityLambda(); @@ -44,7 +44,7 @@ protected: class TListSortBuiltin final: public TListBuiltin { public: - TListSortBuiltin(TPosition pos, const TVector<TNodePtr>& args, bool asc) + TListSortBuiltin(TPosition pos, const TVector<TNodePtr>& args, bool asc) : TListBuiltin(pos, "Sort", args) , Asc(asc) {} @@ -61,7 +61,7 @@ private: class TListExtractBuiltin final: public TListBuiltin { public: - TListExtractBuiltin(TPosition pos, const TVector<TNodePtr>& args) + TListExtractBuiltin(TPosition pos, const TVector<TNodePtr>& args) : TListBuiltin(pos, "OrderedExtract", args) {} @@ -75,8 +75,8 @@ public: class TListProcessBuiltin: public TListBuiltin { protected: TListProcessBuiltin(TPosition pos, - const TString& opName, - const TVector<TNodePtr>& args) + const TString& opName, + const TVector<TNodePtr>& args) : TListBuiltin(pos, opName, args) , OpLiteral(nullptr) {} @@ -85,13 +85,13 @@ protected: TNodePtr PrepareResult(); - const TString* OpLiteral; + const TString* OpLiteral; }; class TListMapBuiltin final: public TListProcessBuiltin { public: TListMapBuiltin(TPosition pos, - const TVector<TNodePtr>& args, + const TVector<TNodePtr>& args, bool flat) : TListProcessBuiltin(pos, flat ? "OrderedFlatMap" : "OrderedMap", args) , Flat(flat) @@ -111,7 +111,7 @@ private: class TListFilterBuiltin final: public TListProcessBuiltin { public: TListFilterBuiltin(TPosition pos, - const TVector<TNodePtr>& args) + const TVector<TNodePtr>& args) : TListProcessBuiltin(pos, "OrderedFilter", args) {} @@ -128,11 +128,11 @@ protected: class TListFoldBuiltin: public TListBuiltin { public: TListFoldBuiltin(TPosition pos, - const TString& opName, - const TString& stateType, - const TString& stateValue, + const TString& opName, + const TString& stateType, + const TString& stateValue, const ui32 argCount, - const TVector<TNodePtr>& args) + const TVector<TNodePtr>& args) : TListBuiltin(pos, opName, args) , StateType(stateType) , StateValue(stateValue) @@ -142,8 +142,8 @@ public: bool DoInit(TContext& ctx, ISource* src) override; protected: - const TString StateType; - const TString StateValue; + const TString StateType; + const TString StateValue; const ui32 ArgCount; virtual TNodePtr GetInitialState(); @@ -153,8 +153,8 @@ protected: class TListFoldBuiltinImpl final: public TListFoldBuiltin { public: - TListFoldBuiltinImpl(TPosition pos, const TString& opName, const TString& stateType, const TString& stateValue, - const ui32 argCount, const TVector<TNodePtr>& args) + TListFoldBuiltinImpl(TPosition pos, const TString& opName, const TString& stateType, const TString& stateValue, + const ui32 argCount, const TVector<TNodePtr>& args) : TListFoldBuiltin(pos, opName, stateType, stateValue, argCount, args) {} @@ -165,7 +165,7 @@ public: class TListCountBuiltin final: public TListFoldBuiltin { public: - TListCountBuiltin(TPosition pos, const TVector<TNodePtr>& args) + TListCountBuiltin(TPosition pos, const TVector<TNodePtr>& args) : TListFoldBuiltin(pos, "Inc", "Uint64", "0", 1, args) {} @@ -178,7 +178,7 @@ private: class TListAvgBuiltin final: public TListFoldBuiltin { public: - TListAvgBuiltin(TPosition pos, const TVector<TNodePtr>& args) + TListAvgBuiltin(TPosition pos, const TVector<TNodePtr>& args) : TListFoldBuiltin(pos, "Avg", "", "", 1, args) { } @@ -196,7 +196,7 @@ private: class TListHasBuiltin final: public TListFoldBuiltin { public: - TListHasBuiltin(TPosition pos, const TVector<TNodePtr>& args) + TListHasBuiltin(TPosition pos, const TVector<TNodePtr>& args) : TListFoldBuiltin(pos, "==", "Bool", "false", 2, args) { } @@ -222,8 +222,8 @@ private: class TListFold1Builtin final: public TListBuiltin { public: TListFold1Builtin(TPosition pos, - const TString& opName, - const TVector<TNodePtr>& args) + const TString& opName, + const TVector<TNodePtr>& args) : TListBuiltin(pos, opName, args) { } @@ -244,7 +244,7 @@ protected: class TListUniqBuiltin final: public TListBuiltin { public: TListUniqBuiltin(TPosition pos, - const TVector<TNodePtr>& args) + const TVector<TNodePtr>& args) : TListBuiltin(pos, "ListUniq", args) {} @@ -258,7 +258,7 @@ public: class TListCreateBuiltin final: public TListBuiltin { public: TListCreateBuiltin(TPosition pos, - const TVector<TNodePtr>& args) + const TVector<TNodePtr>& args) : TListBuiltin(pos, "ListCreate", args) {} diff --git a/ydb/library/yql/sql/v0/node.cpp b/ydb/library/yql/sql/v0/node.cpp index 57f0c6a561f..0e19ca991b6 100644 --- a/ydb/library/yql/sql/v0/node.cpp +++ b/ydb/library/yql/sql/v0/node.cpp @@ -41,15 +41,15 @@ TTableRef::TTableRef(const TTableRef& tr) { } -TString TTableRef::ShortName() const { +TString TTableRef::ShortName() const { Y_VERIFY_DEBUG(Keys); if (Keys->GetTableKeys()->GetTableName()) { return *Keys->GetTableKeys()->GetTableName(); } - return TString(); + return TString(); } -TString TTableRef::ServiceName(const TContext& ctx) const { +TString TTableRef::ServiceName(const TContext& ctx) const { auto service = ctx.GetClusterProvider(Cluster); YQL_ENSURE(service); return *service; @@ -97,11 +97,11 @@ TPosition INode::GetPos() const { return Pos; } -const TString& INode::GetLabel() const { +const TString& INode::GetLabel() const { return Label; } -void INode::SetLabel(const TString& label) { +void INode::SetLabel(const TString& label) { Label = label; } @@ -145,23 +145,23 @@ const TString* INode::SubqueryAlias() const { return nullptr; } -TString INode::GetOpName() const { - return TString(); +TString INode::GetOpName() const { + return TString(); } -const TString* INode::GetLiteral(const TString& type) const { +const TString* INode::GetLiteral(const TString& type) const { Y_UNUSED(type); return nullptr; } -const TString* INode::GetColumnName() const { +const TString* INode::GetColumnName() const { return nullptr; } void INode::AssumeColumn() { } -const TString* INode::GetSourceName() const { +const TString* INode::GetSourceName() const { return nullptr; } @@ -186,7 +186,7 @@ ISource* INode::GetSource() { return nullptr; } -TVector<TNodePtr>* INode::ContentListPtr() { +TVector<TNodePtr>* INode::ContentListPtr() { return nullptr; } @@ -219,7 +219,7 @@ TNodePtr INode::AstNode(TNodePtr node) const { return node; } -TNodePtr INode::AstNode(const TString& str) const { +TNodePtr INode::AstNode(const TString& str) const { return new TAstAtomNodeImpl(Pos, str, TNodeFlags::Default); } @@ -287,7 +287,7 @@ void INode::DoAdd(TNodePtr node) { Y_VERIFY_DEBUG(false, "Node is not expandable"); } -TAstAtomNode::TAstAtomNode(TPosition pos, const TString& content, ui32 flags) +TAstAtomNode::TAstAtomNode(TPosition pos, const TString& content, ui32 flags) : INode(pos) , Content(content) , Flags(flags) @@ -321,7 +321,7 @@ TAstNode* TAstDirectNode::Translate(TContext& ctx) const { return Node; } -TNodePtr BuildAtom(TPosition pos, const TString& content, ui32 flags) { +TNodePtr BuildAtom(TPosition pos, const TString& content, ui32 flags) { return new TAstAtomNodeImpl(pos, content, flags); } @@ -363,7 +363,7 @@ TAstNode* TAstListNode::Translate(TContext& ctx) const { return TAstNode::NewList(listPos, children.data(), children.size(), *ctx.Pool); } -void TAstListNode::UpdateStateByListNodes(const TVector<TNodePtr>& nodes) const { +void TAstListNode::UpdateStateByListNodes(const TVector<TNodePtr>& nodes) const { bool isConst = true; struct TAttributesFlags { bool has = false; @@ -400,7 +400,7 @@ TAstListNode::TAstListNode(const TAstListNode& node) State = node.State; } -TAstListNode::TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes) +TAstListNode::TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes) : INode(pos) , Nodes(std::move(nodes)) { @@ -420,7 +420,7 @@ TAstListNodeImpl::TAstListNodeImpl(TPosition pos) : TAstListNode(pos) {} -TAstListNodeImpl::TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes) +TAstListNodeImpl::TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes) : TAstListNode(pos) { Nodes.swap(nodes); @@ -430,7 +430,7 @@ TNodePtr TAstListNodeImpl::DoClone() const { return new TAstListNodeImpl(Pos, CloneContainer(Nodes)); } -bool ValidateAllNodesForAggregation(TContext& ctx, const TVector<TNodePtr>& nodes) { +bool ValidateAllNodesForAggregation(TContext& ctx, const TVector<TNodePtr>& nodes) { for (auto& node: nodes) { if (node->IsConstant()) { continue; @@ -443,7 +443,7 @@ bool ValidateAllNodesForAggregation(TContext& ctx, const TVector<TNodePtr>& node return true; } -TCallNode::TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TCallNode::TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TAstListNode(pos) , OpName(opName) , MinArgs(minArgs) @@ -452,12 +452,12 @@ TCallNode::TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxA { } -TString TCallNode::GetOpName() const { +TString TCallNode::GetOpName() const { return OpName; } -const TString* TCallNode::GetSourceName() const { - const TString* name = nullptr; +const TString* TCallNode::GetSourceName() const { + const TString* name = nullptr; for (auto& arg: Args) { auto n = arg->GetSourceName(); if (!n) { @@ -471,7 +471,7 @@ const TString* TCallNode::GetSourceName() const { return name; } -const TVector<TNodePtr>& TCallNode::GetArgs() const { +const TVector<TNodePtr>& TCallNode::GetArgs() const { return Args; } @@ -479,7 +479,7 @@ void TCallNode::DoUpdateState() const { UpdateStateByListNodes(Args); } -TString TCallNode::GetCallExplain() const { +TString TCallNode::GetCallExplain() const { auto derivedName = GetOpName(); TStringBuilder sb; sb << derivedName << "()"; @@ -531,11 +531,11 @@ bool TCallNode::DoInit(TContext& ctx, ISource* src) { return true; } -TCallNodeImpl::TCallNodeImpl(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TCallNodeImpl::TCallNodeImpl(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TCallNode(pos, opName, minArgs, maxArgs, args) {} -TCallNodeImpl::TCallNodeImpl(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) +TCallNodeImpl::TCallNodeImpl(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, args.size(), args.size(), args) {} @@ -543,12 +543,12 @@ TCallNode::TPtr TCallNodeImpl::DoClone() const { return new TCallNodeImpl(GetPos(), OpName, MinArgs, MaxArgs, CloneContainer(Args)); } -TCallNodeDepArgs::TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TCallNodeDepArgs::TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TCallNode(pos, opName, minArgs, maxArgs, args) , ReqArgsCount(reqArgsCount) {} -TCallNodeDepArgs::TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, const TVector<TNodePtr>& args) +TCallNodeDepArgs::TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, args.size(), args.size(), args) , ReqArgsCount(reqArgsCount) {} @@ -572,7 +572,7 @@ TCallDirectRow::TPtr TCallDirectRow::DoClone() const { return new TCallDirectRow(Pos, OpName, CloneContainer(Args)); } -TCallDirectRow::TCallDirectRow(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) +TCallDirectRow::TCallDirectRow(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, 0, 0, args) {} @@ -635,16 +635,16 @@ INode::TPtr TWinAggrEmulation::WindowSpecFunc(const TPtr& type) const { return Q(Y(Q(FuncAlias), result)); } -TWinAggrEmulation::TWinAggrEmulation(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TWinAggrEmulation::TWinAggrEmulation(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TCallNode(pos, opName, minArgs, maxArgs, args) , FuncAlias(opName) {} -TWinRowNumber::TWinRowNumber(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TWinRowNumber::TWinRowNumber(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TWinAggrEmulation(pos, opName, minArgs, maxArgs, args) {} -TWinLeadLag::TWinLeadLag(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TWinLeadLag::TWinLeadLag(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TWinAggrEmulation(pos, opName, minArgs, maxArgs, args) {} @@ -666,7 +666,7 @@ bool TWinLeadLag::DoInit(TContext& ctx, ISource* src) { class TQuotedAtomNode: public TAstListNode { public: - TQuotedAtomNode(TPosition pos, const TString& content, ui32 flags) + TQuotedAtomNode(TPosition pos, const TString& content, ui32 flags) : TAstListNode(pos) { Add("quote", BuildAtom(pos, content, flags)); @@ -683,7 +683,7 @@ protected: } }; -TNodePtr BuildQuotedAtom(TPosition pos, const TString& content, ui32 flags) { +TNodePtr BuildQuotedAtom(TPosition pos, const TString& content, ui32 flags) { return new TQuotedAtomNode(pos, content, flags); } @@ -731,14 +731,14 @@ void TColumns::Merge(const TColumns& columns) { } } -void TColumns::SetPrefix(const TString& prefix) { +void TColumns::SetPrefix(const TString& prefix) { Y_VERIFY_DEBUG(!prefix.empty()); - auto addPrefixFunc = [&prefix](const TString& str) { + auto addPrefixFunc = [&prefix](const TString& str) { return prefix + "." + str; }; - TSet<TString> newReal; - TSet<TString> newArtificial; - TVector<TString> newList; + TSet<TString> newReal; + TSet<TString> newArtificial; + TVector<TString> newList; std::transform(Real.begin(), Real.end(), std::inserter(newReal, newReal.begin()), addPrefixFunc); std::transform(Artificial.begin(), Artificial.end(), std::inserter(newArtificial, newArtificial.begin()), addPrefixFunc); std::transform(List.begin(), List.end(), std::back_inserter(newList), addPrefixFunc); @@ -800,7 +800,7 @@ THoppingWindowSpecPtr THoppingWindowSpec::Clone() const { return res; } -TColumnNode::TColumnNode(TPosition pos, const TString& column, const TString& source) +TColumnNode::TColumnNode(TPosition pos, const TString& column, const TString& source) : INode(pos) , ColumnName(column) , Source(source) @@ -826,11 +826,11 @@ bool TColumnNode::IsArtificial() const { return Artificial; } -const TString* TColumnNode::GetColumnName() const { +const TString* TColumnNode::GetColumnName() const { return UseSourceAsColumn ? &Source : (ColumnExpr ? nullptr : &ColumnName); } -const TString* TColumnNode::GetSourceName() const { +const TString* TColumnNode::GetSourceName() const { return UseSourceAsColumn ? &Empty : &Source; } @@ -923,7 +923,7 @@ TAstNode* TColumnNode::Translate(TContext& ctx) const { return Node->Translate(ctx); } -void TColumnNode::ResetColumn(const TString& column, const TString& source) { +void TColumnNode::ResetColumn(const TString& column, const TString& source) { YQL_ENSURE(!State.Test(ENodeState::Initialized)); /// should be not initialized Reliable = true; UseSource = false; @@ -943,9 +943,9 @@ void TColumnNode::ResetColumn(const TNodePtr& column, const TString& source) { Source = source; } -const TString TColumnNode::Empty; +const TString TColumnNode::Empty; -TNodePtr BuildColumn(TPosition pos, const TString& column, const TString& source) { +TNodePtr BuildColumn(TPosition pos, const TString& column, const TString& source) { return new TColumnNode(pos, column, source); } @@ -963,7 +963,7 @@ ITableKeys::ITableKeys(TPosition pos) { } -const TString* ITableKeys::GetTableName() const { +const TString* ITableKeys::GetTableName() const { return nullptr; } @@ -986,7 +986,7 @@ void IAggregation::DoUpdateState() const { State.Set(ENodeState::OverWindow, AggMode == EAggregateMode::OverWindow); } -const TString* IAggregation::GetGenericKey() const { +const TString* IAggregation::GetGenericKey() const { return nullptr; } @@ -994,11 +994,11 @@ void IAggregation::Join(IAggregation*) { Y_VERIFY(false); } -const TString& IAggregation::GetName() const { +const TString& IAggregation::GetName() const { return Name; } -IAggregation::IAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) +IAggregation::IAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) : INode(pos), Name(name), Func(func), AggMode(aggMode) {} @@ -1085,7 +1085,7 @@ bool ISource::AddFilter(TContext& ctx, TNodePtr filter) { return true; } -bool ISource::AddGroupKey(TContext& ctx, const TString& column) { +bool ISource::AddGroupKey(TContext& ctx, const TString& column) { if (!GroupKeys.insert(column).second) { ctx.Error() << "Duplicate grouping column: " << column; return false; @@ -1094,9 +1094,9 @@ bool ISource::AddGroupKey(TContext& ctx, const TString& column) { return true; } -bool ISource::AddExpressions(TContext& ctx, const TVector<TNodePtr>& expressions, EExprSeat exprSeat) { +bool ISource::AddExpressions(TContext& ctx, const TVector<TNodePtr>& expressions, EExprSeat exprSeat) { YQL_ENSURE(exprSeat < EExprSeat::Max); - TSet<TString> names; + TSet<TString> names; for (const auto& expr: expressions) { const auto& alias = expr->GetLabel(); const auto& columnNamePtr = expr->GetColumnName(); @@ -1212,11 +1212,11 @@ TWindowSpecificationPtr ISource::FindWindowSpecification(TContext& ctx, const TS return winSpec; } -inline TVector<TNodePtr>& ISource::Expressions(EExprSeat exprSeat) { +inline TVector<TNodePtr>& ISource::Expressions(EExprSeat exprSeat) { return NamedExprs[static_cast<size_t>(exprSeat)]; } -inline const TVector<TNodePtr>& ISource::Expressions(EExprSeat exprSeat) const { +inline const TVector<TNodePtr>& ISource::Expressions(EExprSeat exprSeat) const { return NamedExprs[static_cast<size_t>(exprSeat)]; } @@ -1236,7 +1236,7 @@ inline TNodePtr ISource::AliasOrColumn(const TNodePtr& node, bool withSource) { return node->Q(result); } -bool ISource::AddAggregationOverWindow(TContext& ctx, const TString& windowName, TAggregationPtr func) { +bool ISource::AddAggregationOverWindow(TContext& ctx, const TString& windowName, TAggregationPtr func) { if (func->IsDistinct()) { ctx.Error(func->GetPos()) << "Aggregation with distinct is not allowed over window: " << windowName; return false; @@ -1248,7 +1248,7 @@ bool ISource::AddAggregationOverWindow(TContext& ctx, const TString& windowName, return true; } -bool ISource::AddFuncOverWindow(TContext& ctx, const TString& windowName, TNodePtr func) { +bool ISource::AddFuncOverWindow(TContext& ctx, const TString& windowName, TNodePtr func) { if (!FindWindowSpecification(ctx, windowName)) { return false; } @@ -1260,7 +1260,7 @@ bool ISource::IsCompositeSource() const { return false; } -bool ISource::IsGroupByColumn(const TString& column) const { +bool ISource::IsGroupByColumn(const TString& column) const { return GroupKeys.contains(column); } @@ -1268,7 +1268,7 @@ bool ISource::IsFlattenByColumns() const { return !Expressions(EExprSeat::FlattenBy).empty(); } -bool ISource::IsAlias(EExprSeat exprSeat, const TString& column) const { +bool ISource::IsAlias(EExprSeat exprSeat, const TString& column) const { for (const auto& exprNode: Expressions(exprSeat)) { const auto& labelName = exprNode->GetLabel(); if (labelName && labelName == column) { @@ -1278,7 +1278,7 @@ bool ISource::IsAlias(EExprSeat exprSeat, const TString& column) const { return false; } -bool ISource::IsExprAlias(const TString& column) const { +bool ISource::IsExprAlias(const TString& column) const { std::array<EExprSeat, 3> exprSeats = {{EExprSeat::FlattenBy, EExprSeat::GroupBy, EExprSeat::WindowPartitionBy}}; for (auto seat: exprSeats) { if (IsAlias(seat, column)) { @@ -1346,7 +1346,7 @@ bool ISource::SetSamplingOptions(TContext& ctx, return false; } -bool ISource::CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const { +bool ISource::CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const { Y_UNUSED(columns); Y_UNUSED(hint); ctx.Error() << "Source not support grouping hint"; @@ -1374,7 +1374,7 @@ TNodePtr ISource::BuildFilterLambda(const TNodePtr& groundNode) { return BuildLambda(Pos, Y("row"), filter); } -TNodePtr ISource::BuildFlattenByColumns(const TString& label) { +TNodePtr ISource::BuildFlattenByColumns(const TString& label) { auto columnsList = Y("FlattenByColumns", Q(FlattenMode), label); for (const auto& column: Expressions(EExprSeat::FlattenBy)) { const auto columnNamePtr = column->GetColumnName(); @@ -1422,7 +1422,7 @@ TNodePtr ISource::BuildPrewindowMap(TContext& ctx, const TNodePtr& groundNode) { return Y(ctx.UseUnordered(*this) ? "OrderedFlatMap" : "FlatMap", "core", BuildLambda(Pos, Y("row"), Y("AsList", feed))); } -TNodePtr ISource::BuildAggregation(const TString& label) { +TNodePtr ISource::BuildAggregation(const TString& label) { if (GroupKeys.empty() && Aggregations.empty() && !IsCompositeSource()) { return nullptr; } @@ -1432,7 +1432,7 @@ TNodePtr ISource::BuildAggregation(const TString& label) { keysTuple = L(keysTuple, BuildQuotedAtom(Pos, key)); } - std::map<std::pair<bool, TString>, std::vector<IAggregation*>> genericAggrs; + std::map<std::pair<bool, TString>, std::vector<IAggregation*>> genericAggrs; for (const auto& aggr: Aggregations) { if (const auto key = aggr->GetGenericKey()) { genericAggrs[{aggr->IsDistinct(), *key}].emplace_back(aggr.Get()); @@ -1469,7 +1469,7 @@ TNodePtr ISource::BuildAggregation(const TString& label) { return Y("Aggregate", label, Q(keysTuple), Q(aggrArgs)); } -TMaybe<TString> ISource::FindColumnMistype(const TString& name) const { +TMaybe<TString> ISource::FindColumnMistype(const TString& name) const { auto result = FindMistypeIn(GroupKeys, name); return result ? result : FindMistypeIn(ExprAliases, name); } @@ -1483,26 +1483,26 @@ struct TWinFrame { }; struct TWinPartition { - TString ParentLabel; + TString ParentLabel; size_t Id = 0; - TVector<size_t> FrameIds; - TVector<TSortSpecificationPtr> OrderBy; - TVector<TNodePtr> Partitions; + TVector<size_t> FrameIds; + TVector<TSortSpecificationPtr> OrderBy; + TVector<TNodePtr> Partitions; }; /// \todo use few levels of grouping (got from group by cube, etc) class WindowFuncSupp { public: struct EvalOverWindow { - TVector<TAggregationPtr> Aggregations; - TVector<TNodePtr> Functions; + TVector<TAggregationPtr> Aggregations; + TVector<TNodePtr> Functions; }; - size_t GetWindowByName(const TString& windowName) { + size_t GetWindowByName(const TString& windowName) { auto iter = WindowMap.find(windowName); return iter != WindowMap.end() ? iter->second : 0; } - size_t CreateWindowBySpec(const TString& windowName, const TWindowSpecificationPtr& winSpec) { + size_t CreateWindowBySpec(const TString& windowName, const TWindowSpecificationPtr& winSpec) { Y_UNUSED(windowName); auto curPartitions = winSpec->Partitions; auto curOrderBy = winSpec->OrderBy; @@ -1551,7 +1551,7 @@ public: Evals[windowId-1].Functions.push_back(func); } - const TVector<TWinPartition>& GetPartitions() { + const TVector<TWinPartition>& GetPartitions() { return Partitions; } const EvalOverWindow& GetEvals(size_t frameId) { @@ -1565,9 +1565,9 @@ public: } private: - TVector<TWinPartition> Partitions; - TMap<TString, size_t> WindowMap; - TVector<EvalOverWindow> Evals; + TVector<TWinPartition> Partitions; + TMap<TString, size_t> WindowMap; + TVector<EvalOverWindow> Evals; }; TNodePtr ISource::BuildCalcOverWindow(TContext& ctx, const TString& label, const TNodePtr& ground) { @@ -1638,7 +1638,7 @@ TNodePtr ISource::BuildCalcOverWindow(TContext& ctx, const TString& label, const } } -TNodePtr ISource::BuildSort(TContext& ctx, const TString& label) { +TNodePtr ISource::BuildSort(TContext& ctx, const TString& label) { Y_UNUSED(ctx); Y_UNUSED(label); return nullptr; @@ -1702,7 +1702,7 @@ TAstNode* ISource::Translate(TContext& ctx) const { return nullptr; } -void ISource::FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortDirection, TNodePtr& sortKeySelector) { +void ISource::FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortDirection, TNodePtr& sortKeySelector) { TNodePtr expr; if (orderBy.empty()) { YQL_ENSURE(!sortKeySelector); @@ -1727,7 +1727,7 @@ void ISource::FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNode sortKeySelector = BuildLambda(Pos, Y("row"), expr); } -TNodePtr ISource::BuildSortSpec(const TVector<TSortSpecificationPtr>& orderBy, const TString& label, const TNodePtr& ground, bool traits) { +TNodePtr ISource::BuildSortSpec(const TVector<TSortSpecificationPtr>& orderBy, const TString& label, const TNodePtr& ground, bool traits) { YQL_ENSURE(!orderBy.empty()); TNodePtr dirsNode; auto keySelectorNode = ground; @@ -1777,7 +1777,7 @@ bool TryStringContent(const TString& str, TString& result, ui32& flags, TString& } } else if (str.size() >= 4 && str.StartsWith("@@") && str.EndsWith("@@")) { flags = TNodeFlags::MultilineContent; - TString s = str.substr(2, str.length() - 4); + TString s = str.substr(2, str.length() - 4); SubstGlobal(s, "@@@@", "@@"); result.swap(s); } else { @@ -1886,7 +1886,7 @@ TLiteralNode::TLiteralNode(TPosition pos, bool isNull) Add(isNull ? "Null" : "Void"); } -TLiteralNode::TLiteralNode(TPosition pos, const TString& type, const TString& value) +TLiteralNode::TLiteralNode(TPosition pos, const TString& type, const TString& value) : TAstListNode(pos) , Null(false) , Void(false) @@ -1910,7 +1910,7 @@ bool TLiteralNode::IsNull() const { return Null; } -const TString* TLiteralNode::GetLiteral(const TString& type) const { +const TString* TLiteralNode::GetLiteral(const TString& type) const { return type == Type ? &Value : nullptr; } @@ -1925,7 +1925,7 @@ TNodePtr TLiteralNode::DoClone() const { } template<typename T> -TLiteralNumberNode<T>::TLiteralNumberNode(TPosition pos, const TString& type, const TString& value) +TLiteralNumberNode<T>::TLiteralNumberNode(TPosition pos, const TString& type, const TString& value) : TLiteralNode(pos, type, value) {} @@ -1988,7 +1988,7 @@ TNodePtr BuildLiteralRawString(TPosition pos, const TString& value) { return new TLiteralNode(pos, "String", value); } -TNodePtr BuildLiteralBool(TPosition pos, const TString& value) { +TNodePtr BuildLiteralBool(TPosition pos, const TString& value) { return new TLiteralNode(pos, "Bool", value); } @@ -2031,7 +2031,7 @@ bool TDeferredAtom::Empty() const { return !Node || Repr.empty(); } -TTupleNode::TTupleNode(TPosition pos, const TVector<TNodePtr>& exprs) +TTupleNode::TTupleNode(TPosition pos, const TVector<TNodePtr>& exprs) : TAstListNode(pos) , Exprs(exprs) {} @@ -2040,7 +2040,7 @@ bool TTupleNode::IsEmpty() const { return Exprs.empty(); } -const TVector<TNodePtr>& TTupleNode::Elements() const { +const TVector<TNodePtr>& TTupleNode::Elements() const { return Exprs; } @@ -2069,11 +2069,11 @@ TNodePtr TTupleNode::DoClone() const { return new TTupleNode(Pos, CloneContainer(Exprs)); } -TNodePtr BuildTuple(TPosition pos, const TVector<TNodePtr>& exprs) { +TNodePtr BuildTuple(TPosition pos, const TVector<TNodePtr>& exprs) { return new TTupleNode(pos, exprs); } -TStructNode::TStructNode(TPosition pos, const TVector<TNodePtr>& exprs) +TStructNode::TStructNode(TPosition pos, const TVector<TNodePtr>& exprs) : TAstListNode(pos) , Exprs(exprs) {} @@ -2095,16 +2095,16 @@ TNodePtr TStructNode::DoClone() const { return new TStructNode(Pos, CloneContainer(Exprs)); } -TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprs) { +TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprs) { return new TStructNode(pos, exprs); } -TListOfNamedNodes::TListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs) +TListOfNamedNodes::TListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs) : INode(pos) , Exprs(std::move(exprs)) {} -TVector<TNodePtr>* TListOfNamedNodes::ContentListPtr() { +TVector<TNodePtr>* TListOfNamedNodes::ContentListPtr() { return &Exprs; } @@ -2118,14 +2118,14 @@ TNodePtr TListOfNamedNodes::DoClone() const { return {}; } -TNodePtr BuildListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs) { +TNodePtr BuildListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs) { return new TListOfNamedNodes(pos, std::move(exprs)); } const char* const TArgPlaceholderNode::ProcessRows = "$ROWS"; const char* const TArgPlaceholderNode::ProcessRow = "$ROW"; -TArgPlaceholderNode::TArgPlaceholderNode(TPosition pos, const TString &name) : +TArgPlaceholderNode::TArgPlaceholderNode(TPosition pos, const TString &name) : INode(pos), Name(name) { @@ -2142,7 +2142,7 @@ TAstNode* TArgPlaceholderNode::Translate(TContext& ctx) const { return nullptr; } -TString TArgPlaceholderNode::GetName() const { +TString TArgPlaceholderNode::GetName() const { return Name; } @@ -2150,7 +2150,7 @@ TNodePtr TArgPlaceholderNode::DoClone() const { return {}; } -TNodePtr BuildArgPlaceholder(TPosition pos, const TString& name) { +TNodePtr BuildArgPlaceholder(TPosition pos, const TString& name) { return new TArgPlaceholderNode(pos, name); } @@ -2168,7 +2168,7 @@ public: auto column = dynamic_cast<TColumnNode*>(Ids[0].Expr.Get()); if (column) { ui32 idx = 1; - TString source; + TString source; if (Ids.size() > 2) { source = Ids[idx].Name; ++idx; @@ -2245,11 +2245,11 @@ public: return Ids[idx].Name; } - const TString* GetColumnName() const override { + const TString* GetColumnName() const override { return ColumnOnly ? Ids[0].Expr->GetColumnName() : nullptr; } - const TString* GetSourceName() const override { + const TString* GetSourceName() const override { return Ids[0].Expr->GetSourceName(); } @@ -2328,7 +2328,7 @@ public: TPtr DoClone() const override { YQL_ENSURE(!Node, "TAccessNode::Clone: Node should not be initialized"); - TVector<TIdPart> cloneIds; + TVector<TIdPart> cloneIds; cloneIds.reserve(Ids.size()); for (const auto& id: Ids) { cloneIds.emplace_back(id.Clone()); @@ -2368,7 +2368,7 @@ protected: private: TNodePtr Node; - TVector<TIdPart> Ids; + TVector<TIdPart> Ids; bool IsLookup; bool ColumnOnly; bool IsColumnRequired; @@ -2381,7 +2381,7 @@ TNodePtr BuildAccess(TPosition pos, const TVector<INode::TIdPart>& ids, bool isL class TBindNode: public TAstListNode { public: - TBindNode(TPosition pos, const TString& module, const TString& alias) + TBindNode(TPosition pos, const TString& module, const TString& alias) : TAstListNode(pos) { Add("bind", AstNode(module), BuildQuotedAtom(pos, alias)); @@ -2392,13 +2392,13 @@ public: } }; -TNodePtr BuildBind(TPosition pos, const TString& module, const TString& alias) { +TNodePtr BuildBind(TPosition pos, const TString& module, const TString& alias) { return new TBindNode(pos, module, alias); } class TLambdaNode: public TAstListNode { public: - TLambdaNode(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName) + TLambdaNode(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName) : TAstListNode(pos) { if (!resName.empty()) { @@ -2412,7 +2412,7 @@ public: } }; -TNodePtr BuildLambda(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName) { +TNodePtr BuildLambda(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName) { return new TLambdaNode(pos, params, body, resName); } @@ -2427,11 +2427,11 @@ public: , ParamTwo(paramTwo) {} - const TString* GetSourceName() const override { + const TString* GetSourceName() const override { return Expr->GetSourceName(); } - TString GetOpName() const override { + TString GetOpName() const override { return Bit ? "BitCast" : "Cast"; } @@ -2448,7 +2448,7 @@ public: bool DoInit(TContext& ctx, ISource* src) override; private: TNodePtr Expr; - const TString NormalizedTypeName; + const TString NormalizedTypeName; const TString ParamOne, ParamTwo; }; @@ -2513,8 +2513,8 @@ TNodePtr BuildBitCast(TContext& ctx, TPosition pos, TNodePtr expr, const TString } TString TypeByAlias(const TString& alias, bool normalize) { - TString type(alias); - TCiString typeAlias(alias); + TString type(alias); + TCiString typeAlias(alias); if (typeAlias.StartsWith("varchar")) { type = "String"; } else if (typeAlias == "tinyint") { @@ -2541,7 +2541,7 @@ TNodePtr BuildIsNullOp(TPosition pos, TNodePtr a) { return new TCallNodeImpl(pos, "Not", {new TCallNodeImpl(pos, "Exists", {a})}); } -TNodePtr BuildUnaryOp(TPosition pos, const TString& opName, TNodePtr a) { +TNodePtr BuildUnaryOp(TPosition pos, const TString& opName, TNodePtr a) { if (!a) { return nullptr; } @@ -2553,7 +2553,7 @@ TNodePtr BuildUnaryOp(TPosition pos, const TString& opName, TNodePtr a) { class TBinaryOpNode final: public TCallNode { public: - TBinaryOpNode(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b); + TBinaryOpNode(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b); TNodePtr DoClone() const final { YQL_ENSURE(Args.size() == 2); @@ -2561,12 +2561,12 @@ public: } }; -TBinaryOpNode::TBinaryOpNode(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b) +TBinaryOpNode::TBinaryOpNode(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b) : TCallNode(pos, opName, 2, 2, { a, b }) { } -TNodePtr BuildBinaryOp(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b) { +TNodePtr BuildBinaryOp(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b) { if (!a || !b) { return nullptr; } @@ -2578,7 +2578,7 @@ TNodePtr BuildBinaryOp(TPosition pos, const TString& opName, TNodePtr a, TNodePt class TCalcOverWindow final: public INode { public: - TCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr node) + TCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr node) : INode(pos) , WindowName(windowName) , FuncNode(node) @@ -2607,11 +2607,11 @@ public: State.Set(ENodeState::OverWindow, true); } protected: - const TString WindowName; + const TString WindowName; TNodePtr FuncNode; }; -TNodePtr BuildCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr call) { +TNodePtr BuildCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr call) { return new TCalcOverWindow(pos, windowName, call); } diff --git a/ydb/library/yql/sql/v0/node.h b/ydb/library/yql/sql/v0/node.h index 4c7cfc273b6..9f35e97a893 100644 --- a/ydb/library/yql/sql/v0/node.h +++ b/ydb/library/yql/sql/v0/node.h @@ -73,7 +73,7 @@ namespace NSQLTranslationV0 { class IAggregation; typedef TIntrusivePtr<IAggregation> TAggregationPtr; - inline TString DotJoin(const TString& lhs, const TString& rhs) { + inline TString DotJoin(const TString& lhs, const TString& rhs) { TStringBuilder sb; sb << lhs << "." << rhs; return sb; @@ -87,11 +87,11 @@ namespace NSQLTranslationV0 { typedef TIntrusivePtr<INode> TPtr; struct TIdPart { - TString Name; + TString Name; TPtr Expr; i32 Pos = -1; - TIdPart(const TString& name) + TIdPart(const TString& name) : Name(name) { } @@ -116,8 +116,8 @@ namespace NSQLTranslationV0 { virtual ~INode(); TPosition GetPos() const; - const TString& GetLabel() const; - void SetLabel(const TString& label); + const TString& GetLabel() const; + void SetLabel(const TString& label); void SetCountHint(bool isCount); bool GetCountHint() const; @@ -136,17 +136,17 @@ namespace NSQLTranslationV0 { virtual bool IsIntegerLiteral() const; virtual bool IsAsterisk() const; virtual const TString* SubqueryAlias() const; - virtual TString GetOpName() const; - virtual const TString* GetLiteral(const TString& type) const; - virtual const TString* GetColumnName() const; + virtual TString GetOpName() const; + virtual const TString* GetLiteral(const TString& type) const; + virtual const TString* GetColumnName() const; virtual void AssumeColumn(); - virtual const TString* GetSourceName() const; + virtual const TString* GetSourceName() const; virtual const TString* GetAtomContent() const; virtual size_t GetTupleSize() const; virtual TPtr GetTupleElement(size_t index) const; virtual ITableKeys* GetTableKeys(); virtual ISource* GetSource(); - virtual TVector<INode::TPtr>* ContentListPtr(); + virtual TVector<INode::TPtr>* ContentListPtr(); virtual TAstNode* Translate(TContext& ctx) const = 0; virtual TAggregationPtr GetAggregation() const; virtual TPtr WindowSpecFunc(const TPtr& type) const; @@ -157,7 +157,7 @@ namespace NSQLTranslationV0 { TPtr AstNode() const; TPtr AstNode(TAstNode* node) const; TPtr AstNode(TPtr node) const; - TPtr AstNode(const TString& str) const; + TPtr AstNode(const TString& str) const; template <typename TVal, typename... TVals> void Add(TVal val, TVals... vals) { @@ -205,7 +205,7 @@ namespace NSQLTranslationV0 { protected: TPosition Pos; - TString Label; + TString Label; mutable TNodeState State; bool AsInner = false; }; @@ -217,8 +217,8 @@ namespace NSQLTranslationV0 { } template<class T> - inline TVector<T> CloneContainer(const TVector<T>& args) { - TVector<T> cloneArgs; + inline TVector<T> CloneContainer(const TVector<T>& args) { + TVector<T> cloneArgs; cloneArgs.reserve(args.size()); for (const auto& arg: args) { cloneArgs.emplace_back(SafeClone(arg)); @@ -228,19 +228,19 @@ namespace NSQLTranslationV0 { class TAstAtomNode: public INode { public: - TAstAtomNode(TPosition pos, const TString& content, ui32 flags); + TAstAtomNode(TPosition pos, const TString& content, ui32 flags); ~TAstAtomNode() override; TAstNode* Translate(TContext& ctx) const override; - const TString& GetContent() const { + const TString& GetContent() const { return Content; } const TString* GetAtomContent() const override; protected: - TString Content; + TString Content; ui32 Flags; void DoUpdateState() const override; @@ -248,7 +248,7 @@ namespace NSQLTranslationV0 { class TAstAtomNodeImpl final: public TAstAtomNode { public: - TAstAtomNodeImpl(TPosition pos, const TString& content, ui32 flags) + TAstAtomNodeImpl(TPosition pos, const TString& content, ui32 flags) : TAstAtomNode(pos, content, flags) {} @@ -279,24 +279,24 @@ namespace NSQLTranslationV0 { protected: explicit TAstListNode(const TAstListNode& node); - explicit TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes); + explicit TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes); TPtr ShallowCopy() const override; bool DoInit(TContext& ctx, ISource* src) override; void DoAdd(TNodePtr node) override; void DoUpdateState() const override; - void UpdateStateByListNodes(const TVector<TNodePtr>& Nodes) const; + void UpdateStateByListNodes(const TVector<TNodePtr>& Nodes) const; protected: - TVector<TNodePtr> Nodes; + TVector<TNodePtr> Nodes; mutable TMaybe<bool> CacheGroupKey; }; class TAstListNodeImpl final: public TAstListNode { public: TAstListNodeImpl(TPosition pos); - TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes); + TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes); protected: TNodePtr DoClone() const final; @@ -304,26 +304,26 @@ namespace NSQLTranslationV0 { class TCallNode: public TAstListNode { public: - TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); - TCallNode(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) + TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TCallNode(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, args.size(), args.size(), args) {} - TString GetOpName() const override; - const TString* GetSourceName() const override; + TString GetOpName() const override; + const TString* GetSourceName() const override; - const TVector<TNodePtr>& GetArgs() const; + const TVector<TNodePtr>& GetArgs() const; protected: bool DoInit(TContext& ctx, ISource* src) override; bool ValidateArguments(TContext& ctx) const; - TString GetCallExplain() const; + TString GetCallExplain() const; protected: - TString OpName; + TString OpName; i32 MinArgs; i32 MaxArgs; - TVector<TNodePtr> Args; + TVector<TNodePtr> Args; mutable TMaybe<bool> CacheGroupKey; void DoUpdateState() const override; @@ -332,15 +332,15 @@ namespace NSQLTranslationV0 { class TCallNodeImpl final: public TCallNode { TPtr DoClone() const final; public: - TCallNodeImpl(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); - TCallNodeImpl(TPosition pos, const TString& opName, const TVector<TNodePtr>& args); + TCallNodeImpl(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TCallNodeImpl(TPosition pos, const TString& opName, const TVector<TNodePtr>& args); }; class TCallNodeDepArgs final : public TCallNode { TPtr DoClone() const final; public: - TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); - TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, const TVector<TNodePtr>& args); + TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, const TVector<TNodePtr>& args); protected: bool DoInit(TContext& ctx, ISource* src) override; @@ -351,7 +351,7 @@ namespace NSQLTranslationV0 { class TCallDirectRow final : public TCallNode { TPtr DoClone() const final; public: - TCallDirectRow(TPosition pos, const TString& opName, const TVector<TNodePtr>& args); + TCallDirectRow(TPosition pos, const TString& opName, const TVector<TNodePtr>& args); protected: bool DoInit(TContext& ctx, ISource* src) override; void DoUpdateState() const override; @@ -363,13 +363,13 @@ namespace NSQLTranslationV0 { bool DoInit(TContext& ctx, ISource* src) override; TPtr WindowSpecFunc(const TNodePtr& type) const override; public: - TWinAggrEmulation(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TWinAggrEmulation(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); protected: template<class TNodeType> TPtr CallNodeClone() const { return new TNodeType(GetPos(), OpName, MinArgs, MaxArgs, CloneContainer(Args)); } - TString FuncAlias; + TString FuncAlias; TNodePtr WinAggrGround; }; @@ -378,7 +378,7 @@ namespace NSQLTranslationV0 { return CallNodeClone<TWinRowNumber>(); } public: - TWinRowNumber(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TWinRowNumber(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); }; class TWinLeadLag final: public TWinAggrEmulation { @@ -387,7 +387,7 @@ namespace NSQLTranslationV0 { } bool DoInit(TContext& ctx, ISource* src) override; public: - TWinLeadLag(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TWinLeadLag(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); }; class ITableKeys: public INode { @@ -400,7 +400,7 @@ namespace NSQLTranslationV0 { }; ITableKeys(TPosition pos); - virtual const TString* GetTableName() const; + virtual const TString* GetTableName() const; virtual TNodePtr BuildKeys(TContext& ctx, EBuildKeysMode mode) = 0; private: @@ -421,15 +421,15 @@ namespace NSQLTranslationV0 { struct TTableRef { const TString RefName; - const TString Cluster; + const TString Cluster; TNodePtr Keys; TNodePtr Options; TTableRef(const TString& refName, const TString& cluster, TNodePtr keys); TTableRef(const TTableRef& tr); - TString ShortName() const; - TString ServiceName(const TContext& ctx) const; + TString ShortName() const; + TString ServiceName(const TContext& ctx) const; bool Check(TContext& ctx) const; }; @@ -437,17 +437,17 @@ namespace NSQLTranslationV0 { struct TIdentifier { TPosition Pos; - TString Name; + TString Name; - TIdentifier(TPosition pos, const TString& name) + TIdentifier(TPosition pos, const TString& name) : Pos(pos) , Name(name) {} }; struct TColumnSchema { TPosition Pos; - TString Name; - TString Type; + TString Name; + TString Type; bool Nullable; bool IsTypeString; @@ -455,9 +455,9 @@ namespace NSQLTranslationV0 { }; struct TColumns: public TSimpleRefCount<TColumns> { - TSet<TString> Real; - TSet<TString> Artificial; - TVector<TString> List; + TSet<TString> Real; + TSet<TString> Artificial; + TVector<TString> List; TVector<bool> NamedColumns; bool All = false; bool QualifiedAll = false; @@ -465,7 +465,7 @@ namespace NSQLTranslationV0 { bool Add(const TString* column, bool countHint, bool isArtificial = false, bool isReliable = true, bool hasName = true); void Merge(const TColumns& columns); - void SetPrefix(const TString& prefix); + void SetPrefix(const TString& prefix); void SetAll(); bool IsColumnPossible(TContext& ctx, const TString& column); }; @@ -497,9 +497,9 @@ namespace NSQLTranslationV0 { }; struct TWindowSpecification: public TSimpleRefCount<TWindowSpecification> { - TMaybe<TString> ExistingWindowName; - TVector<TNodePtr> Partitions; - TVector<TSortSpecificationPtr> OrderBy; + TMaybe<TString> ExistingWindowName; + TVector<TNodePtr> Partitions; + TVector<TSortSpecificationPtr> OrderBy; TMaybe<TFrameSpecification> Frame; TIntrusivePtr<TWindowSpecification> Clone() const; @@ -517,13 +517,13 @@ namespace NSQLTranslationV0 { }; typedef TIntrusivePtr<TWindowSpecification> TWindowSpecificationPtr; - typedef TMap<TString, TWindowSpecificationPtr> TWinSpecs; + typedef TMap<TString, TWindowSpecificationPtr> TWinSpecs; typedef TVector<TTableRef> TTableList; typedef TIntrusivePtr<THoppingWindowSpec> THoppingWindowSpecPtr; - bool ValidateAllNodesForAggregation(TContext& ctx, const TVector<TNodePtr>& nodes); + bool ValidateAllNodesForAggregation(TContext& ctx, const TVector<TNodePtr>& nodes); class TDeferredAtom { public: @@ -548,7 +548,7 @@ namespace NSQLTranslationV0 { class TColumnNode final: public INode { public: - TColumnNode(TPosition pos, const TString& column, const TString& source); + TColumnNode(TPosition pos, const TString& column, const TString& source); TColumnNode(TPosition pos, const TNodePtr& column, const TString& source); virtual ~TColumnNode(); @@ -557,7 +557,7 @@ namespace NSQLTranslationV0 { const TString* GetColumnName() const override; const TString* GetSourceName() const override; TAstNode* Translate(TContext& ctx) const override; - void ResetColumn(const TString& column, const TString& source); + void ResetColumn(const TString& column, const TString& source); void ResetColumn(const TNodePtr& column, const TString& source); void SetUseSourceAsColumn(); @@ -574,11 +574,11 @@ namespace NSQLTranslationV0 { void DoUpdateState() const override; private: - static const TString Empty; + static const TString Empty; TNodePtr Node; TString ColumnName; TNodePtr ColumnExpr; - TString Source; + TString Source; bool GroupKey = false; bool Artificial = false; bool Reliable = true; @@ -592,18 +592,18 @@ namespace NSQLTranslationV0 { static const char* const ProcessRows; static const char* const ProcessRow; public: - TArgPlaceholderNode(TPosition pos, const TString &name); + TArgPlaceholderNode(TPosition pos, const TString &name); TAstNode* Translate(TContext& ctx) const override; - TString GetName() const; + TString GetName() const; TNodePtr DoClone() const final; protected: bool DoInit(TContext& ctx, ISource* src) override; private: - TString Name; + TString Name; }; enum class EAggregateMode { @@ -614,30 +614,30 @@ namespace NSQLTranslationV0 { class TTupleNode: public TAstListNode { public: - TTupleNode(TPosition pos, const TVector<TNodePtr>& exprs); + TTupleNode(TPosition pos, const TVector<TNodePtr>& exprs); bool IsEmpty() const; - const TVector<TNodePtr>& Elements() const; + const TVector<TNodePtr>& Elements() const; bool DoInit(TContext& ctx, ISource* src) override; size_t GetTupleSize() const override; TPtr GetTupleElement(size_t index) const override; TNodePtr DoClone() const final; private: - const TVector<TNodePtr> Exprs; + const TVector<TNodePtr> Exprs; }; class TStructNode: public TAstListNode { public: - TStructNode(TPosition pos, const TVector<TNodePtr>& exprs); + TStructNode(TPosition pos, const TVector<TNodePtr>& exprs); bool DoInit(TContext& ctx, ISource* src) override; TNodePtr DoClone() const final; - const TVector<TNodePtr>& GetExprs() { + const TVector<TNodePtr>& GetExprs() { return Exprs; } private: - const TVector<TNodePtr> Exprs; + const TVector<TNodePtr> Exprs; }; class IAggregation: public INode { @@ -646,7 +646,7 @@ namespace NSQLTranslationV0 { void DoUpdateState() const override; - virtual const TString* GetGenericKey() const; + virtual const TString* GetGenericKey() const; virtual bool InitAggr(TContext& ctx, bool isFactory, ISource* src, TAstListNode& node, const TVector<TNodePtr>& exprs) = 0; @@ -660,7 +660,7 @@ namespace NSQLTranslationV0 { virtual TNodePtr WindowTraits(const TNodePtr& type) const; - const TString& GetName() const; + const TString& GetName() const; virtual void Join(IAggregation* aggr); @@ -668,13 +668,13 @@ namespace NSQLTranslationV0 { virtual TNodePtr GetApply(const TNodePtr& type) const = 0; protected: - IAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode mode); + IAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode mode); TAstNode* Translate(TContext& ctx) const override; - TString Name; - const TString Func; + TString Name; + const TString Func; const EAggregateMode AggMode; - TString DistinctKey; + TString DistinctKey; }; enum class EExprSeat: int { @@ -703,12 +703,12 @@ namespace NSQLTranslationV0 { /// in case of error unfilled, flag show if ensure column name virtual TMaybe<bool> AddColumn(TContext& ctx, TColumnNode& column); virtual void FinishColumns(); - virtual bool AddExpressions(TContext& ctx, const TVector<TNodePtr>& columns, EExprSeat exprSeat); + virtual bool AddExpressions(TContext& ctx, const TVector<TNodePtr>& columns, EExprSeat exprSeat); virtual void SetFlattenByMode(const TString& mode); virtual void MarkFlattenColumns(); virtual bool IsFlattenColumns() const; virtual bool AddFilter(TContext& ctx, TNodePtr filter); - virtual bool AddGroupKey(TContext& ctx, const TString& column); + virtual bool AddGroupKey(TContext& ctx, const TString& column); virtual TString MakeLocalName(const TString& name); virtual bool AddAggregation(TContext& ctx, TAggregationPtr aggr); virtual bool AddFuncOverWindow(TContext& ctx, TNodePtr expr); @@ -716,12 +716,12 @@ namespace NSQLTranslationV0 { virtual const TVector<TString>& GetTmpWindowColumns() const; virtual bool HasAggregations() const; virtual void AddWindowSpecs(TWinSpecs winSpecs); - virtual bool AddAggregationOverWindow(TContext& ctx, const TString& windowName, TAggregationPtr func); - virtual bool AddFuncOverWindow(TContext& ctx, const TString& windowName, TNodePtr func); + virtual bool AddAggregationOverWindow(TContext& ctx, const TString& windowName, TAggregationPtr func); + virtual bool AddFuncOverWindow(TContext& ctx, const TString& windowName, TNodePtr func); virtual void SetHoppingWindowSpec(THoppingWindowSpecPtr spec); virtual THoppingWindowSpecPtr GetHoppingWindowSpec() const; virtual bool IsCompositeSource() const; - virtual bool IsGroupByColumn(const TString& column) const; + virtual bool IsGroupByColumn(const TString& column) const; virtual bool IsFlattenByColumns() const; virtual bool IsCalcOverWindow() const; virtual bool IsOverWindowSource() const; @@ -729,16 +729,16 @@ namespace NSQLTranslationV0 { virtual bool IsOrdered() const; virtual TWriteSettings GetWriteSettings() const; virtual bool SetSamplingOptions(TContext& ctx, TPosition pos, ESampleMode mode, TNodePtr samplingRate, TNodePtr samplingSeed); - virtual bool CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const; + virtual bool CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const; virtual TNodePtr BuildFilter(TContext& ctx, const TString& label, const TNodePtr& groundNode); virtual TNodePtr BuildFilterLambda(const TNodePtr& groundNode); - virtual TNodePtr BuildFlattenByColumns(const TString& label); + virtual TNodePtr BuildFlattenByColumns(const TString& label); virtual TNodePtr BuildFlattenColumns(const TString& label); virtual TNodePtr BuildPreaggregatedMap(TContext& ctx); virtual TNodePtr BuildPrewindowMap(TContext& ctx, const TNodePtr& groundNode); - virtual TNodePtr BuildAggregation(const TString& label); + virtual TNodePtr BuildAggregation(const TString& label); virtual TNodePtr BuildCalcOverWindow(TContext& ctx, const TString& label, const TNodePtr& ground); - virtual TNodePtr BuildSort(TContext& ctx, const TString& label); + virtual TNodePtr BuildSort(TContext& ctx, const TString& label); virtual IJoin* GetJoin(); virtual ISource* GetCompositeSource(); virtual bool IsSelect() const; @@ -750,12 +750,12 @@ namespace NSQLTranslationV0 { virtual bool DoInit(TContext& ctx, ISource* src); virtual TNodePtr Build(TContext& ctx) = 0; - virtual TMaybe<TString> FindColumnMistype(const TString& name) const; + virtual TMaybe<TString> FindColumnMistype(const TString& name) const; virtual bool InitFilters(TContext& ctx); void AddDependentSource(ISource* usedSource); - bool IsAlias(EExprSeat exprSeat, const TString& label) const; - bool IsExprAlias(const TString& label) const; + bool IsAlias(EExprSeat exprSeat, const TString& label) const; + bool IsExprAlias(const TString& label) const; bool IsExprSeat(EExprSeat exprSeat, EExprType type = EExprType::WithExpression) const; TString GetGroupByColumnAlias(const TString& column) const; @@ -767,25 +767,25 @@ namespace NSQLTranslationV0 { ISource(TPosition pos); virtual TAstNode* Translate(TContext& ctx) const; - void FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortKeySelector, TNodePtr& sortDirection); - TNodePtr BuildSortSpec(const TVector<TSortSpecificationPtr>& orderBy, const TString& label, const TNodePtr& ground, bool traits = false); + void FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortKeySelector, TNodePtr& sortDirection); + TNodePtr BuildSortSpec(const TVector<TSortSpecificationPtr>& orderBy, const TString& label, const TNodePtr& ground, bool traits = false); - TVector<TNodePtr>& Expressions(EExprSeat exprSeat); - const TVector<TNodePtr>& Expressions(EExprSeat exprSeat) const; + TVector<TNodePtr>& Expressions(EExprSeat exprSeat); + const TVector<TNodePtr>& Expressions(EExprSeat exprSeat) const; TNodePtr AliasOrColumn(const TNodePtr& node, bool withSource); - THashSet<TString> ExprAliases; - THashMap<TString, TString> GroupByColumnAliases; - TVector<TNodePtr> Filters; - TSet<TString> GroupKeys; - TVector<TString> OrderedGroupKeys; - std::array<TVector<TNodePtr>, static_cast<unsigned>(EExprSeat::Max)> NamedExprs; - TVector<TAggregationPtr> Aggregations; - TMultiMap<TString, TAggregationPtr> AggregationOverWindow; - TMultiMap<TString, TNodePtr> FuncOverWindow; + THashSet<TString> ExprAliases; + THashMap<TString, TString> GroupByColumnAliases; + TVector<TNodePtr> Filters; + TSet<TString> GroupKeys; + TVector<TString> OrderedGroupKeys; + std::array<TVector<TNodePtr>, static_cast<unsigned>(EExprSeat::Max)> NamedExprs; + TVector<TAggregationPtr> Aggregations; + TMultiMap<TString, TAggregationPtr> AggregationOverWindow; + TMultiMap<TString, TNodePtr> FuncOverWindow; TWinSpecs WinSpecs; THoppingWindowSpecPtr HoppingWindowSpec; - TVector<ISource*> UsedSources; + TVector<ISource*> UsedSources; TString FlattenMode; bool FlattenColumns = false; THashMap<TString, ui32> GenIndexes; @@ -794,8 +794,8 @@ namespace NSQLTranslationV0 { typedef TIntrusivePtr<ISource> TSourcePtr; template<> - inline TVector<TSourcePtr> CloneContainer<TSourcePtr>(const TVector<TSourcePtr>& args) { - TVector<TSourcePtr> cloneArgs; + inline TVector<TSourcePtr> CloneContainer<TSourcePtr>(const TVector<TSourcePtr>& args) { + TVector<TSourcePtr> cloneArgs; cloneArgs.reserve(args.size()); for (const auto& arg: args) { cloneArgs.emplace_back(arg ? arg->CloneSource() : nullptr); @@ -809,9 +809,9 @@ namespace NSQLTranslationV0 { virtual IJoin* GetJoin(); virtual TNodePtr BuildJoinKeys(TContext& ctx, const TVector<TDeferredAtom>& names) = 0; - virtual void SetupJoin(const TString& joinOp, TNodePtr joinExpr) = 0; - virtual const THashMap<TString, THashSet<TString>>& GetSameKeysMap() const = 0; - virtual const TSet<TString> GetJoinLabels() const = 0; + virtual void SetupJoin(const TString& joinOp, TNodePtr joinExpr) = 0; + virtual const THashMap<TString, THashSet<TString>>& GetSameKeysMap() const = 0; + virtual const TSet<TString> GetJoinLabels() const = 0; protected: IJoin(TPosition pos); @@ -819,36 +819,36 @@ namespace NSQLTranslationV0 { class TListOfNamedNodes final: public INode { public: - TListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs); + TListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs); - TVector<TNodePtr>* ContentListPtr() override; + TVector<TNodePtr>* ContentListPtr() override; TAstNode* Translate(TContext& ctx) const override; TPtr DoClone() const final; private: - TVector<TNodePtr> Exprs; - TString Meaning; + TVector<TNodePtr> Exprs; + TString Meaning; }; class TLiteralNode: public TAstListNode { public: TLiteralNode(TPosition pos, bool isNull); - TLiteralNode(TPosition pos, const TString& type, const TString& value); + TLiteralNode(TPosition pos, const TString& type, const TString& value); TLiteralNode(TPosition pos, const TString& value, ui32 nodeFlags); bool IsNull() const override; - const TString* GetLiteral(const TString& type) const override; + const TString* GetLiteral(const TString& type) const override; void DoUpdateState() const override; TPtr DoClone() const override; protected: bool Null; bool Void; - TString Type; - TString Value; + TString Type; + TString Value; }; template<typename T> class TLiteralNumberNode: public TLiteralNode { public: - TLiteralNumberNode(TPosition pos, const TString& type, const TString& value); + TLiteralNumberNode(TPosition pos, const TString& type, const TString& value); TPtr DoClone() const override final; bool DoInit(TContext& ctx, ISource* src) override; bool IsIntegerLiteral() const override; @@ -864,40 +864,40 @@ namespace NSQLTranslationV0 { TString StringContent(TContext& ctx, const TString& str); bool TryStringContent(const TString& input, TString& result, ui32& flags, TString& error, TPosition& pos); TString IdContent(TContext& ctx, const TString& str); - TVector<TString> GetContextHints(TContext& ctx); + TVector<TString> GetContextHints(TContext& ctx); TString TypeByAlias(const TString& alias, bool normalize = true); - TNodePtr BuildAtom(TPosition pos, const TString& content, ui32 flags = NYql::TNodeFlags::ArbitraryContent); - TNodePtr BuildQuotedAtom(TPosition pos, const TString& content, ui32 flags = NYql::TNodeFlags::ArbitraryContent); + TNodePtr BuildAtom(TPosition pos, const TString& content, ui32 flags = NYql::TNodeFlags::ArbitraryContent); + TNodePtr BuildQuotedAtom(TPosition pos, const TString& content, ui32 flags = NYql::TNodeFlags::ArbitraryContent); TNodePtr BuildLiteralNull(TPosition pos); TNodePtr BuildLiteralVoid(TPosition pos); /// String is checked as quotable, support escaping and multiline TNodePtr BuildLiteralSmartString(TContext& ctx, const TString& value); TNodePtr BuildLiteralRawString(TPosition pos, const TString& value); - TNodePtr BuildLiteralBool(TPosition pos, const TString& value); + TNodePtr BuildLiteralBool(TPosition pos, const TString& value); TNodePtr BuildEmptyAction(TPosition pos); - TNodePtr BuildTuple(TPosition pos, const TVector<TNodePtr>& exprs); - TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprs); - TNodePtr BuildListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs); + TNodePtr BuildTuple(TPosition pos, const TVector<TNodePtr>& exprs); + TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprs); + TNodePtr BuildListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs); - TNodePtr BuildArgPlaceholder(TPosition pos, const TString& name); + TNodePtr BuildArgPlaceholder(TPosition pos, const TString& name); - TNodePtr BuildColumn(TPosition pos, const TString& column = TString(), const TString& source = TString()); + TNodePtr BuildColumn(TPosition pos, const TString& column = TString(), const TString& source = TString()); TNodePtr BuildColumn(TPosition pos, const TNodePtr& column, const TString& source = TString()); TNodePtr BuildColumn(TPosition pos, const TDeferredAtom& column, const TString& source = TString()); TNodePtr BuildAccess(TPosition pos, const TVector<INode::TIdPart>& ids, bool isLookup); - TNodePtr BuildBind(TPosition pos, const TString& module, const TString& alias); - TNodePtr BuildLambda(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName = TString()); + TNodePtr BuildBind(TPosition pos, const TString& module, const TString& alias); + TNodePtr BuildLambda(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName = TString()); TNodePtr BuildCast(TContext& ctx, TPosition pos, TNodePtr expr, const TString& typeName, const TString& paramOne = TString(), const TString& paramTwo = TString()); TNodePtr BuildBitCast(TContext& ctx, TPosition pos, TNodePtr expr, const TString& typeName, const TString& paramOne = TString(), const TString& paramTwo = TString()); TNodePtr BuildIsNullOp(TPosition pos, TNodePtr a); - TNodePtr BuildUnaryOp(TPosition pos, const TString& opName, TNodePtr a); - TNodePtr BuildBinaryOp(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b); + TNodePtr BuildUnaryOp(TPosition pos, const TString& opName, TNodePtr a); + TNodePtr BuildBinaryOp(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b); - TNodePtr BuildCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr call); + TNodePtr BuildCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr call); TNodePtr BuildYsonOptionsNode(TPosition pos, bool autoConvert, bool strict); TNodePtr BuildShortcutNode(const TNodePtr& node, const TString& baseName); @@ -907,31 +907,31 @@ namespace NSQLTranslationV0 { // Implemented in aggregation.cpp TAggregationPtr BuildFactoryAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode, bool multi = false); TAggregationPtr BuildFactoryAggregationWinAutoarg(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode); - TAggregationPtr BuildKeyPayloadFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildPayloadPredicateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildTwoArgsFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildLinearHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildKeyPayloadFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildPayloadPredicateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildTwoArgsFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildLinearHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); template <bool HasKey> TAggregationPtr BuildTopFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildTopFreqFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildTopFreqFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); TAggregationPtr BuildCountDistinctEstimateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); TAggregationPtr BuildListFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildPercentileFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode); - TAggregationPtr BuildUserDefinedFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildPercentileFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode); + TAggregationPtr BuildUserDefinedFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); typedef std::function<TNodePtr (const TString& baseName, const TNodePtr& node)> TFuncPrepareNameNode; // Implemented in builtin.cpp - TNodePtr BuildCallable(TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args); - TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args); + TNodePtr BuildCallable(TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args); + TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args); TNodePtr BuildBuiltinFunc( TContext& ctx, TPosition pos, - TString name, - const TVector<TNodePtr>& args, - const TString& nameSpace = TString(), + TString name, + const TVector<TNodePtr>& args, + const TString& nameSpace = TString(), EAggregateMode aggMode = EAggregateMode::Normal, bool* mustUseNamed = nullptr, TFuncPrepareNameNode funcPrepareNameNode = {} @@ -939,8 +939,8 @@ namespace NSQLTranslationV0 { TNodePtr TryBuildDataType(TPosition pos, const TString& stringType); // Implemented in join.cpp - TString NormalizeJoinOp(const TString& joinOp); - TSourcePtr BuildEquiJoin(TPosition pos, TVector<TSourcePtr>&& sources); + TString NormalizeJoinOp(const TString& joinOp); + TSourcePtr BuildEquiJoin(TPosition pos, TVector<TSourcePtr>&& sources); // Implemented in select.cpp TNodePtr BuildSubquery(TSourcePtr source, const TString& alias, bool inSubquery, int ensureTupleSize = -1); @@ -950,12 +950,12 @@ namespace NSQLTranslationV0 { TSourcePtr BuildFakeSource(TPosition pos); TSourcePtr BuildNodeSource(TPosition pos, const TNodePtr& node); TSourcePtr BuildTableSource(TPosition pos, const TTableRef& table, bool stream, const TString& label = TString()); - TSourcePtr BuildInnerSource(TPosition pos, TNodePtr node, const TString& label = TString()); - TSourcePtr BuildRefColumnSource(TPosition pos, const TString& partExpression); - TSourcePtr BuildUnionAll(TPosition pos, TVector<TSourcePtr>&& sources); - TSourcePtr BuildOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource); + TSourcePtr BuildInnerSource(TPosition pos, TNodePtr node, const TString& label = TString()); + TSourcePtr BuildRefColumnSource(TPosition pos, const TString& partExpression); + TSourcePtr BuildUnionAll(TPosition pos, TVector<TSourcePtr>&& sources); + TSourcePtr BuildOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource); - TNodePtr BuildOrderBy(TPosition pos, const TVector<TNodePtr>& keys, const TVector<bool>& order); + TNodePtr BuildOrderBy(TPosition pos, const TVector<TNodePtr>& keys, const TVector<bool>& order); TNodePtr BuildSkipTake(TPosition pos, const TNodePtr& skip, const TNodePtr& take); @@ -963,15 +963,15 @@ namespace NSQLTranslationV0 { TContext& ctx, TPosition pos, TSourcePtr source, - const TVector<TNodePtr>& groupByExpr, - const TVector<TNodePtr>& groupBy, - const TVector<TSortSpecificationPtr>& orderBy, + const TVector<TNodePtr>& groupByExpr, + const TVector<TNodePtr>& groupBy, + const TVector<TSortSpecificationPtr>& orderBy, TNodePtr having, TWinSpecs&& windowSpec, THoppingWindowSpecPtr hoppingWindowSpec, - TVector<TNodePtr>&& terms, + TVector<TNodePtr>&& terms, bool distinct, - TVector<TNodePtr>&& without, + TVector<TNodePtr>&& without, bool stream, const TWriteSettings& settings ); @@ -989,10 +989,10 @@ namespace NSQLTranslationV0 { TNodePtr BuildSelectResult(TPosition pos, TSourcePtr source, bool writeResult, bool inSubquery); // Implemented in insert.cpp - TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values); - TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values); - TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, TSourcePtr source); - TSourcePtr BuildUpdateValues(TPosition pos, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values); + TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values); + TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values); + TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, TSourcePtr source); + TSourcePtr BuildUpdateValues(TPosition pos, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values); EWriteColumnMode ToWriteColumnsMode(ESQLWriteColumnMode sqlWriteColumnMode); TNodePtr BuildEraseColumns(TPosition pos, const TVector<TString>& columns); @@ -1002,21 +1002,21 @@ namespace NSQLTranslationV0 { // Implemented in query.cpp TNodePtr BuildTableKey(TPosition pos, const TString& cluster, const TDeferredAtom& name, const TString& view); - TNodePtr BuildTableKeys(TPosition pos, const TString& cluster, const TString& func, const TVector<TTableArg>& args); - TNodePtr BuildInputOptions(TPosition pos, const TVector<TString>& hints); + TNodePtr BuildTableKeys(TPosition pos, const TString& cluster, const TString& func, const TVector<TTableArg>& args); + TNodePtr BuildInputOptions(TPosition pos, const TVector<TString>& hints); TNodePtr BuildInputTables(TPosition pos, const TTableList& tables, bool inSubquery); - TNodePtr BuildCreateTable(TPosition pos, const TTableRef& table, const TVector<TColumnSchema>& columns, + TNodePtr BuildCreateTable(TPosition pos, const TTableRef& table, const TVector<TColumnSchema>& columns, const TVector<TIdentifier>& pkColumns, const TVector<TIdentifier>& partitionByColumns, const TVector<std::pair<TIdentifier, bool>>& orderByColumns); - TNodePtr BuildAlterTable(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, EAlterTableIntentnt mode); + TNodePtr BuildAlterTable(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, EAlterTableIntentnt mode); TNodePtr BuildDropTable(TPosition pos, const TTableRef& table); TNodePtr BuildWriteTable(TPosition pos, const TString& label, const TTableRef& table, EWriteColumnMode mode, TNodePtr options = nullptr); - TNodePtr BuildWriteResult(TPosition pos, const TString& label, TNodePtr settings, const TSet<TString>& clusters); - TNodePtr BuildCommitClusters(TPosition pos, const TSet<TString>& clusters = TSet<TString>()); - TNodePtr BuildRollbackClusters(TPosition pos, const TSet<TString>& clusters = TSet<TString>()); + TNodePtr BuildWriteResult(TPosition pos, const TString& label, TNodePtr settings, const TSet<TString>& clusters); + TNodePtr BuildCommitClusters(TPosition pos, const TSet<TString>& clusters = TSet<TString>()); + TNodePtr BuildRollbackClusters(TPosition pos, const TSet<TString>& clusters = TSet<TString>()); TNodePtr BuildQuery(TPosition pos, const TVector<TNodePtr>& blocks, bool topLevel); TNodePtr BuildPragma(TPosition pos, const TString& prefix, const TString& name, const TVector<TDeferredAtom>& values, bool valueDefault); - TNodePtr BuildSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq); + TNodePtr BuildSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq); TNodePtr BuildEvaluateIfNode(TPosition pos, TNodePtr predicate, TNodePtr thenNode, TNodePtr elseNode); TNodePtr BuildEvaluateForNode(TPosition pos, TNodePtr list, TNodePtr bodyNode, TNodePtr elseNode); diff --git a/ydb/library/yql/sql/v0/query.cpp b/ydb/library/yql/sql/v0/query.cpp index 7752b28b017..fd0eab9a888 100644 --- a/ydb/library/yql/sql/v0/query.cpp +++ b/ydb/library/yql/sql/v0/query.cpp @@ -28,7 +28,7 @@ public: } } - const TString* GetTableName() const override { + const TString* GetTableName() const override { return Name.GetLiteral() ? &Full : nullptr; } @@ -62,10 +62,10 @@ public: } private: - TString Cluster; + TString Cluster; TDeferredAtom Name; - TString View; - TString Full; + TString View; + TString Full; }; TNodePtr BuildTableKey(TPosition pos, const TString& cluster, const TDeferredAtom& name, const TString& view) { @@ -74,7 +74,7 @@ TNodePtr BuildTableKey(TPosition pos, const TString& cluster, const TDeferredAto class TPrepTableKeys: public ITableKeys { public: - TPrepTableKeys(TPosition pos, const TString& cluster, const TString& func, const TVector<TTableArg>& args) + TPrepTableKeys(TPosition pos, const TString& cluster, const TString& func, const TVector<TTableArg>& args) : ITableKeys(pos) , Cluster(cluster) , Func(func) @@ -93,7 +93,7 @@ public: return nullptr; } - TCiString func(Func); + TCiString func(Func); if (func == "concat_strict") { auto tuple = Y(); for (auto& arg: Args) { @@ -306,18 +306,18 @@ public: } private: - TString Cluster; - TString Func; - TVector<TTableArg> Args; + TString Cluster; + TString Func; + TVector<TTableArg> Args; }; -TNodePtr BuildTableKeys(TPosition pos, const TString& cluster, const TString& func, const TVector<TTableArg>& args) { +TNodePtr BuildTableKeys(TPosition pos, const TString& cluster, const TString& func, const TVector<TTableArg>& args) { return new TPrepTableKeys(pos, cluster, func, args); } class TInputOptions final: public TAstListNode { public: - TInputOptions(TPosition pos, const TVector<TString>& hints) + TInputOptions(TPosition pos, const TVector<TString>& hints) : TAstListNode(pos) , Hints(hints) { @@ -325,7 +325,7 @@ public: bool DoInit(TContext& ctx, ISource* src) override { Y_UNUSED(src); - TSet<TString> used; + TSet<TString> used; for (auto& hint: Hints) { TMaybe<TIssue> normalizeError = NormalizeName(Pos, hint); if (!normalizeError.Empty()) { @@ -349,10 +349,10 @@ public: } private: - TVector<TString> Hints; + TVector<TString> Hints; }; -TNodePtr BuildInputOptions(TPosition pos, const TVector<TString>& hints) { +TNodePtr BuildInputOptions(TPosition pos, const TVector<TString>& hints) { if (hints.empty()) { return nullptr; } @@ -420,7 +420,7 @@ TNodePtr BuildInputTables(TPosition pos, const TTableList& tables, bool inSubque class TCreateTableNode final: public TAstListNode { public: - TCreateTableNode(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, + TCreateTableNode(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, const TVector<TIdentifier>& pkColumns, const TVector<TIdentifier>& partitionByColumns, const TVector<std::pair<TIdentifier, bool>>& orderByColumns) : TAstListNode(pos) @@ -443,7 +443,7 @@ public: keys = ctx.GroundBlockShortcutsForExpr(keys); if (!PkColumns.empty() || !PartitionByColumns.empty() || !OrderByColumns.empty()) { - THashSet<TString> columnsSet; + THashSet<TString> columnsSet; for (auto& col : Columns) { columnsSet.insert(col.Name); } @@ -562,13 +562,13 @@ public: } private: TTableRef Table; - TVector<TColumnSchema> Columns; - TVector<TIdentifier> PkColumns; + TVector<TColumnSchema> Columns; + TVector<TIdentifier> PkColumns; TVector<TIdentifier> PartitionByColumns; TVector<std::pair<TIdentifier, bool>> OrderByColumns; // column, is desc? }; -TNodePtr BuildCreateTable(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, +TNodePtr BuildCreateTable(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, const TVector<TIdentifier>& pkColumns, const TVector<TIdentifier>& partitionByColumns, const TVector<std::pair<TIdentifier, bool>>& orderByColumns) { @@ -577,7 +577,7 @@ TNodePtr BuildCreateTable(TPosition pos, const TTableRef& tr, const TVector<TCol class TAlterTableNode final: public TAstListNode { public: - TAlterTableNode(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, EAlterTableIntentnt intent) + TAlterTableNode(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, EAlterTableIntentnt intent) : TAstListNode(pos) , Table(tr) , Columns(columns) @@ -654,11 +654,11 @@ public: } private: TTableRef Table; - TVector<TColumnSchema> Columns; + TVector<TColumnSchema> Columns; EAlterTableIntentnt Intent; }; -TNodePtr BuildAlterTable(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, EAlterTableIntentnt intent) +TNodePtr BuildAlterTable(TPosition pos, const TTableRef& tr, const TVector<TColumnSchema>& columns, EAlterTableIntentnt intent) { return new TAlterTableNode(pos, tr, columns, intent); } @@ -706,7 +706,7 @@ TNodePtr BuildDropTable(TPosition pos, const TTableRef& tr) { return new TDropTableNode(pos, tr); } -static const TMap<EWriteColumnMode, TString> columnModeToStrMapMR { +static const TMap<EWriteColumnMode, TString> columnModeToStrMapMR { {EWriteColumnMode::Default, ""}, {EWriteColumnMode::Insert, "append"}, {EWriteColumnMode::Renew, "renew"} @@ -716,7 +716,7 @@ static const TMap<EWriteColumnMode, TString> columnModeToStrMapStat { {EWriteColumnMode::Upsert, "upsert"} }; -static const TMap<EWriteColumnMode, TString> columnModeToStrMapKikimr { +static const TMap<EWriteColumnMode, TString> columnModeToStrMapKikimr { {EWriteColumnMode::Default, ""}, {EWriteColumnMode::Insert, "insert_abort"}, {EWriteColumnMode::InsertOrAbort, "insert_abort"}, @@ -732,7 +732,7 @@ static const TMap<EWriteColumnMode, TString> columnModeToStrMapKikimr { class TWriteTableNode final: public TAstListNode { public: - TWriteTableNode(TPosition pos, const TString& label, const TTableRef& table, EWriteColumnMode mode, + TWriteTableNode(TPosition pos, const TString& label, const TTableRef& table, EWriteColumnMode mode, TNodePtr options) : TAstListNode(pos) , Label(label) @@ -753,7 +753,7 @@ public: keys = ctx.GroundBlockShortcutsForExpr(keys); const auto serviceName = to_lower(Table.ServiceName(ctx)); - auto getModesMap = [] (const TString& serviceName) -> const TMap<EWriteColumnMode, TString>& { + auto getModesMap = [] (const TString& serviceName) -> const TMap<EWriteColumnMode, TString>& { if (serviceName == KikimrProviderName) { return columnModeToStrMapKikimr; } else if (serviceName == StatProviderName) { @@ -792,7 +792,7 @@ public: return {}; } private: - TString Label; + TString Label; TTableRef Table; EWriteColumnMode Mode; TNodePtr Options; @@ -805,11 +805,11 @@ TNodePtr BuildWriteTable(TPosition pos, const TString& label, const TTableRef& t class TClustersSinkOperationBase: public TAstListNode { protected: - TClustersSinkOperationBase(TPosition pos, const TSet<TString>& clusters) + TClustersSinkOperationBase(TPosition pos, const TSet<TString>& clusters) : TAstListNode(pos) , Clusters(clusters) {} - virtual TPtr ProduceOperation(TContext& ctx, const TString& sinkName, const TString& service) = 0; + virtual TPtr ProduceOperation(TContext& ctx, const TString& sinkName, const TString& service) = 0; bool DoInit(TContext& ctx, ISource* src) override { auto block(Y()); @@ -851,31 +851,31 @@ protected: return {}; } private: - TSet<TString> Clusters; + TSet<TString> Clusters; }; class TCommitClustersNode: public TClustersSinkOperationBase { public: - TCommitClustersNode(TPosition pos, const TSet<TString>& clusters) + TCommitClustersNode(TPosition pos, const TSet<TString>& clusters) : TClustersSinkOperationBase(pos, clusters) {} - TPtr ProduceOperation(TContext& ctx, const TString& sinkName, const TString& service) override { + TPtr ProduceOperation(TContext& ctx, const TString& sinkName, const TString& service) override { Y_UNUSED(ctx); Y_UNUSED(service); return Y("let", "world", Y(TString(CommitName), "world", sinkName)); } }; -TNodePtr BuildCommitClusters(TPosition pos, const TSet<TString>& clusters) { +TNodePtr BuildCommitClusters(TPosition pos, const TSet<TString>& clusters) { return new TCommitClustersNode(pos, clusters); } class TRollbackClustersNode: public TClustersSinkOperationBase { public: - TRollbackClustersNode(TPosition pos, const TSet<TString>& clusters) + TRollbackClustersNode(TPosition pos, const TSet<TString>& clusters) : TClustersSinkOperationBase(pos, clusters) {} - TPtr ProduceOperation(TContext& ctx, const TString& sinkName, const TString& service) override { + TPtr ProduceOperation(TContext& ctx, const TString& sinkName, const TString& service) override { if (service != KikimrProviderName) { ctx.Error(ctx.Pos()) << "ROLLBACK isn't supported for provider: " << TStringBuf(service); return nullptr; @@ -885,13 +885,13 @@ public: } }; -TNodePtr BuildRollbackClusters(TPosition pos, const TSet<TString>& clusters) { +TNodePtr BuildRollbackClusters(TPosition pos, const TSet<TString>& clusters) { return new TRollbackClustersNode(pos, clusters); } class TWriteResultNode final: public TAstListNode { public: - TWriteResultNode(TPosition pos, const TString& label, TNodePtr settings, const TSet<TString>& clusters) + TWriteResultNode(TPosition pos, const TString& label, TNodePtr settings, const TSet<TString>& clusters) : TAstListNode(pos) , Label(label) , Settings(settings) @@ -900,7 +900,7 @@ public: bool DoInit(TContext& ctx, ISource* src) override { auto block(Y( - Y("let", "result_sink", Y("DataSink", Q(TString(ResultProviderName)))), + Y("let", "result_sink", Y("DataSink", Q(TString(ResultProviderName)))), Y("let", "world", Y(TString(WriteName), "world", "result_sink", Y("Key"), Label, Q(Settings))) )); if (ctx.PragmaAutoCommit) { @@ -916,12 +916,12 @@ public: return {}; } private: - TString Label; + TString Label; TNodePtr Settings; TNodePtr CommitClusters; }; -TNodePtr BuildWriteResult(TPosition pos, const TString& label, TNodePtr settings, const TSet<TString>& clusters) { +TNodePtr BuildWriteResult(TPosition pos, const TString& label, TNodePtr settings, const TSet<TString>& clusters) { return new TWriteResultNode(pos, label, settings, clusters); } @@ -1055,7 +1055,7 @@ public: return {}; } private: - TVector<TNodePtr> Blocks; + TVector<TNodePtr> Blocks; const bool TopLevel; }; @@ -1151,7 +1151,7 @@ TNodePtr BuildPragma(TPosition pos, const TString& prefix, const TString& name, class TSqlLambda final: public TAstListNode { public: - TSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq) + TSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq) : TAstListNode(pos) , Args(args) , ExprSeq(exprSeq) @@ -1197,12 +1197,12 @@ public: } private: - TVector<TString> Args; - TVector<TNodePtr> ExprSeq; + TVector<TString> Args; + TVector<TNodePtr> ExprSeq; TSourcePtr FakeSource; }; -TNodePtr BuildSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq) { +TNodePtr BuildSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq) { return new TSqlLambda(pos, std::move(args), std::move(exprSeq)); } diff --git a/ydb/library/yql/sql/v0/select.cpp b/ydb/library/yql/sql/v0/select.cpp index ef47023be15..b07b66b69b8 100644 --- a/ydb/library/yql/sql/v0/select.cpp +++ b/ydb/library/yql/sql/v0/select.cpp @@ -174,7 +174,7 @@ public: return Y("AsList", Y("Uint32", Q("0"))); } - bool AddGroupKey(TContext& ctx, const TString& column) override { + bool AddGroupKey(TContext& ctx, const TString& column) override { Y_UNUSED(column); ctx.Error(Pos) << "Source does not allow grouping"; return false; @@ -186,7 +186,7 @@ public: return false; } - bool IsGroupByColumn(const TString& column) const override { + bool IsGroupByColumn(const TString& column) const override { Y_UNUSED(column); return false; } @@ -198,7 +198,7 @@ public: return nullptr; } - TNodePtr BuildAggregation(const TString& label) override { + TNodePtr BuildAggregation(const TString& label) override { Y_UNUSED(label); return nullptr; } @@ -301,7 +301,7 @@ protected: TMaybe<bool> AddColumn(TContext& ctx, TColumnNode& column) override { Y_VERIFY_DEBUG(Source); - const TString label(Source->GetLabel()); + const TString label(Source->GetLabel()); Source->SetLabel(Label); const auto ret = Source->AddColumn(ctx, column); Source->SetLabel(label); @@ -376,7 +376,7 @@ protected: return true; } - TMaybe<TString> FindColumnMistype(const TString& name) const override { + TMaybe<TString> FindColumnMistype(const TString& name) const override { auto result = FindMistypeIn(Columns.Real, name); if (!result) { auto result = FindMistypeIn(Columns.Artificial, name); @@ -597,7 +597,7 @@ public: TNodePtr samplingRate, TNodePtr samplingSeed) override { Y_UNUSED(pos); - TString modeName; + TString modeName; if (!samplingSeed) { samplingSeed = Y("Int32", Q("0")); } @@ -659,7 +659,7 @@ TSourcePtr BuildTableSource(TPosition pos, const TTableRef& table, bool stream, class TInnerSource: public IProxySource { public: - TInnerSource(TPosition pos, TNodePtr node, const TString& label) + TInnerSource(TPosition pos, TNodePtr node, const TString& label) : IProxySource(pos, nullptr) , Node(node) { @@ -719,7 +719,7 @@ protected: TSourcePtr NewSource; }; -TSourcePtr BuildInnerSource(TPosition pos, TNodePtr node, const TString& label) { +TSourcePtr BuildInnerSource(TPosition pos, TNodePtr node, const TString& label) { return new TInnerSource(pos, node, label); } @@ -892,9 +892,9 @@ public: private: ReduceMode Mode; TSourcePtr Source; - TVector<TSortSpecificationPtr> OrderBy; - TVector<TNodePtr> Keys; - TVector<TNodePtr> Args; + TVector<TSortSpecificationPtr> OrderBy; + TVector<TNodePtr> Keys; + TVector<TNodePtr> Args; TNodePtr Udf; TNodePtr Having; const TWriteSettings Settings; @@ -926,7 +926,7 @@ public: YQL_ENSURE(Source); } - void SetSubselects(TVector<TSourcePtr>&& subselects, TSet<TString>&& groupingCols) { + void SetSubselects(TVector<TSourcePtr>&& subselects, TSet<TString>&& groupingCols) { Subselects = std::move(subselects); GroupingCols = std::move(groupingCols); Y_VERIFY_DEBUG(Subselects.size() > 1); @@ -1027,14 +1027,14 @@ public: TNodePtr DoClone() const final { auto newSource = MakeIntrusive<TCompositeSelect>(Pos, Source->CloneSource(), Settings); - newSource->SetSubselects(CloneContainer(Subselects), TSet<TString>(GroupingCols)); + newSource->SetSubselects(CloneContainer(Subselects), TSet<TString>(GroupingCols)); return newSource; } private: TSourcePtr Source; const TWriteSettings Settings; - TVector<TSourcePtr> Subselects; - TSet<TString> GroupingCols; + TVector<TSourcePtr> Subselects; + TSet<TString> GroupingCols; TNodePtr FiltersGround; }; @@ -1044,15 +1044,15 @@ public: TSelectCore( TPosition pos, TSourcePtr source, - const TVector<TNodePtr>& groupByExpr, - const TVector<TNodePtr>& groupBy, - const TVector<TSortSpecificationPtr>& orderBy, + const TVector<TNodePtr>& groupByExpr, + const TVector<TNodePtr>& groupBy, + const TVector<TSortSpecificationPtr>& orderBy, TNodePtr having, TWinSpecs& winSpecs, THoppingWindowSpecPtr hoppingWindowSpec, - const TVector<TNodePtr>& terms, + const TVector<TNodePtr>& terms, bool distinct, - const TVector<TNodePtr>& without, + const TVector<TNodePtr>& without, bool stream, const TWriteSettings& settings ) @@ -1628,9 +1628,9 @@ private: private: TSourcePtr Source; - TVector<TNodePtr> GroupByExpr; - TVector<TNodePtr> GroupBy; - TVector<TSortSpecificationPtr> OrderBy; + TVector<TNodePtr> GroupByExpr; + TVector<TNodePtr> GroupBy; + TVector<TSortSpecificationPtr> OrderBy; TNodePtr Having; TWinSpecs WinSpecs; TNodePtr Flatten; @@ -1645,8 +1645,8 @@ private: TNodePtr OrderByGround; TNodePtr WinSpecsPartitionByGround; TNodePtr WinSpecsOrderByGround; - TVector<TNodePtr> Terms; - TVector<TNodePtr> Without; + TVector<TNodePtr> Terms; + TVector<TNodePtr> Without; const bool Distinct; bool OrderByInit = false; THoppingWindowSpecPtr HoppingWindowSpec; @@ -1875,14 +1875,14 @@ TSourcePtr BuildProcess( class TNestedProxySource: public IProxySource { public: - TNestedProxySource(TPosition pos, const TVector<TNodePtr>& groupBy, TSourcePtr source) + TNestedProxySource(TPosition pos, const TVector<TNodePtr>& groupBy, TSourcePtr source) : IProxySource(pos, source.Get()) , CompositeSelect(nullptr) , Holder(std::move(source)) , GroupBy(groupBy) {} - TNestedProxySource(TCompositeSelect* compositeSelect, const TVector<TNodePtr>& groupBy) + TNestedProxySource(TCompositeSelect* compositeSelect, const TVector<TNodePtr>& groupBy) : IProxySource(compositeSelect->GetPos(), compositeSelect->RealSource()) , CompositeSelect(compositeSelect) , GroupBy(groupBy) @@ -1912,7 +1912,7 @@ public: return CompositeSelect; } - bool CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const override { + bool CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const override { Y_UNUSED(ctx); hint = 0; if (GroupByColumns.empty()) { @@ -1947,23 +1947,23 @@ public: private: TCompositeSelect* CompositeSelect; TSourcePtr Holder; - TVector<TNodePtr> GroupBy; - mutable TSet<TString> GroupByColumns; + TVector<TNodePtr> GroupBy; + mutable TSet<TString> GroupByColumns; }; TSourcePtr BuildSelectCore( TContext& ctx, TPosition pos, TSourcePtr source, - const TVector<TNodePtr>& groupByExpr, - const TVector<TNodePtr>& groupBy, - const TVector<TSortSpecificationPtr>& orderBy, + const TVector<TNodePtr>& groupByExpr, + const TVector<TNodePtr>& groupBy, + const TVector<TSortSpecificationPtr>& orderBy, TNodePtr having, TWinSpecs&& winSpecs, THoppingWindowSpecPtr hoppingWindowSpec, - TVector<TNodePtr>&& terms, + TVector<TNodePtr>&& terms, bool distinct, - TVector<TNodePtr>&& without, + TVector<TNodePtr>&& without, bool stream, const TWriteSettings& settings ) { @@ -1980,11 +1980,11 @@ TSourcePtr BuildSelectCore( /// \todo some smart merge logic, generalize common part of grouping (expr, flatten, etc)? TIntrusivePtr<TCompositeSelect> compositeSelect = new TCompositeSelect(pos, std::move(source), settings); size_t totalGroups = 0; - TVector<TSourcePtr> subselects; - TSet<TString> groupingCols; + TVector<TSourcePtr> subselects; + TSet<TString> groupingCols; for (auto& grouping: groupBy) { auto contentPtr = grouping->ContentListPtr(); - TVector<TNodePtr> cache(1, nullptr); + TVector<TNodePtr> cache(1, nullptr); if (!contentPtr) { cache[0] = grouping; contentPtr = &cache; @@ -1998,7 +1998,7 @@ TSourcePtr BuildSelectCore( TSourcePtr proxySource = new TNestedProxySource(compositeSelect.Get(), *contentPtr); if (!subselects.empty()) { /// clone terms for others usage - TVector<TNodePtr> termsCopy; + TVector<TNodePtr> termsCopy; for (const auto& term: terms) { termsCopy.emplace_back(term->Clone()); } @@ -2019,7 +2019,7 @@ TSourcePtr BuildSelectCore( class TUnionAll: public IRealSource { public: - TUnionAll(TPosition pos, TVector<TSourcePtr>&& sources) + TUnionAll(TPosition pos, TVector<TSourcePtr>&& sources) : IRealSource(pos) , Sources(std::move(sources)) { @@ -2077,16 +2077,16 @@ public: } private: - TVector<TSourcePtr> Sources; + TVector<TSourcePtr> Sources; }; -TSourcePtr BuildUnionAll(TPosition pos, TVector<TSourcePtr>&& sources) { +TSourcePtr BuildUnionAll(TPosition pos, TVector<TSourcePtr>&& sources) { return new TUnionAll(pos, std::move(sources)); } class TOverWindowSource: public IProxySource { public: - TOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource) + TOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource) : IProxySource(pos, origSource) , WindowName(windowName) { @@ -2138,10 +2138,10 @@ public: } private: - const TString WindowName; + const TString WindowName; }; -TSourcePtr BuildOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource) { +TSourcePtr BuildOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource) { return new TOverWindowSource(pos, windowName, origSource); } @@ -2274,7 +2274,7 @@ public: return false; } - TSet<TString> clusters; + TSet<TString> clusters; for (auto& it: tableList) { clusters.insert(it.Cluster); } diff --git a/ydb/library/yql/sql/v0/sql.cpp b/ydb/library/yql/sql/v0/sql.cpp index b028fc04398..09a37c9f3f3 100644 --- a/ydb/library/yql/sql/v0/sql.cpp +++ b/ydb/library/yql/sql/v0/sql.cpp @@ -17,7 +17,7 @@ #include <google/protobuf/repeated_field.h> -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/set.h> #include <util/string/ascii.h> #include <util/string/cast.h> @@ -88,7 +88,7 @@ inline TString GetKeyword(TTranslation& ctx, const TRule_keyword_restricted& nod return GetKeywordId(ctx, node).Name; } -static TString Id(const TRule_id& node, TTranslation& ctx) { +static TString Id(const TRule_id& node, TTranslation& ctx) { // id: IDENTIFIER | keyword; switch (node.Alt_case()) { case TRule_id::kAltId1: @@ -398,8 +398,8 @@ static std::pair<TString, TString> TableKeyImpl(const TRule_table_key& node, TTr return TableKeyImpl(nameWithAt, view, ctx); } -static TVector<TString> TableHintsImpl(const TRule_table_hints& node, TTranslation& ctx) { - TVector<TString> hints; +static TVector<TString> TableHintsImpl(const TRule_table_hints& node, TTranslation& ctx) { + TVector<TString> hints; auto& block = node.GetBlock2(); switch (block.Alt_case()) { case TRule_table_hints::TBlock2::kAlt1: { @@ -417,26 +417,26 @@ static TVector<TString> TableHintsImpl(const TRule_table_hints& node, TTranslati } /// \return optional prefix -static TString ColumnNameAsStr(TTranslation& ctx, const TRule_column_name& node, TString& id) { +static TString ColumnNameAsStr(TTranslation& ctx, const TRule_column_name& node, TString& id) { id = IdOrString(node.GetRule_id_or_string2(), ctx); return OptIdPrefixAsStr(node.GetRule_opt_id_prefix1(), ctx); } -static TString ColumnNameAsSingleStr(TTranslation& ctx, const TRule_column_name& node) { - TString body; - const TString prefix = ColumnNameAsStr(ctx, node, body); +static TString ColumnNameAsSingleStr(TTranslation& ctx, const TRule_column_name& node) { + TString body; + const TString prefix = ColumnNameAsStr(ctx, node, body); return prefix ? prefix + '.' + body : body; } -static void FillTargetList(TTranslation& ctx, const TRule_set_target_list& node, TVector<TString>& targetList) { +static void FillTargetList(TTranslation& ctx, const TRule_set_target_list& node, TVector<TString>& targetList) { targetList.push_back(ColumnNameAsSingleStr(ctx, node.GetRule_set_target2().GetRule_column_name1())); for (auto& block: node.GetBlock3()) { targetList.push_back(ColumnNameAsSingleStr(ctx, block.GetRule_set_target2().GetRule_column_name1())); } } -TVector<TString> GetContextHints(TContext& ctx) { - TVector<TString> hints; +TVector<TString> GetContextHints(TContext& ctx) { + TVector<TString> hints; if (ctx.PragmaInferSchema) { hints.push_back("infer_scheme"); // TODO use yt.InferSchema instead } @@ -507,7 +507,7 @@ static TTableRef SimpleTableRefImpl(const TRule_simple_table_ref& node, NSQLTran cluster = ctx.Context().CurrCluster; } - TVector<TString> hints = GetContextHints(ctx.Context()); + TVector<TString> hints = GetContextHints(ctx.Context()); if (node.HasBlock2()) { hints = TableHintsImpl(node.GetBlock2().GetRule_table_hints1(), ctx); } @@ -519,7 +519,7 @@ static TTableRef SimpleTableRefImpl(const TRule_simple_table_ref& node, NSQLTran return *tr; } -static bool ValidateForCounters(const TString& input) { +static bool ValidateForCounters(const TString& input) { for (auto c : input) { if (!(IsAlnum(c) || c == '_')) { return false; @@ -528,7 +528,7 @@ static bool ValidateForCounters(const TString& input) { return true; } -static bool IsColumnsOnly(const TVector<TSortSpecificationPtr>& container) { +static bool IsColumnsOnly(const TVector<TSortSpecificationPtr>& container) { for (const auto& elem: container) { if (!elem->OrderExpr->GetColumnName()) { return false; @@ -554,14 +554,14 @@ protected: SqlLambdaParams, }; TNodePtr NamedExpr(const TRule_named_expr& node, EExpr exprMode = EExpr::Regular); - bool NamedExprList(const TRule_named_expr_list& node, TVector<TNodePtr>& exprs, EExpr exprMode = EExpr::Regular); - bool BindList(const TRule_bind_parameter_list& node, TVector<TString>& bindNames); - bool ModulePath(const TRule_module_path& node, TVector<TString>& path); - bool NamedBindList(const TRule_named_bind_parameter_list& node, TVector<TNodePtr>& bindNames); + bool NamedExprList(const TRule_named_expr_list& node, TVector<TNodePtr>& exprs, EExpr exprMode = EExpr::Regular); + bool BindList(const TRule_bind_parameter_list& node, TVector<TString>& bindNames); + bool ModulePath(const TRule_module_path& node, TVector<TString>& path); + bool NamedBindList(const TRule_named_bind_parameter_list& node, TVector<TNodePtr>& bindNames); TNodePtr NamedBindParam(const TRule_named_bind_parameter& node); TNodePtr NamedNode(const TRule_named_nodes_stmt& rule, TVector<TString>& names); - bool ImportStatement(const TRule_import_stmt& stmt, TVector<TString>* namesPtr = nullptr); + bool ImportStatement(const TRule_import_stmt& stmt, TVector<TString>* namesPtr = nullptr); TNodePtr DoStatement(const TRule_do_stmt& stmt, bool makeLambda, const TVector<TString>& args = {}); bool DefineActionOrSubqueryStatement(const TRule_define_action_or_subquery_stmt& stmt); TNodePtr EvaluateIfStatement(const TRule_evaluate_if_stmt& stmt); @@ -634,8 +634,8 @@ private: template<typename TUnarySubExprRule> TNodePtr UnaryExpr(const TUnarySubExprRule& node); - bool SqlLambdaParams(const TNodePtr& node, TVector<TString>& args); - bool SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& node, TVector<TNodePtr>& exprSeq); + bool SqlLambdaParams(const TNodePtr& node, TVector<TString>& args); + bool SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& node, TVector<TNodePtr>& exprSeq); TNodePtr KeyExpr(const TRule_key_expr& node) { TSqlExpression expr(Ctx, Mode); @@ -677,7 +677,7 @@ private: if (!altResult) { return nullptr; } - const TVector<TNodePtr> args({result, altResult}); + const TVector<TNodePtr> args({result, altResult}); Token(block.GetToken1()); result = BuildBuiltinFunc(Ctx, Ctx.Pos(), "Coalesce", args); } @@ -705,17 +705,17 @@ private: template <typename TNode, typename TGetNode, typename TIter> TNodePtr BinOpList(const TNode& node, TGetNode getNode, TIter begin, TIter end); - TNodePtr BinOperList(const TString& opName, TVector<TNodePtr>::const_iterator begin, TVector<TNodePtr>::const_iterator end) const; + TNodePtr BinOperList(const TString& opName, TVector<TNodePtr>::const_iterator begin, TVector<TNodePtr>::const_iterator end) const; template <typename TNode, typename TGetNode, typename TIter> - TNodePtr BinOper(const TString& operName, const TNode& node, TGetNode getNode, TIter begin, TIter end); + TNodePtr BinOper(const TString& operName, const TNode& node, TGetNode getNode, TIter begin, TIter end); TNodePtr SqlInExpr(const TRule_in_expr& node); TNodePtr SmartParenthesis(const TRule_smart_parenthesis& node); ESmartParenthesis SmartParenthesisMode = ESmartParenthesis::Default; - THashMap<TString, TNodePtr> ExprShortcuts; + THashMap<TString, TNodePtr> ExprShortcuts; }; class TSqlCallExpr: public TSqlTranslation { @@ -726,7 +726,7 @@ public: { } - TSqlCallExpr(const TSqlCallExpr& call, const TVector<TNodePtr>& args) + TSqlCallExpr(const TSqlCallExpr& call, const TVector<TNodePtr>& args) : TSqlTranslation(call.Ctx, call.Mode) , Pos(call.Pos) , Func(call.Func) @@ -742,7 +742,7 @@ public: void IncCounters(); TNodePtr BuildUdf(bool withArgsType) { - auto result = Node ? Node : BuildCallable(Pos, Module, Func, withArgsType ? Args : TVector<TNodePtr>()); + auto result = Node ? Node : BuildCallable(Pos, Module, Func, withArgsType ? Args : TVector<TNodePtr>()); if (to_lower(Module) == "tensorflow" && Func == "RunBatch") { Args.erase(Args.begin() + 2); } @@ -750,7 +750,7 @@ public: } TNodePtr BuildCall() { - TVector<TNodePtr> args; + TVector<TNodePtr> args; if (Node) { Module = "YQL"; Func = NamedArgs.empty() ? "Apply" : "NamedApply"; @@ -784,7 +784,7 @@ public: return Pos; } - const TVector<TNodePtr>& GetArgs() const { + const TVector<TNodePtr>& GetArgs() const { return Args; } @@ -810,9 +810,9 @@ private: TString Func; TString Module; TNodePtr Node; - TVector<TNodePtr> Args; - TVector<TNodePtr> PositionalArgs; - TVector<TNodePtr> NamedArgs; + TVector<TNodePtr> Args; + TVector<TNodePtr> PositionalArgs; + TVector<TNodePtr> NamedArgs; EAggregateMode AggMode = EAggregateMode::Normal; TSqlExpression* UsedExpr = nullptr; }; @@ -836,7 +836,7 @@ TNodePtr TSqlTranslation::NamedExpr(const TRule_named_expr& node, EExpr exprMode return exprNode; } -bool TSqlTranslation::NamedExprList(const TRule_named_expr_list& node, TVector<TNodePtr>& exprs, EExpr exprMode) { +bool TSqlTranslation::NamedExprList(const TRule_named_expr_list& node, TVector<TNodePtr>& exprs, EExpr exprMode) { exprs.emplace_back(NamedExpr(node.GetRule_named_expr1(), exprMode)); if (!exprs.back()) { return false; @@ -850,7 +850,7 @@ bool TSqlTranslation::NamedExprList(const TRule_named_expr_list& node, TVector<T return true; } -bool TSqlTranslation::BindList(const TRule_bind_parameter_list& node, TVector<TString>& bindNames) { +bool TSqlTranslation::BindList(const TRule_bind_parameter_list& node, TVector<TString>& bindNames) { bindNames.emplace_back(NamedNodeImpl(node.GetRule_bind_parameter1(), *this)); for (auto& b: node.GetBlock2()) { bindNames.emplace_back(NamedNodeImpl(b.GetRule_bind_parameter2(), *this)); @@ -858,7 +858,7 @@ bool TSqlTranslation::BindList(const TRule_bind_parameter_list& node, TVector<TS return true; } -bool TSqlTranslation::ModulePath(const TRule_module_path& node, TVector<TString>& path) { +bool TSqlTranslation::ModulePath(const TRule_module_path& node, TVector<TString>& path) { if (node.HasBlock1()) { path.emplace_back(TString()); } @@ -869,7 +869,7 @@ bool TSqlTranslation::ModulePath(const TRule_module_path& node, TVector<TString> return true; } -bool TSqlTranslation::NamedBindList(const TRule_named_bind_parameter_list& node, TVector<TNodePtr>& bindNames) { +bool TSqlTranslation::NamedBindList(const TRule_named_bind_parameter_list& node, TVector<TNodePtr>& bindNames) { bindNames.emplace_back(NamedBindParam(node.GetRule_named_bind_parameter1())); for (auto& b: node.GetBlock2()) { bindNames.emplace_back(NamedBindParam(b.GetRule_named_bind_parameter2())); @@ -1000,7 +1000,7 @@ TMaybe<TSourcePtr> TSqlTranslation::AsTableImpl(const TRule_table_ref& node) { return Nothing(); } -bool Expr(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_expr& node) { +bool Expr(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_expr& node) { TNodePtr exprNode = sqlExpr.Build(node); if (!exprNode) { return false; @@ -1009,7 +1009,7 @@ bool Expr(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_exp return true; } -bool ExprList(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_expr_list& node) { +bool ExprList(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_expr_list& node) { if (!Expr(sqlExpr, exprNodes, node.GetRule_expr1())) { return false; } @@ -1118,17 +1118,17 @@ public: TSourcePtr Build(const TRule_select_stmt& node, TPosition& selectPos); private: - bool SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& node); - bool ValidateSelectColumns(const TVector<TNodePtr>& terms); - bool ColumnName(TVector<TNodePtr>& keys, const TRule_column_name& node); - bool ColumnList(TVector<TNodePtr>& keys, const TRule_column_list& node); - bool NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_column& node); - bool NamedColumnList(TVector<TNodePtr>& columnList, const TRule_named_column_list& node); - bool SortSpecification(const TRule_sort_specification& node, TVector<TSortSpecificationPtr>& sortSpecs); - bool SortSpecificationList(const TRule_sort_specification_list& node, TVector<TSortSpecificationPtr>& sortSpecs); + bool SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& node); + bool ValidateSelectColumns(const TVector<TNodePtr>& terms); + bool ColumnName(TVector<TNodePtr>& keys, const TRule_column_name& node); + bool ColumnList(TVector<TNodePtr>& keys, const TRule_column_list& node); + bool NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_column& node); + bool NamedColumnList(TVector<TNodePtr>& columnList, const TRule_named_column_list& node); + bool SortSpecification(const TRule_sort_specification& node, TVector<TSortSpecificationPtr>& sortSpecs); + bool SortSpecificationList(const TRule_sort_specification_list& node, TVector<TSortSpecificationPtr>& sortSpecs); TSourcePtr SingleSource(const TRule_single_source& node); TSourcePtr NamedSingleSource(const TRule_named_single_source& node); - TVector<TNodePtr> OrdinaryNamedColumnList(const TRule_ordinary_named_column_list& node); + TVector<TNodePtr> OrdinaryNamedColumnList(const TRule_ordinary_named_column_list& node); TSourcePtr FlattenSource(const TRule_flatten_source& node); TSourcePtr JoinSource(const TRule_join_source& node); bool JoinOp(ISource* join, const TRule_join_source::TBlock2& block); @@ -1142,7 +1142,7 @@ private: TWindowSpecificationPtr WindowSpecification(const TRule_window_specification_details& rule); bool WindowDefenition(const TRule_window_definition& node, TWinSpecs& winSpecs); bool WindowClause(const TRule_window_clause& node, TWinSpecs& winSpecs); - bool OrderByClause(const TRule_order_by_clause& node, TVector<TSortSpecificationPtr>& orderBy); + bool OrderByClause(const TRule_order_by_clause& node, TVector<TSortSpecificationPtr>& orderBy); TSourcePtr SelectKind(const TRule_select_kind& node, TPosition& selectPos); TSourcePtr SelectKind(const TRule_select_kind_partial& node, TPosition& selectPos); TSourcePtr SelectKind(const TRule_select_kind_parenthesis& node, TPosition& selectPos); @@ -1166,7 +1166,7 @@ class TGroupByClause: public TSqlTranslation { typedef TIntrusivePtr<TGroupByClauseCtx> TPtr; TGroupingSetFeatures GroupFeatures; - TMap<TString, TNodePtr> NodeAliases; + TMap<TString, TNodePtr> NodeAliases; size_t UnnamedCount = 0; }; @@ -1179,37 +1179,37 @@ public: bool Build(const TRule_group_by_clause& node, bool stream); bool ParseList(const TRule_grouping_element_list& groupingListNode); - void SetFeatures(const TString& field) const; - TVector<TNodePtr>& Content(); - TMap<TString, TNodePtr>& Aliases(); + void SetFeatures(const TString& field) const; + TVector<TNodePtr>& Content(); + TMap<TString, TNodePtr>& Aliases(); THoppingWindowSpecPtr GetHoppingWindow(); private: - TVector<TNodePtr> MultiplyGroupingSets(const TVector<TNodePtr>& lhs, const TVector<TNodePtr>& rhs) const; + TVector<TNodePtr> MultiplyGroupingSets(const TVector<TNodePtr>& lhs, const TVector<TNodePtr>& rhs) const; void ResolveGroupByAndGrouping(); bool GroupingElement(const TRule_grouping_element& node); - void FeedCollection(const TNodePtr& elem, TVector<TNodePtr>& collection, bool& hasEmpty) const; + void FeedCollection(const TNodePtr& elem, TVector<TNodePtr>& collection, bool& hasEmpty) const; bool OrdinaryGroupingSet(const TRule_ordinary_grouping_set& node); bool OrdinaryGroupingSetList(const TRule_ordinary_grouping_set_list& node); bool HoppingWindow(const TRule_hopping_window_specification& node); - bool IsNodeColumnsOrNamedExpression(const TVector<TNodePtr>& content, const TString& construction) const; + bool IsNodeColumnsOrNamedExpression(const TVector<TNodePtr>& content, const TString& construction) const; TGroupingSetFeatures& Features(); const TGroupingSetFeatures& Features() const; - bool AddAlias(const TString& label, const TNodePtr& node); - TString GenerateGroupByExprName(); - bool IsAutogenerated(const TString* name) const; + bool AddAlias(const TString& label, const TNodePtr& node); + TString GenerateGroupByExprName(); + bool IsAutogenerated(const TString* name) const; - TVector<TNodePtr> GroupBySet; + TVector<TNodePtr> GroupBySet; TGroupByClauseCtx::TPtr GroupSetContext; THoppingWindowSpecPtr HoppingWindowSpec; // stream queries - static const TString AutogenerateNamePrefix; + static const TString AutogenerateNamePrefix; }; -const TString TGroupByClause::AutogenerateNamePrefix = "group"; +const TString TGroupByClause::AutogenerateNamePrefix = "group"; -bool ParseNumbers(TContext& ctx, const TString& strOrig, ui64& value, TString& suffix) { +bool ParseNumbers(TContext& ctx, const TString& strOrig, ui64& value, TString& suffix) { const auto str = to_lower(strOrig); const auto strLen = str.size(); ui64 base = 10; @@ -1231,7 +1231,7 @@ bool ParseNumbers(TContext& ctx, const TString& strOrig, ui64& value, TString& s if (*iter == 'u') { --iter; } - suffix = TString(++iter, str.cend()); + suffix = TString(++iter, str.cend()); } value = 0; const TString digString(str.begin() + (base == 10 ? 0 : 2), str.end() - suffix.size()); @@ -1254,9 +1254,9 @@ bool ParseNumbers(TContext& ctx, const TString& strOrig, ui64& value, TString& s } TNodePtr LiteralNumber(TContext& ctx, const TRule_integer& node) { - const TString intergerString = ctx.Token(node.GetToken1()); + const TString intergerString = ctx.Token(node.GetToken1()); ui64 value; - TString suffix; + TString suffix; if (!ParseNumbers(ctx, intergerString, value, suffix)) { return {}; } @@ -1295,7 +1295,7 @@ TNodePtr LiteralNumber(TContext& ctx, const TRule_integer& node) { } TNodePtr LiteralReal(TContext& ctx, const TRule_real& node) { - const TString value(ctx.Token(node.GetToken1())); + const TString value(ctx.Token(node.GetToken1())); YQL_ENSURE(!value.empty()); const auto lastValue = value[value.size() - 1]; if (lastValue == 'f' || lastValue == 'F') { @@ -1325,7 +1325,7 @@ TNodePtr TSqlExpression::LiteralExpr(const TRule_literal_value& node) { return LiteralReal(Ctx, node.GetAlt_literal_value2().GetRule_real1()); } case TRule_literal_value::kAltLiteralValue3: { - const TString value(Token(node.GetAlt_literal_value3().GetToken1())); + const TString value(Token(node.GetAlt_literal_value3().GetToken1())); return BuildLiteralSmartString(Ctx, value); } case TRule_literal_value::kAltLiteralValue5: { @@ -1333,7 +1333,7 @@ TNodePtr TSqlExpression::LiteralExpr(const TRule_literal_value& node) { return BuildLiteralNull(Ctx.Pos()); } case TRule_literal_value::kAltLiteralValue9: { - const TString value(Token(node.GetAlt_literal_value9().GetRule_bool_value1().GetToken1())); + const TString value(Token(node.GetAlt_literal_value9().GetRule_bool_value1().GetToken1())); return BuildLiteralBool(Ctx.Pos(), value); } case TRule_literal_value::kAltLiteralValue10: { @@ -1350,7 +1350,7 @@ TNodePtr TSqlExpression::UnaryExpr(const TUnarySubExprType& node) { //unary_subexpr: (id_expr | atom_expr ) key_expr* (DOT (bind_parameter | DIGITS | id_or_string) key_expr*)* (COLLATE id)?; // OR //in_unary_subexpr: (in_id_expr | in_atom_expr) key_expr* (DOT (bind_parameter | DIGITS | id_or_string) key_expr*)* (COLLATE id)?; - TVector<INode::TIdPart> ids; + TVector<INode::TIdPart> ids; auto& block = node.GetBlock1(); switch (block.Alt_case()) { case TUnarySubExprType::TBlock1::kAlt1: { @@ -1595,7 +1595,7 @@ TNodePtr TSqlExpression::WindowFunctionRule(const TWindowFunctionType& rule) { if (funcSpec.HasBlock1() && funcSpec.GetBlock1().GetRule_null_treatment1().Alt_case() == TRule_null_treatment::kAltNullTreatment2) { call.SetIgnoreNulls(); } - const TString windowName = Id(winRule.GetAlt_window_name_or_specification1().GetRule_window_name1().GetRule_id1(), *this); + const TString windowName = Id(winRule.GetAlt_window_name_or_specification1().GetRule_window_name1().GetRule_id1(), *this); Ctx.IncrementMonCounter("sql_features", "WindowFunctionOver"); return BuildCalcOverWindow(Ctx.Pos(), windowName, call.BuildCall()); } @@ -1630,7 +1630,7 @@ TNodePtr TSqlExpression::AtomExpr(const TRule_atom_expr& node) { return CaseRule(node.GetAlt_atom_expr7().GetRule_case_expr1()); case TRule_atom_expr::kAltAtomExpr8: { const auto& alt = node.GetAlt_atom_expr8(); - const TString module(IdOrString(alt.GetRule_id_or_string1(), *this)); + const TString module(IdOrString(alt.GetRule_id_or_string1(), *this)); TPosition pos(Ctx.Pos()); bool rawString = true; const TString name(IdOrString(alt.GetRule_id_or_string3(), *this, rawString)); @@ -1689,14 +1689,14 @@ TNodePtr TSqlExpression::InAtomExpr(const TRule_in_atom_expr& node) { return nullptr; } -bool TSqlExpression::SqlLambdaParams(const TNodePtr& node, TVector<TString>& args) { +bool TSqlExpression::SqlLambdaParams(const TNodePtr& node, TVector<TString>& args) { auto errMsg = TStringBuf("Invalid lambda arguments syntax. Lambda arguments should starts with '$' as named value."); auto tupleNodePtr = dynamic_cast<TTupleNode*>(node.Get()); if (!tupleNodePtr) { Ctx.Error(node->GetPos()) << errMsg; return false; } - THashSet<TString> dupArgsChecker; + THashSet<TString> dupArgsChecker; for (const auto& argPtr: tupleNodePtr->Elements()) { auto contentPtr = argPtr->GetAtomContent(); if (!contentPtr || !contentPtr->StartsWith("$")) { @@ -1712,9 +1712,9 @@ bool TSqlExpression::SqlLambdaParams(const TNodePtr& node, TVector<TString>& arg return true; } -bool TSqlExpression::SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& node, TVector<TNodePtr>& exprSeq) { +bool TSqlExpression::SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& node, TVector<TNodePtr>& exprSeq) { TSqlExpression expr(ctx, ctx.Settings.Mode); - TVector<TString> localNames; + TVector<TString> localNames; bool hasError = false; for (auto& block: node.GetBlock1()) { const auto& rule = block.GetRule_lambda_stmt1(); @@ -1784,7 +1784,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_con_subexpr& node) { return UnaryExpr(node.GetAlt_con_subexpr1().GetRule_unary_subexpr1()); case TRule_con_subexpr::kAltConSubexpr2: { Ctx.IncrementMonCounter("sql_features", "UnaryOperation"); - TString opName; + TString opName; auto token = node.GetAlt_con_subexpr2().GetRule_unary_op1().GetToken1(); Token(token); TPosition pos(Ctx.Pos()); @@ -1820,17 +1820,17 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node) { case TRule_cond_expr::kAltCondExpr1: { const auto& matchOp = cond.GetAlt_cond_expr1(); const bool notMatch = matchOp.HasBlock1(); - const TCiString& opName = Token(matchOp.GetRule_match_op2().GetToken1()); + const TCiString& opName = Token(matchOp.GetRule_match_op2().GetToken1()); const auto& pattern = SubExpr(cond.GetAlt_cond_expr1().GetRule_eq_subexpr3()); if (!pattern) { return {}; } TNodePtr isMatch; if (opName == "like" || opName == "ilike") { - const TString* escapeLiteral = nullptr; + const TString* escapeLiteral = nullptr; TNodePtr escapeNode; const auto& escaper = BuildUdf(Ctx, pos, "Re2", "PatternFromLike", {}); - TVector<TNodePtr> escaperArgs({ escaper, pattern }); + TVector<TNodePtr> escaperArgs({ escaper, pattern }); if (matchOp.HasBlock4()) { const auto& escapeBlock = matchOp.GetBlock4(); @@ -1881,7 +1881,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node) { const auto& matcher = BuildUdf(Ctx, pos, "Re2", "Match", { runConfig }); isMatch = new TCallNodeImpl(pos, "Apply", { matcher, res }); - const TString* literalPattern = pattern->GetLiteral("String"); + const TString* literalPattern = pattern->GetLiteral("String"); if (literalPattern) { TStringBuilder lowerBound; bool inEscape = false; @@ -1960,7 +1960,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node) { } else if (opName == "regexp" || opName == "rlike" || opName == "match") { if (matchOp.HasBlock4()) { Ctx.IncrementMonCounter("sql_errors", "RegexpEscape"); - TString opNameUpper(opName); + TString opNameUpper(opName); opNameUpper.to_upper(); Error() << opName << " and ESCAPE clauses should not be used together"; return nullptr; @@ -2046,7 +2046,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node) { return res; } -TNodePtr TSqlExpression::BinOperList(const TString& opName, TVector<TNodePtr>::const_iterator begin, TVector<TNodePtr>::const_iterator end) const { +TNodePtr TSqlExpression::BinOperList(const TString& opName, TVector<TNodePtr>::const_iterator begin, TVector<TNodePtr>::const_iterator end) const { TPosition pos(Ctx.Pos()); const size_t opCount = end - begin; Y_VERIFY_DEBUG(opCount >= 2); @@ -2061,13 +2061,13 @@ TNodePtr TSqlExpression::BinOperList(const TString& opName, TVector<TNodePtr>::c } template <typename TNode, typename TGetNode, typename TIter> -TNodePtr TSqlExpression::BinOper(const TString& opName, const TNode& node, TGetNode getNode, TIter begin, TIter end) { +TNodePtr TSqlExpression::BinOper(const TString& opName, const TNode& node, TGetNode getNode, TIter begin, TIter end) { if (begin == end) { return SubExpr(node); } Ctx.IncrementMonCounter("sql_binary_operations", opName); const size_t listSize = end - begin; - TVector<TNodePtr> nodes; + TVector<TNodePtr> nodes; nodes.reserve(1 + listSize); nodes.push_back(SubExpr(node)); for (; begin != end; ++begin) { @@ -2083,7 +2083,7 @@ TNodePtr TSqlExpression::BinOpList(const TNode& node, TGetNode getNode, TIter be Ctx.IncrementMonCounter("sql_features", "BinaryOperation"); Token(begin->GetToken1()); TPosition pos(Ctx.Pos()); - TString opName; + TString opName; auto tokenId = begin->GetToken1().GetId(); switch (tokenId) { case SQLLexerTokens::TOKEN_LESS: @@ -2188,7 +2188,7 @@ TNodePtr TSqlExpression::SqlInExpr(const TRule_in_expr& node) { } TNodePtr TSqlExpression::SmartParenthesis(const TRule_smart_parenthesis& node) { - TVector<TNodePtr> exprs; + TVector<TNodePtr> exprs; Token(node.GetToken1()); const TPosition pos(Ctx.Pos()); const bool isTuple = node.HasBlock3(); @@ -2263,12 +2263,12 @@ TNodePtr TSqlTranslation::NamedNode(const TRule_named_nodes_stmt& rule, TVector< } } -bool TSqlTranslation::ImportStatement(const TRule_import_stmt& stmt, TVector<TString>* namesPtr) { - TVector<TString> modulePath; +bool TSqlTranslation::ImportStatement(const TRule_import_stmt& stmt, TVector<TString>* namesPtr) { + TVector<TString> modulePath; if (!ModulePath(stmt.GetRule_module_path2(), modulePath)) { return false; } - TVector<TNodePtr> bindNames; + TVector<TNodePtr> bindNames; if (!NamedBindList(stmt.GetRule_named_bind_parameter_list4(), bindNames)) { return false; } @@ -2347,7 +2347,7 @@ bool TSqlSelect::JoinOp(ISource* join, const TRule_join_source::TBlock2& block) Error() << "Natural join is not implemented yet"; return false; } - TString joinOp("Inner"); + TString joinOp("Inner"); switch (alt.GetBlock2().Alt_case()) { case TRule_join_op::TAlt2::TBlock2::kAlt1: if (alt.GetBlock2().GetAlt1().HasBlock1()) { @@ -2461,8 +2461,8 @@ TNodePtr TSqlSelect::JoinExpr(ISource* join, const TRule_join_constraint& node) return nullptr; } -TVector<TNodePtr> TSqlSelect::OrdinaryNamedColumnList(const TRule_ordinary_named_column_list& node) { - TVector<TNodePtr> result; +TVector<TNodePtr> TSqlSelect::OrdinaryNamedColumnList(const TRule_ordinary_named_column_list& node) { + TVector<TNodePtr> result; switch (node.Alt_case()) { case TRule_ordinary_named_column_list::kAltOrdinaryNamedColumnList1: if (!NamedColumn(result, node.GetAlt_ordinary_named_column_list1().GetRule_named_column1())) { @@ -2530,7 +2530,7 @@ TSourcePtr TSqlSelect::JoinSource(const TRule_join_source& node) { } if (node.Block2Size()) { TPosition pos(Ctx.Pos()); - TVector<TSourcePtr> sources; + TVector<TSourcePtr> sources; sources.emplace_back(std::move(source)); for (auto& block: node.GetBlock2()) { sources.emplace_back(FlattenSource(block.GetRule_flatten_source2())); @@ -2550,7 +2550,7 @@ TSourcePtr TSqlSelect::JoinSource(const TRule_join_source& node) { return source; } -bool TSqlSelect::SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& node) { +bool TSqlSelect::SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& node) { // result_column: // opt_id_prefix ASTERISK // | expr (AS id_or_string)? @@ -2587,12 +2587,12 @@ bool TSqlSelect::SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& return true; } -bool TSqlSelect::ValidateSelectColumns(const TVector<TNodePtr>& terms) { - TSet<TString> labels; - TSet<TString> asteriskSources; +bool TSqlSelect::ValidateSelectColumns(const TVector<TNodePtr>& terms) { + TSet<TString> labels; + TSet<TString> asteriskSources; for (const auto& term: terms) { const auto& label = term->GetLabel(); - if (!Ctx.PragmaAllowDotInAlias && label.find('.') != TString::npos) { + if (!Ctx.PragmaAllowDotInAlias && label.find('.') != TString::npos) { Ctx.Error(term->GetPos()) << "Unable to use '.' in column name. Invalid column name: " << label; return false; } @@ -2752,7 +2752,7 @@ TSourcePtr TSqlSelect::NamedSingleSource(const TRule_named_single_source& node) { const auto& tableSampleClause = sampleBlock.GetAlt2().GetRule_tablesample_clause1(); const auto& modeToken = tableSampleClause.GetRule_sampling_mode2().GetToken1(); - const TCiString& token = Token(modeToken); + const TCiString& token = Token(modeToken); if (token == "system") { mode = ESampleMode::System; } else if (token == "bernoulli") { @@ -2789,7 +2789,7 @@ TSourcePtr TSqlSelect::NamedSingleSource(const TRule_named_single_source& node) return singleSource; } -bool TSqlSelect::ColumnName(TVector<TNodePtr>& keys, const TRule_column_name& node) { +bool TSqlSelect::ColumnName(TVector<TNodePtr>& keys, const TRule_column_name& node) { const auto sourceName = OptIdPrefixAsStr(node.GetRule_opt_id_prefix1(), *this); const auto columnName = IdOrString(node.GetRule_id_or_string2(), *this); YQL_ENSURE(!columnName.empty()); @@ -2797,7 +2797,7 @@ bool TSqlSelect::ColumnName(TVector<TNodePtr>& keys, const TRule_column_name& no return true; } -bool TSqlSelect::ColumnList(TVector<TNodePtr>& keys, const TRule_column_list& node) { +bool TSqlSelect::ColumnList(TVector<TNodePtr>& keys, const TRule_column_list& node) { if (!ColumnName(keys, node.GetRule_column_name1())) { return false; } @@ -2810,7 +2810,7 @@ bool TSqlSelect::ColumnList(TVector<TNodePtr>& keys, const TRule_column_list& no return true; } -bool TSqlSelect::NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_column& node) { +bool TSqlSelect::NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_column& node) { if (!ColumnName(columnList, node.GetRule_column_name1())) { return false; } @@ -2821,7 +2821,7 @@ bool TSqlSelect::NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_co return true; } -bool TSqlSelect::NamedColumnList(TVector<TNodePtr>& columnList, const TRule_named_column_list& node) { +bool TSqlSelect::NamedColumnList(TVector<TNodePtr>& columnList, const TRule_named_column_list& node) { if (!NamedColumn(columnList, node.GetRule_named_column1())) { return false; } @@ -2833,7 +2833,7 @@ bool TSqlSelect::NamedColumnList(TVector<TNodePtr>& columnList, const TRule_name return true; } -bool TSqlSelect::SortSpecification(const TRule_sort_specification& node, TVector<TSortSpecificationPtr>& sortSpecs) { +bool TSqlSelect::SortSpecification(const TRule_sort_specification& node, TVector<TSortSpecificationPtr>& sortSpecs) { bool asc = true; TSqlExpression expr(Ctx, Mode); TNodePtr exprNode = expr.Build(node.GetRule_expr1()); @@ -2866,7 +2866,7 @@ bool TSqlSelect::SortSpecification(const TRule_sort_specification& node, TVector return true; } -bool TSqlSelect::SortSpecificationList(const TRule_sort_specification_list& node, TVector<TSortSpecificationPtr>& sortSpecs) { +bool TSqlSelect::SortSpecificationList(const TRule_sort_specification_list& node, TVector<TSortSpecificationPtr>& sortSpecs) { if (!SortSpecification(node.GetRule_sort_specification1(), sortSpecs)) { return false; } @@ -3008,14 +3008,14 @@ TSourcePtr TSqlSelect::ReduceCore(const TRule_reduce_core& node, const TWriteSet source = BuildMuxSource(pos, std::move(sources)); } - TVector<TSortSpecificationPtr> orderBy; + TVector<TSortSpecificationPtr> orderBy; if (node.HasBlock4()) { if (!SortSpecificationList(node.GetBlock4().GetRule_sort_specification_list2(), orderBy)) { return {}; } } - TVector<TNodePtr> keys; + TVector<TNodePtr> keys; if (!ColumnList(keys, node.GetRule_column_list6())) { return nullptr; } @@ -3107,7 +3107,7 @@ TSourcePtr TSqlSelect::SelectCore(const TRule_select_core& node, const TWriteSet return nullptr; } - TVector<TNodePtr> without; + TVector<TNodePtr> without; if (node.HasBlock7()) { if (!ColumnList(without, node.GetBlock7().GetRule_column_list2())) { return nullptr; @@ -3131,7 +3131,7 @@ TSourcePtr TSqlSelect::SelectCore(const TRule_select_core& node, const TWriteSet } /// \todo merge gtoupByExpr and groupBy in one - TVector<TNodePtr> groupByExpr, groupBy; + TVector<TNodePtr> groupByExpr, groupBy; THoppingWindowSpecPtr hoppingWindowSpec; if (node.HasBlock10()) { TGroupByClause clause(Ctx, Mode); @@ -3169,7 +3169,7 @@ TSourcePtr TSqlSelect::SelectCore(const TRule_select_core& node, const TWriteSet Ctx.IncrementMonCounter("sql_features", "WindowClause"); } - TVector<TSortSpecificationPtr> orderBy; + TVector<TSortSpecificationPtr> orderBy; if (node.HasBlock13()) { if (stream) { Ctx.Error() << "ORDER BY is not allowed in streaming queries"; @@ -3180,7 +3180,7 @@ TSourcePtr TSqlSelect::SelectCore(const TRule_select_core& node, const TWriteSet } Ctx.IncrementMonCounter("sql_features", IsColumnsOnly(orderBy) ? "OrderBy" : "OrderByExpr"); } - TVector<TNodePtr> terms; + TVector<TNodePtr> terms; if (!SelectTerm(terms, node.GetRule_result_column5())) { return nullptr; } @@ -3251,7 +3251,7 @@ bool TSqlSelect::FrameBound(const TRule_window_frame_bound& rule, TNodePtr& node bool TSqlSelect::FrameClause(const TRule_window_frame_clause& rule, TMaybe<TFrameSpecification>& frameSpecLink) { TFrameSpecification frameSpec; - const TString frameUnitStr = to_lower(Token(rule.GetRule_window_frame_units1().GetToken1())); + const TString frameUnitStr = to_lower(Token(rule.GetRule_window_frame_units1().GetToken1())); if (frameUnitStr == "rows") { frameSpec.FrameType = EFrameType::FrameByRows; } else if (frameUnitStr == "range") { @@ -3327,7 +3327,7 @@ TWindowSpecificationPtr TSqlSelect::WindowSpecification(const TRule_window_speci } bool TSqlSelect::WindowDefenition(const TRule_window_definition& rule, TWinSpecs& winSpecs) { - const TString windowName = Id(rule.GetRule_new_window_name1().GetRule_window_name1().GetRule_id1(), *this); + const TString windowName = Id(rule.GetRule_new_window_name1().GetRule_window_name1().GetRule_id1(), *this); if (winSpecs.contains(windowName)) { Ctx.Error() << "Unable to declare window with same name: " << windowName; return false; @@ -3353,7 +3353,7 @@ bool TSqlSelect::WindowClause(const TRule_window_clause& rule, TWinSpecs& winSpe return true; } -bool TSqlSelect::OrderByClause(const TRule_order_by_clause& node, TVector<TSortSpecificationPtr>& orderBy) { +bool TSqlSelect::OrderByClause(const TRule_order_by_clause& node, TVector<TSortSpecificationPtr>& orderBy) { return SortSpecificationList(node.GetRule_sort_specification_list3(), orderBy); } @@ -3391,7 +3391,7 @@ bool TGroupByClause::ParseList(const TRule_grouping_element_list& groupingListNo return true; } -void TGroupByClause::SetFeatures(const TString& field) const { +void TGroupByClause::SetFeatures(const TString& field) const { Ctx.IncrementMonCounter(field, "GroupBy"); const auto& features = Features(); if (features.Test(EGroupByFeatures::Ordinary)) { @@ -3414,11 +3414,11 @@ void TGroupByClause::SetFeatures(const TString& field) const { } } -TVector<TNodePtr>& TGroupByClause::Content() { +TVector<TNodePtr>& TGroupByClause::Content() { return GroupBySet; } -TMap<TString, TNodePtr>& TGroupByClause::Aliases() { +TMap<TString, TNodePtr>& TGroupByClause::Aliases() { return GroupSetContext->NodeAliases; } @@ -3426,13 +3426,13 @@ THoppingWindowSpecPtr TGroupByClause::GetHoppingWindow() { return HoppingWindowSpec; } -TVector<TNodePtr> TGroupByClause::MultiplyGroupingSets(const TVector<TNodePtr>& lhs, const TVector<TNodePtr>& rhs) const { - TVector<TNodePtr> content; +TVector<TNodePtr> TGroupByClause::MultiplyGroupingSets(const TVector<TNodePtr>& lhs, const TVector<TNodePtr>& rhs) const { + TVector<TNodePtr> content; for (const auto& leftNode: lhs) { auto leftPtr = leftNode->ContentListPtr(); YQL_ENSURE(leftPtr, "Unable to multiply grouping sets"); for (const auto& rightNode: rhs) { - TVector<TNodePtr> mulItem(leftPtr->begin(), leftPtr->end()); + TVector<TNodePtr> mulItem(leftPtr->begin(), leftPtr->end()); auto rightPtr = rightNode->ContentListPtr(); YQL_ENSURE(rightPtr, "Unable to multiply grouping sets"); mulItem.insert(mulItem.end(), rightPtr->begin(), rightPtr->end()); @@ -3451,8 +3451,8 @@ void TGroupByClause::ResolveGroupByAndGrouping() { } auto curContent = *(*listPos)->ContentListPtr(); if (listPos != GroupBySet.begin()) { - TVector<TNodePtr> emulate(GroupBySet.begin(), listPos); - TVector<TNodePtr> emulateContent(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(emulate))); + TVector<TNodePtr> emulate(GroupBySet.begin(), listPos); + TVector<TNodePtr> emulateContent(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(emulate))); curContent = MultiplyGroupingSets(emulateContent, curContent); } for (++listPos; listPos != GroupBySet.end(); ++listPos) { @@ -3460,18 +3460,18 @@ void TGroupByClause::ResolveGroupByAndGrouping() { if (newElem) { curContent = MultiplyGroupingSets(curContent, *newElem); } else { - TVector<TNodePtr> emulate(1, *listPos); - TVector<TNodePtr> emulateContent(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(emulate))); + TVector<TNodePtr> emulate(1, *listPos); + TVector<TNodePtr> emulateContent(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(emulate))); curContent = MultiplyGroupingSets(curContent, emulateContent); } } - TVector<TNodePtr> result(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(curContent))); + TVector<TNodePtr> result(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(curContent))); std::swap(result, GroupBySet); } bool TGroupByClause::GroupingElement(const TRule_grouping_element& node) { TSourcePtr res; - TVector<TNodePtr> emptyContent; + TVector<TNodePtr> emptyContent; switch (node.Alt_case()) { case TRule_grouping_element::kAltGroupingElement1: if (!OrdinaryGroupingSet(node.GetAlt_grouping_element1().GetRule_ordinary_grouping_set1())) { @@ -3488,9 +3488,9 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node) { if (!IsNodeColumnsOrNamedExpression(content, "ROLLUP")) { return false; } - TVector<TNodePtr> collection; + TVector<TNodePtr> collection; for (auto limit = content.end(), begin = content.begin(); limit != begin; --limit) { - TVector<TNodePtr> grouping(begin, limit); + TVector<TNodePtr> grouping(begin, limit); collection.push_back(BuildListOfNamedNodes(Ctx.Pos(), std::move(grouping))); } collection.push_back(BuildListOfNamedNodes(Ctx.Pos(), std::move(emptyContent))); @@ -3512,9 +3512,9 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node) { Ctx.Error() << "GROUP BY CUBE is allowed only for " << Ctx.PragmaGroupByCubeLimit << " columns, but you use " << content.size(); return false; } - TVector<TNodePtr> collection; + TVector<TNodePtr> collection; for (unsigned mask = (1 << content.size()) - 1; mask > 0; --mask) { - TVector<TNodePtr> grouping; + TVector<TNodePtr> grouping; for (unsigned index = 0; index < content.size(); ++index) { if (mask & (1 << index)) { grouping.push_back(content[content.size() - index - 1]); @@ -3538,7 +3538,7 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node) { if (!IsNodeColumnsOrNamedExpression(content, "GROUPING SETS")) { return false; } - TVector<TNodePtr> collection; + TVector<TNodePtr> collection; bool hasEmpty = false; for (auto& elem: content) { auto elemContent = elem->ContentListPtr(); @@ -3551,7 +3551,7 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node) { FeedCollection(elem, collection, hasEmpty); } } else { - TVector<TNodePtr> elemList(1, std::move(elem)); + TVector<TNodePtr> elemList(1, std::move(elem)); collection.push_back(BuildListOfNamedNodes(Ctx.Pos(), std::move(elemList))); } } @@ -3571,7 +3571,7 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node) { return true; } -void TGroupByClause::FeedCollection(const TNodePtr& elem, TVector<TNodePtr>& collection, bool& hasEmpty) const { +void TGroupByClause::FeedCollection(const TNodePtr& elem, TVector<TNodePtr>& collection, bool& hasEmpty) const { auto elemContentPtr = elem->ContentListPtr(); if (elemContentPtr && elemContentPtr->empty()) { if (hasEmpty) { @@ -3704,7 +3704,7 @@ bool TGroupByClause::HoppingWindow(const TRule_hopping_window_specification& nod return true; } -bool TGroupByClause::IsNodeColumnsOrNamedExpression(const TVector<TNodePtr>& content, const TString& construction) const { +bool TGroupByClause::IsNodeColumnsOrNamedExpression(const TVector<TNodePtr>& content, const TString& construction) const { for (const auto& node: content) { if (IsAutogenerated(node->GetColumnName())) { Ctx.Error() << "You should use in " << construction << " either expression with required alias either column name or used alias."; @@ -3723,7 +3723,7 @@ const TGroupByClause::TGroupingSetFeatures& TGroupByClause::Features() const { return GroupSetContext->GroupFeatures; } -bool TGroupByClause::AddAlias(const TString& label, const TNodePtr& node) { +bool TGroupByClause::AddAlias(const TString& label, const TNodePtr& node) { if (Aliases().contains(label)) { Ctx.Error() << "Duplicated aliases not allowed"; Ctx.IncrementMonCounter("sql_errors", "GroupByDuplicateAliases"); @@ -3733,11 +3733,11 @@ bool TGroupByClause::AddAlias(const TString& label, const TNodePtr& node) { return true; } -TString TGroupByClause::GenerateGroupByExprName() { +TString TGroupByClause::GenerateGroupByExprName() { return TStringBuilder() << AutogenerateNamePrefix << GroupSetContext->UnnamedCount++; } -bool TGroupByClause::IsAutogenerated(const TString* name) const { +bool TGroupByClause::IsAutogenerated(const TString* name) const { return name && name->StartsWith(AutogenerateNamePrefix); } @@ -3838,7 +3838,7 @@ TSourcePtr TSqlSelect::Build(const TRule_select_stmt& node, TPosition& selectPos } TPosition unionPos = selectPos; // Position of first select - TVector<TSourcePtr> sources; + TVector<TSourcePtr> sources; sources.emplace_back(std::move(res)); for (auto& b: node.GetBlock2()) { auto next = SelectKind(b.GetRule_select_kind_parenthesis2(), selectPos); @@ -3881,7 +3881,7 @@ public: TSourcePtr Build(const TRule_into_values_source& node, const TString& operationName); private: - bool BuildValuesRow(const TRule_values_source_row& inRow, TVector<TNodePtr>& outRow); + bool BuildValuesRow(const TRule_values_source_row& inRow, TVector<TNodePtr>& outRow); TSourcePtr ValuesSource(const TRule_values_source& node, TVector<TString>& columnsHint, const TString& operationName); }; @@ -3915,7 +3915,7 @@ TSourcePtr TSqlIntoValues::ValuesSource(const TRule_values_source& node, TVector TPosition pos(Ctx.Pos()); switch (node.Alt_case()) { case TRule_values_source::kAltValuesSource1: { - TVector<TVector<TNodePtr>> rows {{}}; + TVector<TVector<TNodePtr>> rows {{}}; const auto& rowList = node.GetAlt_values_source1().GetRule_values_source_row_list2(); if (!BuildValuesRow(rowList.GetRule_values_source_row1(), rows.back())) { @@ -3968,7 +3968,7 @@ private: }; TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) { - static const TMap<TString, ESQLWriteColumnMode> str2Mode = { + static const TMap<TString, ESQLWriteColumnMode> str2Mode = { {"InsertInto", ESQLWriteColumnMode::InsertInto}, {"InsertOrAbortInto", ESQLWriteColumnMode::InsertOrAbortInto}, {"InsertOrIgnoreInto", ESQLWriteColumnMode::InsertOrIgnoreInto}, @@ -4211,16 +4211,16 @@ public: private: bool DeclareStatement(const TRule_declare_stmt& stmt); bool ExportStatement(const TRule_export_stmt& stmt); - bool AlterTableAddColumns(TVector<TNodePtr>& blocks, const TRule_alter_table_add_column& node, const TTableRef& tr); - bool AlterTableDropColumn(TVector<TNodePtr>& blocks, const TRule_alter_table_drop_column& node, const TTableRef& tr); + bool AlterTableAddColumns(TVector<TNodePtr>& blocks, const TRule_alter_table_add_column& node, const TTableRef& tr); + bool AlterTableDropColumn(TVector<TNodePtr>& blocks, const TRule_alter_table_drop_column& node, const TTableRef& tr); TNodePtr PragmaStatement(const TRule_pragma_stmt& stmt, bool& success); - void AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node); + void AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node); TNodePtr Build(const TRule_delete_stmt& stmt); TNodePtr Build(const TRule_update_stmt& stmt); TSourcePtr Build(const TRule_set_clause_choice& stmt); - bool FillSetClause(const TRule_set_clause& node, TVector<TString>& targetList, TVector<TNodePtr>& values); + bool FillSetClause(const TRule_set_clause& node, TVector<TString>& targetList, TVector<TNodePtr>& values); TSourcePtr Build(const TRule_set_clause_list& stmt); TSourcePtr Build(const TRule_multiple_column_assignment& stmt); TNodePtr FlexType(TTranslation& ctx, const TRule_flex_type& node); @@ -4230,10 +4230,10 @@ private: internalStatementName.clear(); humanStatementName.clear(); const auto& descr = AltDescription(node); - TVector<TString> parts; + TVector<TString> parts; const auto pos = descr.find(": "); - Y_VERIFY_DEBUG(pos != TString::npos); - Split(TString(descr.begin() + pos + 2, descr.end()), "_", parts); + Y_VERIFY_DEBUG(pos != TString::npos); + Split(TString(descr.begin() + pos + 2, descr.end()), "_", parts); Y_VERIFY_DEBUG(parts.size() > 1); parts.pop_back(); for (auto& part: parts) { @@ -4249,7 +4249,7 @@ private: const bool TopLevel; }; -void TSqlQuery::AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node) { +void TSqlQuery::AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node) { blocks.emplace_back(node); } @@ -4336,8 +4336,8 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core& const auto& rule = core.GetAlt_sql_stmt_core4().GetRule_create_table_stmt1(); TTableRef tr(SimpleTableRefImpl(rule.GetRule_simple_table_ref3(), Mode, *this)); - TVector<TColumnSchema> columns; - TVector<TIdentifier> pkColumns; + TVector<TColumnSchema> columns; + TVector<TIdentifier> pkColumns; TVector<TIdentifier> partitionByColumns; TVector<std::pair<TIdentifier, bool>> orderByColumns; @@ -4540,15 +4540,15 @@ bool TSqlQuery::ExportStatement(const TRule_export_stmt& stmt) { return false; } - TVector<TString> bindNames; + TVector<TString> bindNames; if (!BindList(stmt.GetRule_bind_parameter_list2(), bindNames)) { return false; } return Ctx.AddExports(bindNames); } -bool TSqlQuery::AlterTableAddColumns(TVector<TNodePtr>& blocks, const TRule_alter_table_add_column& rule, const TTableRef& tr) { - TVector<TColumnSchema> columns; +bool TSqlQuery::AlterTableAddColumns(TVector<TNodePtr>& blocks, const TRule_alter_table_add_column& rule, const TTableRef& tr) { + TVector<TColumnSchema> columns; columns.push_back(ColumnSchemaImpl(rule.GetRule_column_schema3(), *this)); for (const auto& block: rule.GetBlock4()) { @@ -4559,19 +4559,19 @@ bool TSqlQuery::AlterTableAddColumns(TVector<TNodePtr>& blocks, const TRule_alte return true; } -bool TSqlQuery::AlterTableDropColumn(TVector<TNodePtr>& blocks, const TRule_alter_table_drop_column& node, const TTableRef& tr) { +bool TSqlQuery::AlterTableDropColumn(TVector<TNodePtr>& blocks, const TRule_alter_table_drop_column& node, const TTableRef& tr) { TString name = Id(node.GetRule_id3(), *this); TColumnSchema column(Ctx.Pos(), name, "", false, false); - AddStatementToBlocks(blocks, BuildAlterTable(Ctx.Pos(), tr, TVector<TColumnSchema>{column}, EAlterTableIntentnt::DropColumn)); + AddStatementToBlocks(blocks, BuildAlterTable(Ctx.Pos(), tr, TVector<TColumnSchema>{column}, EAlterTableIntentnt::DropColumn)); return true; } TNodePtr TSqlQuery::PragmaStatement(const TRule_pragma_stmt& stmt, bool& success) { success = false; - const TString& prefix = OptIdPrefixAsStr(stmt.GetRule_opt_id_prefix2(), *this); - const TString& lowerPrefix = to_lower(prefix); - const TString pragma(IdOrString(stmt.GetRule_id_or_string3(), *this)); - TString normalizedPragma(pragma); + const TString& prefix = OptIdPrefixAsStr(stmt.GetRule_opt_id_prefix2(), *this); + const TString& lowerPrefix = to_lower(prefix); + const TString pragma(IdOrString(stmt.GetRule_id_or_string3(), *this)); + TString normalizedPragma(pragma); TMaybe<TIssue> normalizeError = NormalizeName(Ctx.Pos(), normalizedPragma); if (!normalizeError.Empty()) { Error() << normalizeError->Message; @@ -4580,7 +4580,7 @@ TNodePtr TSqlQuery::PragmaStatement(const TRule_pragma_stmt& stmt, bool& success } TVector<TDeferredAtom> values; - TVector<const TRule_pragma_value*> pragmaValues; + TVector<const TRule_pragma_value*> pragmaValues; bool pragmaValueDefault = false; if (stmt.GetBlock4().HasAlt1()) { pragmaValues.push_back(&stmt.GetBlock4().GetAlt1().GetRule_pragma_value2()); @@ -4992,7 +4992,7 @@ TSourcePtr TSqlQuery::Build(const TRule_set_clause_choice& stmt) { } } -bool TSqlQuery::FillSetClause(const TRule_set_clause& node, TVector<TString>& targetList, TVector<TNodePtr>& values) { +bool TSqlQuery::FillSetClause(const TRule_set_clause& node, TVector<TString>& targetList, TVector<TNodePtr>& values) { targetList.push_back(ColumnNameAsSingleStr(*this, node.GetRule_set_target1().GetRule_column_name1())); TSqlExpression sqlExpr(Ctx, Mode); if (!Expr(sqlExpr, values, node.GetRule_expr3())) { @@ -5002,8 +5002,8 @@ bool TSqlQuery::FillSetClause(const TRule_set_clause& node, TVector<TString>& ta } TSourcePtr TSqlQuery::Build(const TRule_set_clause_list& stmt) { - TVector<TString> targetList; - TVector<TNodePtr> values; + TVector<TString> targetList; + TVector<TNodePtr> values; const TPosition pos(Ctx.Pos()); if (!FillSetClause(stmt.GetRule_set_clause1(), targetList, values)) { return nullptr; @@ -5018,13 +5018,13 @@ TSourcePtr TSqlQuery::Build(const TRule_set_clause_list& stmt) { } TSourcePtr TSqlQuery::Build(const TRule_multiple_column_assignment& stmt) { - TVector<TString> targetList; + TVector<TString> targetList; FillTargetList(*this, stmt.GetRule_set_target_list1(), targetList); auto simpleValuesNode = stmt.GetRule_simple_values_source4(); const TPosition pos(Ctx.Pos()); switch (simpleValuesNode.Alt_case()) { case TRule_simple_values_source::kAltSimpleValuesSource1: { - TVector<TNodePtr> values; + TVector<TNodePtr> values; TSqlExpression sqlExpr(Ctx, Mode); if (!ExprList(sqlExpr, values, simpleValuesNode.GetAlt_simple_values_source1().GetRule_expr_list1())) { return nullptr; @@ -5049,7 +5049,7 @@ TSourcePtr TSqlQuery::Build(const TRule_multiple_column_assignment& stmt) { TNodePtr TSqlQuery::Build(const TSQLParserAST& ast) { const auto& statements = ast.GetRule_sql_stmt_list(); - TVector<TNodePtr> blocks; + TVector<TNodePtr> blocks; if (Ctx.Settings.WarnOnV0) { if (Ctx.Settings.V0WarnAsError->Allow()) { diff --git a/ydb/library/yql/sql/v0/sql_ut.cpp b/ydb/library/yql/sql/v0/sql_ut.cpp index 3a70aef93cc..7fa128d9b37 100644 --- a/ydb/library/yql/sql/v0/sql_ut.cpp +++ b/ydb/library/yql/sql/v0/sql_ut.cpp @@ -14,7 +14,7 @@ enum class EDebugOutput { ToCerr, }; -TString Err2Str(NYql::TAstParseResult& res, EDebugOutput debug = EDebugOutput::None) { +TString Err2Str(NYql::TAstParseResult& res, EDebugOutput debug = EDebugOutput::None) { TStringStream s; res.Issues.PrintTo(s); @@ -27,7 +27,7 @@ TString Err2Str(NYql::TAstParseResult& res, EDebugOutput debug = EDebugOutput::N NYql::TAstParseResult SqlToYqlWithMode(const TString& query, NSQLTranslation::ESqlMode mode = NSQLTranslation::ESqlMode::QUERY, size_t maxErrors = 10, const TString& provider = {}, EDebugOutput debug = EDebugOutput::None) { google::protobuf::Arena arena; const auto service = provider ? provider : TString(NYql::YtProviderName); - const TString cluster = "plato"; + const TString cluster = "plato"; NSQLTranslation::TTranslationSettings settings; settings.ClusterMapping[cluster] = service; settings.MaxErrors = maxErrors; @@ -46,17 +46,17 @@ NYql::TAstParseResult SqlToYql(const TString& query, size_t maxErrors = 10, cons return SqlToYqlWithMode(query, NSQLTranslation::ESqlMode::QUERY, maxErrors, provider, debug); } -TString GetPrettyPrint(const NYql::TAstParseResult& res) { +TString GetPrettyPrint(const NYql::TAstParseResult& res) { TStringStream yqlProgram; res.Root->PrettyPrintTo(yqlProgram, NYql::TAstPrintFlags::PerLine | NYql::TAstPrintFlags::ShortQuote); return yqlProgram.Str(); } -TString Quote(const char* str) { +TString Quote(const char* str) { return TStringBuilder() << "'\"" << str << "\""; } -class TWordCountHive: public TMap<TString, unsigned> { +class TWordCountHive: public TMap<TString, unsigned> { public: TWordCountHive(std::initializer_list<TString> strings) { for (auto& str: strings) { @@ -65,21 +65,21 @@ public: } TWordCountHive(std::initializer_list<std::pair<const TString, unsigned>> list) - : TMap(list) + : TMap(list) { } }; -typedef std::function<void (const TString& word, const TString& line)> TVerifyLineFunc; +typedef std::function<void (const TString& word, const TString& line)> TVerifyLineFunc; -TString VerifyProgram(const NYql::TAstParseResult& res, TWordCountHive& wordCounter, TVerifyLineFunc verifyLine = TVerifyLineFunc()) { +TString VerifyProgram(const NYql::TAstParseResult& res, TWordCountHive& wordCounter, TVerifyLineFunc verifyLine = TVerifyLineFunc()) { const auto programm = GetPrettyPrint(res); - TVector<TString> yqlProgram; + TVector<TString> yqlProgram; Split(programm, "\n", yqlProgram); for (const auto& line: yqlProgram) { for (auto& counterIter: wordCounter) { const auto& word = counterIter.first; - if (line.find(word) != TString::npos) { + if (line.find(word) != TString::npos) { ++counterIter.second; if (verifyLine) { verifyLine(word, line); @@ -167,20 +167,20 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("select interested_table.*, LENGTH(value) AS megahelpful_len from plato.Input as interested_table;"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "FlattenMembers") { static ui32 count1 = 0; if (++count1 == 1) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("interested_table.")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("interested_table.")); } } else if (word == "AsStruct") { static ui32 count2 = 0; if (++count2 == 2) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("megahelpful_len")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("megahelpful_len")); } } }; - TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["FlattenMembers"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["AsStruct"]); @@ -190,20 +190,20 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("select LENGTH(value) AS megahelpful_len, interested_table.* from plato.Input as interested_table;"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "FlattenMembers") { static ui32 count1 = 0; if (++count1 == 1) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("interested_table.")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("interested_table.")); } } else if (word == "AsStruct") { static ui32 count2 = 0; if (++count2 == 2) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("megahelpful_len")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("megahelpful_len")); } } }; - TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["FlattenMembers"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["AsStruct"]); @@ -213,10 +213,10 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("select interested_table.key, interested_table.value from plato.Input as interested_table;"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { - const bool fieldKey = TString::npos != line.find(Quote("key")); - const bool fieldValue = TString::npos != line.find(Quote("value")); - const bool refOnTable = TString::npos != line.find("interested_table."); + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + const bool fieldKey = TString::npos != line.find(Quote("key")); + const bool fieldValue = TString::npos != line.find(Quote("value")); + const bool refOnTable = TString::npos != line.find("interested_table."); if (word == "AsStruct") { UNIT_ASSERT(fieldKey || fieldValue); UNIT_ASSERT(!refOnTable); @@ -224,7 +224,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { UNIT_ASSERT(fieldKey && fieldValue && !refOnTable); } }; - TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}, {TString("Write!"), 0}}; + TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}, {TString("Write!"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(0, elementStat["FlattenMembers"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["AsStruct"]); @@ -240,18 +240,18 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { ); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "SelectMembers") { - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa.")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("table_bb.")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa.")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("table_bb.")); } else if (word == "AsStruct") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("SqlColumn")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("table_aa"))); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("key"))); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("megakey"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("SqlColumn")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("table_aa"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("key"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("megakey"))); } }; - TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("SelectMembers"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("SelectMembers"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["FlattenMembers"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["SelectMembers"]); @@ -268,21 +268,21 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Err2Str(res); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "SelectMembers") { - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa.")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("table_bb.")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("table_cc.")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa.")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("table_bb.")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("table_cc.")); } else if (word == "AsStruct") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("SqlColumn")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("SqlColumn")); const auto posTableAA = line.find(Quote("table_aa")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, posTableAA); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("key"))); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("gigakey"))); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa", posTableAA + 3)); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, posTableAA); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("key"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("gigakey"))); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa", posTableAA + 3)); } }; - TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("SelectMembers"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("SelectMembers"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["FlattenMembers"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["SelectMembers"]); @@ -299,20 +299,20 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { ); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "AsStruct") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("SqlColumn")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("SqlColumn")); const auto posTableA = line.find(Quote("a")); const auto posTableB = line.find(Quote("b")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, posTableA); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, posTableB); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find(Quote("a"), posTableA + 1)); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("v"))); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find(Quote("b"), posTableB + 1)); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("value"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, posTableA); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, posTableB); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find(Quote("a"), posTableA + 1)); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("v"))); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find(Quote("b"), posTableB + 1)); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("value"))); } }; - TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(0, elementStat["FlattenMembers"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["AsStruct"]); @@ -322,18 +322,18 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("SELECT a.value, b.value FROM plato.Input AS a JOIN plato.Input as b ON a.key == b.key;"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "AsStruct") { - const bool isValueFromA = TString::npos != line.find(Quote("a.value")); - const bool isValueFromB = TString::npos != line.find(Quote("b.value")); + const bool isValueFromA = TString::npos != line.find(Quote("a.value")); + const bool isValueFromB = TString::npos != line.find(Quote("b.value")); UNIT_ASSERT(isValueFromA || isValueFromB); } if (word == "Write!") { - const bool noDuplicateSourceInA = TString::npos == line.find("a.a."); - const bool noDuplicateSourceInB = TString::npos == line.find("b.b."); + const bool noDuplicateSourceInA = TString::npos == line.find("a.a."); + const bool noDuplicateSourceInB = TString::npos == line.find("b.b."); UNIT_ASSERT(noDuplicateSourceInA || noDuplicateSourceInB); } }; - TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}, {"Write!", 0}}; + TWordCountHive elementStat = {{TString("FlattenMembers"), 0}, {TString("AsStruct"), 0}, {"Write!", 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(0, elementStat["FlattenMembers"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["AsStruct"]); @@ -373,19 +373,19 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Y_UNIT_TEST(SelectOrderByLabeledColumn) { NYql::TAstParseResult res = SqlToYql("select key as goal from plato.Input order by goal"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "DataSource" && TString::npos == line.find("SQL")) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("plato")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Input")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("plato")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Input")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("goal")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("goal")); } else if (word == "Sort") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("goal")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("goal")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("key")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("key")); } }; - TWordCountHive elementStat = {{TString("DataSource"), 0}, {TString("Sort"), 0}}; + TWordCountHive elementStat = {{TString("DataSource"), 0}, {TString("Sort"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(2, elementStat["DataSource"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Sort"]); @@ -404,18 +404,18 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Y_UNIT_TEST(SelectOrderByExpression) { NYql::TAstParseResult res = SqlToYql("select * from plato.Input as i order by cast(key as uint32) + cast(subkey as uint32)"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Sort") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"+\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("key")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("subkey")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'true)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"+\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("key")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("subkey")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'true)")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.key")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.subkey")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.key")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.subkey")); } }; - TWordCountHive elementStat = {{TString("Sort"), 0}}; + TWordCountHive elementStat = {{TString("Sort"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Sort"]); } @@ -423,21 +423,21 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Y_UNIT_TEST(SelectOrderByExpressionDesc) { NYql::TAstParseResult res = SqlToYql("select i.*, key, subkey from plato.Input as i order by cast(i.key as uint32) - cast(i.subkey as uint32) desc"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Sort") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"-\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'false)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"-\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'false)")); } else if (word == "Write!") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("'columns")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("prefix")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"i.\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("'columns")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("prefix")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"i.\"")); } }; - TWordCountHive elementStat = {{TString("Sort"), 0}, {TString("Write!"), 0}}; + TWordCountHive elementStat = {{TString("Sort"), 0}, {TString("Write!"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Sort"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write!"]); @@ -446,20 +446,20 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Y_UNIT_TEST(SelectOrderByExpressionAsc) { NYql::TAstParseResult res = SqlToYql("select i.key, i.subkey from plato.Input as i order by cast(key as uint32) % cast(i.subkey as uint32) asc"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Sort") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"%\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'true)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"%\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'true)")); } else if (word == "Write!") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("'columns")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("'columns")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.")); } }; - TWordCountHive elementStat = {{TString("Sort"), 0}, {TString("Write!"), 0}}; + TWordCountHive elementStat = {{TString("Sort"), 0}, {TString("Write!"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Sort"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write!"]); @@ -494,14 +494,14 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("USE plato; CREATE TABLE tableName (Key Uint32, Subkey Int64, Value String, PRIMARY KEY (Key, Subkey));"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"Key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"Subkey\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"Key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"Subkey\"")); } }; - TWordCountHive elementStat = {{TString("Write"), 0}, {TString("primarykey"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}, {TString("primarykey"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -512,13 +512,13 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("delete from plato.Input where key = 200;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'delete)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'delete)")); } }; - TWordCountHive elementStat = {{TString("Write"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -528,13 +528,13 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("delete from plato.Input;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'delete)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'delete)")); } }; - TWordCountHive elementStat = {{TString("Write"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -578,22 +578,22 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("update plato.Input set key = 777, value = 'cool' where key = 200;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); } else if (word == "AsStruct") { - const bool isKey = line.find("key") != TString::npos; - const bool isValue = line.find("value") != TString::npos; + const bool isKey = line.find("key") != TString::npos; + const bool isValue = line.find("value") != TString::npos; UNIT_ASSERT(isKey || isValue); if (isKey) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("777"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("777"))); } else if (isValue) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("cool"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("cool"))); } } }; - TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -604,25 +604,25 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("update plato.Input set (key, value, subkey) = ('2','ddd',':') where key = 200;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); } else if (word == "AsStruct") { - const bool isKey = line.find("key") != TString::npos; - const bool isSubkey = line.find("subkey") != TString::npos; - const bool isValue = line.find("value") != TString::npos; + const bool isKey = line.find("key") != TString::npos; + const bool isSubkey = line.find("subkey") != TString::npos; + const bool isValue = line.find("value") != TString::npos; UNIT_ASSERT(isKey || isSubkey || isValue); if (isKey && !isSubkey) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("2"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("2"))); } else if (isSubkey) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote(":"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote(":"))); } else if (isValue) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("ddd"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("ddd"))); } } }; - TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -659,18 +659,18 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("update plato.Input set subkey = subkey + 's';", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); } else if (word == "AsStruct") { - const bool isSubkey = line.find("subkey") != TString::npos; + const bool isSubkey = line.find("subkey") != TString::npos; UNIT_ASSERT(isSubkey); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("subkey"))); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("s"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("subkey"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("s"))); } }; - TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -714,7 +714,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("SELECT key FROM plato.Input UNION ALL select subkey FROM plato.Input;"); UNIT_ASSERT(res.Root); - TWordCountHive elementStat = {{TString("UnionAll"), 0}}; + TWordCountHive elementStat = {{TString("UnionAll"), 0}}; VerifyProgram(res, elementStat, {}); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["UnionAll"]); } @@ -740,7 +740,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("use plato; rollback;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TWordCountHive elementStat = {{TString("rollback"), 0}}; + TWordCountHive elementStat = {{TString("rollback"), 0}}; VerifyProgram(res, elementStat); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["rollback"]); } @@ -749,7 +749,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql(R"(pragma file("HW", "sbr:181041334");)"); UNIT_ASSERT(res.Root); - TWordCountHive elementStat = {{TString(R"((let world (Configure! world (DataSource '"config") '"AddFileByUrl" '"HW" '"sbr:181041334")))"), 0}}; + TWordCountHive elementStat = {{TString(R"((let world (Configure! world (DataSource '"config") '"AddFileByUrl" '"HW" '"sbr:181041334")))"), 0}}; VerifyProgram(res, elementStat); UNIT_ASSERT_VALUES_EQUAL(1, elementStat.cbegin()->second); } diff --git a/ydb/library/yql/sql/v1/aggregation.cpp b/ydb/library/yql/sql/v1/aggregation.cpp index 850e0e5056e..28b7cac40e4 100644 --- a/ydb/library/yql/sql/v1/aggregation.cpp +++ b/ydb/library/yql/sql/v1/aggregation.cpp @@ -182,7 +182,7 @@ TAggregationPtr BuildFactoryAggregation(TPosition pos, const TString& name, cons class TKeyPayloadAggregationFactory final : public TAggregationFactory { public: - TKeyPayloadAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TKeyPayloadAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -279,13 +279,13 @@ private: TNodePtr Key, Payload, Limit; }; -TAggregationPtr BuildKeyPayloadFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildKeyPayloadFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TKeyPayloadAggregationFactory(pos, name, factory, aggMode); } class TPayloadPredicateAggregationFactory final : public TAggregationFactory { public: - TPayloadPredicateAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TPayloadPredicateAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -357,13 +357,13 @@ private: TNodePtr Payload, Predicate; }; -TAggregationPtr BuildPayloadPredicateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildPayloadPredicateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TPayloadPredicateAggregationFactory(pos, name, factory, aggMode); } class TTwoArgsAggregationFactory final : public TAggregationFactory { public: - TTwoArgsAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TTwoArgsAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -431,13 +431,13 @@ private: TNodePtr One, Two; }; -TAggregationPtr BuildTwoArgsFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildTwoArgsFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TTwoArgsAggregationFactory(pos, name, factory, aggMode); } class THistogramAggregationFactory final : public TAggregationFactory { public: - THistogramAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + THistogramAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) , FakeSource(BuildFakeSource(pos)) , Weight(Y("Double", Q("1.0"))) @@ -526,13 +526,13 @@ private: TNodePtr Weight, Intervals; }; -TAggregationPtr BuildHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new THistogramAggregationFactory(pos, name, factory, aggMode); } class TLinearHistogramAggregationFactory final : public TAggregationFactory { public: - TLinearHistogramAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TLinearHistogramAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) , FakeSource(BuildFakeSource(pos)) , BinSize(Y("Double", Q("10.0"))) @@ -601,19 +601,19 @@ private: TNodePtr BinSize, Minimum, Maximum; }; -TAggregationPtr BuildLinearHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildLinearHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TLinearHistogramAggregationFactory(pos, name, factory, aggMode); } class TPercentileFactory final : public TAggregationFactory { public: - TPercentileFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TPercentileFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) , FakeSource(BuildFakeSource(pos)) {} private: - const TString* GetGenericKey() const final { + const TString* GetGenericKey() const final { return Column; } @@ -715,18 +715,18 @@ private: } TSourcePtr FakeSource; - std::multimap<TString, TNodePtr> Percentiles; + std::multimap<TString, TNodePtr> Percentiles; TNodePtr FactoryPercentile; const TString* Column = nullptr; }; -TAggregationPtr BuildPercentileFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildPercentileFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TPercentileFactory(pos, name, factory, aggMode); } class TTopFreqFactory final : public TAggregationFactory { public: - TTopFreqFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TTopFreqFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) , FakeSource(BuildFakeSource(pos)) {} @@ -840,12 +840,12 @@ private: return TAggregationFactory::DoInit(ctx, src); } - std::multimap<TString, TPair> TopFreqs; + std::multimap<TString, TPair> TopFreqs; TPair TopFreqFactoryParams; TSourcePtr FakeSource; }; -TAggregationPtr BuildTopFreqFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildTopFreqFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TTopFreqFactory(pos, name, factory, aggMode); } @@ -1111,7 +1111,7 @@ TAggregationPtr BuildListFactoryAggregation(TPosition pos, const TString& name, class TUserDefinedAggregationFactory final : public TAggregationFactory { public: - TUserDefinedAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) + TUserDefinedAggregationFactory(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) : TAggregationFactory(pos, name, factory, aggMode) {} @@ -1169,13 +1169,13 @@ private: TNodePtr DefVal; }; -TAggregationPtr BuildUserDefinedFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { +TAggregationPtr BuildUserDefinedFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode) { return new TUserDefinedAggregationFactory(pos, name, factory, aggMode); } class TCountAggregation final : public TAggregationFactory { public: - TCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) + TCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) : TAggregationFactory(pos, name, func, aggMode) {} @@ -1200,7 +1200,7 @@ private: } }; -TAggregationPtr BuildCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) { +TAggregationPtr BuildCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) { return new TCountAggregation(pos, name, func, aggMode); } diff --git a/ydb/library/yql/sql/v1/builtin.cpp b/ydb/library/yql/sql/v1/builtin.cpp index 43ef1243f10..75b053bdc33 100644 --- a/ydb/library/yql/sql/v1/builtin.cpp +++ b/ydb/library/yql/sql/v1/builtin.cpp @@ -53,7 +53,7 @@ TMaybe<TString> MakeTypeConfig(const TString& ns, const TVector<TNodePtr>& udfAr class TGroupingNode final: public TAstListNode { public: - TGroupingNode(TPosition pos, const TVector<TNodePtr>& args) + TGroupingNode(TPosition pos, const TVector<TNodePtr>& args) : TAstListNode(pos) , Args(args) {} @@ -63,7 +63,7 @@ public: ctx.Error(Pos) << "Grouping function should have source"; return false; } - TVector<TString> columns; + TVector<TString> columns; columns.reserve(Args.size()); const bool isJoin = src->GetJoin(); ISource* composite = src->GetCompositeSource(); @@ -101,19 +101,19 @@ public: } private: - const TVector<TNodePtr> Args; + const TVector<TNodePtr> Args; }; class TBasicAggrFunc final: public TAstListNode { public: - TBasicAggrFunc(TPosition pos, const TString& name, TAggregationPtr aggr, const TVector<TNodePtr>& args) + TBasicAggrFunc(TPosition pos, const TString& name, TAggregationPtr aggr, const TVector<TNodePtr>& args) : TAstListNode(pos) , Name(name) , Aggr(aggr) , Args(args) {} - TCiString GetName() const { + TCiString GetName() const { return Name; } @@ -190,9 +190,9 @@ private: TNodePtr PreaggregateExpr; protected: - const TString Name; + const TString Name; TAggregationPtr Aggr; - TVector<TNodePtr> Args; + TVector<TNodePtr> Args; }; class TBasicAggrFactory final : public TAstListNode { @@ -261,7 +261,7 @@ typedef THolder<TBasicAggrFunc> TAggrFuncPtr; class TLiteralStringAtom: public INode { public: - TLiteralStringAtom(TPosition pos, TNodePtr node, const TString& info) + TLiteralStringAtom(TPosition pos, TNodePtr node, const TString& info) : INode(pos) , Node(node) , Info(info) @@ -312,12 +312,12 @@ public: private: TNodePtr Node; TNodePtr Atom; - TString Info; + TString Info; }; class TYqlAsAtom: public TLiteralStringAtom { public: - TYqlAsAtom(TPosition pos, const TVector<TNodePtr>& args) + TYqlAsAtom(TPosition pos, const TVector<TNodePtr>& args) : TLiteralStringAtom(pos, args.size() == 1 ? args[0] : nullptr, "Literal string is required as argument") { } @@ -325,7 +325,7 @@ public: class TYqlData: public TCallNode { public: - TYqlData(TPosition pos, const TString& type, const TVector<TNodePtr>& args) + TYqlData(TPosition pos, const TString& type, const TVector<TNodePtr>& args) : TCallNode(pos, type, 1, 1, args) { } @@ -512,7 +512,7 @@ private: class TYqlParseType final : public INode { public: - TYqlParseType(TPosition pos, const TVector<TNodePtr>& args) + TYqlParseType(TPosition pos, const TVector<TNodePtr>& args) : INode(pos) , Args(args) {} @@ -546,7 +546,7 @@ public: State.Set(ENodeState::Const); } private: - TVector<TNodePtr> Args; + TVector<TNodePtr> Args; }; class TYqlAddTimezone: public TCallNode { @@ -650,7 +650,7 @@ public: class TFromBytes final : public TCallNode { public: - TFromBytes(TPosition pos, const TVector<TNodePtr>& args) + TFromBytes(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "FromBytes", 2, 2, args) {} @@ -674,7 +674,7 @@ public: class TYqlTaggedBase : public TCallNode { public: - TYqlTaggedBase(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) + TYqlTaggedBase(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, 2, 2, args) {} @@ -694,7 +694,7 @@ public: class TYqlAsTagged final : public TYqlTaggedBase { public: - TYqlAsTagged(TPosition pos, const TVector<TNodePtr>& args) + TYqlAsTagged(TPosition pos, const TVector<TNodePtr>& args) : TYqlTaggedBase(pos, "AsTagged", args) {} @@ -705,7 +705,7 @@ public: class TYqlUntag final : public TYqlTaggedBase { public: - TYqlUntag(TPosition pos, const TVector<TNodePtr>& args) + TYqlUntag(TPosition pos, const TVector<TNodePtr>& args) : TYqlTaggedBase(pos, "Untag", args) {} @@ -716,7 +716,7 @@ public: class TYqlVariant final : public TCallNode { public: - TYqlVariant(TPosition pos, const TVector<TNodePtr>& args) + TYqlVariant(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "Variant", 3, 3, args) {} @@ -994,11 +994,11 @@ static const TSet<TString> AvailableDataTypes = {"Bool", "String", "Uint32", "Ui "Date", "Datetime", "Timestamp", "Interval", "Uint8", "Int8", "Uint16", "Int16", "TzDate", "TzDatetime", "TzTimestamp", "Uuid", "Decimal", "DyNumber"}; TNodePtr GetDataTypeStringNode(TContext& ctx, TCallNode& node, unsigned argNum, TString* outTypeStrPtr = nullptr) { auto errMsgFunc = [&node, argNum]() { - static std::array<TString, 2> numToName = {{"first", "second"}}; + static std::array<TString, 2> numToName = {{"first", "second"}}; TStringBuilder sb; sb << "At " << numToName.at(argNum) << " argument of " << node.GetOpName() << " expected type string, available one of: " << JoinRange(", ", AvailableDataTypes.begin(), AvailableDataTypes.end()) << ";"; - return TString(sb); + return TString(sb); }; auto typeStringNode = node.GetArgs().at(argNum); auto typeStringPtr = typeStringNode->GetLiteral("String"); @@ -1022,7 +1022,7 @@ TNodePtr GetDataTypeStringNode(TContext& ctx, TCallNode& node, unsigned argNum, class TYqlParseFileOp final: public TCallNode { public: - TYqlParseFileOp(TPosition pos, const TVector<TNodePtr>& args) + TYqlParseFileOp(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "ParseFile", 2, 2, args) {} @@ -1047,7 +1047,7 @@ public: return TCallNode::DoInit(ctx, src); } - TString GetOpName() const override { + TString GetOpName() const override { return "ParseFile"; } @@ -1058,7 +1058,7 @@ public: class TYqlDataType final : public TCallNode { public: - TYqlDataType(TPosition pos, const TVector<TNodePtr>& args) + TYqlDataType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "DataType", 1, 3, args) { FakeSource = BuildFakeSource(pos); @@ -1090,7 +1090,7 @@ private: class TYqlResourceType final : public TCallNode { public: - TYqlResourceType(TPosition pos, const TVector<TNodePtr>& args) + TYqlResourceType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "ResourceType", 1, 1, args) {} @@ -1114,7 +1114,7 @@ public: class TYqlTaggedType final : public TCallNode { public: - TYqlTaggedType(TPosition pos, const TVector<TNodePtr>& args) + TYqlTaggedType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "TaggedType", 2, 2, args) {} @@ -1138,7 +1138,7 @@ public: class TYqlCallableType final : public TCallNode { public: - TYqlCallableType(TPosition pos, const TVector<TNodePtr>& args) + TYqlCallableType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "CallableType", 2, -1, args) {} @@ -1177,7 +1177,7 @@ public: class TYqlTupleElementType final : public TCallNode { public: - TYqlTupleElementType(TPosition pos, const TVector<TNodePtr>& args) + TYqlTupleElementType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "TupleElementType", 2, 2, args) {} @@ -1201,7 +1201,7 @@ public: class TYqlStructMemberType final : public TCallNode { public: - TYqlStructMemberType(TPosition pos, const TVector<TNodePtr>& args) + TYqlStructMemberType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "StructMemberType", 2, 2, args) {} @@ -1225,7 +1225,7 @@ public: class TYqlCallableArgumentType final : public TCallNode { public: - TYqlCallableArgumentType(TPosition pos, const TVector<TNodePtr>& args) + TYqlCallableArgumentType(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "CallableArgumentType", 2, 2, args) {} @@ -1251,7 +1251,7 @@ public: class TStructTypeNode : public TAstListNode { public: - TStructTypeNode(TPosition pos, const TVector<TNodePtr>& exprs) + TStructTypeNode(TPosition pos, const TVector<TNodePtr>& exprs) : TAstListNode(pos) , Exprs(exprs) {} @@ -1274,13 +1274,13 @@ public: } private: - const TVector<TNodePtr> Exprs; + const TVector<TNodePtr> Exprs; }; template <bool IsStrict> class TYqlIf final: public TCallNode { public: - TYqlIf(TPosition pos, const TVector<TNodePtr>& args) + TYqlIf(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, IsStrict ? "IfStrict" : "If", 2, 3, args) {} @@ -1323,7 +1323,7 @@ private: class TYqlIn final: public TCallNode { public: - TYqlIn(TPosition pos, const TVector<TNodePtr>& args) + TYqlIn(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "IN", 3, 3, args) {} @@ -1419,8 +1419,8 @@ protected: {} private: - static TVector<TNodePtr> UdfArgs(TPosition pos, const TString& name, const TVector<TNodePtr>* args = nullptr) { - TVector<TNodePtr> res = { BuildQuotedAtom(pos, name) }; + static TVector<TNodePtr> UdfArgs(TPosition pos, const TString& name, const TVector<TNodePtr>* args = nullptr) { + TVector<TNodePtr> res = { BuildQuotedAtom(pos, name) }; if (args) { res.insert(res.end(), args->begin(), args->end()); } @@ -1492,7 +1492,7 @@ private: class TWeakFieldOp final: public TCallNode { public: - TWeakFieldOp(TPosition pos, const TVector<TNodePtr>& args) + TWeakFieldOp(TPosition pos, const TVector<TNodePtr>& args) : TCallNode(pos, "WeakField", 2, 3, args) {} @@ -1523,7 +1523,7 @@ public: PrecacheState(); const auto memberPos = Args[0]->GetPos(); - TVector<TNodePtr> repackArgs = {BuildAtom(memberPos, "row", NYql::TNodeFlags::Default)}; + TVector<TNodePtr> repackArgs = {BuildAtom(memberPos, "row", NYql::TNodeFlags::Default)}; if (auto literal = Args[1]->GetLiteral("String")) { TString targetType; if (!GetDataTypeStringNode(ctx, *this, 1, &targetType)) { @@ -1535,7 +1535,7 @@ public: repackArgs.push_back(Args[1]); } - TVector<TNodePtr> column; + TVector<TNodePtr> column; auto namePtr = Args[0]->GetColumnName(); if (!namePtr || !*namePtr) { ctx.Error(Pos) << GetCallExplain() << " expects column name as first argument"; @@ -1575,7 +1575,7 @@ public: template <bool Join> class TTableRow final : public INode { public: - TTableRow(TPosition pos, const TVector<TNodePtr>& args) + TTableRow(TPosition pos, const TVector<TNodePtr>& args) : TTableRow(pos, args.size()) {} @@ -1889,13 +1889,13 @@ private: }; -TNodePtr BuildUdfUserTypeArg(TPosition pos, const TVector<TNodePtr>& args, TNodePtr customUserType) { - TVector<TNodePtr> argsTypeItems; +TNodePtr BuildUdfUserTypeArg(TPosition pos, const TVector<TNodePtr>& args, TNodePtr customUserType) { + TVector<TNodePtr> argsTypeItems; for (auto& arg : args) { - argsTypeItems.push_back(new TCallNodeImpl(pos, "TypeOf", TVector<TNodePtr>(1, arg))); + argsTypeItems.push_back(new TCallNodeImpl(pos, "TypeOf", TVector<TNodePtr>(1, arg))); } - TVector<TNodePtr> userTypeItems; + TVector<TNodePtr> userTypeItems; userTypeItems.push_back(new TCallNodeImpl(pos, "TupleType", argsTypeItems)); userTypeItems.push_back(new TCallNodeImpl(pos, "StructType", {})); if (customUserType) { @@ -1908,7 +1908,7 @@ TNodePtr BuildUdfUserTypeArg(TPosition pos, const TVector<TNodePtr>& args, TNode } TNodePtr BuildUdfUserTypeArg(TPosition pos, TNodePtr positionalArgs, TNodePtr namedArgs, TNodePtr customUserType) { - TVector<TNodePtr> userTypeItems; + TVector<TNodePtr> userTypeItems; userTypeItems.reserve(3); userTypeItems.push_back(positionalArgs->Y("TypeOf", positionalArgs)); userTypeItems.push_back(positionalArgs->Y("TypeOf", namedArgs)); @@ -1921,12 +1921,12 @@ TNodePtr BuildUdfUserTypeArg(TPosition pos, TNodePtr positionalArgs, TNodePtr na return new TCallNodeImpl(pos, "TupleType", userTypeItems); } -TVector<TNodePtr> BuildUdfArgs(const TContext& ctx, TPosition pos, const TVector<TNodePtr>& args, +TVector<TNodePtr> BuildUdfArgs(const TContext& ctx, TPosition pos, const TVector<TNodePtr>& args, TNodePtr positionalArgs, TNodePtr namedArgs, TNodePtr customUserType, TMaybe<TString> typeConfig) { if (!ctx.Settings.EnableGenericUdfs) { return {}; } - TVector<TNodePtr> udfArgs; + TVector<TNodePtr> udfArgs; udfArgs.push_back(new TAstListNodeImpl(pos)); udfArgs[0]->Add(new TAstAtomNodeImpl(pos, "Void", 0)); if (namedArgs) { @@ -2086,9 +2086,9 @@ public: Node->VisitTree(func, visited); } private: - TCiString Module; - TString Name; - TVector<TNodePtr> Args; + TCiString Module; + TString Name; + TVector<TNodePtr> Args; TNodePtr Node; const bool ForReduce; }; @@ -2097,7 +2097,7 @@ TNodePtr BuildCallable(TPosition pos, const TString& module, const TString& name return new TCallableNode(pos, module, name, args, forReduce); } -TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args) { +TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args) { if (to_lower(module) == "@yql") { return BuildCallable(pos, module, name, args); } @@ -2114,7 +2114,7 @@ TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TSt class TScriptUdf final: public INode { public: - TScriptUdf(TPosition pos, const TString& moduleName, const TString& funcName, const TVector<TNodePtr>& args) + TScriptUdf(TPosition pos, const TString& moduleName, const TString& funcName, const TVector<TNodePtr>& args) : INode(pos) , ModuleName(moduleName) , FuncName(funcName) @@ -2185,16 +2185,16 @@ public: Node->VisitTree(func, visited); } private: - TString ModuleName; - TString FuncName; - TVector<TNodePtr> Args; + TString ModuleName; + TString FuncName; + TVector<TNodePtr> Args; TNodePtr Node; }; template <bool Sorted> class TYqlToDict final: public TCallNode { public: - TYqlToDict(TPosition pos, const TString& mode, const TVector<TNodePtr>& args) + TYqlToDict(TPosition pos, const TString& mode, const TVector<TNodePtr>& args) : TCallNode(pos, "ToDict", 4, 4, args) , Mode(mode) {} @@ -2215,7 +2215,7 @@ private: return TCallNode::DoInit(ctx, src); } private: - TString Mode; + TString Mode; }; template <bool IsStart> @@ -2261,7 +2261,7 @@ private: class TInvalidBuiltin final: public INode { public: - TInvalidBuiltin(TPosition pos, const TString& info) + TInvalidBuiltin(TPosition pos, const TString& info) : INode(pos) , Info(info) { @@ -2280,7 +2280,7 @@ public: return {}; } private: - TString Info; + TString Info; }; enum EAggrFuncTypeCallback { @@ -2307,19 +2307,19 @@ struct TCoreFuncInfo { }; using TAggrFuncFactoryCallback = std::function<INode::TPtr(TPosition pos, const TVector<TNodePtr>& args, EAggregateMode aggMode, bool isFactory)>; -using TAggrFuncFactoryCallbackMap = std::unordered_map<TString, TAggrFuncFactoryCallback, THash<TString>>; -using TBuiltinFactoryCallback = std::function<TNodePtr(TPosition pos, const TVector<TNodePtr>& args)>; -using TBuiltinFactoryCallbackMap = std::unordered_map<TString, TBuiltinFactoryCallback, THash<TString>>; +using TAggrFuncFactoryCallbackMap = std::unordered_map<TString, TAggrFuncFactoryCallback, THash<TString>>; +using TBuiltinFactoryCallback = std::function<TNodePtr(TPosition pos, const TVector<TNodePtr>& args)>; +using TBuiltinFactoryCallbackMap = std::unordered_map<TString, TBuiltinFactoryCallback, THash<TString>>; using TCoreFuncMap = std::unordered_map<TString, TCoreFuncInfo, THash<TString>>; TAggrFuncFactoryCallback BuildAggrFuncFactoryCallback( - const TString& functionName, - const TString& factoryName, + const TString& functionName, + const TString& factoryName, EAggrFuncTypeCallback type = NORMAL, const TString& functionNameOverride = TString(), const TVector<EAggregateMode>& validModes = {}) { - const TString realFunctionName = functionNameOverride.empty() ? functionName : functionNameOverride; + const TString realFunctionName = functionNameOverride.empty() ? functionName : functionNameOverride; return [functionName, realFunctionName, factoryName, type, validModes] (TPosition pos, const TVector<TNodePtr>& args, EAggregateMode aggMode, bool isFactory) -> INode::TPtr { if (!validModes.empty()) { if (!IsIn(validModes, aggMode)) { @@ -2400,54 +2400,54 @@ TAggrFuncFactoryCallback BuildAggrFuncFactoryCallback( template<typename TType> TBuiltinFactoryCallback BuildSimpleBuiltinFactoryCallback() { - return [] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { + return [] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, args); }; } template<typename TType> -TBuiltinFactoryCallback BuildNamedBuiltinFactoryCallback(const TString& name) { - return [name] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { +TBuiltinFactoryCallback BuildNamedBuiltinFactoryCallback(const TString& name) { + return [name] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, name, args); }; } template<typename TType> TBuiltinFactoryCallback BuildArgcBuiltinFactoryCallback(i32 minArgs, i32 maxArgs) { - return [minArgs, maxArgs] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { + return [minArgs, maxArgs] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, minArgs, maxArgs, args); }; } template<typename TType> -TBuiltinFactoryCallback BuildNamedArgcBuiltinFactoryCallback(const TString& name, i32 minArgs, i32 maxArgs) { - return [name, minArgs, maxArgs] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { +TBuiltinFactoryCallback BuildNamedArgcBuiltinFactoryCallback(const TString& name, i32 minArgs, i32 maxArgs) { + return [name, minArgs, maxArgs] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, name, minArgs, maxArgs, args); }; } template<typename TType> -TBuiltinFactoryCallback BuildNamedDepsArgcBuiltinFactoryCallback(ui32 reqArgsCount, const TString& name, i32 minArgs, i32 maxArgs) { - return [reqArgsCount, name, minArgs, maxArgs](TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { +TBuiltinFactoryCallback BuildNamedDepsArgcBuiltinFactoryCallback(ui32 reqArgsCount, const TString& name, i32 minArgs, i32 maxArgs) { + return [reqArgsCount, name, minArgs, maxArgs](TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(reqArgsCount, pos, name, minArgs, maxArgs, args); }; } template<typename TType> TBuiltinFactoryCallback BuildBoolBuiltinFactoryCallback(bool arg) { - return [arg] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { + return [arg] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, args, arg); }; } template<typename TType> -TBuiltinFactoryCallback BuildFoldBuiltinFactoryCallback(const TString& name, const TString& defaultValue) { - return [name, defaultValue] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { +TBuiltinFactoryCallback BuildFoldBuiltinFactoryCallback(const TString& name, const TString& defaultValue) { + return [name, defaultValue] (TPosition pos, const TVector<TNodePtr>& args) -> TNodePtr { return new TType(pos, name, "Bool", defaultValue, 1, args); }; } -TNodePtr MakePair(TPosition pos, const TVector<TNodePtr>& args) { +TNodePtr MakePair(TPosition pos, const TVector<TNodePtr>& args) { TNodePtr list = new TAstListNodeImpl(pos, { args[0], args.size() > 1 ? args[1] : new TAstListNodeImpl(pos,{ new TAstAtomNodeImpl(pos, "Null", TNodeFlags::Default) }) @@ -2884,7 +2884,7 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec } } - TString normalizedName(name); + TString normalizedName(name); TString nameSpace(originalNameSpace); TString ns = to_lower(nameSpace); if (ns.empty()) { @@ -2956,7 +2956,7 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec } } else if (moduleResource) { auto exportName = ns == "core" ? name : "$" + name; - TVector<TNodePtr> applyArgs = { + TVector<TNodePtr> applyArgs = { new TCallNodeImpl(pos, "bind", { BuildAtom(pos, ns + "_module", 0), BuildQuotedAtom(pos, exportName) }) @@ -2964,7 +2964,7 @@ TNodePtr BuildBuiltinFunc(TContext& ctx, TPosition pos, TString name, const TVec applyArgs.insert(applyArgs.end(), args.begin(), args.end()); return new TCallNodeImpl(pos, "Apply", applyArgs); } else if (ns == "hyperscan" || ns == "pcre" || ns == "pire" || ns.StartsWith("re2")) { - TString moduleName(nameSpace); + TString moduleName(nameSpace); moduleName.to_title(); if ((args.size() == 1 || args.size() == 2) && (name.StartsWith("Multi") || (ns.StartsWith("re2") && name == "Capture"))) { TVector<TNodePtr> multiArgs{ diff --git a/ydb/library/yql/sql/v1/context.cpp b/ydb/library/yql/sql/v1/context.cpp index c08fe96caeb..944e694d2c2 100644 --- a/ydb/library/yql/sql/v1/context.cpp +++ b/ydb/library/yql/sql/v1/context.cpp @@ -123,7 +123,7 @@ const NYql::TPosition& TContext::Pos() const { return Position; } -TString TContext::MakeName(const TString& name) { +TString TContext::MakeName(const TString& name) { auto iter = GenIndexes.find(name); if (iter == GenIndexes.end()) { iter = GenIndexes.emplace(name, 0).first; @@ -198,7 +198,7 @@ IOutputStream& TContext::MakeIssue(ESeverity severity, TIssueCode code, NYql::TP return *IssueMsgHolder; } -bool TContext::SetPathPrefix(const TString& value, TMaybe<TString> arg) { +bool TContext::SetPathPrefix(const TString& value, TMaybe<TString> arg) { if (arg.Defined()) { if (*arg == YtProviderName || *arg == KikimrProviderName @@ -240,7 +240,7 @@ TNodePtr TContext::GetPrefixedPath(const TString& service, const TDeferredAtom& } } -TNodePtr TContext::UniversalAlias(const TString& baseName, TNodePtr&& node) { +TNodePtr TContext::UniversalAlias(const TString& baseName, TNodePtr&& node) { auto alias = MakeName(baseName); UniversalAliases.emplace(alias, node); return BuildAtom(node->GetPos(), alias, TNodeFlags::Default); @@ -267,7 +267,7 @@ bool TContext::AddExport(TPosition pos, const TString& name) { return true; } -TString TContext::AddImport(const TVector<TString>& modulePath) { +TString TContext::AddImport(const TVector<TString>& modulePath) { YQL_ENSURE(!modulePath.empty()); const TString path = JoinRange("/", modulePath.cbegin(), modulePath.cend()); auto iter = ImportModuleAliases.find(path); @@ -470,7 +470,7 @@ IOutputStream& TTranslation::Error() { return Ctx.Error(); } -TNodePtr TTranslation::GetNamedNode(const TString& name) { +TNodePtr TTranslation::GetNamedNode(const TString& name) { if (name == "$_") { Ctx.Error() << "Unable to reference anonymous name " << name; return nullptr; @@ -512,7 +512,7 @@ TString TTranslation::PushNamedAtom(TPosition namePos, const TString& name) { return PushNamedNode(namePos, name, buildAtom); } -void TTranslation::PopNamedNode(const TString& name) { +void TTranslation::PopNamedNode(const TString& name) { auto mapIt = Ctx.Scoped->NamedNodes.find(name); Y_VERIFY_DEBUG(mapIt != Ctx.Scoped->NamedNodes.end()); Y_VERIFY_DEBUG(mapIt->second.size() > 0); @@ -543,16 +543,16 @@ void TTranslation::WarnUnusedNodes() const { } } -TString GetDescription(const google::protobuf::Message& node, const google::protobuf::FieldDescriptor* d) { +TString GetDescription(const google::protobuf::Message& node, const google::protobuf::FieldDescriptor* d) { const auto& field = node.GetReflection()->GetMessage(node, d); return field.GetReflection()->GetString(field, d->message_type()->FindFieldByName("Descr")); } -TString TTranslation::AltDescription(const google::protobuf::Message& node, ui32 altCase, const google::protobuf::Descriptor* descr) const { +TString TTranslation::AltDescription(const google::protobuf::Message& node, ui32 altCase, const google::protobuf::Descriptor* descr) const { return GetDescription(node, descr->FindFieldByNumber(altCase)); } -void TTranslation::AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr) { +void TTranslation::AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr) { Error() << ruleName << ": alternative is not implemented yet: " << AltDescription(node, altCase, descr); } diff --git a/ydb/library/yql/sql/v1/context.h b/ydb/library/yql/sql/v1/context.h index 89517574862..e07ebb8ba79 100644 --- a/ydb/library/yql/sql/v1/context.h +++ b/ydb/library/yql/sql/v1/context.h @@ -86,7 +86,7 @@ namespace NSQLTranslationV1 { const NYql::TPosition& Pos() const; void ClearBlockScope(); - TString MakeName(const TString& name); + TString MakeName(const TString& name); IOutputStream& Error(NYql::TIssueCode code = NYql::TIssuesIds::DEFAULT_ERROR); IOutputStream& Error(NYql::TPosition pos, NYql::TIssueCode code = NYql::TIssuesIds::DEFAULT_ERROR); @@ -96,7 +96,7 @@ namespace NSQLTranslationV1 { void SetWarningPolicyFor(NYql::TIssueCode code, NYql::EWarningAction action); template <typename TToken> - const TString& Token(const TToken& token) { + const TString& Token(const TToken& token) { Position.Row = token.GetLine(); Position.Column = token.GetColumn() + 1; return token.GetValue(); @@ -110,7 +110,7 @@ namespace NSQLTranslationV1 { return pos; } - inline void IncrementMonCounter(const TString& name, const TString& value) { + inline void IncrementMonCounter(const TString& name, const TString& value) { if (IncrementMonCounterFunction) { IncrementMonCounterFunction(name, value); } @@ -120,7 +120,7 @@ namespace NSQLTranslationV1 { return GetClusterProvider(cluster).Defined(); } - TMaybe<TString> GetClusterProvider(const TString& cluster) const { + TMaybe<TString> GetClusterProvider(const TString& cluster) const { TString unusedNormalizedClusterName; return GetClusterProvider(cluster, unusedNormalizedClusterName); } @@ -142,11 +142,11 @@ namespace NSQLTranslationV1 { bool UseUnordered(const ISource& source) const; bool UseUnordered(const TTableRef& table) const; - bool SetPathPrefix(const TString& value, TMaybe<TString> arg = TMaybe<TString>()); + bool SetPathPrefix(const TString& value, TMaybe<TString> arg = TMaybe<TString>()); TNodePtr GetPrefixedPath(const TString& service, const TDeferredAtom& cluster, const TDeferredAtom& path); - TNodePtr UniversalAlias(const TString& baseName, TNodePtr&& node); + TNodePtr UniversalAlias(const TString& baseName, TNodePtr&& node); void BodyPart() { IntoHeading = false; @@ -159,7 +159,7 @@ namespace NSQLTranslationV1 { void DeclareVariable(const TString& varName, const TNodePtr& typeNode); bool AddExport(TPosition symbolPos, const TString& symbolName); - TString AddImport(const TVector<TString>& modulePath); + TString AddImport(const TVector<TString>& modulePath); TString AddSimpleUdf(const TString& udf); void SetPackageVersion(const TString& packageName, ui32 version); @@ -189,7 +189,7 @@ namespace NSQLTranslationV1 { NYql::TPosition Position; THolder<TStringOutput> IssueMsgHolder; NSQLTranslation::TClusterMapping ClusterMapping; - TString PathPrefix; + TString PathPrefix; THashMap<TString, TString> ProviderPathPrefixes; THashMap<TString, TString> ClusterPathPrefixes; bool IntoHeading = true; @@ -201,21 +201,21 @@ namespace NSQLTranslationV1 { TString NoColumnErrorContext = "in current scope"; public: - THashMap<TString, TNodePtr> Variables; + THashMap<TString, TNodePtr> Variables; NSQLTranslation::TTranslationSettings Settings; std::unique_ptr<TMemoryPool> Pool; NYql::TIssues& Issues; - TMap<TString, TNodePtr> UniversalAliases; - THashSet<TString> Exports; - THashMap<TString, TString> ImportModuleAliases; - TMap<TString, TString> SimpleUdfs; + TMap<TString, TNodePtr> UniversalAliases; + THashSet<TString> Exports; + THashMap<TString, TString> ImportModuleAliases; + TMap<TString, TString> SimpleUdfs; NSQLTranslation::TIncrementMonCounterFunction IncrementMonCounterFunction; TScopedStatePtr Scoped; int ScopeLevel = 0; size_t AnonymousNameIndex = 0; TDeque<TScopedStatePtr> AllScopes; bool HasPendingErrors; - THashMap<TString, ui32> GenIndexes; + THashMap<TString, ui32> GenIndexes; using TWinSpecsRef = std::reference_wrapper<TWinSpecs>; TDeque<TWinSpecsRef> WinSpecsScopes; bool PragmaRefSelect = false; @@ -295,7 +295,7 @@ namespace NSQLTranslationV1 { class TTranslation { protected: - typedef TSet<ui32> TSetType; + typedef TSet<ui32> TSetType; protected: TTranslation(TContext& ctx); @@ -305,41 +305,41 @@ namespace NSQLTranslationV1 { IOutputStream& Error(); template <typename TToken> - const TString& Token(const TToken& token) { + const TString& Token(const TToken& token) { return Ctx.Token(token); } template <typename TToken> - TString Identifier(const TToken& token) { + TString Identifier(const TToken& token) { return IdContent(Ctx, Token(token)); } - TString Identifier(const TString& str) const { + TString Identifier(const TString& str) const { return IdContent(Ctx, str); } - TNodePtr GetNamedNode(const TString& name); + TNodePtr GetNamedNode(const TString& name); using TNodeBuilderByName = std::function<TNodePtr(const TString& effectiveName)>; TString PushNamedNode(TPosition namePos, const TString& name, const TNodeBuilderByName& builder); TString PushNamedNode(TPosition namePos, const TString& name, TNodePtr node); TString PushNamedAtom(TPosition namePos, const TString& name); - void PopNamedNode(const TString& name); + void PopNamedNode(const TString& name); void WarnUnusedNodes() const; template <typename TNode> - void AltNotImplemented(const TString& ruleName, const TNode& node) { + void AltNotImplemented(const TString& ruleName, const TNode& node) { AltNotImplemented(ruleName, node.Alt_case(), node, TNode::descriptor()); } template <typename TNode> - TString AltDescription(const TNode& node) const { + TString AltDescription(const TNode& node) const { return AltDescription(node, node.Alt_case(), TNode::descriptor()); } protected: - void AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr); - TString AltDescription(const google::protobuf::Message& node, ui32 altCase, const google::protobuf::Descriptor* descr) const; + void AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr); + TString AltDescription(const google::protobuf::Message& node, ui32 altCase, const google::protobuf::Descriptor* descr) const; protected: TContext& Ctx; diff --git a/ydb/library/yql/sql/v1/insert.cpp b/ydb/library/yql/sql/v1/insert.cpp index 4f4c8630181..29c5211a9fa 100644 --- a/ydb/library/yql/sql/v1/insert.cpp +++ b/ydb/library/yql/sql/v1/insert.cpp @@ -7,7 +7,7 @@ using namespace NYql; namespace NSQLTranslationV1 { -static const TMap<ESQLWriteColumnMode, EWriteColumnMode> sqlIntoMode2WriteColumn = { +static const TMap<ESQLWriteColumnMode, EWriteColumnMode> sqlIntoMode2WriteColumn = { {ESQLWriteColumnMode::InsertInto, EWriteColumnMode::Insert}, {ESQLWriteColumnMode::InsertOrAbortInto, EWriteColumnMode::InsertOrAbort}, {ESQLWriteColumnMode::InsertOrIgnoreInto, EWriteColumnMode::InsertOrIgnore}, @@ -21,7 +21,7 @@ static const TMap<ESQLWriteColumnMode, EWriteColumnMode> sqlIntoMode2WriteColumn class TModifySourceBase: public ISource { public: - TModifySourceBase(TPosition pos, const TVector<TString>& columnsHint) + TModifySourceBase(TPosition pos, const TVector<TString>& columnsHint) : ISource(pos) , ColumnsHint(columnsHint) { @@ -33,7 +33,7 @@ public: return false; } - bool AddGroupKey(TContext& ctx, const TString& column) override { + bool AddGroupKey(TContext& ctx, const TString& column) override { Y_UNUSED(column); ctx.Error(Pos) << "Source does not allow grouping"; return false; @@ -51,19 +51,19 @@ public: return nullptr; } - TNodePtr BuildAggregation(const TString& label) override { + TNodePtr BuildAggregation(const TString& label) override { Y_UNUSED(label); return nullptr; } protected: - TVector<TString> ColumnsHint; - TString OperationHumanName; + TVector<TString> ColumnsHint; + TString OperationHumanName; }; class TUpdateByValues: public TModifySourceBase { public: - TUpdateByValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) + TUpdateByValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) : TModifySourceBase(pos, columnsHint) , OperationHumanName(operationHumanName) , Values(values) @@ -88,7 +88,7 @@ public: auto structObj = Y("AsStruct"); for (size_t i = 0; i < Values.size(); ++i) { - TString column = ColumnsHint[i]; + TString column = ColumnsHint[i]; TNodePtr value = Values[i]; structObj = L(structObj, Q(Y(Q(column), value))); @@ -102,15 +102,15 @@ public: return new TUpdateByValues(Pos, OperationHumanName, ColumnsHint, CloneContainer(Values)); } private: - TString OperationHumanName; + TString OperationHumanName; protected: - TVector<TNodePtr> Values; + TVector<TNodePtr> Values; }; class TModifyByValues: public TModifySourceBase { public: - TModifyByValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values) + TModifyByValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values) : TModifySourceBase(pos, columnsHint) , OperationHumanName(operationHumanName) , Values(values) @@ -158,7 +158,7 @@ public: } TNodePtr DoClone() const final { - TVector<TVector<TNodePtr>> clonedValues; + TVector<TVector<TNodePtr>> clonedValues; clonedValues.reserve(Values.size()); for (auto cur: Values) { clonedValues.push_back(CloneContainer(cur)); @@ -167,14 +167,14 @@ public: } private: - TString OperationHumanName; - TVector<TVector<TNodePtr>> Values; + TString OperationHumanName; + TVector<TVector<TNodePtr>> Values; TSourcePtr FakeSource; }; class TModifyBySource: public TModifySourceBase { public: - TModifyBySource(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, TSourcePtr source) + TModifyBySource(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, TSourcePtr source) : TModifySourceBase(pos, columnsHint) , OperationHumanName(operationHumanName) , Source(std::move(source)) @@ -245,19 +245,19 @@ public: } private: - TString OperationHumanName; + TString OperationHumanName; TSourcePtr Source; }; -TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values) { +TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values) { return new TModifyByValues(pos, operationHumanName, columnsHint, values); } -TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, TSourcePtr source) { +TSourcePtr BuildWriteValues(TPosition pos, const TString& operationHumanName, const TVector<TString>& columnsHint, TSourcePtr source) { return new TModifyBySource(pos, operationHumanName, columnsHint, std::move(source)); } -TSourcePtr BuildUpdateValues(TPosition pos, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) { +TSourcePtr BuildUpdateValues(TPosition pos, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values) { return new TUpdateByValues(pos, "UPDATE", columnsHint, values); } diff --git a/ydb/library/yql/sql/v1/join.cpp b/ydb/library/yql/sql/v1/join.cpp index 29f5b3ec4b8..d078e7cc5ee 100644 --- a/ydb/library/yql/sql/v1/join.cpp +++ b/ydb/library/yql/sql/v1/join.cpp @@ -13,8 +13,8 @@ using namespace NYql; namespace NSQLTranslationV1 { -TString NormalizeJoinOp(const TString& joinOp) { - TVector<TString> joinOpsParts; +TString NormalizeJoinOp(const TString& joinOp) { + TVector<TString> joinOpsParts; Split(joinOp, " ", joinOpsParts); for (auto&x : joinOpsParts) { x.to_title(); @@ -24,7 +24,7 @@ TString NormalizeJoinOp(const TString& joinOp) { } struct TJoinDescr { - TString Op; + TString Op; TJoinLinkSettings LinkSettings; struct TFullColumn { @@ -32,7 +32,7 @@ struct TJoinDescr { TNodePtr Column; }; - TVector<std::pair<TFullColumn, TFullColumn>> Keys; + TVector<std::pair<TFullColumn, TFullColumn>> Keys; explicit TJoinDescr(const TString& op) : Op(op) @@ -104,7 +104,7 @@ public: unsigned acceptedColumns = 0; TIntrusivePtr<TColumnNode> tryColumn = static_cast<TColumnNode*>(column.Clone().Get()); tryColumn->SetAsNotReliable(); - TString lastAcceptedColumnSource; + TString lastAcceptedColumnSource; for (auto& source: Sources) { if (source->AddColumn(ctx, *tryColumn)) { ++acceptedColumns; @@ -144,12 +144,12 @@ public: TNodePtr BuildJoinKeys(TContext& ctx, const TVector<TDeferredAtom>& names) override { const size_t n = JoinOps.size(); - TString what(Sources[n]->GetLabel()); - static const TSet<TString> noRightSourceJoinOps = {"LeftOnly", "LeftSemi"}; + TString what(Sources[n]->GetLabel()); + static const TSet<TString> noRightSourceJoinOps = {"LeftOnly", "LeftSemi"}; for (size_t nn = n; nn > 0 && noRightSourceJoinOps.contains(JoinOps[nn-1]); --nn) { what = Sources[nn-1]->GetLabel(); } - const TString with(Sources[n + 1]->GetLabel()); + const TString with(Sources[n + 1]->GetLabel()); for (auto index = n; index <= n + 1; ++index) { const auto& label = Sources[index]->GetLabel(); @@ -201,18 +201,18 @@ public: } protected: - static TString FullColumnName(const TColumnNode& column) { + static TString FullColumnName(const TColumnNode& column) { auto sourceName = *column.GetSourceName(); auto columnName = *column.GetColumnName(); return sourceName ? DotJoin(sourceName, columnName) : columnName; } bool InitKeysOrFilters(TContext& ctx, ui32 joinIdx, TNodePtr expr) { - const TString joinOp(JoinOps[joinIdx]); + const TString joinOp(JoinOps[joinIdx]); const TJoinLinkSettings linkSettings(JoinLinkSettings[joinIdx]); const TCallNode* op = nullptr; if (expr) { - const TString opName(expr->GetOpName()); + const TString opName(expr->GetOpName()); if (opName != "==") { ctx.Error(expr->GetPos()) << "JOIN ON expression must be a conjunction of equality predicates"; return false; @@ -224,7 +224,7 @@ protected: } ui32 idx = 0; - THashMap<TString, ui32> sources; + THashMap<TString, ui32> sources; for (auto& source: Sources) { auto label = source->GetLabel(); if (!label) { @@ -244,10 +244,10 @@ protected: ui32 rightArg = 0; ui32 leftSourceIdx = 0; ui32 rightSourceIdx = 0; - const TString* leftSource = nullptr; - const TString* rightSource = nullptr; + const TString* leftSource = nullptr; + const TString* rightSource = nullptr; const TString* sameColumnNamePtr = nullptr; - TSet<TString> joinedSources; + TSet<TString> joinedSources; if (op) { const TString* columnNamePtr = nullptr; for (auto& arg : op->GetArgs()) { @@ -356,11 +356,11 @@ protected: } protected: - TVector<TString> JoinOps; - TVector<TNodePtr> JoinExprs; + TVector<TString> JoinOps; + TVector<TNodePtr> JoinExprs; TVector<TJoinLinkSettings> JoinLinkSettings; - TVector<TJoinDescr> JoinDescrs; - THashMap<TString, THashSet<TString>> SameKeyMap; + TVector<TJoinDescr> JoinDescrs; + THashMap<TString, THashSet<TString>> SameKeyMap; const TVector<TSourcePtr> Sources; const TVector<bool> AnyFlags; TColumns JoinedColumns; @@ -424,7 +424,7 @@ bool TJoinBase::DoInit(TContext& ctx, ISource* initSrc) { YQL_ENSURE(JoinOps.size() == JoinExprs.size(), "Invalid join exprs number"); YQL_ENSURE(JoinOps.size() == JoinLinkSettings.size()); - const TSet<TString> allowedJoinOps = {"Inner", "Left", "Right", "Full", "LeftOnly", "RightOnly", "Exclusion", "LeftSemi", "RightSemi", "Cross"}; + const TSet<TString> allowedJoinOps = {"Inner", "Left", "Right", "Full", "LeftOnly", "RightOnly", "Exclusion", "LeftSemi", "RightSemi", "Cross"}; for (auto& opName: JoinOps) { if (!allowedJoinOps.contains(opName)) { ctx.Error(Pos) << "Invalid join op: " << opName; @@ -435,7 +435,7 @@ bool TJoinBase::DoInit(TContext& ctx, ISource* initSrc) { ui32 idx = 0; for (auto expr: JoinExprs) { if (expr) { - TDeque<TNodePtr> conjQueue; + TDeque<TNodePtr> conjQueue; conjQueue.push_back(expr); while (!conjQueue.empty()) { TNodePtr cur = conjQueue.front(); @@ -456,7 +456,7 @@ bool TJoinBase::DoInit(TContext& ctx, ISource* initSrc) { ++idx; } - TSet<ui32> joinedSources; + TSet<ui32> joinedSources; for (auto& descr: JoinDescrs) { for (auto& key : descr.Keys) { joinedSources.insert(key.first.Source); @@ -482,7 +482,7 @@ public: } TNodePtr Build(TContext& ctx) override { - TMap<std::pair<TString, TString>, TNodePtr> extraColumns; + TMap<std::pair<TString, TString>, TNodePtr> extraColumns; TNodePtr joinTree; for (auto& descr: JoinDescrs) { auto leftBranch = joinTree; @@ -593,7 +593,7 @@ public: return equiJoin; } - const THashMap<TString, THashSet<TString>>& GetSameKeysMap() const override { + const THashMap<TString, THashSet<TString>>& GetSameKeysMap() const override { return SameKeyMap; } @@ -608,7 +608,7 @@ public: } TPtr DoClone() const final { - TVector<TSourcePtr> clonedSources; + TVector<TSourcePtr> clonedSources; for (auto& cur: Sources) { clonedSources.push_back(cur->CloneSource()); } @@ -622,15 +622,15 @@ public: private: TNodePtr GetColumnNames( TContext& ctx, - TMap<std::pair<TString, TString>, TNodePtr>& extraColumns, - const TVector<std::pair<TJoinDescr::TFullColumn, TJoinDescr::TFullColumn>>& keys, + TMap<std::pair<TString, TString>, TNodePtr>& extraColumns, + const TVector<std::pair<TJoinDescr::TFullColumn, TJoinDescr::TFullColumn>>& keys, bool left ) { Y_UNUSED(ctx); auto res = Y(); for (auto& it: keys) { auto tableName = Sources[left ? it.first.Source : it.second.Source]->GetLabel(); - TString columnName; + TString columnName; auto column = left ? it.first.Column : it.second.Column; if (!column) { continue; diff --git a/ydb/library/yql/sql/v1/list_builtin.h b/ydb/library/yql/sql/v1/list_builtin.h index a8077b464a2..d38e1352c3e 100644 --- a/ydb/library/yql/sql/v1/list_builtin.h +++ b/ydb/library/yql/sql/v1/list_builtin.h @@ -17,8 +17,8 @@ namespace NSQLTranslationV1 { class TListBuiltin: public TCallNode { public: TListBuiltin(TPosition pos, - const TString& opName, - const TVector<TNodePtr>& args) + const TString& opName, + const TVector<TNodePtr>& args) : TCallNode(pos, opName, args.size(), args.size(), args) , OpName(opName) , Args(args) @@ -29,8 +29,8 @@ public: TAstNode* Translate(TContext& ctx) const override; protected: - const TString OpName; - TVector<TNodePtr> Args; + const TString OpName; + TVector<TNodePtr> Args; TNodePtr Node; inline TNodePtr GetIdentityLambda(); @@ -38,7 +38,7 @@ protected: class TListSortBuiltin final: public TListBuiltin { public: - TListSortBuiltin(TPosition pos, const TVector<TNodePtr>& args, bool asc) + TListSortBuiltin(TPosition pos, const TVector<TNodePtr>& args, bool asc) : TListBuiltin(pos, "ListSort", args) , Asc(asc) {} @@ -55,7 +55,7 @@ private: class TListExtractBuiltin final: public TListBuiltin { public: - TListExtractBuiltin(TPosition pos, const TVector<TNodePtr>& args) + TListExtractBuiltin(TPosition pos, const TVector<TNodePtr>& args) : TListBuiltin(pos, "ListExtract", args) {} @@ -69,8 +69,8 @@ public: class TListProcessBuiltin: public TListBuiltin { protected: TListProcessBuiltin(TPosition pos, - const TString& opName, - const TVector<TNodePtr>& args) + const TString& opName, + const TVector<TNodePtr>& args) : TListBuiltin(pos, opName, args) {} @@ -80,7 +80,7 @@ protected: class TListMapBuiltin final: public TListProcessBuiltin { public: TListMapBuiltin(TPosition pos, - const TVector<TNodePtr>& args, + const TVector<TNodePtr>& args, bool flat) : TListProcessBuiltin(pos, flat ? "ListFlatMap" : "ListMap", args) , Flat(flat) @@ -98,7 +98,7 @@ private: class TListFilterBuiltin final: public TListProcessBuiltin { public: TListFilterBuiltin(TPosition pos, const TString& opName, - const TVector<TNodePtr>& args) + const TVector<TNodePtr>& args) : TListProcessBuiltin(pos, opName, args) {} @@ -115,7 +115,7 @@ protected: class TListUniqBuiltin final: public TListBuiltin { public: TListUniqBuiltin(TPosition pos, - const TVector<TNodePtr>& args) + const TVector<TNodePtr>& args) : TListBuiltin(pos, "ListUniq", args) {} @@ -129,7 +129,7 @@ public: class TListCreateBuiltin final: public TListBuiltin { public: TListCreateBuiltin(TPosition pos, - const TVector<TNodePtr>& args) + const TVector<TNodePtr>& args) : TListBuiltin(pos, "ListCreate", args) {} diff --git a/ydb/library/yql/sql/v1/node.cpp b/ydb/library/yql/sql/v1/node.cpp index 870bbd9cc7f..e6ac937663c 100644 --- a/ydb/library/yql/sql/v1/node.cpp +++ b/ydb/library/yql/sql/v1/node.cpp @@ -36,12 +36,12 @@ TTableRef::TTableRef(const TString& refName, const TString& service, const TDefe { } -TString TTableRef::ShortName() const { +TString TTableRef::ShortName() const { Y_VERIFY_DEBUG(Keys); if (Keys->GetTableKeys()->GetTableName()) { return *Keys->GetTableKeys()->GetTableName(); } - return TString(); + return TString(); } TColumnSchema::TColumnSchema(TPosition pos, const TString& name, const TNodePtr& type, bool nullable, @@ -67,7 +67,7 @@ TPosition INode::GetPos() const { return Pos; } -const TString& INode::GetLabel() const { +const TString& INode::GetLabel() const { return Label; } @@ -152,23 +152,23 @@ const TString* INode::SubqueryAlias() const { return nullptr; } -TString INode::GetOpName() const { - return TString(); +TString INode::GetOpName() const { + return TString(); } -const TString* INode::GetLiteral(const TString& type) const { +const TString* INode::GetLiteral(const TString& type) const { Y_UNUSED(type); return nullptr; } -const TString* INode::GetColumnName() const { +const TString* INode::GetColumnName() const { return nullptr; } void INode::AssumeColumn() { } -const TString* INode::GetSourceName() const { +const TString* INode::GetSourceName() const { return nullptr; } @@ -197,7 +197,7 @@ ISource* INode::GetSource() { return nullptr; } -TVector<TNodePtr>* INode::ContentListPtr() { +TVector<TNodePtr>* INode::ContentListPtr() { return nullptr; } @@ -230,7 +230,7 @@ TNodePtr INode::AstNode(TNodePtr node) const { return node; } -TNodePtr INode::AstNode(const TString& str) const { +TNodePtr INode::AstNode(const TString& str) const { return new TAstAtomNodeImpl(Pos, str, TNodeFlags::Default); } @@ -423,7 +423,7 @@ TAstNode* TAstListNode::Translate(TContext& ctx) const { return TAstNode::NewList(listPos, children.data(), children.size(), *ctx.Pool); } -void TAstListNode::UpdateStateByListNodes(const TVector<TNodePtr>& nodes) const { +void TAstListNode::UpdateStateByListNodes(const TVector<TNodePtr>& nodes) const { bool isConst = true; struct TAttributesFlags { bool has = false; @@ -471,7 +471,7 @@ TAstListNode::TAstListNode(const TAstListNode& node) State = node.State; } -TAstListNode::TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes) +TAstListNode::TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes) : INode(pos) , Nodes(std::move(nodes)) { @@ -494,7 +494,7 @@ TAstListNodeImpl::TAstListNodeImpl(TPosition pos) : TAstListNode(pos) {} -TAstListNodeImpl::TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes) +TAstListNodeImpl::TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes) : TAstListNode(pos) { for (const auto& node: nodes) { @@ -513,7 +513,7 @@ TNodePtr TAstListNodeImpl::DoClone() const { return new TAstListNodeImpl(Pos, CloneContainer(Nodes)); } -TCallNode::TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TCallNode::TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TAstListNode(pos) , OpName(opName) , MinArgs(minArgs) @@ -525,13 +525,13 @@ TCallNode::TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxA } } -TString TCallNode::GetOpName() const { +TString TCallNode::GetOpName() const { return OpName; } namespace { const TString* DeriveCommonSourceName(const TVector<TNodePtr> &nodes) { - const TString* name = nullptr; + const TString* name = nullptr; for (auto& node: nodes) { auto n = node->GetSourceName(); if (!n) { @@ -551,7 +551,7 @@ const TString* TCallNode::GetSourceName() const { return DeriveCommonSourceName(Args); } -const TVector<TNodePtr>& TCallNode::GetArgs() const { +const TVector<TNodePtr>& TCallNode::GetArgs() const { return Args; } @@ -559,7 +559,7 @@ void TCallNode::DoUpdateState() const { UpdateStateByListNodes(Args); } -TString TCallNode::GetCallExplain() const { +TString TCallNode::GetCallExplain() const { auto derivedName = GetOpName(); TStringBuilder sb; sb << derivedName << "()"; @@ -618,11 +618,11 @@ bool TCallNode::DoInit(TContext& ctx, ISource* src) { return true; } -TCallNodeImpl::TCallNodeImpl(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TCallNodeImpl::TCallNodeImpl(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TCallNode(pos, opName, minArgs, maxArgs, args) {} -TCallNodeImpl::TCallNodeImpl(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) +TCallNodeImpl::TCallNodeImpl(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, args.size(), args.size(), args) {} @@ -642,12 +642,12 @@ const TString* TFuncNodeImpl::FuncName() const { return &OpName; } -TCallNodeDepArgs::TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TCallNodeDepArgs::TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TCallNode(pos, opName, minArgs, maxArgs, args) , ReqArgsCount(reqArgsCount) {} -TCallNodeDepArgs::TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, const TVector<TNodePtr>& args) +TCallNodeDepArgs::TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, args.size(), args.size(), args) , ReqArgsCount(reqArgsCount) {} @@ -671,7 +671,7 @@ TCallDirectRow::TPtr TCallDirectRow::DoClone() const { return new TCallDirectRow(Pos, OpName, CloneContainer(Args)); } -TCallDirectRow::TCallDirectRow(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) +TCallDirectRow::TCallDirectRow(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, 0, 0, args) {} @@ -732,16 +732,16 @@ INode::TPtr TWinAggrEmulation::WindowSpecFunc(const TPtr& type) const { return Q(Y(Q(FuncAlias), result)); } -TWinAggrEmulation::TWinAggrEmulation(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TWinAggrEmulation::TWinAggrEmulation(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TCallNode(pos, opName, minArgs, maxArgs, args) , FuncAlias(opName) {} -TWinRowNumber::TWinRowNumber(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TWinRowNumber::TWinRowNumber(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TWinAggrEmulation(pos, opName, minArgs, maxArgs, args) {} -TWinLeadLag::TWinLeadLag(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) +TWinLeadLag::TWinLeadLag(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args) : TWinAggrEmulation(pos, opName, minArgs, maxArgs, args) {} @@ -846,7 +846,7 @@ bool TWinRank::DoInit(TContext& ctx, ISource* src) { class TQuotedAtomNode: public TAstListNode { public: - TQuotedAtomNode(TPosition pos, const TString& content, ui32 flags) + TQuotedAtomNode(TPosition pos, const TString& content, ui32 flags) : TAstListNode(pos) { Add("quote", BuildAtom(pos, content, flags)); @@ -863,7 +863,7 @@ protected: } }; -TNodePtr BuildQuotedAtom(TPosition pos, const TString& content, ui32 flags) { +TNodePtr BuildQuotedAtom(TPosition pos, const TString& content, ui32 flags) { return new TQuotedAtomNode(pos, content, flags); } @@ -911,14 +911,14 @@ void TColumns::Merge(const TColumns& columns) { } } -void TColumns::SetPrefix(const TString& prefix) { +void TColumns::SetPrefix(const TString& prefix) { Y_VERIFY_DEBUG(!prefix.empty()); - auto addPrefixFunc = [&prefix](const TString& str) { + auto addPrefixFunc = [&prefix](const TString& str) { return prefix + "." + str; }; - TSet<TString> newReal; - TSet<TString> newArtificial; - TVector<TString> newList; + TSet<TString> newReal; + TSet<TString> newArtificial; + TVector<TString> newList; std::transform(Real.begin(), Real.end(), std::inserter(newReal, newReal.begin()), addPrefixFunc); std::transform(Artificial.begin(), Artificial.end(), std::inserter(newArtificial, newArtificial.begin()), addPrefixFunc); std::transform(List.begin(), List.end(), std::back_inserter(newList), addPrefixFunc); @@ -1030,11 +1030,11 @@ bool TColumnNode::IsArtificial() const { return Artificial; } -const TString* TColumnNode::GetColumnName() const { +const TString* TColumnNode::GetColumnName() const { return UseSourceAsColumn ? &Source : (ColumnExpr ? nullptr : &ColumnName); } -const TString* TColumnNode::GetSourceName() const { +const TString* TColumnNode::GetSourceName() const { return UseSourceAsColumn ? &Empty : &Source; } @@ -1138,7 +1138,7 @@ TAstNode* TColumnNode::Translate(TContext& ctx) const { return Node->Translate(ctx); } -void TColumnNode::ResetColumn(const TString& column, const TString& source) { +void TColumnNode::ResetColumn(const TString& column, const TString& source) { YQL_ENSURE(!State.Test(ENodeState::Initialized)); /// should be not initialized Reliable = true; UseSource = false; @@ -1158,9 +1158,9 @@ void TColumnNode::ResetColumn(const TNodePtr& column, const TString& source) { Source = source; } -const TString TColumnNode::Empty; +const TString TColumnNode::Empty; -TNodePtr BuildColumn(TPosition pos, const TString& column, const TString& source) { +TNodePtr BuildColumn(TPosition pos, const TString& column, const TString& source) { bool maybeType = false; return new TColumnNode(pos, column, source, maybeType); } @@ -1184,7 +1184,7 @@ ITableKeys::ITableKeys(TPosition pos) { } -const TString* ITableKeys::GetTableName() const { +const TString* ITableKeys::GetTableName() const { return nullptr; } @@ -1207,7 +1207,7 @@ void IAggregation::DoUpdateState() const { State.Set(ENodeState::OverWindow, AggMode == EAggregateMode::OverWindow); } -const TString* IAggregation::GetGenericKey() const { +const TString* IAggregation::GetGenericKey() const { return nullptr; } @@ -1215,7 +1215,7 @@ void IAggregation::Join(IAggregation*) { Y_VERIFY(false); } -const TString& IAggregation::GetName() const { +const TString& IAggregation::GetName() const { return Name; } @@ -1227,7 +1227,7 @@ void IAggregation::MarkKeyColumnAsGenerated() { IsGeneratedKeyColumn = true; } -IAggregation::IAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) +IAggregation::IAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode) : INode(pos), Name(name), Func(func), AggMode(aggMode) {} @@ -1317,7 +1317,7 @@ bool ISource::AddFilter(TContext& ctx, TNodePtr filter) { return true; } -bool ISource::AddGroupKey(TContext& ctx, const TString& column) { +bool ISource::AddGroupKey(TContext& ctx, const TString& column) { if (!GroupKeys.insert(column).second) { ctx.Error() << "Duplicate grouping column: " << column; return false; @@ -1330,7 +1330,7 @@ void ISource::SetCompactGroupBy(bool compactGroupBy) { CompactGroupBy = compactGroupBy; } -bool ISource::AddExpressions(TContext& ctx, const TVector<TNodePtr>& expressions, EExprSeat exprSeat) { +bool ISource::AddExpressions(TContext& ctx, const TVector<TNodePtr>& expressions, EExprSeat exprSeat) { YQL_ENSURE(exprSeat < EExprSeat::Max); THashSet<TString> names; THashSet<TString> aliasSet; @@ -1465,7 +1465,7 @@ TWindowSpecificationPtr ISource::FindWindowSpecification(TContext& ctx, const TS return winIter->second; } -inline TVector<TNodePtr>& ISource::Expressions(EExprSeat exprSeat) { +inline TVector<TNodePtr>& ISource::Expressions(EExprSeat exprSeat) { return NamedExprs[static_cast<size_t>(exprSeat)]; } @@ -1489,7 +1489,7 @@ inline TNodePtr ISource::AliasOrColumn(const TNodePtr& node, bool withSource) { return BuildQuotedAtom(node->GetPos(), result); } -bool ISource::AddAggregationOverWindow(TContext& ctx, const TString& windowName, TAggregationPtr func) { +bool ISource::AddAggregationOverWindow(TContext& ctx, const TString& windowName, TAggregationPtr func) { YQL_ENSURE(func->IsOverWindow()); if (func->IsDistinct()) { ctx.Error(func->GetPos()) << "Aggregation with distinct is not allowed over window: " << windowName; @@ -1502,7 +1502,7 @@ bool ISource::AddAggregationOverWindow(TContext& ctx, const TString& windowName, return true; } -bool ISource::AddFuncOverWindow(TContext& ctx, const TString& windowName, TNodePtr func) { +bool ISource::AddFuncOverWindow(TContext& ctx, const TString& windowName, TNodePtr func) { if (!FindWindowSpecification(ctx, windowName)) { return false; } @@ -1514,7 +1514,7 @@ bool ISource::IsCompositeSource() const { return false; } -bool ISource::IsGroupByColumn(const TString& column) const { +bool ISource::IsGroupByColumn(const TString& column) const { return GroupKeys.contains(column); } @@ -1526,7 +1526,7 @@ bool ISource::IsFlattenByExprs() const { return !Expressions(EExprSeat::FlattenByExpr).empty(); } -bool ISource::IsAlias(EExprSeat exprSeat, const TString& column) const { +bool ISource::IsAlias(EExprSeat exprSeat, const TString& column) const { for (const auto& exprNode: Expressions(exprSeat)) { const auto& labelName = exprNode->GetLabel(); if (labelName && labelName == column) { @@ -1536,7 +1536,7 @@ bool ISource::IsAlias(EExprSeat exprSeat, const TString& column) const { return false; } -bool ISource::IsExprAlias(const TString& column) const { +bool ISource::IsExprAlias(const TString& column) const { std::array<EExprSeat, 5> exprSeats = {{EExprSeat::FlattenBy, EExprSeat::FlattenByExpr, EExprSeat::GroupBy, EExprSeat::WindowPartitionBy, EExprSeat::DistinctAggr}}; for (auto seat: exprSeats) { @@ -1616,7 +1616,7 @@ bool ISource::SetTableHints(TContext& ctx, TPosition pos, const TTableHints& hin return true; } -bool ISource::CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const { +bool ISource::CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const { Y_UNUSED(columns); Y_UNUSED(hint); ctx.Error() << "Source not support grouping hint"; @@ -1641,7 +1641,7 @@ TNodePtr ISource::BuildFilterLambda() { return BuildLambda(Pos, Y("row"), filter); } -TNodePtr ISource::BuildFlattenByColumns(const TString& label) { +TNodePtr ISource::BuildFlattenByColumns(const TString& label) { auto columnsList = Y("FlattenByColumns", Q(FlattenMode), label); for (const auto& column: Expressions(EExprSeat::FlattenBy)) { const auto columnNamePtr = column->GetColumnName(); @@ -1736,7 +1736,7 @@ bool ISource::SetSamplingRate(TContext& ctx, TNodePtr samplingRate) { return true; } -TNodePtr ISource::BuildAggregation(const TString& label) { +TNodePtr ISource::BuildAggregation(const TString& label) { if (GroupKeys.empty() && Aggregations.empty() && !IsCompositeSource()) { return nullptr; } @@ -1748,7 +1748,7 @@ TNodePtr ISource::BuildAggregation(const TString& label) { keysTuple = L(keysTuple, BuildQuotedAtom(Pos, key)); } - std::map<std::pair<bool, TString>, std::vector<IAggregation*>> genericAggrs; + std::map<std::pair<bool, TString>, std::vector<IAggregation*>> genericAggrs; for (const auto& aggr: Aggregations) { if (const auto key = aggr->GetGenericKey()) { genericAggrs[{aggr->IsDistinct(), *key}].emplace_back(aggr.Get()); @@ -1797,7 +1797,7 @@ TNodePtr ISource::BuildAggregation(const TString& label) { return Y("AssumeColumnOrderPartial", Y("Aggregate", label, Q(keysTuple), Q(aggrArgs), Q(options)), Q(keysTuple)); } -TMaybe<TString> ISource::FindColumnMistype(const TString& name) const { +TMaybe<TString> ISource::FindColumnMistype(const TString& name) const { auto result = FindMistypeIn(GroupKeys, name); return result ? result : FindMistypeIn(ExprAliases, name); } @@ -1981,7 +1981,7 @@ TNodePtr ISource::BuildCalcOverWindow(TContext& ctx, const TString& label) { } } -TNodePtr ISource::BuildSort(TContext& ctx, const TString& label) { +TNodePtr ISource::BuildSort(TContext& ctx, const TString& label) { Y_UNUSED(ctx); Y_UNUSED(label); return nullptr; @@ -2051,7 +2051,7 @@ TAstNode* ISource::Translate(TContext& ctx) const { return nullptr; } -void ISource::FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortDirection, TNodePtr& sortKeySelector) { +void ISource::FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortDirection, TNodePtr& sortKeySelector) { TNodePtr expr; if (orderBy.empty()) { YQL_ENSURE(!sortKeySelector); @@ -2191,7 +2191,7 @@ StringContentInternal(TContext& ctx, TPosition pos, const TString& input, EStrin } } else if (str.size() >= 4 && str.StartsWith("@@") && str.EndsWith("@@")) { result.Flags = TNodeFlags::MultilineContent; - TString s = str.substr(2, str.length() - 4); + TString s = str.substr(2, str.length() - 4); SubstGlobal(s, "@@@@", "@@"); result.Content.swap(s); } else { @@ -2313,7 +2313,7 @@ TLiteralNode::TLiteralNode(TPosition pos, bool isNull) Add(isNull ? "Null" : "Void"); } -TLiteralNode::TLiteralNode(TPosition pos, const TString& type, const TString& value) +TLiteralNode::TLiteralNode(TPosition pos, const TString& type, const TString& value) : TAstListNode(pos) , Null(false) , Void(false) @@ -2347,7 +2347,7 @@ bool TLiteralNode::IsNull() const { return Null; } -const TString* TLiteralNode::GetLiteral(const TString& type) const { +const TString* TLiteralNode::GetLiteral(const TString& type) const { return type == Type ? &Value : nullptr; } @@ -2556,7 +2556,7 @@ bool TDeferredAtom::Empty() const { return !Node || Repr.empty(); } -TTupleNode::TTupleNode(TPosition pos, const TVector<TNodePtr>& exprs) +TTupleNode::TTupleNode(TPosition pos, const TVector<TNodePtr>& exprs) : TAstListNode(pos) , Exprs(exprs) {} @@ -2565,7 +2565,7 @@ bool TTupleNode::IsEmpty() const { return Exprs.empty(); } -const TVector<TNodePtr>& TTupleNode::Elements() const { +const TVector<TNodePtr>& TTupleNode::Elements() const { return Exprs; } @@ -2604,7 +2604,7 @@ const TString* TTupleNode::GetSourceName() const { return DeriveCommonSourceName(Exprs); } -TNodePtr BuildTuple(TPosition pos, const TVector<TNodePtr>& exprs) { +TNodePtr BuildTuple(TPosition pos, const TVector<TNodePtr>& exprs) { return new TTupleNode(pos, exprs); } @@ -2650,7 +2650,7 @@ const TString* TStructNode::GetSourceName() const { return DeriveCommonSourceName(Exprs); } -TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprs) { +TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprs) { bool ordered = false; return new TStructNode(pos, exprs, {}, ordered); } @@ -2665,12 +2665,12 @@ TNodePtr BuildOrderedStructure(TPosition pos, const TVector<TNodePtr>& exprsUnla return new TStructNode(pos, exprsUnlabeled, labels, ordered); } -TListOfNamedNodes::TListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs) +TListOfNamedNodes::TListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs) : INode(pos) , Exprs(std::move(exprs)) {} -TVector<TNodePtr>* TListOfNamedNodes::ContentListPtr() { +TVector<TNodePtr>* TListOfNamedNodes::ContentListPtr() { return &Exprs; } @@ -2690,11 +2690,11 @@ void TListOfNamedNodes::DoVisitChildren(const TVisitFunc& func, TVisitNodeSet& v } } -TNodePtr BuildListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs) { +TNodePtr BuildListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs) { return new TListOfNamedNodes(pos, std::move(exprs)); } -TArgPlaceholderNode::TArgPlaceholderNode(TPosition pos, const TString &name) : +TArgPlaceholderNode::TArgPlaceholderNode(TPosition pos, const TString &name) : INode(pos), Name(name) { @@ -2711,7 +2711,7 @@ TAstNode* TArgPlaceholderNode::Translate(TContext& ctx) const { return nullptr; } -TString TArgPlaceholderNode::GetName() const { +TString TArgPlaceholderNode::GetName() const { return Name; } @@ -2719,7 +2719,7 @@ TNodePtr TArgPlaceholderNode::DoClone() const { return {}; } -TNodePtr BuildArgPlaceholder(TPosition pos, const TString& name) { +TNodePtr BuildArgPlaceholder(TPosition pos, const TString& name) { return new TArgPlaceholderNode(pos, name); } @@ -2738,7 +2738,7 @@ public: auto column = dynamic_cast<TColumnNode*>(Ids[0].Expr.Get()); if (column) { ui32 idx = 1; - TString source; + TString source; if (Ids.size() > 2) { source = Ids[idx].Name; ++idx; @@ -2770,11 +2770,11 @@ public: return Ids[idx].Name; } - const TString* GetColumnName() const override { + const TString* GetColumnName() const override { return ColumnOnly ? Ids[0].Expr->GetColumnName() : nullptr; } - const TString* GetSourceName() const override { + const TString* GetSourceName() const override { return Ids[0].Expr->GetSourceName(); } @@ -2853,7 +2853,7 @@ public: TPtr DoClone() const override { YQL_ENSURE(!Node, "TAccessNode::Clone: Node should not be initialized"); - TVector<TIdPart> cloneIds; + TVector<TIdPart> cloneIds; cloneIds.reserve(Ids.size()); for (const auto& id: Ids) { cloneIds.emplace_back(id.Clone()); @@ -2904,7 +2904,7 @@ protected: private: TNodePtr Node; - TVector<TIdPart> Ids; + TVector<TIdPart> Ids; bool IsLookup; bool ColumnOnly; bool IsColumnRequired; @@ -3049,7 +3049,7 @@ bool ValidateAllNodesForAggregation(TContext& ctx, const TVector<TNodePtr>& node class TBindNode: public TAstListNode { public: - TBindNode(TPosition pos, const TString& module, const TString& alias) + TBindNode(TPosition pos, const TString& module, const TString& alias) : TAstListNode(pos) { Add("bind", AstNode(module), BuildQuotedAtom(pos, alias)); @@ -3060,13 +3060,13 @@ public: } }; -TNodePtr BuildBind(TPosition pos, const TString& module, const TString& alias) { +TNodePtr BuildBind(TPosition pos, const TString& module, const TString& alias) { return new TBindNode(pos, module, alias); } class TLambdaNode: public TAstListNode { public: - TLambdaNode(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName) + TLambdaNode(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName) : TAstListNode(pos) { if (!resName.empty()) { @@ -3085,7 +3085,7 @@ protected: } }; -TNodePtr BuildLambda(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName) { +TNodePtr BuildLambda(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName) { return new TLambdaNode(pos, params, body, resName); } @@ -3114,8 +3114,8 @@ TNodePtr BuildSimpleType(TContext& ctx, TPosition pos, const TString& typeName, } TString TypeByAlias(const TString& alias, bool normalize) { - TString type(alias); - TCiString typeAlias(alias); + TString type(alias); + TCiString typeAlias(alias); if (typeAlias.StartsWith("varchar")) { type = "String"; } else if (typeAlias == "tinyint") { @@ -3144,7 +3144,7 @@ TNodePtr BuildIsNullOp(TPosition pos, TNodePtr a) { class TBinaryOpNode final: public TCallNode { public: - TBinaryOpNode(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b); + TBinaryOpNode(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b); TNodePtr DoClone() const final { YQL_ENSURE(Args.size() == 2); @@ -3152,7 +3152,7 @@ public: } }; -TBinaryOpNode::TBinaryOpNode(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b) +TBinaryOpNode::TBinaryOpNode(TPosition pos, const TString& opName, TNodePtr a, TNodePtr b) : TCallNode(pos, opName, 2, 2, { a, b }) { } @@ -3177,7 +3177,7 @@ TNodePtr BuildBinaryOp(TContext& ctx, TPosition pos, const TString& opName, TNod class TCalcOverWindow final: public INode { public: - TCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr node) + TCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr node) : INode(pos) , WindowName(windowName) , FuncNode(node) @@ -3212,11 +3212,11 @@ public: FuncNode->VisitTree(func, visited); } protected: - const TString WindowName; + const TString WindowName; TNodePtr FuncNode; }; -TNodePtr BuildCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr call) { +TNodePtr BuildCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr call) { return new TCalcOverWindow(pos, windowName, call); } diff --git a/ydb/library/yql/sql/v1/node.h b/ydb/library/yql/sql/v1/node.h index de82b45a238..3b56d8d3e9a 100644 --- a/ydb/library/yql/sql/v1/node.h +++ b/ydb/library/yql/sql/v1/node.h @@ -82,7 +82,7 @@ namespace NSQLTranslationV1 { struct TScopedState; typedef TIntrusivePtr<TScopedState> TScopedStatePtr; - inline TString DotJoin(const TString& lhs, const TString& rhs) { + inline TString DotJoin(const TString& lhs, const TString& rhs) { TStringBuilder sb; sb << lhs << "." << rhs; return sb; @@ -96,10 +96,10 @@ namespace NSQLTranslationV1 { typedef TIntrusivePtr<INode> TPtr; struct TIdPart { - TString Name; + TString Name; TPtr Expr; - TIdPart(const TString& name) + TIdPart(const TString& name) : Name(name) { } @@ -119,7 +119,7 @@ namespace NSQLTranslationV1 { virtual ~INode(); TPosition GetPos() const; - const TString& GetLabel() const; + const TString& GetLabel() const; TMaybe<TPosition> GetLabelPos() const; void SetLabel(const TString& label, TMaybe<TPosition> pos = {}); bool IsImplicitLabel() const; @@ -147,18 +147,18 @@ namespace NSQLTranslationV1 { virtual TPtr ApplyUnaryOp(TContext& ctx, TPosition pos, const TString& opName) const; virtual bool IsAsterisk() const; virtual const TString* SubqueryAlias() const; - virtual TString GetOpName() const; - virtual const TString* GetLiteral(const TString& type) const; - virtual const TString* GetColumnName() const; + virtual TString GetOpName() const; + virtual const TString* GetLiteral(const TString& type) const; + virtual const TString* GetColumnName() const; virtual void AssumeColumn(); - virtual const TString* GetSourceName() const; + virtual const TString* GetSourceName() const; virtual const TString* GetAtomContent() const; virtual bool IsOptionalArg() const; virtual size_t GetTupleSize() const; virtual TPtr GetTupleElement(size_t index) const; virtual ITableKeys* GetTableKeys(); virtual ISource* GetSource(); - virtual TVector<INode::TPtr>* ContentListPtr(); + virtual TVector<INode::TPtr>* ContentListPtr(); virtual TAstNode* Translate(TContext& ctx) const = 0; virtual TAggregationPtr GetAggregation() const; virtual void CollectPreaggregateExprs(TContext& ctx, ISource& src, TVector<INode::TPtr>& exprs); @@ -179,7 +179,7 @@ namespace NSQLTranslationV1 { TPtr AstNode() const; TPtr AstNode(TAstNode* node) const; TPtr AstNode(TPtr node) const; - TPtr AstNode(const TString& str) const; + TPtr AstNode(const TString& str) const; template <typename TVal, typename... TVals> void Add(TVal val, TVals... vals) { @@ -228,7 +228,7 @@ namespace NSQLTranslationV1 { protected: TPosition Pos; - TString Label; + TString Label; TMaybe<TPosition> LabelPos; bool ImplicitLabel = false; mutable TNodeState State; @@ -245,8 +245,8 @@ namespace NSQLTranslationV1 { } template<class T> - inline TVector<T> CloneContainer(const TVector<T>& args) { - TVector<T> cloneArgs; + inline TVector<T> CloneContainer(const TVector<T>& args) { + TVector<T> cloneArgs; cloneArgs.reserve(args.size()); for (const auto& arg: args) { cloneArgs.emplace_back(SafeClone(arg)); @@ -261,7 +261,7 @@ namespace NSQLTranslationV1 { ~TAstAtomNode() override; TAstNode* Translate(TContext& ctx) const override; - const TString& GetContent() const { + const TString& GetContent() const { return Content; } @@ -269,7 +269,7 @@ namespace NSQLTranslationV1 { bool IsOptionalArg() const override; protected: - TString Content; + TString Content; ui32 Flags; bool IsOptionalArg_; @@ -309,7 +309,7 @@ namespace NSQLTranslationV1 { protected: explicit TAstListNode(const TAstListNode& node); - explicit TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes); + explicit TAstListNode(TPosition pos, TVector<TNodePtr>&& nodes); TPtr ShallowCopy() const override; bool DoInit(TContext& ctx, ISource* src) override; void DoAdd(TNodePtr node) override; @@ -317,17 +317,17 @@ namespace NSQLTranslationV1 { void DoUpdateState() const override; - void UpdateStateByListNodes(const TVector<TNodePtr>& Nodes) const; + void UpdateStateByListNodes(const TVector<TNodePtr>& Nodes) const; protected: - TVector<TNodePtr> Nodes; + TVector<TNodePtr> Nodes; mutable TMaybe<bool> CacheGroupKey; }; class TAstListNodeImpl final: public TAstListNode { public: TAstListNodeImpl(TPosition pos); - TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes); + TAstListNodeImpl(TPosition pos, TVector<TNodePtr> nodes); void CollectPreaggregateExprs(TContext& ctx, ISource& src, TVector<INode::TPtr>& exprs) override; protected: @@ -336,27 +336,27 @@ namespace NSQLTranslationV1 { class TCallNode: public TAstListNode { public: - TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); - TCallNode(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) + TCallNode(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TCallNode(TPosition pos, const TString& opName, const TVector<TNodePtr>& args) : TCallNode(pos, opName, args.size(), args.size(), args) {} - TString GetOpName() const override; - const TString* GetSourceName() const override; + TString GetOpName() const override; + const TString* GetSourceName() const override; - const TVector<TNodePtr>& GetArgs() const; + const TVector<TNodePtr>& GetArgs() const; protected: bool DoInit(TContext& ctx, ISource* src) override; bool ValidateArguments(TContext& ctx) const; - TString GetCallExplain() const; + TString GetCallExplain() const; void CollectPreaggregateExprs(TContext& ctx, ISource& src, TVector<INode::TPtr>& exprs) override; protected: - TString OpName; + TString OpName; i32 MinArgs; i32 MaxArgs; - TVector<TNodePtr> Args; + TVector<TNodePtr> Args; mutable TMaybe<bool> CacheGroupKey; void DoUpdateState() const override; @@ -365,8 +365,8 @@ namespace NSQLTranslationV1 { class TCallNodeImpl final: public TCallNode { TPtr DoClone() const final; public: - TCallNodeImpl(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); - TCallNodeImpl(TPosition pos, const TString& opName, const TVector<TNodePtr>& args); + TCallNodeImpl(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TCallNodeImpl(TPosition pos, const TString& opName, const TVector<TNodePtr>& args); }; class TFuncNodeImpl final : public TCallNode { @@ -379,8 +379,8 @@ namespace NSQLTranslationV1 { class TCallNodeDepArgs final : public TCallNode { TPtr DoClone() const final; public: - TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); - TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, const TVector<TNodePtr>& args); + TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TCallNodeDepArgs(ui32 reqArgsCount, TPosition pos, const TString& opName, const TVector<TNodePtr>& args); protected: bool DoInit(TContext& ctx, ISource* src) override; @@ -391,7 +391,7 @@ namespace NSQLTranslationV1 { class TCallDirectRow final : public TCallNode { TPtr DoClone() const final; public: - TCallDirectRow(TPosition pos, const TString& opName, const TVector<TNodePtr>& args); + TCallDirectRow(TPosition pos, const TString& opName, const TVector<TNodePtr>& args); protected: bool DoInit(TContext& ctx, ISource* src) override; void DoUpdateState() const override; @@ -403,13 +403,13 @@ namespace NSQLTranslationV1 { bool DoInit(TContext& ctx, ISource* src) override; TPtr WindowSpecFunc(const TNodePtr& type) const override; public: - TWinAggrEmulation(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TWinAggrEmulation(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); protected: template<class TNodeType> TPtr CallNodeClone() const { return new TNodeType(GetPos(), OpName, MinArgs, MaxArgs, CloneContainer(Args)); } - TString FuncAlias; + TString FuncAlias; }; using TFunctionConfig = TMap<TString, TNodePtr>; @@ -434,7 +434,7 @@ namespace NSQLTranslationV1 { return CallNodeClone<TWinRowNumber>(); } public: - TWinRowNumber(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TWinRowNumber(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); }; class TWinLeadLag final: public TWinAggrEmulation { @@ -443,7 +443,7 @@ namespace NSQLTranslationV1 { } bool DoInit(TContext& ctx, ISource* src) override; public: - TWinLeadLag(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); + TWinLeadLag(TPosition pos, const TString& opName, i32 minArgs, i32 maxArgs, const TVector<TNodePtr>& args); }; class TWinRank final: public TWinAggrEmulation { @@ -465,7 +465,7 @@ namespace NSQLTranslationV1 { }; ITableKeys(TPosition pos); - virtual const TString* GetTableName() const; + virtual const TString* GetTableName() const; virtual TNodePtr BuildKeys(TContext& ctx, EBuildKeysMode mode) = 0; private: @@ -516,21 +516,21 @@ namespace NSQLTranslationV1 { TTableRef(const TTableRef&) = default; TTableRef& operator=(const TTableRef&) = default; - TString ShortName() const; + TString ShortName() const; }; struct TIdentifier { TPosition Pos; - TString Name; + TString Name; - TIdentifier(TPosition pos, const TString& name) + TIdentifier(TPosition pos, const TString& name) : Pos(pos) , Name(name) {} }; struct TColumnSchema { TPosition Pos; - TString Name; + TString Name; TNodePtr Type; bool Nullable; TVector<TIdentifier> Families; @@ -540,9 +540,9 @@ namespace NSQLTranslationV1 { }; struct TColumns: public TSimpleRefCount<TColumns> { - TSet<TString> Real; - TSet<TString> Artificial; - TVector<TString> List; + TSet<TString> Real; + TSet<TString> Artificial; + TVector<TString> List; TVector<bool> NamedColumns; bool All = false; bool QualifiedAll = false; @@ -550,7 +550,7 @@ namespace NSQLTranslationV1 { bool Add(const TString* column, bool countHint, bool isArtificial = false, bool isReliable = true, bool hasName = true); void Merge(const TColumns& columns); - void SetPrefix(const TString& prefix); + void SetPrefix(const TString& prefix); void SetAll(); bool IsColumnPossible(TContext& ctx, const TString& column); }; @@ -628,13 +628,13 @@ namespace NSQLTranslationV1 { ~TWindowSpecification() {} }; typedef TIntrusivePtr<TWindowSpecification> TWindowSpecificationPtr; - typedef TMap<TString, TWindowSpecificationPtr> TWinSpecs; + typedef TMap<TString, TWindowSpecificationPtr> TWinSpecs; typedef TVector<TTableRef> TTableList; void WarnIfAliasFromSelectIsUsedInGroupBy(TContext& ctx, const TVector<TNodePtr>& selectTerms, const TVector<TNodePtr>& groupByTerms, const TVector<TNodePtr>& groupByExprTerms); - bool ValidateAllNodesForAggregation(TContext& ctx, const TVector<TNodePtr>& nodes); + bool ValidateAllNodesForAggregation(TContext& ctx, const TVector<TNodePtr>& nodes); struct TWriteSettings { bool Discard = false; @@ -652,7 +652,7 @@ namespace NSQLTranslationV1 { const TString* GetColumnName() const override; const TString* GetSourceName() const override; TAstNode* Translate(TContext& ctx) const override; - void ResetColumn(const TString& column, const TString& source); + void ResetColumn(const TString& column, const TString& source); void ResetColumn(const TNodePtr& column, const TString& source); void SetUseSourceAsColumn(); @@ -670,11 +670,11 @@ namespace NSQLTranslationV1 { void DoUpdateState() const override; private: - static const TString Empty; + static const TString Empty; TNodePtr Node; TString ColumnName; TNodePtr ColumnExpr; - TString Source; + TString Source; bool GroupKey = false; bool Artificial = false; bool Reliable = true; @@ -686,18 +686,18 @@ namespace NSQLTranslationV1 { class TArgPlaceholderNode final: public INode { public: - TArgPlaceholderNode(TPosition pos, const TString &name); + TArgPlaceholderNode(TPosition pos, const TString &name); TAstNode* Translate(TContext& ctx) const override; - TString GetName() const; + TString GetName() const; TNodePtr DoClone() const final; protected: bool DoInit(TContext& ctx, ISource* src) override; private: - TString Name; + TString Name; }; enum class EAggregateMode { @@ -708,10 +708,10 @@ namespace NSQLTranslationV1 { class TTupleNode: public TAstListNode { public: - TTupleNode(TPosition pos, const TVector<TNodePtr>& exprs); + TTupleNode(TPosition pos, const TVector<TNodePtr>& exprs); bool IsEmpty() const; - const TVector<TNodePtr>& Elements() const; + const TVector<TNodePtr>& Elements() const; bool DoInit(TContext& ctx, ISource* src) override; size_t GetTupleSize() const override; TPtr GetTupleElement(size_t index) const override; @@ -720,7 +720,7 @@ namespace NSQLTranslationV1 { void CollectPreaggregateExprs(TContext& ctx, ISource& src, TVector<INode::TPtr>& exprs) override; const TString* GetSourceName() const override; - const TVector<TNodePtr> Exprs; + const TVector<TNodePtr> Exprs; }; class TStructNode: public TAstListNode { @@ -729,7 +729,7 @@ namespace NSQLTranslationV1 { bool DoInit(TContext& ctx, ISource* src) override; TNodePtr DoClone() const final; - const TVector<TNodePtr>& GetExprs() { + const TVector<TNodePtr>& GetExprs() { return Exprs; } @@ -737,7 +737,7 @@ namespace NSQLTranslationV1 { void CollectPreaggregateExprs(TContext& ctx, ISource& src, TVector<INode::TPtr>& exprs) override; const TString* GetSourceName() const override; - const TVector<TNodePtr> Exprs; + const TVector<TNodePtr> Exprs; const TVector<TNodePtr> Labels; const bool Ordered; }; @@ -748,7 +748,7 @@ namespace NSQLTranslationV1 { void DoUpdateState() const override; - virtual const TString* GetGenericKey() const; + virtual const TString* GetGenericKey() const; virtual bool InitAggr(TContext& ctx, bool isFactory, ISource* src, TAstListNode& node, const TVector<TNodePtr>& exprs) = 0; @@ -762,7 +762,7 @@ namespace NSQLTranslationV1 { virtual TNodePtr WindowTraits(const TNodePtr& type) const; - const TString& GetName() const; + const TString& GetName() const; EAggregateMode GetAggregationMode() const; void MarkKeyColumnAsGenerated(); @@ -773,13 +773,13 @@ namespace NSQLTranslationV1 { virtual TNodePtr GetApply(const TNodePtr& type) const = 0; protected: - IAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode mode); + IAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode mode); TAstNode* Translate(TContext& ctx) const override; - TString Name; + TString Name; TString Func; const EAggregateMode AggMode; - TString DistinctKey; + TString DistinctKey; bool IsGeneratedKeyColumn = false; }; @@ -817,12 +817,12 @@ namespace NSQLTranslationV1 { /// in case of error unfilled, flag show if ensure column name virtual TMaybe<bool> AddColumn(TContext& ctx, TColumnNode& column); virtual void FinishColumns(); - virtual bool AddExpressions(TContext& ctx, const TVector<TNodePtr>& columns, EExprSeat exprSeat); + virtual bool AddExpressions(TContext& ctx, const TVector<TNodePtr>& columns, EExprSeat exprSeat); virtual void SetFlattenByMode(const TString& mode); virtual void MarkFlattenColumns(); virtual bool IsFlattenColumns() const; virtual bool AddFilter(TContext& ctx, TNodePtr filter); - virtual bool AddGroupKey(TContext& ctx, const TString& column); + virtual bool AddGroupKey(TContext& ctx, const TString& column); virtual void SetCompactGroupBy(bool compactGroupBy); virtual TString MakeLocalName(const TString& name); virtual bool AddAggregation(TContext& ctx, TAggregationPtr aggr); @@ -831,13 +831,13 @@ namespace NSQLTranslationV1 { virtual const TVector<TString>& GetTmpWindowColumns() const; virtual bool HasAggregations() const; virtual void AddWindowSpecs(TWinSpecs winSpecs); - virtual bool AddAggregationOverWindow(TContext& ctx, const TString& windowName, TAggregationPtr func); - virtual bool AddFuncOverWindow(TContext& ctx, const TString& windowName, TNodePtr func); + virtual bool AddAggregationOverWindow(TContext& ctx, const TString& windowName, TAggregationPtr func); + virtual bool AddFuncOverWindow(TContext& ctx, const TString& windowName, TNodePtr func); virtual void SetHoppingWindowSpec(THoppingWindowSpecPtr spec); virtual THoppingWindowSpecPtr GetHoppingWindowSpec() const; virtual TNodePtr GetSessionWindowSpec() const; virtual bool IsCompositeSource() const; - virtual bool IsGroupByColumn(const TString& column) const; + virtual bool IsGroupByColumn(const TString& column) const; virtual bool IsFlattenByColumns() const; virtual bool IsFlattenByExprs() const; virtual bool IsCalcOverWindow() const; @@ -847,17 +847,17 @@ namespace NSQLTranslationV1 { virtual TWriteSettings GetWriteSettings() const; virtual bool SetSamplingOptions(TContext& ctx, TPosition pos, ESampleMode mode, TNodePtr samplingRate, TNodePtr samplingSeed); virtual bool SetTableHints(TContext& ctx, TPosition pos, const TTableHints& hints, const TTableHints& contextHints); - virtual bool CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const; + virtual bool CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const; virtual TNodePtr BuildFilter(TContext& ctx, const TString& label); virtual TNodePtr BuildFilterLambda(); - virtual TNodePtr BuildFlattenByColumns(const TString& label); + virtual TNodePtr BuildFlattenByColumns(const TString& label); virtual TNodePtr BuildFlattenColumns(const TString& label); virtual TNodePtr BuildPreaggregatedMap(TContext& ctx); virtual TNodePtr BuildPreFlattenMap(TContext& ctx); virtual TNodePtr BuildPrewindowMap(TContext& ctx); - virtual TNodePtr BuildAggregation(const TString& label); + virtual TNodePtr BuildAggregation(const TString& label); virtual TNodePtr BuildCalcOverWindow(TContext& ctx, const TString& label); - virtual TNodePtr BuildSort(TContext& ctx, const TString& label); + virtual TNodePtr BuildSort(TContext& ctx, const TString& label); virtual TNodePtr BuildCleanupColumns(TContext& ctx, const TString& label); virtual bool BuildSamplingLambda(TNodePtr& node); virtual bool SetSamplingRate(TContext& ctx, TNodePtr samplingRate); @@ -872,12 +872,12 @@ namespace NSQLTranslationV1 { virtual bool DoInit(TContext& ctx, ISource* src); virtual TNodePtr Build(TContext& ctx) = 0; - virtual TMaybe<TString> FindColumnMistype(const TString& name) const; + virtual TMaybe<TString> FindColumnMistype(const TString& name) const; virtual bool InitFilters(TContext& ctx); void AddDependentSource(ISource* usedSource); - bool IsAlias(EExprSeat exprSeat, const TString& label) const; - bool IsExprAlias(const TString& label) const; + bool IsAlias(EExprSeat exprSeat, const TString& label) const; + bool IsExprAlias(const TString& label) const; bool IsExprSeat(EExprSeat exprSeat, EExprType type = EExprType::WithExpression) const; TString GetGroupByColumnAlias(const TString& column) const; const TVector<TNodePtr>& Expressions(EExprSeat exprSeat) const; @@ -890,29 +890,29 @@ namespace NSQLTranslationV1 { ISource(TPosition pos); virtual TAstNode* Translate(TContext& ctx) const; - void FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortKeySelector, TNodePtr& sortDirection); + void FillSortParts(const TVector<TSortSpecificationPtr>& orderBy, TNodePtr& sortKeySelector, TNodePtr& sortDirection); TNodePtr BuildSortSpec(const TVector<TSortSpecificationPtr>& orderBy, const TString& label, bool traits, bool assume); - TVector<TNodePtr>& Expressions(EExprSeat exprSeat); + TVector<TNodePtr>& Expressions(EExprSeat exprSeat); TNodePtr AliasOrColumn(const TNodePtr& node, bool withSource); TNodePtr BuildWindowFrame(const TFrameSpecification& spec, bool isCompact); - THashSet<TString> ExprAliases; + THashSet<TString> ExprAliases; THashSet<TString> FlattenByAliases; - THashMap<TString, TString> GroupByColumnAliases; - TVector<TNodePtr> Filters; + THashMap<TString, TString> GroupByColumnAliases; + TVector<TNodePtr> Filters; bool CompactGroupBy = false; - TSet<TString> GroupKeys; - TVector<TString> OrderedGroupKeys; - std::array<TVector<TNodePtr>, static_cast<unsigned>(EExprSeat::Max)> NamedExprs; - TVector<TAggregationPtr> Aggregations; + TSet<TString> GroupKeys; + TVector<TString> OrderedGroupKeys; + std::array<TVector<TNodePtr>, static_cast<unsigned>(EExprSeat::Max)> NamedExprs; + TVector<TAggregationPtr> Aggregations; TMap<TString, TVector<TAggregationPtr>> AggregationOverWindow; TMap<TString, TVector<TNodePtr>> FuncOverWindow; TWinSpecs WinSpecs; THoppingWindowSpecPtr HoppingWindowSpec; TNodePtr SessionWindow; - TVector<ISource*> UsedSources; + TVector<ISource*> UsedSources; TString FlattenMode; bool FlattenColumns = false; THashMap<TString, ui32> GenIndexes; @@ -921,8 +921,8 @@ namespace NSQLTranslationV1 { }; template<> - inline TVector<TSourcePtr> CloneContainer<TSourcePtr>(const TVector<TSourcePtr>& args) { - TVector<TSourcePtr> cloneArgs; + inline TVector<TSourcePtr> CloneContainer<TSourcePtr>(const TVector<TSourcePtr>& args) { + TVector<TSourcePtr> cloneArgs; cloneArgs.reserve(args.size()); for (const auto& arg: args) { cloneArgs.emplace_back(arg ? arg->CloneSource() : nullptr); @@ -941,7 +941,7 @@ namespace NSQLTranslationV1 { virtual IJoin* GetJoin(); virtual TNodePtr BuildJoinKeys(TContext& ctx, const TVector<TDeferredAtom>& names) = 0; virtual void SetupJoin(const TString& joinOp, TNodePtr joinExpr, const TJoinLinkSettings& linkSettings) = 0; - virtual const THashMap<TString, THashSet<TString>>& GetSameKeysMap() const = 0; + virtual const THashMap<TString, THashSet<TString>>& GetSameKeysMap() const = 0; virtual TVector<TString> GetJoinLabels() const = 0; protected: @@ -950,25 +950,25 @@ namespace NSQLTranslationV1 { class TListOfNamedNodes final: public INode { public: - TListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs); + TListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs); - TVector<TNodePtr>* ContentListPtr() override; + TVector<TNodePtr>* ContentListPtr() override; TAstNode* Translate(TContext& ctx) const override; TPtr DoClone() const final; void DoVisitChildren(const TVisitFunc& func, TVisitNodeSet& visited) const final; private: - TVector<TNodePtr> Exprs; - TString Meaning; + TVector<TNodePtr> Exprs; + TString Meaning; }; class TLiteralNode: public TAstListNode { public: TLiteralNode(TPosition pos, bool isNull); - TLiteralNode(TPosition pos, const TString& type, const TString& value); + TLiteralNode(TPosition pos, const TString& type, const TString& value); TLiteralNode(TPosition pos, const TString& value, ui32 nodeFlags); TLiteralNode(TPosition pos, const TString& value, ui32 nodeFlags, const TString& type); bool IsNull() const override; - const TString* GetLiteral(const TString& type) const override; + const TString* GetLiteral(const TString& type) const override; void DoUpdateState() const override; TPtr DoClone() const override; bool IsLiteral() const override; @@ -977,8 +977,8 @@ namespace NSQLTranslationV1 { protected: bool Null; bool Void; - TString Type; - TString Value; + TString Type; + TString Value; }; class TAsteriskNode: public INode { @@ -1175,7 +1175,7 @@ namespace NSQLTranslationV1 { TNodePtr BuildAtom(TPosition pos, const TString& content, ui32 flags = NYql::TNodeFlags::ArbitraryContent, bool isOptionalArg = false); - TNodePtr BuildQuotedAtom(TPosition pos, const TString& content, ui32 flags = NYql::TNodeFlags::ArbitraryContent); + TNodePtr BuildQuotedAtom(TPosition pos, const TString& content, ui32 flags = NYql::TNodeFlags::ArbitraryContent); TNodePtr BuildLiteralNull(TPosition pos); TNodePtr BuildLiteralVoid(TPosition pos); @@ -1192,29 +1192,29 @@ namespace NSQLTranslationV1 { TNodePtr BuildLiteralBool(TPosition pos, bool value); TNodePtr BuildEmptyAction(TPosition pos); - TNodePtr BuildTuple(TPosition pos, const TVector<TNodePtr>& exprs); + TNodePtr BuildTuple(TPosition pos, const TVector<TNodePtr>& exprs); - TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprs); + TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprs); TNodePtr BuildStructure(TPosition pos, const TVector<TNodePtr>& exprsUnlabeled, const TVector<TNodePtr>& labels); TNodePtr BuildOrderedStructure(TPosition pos, const TVector<TNodePtr>& exprsUnlabeled, const TVector<TNodePtr>& labels); - TNodePtr BuildListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs); + TNodePtr BuildListOfNamedNodes(TPosition pos, TVector<TNodePtr>&& exprs); - TNodePtr BuildArgPlaceholder(TPosition pos, const TString& name); + TNodePtr BuildArgPlaceholder(TPosition pos, const TString& name); - TNodePtr BuildColumn(TPosition pos, const TString& column = TString(), const TString& source = TString()); + TNodePtr BuildColumn(TPosition pos, const TString& column = TString(), const TString& source = TString()); TNodePtr BuildColumn(TPosition pos, const TNodePtr& column, const TString& source = TString()); TNodePtr BuildColumn(TPosition pos, const TDeferredAtom& column, const TString& source = TString()); TNodePtr BuildColumnOrType(TPosition pos, const TString& column = TString()); TNodePtr BuildAccess(TPosition pos, const TVector<INode::TIdPart>& ids, bool isLookup); - TNodePtr BuildBind(TPosition pos, const TString& module, const TString& alias); - TNodePtr BuildLambda(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName = TString()); + TNodePtr BuildBind(TPosition pos, const TString& module, const TString& alias); + TNodePtr BuildLambda(TPosition pos, TNodePtr params, TNodePtr body, const TString& resName = TString()); TNodePtr BuildDataType(TPosition pos, const TString& typeName); TNodePtr BuildSimpleType(TContext& ctx, TPosition pos, const TString& typeName, bool dataOnly); TNodePtr BuildIsNullOp(TPosition pos, TNodePtr a); TNodePtr BuildBinaryOp(TContext& ctx, TPosition pos, const TString& opName, TNodePtr a, TNodePtr b); - TNodePtr BuildCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr call); + TNodePtr BuildCalcOverWindow(TPosition pos, const TString& windowName, TNodePtr call); TNodePtr BuildYsonOptionsNode(TPosition pos, bool autoConvert, bool strict, bool fastYson); TNodePtr BuildDoCall(TPosition pos, const TNodePtr& node); @@ -1222,37 +1222,37 @@ namespace NSQLTranslationV1 { // Implemented in aggregation.cpp TAggregationPtr BuildFactoryAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode, bool multi = false); - TAggregationPtr BuildKeyPayloadFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildPayloadPredicateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildTwoArgsFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildLinearHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildKeyPayloadFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildPayloadPredicateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildTwoArgsFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildLinearHistogramFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); template <bool HasKey> TAggregationPtr BuildTopFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildTopFreqFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildTopFreqFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); TAggregationPtr BuildCountDistinctEstimateFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); TAggregationPtr BuildListFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildPercentileFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); - TAggregationPtr BuildCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode); - TAggregationPtr BuildUserDefinedFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildPercentileFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); + TAggregationPtr BuildCountAggregation(TPosition pos, const TString& name, const TString& func, EAggregateMode aggMode); + TAggregationPtr BuildUserDefinedFactoryAggregation(TPosition pos, const TString& name, const TString& factory, EAggregateMode aggMode); // Implemented in builtin.cpp TNodePtr BuildCallable(TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args, bool forReduce = false); - TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args); + TNodePtr BuildUdf(TContext& ctx, TPosition pos, const TString& module, const TString& name, const TVector<TNodePtr>& args); TNodePtr BuildBuiltinFunc( TContext& ctx, TPosition pos, - TString name, - const TVector<TNodePtr>& args, - const TString& nameSpace = TString(), + TString name, + const TVector<TNodePtr>& args, + const TString& nameSpace = TString(), EAggregateMode aggMode = EAggregateMode::Normal, bool* mustUseNamed = nullptr, bool warnOnYqlNameSpace = true ); // Implemented in join.cpp - TString NormalizeJoinOp(const TString& joinOp); + TString NormalizeJoinOp(const TString& joinOp); TSourcePtr BuildEquiJoin(TPosition pos, TVector<TSourcePtr>&& sources, TVector<bool>&& anyFlags, bool strictJoinKeyTypes); // Implemented in select.cpp @@ -1264,11 +1264,11 @@ namespace NSQLTranslationV1 { TSourcePtr BuildNodeSource(TPosition pos, const TNodePtr& node, bool wrapToList = false); TSourcePtr BuildTableSource(TPosition pos, const TTableRef& table, const TString& label = TString()); TSourcePtr BuildInnerSource(TPosition pos, TNodePtr node, const TString& service, const TDeferredAtom& cluster, const TString& label = TString()); - TSourcePtr BuildRefColumnSource(TPosition pos, const TString& partExpression); + TSourcePtr BuildRefColumnSource(TPosition pos, const TString& partExpression); TSourcePtr BuildUnionAll(TPosition pos, TVector<TSourcePtr>&& sources, const TWriteSettings& settings); - TSourcePtr BuildOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource); + TSourcePtr BuildOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource); - TNodePtr BuildOrderBy(TPosition pos, const TVector<TNodePtr>& keys, const TVector<bool>& order); + TNodePtr BuildOrderBy(TPosition pos, const TVector<TNodePtr>& keys, const TVector<bool>& order); TNodePtr BuildSkipTake(TPosition pos, const TNodePtr& skip, const TNodePtr& take); @@ -1276,17 +1276,17 @@ namespace NSQLTranslationV1 { TContext& ctx, TPosition pos, TSourcePtr source, - const TVector<TNodePtr>& groupByExpr, - const TVector<TNodePtr>& groupBy, + const TVector<TNodePtr>& groupByExpr, + const TVector<TNodePtr>& groupBy, bool compactGroupBy, bool assumeSorted, - const TVector<TSortSpecificationPtr>& orderBy, + const TVector<TSortSpecificationPtr>& orderBy, TNodePtr having, TWinSpecs&& windowSpec, THoppingWindowSpecPtr hoppingWindowSpec, - TVector<TNodePtr>&& terms, + TVector<TNodePtr>&& terms, bool distinct, - TVector<TNodePtr>&& without, + TVector<TNodePtr>&& without, bool selectStream, const TWriteSettings& settings ); @@ -1306,9 +1306,9 @@ namespace NSQLTranslationV1 { TNodePtr BuildSelectResult(TPosition pos, TSourcePtr source, bool writeResult, bool inSubquery, TScopedStatePtr scoped); // Implemented in insert.cpp - TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values); - TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, TSourcePtr source); - TSourcePtr BuildUpdateValues(TPosition pos, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values); + TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, const TVector<TVector<TNodePtr>>& values); + TSourcePtr BuildWriteValues(TPosition pos, const TString& opertationHumanName, const TVector<TString>& columnsHint, TSourcePtr source); + TSourcePtr BuildUpdateValues(TPosition pos, const TVector<TString>& columnsHint, const TVector<TNodePtr>& values); EWriteColumnMode ToWriteColumnsMode(ESQLWriteColumnMode sqlWriteColumnMode); TNodePtr BuildEraseColumns(TPosition pos, const TVector<TString>& columns); @@ -1339,7 +1339,7 @@ namespace NSQLTranslationV1 { TNodePtr BuildRollbackClusters(TPosition pos); TNodePtr BuildQuery(TPosition pos, const TVector<TNodePtr>& blocks, bool topLevel, TScopedStatePtr scoped); TNodePtr BuildPragma(TPosition pos, const TString& prefix, const TString& name, const TVector<TDeferredAtom>& values, bool valueDefault); - TNodePtr BuildSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq); + TNodePtr BuildSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq); TNodePtr BuildWorldIfNode(TPosition pos, TNodePtr predicate, TNodePtr thenNode, TNodePtr elseNode, bool isEvaluate); TNodePtr BuildWorldForNode(TPosition pos, TNodePtr list, TNodePtr bodyNode, TNodePtr elseNode, bool isEvaluate); diff --git a/ydb/library/yql/sql/v1/query.cpp b/ydb/library/yql/sql/v1/query.cpp index 725356b9f57..2aaeae70d06 100644 --- a/ydb/library/yql/sql/v1/query.cpp +++ b/ydb/library/yql/sql/v1/query.cpp @@ -42,7 +42,7 @@ public: return true; } - const TString* GetTableName() const override { + const TString* GetTableName() const override { return Name.GetLiteral() ? &Full : nullptr; } @@ -80,8 +80,8 @@ private: TString Service; TDeferredAtom Cluster; TDeferredAtom Name; - TString View; - TString Full; + TString View; + TString Full; }; TNodePtr BuildTableKey(TPosition pos, const TString& service, const TDeferredAtom& cluster, @@ -168,7 +168,7 @@ public: return nullptr; } - TCiString func(Func); + TCiString func(Func); if (func != "object") { for (auto& arg: Args) { if (arg.Expr->GetLabel()) { @@ -449,8 +449,8 @@ public: private: TString Service; TDeferredAtom Cluster; - TString Func; - TVector<TTableArg> Args; + TString Func; + TVector<TTableArg> Args; }; TNodePtr BuildTableKeys(TPosition pos, const TString& service, const TDeferredAtom& cluster, @@ -583,7 +583,7 @@ public: || !Params.Indexes.empty() || !Params.Changefeeds.empty()) { - THashSet<TString> columnsSet; + THashSet<TString> columnsSet; for (auto& col : Params.Columns) { columnsSet.insert(col.Name); } @@ -1382,7 +1382,7 @@ TNodePtr BuildDropRoles(TPosition pos, const TString& service, const TDeferredAt return new TDropRoles(pos, service, cluster, toDrop, isUser, force, scoped); } -static const TMap<EWriteColumnMode, TString> columnModeToStrMapMR { +static const TMap<EWriteColumnMode, TString> columnModeToStrMapMR { {EWriteColumnMode::Default, ""}, {EWriteColumnMode::Insert, "append"}, {EWriteColumnMode::Renew, "renew"} @@ -1392,7 +1392,7 @@ static const TMap<EWriteColumnMode, TString> columnModeToStrMapStat { {EWriteColumnMode::Upsert, "upsert"} }; -static const TMap<EWriteColumnMode, TString> columnModeToStrMapKikimr { +static const TMap<EWriteColumnMode, TString> columnModeToStrMapKikimr { {EWriteColumnMode::Default, ""}, {EWriteColumnMode::Insert, "insert_abort"}, {EWriteColumnMode::InsertOrAbort, "insert_abort"}, @@ -1408,7 +1408,7 @@ static const TMap<EWriteColumnMode, TString> columnModeToStrMapKikimr { class TWriteTableNode final: public TAstListNode { public: - TWriteTableNode(TPosition pos, const TString& label, const TTableRef& table, EWriteColumnMode mode, + TWriteTableNode(TPosition pos, const TString& label, const TTableRef& table, EWriteColumnMode mode, TNodePtr options, TScopedStatePtr scoped) : TAstListNode(pos) , Label(label) @@ -1426,7 +1426,7 @@ public: return false; } - auto getModesMap = [] (const TString& serviceName) -> const TMap<EWriteColumnMode, TString>& { + auto getModesMap = [] (const TString& serviceName) -> const TMap<EWriteColumnMode, TString>& { if (serviceName == KikimrProviderName || serviceName == YdbProviderName) { return columnModeToStrMapKikimr; } else if (serviceName == StatProviderName) { @@ -1464,7 +1464,7 @@ public: return {}; } private: - TString Label; + TString Label; TTableRef Table; EWriteColumnMode Mode; TNodePtr Options; @@ -1548,7 +1548,7 @@ public: bool DoInit(TContext& ctx, ISource* src) override { auto block(Y( - Y("let", "result_sink", Y("DataSink", Q(TString(ResultProviderName)))), + Y("let", "result_sink", Y("DataSink", Q(TString(ResultProviderName)))), Y("let", "world", Y(TString(WriteName), "world", "result_sink", Y("Key"), Label, Q(Settings))) )); if (ctx.PragmaAutoCommit) { @@ -1564,7 +1564,7 @@ public: return {}; } private: - TString Label; + TString Label; TNodePtr Settings; TNodePtr CommitClusters; }; @@ -1769,7 +1769,7 @@ public: return {}; } private: - TVector<TNodePtr> Blocks; + TVector<TNodePtr> Blocks; const bool TopLevel; TScopedStatePtr Scoped; }; @@ -1906,12 +1906,12 @@ public: } private: - TVector<TString> Args; - TVector<TNodePtr> ExprSeq; + TVector<TString> Args; + TVector<TNodePtr> ExprSeq; TSourcePtr FakeSource; }; -TNodePtr BuildSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq) { +TNodePtr BuildSqlLambda(TPosition pos, TVector<TString>&& args, TVector<TNodePtr>&& exprSeq) { return new TSqlLambda(pos, std::move(args), std::move(exprSeq)); } diff --git a/ydb/library/yql/sql/v1/select.cpp b/ydb/library/yql/sql/v1/select.cpp index 2841f05a5b5..154258887f8 100644 --- a/ydb/library/yql/sql/v1/select.cpp +++ b/ydb/library/yql/sql/v1/select.cpp @@ -193,7 +193,7 @@ public: return Y("AsList", Y("AsStruct")); } - bool AddGroupKey(TContext& ctx, const TString& column) override { + bool AddGroupKey(TContext& ctx, const TString& column) override { Y_UNUSED(column); ctx.Error(Pos) << "Grouping is not allowed " << (MissingFrom ? "without FROM" : "in this context"); return false; @@ -225,7 +225,7 @@ public: return {}; } - bool IsGroupByColumn(const TString& column) const override { + bool IsGroupByColumn(const TString& column) const override { Y_UNUSED(column); return false; } @@ -236,7 +236,7 @@ public: return nullptr; } - TNodePtr BuildAggregation(const TString& label) override { + TNodePtr BuildAggregation(const TString& label) override { Y_UNUSED(label); return nullptr; } @@ -355,7 +355,7 @@ protected: TMaybe<bool> AddColumn(TContext& ctx, TColumnNode& column) override { Y_VERIFY_DEBUG(Source); - const TString label(Source->GetLabel()); + const TString label(Source->GetLabel()); Source->SetLabel(Label); const auto ret = Source->AddColumn(ctx, column); Source->SetLabel(label); @@ -430,7 +430,7 @@ protected: return true; } - TMaybe<TString> FindColumnMistype(const TString& name) const override { + TMaybe<TString> FindColumnMistype(const TString& name) const override { auto result = FindMistypeIn(Columns.Real, name); if (!result) { auto result = FindMistypeIn(Columns.Artificial, name); @@ -676,7 +676,7 @@ public: TNodePtr samplingRate, TNodePtr samplingSeed) override { - TString modeName; + TString modeName; if (!samplingSeed) { samplingSeed = Y("Int32", Q("0")); } @@ -1133,9 +1133,9 @@ public: private: ReduceMode Mode; TSourcePtr Source; - TVector<TSortSpecificationPtr> OrderBy; - TVector<TNodePtr> Keys; - TVector<TNodePtr> Args; + TVector<TSortSpecificationPtr> OrderBy; + TVector<TNodePtr> Keys; + TVector<TNodePtr> Args; TNodePtr Udf; TNodePtr Having; const TWriteSettings Settings; @@ -1381,10 +1381,10 @@ private: TNodePtr Flatten; TNodePtr PreFlattenMap; const TWriteSettings Settings; - TVector<TSourcePtr> Subselects; + TVector<TSourcePtr> Subselects; TVector<TNodePtr> Grouping; TVector<TNodePtr> GroupByExpr; - TSet<TString> GroupingCols; + TSet<TString> GroupingCols; }; /// \todo simplify class @@ -1393,17 +1393,17 @@ public: TSelectCore( TPosition pos, TSourcePtr source, - const TVector<TNodePtr>& groupByExpr, - const TVector<TNodePtr>& groupBy, + const TVector<TNodePtr>& groupByExpr, + const TVector<TNodePtr>& groupBy, bool compactGroupBy, bool assumeSorted, - const TVector<TSortSpecificationPtr>& orderBy, + const TVector<TSortSpecificationPtr>& orderBy, TNodePtr having, TWinSpecs& winSpecs, THoppingWindowSpecPtr hoppingWindowSpec, - const TVector<TNodePtr>& terms, + const TVector<TNodePtr>& terms, bool distinct, - const TVector<TNodePtr>& without, + const TVector<TNodePtr>& without, bool selectStream, const TWriteSettings& settings ) @@ -2072,12 +2072,12 @@ private: private: TSourcePtr Source; - TVector<TNodePtr> GroupByExpr; + TVector<TNodePtr> GroupByExpr; TVector<TNodePtr> DistinctAggrExpr; - TVector<TNodePtr> GroupBy; + TVector<TNodePtr> GroupBy; bool AssumeSorted = false; bool CompactGroupBy = false; - TVector<TSortSpecificationPtr> OrderBy; + TVector<TSortSpecificationPtr> OrderBy; TNodePtr Having; TWinSpecs WinSpecs; TNodePtr Flatten; @@ -2087,8 +2087,8 @@ private: TNodePtr Aggregate; TNodePtr CalcOverWindow; TNodePtr CompositeTerms; - TVector<TNodePtr> Terms; - TVector<TNodePtr> Without; + TVector<TNodePtr> Terms; + TVector<TNodePtr> Without; const bool Distinct; bool OrderByInit = false; THoppingWindowSpecPtr HoppingWindowSpec; @@ -2362,14 +2362,14 @@ TSourcePtr BuildProcess( class TNestedProxySource: public IProxySource { public: - TNestedProxySource(TPosition pos, const TVector<TNodePtr>& groupBy, TSourcePtr source) + TNestedProxySource(TPosition pos, const TVector<TNodePtr>& groupBy, TSourcePtr source) : IProxySource(pos, source.Get()) , CompositeSelect(nullptr) , Holder(std::move(source)) , GroupBy(groupBy) {} - TNestedProxySource(TCompositeSelect* compositeSelect, const TVector<TNodePtr>& groupBy) + TNestedProxySource(TCompositeSelect* compositeSelect, const TVector<TNodePtr>& groupBy) : IProxySource(compositeSelect->GetPos(), compositeSelect->RealSource()) , CompositeSelect(compositeSelect) , GroupBy(groupBy) @@ -2403,7 +2403,7 @@ public: return CompositeSelect; } - bool CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const override { + bool CalculateGroupingHint(TContext& ctx, const TVector<TString>& columns, ui64& hint) const override { Y_UNUSED(ctx); hint = 0; if (GroupByColumns.empty()) { @@ -2443,8 +2443,8 @@ public: private: TCompositeSelect* CompositeSelect; TSourcePtr Holder; - TVector<TNodePtr> GroupBy; - mutable TSet<TString> GroupByColumns; + TVector<TNodePtr> GroupBy; + mutable TSet<TString> GroupByColumns; }; @@ -2454,17 +2454,17 @@ TSourcePtr DoBuildSelectCore( TPosition pos, TSourcePtr originalSource, TSourcePtr source, - const TVector<TNodePtr>& groupByExpr, - const TVector<TNodePtr>& groupBy, + const TVector<TNodePtr>& groupByExpr, + const TVector<TNodePtr>& groupBy, bool compactGroupBy, bool assumeSorted, - const TVector<TSortSpecificationPtr>& orderBy, + const TVector<TSortSpecificationPtr>& orderBy, TNodePtr having, TWinSpecs&& winSpecs, THoppingWindowSpecPtr hoppingWindowSpec, - TVector<TNodePtr>&& terms, + TVector<TNodePtr>&& terms, bool distinct, - TVector<TNodePtr>&& without, + TVector<TNodePtr>&& without, bool selectStream, const TWriteSettings& settings ) { @@ -2483,11 +2483,11 @@ TSourcePtr DoBuildSelectCore( /// \todo some smart merge logic, generalize common part of grouping (expr, flatten, etc)? TIntrusivePtr<TCompositeSelect> compositeSelect = new TCompositeSelect(pos, std::move(source), originalSource->CloneSource(), settings); size_t totalGroups = 0; - TVector<TSourcePtr> subselects; + TVector<TSourcePtr> subselects; TVector<TNodePtr> groupingCols; for (auto& grouping: groupBy) { auto contentPtr = grouping->ContentListPtr(); - TVector<TNodePtr> cache(1, nullptr); + TVector<TNodePtr> cache(1, nullptr); if (!contentPtr) { cache[0] = grouping; contentPtr = &cache; @@ -2496,7 +2496,7 @@ TSourcePtr DoBuildSelectCore( TSourcePtr proxySource = new TNestedProxySource(compositeSelect.Get(), CloneContainer(*contentPtr)); if (!subselects.empty()) { /// clone terms for others usage - TVector<TNodePtr> termsCopy; + TVector<TNodePtr> termsCopy; for (const auto& term: terms) { termsCopy.emplace_back(term->Clone()); } @@ -2613,7 +2613,7 @@ public: } private: - TVector<TSourcePtr> Sources; + TVector<TSourcePtr> Sources; const TWriteSettings Settings; }; @@ -2623,7 +2623,7 @@ TSourcePtr BuildUnionAll(TPosition pos, TVector<TSourcePtr>&& sources, const TWr class TOverWindowSource: public IProxySource { public: - TOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource) + TOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource) : IProxySource(pos, origSource) , WindowName(windowName) { @@ -2679,10 +2679,10 @@ public: } private: - const TString WindowName; + const TString WindowName; }; -TSourcePtr BuildOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource) { +TSourcePtr BuildOverWindowSource(TPosition pos, const TString& windowName, ISource* origSource) { return new TOverWindowSource(pos, windowName, origSource); } diff --git a/ydb/library/yql/sql/v1/sql.cpp b/ydb/library/yql/sql/v1/sql.cpp index ab5a8647885..1be0f6e5402 100644 --- a/ydb/library/yql/sql/v1/sql.cpp +++ b/ydb/library/yql/sql/v1/sql.cpp @@ -24,7 +24,7 @@ #include <google/protobuf/repeated_field.h> #include <util/charset/wide.h> -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/set.h> #include <util/generic/ylimits.h> #include <util/string/ascii.h> @@ -110,7 +110,7 @@ static TString Id(const TRule_identifier& node, TTranslation& ctx) { return ctx.Identifier(node.GetToken1()); } -static TString Id(const TRule_id& node, TTranslation& ctx) { +static TString Id(const TRule_id& node, TTranslation& ctx) { // id: identifier | keyword; switch (node.Alt_case()) { case TRule_id::kAltId1: @@ -721,18 +721,18 @@ static std::pair<TString, TString> TableKeyImpl(const TRule_table_key& node, TTr } /// \return optional prefix -static TString ColumnNameAsStr(TTranslation& ctx, const TRule_column_name& node, TString& id) { +static TString ColumnNameAsStr(TTranslation& ctx, const TRule_column_name& node, TString& id) { id = Id(node.GetRule_an_id2(), ctx); return OptIdPrefixAsStr(node.GetRule_opt_id_prefix1(), ctx); } -static TString ColumnNameAsSingleStr(TTranslation& ctx, const TRule_column_name& node) { - TString body; - const TString prefix = ColumnNameAsStr(ctx, node, body); +static TString ColumnNameAsSingleStr(TTranslation& ctx, const TRule_column_name& node) { + TString body; + const TString prefix = ColumnNameAsStr(ctx, node, body); return prefix ? prefix + '.' + body : body; } -static void FillTargetList(TTranslation& ctx, const TRule_set_target_list& node, TVector<TString>& targetList) { +static void FillTargetList(TTranslation& ctx, const TRule_set_target_list& node, TVector<TString>& targetList) { targetList.push_back(ColumnNameAsSingleStr(ctx, node.GetRule_set_target2().GetRule_column_name1())); for (auto& block: node.GetBlock3()) { targetList.push_back(ColumnNameAsSingleStr(ctx, block.GetRule_set_target2().GetRule_column_name1())); @@ -764,7 +764,7 @@ static TTableHints GetTableFuncHints(TStringBuf funcName) { return res; } -static bool ValidateForCounters(const TString& input) { +static bool ValidateForCounters(const TString& input) { for (auto c : input) { if (!(IsAlnum(c) || c == '_')) { return false; @@ -773,7 +773,7 @@ static bool ValidateForCounters(const TString& input) { return true; } -static bool IsColumnsOnly(const TVector<TSortSpecificationPtr>& container) { +static bool IsColumnsOnly(const TVector<TSortSpecificationPtr>& container) { for (const auto& elem: container) { if (!elem->OrderExpr->GetColumnName()) { return false; @@ -821,7 +821,7 @@ protected: bool NamedExprList(const TRule_named_expr_list& node, TVector<TNodePtr>& exprs, EExpr exprMode = EExpr::Regular); bool BindList(const TRule_bind_parameter_list& node, TVector<TSymbolNameWithPos>& bindNames); bool ActionOrSubqueryArgs(const TRule_action_or_subquery_args& node, TVector<TSymbolNameWithPos>& bindNames, ui32& optionalArgsCount); - bool ModulePath(const TRule_module_path& node, TVector<TString>& path); + bool ModulePath(const TRule_module_path& node, TVector<TString>& path); bool NamedBindList(const TRule_named_bind_parameter_list& node, TVector<TSymbolNameWithPos>& names, TVector<TSymbolNameWithPos>& aliases); bool NamedBindParam(const TRule_named_bind_parameter& node, TSymbolNameWithPos& name, TSymbolNameWithPos& alias); @@ -970,7 +970,7 @@ private: TNodePtr UnaryExpr(const TUnarySubExprRule& node, const TTrailingQuestions& tail); bool SqlLambdaParams(const TNodePtr& node, TVector<TSymbolNameWithPos>& args, ui32& optionalArgumentsCount); - bool SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& node, TVector<TNodePtr>& exprSeq); + bool SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& node, TVector<TNodePtr>& exprSeq); bool SqlLambdaExprBody(TContext& ctx, const TRule_expr& node, TVector<TNodePtr>& exprSeq); TNodePtr KeyExpr(const TRule_key_expr& node) { @@ -1060,7 +1060,7 @@ private: template <typename TGetNode, typename TIter> TNodePtr BinOpList(const TRule_eq_subexpr& node, TGetNode getNode, TIter begin, TIter end, const TTrailingQuestions& tail); - TNodePtr BinOperList(const TString& opName, TVector<TNodePtr>::const_iterator begin, TVector<TNodePtr>::const_iterator end) const; + TNodePtr BinOperList(const TString& opName, TVector<TNodePtr>::const_iterator begin, TVector<TNodePtr>::const_iterator end) const; struct TCaseBranch { TNodePtr Pred; @@ -1082,7 +1082,7 @@ private: ESmartParenthesis SmartParenthesisMode = ESmartParenthesis::Default; - THashMap<TString, TNodePtr> ExprShortcuts; + THashMap<TString, TNodePtr> ExprShortcuts; }; class TSqlCallExpr: public TSqlTranslation { @@ -1092,7 +1092,7 @@ public: { } - TSqlCallExpr(const TSqlCallExpr& call, const TVector<TNodePtr>& args) + TSqlCallExpr(const TSqlCallExpr& call, const TVector<TNodePtr>& args) : TSqlTranslation(call.Ctx, call.Mode) , Pos(call.Pos) , Func(call.Func) @@ -1129,7 +1129,7 @@ public: } TNodePtr BuildCall() { - TVector<TNodePtr> args; + TVector<TNodePtr> args; bool warnOnYqlNameSpace = true; if (Node && !Node->FuncName()) { Module = "YQL"; @@ -1187,7 +1187,7 @@ public: return Pos; } - const TVector<TNodePtr>& GetArgs() const { + const TVector<TNodePtr>& GetArgs() const { return Args; } @@ -1214,9 +1214,9 @@ private: TString Func; TString Module; TNodePtr Node; - TVector<TNodePtr> Args; - TVector<TNodePtr> PositionalArgs; - TVector<TNodePtr> NamedArgs; + TVector<TNodePtr> Args; + TVector<TNodePtr> PositionalArgs; + TVector<TNodePtr> NamedArgs; EAggregateMode AggMode = EAggregateMode::Normal; TString WindowName; bool DistinctAllowed = false; @@ -1308,7 +1308,7 @@ bool TSqlTranslation::ActionOrSubqueryArgs(const TRule_action_or_subquery_args& return true; } -bool TSqlTranslation::ModulePath(const TRule_module_path& node, TVector<TString>& path) { +bool TSqlTranslation::ModulePath(const TRule_module_path& node, TVector<TString>& path) { if (node.HasBlock1()) { path.emplace_back(TString()); } @@ -2813,7 +2813,7 @@ TNodePtr TSqlTranslation::TypeNode(const TRule_type_name_composite& node) { return AddOptionals(result, node.GetBlock2().size()); } -bool Expr(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_expr& node) { +bool Expr(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_expr& node) { TNodePtr exprNode = sqlExpr.Build(node); if (!exprNode) { return false; @@ -2822,7 +2822,7 @@ bool Expr(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_exp return true; } -bool ExprList(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_expr_list& node) { +bool ExprList(TSqlExpression& sqlExpr, TVector<TNodePtr>& exprNodes, const TRule_expr_list& node) { if (!Expr(sqlExpr, exprNodes, node.GetRule_expr1())) { return false; } @@ -3484,13 +3484,13 @@ public: TSourcePtr Build(const TRule_select_unparenthesized_stmt& node, TPosition& selectPos); private: - bool SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& node); - bool ValidateSelectColumns(const TVector<TNodePtr>& terms); + bool SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& node); + bool ValidateSelectColumns(const TVector<TNodePtr>& terms); bool ColumnName(TVector<TNodePtr>& keys, const TRule_column_name& node); bool ColumnName(TVector<TNodePtr>& keys, const TRule_without_column_name& node); template<typename TRule> bool ColumnList(TVector<TNodePtr>& keys, const TRule& node); - bool NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_column& node); + bool NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_column& node); TSourcePtr SingleSource(const TRule_single_source& node, const TVector<TString>& derivedColumns, TPosition derivedColumnsPos, bool unorderedSubquery); TSourcePtr NamedSingleSource(const TRule_named_single_source& node, bool unorderedSubquery); bool FlattenByArg(const TString& sourceLabel, TVector<TNodePtr>& flattenByColumns, TVector<TNodePtr>& flattenByExprs, const TRule_flatten_by_arg& node); @@ -3570,7 +3570,7 @@ class TGroupByClause: public TSqlTranslation { typedef TIntrusivePtr<TGroupByClauseCtx> TPtr; TGroupingSetFeatures GroupFeatures; - TMap<TString, TNodePtr> NodeAliases; + TMap<TString, TNodePtr> NodeAliases; size_t UnnamedCount = 0; }; @@ -3584,9 +3584,9 @@ public: bool Build(const TRule_group_by_clause& node, bool stream); bool ParseList(const TRule_grouping_element_list& groupingListNode, EGroupByFeatures featureContext); - void SetFeatures(const TString& field) const; - TVector<TNodePtr>& Content(); - TMap<TString, TNodePtr>& Aliases(); + void SetFeatures(const TString& field) const; + TVector<TNodePtr>& Content(); + TMap<TString, TNodePtr>& Aliases(); THoppingWindowSpecPtr GetHoppingWindow() const; bool IsCompactGroupBy() const; @@ -3594,7 +3594,7 @@ private: TMaybe<TVector<TNodePtr>> MultiplyGroupingSets(const TVector<TNodePtr>& lhs, const TVector<TNodePtr>& rhs) const; bool ResolveGroupByAndGrouping(); bool GroupingElement(const TRule_grouping_element& node, EGroupByFeatures featureContext); - void FeedCollection(const TNodePtr& elem, TVector<TNodePtr>& collection, bool& hasEmpty) const; + void FeedCollection(const TNodePtr& elem, TVector<TNodePtr>& collection, bool& hasEmpty) const; bool OrdinaryGroupingSet(const TRule_ordinary_grouping_set& node, EGroupByFeatures featureContext); bool OrdinaryGroupingSetList(const TRule_ordinary_grouping_set_list& node, EGroupByFeatures featureContext); bool HoppingWindow(const TRule_hopping_window_specification& node); @@ -3603,20 +3603,20 @@ private: TGroupingSetFeatures& Features(); const TGroupingSetFeatures& Features() const; - bool AddAlias(const TString& label, const TNodePtr& node); - TString GenerateGroupByExprName(); - bool IsAutogenerated(const TString* name) const; + bool AddAlias(const TString& label, const TNodePtr& node); + TString GenerateGroupByExprName(); + bool IsAutogenerated(const TString* name) const; - TVector<TNodePtr> GroupBySet; + TVector<TNodePtr> GroupBySet; TGroupByClauseCtx::TPtr GroupSetContext; THoppingWindowSpecPtr HoppingWindowSpec; // stream queries - static const TString AutogenerateNamePrefix; + static const TString AutogenerateNamePrefix; bool CompactGroupBy; }; -const TString TGroupByClause::AutogenerateNamePrefix = "group"; +const TString TGroupByClause::AutogenerateNamePrefix = "group"; -bool ParseNumbers(TContext& ctx, const TString& strOrig, ui64& value, TString& suffix) { +bool ParseNumbers(TContext& ctx, const TString& strOrig, ui64& value, TString& suffix) { const auto str = to_lower(strOrig); const auto strLen = str.size(); ui64 base = 10; @@ -3638,7 +3638,7 @@ bool ParseNumbers(TContext& ctx, const TString& strOrig, ui64& value, TString& s if (*iter == 'u') { --iter; } - suffix = TString(++iter, str.cend()); + suffix = TString(++iter, str.cend()); } value = 0; const TString digString(str.begin() + (base == 10 ? 0 : 2), str.end() - suffix.size()); @@ -3668,9 +3668,9 @@ bool ParseNumbers(TContext& ctx, const TString& strOrig, ui64& value, TString& s } TNodePtr LiteralNumber(TContext& ctx, const TRule_integer& node) { - const TString intergerString = ctx.Token(node.GetToken1()); + const TString intergerString = ctx.Token(node.GetToken1()); ui64 value; - TString suffix; + TString suffix; if (!ParseNumbers(ctx, intergerString, value, suffix)) { return {}; } @@ -3706,7 +3706,7 @@ TNodePtr LiteralNumber(TContext& ctx, const TRule_integer& node) { } TNodePtr LiteralReal(TContext& ctx, const TRule_real& node) { - const TString value(ctx.Token(node.GetToken1())); + const TString value(ctx.Token(node.GetToken1())); YQL_ENSURE(!value.empty()); const auto lastValue = value[value.size() - 1]; if (lastValue == 'f' || lastValue == 'F') { @@ -3728,7 +3728,7 @@ TMaybe<TExprOrIdent> TSqlExpression::LiteralExpr(const TRule_literal_value& node break; } case TRule_literal_value::kAltLiteralValue3: { - const TString value(Token(node.GetAlt_literal_value3().GetToken1())); + const TString value(Token(node.GetAlt_literal_value3().GetToken1())); return BuildLiteralTypedSmartStringOrId(Ctx, value); } case TRule_literal_value::kAltLiteralValue5: { @@ -4623,7 +4623,7 @@ TMaybe<TExprOrIdent> TSqlExpression::AtomExpr(const TRule_atom_expr& node, const const auto& alt = node.GetAlt_atom_expr7(); TString module(Id(alt.GetRule_an_id_or_type1(), *this)); TPosition pos(Ctx.Pos()); - TString name; + TString name; switch (alt.GetBlock3().Alt_case()) { case TRule_atom_expr::TAlt7::TBlock3::kAlt1: name = Id(alt.GetBlock3().GetAlt1().GetRule_id_or_type1(), *this); @@ -4779,7 +4779,7 @@ bool TSqlExpression::SqlLambdaParams(const TNodePtr& node, TVector<TSymbolNameWi Ctx.Error(node->GetPos()) << errMsg; return false; } - THashSet<TString> dupArgsChecker; + THashSet<TString> dupArgsChecker; for (const auto& argPtr: tupleNodePtr->Elements()) { auto contentPtr = argPtr->GetAtomContent(); if (!contentPtr || !contentPtr->StartsWith("$")) { @@ -4812,9 +4812,9 @@ bool TSqlExpression::SqlLambdaExprBody(TContext& ctx, const TRule_expr& node, TV return true; } -bool TSqlExpression::SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& node, TVector<TNodePtr>& exprSeq) { +bool TSqlExpression::SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& node, TVector<TNodePtr>& exprSeq) { TSqlExpression expr(ctx, ctx.Settings.Mode); - TVector<TString> localNames; + TVector<TString> localNames; bool hasError = false; for (auto& block: node.GetBlock2()) { const auto& rule = block.GetRule_lambda_stmt1(); @@ -4884,7 +4884,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_con_subexpr& node, const TTrailingQ return UnaryExpr(node.GetAlt_con_subexpr1().GetRule_unary_subexpr1(), tail); case TRule_con_subexpr::kAltConSubexpr2: { Ctx.IncrementMonCounter("sql_features", "UnaryOperation"); - TString opName; + TString opName; auto token = node.GetAlt_con_subexpr2().GetRule_unary_op1().GetToken1(); Token(token); TPosition pos(Ctx.Pos()); @@ -4921,17 +4921,17 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node, const TTrailingQ case TRule_cond_expr::kAltCondExpr1: { const auto& matchOp = cond.GetAlt_cond_expr1(); const bool notMatch = matchOp.HasBlock1(); - const TCiString& opName = Token(matchOp.GetRule_match_op2().GetToken1()); + const TCiString& opName = Token(matchOp.GetRule_match_op2().GetToken1()); const auto& pattern = SubExpr(cond.GetAlt_cond_expr1().GetRule_eq_subexpr3(), matchOp.HasBlock4() ? TTrailingQuestions{} : tail); if (!pattern) { return {}; } TNodePtr isMatch; if (opName == "like" || opName == "ilike") { - const TString* escapeLiteral = nullptr; + const TString* escapeLiteral = nullptr; TNodePtr escapeNode; const auto& escaper = BuildUdf(Ctx, pos, "Re2", "PatternFromLike", {}); - TVector<TNodePtr> escaperArgs({ escaper, pattern }); + TVector<TNodePtr> escaperArgs({ escaper, pattern }); if (matchOp.HasBlock4()) { const auto& escapeBlock = matchOp.GetBlock4(); @@ -5038,7 +5038,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node, const TTrailingQ } else if (opName == "regexp" || opName == "rlike" || opName == "match") { if (matchOp.HasBlock4()) { Ctx.IncrementMonCounter("sql_errors", "RegexpEscape"); - TString opNameUpper(opName); + TString opNameUpper(opName); opNameUpper.to_upper(); Error() << opName << " and ESCAPE clauses should not be used together"; return nullptr; @@ -5136,7 +5136,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node, const TTrailingQ return res; } -TNodePtr TSqlExpression::BinOperList(const TString& opName, TVector<TNodePtr>::const_iterator begin, TVector<TNodePtr>::const_iterator end) const { +TNodePtr TSqlExpression::BinOperList(const TString& opName, TVector<TNodePtr>::const_iterator begin, TVector<TNodePtr>::const_iterator end) const { TPosition pos(Ctx.Pos()); const size_t opCount = end - begin; Y_VERIFY_DEBUG(opCount >= 2); @@ -5180,7 +5180,7 @@ TNodePtr TSqlExpression::BinOper(const TString& opName, const TNode& node, TGetN } Ctx.IncrementMonCounter("sql_binary_operations", opName); const size_t listSize = end - begin; - TVector<TNodePtr> nodes; + TVector<TNodePtr> nodes; nodes.reserve(1 + listSize); nodes.push_back(SubExpr(node, {})); for (; begin != end; ++begin) { @@ -5196,7 +5196,7 @@ TNodePtr TSqlExpression::BinOpList(const TNode& node, TGetNode getNode, TIter be Ctx.IncrementMonCounter("sql_features", "BinaryOperation"); Token(begin->GetToken1()); TPosition pos(Ctx.Pos()); - TString opName; + TString opName; auto tokenId = begin->GetToken1().GetId(); switch (tokenId) { case SQLv1LexerTokens::TOKEN_LESS: @@ -5410,7 +5410,7 @@ TNodePtr TSqlExpression::SqlInExpr(const TRule_in_expr& node, const TTrailingQue } TNodePtr TSqlExpression::SmartParenthesis(const TRule_smart_parenthesis& node) { - TVector<TNodePtr> exprs; + TVector<TNodePtr> exprs; Token(node.GetToken1()); const TPosition pos(Ctx.Pos()); const bool isTuple = node.HasBlock3(); @@ -5506,7 +5506,7 @@ TNodePtr TSqlTranslation::NamedNode(const TRule_named_nodes_stmt& rule, TVector< } bool TSqlTranslation::ImportStatement(const TRule_import_stmt& stmt, TVector<TString>* namesPtr) { - TVector<TString> modulePath; + TVector<TString> modulePath; if (!ModulePath(stmt.GetRule_module_path2(), modulePath)) { return false; } @@ -5564,7 +5564,7 @@ bool TSqlSelect::JoinOp(ISource* join, const TRule_join_source::TBlock3& block, Error() << "Natural join is not implemented yet"; return false; } - TString joinOp("Inner"); + TString joinOp("Inner"); TJoinLinkSettings linkSettings; linkSettings.ForceSortedMerge = alt.HasBlock3(); switch (alt.GetBlock2().Alt_case()) { @@ -5842,7 +5842,7 @@ TSourcePtr TSqlSelect::JoinSource(const TRule_join_source& node) { if (node.Block3Size()) { TPosition pos(Ctx.Pos()); - TVector<TSourcePtr> sources; + TVector<TSourcePtr> sources; TVector<TMaybe<TPosition>> anyPositions; TVector<bool> anyFlags; @@ -5879,7 +5879,7 @@ TSourcePtr TSqlSelect::JoinSource(const TRule_join_source& node) { return source; } -bool TSqlSelect::SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& node) { +bool TSqlSelect::SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& node) { // result_column: // opt_id_prefix ASTERISK // | expr ((AS an_id) | an_id_pure)? @@ -5936,12 +5936,12 @@ bool TSqlSelect::SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& return true; } -bool TSqlSelect::ValidateSelectColumns(const TVector<TNodePtr>& terms) { - TSet<TString> labels; - TSet<TString> asteriskSources; +bool TSqlSelect::ValidateSelectColumns(const TVector<TNodePtr>& terms) { + TSet<TString> labels; + TSet<TString> asteriskSources; for (const auto& term: terms) { const auto& label = term->GetLabel(); - if (!Ctx.PragmaAllowDotInAlias && label.find('.') != TString::npos) { + if (!Ctx.PragmaAllowDotInAlias && label.find('.') != TString::npos) { Ctx.Error(term->GetPos()) << "Unable to use '.' in column name. Invalid column name: " << label; return false; } @@ -6089,7 +6089,7 @@ TSourcePtr TSqlSelect::NamedSingleSource(const TRule_named_single_source& node, { const auto& tableSampleClause = sampleBlock.GetAlt2().GetRule_tablesample_clause1(); const auto& modeToken = tableSampleClause.GetRule_sampling_mode2().GetToken1(); - const TCiString& token = Token(modeToken); + const TCiString& token = Token(modeToken); if (token == "system") { mode = ESampleMode::System; } else if (token == "bernoulli") { @@ -6194,7 +6194,7 @@ bool TSqlSelect::ColumnList(TVector<TNodePtr>& keys, const TRule& node) { return true; } -bool TSqlSelect::NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_column& node) { +bool TSqlSelect::NamedColumn(TVector<TNodePtr>& columnList, const TRule_named_column& node) { if (!ColumnName(columnList, node.GetRule_column_name1())) { return false; } @@ -6462,14 +6462,14 @@ TSourcePtr TSqlSelect::ReduceCore(const TRule_reduce_core& node, const TWriteSet source = BuildMuxSource(pos, std::move(sources)); } - TVector<TSortSpecificationPtr> orderBy; + TVector<TSortSpecificationPtr> orderBy; if (node.HasBlock4()) { if (!SortSpecificationList(node.GetBlock4().GetRule_sort_specification_list2(), orderBy)) { return {}; } } - TVector<TNodePtr> keys; + TVector<TNodePtr> keys; if (!ColumnList(keys, node.GetRule_column_list6())) { return nullptr; } @@ -6584,7 +6584,7 @@ TSourcePtr TSqlSelect::SelectCore(const TRule_select_core& node, const TWriteSet } const bool selectStream = node.HasBlock3(); - TVector<TNodePtr> without; + TVector<TNodePtr> without; if (node.HasBlock8()) { if (!ColumnList(without, node.GetBlock8().GetRule_without_column_list2())) { return nullptr; @@ -6612,7 +6612,7 @@ TSourcePtr TSqlSelect::SelectCore(const TRule_select_core& node, const TWriteSet } /// \todo merge gtoupByExpr and groupBy in one - TVector<TNodePtr> groupByExpr, groupBy; + TVector<TNodePtr> groupByExpr, groupBy; THoppingWindowSpecPtr hoppingWindowSpec; bool compactGroupBy = false; if (node.HasBlock11()) { @@ -6654,7 +6654,7 @@ TSourcePtr TSqlSelect::SelectCore(const TRule_select_core& node, const TWriteSet } bool assumeSorted = false; - TVector<TSortSpecificationPtr> orderBy; + TVector<TSortSpecificationPtr> orderBy; if (node.HasBlock14()) { auto& orderBlock = node.GetBlock14().GetRule_ext_order_by_clause1(); assumeSorted = orderBlock.HasBlock1(); @@ -6684,7 +6684,7 @@ TSourcePtr TSqlSelect::SelectCore(const TRule_select_core& node, const TWriteSet } } - TVector<TNodePtr> terms; + TVector<TNodePtr> terms; { class TScopedWinSpecs { public: @@ -6854,7 +6854,7 @@ bool TSqlTranslation::FrameBound(const TRule_window_frame_bound& rule, TFrameBou bool TSqlTranslation::FrameClause(const TRule_window_frame_clause& rule, TFrameSpecificationPtr& frameSpec) { frameSpec = new TFrameSpecification; - const TString frameUnitStr = to_lower(Token(rule.GetRule_window_frame_units1().GetToken1())); + const TString frameUnitStr = to_lower(Token(rule.GetRule_window_frame_units1().GetToken1())); if (frameUnitStr == "rows") { frameSpec->FrameType = EFrameType::FrameByRows; } else if (frameUnitStr == "range") { @@ -7065,7 +7065,7 @@ bool TGroupByClause::ParseList(const TRule_grouping_element_list& groupingListNo return true; } -void TGroupByClause::SetFeatures(const TString& field) const { +void TGroupByClause::SetFeatures(const TString& field) const { Ctx.IncrementMonCounter(field, "GroupBy"); const auto& features = Features(); if (features.Test(EGroupByFeatures::Ordinary)) { @@ -7088,11 +7088,11 @@ void TGroupByClause::SetFeatures(const TString& field) const { } } -TVector<TNodePtr>& TGroupByClause::Content() { +TVector<TNodePtr>& TGroupByClause::Content() { return GroupBySet; } -TMap<TString, TNodePtr>& TGroupByClause::Aliases() { +TMap<TString, TNodePtr>& TGroupByClause::Aliases() { return GroupSetContext->NodeAliases; } @@ -7105,7 +7105,7 @@ bool TGroupByClause::IsCompactGroupBy() const { } TMaybe<TVector<TNodePtr>> TGroupByClause::MultiplyGroupingSets(const TVector<TNodePtr>& lhs, const TVector<TNodePtr>& rhs) const { - TVector<TNodePtr> content; + TVector<TNodePtr> content; for (const auto& leftNode: lhs) { auto leftPtr = leftNode->ContentListPtr(); if (!leftPtr) { @@ -7114,7 +7114,7 @@ TMaybe<TVector<TNodePtr>> TGroupByClause::MultiplyGroupingSets(const TVector<TNo return {}; } for (const auto& rightNode: rhs) { - TVector<TNodePtr> mulItem(leftPtr->begin(), leftPtr->end()); + TVector<TNodePtr> mulItem(leftPtr->begin(), leftPtr->end()); auto rightPtr = rightNode->ContentListPtr(); if (!rightPtr) { // TODO: shouldn't happen @@ -7137,8 +7137,8 @@ bool TGroupByClause::ResolveGroupByAndGrouping() { } auto curContent = *(*listPos)->ContentListPtr(); if (listPos != GroupBySet.begin()) { - TVector<TNodePtr> emulate(GroupBySet.begin(), listPos); - TVector<TNodePtr> emulateContent(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(emulate))); + TVector<TNodePtr> emulate(GroupBySet.begin(), listPos); + TVector<TNodePtr> emulateContent(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(emulate))); auto mult = MultiplyGroupingSets(emulateContent, curContent); if (!mult) { return false; @@ -7154,8 +7154,8 @@ bool TGroupByClause::ResolveGroupByAndGrouping() { } curContent = *mult; } else { - TVector<TNodePtr> emulate(1, *listPos); - TVector<TNodePtr> emulateContent(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(emulate))); + TVector<TNodePtr> emulate(1, *listPos); + TVector<TNodePtr> emulateContent(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(emulate))); auto mult = MultiplyGroupingSets(curContent, emulateContent); if (!mult) { return false; @@ -7163,14 +7163,14 @@ bool TGroupByClause::ResolveGroupByAndGrouping() { curContent = *mult; } } - TVector<TNodePtr> result(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(curContent))); + TVector<TNodePtr> result(1, BuildListOfNamedNodes(Ctx.Pos(), std::move(curContent))); std::swap(result, GroupBySet); return true; } bool TGroupByClause::GroupingElement(const TRule_grouping_element& node, EGroupByFeatures featureContext) { TSourcePtr res; - TVector<TNodePtr> emptyContent; + TVector<TNodePtr> emptyContent; switch (node.Alt_case()) { case TRule_grouping_element::kAltGroupingElement1: if (!OrdinaryGroupingSet(node.GetAlt_grouping_element1().GetRule_ordinary_grouping_set1(), featureContext)) { @@ -7186,9 +7186,9 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node, EGroupB return false; } auto& content = subClause.Content(); - TVector<TNodePtr> collection; + TVector<TNodePtr> collection; for (auto limit = content.end(), begin = content.begin(); limit != begin; --limit) { - TVector<TNodePtr> grouping(begin, limit); + TVector<TNodePtr> grouping(begin, limit); collection.push_back(BuildListOfNamedNodes(Ctx.Pos(), std::move(grouping))); } collection.push_back(BuildListOfNamedNodes(Ctx.Pos(), std::move(emptyContent))); @@ -7209,9 +7209,9 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node, EGroupB Ctx.Error() << "GROUP BY CUBE is allowed only for " << Ctx.PragmaGroupByCubeLimit << " columns, but you use " << content.size(); return false; } - TVector<TNodePtr> collection; + TVector<TNodePtr> collection; for (unsigned mask = (1 << content.size()) - 1; mask > 0; --mask) { - TVector<TNodePtr> grouping; + TVector<TNodePtr> grouping; for (unsigned index = 0; index < content.size(); ++index) { if (mask & (1 << index)) { grouping.push_back(content[content.size() - index - 1]); @@ -7232,7 +7232,7 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node, EGroupB return false; } auto& content = subClause.Content(); - TVector<TNodePtr> collection; + TVector<TNodePtr> collection; bool hasEmpty = false; for (auto& elem: content) { auto elemContent = elem->ContentListPtr(); @@ -7245,7 +7245,7 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node, EGroupB FeedCollection(elem, collection, hasEmpty); } } else { - TVector<TNodePtr> elemList(1, std::move(elem)); + TVector<TNodePtr> elemList(1, std::move(elem)); collection.push_back(BuildListOfNamedNodes(Ctx.Pos(), std::move(elemList))); } } @@ -7265,7 +7265,7 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node, EGroupB return true; } -void TGroupByClause::FeedCollection(const TNodePtr& elem, TVector<TNodePtr>& collection, bool& hasEmpty) const { +void TGroupByClause::FeedCollection(const TNodePtr& elem, TVector<TNodePtr>& collection, bool& hasEmpty) const { auto elemContentPtr = elem->ContentListPtr(); if (elemContentPtr && elemContentPtr->empty()) { if (hasEmpty) { @@ -7443,7 +7443,7 @@ const TGroupByClause::TGroupingSetFeatures& TGroupByClause::Features() const { return GroupSetContext->GroupFeatures; } -bool TGroupByClause::AddAlias(const TString& label, const TNodePtr& node) { +bool TGroupByClause::AddAlias(const TString& label, const TNodePtr& node) { if (Aliases().contains(label)) { Ctx.Error() << "Duplicated aliases not allowed"; Ctx.IncrementMonCounter("sql_errors", "GroupByDuplicateAliases"); @@ -7453,7 +7453,7 @@ bool TGroupByClause::AddAlias(const TString& label, const TNodePtr& node) { return true; } -TString TGroupByClause::GenerateGroupByExprName() { +TString TGroupByClause::GenerateGroupByExprName() { return TStringBuilder() << AutogenerateNamePrefix << GroupSetContext->UnnamedCount++; } @@ -7631,7 +7631,7 @@ TSqlSelect::TSelectKindResult TSqlSelect::SelectKind(const TRule_select_kind_par template<typename TRule> TSourcePtr TSqlSelect::Build(const TRule& node, TPosition pos, TSelectKindResult&& first) { TPosition unionPos = pos; // Position of first select - TVector<TSourcePtr> sources; + TVector<TSourcePtr> sources; sources.emplace_back(std::move(first.Source)); TVector<TSortSpecificationPtr> orderBy; @@ -7853,7 +7853,7 @@ TSourcePtr TSqlIntoValues::ValuesSource(const TRule_values_source& node, TVector TPosition pos(Ctx.Pos()); switch (node.Alt_case()) { case TRule_values_source::kAltValuesSource1: { - TVector<TVector<TNodePtr>> rows {{}}; + TVector<TVector<TNodePtr>> rows {{}}; const auto& rowList = node.GetAlt_values_source1().GetRule_values_stmt1().GetRule_values_source_row_list2(); if (!BuildRows(rowList, rows)) { return nullptr; @@ -7897,7 +7897,7 @@ private: }; TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) { - static const TMap<TString, ESQLWriteColumnMode> str2Mode = { + static const TMap<TString, ESQLWriteColumnMode> str2Mode = { {"InsertInto", ESQLWriteColumnMode::InsertInto}, {"InsertOrAbortInto", ESQLWriteColumnMode::InsertOrAbortInto}, {"InsertOrIgnoreInto", ESQLWriteColumnMode::InsertOrIgnoreInto}, @@ -8164,13 +8164,13 @@ private: bool AlterTableAlterChangefeed(const TRule_alter_table_alter_changefeed& node, TAlterTableParameters& params); void AlterTableDropChangefeed(const TRule_alter_table_drop_changefeed& node, TAlterTableParameters& params); TNodePtr PragmaStatement(const TRule_pragma_stmt& stmt, bool& success); - void AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node); + void AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node); TNodePtr Build(const TRule_delete_stmt& stmt); TNodePtr Build(const TRule_update_stmt& stmt); TSourcePtr Build(const TRule_set_clause_choice& stmt); - bool FillSetClause(const TRule_set_clause& node, TVector<TString>& targetList, TVector<TNodePtr>& values); + bool FillSetClause(const TRule_set_clause& node, TVector<TString>& targetList, TVector<TNodePtr>& values); TSourcePtr Build(const TRule_set_clause_list& stmt); TSourcePtr Build(const TRule_multiple_column_assignment& stmt); @@ -8179,10 +8179,10 @@ private: internalStatementName.clear(); humanStatementName.clear(); const auto& descr = AltDescription(node); - TVector<TString> parts; + TVector<TString> parts; const auto pos = descr.find(": "); - Y_VERIFY_DEBUG(pos != TString::npos); - Split(TString(descr.begin() + pos + 2, descr.end()), "_", parts); + Y_VERIFY_DEBUG(pos != TString::npos); + Split(TString(descr.begin() + pos + 2, descr.end()), "_", parts); Y_VERIFY_DEBUG(parts.size() > 1); parts.pop_back(); for (auto& part: parts) { @@ -8290,7 +8290,7 @@ TNodePtr TSqlTranslation::DoStatement(const TRule_do_stmt& stmt, bool makeLambda } } -void TSqlQuery::AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node) { +void TSqlQuery::AddStatementToBlocks(TVector<TNodePtr>& blocks, TNodePtr node) { blocks.emplace_back(node); } @@ -9134,9 +9134,9 @@ void TSqlQuery::AlterTableDropChangefeed(const TRule_alter_table_drop_changefeed TNodePtr TSqlQuery::PragmaStatement(const TRule_pragma_stmt& stmt, bool& success) { success = false; const TString& prefix = OptIdPrefixAsStr(stmt.GetRule_opt_id_prefix_or_type2(), *this); - const TString& lowerPrefix = to_lower(prefix); + const TString& lowerPrefix = to_lower(prefix); const TString pragma(Id(stmt.GetRule_an_id3(), *this)); - TString normalizedPragma(pragma); + TString normalizedPragma(pragma); TMaybe<TIssue> normalizeError = NormalizeName(Ctx.Pos(), normalizedPragma); if (!normalizeError.Empty()) { Error() << normalizeError->Message; @@ -9145,7 +9145,7 @@ TNodePtr TSqlQuery::PragmaStatement(const TRule_pragma_stmt& stmt, bool& success } TVector<TDeferredAtom> values; - TVector<const TRule_pragma_value*> pragmaValues; + TVector<const TRule_pragma_value*> pragmaValues; bool pragmaValueDefault = false; if (stmt.GetBlock4().HasAlt1()) { pragmaValues.push_back(&stmt.GetBlock4().GetAlt1().GetRule_pragma_value2()); @@ -9788,7 +9788,7 @@ TSourcePtr TSqlQuery::Build(const TRule_set_clause_choice& stmt) { } } -bool TSqlQuery::FillSetClause(const TRule_set_clause& node, TVector<TString>& targetList, TVector<TNodePtr>& values) { +bool TSqlQuery::FillSetClause(const TRule_set_clause& node, TVector<TString>& targetList, TVector<TNodePtr>& values) { targetList.push_back(ColumnNameAsSingleStr(*this, node.GetRule_set_target1().GetRule_column_name1())); TColumnRefScope scope(Ctx, EColumnRefState::Allow); TSqlExpression sqlExpr(Ctx, Mode); @@ -9799,8 +9799,8 @@ bool TSqlQuery::FillSetClause(const TRule_set_clause& node, TVector<TString>& ta } TSourcePtr TSqlQuery::Build(const TRule_set_clause_list& stmt) { - TVector<TString> targetList; - TVector<TNodePtr> values; + TVector<TString> targetList; + TVector<TNodePtr> values; const TPosition pos(Ctx.Pos()); if (!FillSetClause(stmt.GetRule_set_clause1(), targetList, values)) { return nullptr; @@ -9815,13 +9815,13 @@ TSourcePtr TSqlQuery::Build(const TRule_set_clause_list& stmt) { } TSourcePtr TSqlQuery::Build(const TRule_multiple_column_assignment& stmt) { - TVector<TString> targetList; + TVector<TString> targetList; FillTargetList(*this, stmt.GetRule_set_target_list1(), targetList); auto simpleValuesNode = stmt.GetRule_simple_values_source4(); const TPosition pos(Ctx.Pos()); switch (simpleValuesNode.Alt_case()) { case TRule_simple_values_source::kAltSimpleValuesSource1: { - TVector<TNodePtr> values; + TVector<TNodePtr> values; TSqlExpression sqlExpr(Ctx, Mode); if (!ExprList(sqlExpr, values, simpleValuesNode.GetAlt_simple_values_source1().GetRule_expr_list1())) { return nullptr; @@ -9846,7 +9846,7 @@ TSourcePtr TSqlQuery::Build(const TRule_multiple_column_assignment& stmt) { TNodePtr TSqlQuery::Build(const TSQLv1ParserAST& ast) { const auto& query = ast.GetRule_sql_query(); - TVector<TNodePtr> blocks; + TVector<TNodePtr> blocks; if (query.Alt_case() == TRule_sql_query::kAltSqlQuery1) { const auto& statements = query.GetAlt_sql_query1().GetRule_sql_stmt_list1(); if (!Statement(blocks, statements.GetRule_sql_stmt2().GetRule_sql_stmt_core2())) { diff --git a/ydb/library/yql/sql/v1/sql_ut.cpp b/ydb/library/yql/sql/v1/sql_ut.cpp index 85b6e0dfcd3..ef1d7295e38 100644 --- a/ydb/library/yql/sql/v1/sql_ut.cpp +++ b/ydb/library/yql/sql/v1/sql_ut.cpp @@ -14,7 +14,7 @@ enum class EDebugOutput { ToCerr, }; -TString Err2Str(NYql::TAstParseResult& res, EDebugOutput debug = EDebugOutput::None) { +TString Err2Str(NYql::TAstParseResult& res, EDebugOutput debug = EDebugOutput::None) { TStringStream s; res.Issues.PrintTo(s); @@ -29,7 +29,7 @@ NYql::TAstParseResult SqlToYqlWithMode(const TString& query, NSQLTranslation::ES { google::protobuf::Arena arena; const auto service = provider ? provider : TString(NYql::YtProviderName); - const TString cluster = "plato"; + const TString cluster = "plato"; settings.ClusterMapping[cluster] = service; settings.ClusterMapping["hahn"] = NYql::YtProviderName; settings.MaxErrors = maxErrors; @@ -71,17 +71,17 @@ void ExpectFailWithErrorForAnsiLexer(const TString& query, const TString& error) UNIT_ASSERT_NO_DIFF(Err2Str(res), error); } -TString GetPrettyPrint(const NYql::TAstParseResult& res) { +TString GetPrettyPrint(const NYql::TAstParseResult& res) { TStringStream yqlProgram; res.Root->PrettyPrintTo(yqlProgram, NYql::TAstPrintFlags::PerLine | NYql::TAstPrintFlags::ShortQuote); return yqlProgram.Str(); } -TString Quote(const char* str) { +TString Quote(const char* str) { return TStringBuilder() << "'\"" << str << "\""; } -class TWordCountHive: public TMap<TString, unsigned> { +class TWordCountHive: public TMap<TString, unsigned> { public: TWordCountHive(std::initializer_list<TString> strings) { for (auto& str: strings) { @@ -90,16 +90,16 @@ public: } TWordCountHive(std::initializer_list<std::pair<const TString, unsigned>> list) - : TMap(list) + : TMap(list) { } }; -typedef std::function<void (const TString& word, const TString& line)> TVerifyLineFunc; +typedef std::function<void (const TString& word, const TString& line)> TVerifyLineFunc; -TString VerifyProgram(const NYql::TAstParseResult& res, TWordCountHive& wordCounter, TVerifyLineFunc verifyLine = TVerifyLineFunc()) { +TString VerifyProgram(const NYql::TAstParseResult& res, TWordCountHive& wordCounter, TVerifyLineFunc verifyLine = TVerifyLineFunc()) { const auto programm = GetPrettyPrint(res); - TVector<TString> yqlProgram; + TVector<TString> yqlProgram; Split(programm, "\n", yqlProgram); for (const auto& line: yqlProgram) { for (auto& counterIter: wordCounter) { @@ -230,7 +230,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { ); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { static bool seenStar = false; if (word == "FlattenMembers") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("interested_table.")); @@ -255,7 +255,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { ); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { static bool seenStar = false; if (word == "FlattenMembers") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("interested_table.")); @@ -277,10 +277,10 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("select interested_table.key, interested_table.value from plato.Input as interested_table;"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { - const bool fieldKey = TString::npos != line.find(Quote("key")); - const bool fieldValue = TString::npos != line.find(Quote("value")); - const bool refOnTable = TString::npos != line.find("interested_table."); + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + const bool fieldKey = TString::npos != line.find(Quote("key")); + const bool fieldValue = TString::npos != line.find(Quote("value")); + const bool refOnTable = TString::npos != line.find("interested_table."); if (word == "SqlProjectItem") { UNIT_ASSERT(fieldKey || fieldValue); UNIT_ASSERT(!refOnTable); @@ -305,15 +305,15 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { ); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "SelectMembers") { - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa.")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("table_bb.")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa.")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("table_bb.")); } else if (word == "SqlProjectItem") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("megakey"))); } else if (word == "SqlColumn") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("table_aa"))); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("key"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("table_aa"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("key"))); } }; TWordCountHive elementStat = {{TString("SqlProjectItem"), 0}, {TString("SqlProjectStarItem"), 0}, {TString("SelectMembers"), 0}, {TString("SqlColumn"), 0}}; @@ -335,17 +335,17 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Err2Str(res); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "SelectMembers") { - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa.")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa.")); UNIT_ASSERT(line.find("table_bb.") != TString::npos || line.find("table_cc.") != TString::npos); } else if (word == "SqlProjectItem") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("gigakey"))); } else if (word == "SqlColumn") { const auto posTableAA = line.find(Quote("table_aa")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, posTableAA); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("key"))); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa", posTableAA + 3)); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, posTableAA); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("key"))); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("table_aa", posTableAA + 3)); } }; TWordCountHive elementStat = {{TString("SqlProjectItem"), 0}, {TString("SqlProjectStarItem"), 0}, {TString("SelectMembers"), 0}, {TString("SqlColumn"), 0}}; @@ -366,7 +366,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { ); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "SqlProjectItem") { UNIT_ASSERT(line.find(Quote("a.v")) != TString::npos || line.find(Quote("b.value")) != TString::npos); } else if (word == "SqlColumn") { @@ -391,10 +391,10 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("SELECT a.value, b.value FROM plato.Input AS a JOIN plato.Input as b ON a.key == b.key;"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "SqlProjectItem") { - const bool isValueFromA = TString::npos != line.find(Quote("a.value")); - const bool isValueFromB = TString::npos != line.find(Quote("b.value")); + const bool isValueFromA = TString::npos != line.find(Quote("a.value")); + const bool isValueFromB = TString::npos != line.find(Quote("b.value")); UNIT_ASSERT(isValueFromA || isValueFromB); } if (word == "Write!") { UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("a.a.")); @@ -446,19 +446,19 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Y_UNIT_TEST(SelectOrderByLabeledColumn) { NYql::TAstParseResult res = SqlToYql("pragma DisableOrderedColumns; select key as goal from plato.Input order by goal"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "DataSource") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("plato")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Input")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("plato")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("Input")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("goal")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("goal")); } else if (word == "Sort") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("goal")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("goal")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("key")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("key")); } }; - TWordCountHive elementStat = {{TString("DataSource"), 0}, {TString("Sort"), 0}}; + TWordCountHive elementStat = {{TString("DataSource"), 0}, {TString("Sort"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["DataSource"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Sort"]); @@ -477,18 +477,18 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Y_UNIT_TEST(SelectOrderByExpression) { NYql::TAstParseResult res = SqlToYql("select * from plato.Input as i order by cast(key as uint32) + cast(subkey as uint32)"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Sort") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"+\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("key")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("subkey")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'true)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"+\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("key")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("subkey")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'true)")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.key")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.subkey")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.key")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.subkey")); } }; - TWordCountHive elementStat = {{TString("Sort"), 0}}; + TWordCountHive elementStat = {{TString("Sort"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Sort"]); } @@ -496,21 +496,21 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Y_UNIT_TEST(SelectOrderByExpressionDesc) { NYql::TAstParseResult res = SqlToYql("pragma disablesimplecolumns; select i.*, key, subkey from plato.Input as i order by cast(i.key as uint32) - cast(i.subkey as uint32) desc"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Sort") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"-\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'false)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"-\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'false)")); } else if (word == "Write!") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("'columns")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("prefix")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"i.\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("'columns")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("prefix")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"i.\"")); } }; - TWordCountHive elementStat = {{TString("Sort"), 0}, {TString("Write!"), 0}}; + TWordCountHive elementStat = {{TString("Sort"), 0}, {TString("Write!"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Sort"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write!"]); @@ -519,20 +519,20 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { Y_UNIT_TEST(SelectOrderByExpressionAsc) { NYql::TAstParseResult res = SqlToYql("select i.key, i.subkey from plato.Input as i order by cast(key as uint32) % cast(i.subkey as uint32) asc"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Sort") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"%\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'true)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"%\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("(Bool 'true)")); } else if (word == "Write!") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("'columns")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); - UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("'columns")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"subkey\"")); + UNIT_ASSERT_VALUES_EQUAL(TString::npos, line.find("i.")); } }; - TWordCountHive elementStat = {{TString("Sort"), 0}, {TString("Write!"), 0}}; + TWordCountHive elementStat = {{TString("Sort"), 0}, {TString("Write!"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Sort"]); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write!"]); @@ -567,14 +567,14 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("USE plato; CREATE TABLE tableName (Key Uint32, Subkey Int64, Value String, PRIMARY KEY (Key, Subkey));"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"Key\"")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"Subkey\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"Key\"")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("\"Subkey\"")); } }; - TWordCountHive elementStat = {{TString("Write"), 0}, {TString("primarykey"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}, {TString("primarykey"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -585,13 +585,13 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("delete from plato.Input where key = 200;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'delete)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'delete)")); } }; - TWordCountHive elementStat = {{TString("Write"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -601,13 +601,13 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("delete from plato.Input;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'delete)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'delete)")); } }; - TWordCountHive elementStat = {{TString("Write"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -651,22 +651,22 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("update plato.Input set key = 777, value = 'cool' where key = 200;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); } else if (word == "AsStruct") { - const bool isKey = line.find("key") != TString::npos; - const bool isValue = line.find("value") != TString::npos; + const bool isKey = line.find("key") != TString::npos; + const bool isValue = line.find("value") != TString::npos; UNIT_ASSERT(isKey || isValue); if (isKey) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("777"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("777"))); } else if (isValue) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("cool"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("cool"))); } } }; - TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -677,25 +677,25 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("update plato.Input set (key, value, subkey) = ('2','ddd',':') where key = 200;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); } else if (word == "AsStruct") { - const bool isKey = line.find("key") != TString::npos; - const bool isSubkey = line.find("subkey") != TString::npos; - const bool isValue = line.find("value") != TString::npos; + const bool isKey = line.find("key") != TString::npos; + const bool isSubkey = line.find("subkey") != TString::npos; + const bool isValue = line.find("value") != TString::npos; UNIT_ASSERT(isKey || isSubkey || isValue); if (isKey && !isSubkey) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("2"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("2"))); } else if (isSubkey) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote(":"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote(":"))); } else if (isValue) { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("ddd"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("ddd"))); } } }; - TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -732,18 +732,18 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("update plato.Input set subkey = subkey + 's';", 10, "kikimr"); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [](const TString& word, const TString& line) { if (word == "Write") { - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("('mode 'update)")); } else if (word == "AsStruct") { - const bool isSubkey = line.find("subkey") != TString::npos; + const bool isSubkey = line.find("subkey") != TString::npos; UNIT_ASSERT(isSubkey); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("subkey"))); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("s"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("subkey"))); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(Quote("s"))); } }; - TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; + TWordCountHive elementStat = {{TString("Write"), 0}, {TString("AsStruct"), 0}}; VerifyProgram(res, elementStat, verifyLine); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); @@ -787,7 +787,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("SELECT key FROM plato.Input UNION ALL select subkey FROM plato.Input;"); UNIT_ASSERT(res.Root); - TWordCountHive elementStat = {{TString("UnionAll"), 0}}; + TWordCountHive elementStat = {{TString("UnionAll"), 0}}; VerifyProgram(res, elementStat, {}); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["UnionAll"]); } @@ -813,7 +813,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql("use plato; select * from Input; rollback;", 10, "kikimr"); UNIT_ASSERT(res.Root); - TWordCountHive elementStat = {{TString("rollback"), 0}}; + TWordCountHive elementStat = {{TString("rollback"), 0}}; VerifyProgram(res, elementStat); UNIT_ASSERT_VALUES_EQUAL(1, elementStat["rollback"]); } @@ -822,7 +822,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { NYql::TAstParseResult res = SqlToYql(R"(pragma file("HW", "sbr:181041334");)"); UNIT_ASSERT(res.Root); - TWordCountHive elementStat = {{TString(R"((let world (Configure! world (DataSource '"config") '"AddFileByUrl" '"HW" '"sbr:181041334")))"), 0}}; + TWordCountHive elementStat = {{TString(R"((let world (Configure! world (DataSource '"config") '"AddFileByUrl" '"HW" '"sbr:181041334")))"), 0}}; VerifyProgram(res, elementStat); UNIT_ASSERT_VALUES_EQUAL(1, elementStat.cbegin()->second); } diff --git a/ydb/library/yql/udfs/common/datetime/datetime_udf.cpp b/ydb/library/yql/udfs/common/datetime/datetime_udf.cpp index 01567c0b1b1..8985a7c6e52 100644 --- a/ydb/library/yql/udfs/common/datetime/datetime_udf.cpp +++ b/ydb/library/yql/udfs/common/datetime/datetime_udf.cpp @@ -27,7 +27,7 @@ namespace { SIMPLE_UDF(TToStringFormat, char*(TAutoMap<TTimestamp>, char*)) { const auto input = args[0].Get<ui64>(); - const TString format(args[1].AsStringRef()); + const TString format(args[1].AsStringRef()); TInstant instant = TInstant::MicroSeconds(input); TSimpleTM tm = TSimpleTM::New(static_cast<time_t>(instant.Seconds())); return valueBuilder->NewString(tm.ToString(format.c_str())); @@ -44,7 +44,7 @@ namespace { Y_UNUSED(valueBuilder); const auto input = args[0].Get<ui64>(); TInstant instant = TInstant::MicroSeconds(input); - const TString tz_name(args[1].AsStringRef()); + const TString tz_name(args[1].AsStringRef()); TTimeZone tz = GetTimeZone(tz_name); TTimeZone gmt_tz = GetTimeZone("GMT+0"); TSimpleTM ct = ToCivilTime(instant, tz); @@ -56,7 +56,7 @@ namespace { Y_UNUSED(valueBuilder); const auto input = args[0].Get<ui64>(); TInstant instant = TInstant::MicroSeconds(input); - const TString tz_name(args[1].AsStringRef()); + const TString tz_name(args[1].AsStringRef()); TTimeZone tz = GetTimeZone(tz_name); TSimpleTM tm = TSimpleTM::New(static_cast<time_t>(instant.Seconds())); TInstant at = ToAbsoluteTime(tm, tz); @@ -84,7 +84,7 @@ namespace { return TUnboxedValuePod(tm.WDay == 0 || tm.WDay == 6); } - bool TryStrptime(const TString& input, const TString& format, TInstant& result) { + bool TryStrptime(const TString& input, const TString& format, TInstant& result) { struct tm inputTm; memset(&inputTm, 0, sizeof(tm)); inputTm.tm_mday = 1; @@ -115,7 +115,7 @@ namespace { TInstant result; ui64 bonus = 0; - const static std::unordered_map<size_t, TString> iso8601withoutTzMap = { + const static std::unordered_map<size_t, TString> iso8601withoutTzMap = { {7, "%Y-%m"}, {10, "%Y-%m-%d"}, {16, "%Y-%m-%d %H:%M"}, @@ -162,7 +162,7 @@ namespace { TUnboxedValue FromStringFormatImpl(const TUnboxedValuePod* args) { EMPTY_RESULT_ON_EMPTY_ARG(0); const TString input(args[0].AsStringRef()); - const TString format(args[1].AsStringRef()); + const TString format(args[1].AsStringRef()); TInstant result; bool success = TryStrptime(input, format, result); diff --git a/ydb/library/yql/udfs/common/histogram/histogram_udf.cpp b/ydb/library/yql/udfs/common/histogram/histogram_udf.cpp index 3cbf685cc1f..bf7b31f11c6 100644 --- a/ydb/library/yql/udfs/common/histogram/histogram_udf.cpp +++ b/ydb/library/yql/udfs/common/histogram/histogram_udf.cpp @@ -121,7 +121,7 @@ namespace { typedef TBoxedResource<THistogramType, ResourceName> THistogramResource; static const TStringRef& Name() { - static auto name = TString(ResourceName).substr(10) + "Histogram_Create"; + static auto name = TString(ResourceName).substr(10) + "Histogram_Create"; static auto nameRef = TStringRef(name); return nameRef; } @@ -172,7 +172,7 @@ namespace { typedef TBoxedResource<THistogramType, ResourceName> THistogramResource; static const TStringRef& Name() { - static auto name = TString(ResourceName).substr(10) + "Histogram_AddValue"; + static auto name = TString(ResourceName).substr(10) + "Histogram_AddValue"; static auto nameRef = TStringRef(name); return nameRef; } @@ -223,7 +223,7 @@ namespace { typedef TBoxedResource<THistogramType, ResourceName> THistogramResource; static const TStringRef& Name() { - static auto name = TString(ResourceName).substr(10) + "Histogram_Serialize"; + static auto name = TString(ResourceName).substr(10) + "Histogram_Serialize"; static auto nameRef = TStringRef(name); return nameRef; } @@ -234,7 +234,7 @@ namespace { const TUnboxedValuePod* args) const override { try { THistogram proto; - TString result; + TString result; static_cast<THistogramResource*>(args[0].AsBoxed().Get())->Get()->ToProto(proto); Y_PROTOBUF_SUPPRESS_NODISCARD proto.SerializeToString(&result); return valueBuilder->NewString(result); @@ -275,7 +275,7 @@ namespace { typedef TBoxedResource<THistogramType, ResourceName> THistogramResource; static const TStringRef& Name() { - static auto name = TString(ResourceName).substr(10) + "Histogram_Deserialize"; + static auto name = TString(ResourceName).substr(10) + "Histogram_Deserialize"; static auto nameRef = TStringRef(name); return nameRef; } @@ -328,7 +328,7 @@ namespace { typedef TBoxedResource<THistogramType, ResourceName> THistogramResource; static const TStringRef& Name() { - static auto name = TString(ResourceName).substr(10) + "Histogram_Merge"; + static auto name = TString(ResourceName).substr(10) + "Histogram_Merge"; static auto nameRef = TStringRef(name); return nameRef; } @@ -403,7 +403,7 @@ namespace { } static const TStringRef& Name() { - static auto name = TString(ResourceName).substr(10) + "Histogram_GetResult"; + static auto name = TString(ResourceName).substr(10) + "Histogram_GetResult"; static auto nameRef = TStringRef(name); return nameRef; } diff --git a/ydb/library/yql/udfs/common/json/json_udf.cpp b/ydb/library/yql/udfs/common/json/json_udf.cpp index e994e589bda..19b2a833eff 100644 --- a/ydb/library/yql/udfs/common/json/json_udf.cpp +++ b/ydb/library/yql/udfs/common/json/json_udf.cpp @@ -32,7 +32,7 @@ namespace { NJson::TJsonParser parser; parser.AddField(field, false); - TVector<TString> result; + TVector<TString> result; parser.Parse(json, &result); TUnboxedValue* items = nullptr; diff --git a/ydb/library/yql/udfs/common/re2/re2_udf.cpp b/ydb/library/yql/udfs/common/re2/re2_udf.cpp index b478675fb60..0da16870457 100644 --- a/ydb/library/yql/udfs/common/re2/re2_udf.cpp +++ b/ydb/library/yql/udfs/common/re2/re2_udf.cpp @@ -47,8 +47,8 @@ namespace { }; struct TRegexpGroups { - TVector<TString> Names; - TVector<ui32> Indexes; + TVector<TString> Names; + TVector<ui32> Indexes; }; class TRe2Udf: public TBoxedValue { diff --git a/ydb/library/yql/udfs/common/stat/static/tdigest.cpp b/ydb/library/yql/udfs/common/stat/static/tdigest.cpp index b8668eb27b0..a9001091f76 100644 --- a/ydb/library/yql/udfs/common/stat/static/tdigest.cpp +++ b/ydb/library/yql/udfs/common/stat/static/tdigest.cpp @@ -67,7 +67,7 @@ double TDigest::GetThreshold(double q) { return 4 * N * Delta * q * (1 - q); } -void TDigest::MergeCentroid(TVector<TCentroid>& merged, double& sum, const TCentroid& centroid) { +void TDigest::MergeCentroid(TVector<TCentroid>& merged, double& sum, const TCentroid& centroid) { if (merged.empty()) { merged.push_back(centroid); sum += centroid.Count; @@ -155,7 +155,7 @@ double TDigest::GetPercentile(double percentile) { return Centroids.back().Mean; } -TString TDigest::Serialize() { +TString TDigest::Serialize() { Compress(); NTDigest::TDigest digest; digest.SetDelta(Delta); diff --git a/ydb/library/yql/udfs/common/stat/static/tdigest.h b/ydb/library/yql/udfs/common/stat/static/tdigest.h index acec0a02645..1da20691080 100644 --- a/ydb/library/yql/udfs/common/stat/static/tdigest.h +++ b/ydb/library/yql/udfs/common/stat/static/tdigest.h @@ -30,10 +30,10 @@ class TDigest { } }; - TVector<TCentroid> Centroids; - TVector<TCentroid> Unmerged; - TVector<TCentroid> Merged; - typedef TVector<TCentroid>::iterator iter_t; + TVector<TCentroid> Centroids; + TVector<TCentroid> Unmerged; + TVector<TCentroid> Merged; + typedef TVector<TCentroid>::iterator iter_t; double N; double Delta; double K; @@ -42,7 +42,7 @@ class TDigest { void AddCentroid(const TCentroid& centroid); double GetThreshold(double q); - void MergeCentroid(TVector<TCentroid>& merged, double& sum, const TCentroid& centroid); + void MergeCentroid(TVector<TCentroid>& merged, double& sum, const TCentroid& centroid); protected: void Update(double x, double w = 1.0); @@ -52,7 +52,7 @@ public: TDigest(double delta, double k, double firstValue); TDigest(const TString& serializedDigest); TDigest(const TDigest* digest1, const TDigest* digest2); // merge - TString Serialize(); + TString Serialize(); TDigest operator+(const TDigest& other); TDigest& operator+=(const TDigest& other); void AddValue(double value); diff --git a/ydb/library/yql/udfs/logs/dsv/dsv_udf.cpp b/ydb/library/yql/udfs/logs/dsv/dsv_udf.cpp index b74bf80b185..16b7dbb5cda 100644 --- a/ydb/library/yql/udfs/logs/dsv/dsv_udf.cpp +++ b/ydb/library/yql/udfs/logs/dsv/dsv_udf.cpp @@ -150,7 +150,7 @@ case TDataType<type>::Id: part += ToString(member.Get<type>()); break; class TDsvSerialize: public TBoxedValue { public: - explicit TDsvSerialize(const TVector<TDataTypeId>& typeIds, TStructTypeInspector* structInspector) + explicit TDsvSerialize(const TVector<TDataTypeId>& typeIds, TStructTypeInspector* structInspector) : TypeIds(typeIds) , StructInspector(structInspector) {} @@ -190,7 +190,7 @@ private: UdfTerminate(e.what()); } - const TVector<TDataTypeId> TypeIds; + const TVector<TDataTypeId> TypeIds; THolder<TStructTypeInspector> StructInspector; }; diff --git a/ydb/library/yql/utils/fetch/fetch.cpp b/ydb/library/yql/utils/fetch/fetch.cpp index 100c88c3858..0e55e5dc389 100644 --- a/ydb/library/yql/utils/fetch/fetch.cpp +++ b/ydb/library/yql/utils/fetch/fetch.cpp @@ -26,8 +26,8 @@ THttpURL ParseURL(const TStringBuf addr, NUri::TParseFlags features) { class TFetchResultImpl: public IFetchResult { public: TFetchResultImpl(const THttpURL& url, const THttpHeaders& additionalHeaders, TDuration timeout) { - TString host = url.Get(THttpURL::FieldHost); - TString path = url.PrintS(THttpURL::FlagPath | THttpURL::FlagQuery); + TString host = url.Get(THttpURL::FieldHost); + TString path = url.PrintS(THttpURL::FlagPath | THttpURL::FlagQuery); const char* p = url.Get(THttpURL::FieldPort); ui16 port = 80; bool https = false; @@ -41,7 +41,7 @@ public: port = FromString<ui16>(p); } - TString req; + TString req; { TStringOutput rqs(req); TStringBuf userAgent = "User-Agent: Mozilla/5.0 (compatible; YQL/1.0)"; diff --git a/ydb/library/yql/utils/fetch/fetch.h b/ydb/library/yql/utils/fetch/fetch.h index d9e1c3c1a57..88d77eb6183 100644 --- a/ydb/library/yql/utils/fetch/fetch.h +++ b/ydb/library/yql/utils/fetch/fetch.h @@ -5,7 +5,7 @@ #include <library/cpp/http/io/stream.h> #include <util/datetime/base.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/ptr.h> namespace NYql { diff --git a/ydb/library/yql/utils/log/context.cpp b/ydb/library/yql/utils/log/context.cpp index b591c42a779..36f4052b53e 100644 --- a/ydb/library/yql/utils/log/context.cpp +++ b/ydb/library/yql/utils/log/context.cpp @@ -9,7 +9,7 @@ namespace NLog { namespace { struct TThrowedLogContext { - TString LocationWithLogContext; // separated with ': ' + TString LocationWithLogContext; // separated with ': ' }; } // namspace @@ -55,13 +55,13 @@ NImpl::TLogContextListItem* NImpl::GetLogContextList() { return FastTlsSingleton<NImpl::TLogContextListItem>(); } -TString CurrentLogContextPath() { +TString CurrentLogContextPath() { TStringStream ss; OutputLogCtx(&ss, false); return ss.Str(); } -TString ThrowedLogContextPath() { +TString ThrowedLogContextPath() { TThrowedLogContext* tlc = FastTlsSingleton<TThrowedLogContext>(); return std::move(tlc->LocationWithLogContext); } diff --git a/ydb/library/yql/utils/log/context.h b/ydb/library/yql/utils/log/context.h index ab6e9430e50..892ca427764 100644 --- a/ydb/library/yql/utils/log/context.h +++ b/ydb/library/yql/utils/log/context.h @@ -173,13 +173,13 @@ auto MakeRootCtx(TArgs&&... args) -> TRootLogContext<sizeof...(args)> { * @brief Returns current logger contexts path as string. Each element * is separated with '/'. */ -TString CurrentLogContextPath(); +TString CurrentLogContextPath(); /** * @brief If last throwing exception was performed with YQL_LOG_CTX_THROW * macro this function returns location and context of that throw point. */ -TString ThrowedLogContextPath(); +TString ThrowedLogContextPath(); /** * @brief Adds context preffix before logging message. diff --git a/ydb/library/yql/utils/log/log.cpp b/ydb/library/yql/utils/log/log.cpp index b62bfeb907a..f31337bd58e 100644 --- a/ydb/library/yql/utils/log/log.cpp +++ b/ydb/library/yql/utils/log/log.cpp @@ -95,7 +95,7 @@ TYqlLog::TYqlLog() , ProcId_() , WriteTruncMsg_(0) {} -TYqlLog::TYqlLog(const TString& logType, const TComponentLevels& levels) +TYqlLog::TYqlLog(const TString& logType, const TComponentLevels& levels) : TLog(logType) , ProcName_(GetProgramName()) , ProcId_(GetPID()) @@ -117,7 +117,7 @@ TYqlLog::TYqlLog(TAutoPtr<TLogBackend> backend, const TComponentLevels& levels) } } -void TYqlLog::UpdateProcInfo(const TString& procName) { +void TYqlLog::UpdateProcInfo(const TString& procName) { ProcName_ = procName; ProcId_ = GetPID(); } @@ -163,7 +163,7 @@ void TYqlLog::SetMaxLogLimit(ui64 limit) { TLog::ResetBackend(THolder(new TLimitedLogBackend(backend, WriteTruncMsg_, limit))); } -void InitLogger(const TString& logType, bool startAsDaemon) { +void InitLogger(const TString& logType, bool startAsDaemon) { with_lock(g_InitLoggerMutex) { ++g_LoggerInitialized; if (g_LoggerInitialized > 1) { diff --git a/ydb/library/yql/utils/log/log.h b/ydb/library/yql/utils/log/log.h index 8095fdd4952..62a46ee44ec 100644 --- a/ydb/library/yql/utils/log/log.h +++ b/ydb/library/yql/utils/log/log.h @@ -96,11 +96,11 @@ using TComponentLevels = class TYqlLog: public TLog { public: TYqlLog(); - TYqlLog(const TString& logType, const TComponentLevels& levels); + TYqlLog(const TString& logType, const TComponentLevels& levels); TYqlLog(TAutoPtr<TLogBackend> backend, const TComponentLevels& levels); // XXX: not thread-safe - void UpdateProcInfo(const TString& procName); + void UpdateProcInfo(const TString& procName); ELevel GetComponentLevel(EComponent component) const { return ELevelHelpers::FromInt(AtomicGet(ComponentLevels_[EComponentHelpers::ToInt(component)])); @@ -121,7 +121,7 @@ public: void WriteLogPrefix(IOutputStream* out, EComponent component, ELevel level, TStringBuf file, int line) const; private: - TString ProcName_; + TString ProcName_; pid_t ProcId_; std::array<TAtomic, EComponentHelpers::ToInt(EComponent::MaxValue)> ComponentLevels_{0}; mutable TAtomic WriteTruncMsg_; @@ -147,7 +147,7 @@ inline bool IsYqlLoggerInitialized() { * @param log - one of { syslog, console, cout, cerr, null, /path/to/file } * @param startAsDaemon - true if process is demonized */ -void InitLogger(const TString& log, bool startAsDaemon = false); +void InitLogger(const TString& log, bool startAsDaemon = false); /** * @brief Initialize logger with concrete backend. diff --git a/ydb/library/yql/utils/log/log_ut.cpp b/ydb/library/yql/utils/log/log_ut.cpp index bf8b71476c0..bb4c3e717cd 100644 --- a/ydb/library/yql/utils/log/log_ut.cpp +++ b/ydb/library/yql/utils/log/log_ut.cpp @@ -26,7 +26,7 @@ Y_UNIT_TEST_SUITE(TLogTest) YqlLoggerScope logger(&out); YqlLogger().UpdateProcInfo("my_proc"); - TString message = "some performance info"; + TString message = "some performance info"; YQL_LOG(INFO) << message; TLogRow logRow = ParseLogRow(out.Str()); @@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(TLogTest) YQL_LOG(DEBUG) << "debug message"; YQL_LOG(TRACE) << "trace message"; - TString fatalStr, errorStr, warnStr, infoStr, _; + TString fatalStr, errorStr, warnStr, infoStr, _; Split(out.Str(), '\n', fatalStr, errorStr, warnStr, infoStr, _); { @@ -99,7 +99,7 @@ Y_UNIT_TEST_SUITE(TLogTest) YQL_CLOG(INFO, Performance) << "performance message"; YQL_CLOG(INFO, Perf) << "perf message"; - TString defaultStr, coreStr, sqlStr, commonStr, ytStr, + TString defaultStr, coreStr, sqlStr, commonStr, ytStr, kikimrStr, rtmrStr, performanceStr, perfStr, _; Split(out.Str(), '\n', defaultStr, coreStr, sqlStr, commonStr, ytStr, @@ -174,7 +174,7 @@ Y_UNIT_TEST_SUITE(TLogTest) YQL_CLOG_IF(INFO, Perf, true) << "perf info message"; YQL_CLOG_IF(INFO, Perf, false) << "perf info message"; - TString defaultStr, perfStr, _; + TString defaultStr, perfStr, _; Split(out.Str(), '\n', defaultStr, perfStr, _); { @@ -213,7 +213,7 @@ Y_UNIT_TEST_SUITE(TLogTest) UNIT_ASSERT_STRINGS_EQUAL(CurrentLogContextPath(), ""); YQL_LOG(INFO) << "level0 - end"; - TString row1Str, row2Str, row3Str, row4Str, row5Str, _; + TString row1Str, row2Str, row3Str, row4Str, row5Str, _; Split(out.Str(), '\n', row1Str, row2Str, row3Str, row4Str, row5Str, _); { @@ -259,7 +259,7 @@ Y_UNIT_TEST_SUITE(TLogTest) UNIT_ASSERT_STRINGS_EQUAL(e.AsStrBuf(), "some message"); - TString throwedLogCtx = ThrowedLogContextPath(); + TString throwedLogCtx = ThrowedLogContextPath(); TStringBuf file, line, context; TStringBuf(throwedLogCtx).Split(".cpp:", file, line); line.Split(':', line, context); @@ -309,7 +309,7 @@ Y_UNIT_TEST_SUITE(TLogTest) } UNIT_ASSERT_STRINGS_EQUAL(CurrentLogContextPath(), ""); - TString row1Str, row2Str, row3Str, row4Str, row5Str, _; + TString row1Str, row2Str, row3Str, row4Str, row5Str, _; Split(out.Str(), '\n', row1Str, row2Str, row3Str, row4Str, row5Str, _); { @@ -366,7 +366,7 @@ Y_UNIT_TEST_SUITE(TLogTest) } UNIT_ASSERT(isExecuted); - TString row1Str, row2Str, row3Str, _; + TString row1Str, row2Str, row3Str, _; Split(out.Str(), '\n', row1Str, row2Str, row3Str, _); { @@ -416,7 +416,7 @@ Y_UNIT_TEST_SUITE(TLogTest) Func1(1, 2); Func2(1, 2); - TString row1Str, row2Str, _; + TString row1Str, row2Str, _; Split(out.Str(), '\n', row1Str, row2Str, _); { diff --git a/ydb/library/yql/utils/log/profile.h b/ydb/library/yql/utils/log/profile.h index 656dd550880..97bdb0bdb56 100644 --- a/ydb/library/yql/utils/log/profile.h +++ b/ydb/library/yql/utils/log/profile.h @@ -45,7 +45,7 @@ namespace NLog { class TProfilingScope { public: TProfilingScope(const char* name, ELevel level, const char* file, int line, - TString logCtxPath = TString()) + TString logCtxPath = TString()) : Name_(name) , Level_(level) , File_(file) @@ -67,7 +67,7 @@ private: const char* File_; int Line_; ui64 StartedAt_; - TString LogCtxPath_; + TString LogCtxPath_; }; } // namspace NLog diff --git a/ydb/library/yql/utils/log/tls_backend_ut.cpp b/ydb/library/yql/utils/log/tls_backend_ut.cpp index 6f4147fed6b..352de72cbf0 100644 --- a/ydb/library/yql/utils/log/tls_backend_ut.cpp +++ b/ydb/library/yql/utils/log/tls_backend_ut.cpp @@ -38,12 +38,12 @@ public: YQL_LOG(INFO) << "this message will be missed"; } - const TString& GetLogs() const { + const TString& GetLogs() const { return Logs_.Str(); } private: - TString Name_; + TString Name_; int Count_; TStringStream Logs_; }; @@ -68,7 +68,7 @@ Y_UNIT_TEST_SUITE(TTlsLogBackendTest) // Cout << "--[t2 logs]-----------------\n" << r2.GetLogs() << Endl; { // t1 - TString row1Str, row2Str, row3Str, _; + TString row1Str, row2Str, row3Str, _; Split(r1.GetLogs(), '\n', row1Str, row2Str, row3Str, _); ui64 threadId = 0; @@ -97,7 +97,7 @@ Y_UNIT_TEST_SUITE(TTlsLogBackendTest) } { // t2 - TString row1Str, row2Str, _; + TString row1Str, row2Str, _; Split(r2.GetLogs(), '\n', row1Str, row2Str, _); ui64 threadId = 0; diff --git a/ydb/library/yql/utils/log/ut/log_parser.h b/ydb/library/yql/utils/log/ut/log_parser.h index 98d796f0077..3e15dbf0887 100644 --- a/ydb/library/yql/utils/log/ut/log_parser.h +++ b/ydb/library/yql/utils/log/ut/log_parser.h @@ -15,16 +15,16 @@ namespace NLog { struct TLogRow { TInstant Time; ELevel Level; - TString ProcName; + TString ProcName; pid_t ProcId; ui64 ThreadId; EComponent Component; - TString FileName; + TString FileName; ui32 LineNumber; - TString Message; + TString Message; }; -static TLogRow ParseLogRow(const TString& str) { +static TLogRow ParseLogRow(const TString& str) { static std::regex rowRe( "^([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}) " // (1) time "([A-Z ]{5}) " // (2) level diff --git a/ydb/public/lib/base/msgbus.cpp b/ydb/public/lib/base/msgbus.cpp index 3de18610988..0e2200b2a24 100644 --- a/ydb/public/lib/base/msgbus.cpp +++ b/ydb/public/lib/base/msgbus.cpp @@ -4,7 +4,7 @@ namespace NKikimr { namespace NMsgBusProxy { -void ExplainProposeTransactionStatus(ui32 status, TString& name, TString& description) { +void ExplainProposeTransactionStatus(ui32 status, TString& name, TString& description) { name = ToString(status); description = "Unknown status"; @@ -22,7 +22,7 @@ void ExplainProposeTransactionStatus(ui32 status, TString& name, TString& descri } } -void ExplainExecutionEngineStatus(ui32 status, TString& name, TString& description) { +void ExplainExecutionEngineStatus(ui32 status, TString& name, TString& description) { name = ToString(status); description = "Unknown status"; diff --git a/ydb/public/lib/base/msgbus.h b/ydb/public/lib/base/msgbus.h index f11bd9771f1..e86beaa47ac 100644 --- a/ydb/public/lib/base/msgbus.h +++ b/ydb/public/lib/base/msgbus.h @@ -154,7 +154,7 @@ struct TBusTestShardControlRequest : TBusMessage<TBusTestShardControlRequest, NK class TBusResponseStatus : public TBusResponse { public: - TBusResponseStatus(EResponseStatus status, const TString& text = TString()) + TBusResponseStatus(EResponseStatus status, const TString& text = TString()) { Record.SetStatus(status); if (text) { @@ -165,12 +165,12 @@ public: class TProtocol : public NBus::TBusBufferProtocol { protected: - THashMap<TString, NBus::TBusBufferBase*> NameToType; + THashMap<TString, NBus::TBusBufferBase*> NameToType; public: - static TString TrimMessageName(const TString& name) { + static TString TrimMessageName(const TString& name) { std::size_t pos = name.rfind(':'); - if (pos != TString::npos && pos + 5 <= name.size() && name.substr(pos + 1, 4) == "TBus") + if (pos != TString::npos && pos + 5 <= name.size() && name.substr(pos + 1, 4) == "TBus") return name.substr(pos + 5); // removing leading 'TBus' letters return name; } @@ -181,7 +181,7 @@ public: NBus::TBusBufferProtocol::RegisterType(message); } - TAutoPtr<NBus::TBusBufferBase> NewMessage(const TString& name) const { + TAutoPtr<NBus::TBusBufferBase> NewMessage(const TString& name) const { auto it = NameToType.find(name); if (it != NameToType.end()) { return it->second->New(); diff --git a/ydb/public/lib/base/msgbus_status.h b/ydb/public/lib/base/msgbus_status.h index 15876b170dd..e15f92b9efe 100644 --- a/ydb/public/lib/base/msgbus_status.h +++ b/ydb/public/lib/base/msgbus_status.h @@ -23,8 +23,8 @@ enum EResponseStatus { ENUM_TO_STRING(EResponseStatus, RESPONSE_STATUS_MAP) -void ExplainProposeTransactionStatus(ui32 status, TString& name, TString& description); -void ExplainExecutionEngineStatus(ui32 status, TString& name, TString& description); +void ExplainProposeTransactionStatus(ui32 status, TString& name, TString& description); +void ExplainExecutionEngineStatus(ui32 status, TString& name, TString& description); void ExplainResponseStatus(ui32 status, TString& name, TString& description); }} diff --git a/ydb/public/lib/deprecated/client/grpc_client.cpp b/ydb/public/lib/deprecated/client/grpc_client.cpp index dbf808ef752..f6464642744 100644 --- a/ydb/public/lib/deprecated/client/grpc_client.cpp +++ b/ydb/public/lib/deprecated/client/grpc_client.cpp @@ -182,9 +182,9 @@ namespace NKikimr { TMaybe<TDuration> Timeout; ui32 MaxInFlight = 0; ui32 InFlight = 0; - TQueue<THolder<IProcessorBase>> PendingQ; + TQueue<THolder<IProcessorBase>> PendingQ; TMutex Mutex; - TSet<void*> StreamTags; + TSet<void*> StreamTags; public: TImpl(const TGRpcClientConfig& config) diff --git a/ydb/public/lib/deprecated/client/msgbus_client.cpp b/ydb/public/lib/deprecated/client/msgbus_client.cpp index 4d5f2427ebd..1364c4dde66 100644 --- a/ydb/public/lib/deprecated/client/msgbus_client.cpp +++ b/ydb/public/lib/deprecated/client/msgbus_client.cpp @@ -4,9 +4,9 @@ namespace NKikimr { namespace NMsgBusProxy { -void TMsgBusClientConfig::CrackAddress(const TString& address, TString& hostname, ui32& port) { +void TMsgBusClientConfig::CrackAddress(const TString& address, TString& hostname, ui32& port) { size_t first_colon_pos = address.find(':'); - if (first_colon_pos != TString::npos) { + if (first_colon_pos != TString::npos) { size_t last_colon_pos = address.rfind(':'); if (last_colon_pos == first_colon_pos) { // only one colon, simple case @@ -15,7 +15,7 @@ void TMsgBusClientConfig::CrackAddress(const TString& address, TString& hostname } else { // ipv6? size_t closing_bracket_pos = address.rfind(']'); - if (closing_bracket_pos == TString::npos || closing_bracket_pos > last_colon_pos) { + if (closing_bracket_pos == TString::npos || closing_bracket_pos > last_colon_pos) { // whole address is ipv6 host hostname = address; } else { @@ -97,7 +97,7 @@ TMsgBusClientConfig::TMsgBusClientConfig() , UseCompression(false) {} -void TMsgBusClientConfig::ConfigureLastGetopt(NLastGetopt::TOpts &opts, const TString& prefix) { +void TMsgBusClientConfig::ConfigureLastGetopt(NLastGetopt::TOpts &opts, const TString& prefix) { BusSessionConfig.ConfigureLastGetopt(opts, prefix); BusQueueConfig.ConfigureLastGetopt(opts, prefix); } diff --git a/ydb/public/lib/deprecated/client/msgbus_client_config.h b/ydb/public/lib/deprecated/client/msgbus_client_config.h index 816efff9676..1386b584c35 100644 --- a/ydb/public/lib/deprecated/client/msgbus_client_config.h +++ b/ydb/public/lib/deprecated/client/msgbus_client_config.h @@ -11,14 +11,14 @@ struct TMsgBusClientConfig { NBus::TBusQueueConfig BusQueueConfig; NBus::TBusClientSessionConfig BusSessionConfig; - TString Ip; + TString Ip; ui32 Port; bool UseCompression; TMsgBusClientConfig(); - void ConfigureLastGetopt(NLastGetopt::TOpts &opts, const TString& prefix = TString()); - static void CrackAddress(const TString& address, TString& hostname, ui32& port); + void ConfigureLastGetopt(NLastGetopt::TOpts &opts, const TString& prefix = TString()); + static void CrackAddress(const TString& address, TString& hostname, ui32& port); }; }} diff --git a/ydb/public/lib/deprecated/client/msgbus_player.cpp b/ydb/public/lib/deprecated/client/msgbus_player.cpp index befa19f73a1..bf2c3be30bd 100644 --- a/ydb/public/lib/deprecated/client/msgbus_player.cpp +++ b/ydb/public/lib/deprecated/client/msgbus_player.cpp @@ -16,7 +16,7 @@ public: {} protected: - static TString GenerateUniqueName() { + static TString GenerateUniqueName() { ui64 number = TInstant::Now().MicroSeconds(); return Sprintf("darwin-sem-%" PRIu64, number); } @@ -81,7 +81,7 @@ public: } protected: - THashSet<TType> InFlight; + THashSet<TType> InFlight; TMutex InFlightLock; TCondVar InFlightFinished; TAutoSemaphore MaxInFlight; @@ -92,13 +92,13 @@ TMsgBusPlayer::TMsgBusPlayer(TMsgBusPlayer::TMsgBusClient &msgBusClient) : MsgBusClient(msgBusClient) {} -TString DumpMessageHeader(const NBus::TBusHeader& messageHeader) { - return Sprintf("Message Id=%lx,Time=%s,Size=%d,Type=%x", messageHeader.Id, TInstant::MicroSeconds(messageHeader.SendTime).ToString().c_str(), messageHeader.Size, messageHeader.Type); +TString DumpMessageHeader(const NBus::TBusHeader& messageHeader) { + return Sprintf("Message Id=%lx,Time=%s,Size=%d,Type=%x", messageHeader.Id, TInstant::MicroSeconds(messageHeader.SendTime).ToString().c_str(), messageHeader.Size, messageHeader.Type); } -ui32 TMsgBusPlayer::PlayTrace(const TString &traceFile, ui32 maxInFlight, std::function<void(int)> progressReporter) { +ui32 TMsgBusPlayer::PlayTrace(const TString &traceFile, ui32 maxInFlight, std::function<void(int)> progressReporter) { using NBus::TBusKey; - TAutoPtr<IInputStream> stream = new TUnbufferedFileInput(traceFile); + TAutoPtr<IInputStream> stream = new TUnbufferedFileInput(traceFile); i64 fileLength = GetFileLength(traceFile); i64 filePos = 0; int lastPercent = -1; diff --git a/ydb/public/lib/deprecated/client/msgbus_player.h b/ydb/public/lib/deprecated/client/msgbus_player.h index 0126a4a3595..a9e6fb8047b 100644 --- a/ydb/public/lib/deprecated/client/msgbus_player.h +++ b/ydb/public/lib/deprecated/client/msgbus_player.h @@ -11,7 +11,7 @@ protected: TMsgBusClient &MsgBusClient; public: TMsgBusPlayer(TMsgBusClient &msgBusClient); - ui32 PlayTrace(const TString &traceFile, ui32 maxInFlight = 1000, std::function<void(int)> progressReporter = std::function<void(int)>()); + ui32 PlayTrace(const TString &traceFile, ui32 maxInFlight = 1000, std::function<void(int)> progressReporter = std::function<void(int)>()); }; } diff --git a/ydb/public/lib/deprecated/kicli/cpp_ut.cpp b/ydb/public/lib/deprecated/kicli/cpp_ut.cpp index cb7dc3ed6d9..f5090239b43 100644 --- a/ydb/public/lib/deprecated/kicli/cpp_ut.cpp +++ b/ydb/public/lib/deprecated/kicli/cpp_ut.cpp @@ -395,7 +395,7 @@ Y_UNIT_TEST_SUITE(ClientLibSchema) { static void MaxPath(NClient::TKikimr& kikimr) { try { const ui32 TestedMaxPath = 32; - TVector<NKikimr::NClient::TSchemaObject> paths; + TVector<NKikimr::NClient::TSchemaObject> paths; paths.reserve(TestedMaxPath+1); paths.emplace_back(kikimr.GetSchemaRoot("dc-1")); @@ -480,8 +480,8 @@ Y_UNIT_TEST_SUITE(ClientLib) { auto result = query.SyncExecute(); auto value = result.GetValue(); UNIT_ASSERT(!value["myRes"].IsNull()); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"]["Species"], "Rat"); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"]["Name"], "Dobby"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"]["Species"], "Rat"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"]["Name"], "Dobby"); } } @@ -518,8 +518,8 @@ Y_UNIT_TEST_SUITE(ClientLib) { auto result = query.AsyncPrepare().GetValue(TDuration::Max()).GetQuery().AsyncExecute().GetValue(TDuration::Max()); auto value = result.GetValue(); UNIT_ASSERT(!value["myRes"].IsNull()); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"]["Species"], "Rat"); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"]["Name"], "Dobby"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"]["Species"], "Rat"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"]["Name"], "Dobby"); } } @@ -642,12 +642,12 @@ Y_UNIT_TEST_SUITE(ClientLib) { auto value = result.GetValue(); UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat"); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby"); UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Description"], "A test for \"double quotes\""); UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat"); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik"); UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Description"], "A test for 'single quotes'"); UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500); } @@ -846,11 +846,11 @@ Y_UNIT_TEST_SUITE(ClientLib) { auto value = result.GetValue(); UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat"); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby"); UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat"); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik"); UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500); } @@ -928,16 +928,16 @@ Y_UNIT_TEST_SUITE(ClientLib) { auto value = result.GetValue(); UNIT_ASSERT_VALUES_EQUAL(value["myRes"].Size(), 2); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat"); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Species"], "Rat"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][0]["Name"], "Dobby"); UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][0]["Weight"], 350); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat"); - UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Species"], "Rat"); + UNIT_ASSERT_VALUES_EQUAL((TString)value["myRes"][1]["Name"], "Korzhik"); UNIT_ASSERT_VALUES_EQUAL((i64)value["myRes"][1]["Weight"], 500); } struct TGenericParameterType { - TGenericParameterType(const TString& name, const NKikimrMiniKQL::TParams& parameter) + TGenericParameterType(const TString& name, const NKikimrMiniKQL::TParams& parameter) : Name(name) , Parameter(parameter) { @@ -951,7 +951,7 @@ Y_UNIT_TEST_SUITE(ClientLib) { value.CopyFrom(Parameter.GetValue()); } private: - TString Name; + TString Name; NKikimrMiniKQL::TParams Parameter; }; @@ -1178,8 +1178,8 @@ Y_UNIT_TEST_SUITE(ClientLib) { TParameter("ID", (ui64)1), TParameter("ANIMAL", TEmptyOptional( TStruct( - TParameter("SPECIES", TString()), - TParameter("NAME", TString()), + TParameter("SPECIES", TString()), + TParameter("NAME", TString()), TParameter("WEIGHT", i64()) ))) ); @@ -1506,7 +1506,7 @@ Y_UNIT_TEST_SUITE(ClientLib) { void CheckSelectRange(NClient::TKikimr& kikimr, ui32 key1Start, ui32 key1End, bool includeFrom, bool includeTo, - const TVector<std::pair<ui32, ui32>>& expectedKeys) + const TVector<std::pair<ui32, ui32>>& expectedKeys) { using namespace NClient; @@ -1588,7 +1588,7 @@ Y_UNIT_TEST_SUITE(ClientLib) { auto result = updateQuery.GetQuery().SyncExecute( TParameter("KEY1", k1), TParameter("KEY2", k2), - TParameter("VALUE", TString(2048, 'A')) + TParameter("VALUE", TString(2048, 'A')) ); UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), NMsgBusProxy::MSTATUS_OK, result.GetError().GetMessage().c_str()); } @@ -1596,7 +1596,7 @@ Y_UNIT_TEST_SUITE(ClientLib) { for (ui32 k1 = 0; k1 < 299; ++k1) { // from (k1, inf) to (k1+1, inf) - TVector<std::pair<ui32, ui32>> expected = {{k1+1,0},{k1+1,1},{k1+1,2}}; + TVector<std::pair<ui32, ui32>> expected = {{k1+1,0},{k1+1,1},{k1+1,2}}; CheckSelectRange(kikimr, k1, k1+1, false, false, expected); CheckSelectRange(kikimr, k1, k1+1, false, true, expected); CheckSelectRange(kikimr, k1, k1+1, true, false, expected); @@ -1663,9 +1663,9 @@ Y_UNIT_TEST_SUITE(ClientLib) { (return pgmReturn) ) )___").SyncPrepare().GetQuery(); - THashSet<ui64> values_h1; - THashSet<ui64> values_h2; - THashSet<ui64> values_h3; + THashSet<ui64> values_h1; + THashSet<ui64> values_h2; + THashSet<ui64> values_h3; for (ui64 cnt = 0; cnt < 10; ++cnt) { ui64 H1 = 100 + cnt; ui64 H2 = 200 - cnt * 2; @@ -2040,13 +2040,13 @@ Y_UNIT_TEST_SUITE(ClientLib) { UNIT_ASSERT_EQUAL((ui64)value["rui64"], 5); UNIT_ASSERT_EQUAL((float)value["rf"], 6.5); UNIT_ASSERT_EQUAL((double)value["rd"], 7.5); - UNIT_ASSERT_EQUAL((TString)value["rs"], "Str1"); - UNIT_ASSERT_EQUAL((TString)value["ru"], "Str2"); + UNIT_ASSERT_EQUAL((TString)value["rs"], "Str1"); + UNIT_ASSERT_EQUAL((TString)value["ru"], "Str2"); } // Y_UNIT_TEST(Wrongdoing1) { // using namespace NClient; -// TString type = R"___( +// TString type = R"___( // Kind: 6 // Struct { // Member { @@ -2137,7 +2137,7 @@ Y_UNIT_TEST_SUITE(ClientLib) { // } } -NKikimrTxUserProxy::TKeyRange MakeRange(const TVector<TString> from, const TVector<TString> to, +NKikimrTxUserProxy::TKeyRange MakeRange(const TVector<TString> from, const TVector<TString> to, bool fromInclusive, bool toInclusive) { NKikimrTxUserProxy::TKeyRange range; diff --git a/ydb/public/lib/deprecated/kicli/error.cpp b/ydb/public/lib/deprecated/kicli/error.cpp index 473a981f607..b71d606178d 100644 --- a/ydb/public/lib/deprecated/kicli/error.cpp +++ b/ydb/public/lib/deprecated/kicli/error.cpp @@ -166,7 +166,7 @@ bool TError::Rejected() const { return false; } -TString TError::GetCode() const { +TString TError::GetCode() const { switch(Facility) { case EFacility::FacilityMessageBus: return Sprintf("MB-%04" PRIu16, Code); @@ -177,10 +177,10 @@ TString TError::GetCode() const { case EFacility::FacilityMsgBusProxy: return Sprintf("MP-%04" PRIu16, Code); } - return TString(); + return TString(); } -TString TError::GetMessage() const { +TString TError::GetMessage() const { if (!Message.empty()) return Message; switch(Facility) { diff --git a/ydb/public/lib/deprecated/kicli/kicli.h b/ydb/public/lib/deprecated/kicli/kicli.h index 9dc472d2314..446c778b662 100644 --- a/ydb/public/lib/deprecated/kicli/kicli.h +++ b/ydb/public/lib/deprecated/kicli/kicli.h @@ -68,14 +68,14 @@ public: static const TType JsonDocument; static const TType Timestamp; - const TString& GetName() const; + const TString& GetName() const; ui16 GetId() const; - TType(const TString& typeName, ui16 typeId); + TType(const TString& typeName, ui16 typeId); TType(ui16 typeId); protected: - TString TypeName; + TString TypeName; ui16 TypeId; }; @@ -88,35 +88,35 @@ public: ui32 Partitions; // generic column of a table, used in schema operations - TColumn(const TString& name, const TType& type); + TColumn(const TString& name, const TType& type); protected: - TColumn(const TString& name, const TType& type, bool key, ui32 partitions); + TColumn(const TString& name, const TType& type, bool key, ui32 partitions); }; class TKeyColumn : public TColumn { public: // column which automatically will be added to table key - TKeyColumn(const TString& name, const TType& type); + TKeyColumn(const TString& name, const TType& type); protected: - TKeyColumn(const TString& name, const TType& type, ui32 partitions); + TKeyColumn(const TString& name, const TType& type, ui32 partitions); }; class TKeyPartitioningColumn : public TKeyColumn { public: // uniform partitioning column, the type should be either Uint64 or Uint32 // the column should be first in a create table's list - TKeyPartitioningColumn(const TString& name, const TType& type, ui32 partitions); + TKeyPartitioningColumn(const TString& name, const TType& type, ui32 partitions); }; template <typename MemberType> class TStructMemberValue { public: - TString Name; + TString Name; MemberType Value; - explicit TStructMemberValue(const TString& name, MemberType value) + explicit TStructMemberValue(const TString& name, MemberType value) : Name(name) , Value(value) {} @@ -207,7 +207,7 @@ public: template <typename ParameterType, NScheme::TTypeId SchemeType = SchemeMapper<ParameterType>::SchemeType> class TParameterValue : public TStructMemberValue<TDataValue<ParameterType, SchemeType>> { public: - TParameterValue(const TString& name, ParameterType parameter) + TParameterValue(const TString& name, ParameterType parameter) : TStructMemberValue<TDataValue<ParameterType, SchemeType>>(name, TDataValue<ParameterType, SchemeType>(parameter)) {} }; @@ -218,7 +218,7 @@ TDataValue<DataType> TData(DataType value) { } template <typename MemberType> -TStructMemberValue<MemberType> TStructMember(const TString& name, MemberType value) { +TStructMemberValue<MemberType> TStructMember(const TString& name, MemberType value) { return TStructMemberValue<MemberType>(name, value); } @@ -241,17 +241,17 @@ TOptionalValue<ValueType, false> TEmptyOptional(ValueType value = ValueType()) { // TParameter(name, value) = TStructMemberValue(name, TDataValue(value)) template <typename ParameterType> -TParameterValue<ParameterType, SchemeMapper<ParameterType>::SchemeType> TParameter(const TString& name, ParameterType value) { +TParameterValue<ParameterType, SchemeMapper<ParameterType>::SchemeType> TParameter(const TString& name, ParameterType value) { return TParameterValue<ParameterType, SchemeMapper<ParameterType>::SchemeType>(name, value); } template <typename... MemberTypes> -TStructMemberValue<TStructValue<MemberTypes...>> TParameter(const TString& name, TStructValue<MemberTypes...> value) { +TStructMemberValue<TStructValue<MemberTypes...>> TParameter(const TString& name, TStructValue<MemberTypes...> value) { return TStructMemberValue<TStructValue<MemberTypes...>>(name, value); } template <typename ValueType, bool HaveValue> -TStructMemberValue<TOptionalValue<ValueType, HaveValue>> TParameter(const TString& name, TOptionalValue<ValueType, HaveValue> value) { +TStructMemberValue<TOptionalValue<ValueType, HaveValue>> TParameter(const TString& name, TOptionalValue<ValueType, HaveValue> value) { return TStructMemberValue<TOptionalValue<ValueType, HaveValue>>(name, value); } @@ -285,8 +285,8 @@ public: bool Temporary() const { return !Permanent(); } bool Timeout() const; bool Rejected() const; - TString GetCode() const; - TString GetMessage() const; + TString GetCode() const; + TString GetMessage() const; void Throw() const; EFacility GetFacility() const; // Returns YDB status @@ -296,7 +296,7 @@ protected: TError(const TResult& result); NMsgBusProxy::EResponseStatus GetMsgBusProxyStatus() const; - TString Message; + TString Message; EFacility Facility; ui16 Code; Ydb::StatusIds::StatusCode YdbStatus; @@ -480,8 +480,8 @@ public: return AsyncExecute((const NKikimrMiniKQL::TParams&)parameters); } - TQueryResult SyncExecute(const TString& parameters) const; - NThreading::TFuture<TQueryResult> AsyncExecute(const TString& parameters) const; + TQueryResult SyncExecute(const TString& parameters) const; + NThreading::TFuture<TQueryResult> AsyncExecute(const TString& parameters) const; TQueryResult SyncExecute(const NKikimrMiniKQL::TParams& parameters) const; NThreading::TFuture<TQueryResult> AsyncExecute(const NKikimrMiniKQL::TParams& parameters) const; @@ -489,7 +489,7 @@ public: protected: TTextQuery(TKikimr& kikimr, const TString& program); - TString TextProgram; + TString TextProgram; }; class TUnbindedQuery { @@ -502,9 +502,9 @@ public: TUnbindedQuery& operator = (const TUnbindedQuery&) = delete; protected: - TUnbindedQuery(const TString& program); + TUnbindedQuery(const TString& program); - TString CompiledProgram; + TString CompiledProgram; }; class TPreparedQuery : public TQuery { @@ -541,8 +541,8 @@ public: return AsyncExecute((const NKikimrMiniKQL::TParams&)parameters); } - TQueryResult SyncExecute(const TString& parameters) const; - NThreading::TFuture<TQueryResult> AsyncExecute(const TString& parameters) const; + TQueryResult SyncExecute(const TString& parameters) const; + NThreading::TFuture<TQueryResult> AsyncExecute(const TString& parameters) const; TQueryResult SyncExecute(const NKikimrMiniKQL::TParams& parameters) const; NThreading::TFuture<TQueryResult> AsyncExecute(const NKikimrMiniKQL::TParams& parameters) const; @@ -550,9 +550,9 @@ public: TUnbindedQuery Unbind() const; protected: - TPreparedQuery(const TQuery& textQuery, const TString& program); + TPreparedQuery(const TQuery& textQuery, const TString& program); - TString CompiledProgram; + TString CompiledProgram; }; struct TSchemaObjectStats { @@ -586,15 +586,15 @@ public: void Drop(); void ModifySchema(const TModifyScheme& schema); - TSchemaObject MakeDirectory(const TString& name); - TSchemaObject CreateTable(const TString& name, const TVector<TColumn>& columns); - TSchemaObject CreateTable(const TString& name, const TVector<TColumn>& columns, + TSchemaObject MakeDirectory(const TString& name); + TSchemaObject CreateTable(const TString& name, const TVector<TColumn>& columns); + TSchemaObject CreateTable(const TString& name, const TVector<TColumn>& columns, const TTablePartitionConfig& partitionConfig); - TSchemaObject GetChild(const TString& name) const; - TString GetName() const; - TString GetPath() const; - TVector<TSchemaObject> GetChildren() const; - TVector<TColumn> GetColumns() const; + TSchemaObject GetChild(const TString& name) const; + TString GetName() const; + TString GetPath() const; + TVector<TSchemaObject> GetChildren() const; + TVector<TColumn> GetColumns() const; TSchemaObjectStats GetStats() const; EPathType GetPathType() const { return PathType; } @@ -606,12 +606,12 @@ protected: TSchemaObject(TKikimr& kikimr, const TString& path, const TString& name, ui64 pathId = 0, EPathType pathType = EPathType::Unknown); - TSchemaObject DoCreateTable(const TString& name, const TVector<TColumn>& columns, + TSchemaObject DoCreateTable(const TString& name, const TVector<TColumn>& columns, const TTablePartitionConfig* partitionConfig); TKikimr& Kikimr; - TString Path; - TString Name; + TString Path; + TString Name; ui64 PathId; EPathType PathType; }; @@ -656,7 +656,7 @@ class TTableStream { public: NThreading::TFuture<TResult> AsyncRead(const TString &path, bool ordered, std::function<void(NClient::TReadTableResult)> processPart, - const TVector<TString> &columns = TVector<TString>(), + const TVector<TString> &columns = TVector<TString>(), const NKikimrTxUserProxy::TKeyRange &range = NKikimrTxUserProxy::TKeyRange(), ui64 limit = 0); @@ -756,12 +756,12 @@ public: TKikimr(TKikimr&& kikimr); ~TKikimr(); - TSchemaObject GetSchemaRoot(const TString& name = TString()); - TSchemaObject GetSchemaObject(const TString& name); - TTextQuery Query(const TString& program); + TSchemaObject GetSchemaRoot(const TString& name = TString()); + TSchemaObject GetSchemaObject(const TString& name); + TTextQuery Query(const TString& program); TPreparedQuery Query(const TUnbindedQuery& query); // sets security token - void SetSecurityToken(const TString& securityToken); + void SetSecurityToken(const TString& securityToken); TString GetCurrentLocation() const; TNodeRegistrant GetNodeRegistrant(); @@ -780,14 +780,14 @@ public: protected: NThreading::TFuture<TQueryResult> ExecuteQuery(const TTextQuery& query, const NKikimrMiniKQL::TParams& parameters); - NThreading::TFuture<TQueryResult> ExecuteQuery(const TTextQuery& query, const TString& parameters); + NThreading::TFuture<TQueryResult> ExecuteQuery(const TTextQuery& query, const TString& parameters); NThreading::TFuture<TQueryResult> ExecuteQuery(const TPreparedQuery& query, const NKikimrMiniKQL::TParams& parameters); - NThreading::TFuture<TQueryResult> ExecuteQuery(const TPreparedQuery& query, const TString& parameters); + NThreading::TFuture<TQueryResult> ExecuteQuery(const TPreparedQuery& query, const TString& parameters); NThreading::TFuture<TPrepareResult> PrepareQuery(const TTextQuery& query); NThreading::TFuture<TResult> DescribeObject(const TSchemaObject& object); NThreading::TFuture<TResult> ModifySchema(const TModifyScheme& schema); - NThreading::TFuture<TResult> MakeDirectory(const TSchemaObject& object, const TString& name); - NThreading::TFuture<TResult> CreateTable(TSchemaObject& object, const TString& name, const TVector<TColumn>& columns, + NThreading::TFuture<TResult> MakeDirectory(const TSchemaObject& object, const TString& name); + NThreading::TFuture<TResult> CreateTable(TSchemaObject& object, const TString& name, const TVector<TColumn>& columns, const TTablePartitionConfig* partitionConfig); NBus::EMessageStatus ExecuteRequestInternal(NThreading::TPromise<TResult> promise, TAutoPtr<NBus::TBusMessage> request); NThreading::TFuture<TResult> RegisterNode(const TString& domainPath, const TString& host, ui16 port, @@ -803,7 +803,7 @@ protected: template <typename T> static void DumpRequest(const T& pb) { if (DUMP_REQUESTS) { - TString res; + TString res; ::google::protobuf::TextFormat::PrintToString(pb, &res); Cerr << "<-- " << TypeName<T>() << Endl << res << Endl; } @@ -811,7 +811,7 @@ protected: template <typename T> static void DumpResponse(const T& pb) { if (DUMP_REQUESTS) { - TString res; + TString res; ::google::protobuf::TextFormat::PrintToString(pb, &res); Cerr << "--> " << TypeName<T>() << Endl << res << Endl; } @@ -868,7 +868,7 @@ protected: } } - TString SecurityToken; + TString SecurityToken; THolder<TImpl> Impl; }; diff --git a/ydb/public/lib/deprecated/kicli/kikimr.cpp b/ydb/public/lib/deprecated/kicli/kikimr.cpp index 4156d72d4b3..9f1a3853dff 100644 --- a/ydb/public/lib/deprecated/kicli/kikimr.cpp +++ b/ydb/public/lib/deprecated/kicli/kikimr.cpp @@ -16,7 +16,7 @@ struct TRetryState { if (RetryNumber == 0) { wait = policy.DoFirstRetryInstantly ? TDuration::Zero() : policy.MinRetryTime; } else { - wait = TDuration::MicroSeconds(RetryDuration.GetValue() * policy.BackoffMultiplier); + wait = TDuration::MicroSeconds(RetryDuration.GetValue() * policy.BackoffMultiplier); wait = Max(policy.MinRetryTime, wait); wait = Min(policy.MaxRetryTime, wait); } @@ -52,7 +52,7 @@ protected: TKikimr::TImpl& Kikimr; volatile bool TimeToQuit; TMutex QueueMutex; - TPriorityQueue<TQueueItem> Queue; + TPriorityQueue<TQueueItem> Queue; TCondVar CondVar; TThread QueueThread; @@ -444,7 +444,7 @@ NThreading::TFuture<TQueryResult> TKikimr::ExecuteQuery(const TTextQuery& query, }); } -NThreading::TFuture<TQueryResult> TKikimr::ExecuteQuery(const TTextQuery& query, const TString& parameters) { +NThreading::TFuture<TQueryResult> TKikimr::ExecuteQuery(const TTextQuery& query, const TString& parameters) { TAutoPtr<NMsgBusProxy::TBusRequest> request(new NMsgBusProxy::TBusRequest()); auto* mkqlTx = request->Record.MutableTransaction()->MutableMiniKQLTransaction(); mkqlTx->SetFlatMKQL(true); @@ -473,7 +473,7 @@ NThreading::TFuture<TQueryResult> TKikimr::ExecuteQuery(const TPreparedQuery& qu }); } -NThreading::TFuture<TQueryResult> TKikimr::ExecuteQuery(const TPreparedQuery& query, const TString& parameters) { +NThreading::TFuture<TQueryResult> TKikimr::ExecuteQuery(const TPreparedQuery& query, const TString& parameters) { TAutoPtr<NMsgBusProxy::TBusRequest> request(new NMsgBusProxy::TBusRequest()); auto* mkqlTx = request->Record.MutableTransaction()->MutableMiniKQLTransaction(); mkqlTx->SetFlatMKQL(true); @@ -512,7 +512,7 @@ NThreading::TFuture<TResult> TKikimr::ModifySchema(const TModifyScheme& schema) return ExecuteRequest(request.Release()); } -NThreading::TFuture<TResult> TKikimr::MakeDirectory(const TSchemaObject& object, const TString& name) { +NThreading::TFuture<TResult> TKikimr::MakeDirectory(const TSchemaObject& object, const TString& name) { TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation()); request->Record.MutablePollOptions()->SetTimeout(POLLING_TIMEOUT); auto* modifyScheme = request->Record.MutableTransaction()->MutableModifyScheme(); @@ -523,7 +523,7 @@ NThreading::TFuture<TResult> TKikimr::MakeDirectory(const TSchemaObject& object, return ExecuteRequest(request.Release()); } -NThreading::TFuture<TResult> TKikimr::CreateTable(TSchemaObject& object, const TString& name, const TVector<TColumn>& columns, +NThreading::TFuture<TResult> TKikimr::CreateTable(TSchemaObject& object, const TString& name, const TVector<TColumn>& columns, const TTablePartitionConfig* partitionConfig) { TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation()); @@ -551,7 +551,7 @@ NThreading::TFuture<TResult> TKikimr::CreateTable(TSchemaObject& object, const T return ExecuteRequest(request.Release()); } -void TKikimr::SetSecurityToken(const TString& securityToken) { +void TKikimr::SetSecurityToken(const TString& securityToken) { SecurityToken = securityToken; } diff --git a/ydb/public/lib/deprecated/kicli/query.cpp b/ydb/public/lib/deprecated/kicli/query.cpp index c614b5b3fdb..38292c25909 100644 --- a/ydb/public/lib/deprecated/kicli/query.cpp +++ b/ydb/public/lib/deprecated/kicli/query.cpp @@ -7,14 +7,14 @@ TQuery::TQuery(TKikimr& kikimr) : Kikimr(&kikimr) {} -void TQuery::ParseTextParameters(NKikimrMiniKQL::TParams& params, const TString& parameters) { +void TQuery::ParseTextParameters(NKikimrMiniKQL::TParams& params, const TString& parameters) { if (!parameters.empty()) { bool ok = ::google::protobuf::TextFormat::ParseFromString(parameters, ¶ms); Y_VERIFY(ok); } } -TTextQuery::TTextQuery(TKikimr& kikimr, const TString& program) +TTextQuery::TTextQuery(TKikimr& kikimr, const TString& program) : TQuery(kikimr) , TextProgram(program) {} @@ -31,7 +31,7 @@ TQueryResult TTextQuery::SyncExecute(const NKikimrMiniKQL::TParams& parameters) return AsyncExecute(parameters).GetValue(TDuration::Max()); } -TQueryResult TTextQuery::SyncExecute(const TString& parameters) const { +TQueryResult TTextQuery::SyncExecute(const TString& parameters) const { return AsyncExecute(parameters).GetValue(TDuration::Max()); } @@ -39,11 +39,11 @@ NThreading::TFuture<TQueryResult> TTextQuery::AsyncExecute(const NKikimrMiniKQL: return Kikimr->ExecuteQuery(*this, parameters); } -NThreading::TFuture<TQueryResult> TTextQuery::AsyncExecute(const TString& parameters) const { +NThreading::TFuture<TQueryResult> TTextQuery::AsyncExecute(const TString& parameters) const { return Kikimr->ExecuteQuery(*this, parameters); } -TPreparedQuery::TPreparedQuery(const TQuery& textQuery, const TString& program) +TPreparedQuery::TPreparedQuery(const TQuery& textQuery, const TString& program) : TQuery(textQuery) , CompiledProgram(program) {} @@ -52,7 +52,7 @@ TQueryResult TPreparedQuery::SyncExecute(const NKikimrMiniKQL::TParams& paramete return AsyncExecute(parameters).GetValue(TDuration::Max()); } -TQueryResult TPreparedQuery::SyncExecute(const TString& parameters) const { +TQueryResult TPreparedQuery::SyncExecute(const TString& parameters) const { return AsyncExecute(parameters).GetValue(TDuration::Max()); } @@ -60,11 +60,11 @@ NThreading::TFuture<TQueryResult> TPreparedQuery::AsyncExecute(const NKikimrMini return Kikimr->ExecuteQuery(*this, parameters); } -NThreading::TFuture<TQueryResult> TPreparedQuery::AsyncExecute(const TString& parameters) const { +NThreading::TFuture<TQueryResult> TPreparedQuery::AsyncExecute(const TString& parameters) const { return Kikimr->ExecuteQuery(*this, parameters); } -TUnbindedQuery::TUnbindedQuery(const TString& program) +TUnbindedQuery::TUnbindedQuery(const TString& program) : CompiledProgram(program) {} diff --git a/ydb/public/lib/deprecated/kicli/schema.cpp b/ydb/public/lib/deprecated/kicli/schema.cpp index d1ee0384f8b..1c73a8abffe 100644 --- a/ydb/public/lib/deprecated/kicli/schema.cpp +++ b/ydb/public/lib/deprecated/kicli/schema.cpp @@ -4,33 +4,33 @@ namespace NKikimr { namespace NClient { -TColumn::TColumn(const TString& name, const TType& type) +TColumn::TColumn(const TString& name, const TType& type) : Name(name) , Type(type) , Key(false) , Partitions(0) {} -TColumn::TColumn(const TString& name, const TType& type, bool key, ui32 partitions) +TColumn::TColumn(const TString& name, const TType& type, bool key, ui32 partitions) : Name(name) , Type(type) , Key(key) , Partitions(partitions) {} -TKeyColumn::TKeyColumn(const TString& name, const TType& type) +TKeyColumn::TKeyColumn(const TString& name, const TType& type) : TColumn(name, type, true, 0) {} -TKeyColumn::TKeyColumn(const TString& name, const TType& type, ui32 partitions) +TKeyColumn::TKeyColumn(const TString& name, const TType& type, ui32 partitions) : TColumn(name, type, true, partitions) {} -TKeyPartitioningColumn::TKeyPartitioningColumn(const TString& name, const TType& type, ui32 partitions) +TKeyPartitioningColumn::TKeyPartitioningColumn(const TString& name, const TType& type, ui32 partitions) : TKeyColumn(name, type, partitions) {} -TType::TType(const TString& typeName, NScheme::TTypeId typeId) +TType::TType(const TString& typeName, NScheme::TTypeId typeId) : TypeName(typeName) , TypeId(typeId) {} @@ -56,7 +56,7 @@ const TType TType::Json(NScheme::NTypeIds::Json); const TType TType::JsonDocument(NScheme::NTypeIds::JsonDocument); const TType TType::Timestamp(NScheme::NTypeIds::Timestamp); -const TString& TType::GetName() const { +const TString& TType::GetName() const { return TypeName; } @@ -131,7 +131,7 @@ void TSchemaObject::Drop() { ModifySchema(drop); } -TSchemaObject TSchemaObject::MakeDirectory(const TString& name) { +TSchemaObject TSchemaObject::MakeDirectory(const TString& name) { NThreading::TFuture<TResult> future = Kikimr.MakeDirectory(*this, name); TResult result = future.GetValue(TDuration::Max()); result.GetError().Throw(); @@ -142,17 +142,17 @@ TSchemaObject TSchemaObject::MakeDirectory(const TString& name) { return TSchemaObject(Kikimr, Path, name, pathId, EPathType::Directory); } -TSchemaObject TSchemaObject::CreateTable(const TString& name, const TVector<TColumn>& columns) { +TSchemaObject TSchemaObject::CreateTable(const TString& name, const TVector<TColumn>& columns) { return DoCreateTable(name, columns, nullptr); } -TSchemaObject TSchemaObject::CreateTable(const TString& name, const TVector<TColumn>& columns, +TSchemaObject TSchemaObject::CreateTable(const TString& name, const TVector<TColumn>& columns, const TTablePartitionConfig& partitionConfig) { return DoCreateTable(name, columns, &partitionConfig); } -TSchemaObject TSchemaObject::DoCreateTable(const TString& name, const TVector<TColumn>& columns, +TSchemaObject TSchemaObject::DoCreateTable(const TString& name, const TVector<TColumn>& columns, const TTablePartitionConfig* partitionConfig) { NThreading::TFuture<TResult> future = Kikimr.CreateTable(*this, name, columns, partitionConfig); @@ -165,7 +165,7 @@ TSchemaObject TSchemaObject::DoCreateTable(const TString& name, const TVector<TC return TSchemaObject(Kikimr, Path, name, pathId, EPathType::Table); } -TSchemaObject TSchemaObject::GetChild(const TString& name) const { +TSchemaObject TSchemaObject::GetChild(const TString& name) const { auto children = GetChildren(); auto child = FindIf(children.begin(), children.end(), [&](const TSchemaObject& c) { return c.GetName() == name; }); if (child == children.end()) { @@ -211,12 +211,12 @@ static TSchemaObject::EPathType GetType(const NKikimrSchemeOp::TDirEntry& entry) return TSchemaObject::EPathType::Unknown; } -TVector<TSchemaObject> TSchemaObject::GetChildren() const { +TVector<TSchemaObject> TSchemaObject::GetChildren() const { NThreading::TFuture<TResult> future = Kikimr.DescribeObject(*this); TResult result = future.GetValue(TDuration::Max()); result.GetError().Throw(); const NKikimrClient::TResponse& objects = result.GetResult<NKikimrClient::TResponse>(); - TVector<TSchemaObject> children; + TVector<TSchemaObject> children; children.reserve(objects.GetPathDescription().ChildrenSize()); for (const auto& child : objects.GetPathDescription().GetChildren()) { children.push_back(TSchemaObject(Kikimr, Path, child.GetName(), child.GetPathId(), GetType(child))); @@ -224,7 +224,7 @@ TVector<TSchemaObject> TSchemaObject::GetChildren() const { return children; } -TVector<TColumn> TSchemaObject::GetColumns() const { +TVector<TColumn> TSchemaObject::GetColumns() const { NThreading::TFuture<TResult> future = Kikimr.DescribeObject(*this); TResult result = future.GetValue(TDuration::Max()); result.GetError().Throw(); @@ -237,7 +237,7 @@ TVector<TColumn> TSchemaObject::GetColumns() const { columnsMap[column.GetId()] = column; } - TVector<TColumn> columns; + TVector<TColumn> columns; columns.reserve(table.ColumnsSize()); for (ui32 keyColumnId : table.GetKeyColumnIds()) { auto column = columnsMap.FindPtr(keyColumnId); @@ -264,11 +264,11 @@ TSchemaObjectStats TSchemaObject::GetStats() const { return stats; } -TString TSchemaObject::GetPath() const { +TString TSchemaObject::GetPath() const { return Path; } -TString TSchemaObject::GetName() const { +TString TSchemaObject::GetName() const { return Name; } diff --git a/ydb/public/lib/value/value.cpp b/ydb/public/lib/value/value.cpp index 0ed8b826895..033aa916874 100644 --- a/ydb/public/lib/value/value.cpp +++ b/ydb/public/lib/value/value.cpp @@ -87,7 +87,7 @@ TValue TValue::operator [](int index) const { } } -TString TValue::GetMemberName(int index) const { +TString TValue::GetMemberName(int index) const { Y_ASSERT(Type.HasStruct()); const auto& structField = Type.GetStruct(); size_t size = structField.MemberSize(); @@ -95,11 +95,11 @@ TString TValue::GetMemberName(int index) const { return structField.GetMember(index).GetName(); } -TVector<TString> TValue::GetMembersNames() const { +TVector<TString> TValue::GetMembersNames() const { Y_ASSERT(Type.HasStruct()); const auto& structField = Type.GetStruct(); size_t size = structField.MemberSize(); - TVector<TString> members; + TVector<TString> members; members.reserve(size); for (int index = 0; (size_t)index < size; ++index) { members.emplace_back(structField.GetMember(index).GetName()); @@ -186,7 +186,7 @@ TWriteValue& TWriteValue::Bytes(const char* value) { return *this; } -TWriteValue& TWriteValue::Bytes(const TString& value) { +TWriteValue& TWriteValue::Bytes(const TString& value) { Type.SetKind(NKikimrMiniKQL::ETypeKind::Data); Type.MutableData()->SetScheme(NScheme::NTypeIds::String); Value.SetBytes(value); @@ -200,7 +200,7 @@ TWriteValue& TWriteValue::Yson(const char* value) { return *this; } -TWriteValue& TWriteValue::Yson(const TString& value) { +TWriteValue& TWriteValue::Yson(const TString& value) { Type.SetKind(NKikimrMiniKQL::ETypeKind::Data); Type.MutableData()->SetScheme(NScheme::NTypeIds::Yson); Value.SetBytes(value); @@ -326,7 +326,7 @@ TWriteValue& TWriteValue::operator =(float value) { return *this; } -TWriteValue& TWriteValue::operator =(const TString& value) { +TWriteValue& TWriteValue::operator =(const TString& value) { Type.SetKind(NKikimrMiniKQL::ETypeKind::Data); Type.MutableData()->SetScheme(NScheme::NTypeIds::Utf8); Value.SetText(value); @@ -374,7 +374,7 @@ NScheme::TTypeId TValue::GetDataType() const { return Type.GetData().GetScheme(); } -TString TValue::GetDataText() const { +TString TValue::GetDataText() const { Y_ASSERT(Type.GetKind() == NKikimrMiniKQL::ETypeKind::Data); switch (Type.GetData().GetScheme()) { case NScheme::NTypeIds::Bool: @@ -425,7 +425,7 @@ TString TValue::GetDataText() const { return TStringBuilder() << "\"<unknown type " << Type.GetData().GetScheme() << ">\""; } -template <> TString TValue::GetTypeText<TFormatCxx>(const TFormatCxx& format) const { +template <> TString TValue::GetTypeText<TFormatCxx>(const TFormatCxx& format) const { switch(Type.GetKind()) { case NKikimrMiniKQL::ETypeKind::Void: return "void"; @@ -437,7 +437,7 @@ template <> TString TValue::GetTypeText<TFormatCxx>(const TFormatCxx& format) co return "list<" + TValue::Create(Null, Type.GetList().GetItem()).GetTypeText<TFormatCxx>(format) + ">"; case NKikimrMiniKQL::ETypeKind::Tuple: { - TString typeName = "tuple<"; + TString typeName = "tuple<"; const auto& element = Type.GetTuple().GetElement(); for (auto it = element.begin(); it != element.end(); ++it) { if (it != element.begin()) @@ -449,7 +449,7 @@ template <> TString TValue::GetTypeText<TFormatCxx>(const TFormatCxx& format) co } case NKikimrMiniKQL::ETypeKind::Struct: { - TString typeName = "struct{"; + TString typeName = "struct{"; const auto& member = Type.GetStruct().GetMember(); for (auto it = member.begin(); it != member.end(); ++it) { typeName += TValue::Create(Null, it->GetType()).GetTypeText<TFormatCxx>(format); @@ -468,7 +468,7 @@ template <> TString TValue::GetTypeText<TFormatCxx>(const TFormatCxx& format) co } TString EscapeJsonUTF8(const TString& s) { - TString result; + TString result; result.reserve(s.size()); const char* b = s.begin(); const char* e = s.end(); @@ -577,7 +577,7 @@ TString PrintCsvHeader(const NKikimrMiniKQL::TType& type, return hdr; } -template <> TString TValue::GetValueText<TFormatJSON>(const TFormatJSON& format) const { +template <> TString TValue::GetValueText<TFormatJSON>(const TFormatJSON& format) const { switch(Type.GetKind()) { case NKikimrMiniKQL::ETypeKind::Void: return "null"; @@ -611,7 +611,7 @@ template <> TString TValue::GetValueText<TFormatJSON>(const TFormatJSON& format) } case NKikimrMiniKQL::ETypeKind::List: { - TString valueText = "["; + TString valueText = "["; const auto& list = Value.GetList(); const auto& type = Type.GetList().GetItem(); for (auto it = list.begin(); it != list.end(); ++it) { @@ -624,7 +624,7 @@ template <> TString TValue::GetValueText<TFormatJSON>(const TFormatJSON& format) } case NKikimrMiniKQL::ETypeKind::Tuple: { - TString valueText = "["; + TString valueText = "["; const auto& tuple = Value.GetTuple(); const auto& type = Type.GetTuple().GetElement(); size_t maxElements = type.size(); @@ -638,7 +638,7 @@ template <> TString TValue::GetValueText<TFormatJSON>(const TFormatJSON& format) } case NKikimrMiniKQL::ETypeKind::Struct: { - TString valueText = "{"; + TString valueText = "{"; const auto& str = Value.GetStruct(); const auto& type = Type.GetStruct().GetMember(); size_t maxElements = type.size(); @@ -655,7 +655,7 @@ template <> TString TValue::GetValueText<TFormatJSON>(const TFormatJSON& format) } case NKikimrMiniKQL::ETypeKind::Dict: { - TString valueText = "{"; + TString valueText = "{"; const auto& dict = Value.GetDict(); const auto& type = Type.GetDict(); for (auto it = dict.begin(); it != dict.end(); ++it) { @@ -676,7 +676,7 @@ template <> TString TValue::GetValueText<TFormatJSON>(const TFormatJSON& format) } } -template <> TString TValue::GetValueText<TFormatRowset>(const TFormatRowset& format) const { +template <> TString TValue::GetValueText<TFormatRowset>(const TFormatRowset& format) const { if (HaveValue()) { switch(Type.GetKind()) { case NKikimrMiniKQL::ETypeKind::Void: @@ -687,7 +687,7 @@ template <> TString TValue::GetValueText<TFormatRowset>(const TFormatRowset& for return TValue::Create(Value.GetOptional(), Type.GetOptional().GetItem()).GetValueText<TFormatRowset>(format); case NKikimrMiniKQL::ETypeKind::List: { - TString valueText; + TString valueText; if (Type.GetList().GetItem().GetKind() == NKikimrMiniKQL::ETypeKind::Struct) { const auto& list_type = Type.GetList(); const auto& type = list_type.GetItem().GetStruct().GetMember(); @@ -721,7 +721,7 @@ template <> TString TValue::GetValueText<TFormatRowset>(const TFormatRowset& for } case NKikimrMiniKQL::ETypeKind::Tuple: { - TString valueText = "["; + TString valueText = "["; const auto& tuple = Value.GetTuple(); const auto& type = Type.GetTuple().GetElement(); size_t maxElements = type.size(); @@ -735,7 +735,7 @@ template <> TString TValue::GetValueText<TFormatRowset>(const TFormatRowset& for } case NKikimrMiniKQL::ETypeKind::Struct: { - TString valueText = ""; + TString valueText = ""; const auto& str = Value.GetStruct(); const auto& type = Type.GetStruct().GetMember(); size_t maxElements = type.size(); @@ -755,7 +755,7 @@ template <> TString TValue::GetValueText<TFormatRowset>(const TFormatRowset& for } case NKikimrMiniKQL::ETypeKind::Dict: { - TString valueText = ""; + TString valueText = ""; const auto& dict = Value.GetDict(); const auto& type = Type.GetDict(); valueText += "Key"; @@ -939,7 +939,7 @@ TValue::operator i16() const { return Value.GetInt32(); } -TValue::operator TString() const { +TValue::operator TString() const { Y_ASSERT(Type.GetData().GetScheme() == NScheme::NTypeIds::Utf8 || Type.GetData().GetScheme() == NScheme::NTypeIds::String || Type.GetData().GetScheme() == NScheme::NTypeIds::String4k diff --git a/ydb/public/lib/value/value.h b/ydb/public/lib/value/value.h index 8ae368ac027..e8c3609c6aa 100644 --- a/ydb/public/lib/value/value.h +++ b/ydb/public/lib/value/value.h @@ -96,7 +96,7 @@ public: // returns member name by index TString GetMemberName(int index) const; // returns all members - TVector<TString> GetMembersNames() const; + TVector<TString> GetMembersNames() const; // returns member index by name int GetMemberIndex(TStringBuf name) const; diff --git a/ydb/public/lib/ydb_cli/common/command.cpp b/ydb/public/lib/ydb_cli/common/command.cpp index ce7334d7388..5fa6b5be8ee 100644 --- a/ydb/public/lib/ydb_cli/common/command.cpp +++ b/ydb/public/lib/ydb_cli/common/command.cpp @@ -85,7 +85,7 @@ namespace { } } -TClientCommand::TClientCommand(const TString& name, const std::initializer_list<TString>& aliases, const TString& description) +TClientCommand::TClientCommand(const TString& name, const std::initializer_list<TString>& aliases, const TString& description) : Name(name) , Aliases(aliases) , Description(description) @@ -201,8 +201,8 @@ void TClientCommand::SetFreeArgTitle(size_t pos, const TString& title, const TSt Opts.SetFreeArgTitle(pos, title, help); } -TString TClientCommand::Ends2Prefix(const std::basic_string<bool>& ends) { - TString prefix; +TString TClientCommand::Ends2Prefix(const std::basic_string<bool>& ends) { + TString prefix; if (!ends.empty()) { for (auto it = ends.begin();;) { bool s = *it; @@ -246,7 +246,7 @@ void TClientCommand::RenderCommandsDescription( stream << '\n'; } -TClientCommandTree::TClientCommandTree(const TString& name, const std::initializer_list<TString>& aliases, const TString& description) +TClientCommandTree::TClientCommandTree(const TString& name, const std::initializer_list<TString>& aliases, const TString& description) : TClientCommand(name, aliases, description) , SelectedCommand(nullptr) { @@ -254,7 +254,7 @@ TClientCommandTree::TClientCommandTree(const TString& name, const std::initializ } void TClientCommandTree::AddCommand(std::unique_ptr<TClientCommand> command) { - for (const TString& a : command->Aliases) { + for (const TString& a : command->Aliases) { Aliases[a] = command->Name; } command->Parent = this; @@ -264,7 +264,7 @@ void TClientCommandTree::AddCommand(std::unique_ptr<TClientCommand> command) { void TClientCommandTree::Config(TConfig& config) { TClientCommand::Config(config); SetFreeArgs(config); - TString commands; + TString commands; for (auto it = SubCommands.begin(); it != SubCommands.end(); ++it) { if (!commands.empty()) commands += ','; @@ -284,7 +284,7 @@ void TClientCommandTree::Config(TConfig& config) { void TClientCommandTree::Parse(TConfig& config) { TClientCommand::Parse(config); - TString cmd = config.ParseResult->GetFreeArgs().at(0); + TString cmd = config.ParseResult->GetFreeArgs().at(0); config.Tokens.push_back(cmd); size_t count = config.ParseResult->GetFreeArgsPos(); config.ArgC -= count; diff --git a/ydb/services/persqueue_v1/grpc_pq_actor.h b/ydb/services/persqueue_v1/grpc_pq_actor.h index 65c8aca1db2..c2df84e2ad4 100644 --- a/ydb/services/persqueue_v1/grpc_pq_actor.h +++ b/ydb/services/persqueue_v1/grpc_pq_actor.h @@ -618,7 +618,7 @@ private: bool WritesDone; - THashMap<ui32, ui64> PartitionToTablet; + THashMap<ui32, ui64> PartitionToTablet; TIntrusivePtr<NMonitoring::TDynamicCounters> Counters; @@ -960,9 +960,9 @@ private: ui64 NextAssignId; THashMap<ui64, TPartitionActorInfo> Partitions; //assignId -> info - THashMap<TString, TTopicHolder> Topics; // topic -> info + THashMap<TString, TTopicHolder> Topics; // topic -> info THashMap<TString, NPersQueue::TConverterPtr> FullPathToConverter; // PrimaryFullPath -> Converter, for balancer replies matching - THashSet<TString> TopicsToResolve; + THashSet<TString> TopicsToResolve; THashMap<TString, TVector<ui32>> TopicGroups; THashMap<TString, ui64> ReadFromTimestamp; @@ -979,7 +979,7 @@ private: } }; - TSet<TPartitionInfo> AvailablePartitions; + TSet<TPartitionInfo> AvailablePartitions; struct TFormedReadResponse: public TSimpleRefCount<TFormedReadResponse> { using TPtr = TIntrusivePtr<TFormedReadResponse>; @@ -1049,7 +1049,7 @@ private: NKikimr::NPQ::TPercentileCounter PartsPerSession; - THashMap<TString, TTopicCounters> TopicCounters; + THashMap<TString, TTopicCounters> TopicCounters; THashMap<TString, ui32> NumPartitionsFromTopic; TVector<NPQ::TLabelsInfo> Aggr; diff --git a/ydb/services/persqueue_v1/grpc_pq_read_actor.cpp b/ydb/services/persqueue_v1/grpc_pq_read_actor.cpp index 654edfcfcd4..bb8f473a1ed 100644 --- a/ydb/services/persqueue_v1/grpc_pq_read_actor.cpp +++ b/ydb/services/persqueue_v1/grpc_pq_read_actor.cpp @@ -827,7 +827,7 @@ void TReadSessionActor::SetupCounters() BytesInflight = subGroup->GetExpiringCounter("BytesInflight", false); PartsPerSession = NKikimr::NPQ::TPercentileCounter(subGroup->GetSubgroup("sensor", "PartsPerSession"), {}, {}, "Count", - TVector<std::pair<ui64, TString>>{{1, "1"}, {2, "2"}, {5, "5"}, + TVector<std::pair<ui64, TString>>{{1, "1"}, {2, "2"}, {5, "5"}, {10, "10"}, {20, "20"}, {50, "50"}, {70, "70"}, {100, "100"}, {150, "150"}, {300,"300"}, {99999999, "99999999"}}, false); |