diff options
author | Alexander Smirnov <alex@ydb.tech> | 2025-05-18 06:40:04 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2025-05-18 06:40:04 +0000 |
commit | dee22ec17f9818abef2a8bfb2a2ad405c97eabb9 (patch) | |
tree | 4fc39670e5949ea6fb173a72a34fc66ce341e26f | |
parent | d9d7e183cd9b7174a485de7530f0ac3dc5b8c271 (diff) | |
parent | 0955f01d2089135ddb96bd561bca1007a740f3bf (diff) | |
download | ydb-dee22ec17f9818abef2a8bfb2a2ad405c97eabb9.tar.gz |
Merge pull request #18449 from ydb-platform/merge-libs-250518-0050
58 files changed, 287 insertions, 261 deletions
diff --git a/build/export_generators/cmake/cmake/global_flags.compiler.msvc.cmake b/build/export_generators/cmake/cmake/global_flags.compiler.msvc.cmake index 07aaa8ce5f5..bf76aef24ca 100644 --- a/build/export_generators/cmake/cmake/global_flags.compiler.msvc.cmake +++ b/build/export_generators/cmake/cmake/global_flags.compiler.msvc.cmake @@ -131,6 +131,7 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") string(APPEND _MSVC_COMMON_C_CXX_FLAGS " \ /D_WIN64 \ /DWIN64 \ + /D__SSE__ \ /D__SSE2__ \ /D__SSE3__ \ /D__SSSE3__ \ diff --git a/build/ymake.core.conf b/build/ymake.core.conf index 0611d40744e..5cdcf1e8e72 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -785,10 +785,8 @@ module _BASE_UNIT: _BARE_UNIT { when ($NOSSE != "yes") { CFLAGS+=$SSE_CFLAGS - C_DEFINES+=$SSE_DEFINES when ($USE_SSE4 == "yes") { CFLAGS+=$SSE4_CFLAGS - C_DEFINES+=$SSE4_DEFINES } } elsewhen ($MSVC != "yes") { @@ -2822,7 +2820,6 @@ SSSE3_CFLAGS= SSE41_CFLAGS= SSE42_CFLAGS= POPCNT_CFLAGS= -PCLMUL_CFLAGS= CX16_FLAGS= AVX_CFLAGS= AVX2_CFLAGS= @@ -2830,9 +2827,7 @@ AVX512_CFLAGS= AMX_CFLAGS= # tag:cpu -SSE_DEFINES= SSE_CFLAGS= -SSE4_DEFINES= SSE4_CFLAGS= XOP_CFLAGS= @@ -2848,10 +2843,23 @@ when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") { SSSE3_CFLAGS=-mssse3 SSE41_CFLAGS=-msse4.1 SSE42_CFLAGS=-msse4.2 + XOP_CFLAGS=-mxop POPCNT_CFLAGS=-mpopcnt - PCLMUL_CFLAGS=-mpclmul - AVX_CFLAGS=-mavx + # Intel added (non-vectorized) CLMUL instruction set in Westmere, + # that is after introducing SSE4.2 in Nehalem but before introducing AVX in Sandy Bridge. + # + # AMD implemented CLMUL in Jaguar after adding SSE4.2 in Bobcat, but before introducing AVX in Puma. + # Due to the above, it should be safe to bind AVX and CLMUL instructions together. + # + # See: + # https://en.wikipedia.org/wiki/CLMUL_instruction_set + # https://en.wikipedia.org/wiki/Nehalem_(microarchitecture) + # https://en.wikipedia.org/wiki/Westmere_(microarchitecture) + # https://en.wikipedia.org/wiki/Sandy_Bridge + # + # https://en.wikipedia.org/wiki/Jaguar_(microarchitecture) + AVX_CFLAGS=-mavx -mpclmul # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell. # See: @@ -2881,8 +2889,6 @@ when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") { when ($ARCH_X86_64 && $OS_ANDROID != "yes") { CX16_FLAGS=-mcx16 } - SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1 - SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1 } elsewhen ($MSVC) { SSE2_CFLAGS=/D__SSE2__=1 @@ -2891,12 +2897,9 @@ when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") { SSE41_CFLAGS=/D__SSE4_1__=1 SSE42_CFLAGS=/D__SSE4_2__=1 POPCNT_CFLAGS=/D__POPCNT__=1 - PCLMUL_CFLAGS=/D__PCLMUL__=1 - AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1 - AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1 - AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1 - SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1 - SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1 + AVX_CFLAGS=/arch:AVX /D__AVX__ /D__PCLMUL__=1 + AVX2_CFLAGS=/arch:AVX2 /D__AVX2__ + AVX512_CFLAGS=/arch:AVX512 /D__AVX512__ } SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS @@ -3695,14 +3698,6 @@ macro SRC_C_XOP(FILE, FLAGS...) { _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_XOP $FILE .xop $XOP_CFLAGS $FLAGS) } -# tag:src-specific tag:cpp-specific tag:cpu -### @usage: SRC_C_PCLMUL(File Flags...) -### -### Compile a single C/C++ file with PCLMUL and additional Flags -macro SRC_C_PCLMUL(FILE, FLAGS...) { - _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE .pclmul $PCLMUL_CFLAGS $FLAGS ) -} - # tag:src-specific tag:cpp-specific ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal ### diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/initializer_list b/contrib/libs/cxxsupp/libcxxmsvc/include/initializer_list index f5175993b0d..39d6e2d4a67 100644 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/initializer_list +++ b/contrib/libs/cxxsupp/libcxxmsvc/include/initializer_list @@ -47,13 +47,15 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in #if defined(_LIBCPP_COMPILER_MSVC) && !defined(__clang__) -// save __cpp_lib_concepts and __cpp_lib_ranges because they can be redefined inside MSVC standard headers +// save these macros because they can be redefined inside MSVC standard headers #pragma push_macro("__cpp_lib_concepts") +#pragma push_macro("__cpp_lib_memory_resource") #pragma push_macro("__cpp_lib_ranges") #include Y_MSVC_INCLUDE_NEXT(yvals.h) #pragma pop_macro("__cpp_lib_concepts") +#pragma pop_macro("__cpp_lib_memory_resource") #pragma pop_macro("__cpp_lib_ranges") #include Y_MSVC_INCLUDE_NEXT(initializer_list) diff --git a/contrib/libs/tbb/include/oneapi/tbb/detail/_config.h b/contrib/libs/tbb/include/oneapi/tbb/detail/_config.h index 743a02b6b28..98ee7245bd8 100644 --- a/contrib/libs/tbb/include/oneapi/tbb/detail/_config.h +++ b/contrib/libs/tbb/include/oneapi/tbb/detail/_config.h @@ -256,8 +256,12 @@ // GCC4.8 on RHEL7 does not support std::is_trivially_copyable #define __TBB_CPP11_TYPE_PROPERTIES_PRESENT (_LIBCPP_VERSION || _MSC_VER >= 1700 || (__TBB_GLIBCXX_VERSION >= 50000 && __GXX_EXPERIMENTAL_CXX0X__)) -#define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (__TBB_LANG > 201402L) || \ +#if defined(__cpp_lib_memory_resource) + #define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (__TBB_LANG > 201402L) || \ __TBB_GLIBCXX_VERSION >= 90000 && __TBB_LANG >= 201703L) +#else + #define __TBB_CPP17_MEMORY_RESOURCE_PRESENT 0 +#endif #define __TBB_CPP17_HW_INTERFERENCE_SIZE_PRESENT 0 #define __TBB_CPP17_LOGICAL_OPERATIONS_PRESENT (__TBB_LANG >= 201703L) #define __TBB_CPP17_ALLOCATOR_IS_ALWAYS_EQUAL_PRESENT (__TBB_LANG >= 201703L) diff --git a/contrib/libs/tbb/patches/config.patch b/contrib/libs/tbb/patches/config.patch index e5102337e24..7ec0ee217c2 100644 --- a/contrib/libs/tbb/patches/config.patch +++ b/contrib/libs/tbb/patches/config.patch @@ -1,5 +1,18 @@ --- contrib/libs/tbb/include/oneapi/tbb/detail/_config.h (index) +++ contrib/libs/tbb/include/oneapi/tbb/detail/_config.h (working tree) -@@ -258,1 +258,1 @@ +@@ -256,9 +256,13 @@ + // GCC4.8 on RHEL7 does not support std::is_trivially_copyable + #define __TBB_CPP11_TYPE_PROPERTIES_PRESENT (_LIBCPP_VERSION || _MSC_VER >= 1700 || (__TBB_GLIBCXX_VERSION >= 50000 && __GXX_EXPERIMENTAL_CXX0X__)) + +-#define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (__TBB_LANG > 201402L) || \ ++#if defined(__cpp_lib_memory_resource) ++ #define __TBB_CPP17_MEMORY_RESOURCE_PRESENT (_MSC_VER >= 1913 && (__TBB_LANG > 201402L) || \ + __TBB_GLIBCXX_VERSION >= 90000 && __TBB_LANG >= 201703L) -#define __TBB_CPP17_HW_INTERFERENCE_SIZE_PRESENT (_MSC_VER >= 1911) ++#else ++ #define __TBB_CPP17_MEMORY_RESOURCE_PRESENT 0 ++#endif +#define __TBB_CPP17_HW_INTERFERENCE_SIZE_PRESENT 0 + #define __TBB_CPP17_LOGICAL_OPERATIONS_PRESENT (__TBB_LANG >= 201703L) + #define __TBB_CPP17_ALLOCATOR_IS_ALWAYS_EQUAL_PRESENT (__TBB_LANG >= 201703L) + #define __TBB_CPP17_IS_SWAPPABLE_PRESENT (__TBB_LANG >= 201703L) diff --git a/contrib/python/pip/.dist-info/METADATA b/contrib/python/pip/.dist-info/METADATA index 0b953fccda6..3cae064c16e 100644 --- a/contrib/python/pip/.dist-info/METADATA +++ b/contrib/python/pip/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: pip -Version: 25.1 +Version: 25.1.1 Summary: The PyPA recommended tool for installing Python packages. Author-email: The pip developers <distutils-sig@python.org> License: MIT diff --git a/contrib/python/pip/pip/__init__.py b/contrib/python/pip/pip/__init__.py index 52aefb210ac..d4b19f02dea 100644 --- a/contrib/python/pip/pip/__init__.py +++ b/contrib/python/pip/pip/__init__.py @@ -1,6 +1,6 @@ from typing import List, Optional -__version__ = "25.1" +__version__ = "25.1.1" def main(args: Optional[List[str]] = None) -> int: diff --git a/contrib/python/pip/pip/_internal/commands/install.py b/contrib/python/pip/pip/_internal/commands/install.py index 49b8fd78bef..300ae92b337 100644 --- a/contrib/python/pip/pip/_internal/commands/install.py +++ b/contrib/python/pip/pip/_internal/commands/install.py @@ -420,7 +420,7 @@ class InstallCommand(RequirementCommand): reqs_to_build = [ r - for r in requirement_set.requirements.values() + for r in requirement_set.requirements_to_install if should_build_for_install_command(r) ] diff --git a/contrib/python/pip/pip/_internal/operations/install/wheel.py b/contrib/python/pip/pip/_internal/operations/install/wheel.py index 73e4bfc7c00..cfc3b26ebbc 100644 --- a/contrib/python/pip/pip/_internal/operations/install/wheel.py +++ b/contrib/python/pip/pip/_internal/operations/install/wheel.py @@ -13,7 +13,6 @@ import sys import warnings from base64 import urlsafe_b64encode from email.message import Message -from io import StringIO from itertools import chain, filterfalse, starmap from typing import ( IO, @@ -50,7 +49,7 @@ from pip._internal.metadata import ( from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl from pip._internal.models.scheme import SCHEME_KEYS, Scheme from pip._internal.utils.filesystem import adjacent_tmp_file, replace -from pip._internal.utils.misc import ensure_dir, hash_file, partition +from pip._internal.utils.misc import StreamWrapper, ensure_dir, hash_file, partition from pip._internal.utils.unpacking import ( current_umask, is_within_directory, @@ -607,7 +606,9 @@ def _install_wheel( # noqa: C901, PLR0915 function is too long # Compile all of the pyc files for the installed files if pycompile: - with contextlib.redirect_stdout(StringIO()) as stdout: + with contextlib.redirect_stdout( + StreamWrapper.from_stream(sys.stdout) + ) as stdout: with warnings.catch_warnings(): warnings.filterwarnings("ignore") for path in pyc_source_file_paths(): diff --git a/contrib/python/pip/pip/_internal/req/req_dependency_group.py b/contrib/python/pip/pip/_internal/req/req_dependency_group.py index 8f124de5b81..e81dd45522a 100644 --- a/contrib/python/pip/pip/_internal/req/req_dependency_group.py +++ b/contrib/python/pip/pip/_internal/req/req_dependency_group.py @@ -1,6 +1,11 @@ +import sys from typing import Any, Dict, Iterable, Iterator, List, Tuple -from pip._vendor import tomli +if sys.version_info >= (3, 11): + import tomllib +else: + from pip._vendor import tomli as tomllib + from pip._vendor.dependency_groups import DependencyGroupResolver from pip._internal.exceptions import InstallationError @@ -65,10 +70,10 @@ def _load_pyproject(path: str) -> Dict[str, Any]: """ try: with open(path, "rb") as fp: - return tomli.load(fp) + return tomllib.load(fp) except FileNotFoundError: raise InstallationError(f"{path} not found. Cannot resolve '--group' option.") - except tomli.TOMLDecodeError as e: + except tomllib.TOMLDecodeError as e: raise InstallationError(f"Error parsing {path}: {e}") from e except OSError as e: raise InstallationError(f"Error reading {path}: {e}") from e diff --git a/contrib/python/pip/pip/_internal/utils/misc.py b/contrib/python/pip/pip/_internal/utils/misc.py index 156accda1bd..44f6a05fbdd 100644 --- a/contrib/python/pip/pip/_internal/utils/misc.py +++ b/contrib/python/pip/pip/_internal/utils/misc.py @@ -11,6 +11,7 @@ import sysconfig import urllib.parse from dataclasses import dataclass from functools import partial +from io import StringIO from itertools import filterfalse, tee, zip_longest from pathlib import Path from types import FunctionType, TracebackType @@ -25,6 +26,7 @@ from typing import ( Mapping, Optional, Sequence, + TextIO, Tuple, Type, TypeVar, @@ -373,6 +375,22 @@ def write_output(msg: Any, *args: Any) -> None: logger.info(msg, *args) +class StreamWrapper(StringIO): + orig_stream: TextIO + + @classmethod + def from_stream(cls, orig_stream: TextIO) -> "StreamWrapper": + ret = cls() + ret.orig_stream = orig_stream + return ret + + # compileall.compile_dir() needs stdout.encoding to print to stdout + # type ignore is because TextIOBase.encoding is writeable + @property + def encoding(self) -> str: # type: ignore + return self.orig_stream.encoding + + # Simulates an enum def enum(*sequential: Any, **named: Any) -> Type[Any]: enums = dict(zip(sequential, range(len(sequential))), **named) diff --git a/contrib/python/pip/pip/_vendor/dependency_groups/_implementation.py b/contrib/python/pip/pip/_vendor/dependency_groups/_implementation.py index 80d91693820..64e314a6328 100644 --- a/contrib/python/pip/pip/_vendor/dependency_groups/_implementation.py +++ b/contrib/python/pip/pip/_vendor/dependency_groups/_implementation.py @@ -12,7 +12,7 @@ def _normalize_name(name: str) -> str: def _normalize_group_names( - dependency_groups: Mapping[str, str | Mapping[str, str]] + dependency_groups: Mapping[str, str | Mapping[str, str]], ) -> Mapping[str, str | Mapping[str, str]]: original_names: dict[str, list[str]] = {} normalized_groups = {} @@ -171,17 +171,16 @@ class DependencyGroupResolver: if isinstance(item, Requirement): resolved_group.append(item) elif isinstance(item, DependencyGroupInclude): - if item.include_group in self._include_graph_ancestors.get(group, ()): + include_group = _normalize_name(item.include_group) + if include_group in self._include_graph_ancestors.get(group, ()): raise CyclicDependencyError( requested_group, group, item.include_group ) - self._include_graph_ancestors[item.include_group] = ( + self._include_graph_ancestors[include_group] = ( *self._include_graph_ancestors.get(group, ()), group, ) - resolved_group.extend( - self._resolve(item.include_group, requested_group) - ) + resolved_group.extend(self._resolve(include_group, requested_group)) else: # unreachable raise NotImplementedError( f"Invalid dependency group item after parse: {item}" @@ -206,8 +205,5 @@ def resolve( :raises LookupError: if group name is absent :raises packaging.requirements.InvalidRequirement: if a specifier is not valid """ - return tuple( - str(r) - for group in groups - for r in DependencyGroupResolver(dependency_groups).resolve(group) - ) + resolver = DependencyGroupResolver(dependency_groups) + return tuple(str(r) for group in groups for r in resolver.resolve(group)) diff --git a/contrib/python/pip/pip/_vendor/vendor.txt b/contrib/python/pip/pip/_vendor/vendor.txt index 283d57f5f34..b6597dc0022 100644 --- a/contrib/python/pip/pip/_vendor/vendor.txt +++ b/contrib/python/pip/pip/_vendor/vendor.txt @@ -17,4 +17,4 @@ setuptools==70.3.0 tomli==2.2.1 tomli-w==1.2.0 truststore==0.10.1 -dependency-groups==1.3.0 +dependency-groups==1.3.1 diff --git a/contrib/python/pip/ya.make b/contrib/python/pip/ya.make index 195518f4556..0a5893b069f 100644 --- a/contrib/python/pip/ya.make +++ b/contrib/python/pip/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(25.1) +VERSION(25.1.1) LICENSE(MIT) diff --git a/contrib/restricted/aws/s2n/.yandex_meta/__init__.py b/contrib/restricted/aws/s2n/.yandex_meta/__init__.py index 226a7c2e2ba..59c4cca5937 100644 --- a/contrib/restricted/aws/s2n/.yandex_meta/__init__.py +++ b/contrib/restricted/aws/s2n/.yandex_meta/__init__.py @@ -4,15 +4,11 @@ from devtools.yamaker.project import CMakeNinjaNixProject def post_install(self): with self.yamakes["."] as m: - pclmul_srcs = [] avx2_srcs = [] avx2_asm_srcs = [] avx512_srcs = [] for src in sorted(m.SRCS): - if src.endswith("_pclmul.c"): - m.SRCS.remove(src) - pclmul_srcs.append(src) - elif src.endswith("_avx2.c"): + if src.endswith("_avx2.c"): m.SRCS.remove(src) avx2_srcs.append(src) elif src.endswith("_avx2.S"): @@ -34,9 +30,6 @@ def post_install(self): SRCS=avx2_asm_srcs, ) - for src in pclmul_srcs: - x86_only_section.after("SRCS", f"SRC_C_PCLMUL({src})") - for src in avx2_srcs: x86_only_section.after("SRCS", f"SRC_C_AVX2({src})") diff --git a/library/cpp/l1_distance/l1_distance.h b/library/cpp/l1_distance/l1_distance.h index 71545cbe337..bd6e28bb748 100644 --- a/library/cpp/l1_distance/l1_distance.h +++ b/library/cpp/l1_distance/l1_distance.h @@ -423,7 +423,7 @@ inline double L1Distance(const double* lhs, const double* rhs, int length) { return NL1Distance::NPrivate::L1DistanceImpl4<double, double>(lhs, rhs, length); } -#endif // _sse_ +#endif // ARCADIA_SSE /** * L1Distance (sum(abs(l[i] - r[i]))) implementation without SSE. diff --git a/library/cpp/sse/sse.h b/library/cpp/sse/sse.h index 19bac17de0b..c118143c94b 100644 --- a/library/cpp/sse/sse.h +++ b/library/cpp/sse/sse.h @@ -11,23 +11,23 @@ #include <util/system/platform.h> #if (defined(_i386_) || defined(_x86_64_)) && defined(_sse_) -#include <xmmintrin.h> -#include <emmintrin.h> -#include <pmmintrin.h> -#define ARCADIA_SSE -#if defined(_ssse3_) -#include <tmmintrin.h> -#endif -#if defined(_sse4_1_) -#include <smmintrin.h> -#endif -#if defined(_sse4_2_) -#include <nmmintrin.h> -#endif + #include <xmmintrin.h> + #include <emmintrin.h> + #include <pmmintrin.h> + #define ARCADIA_SSE + #if defined(_ssse3_) + #include <tmmintrin.h> + #endif + #if defined(_sse4_1_) + #include <smmintrin.h> + #endif + #if defined(_sse4_2_) + #include <nmmintrin.h> + #endif #elif defined(_arm64_) -#include "sse2neon.h" -#define ARCADIA_SSE + #include "sse2neon.h" + #define ARCADIA_SSE #elif defined(_ppc64_) -#include "powerpc.h" -#define ARCADIA_SSE + #include "powerpc.h" + #define ARCADIA_SSE #endif diff --git a/util/system/platform.h b/util/system/platform.h index 0f5f668a3dd..363bf4fdec0 100644 --- a/util/system/platform.h +++ b/util/system/platform.h @@ -142,51 +142,51 @@ #define _console_ #endif -#if defined(__SSE__) || defined(SSE_ENABLED) +#if defined(__SSE__) #define _sse_ #endif -#if defined(__SSE2__) || defined(SSE2_ENABLED) +#if defined(__SSE2__) #define _sse2_ #endif -#if defined(__SSE3__) || defined(SSE3_ENABLED) +#if defined(__SSE3__) #define _sse3_ #endif -#if defined(__SSSE3__) || defined(SSSE3_ENABLED) +#if defined(__SSSE3__) #define _ssse3_ #endif -#if defined(__SSE4_1__) || defined(SSE41_ENABLED) +#if defined(__SSE4_1__) #define _sse4_1_ #endif -#if defined(__SSE4_2__) || defined(SSE42_ENABLED) +#if defined(__SSE4_2__) #define _sse4_2_ #endif -#if defined(__POPCNT__) || defined(POPCNT_ENABLED) +#if defined(__POPCNT__) #define _popcnt_ #endif -#if defined(__PCLMUL__) || defined(PCLMUL_ENABLED) +#if defined(__PCLMUL__) #define _pclmul_ #endif -#if defined(__AES__) || defined(AES_ENABLED) +#if defined(__AES__) #define _aes_ #endif -#if defined(__AVX__) || defined(AVX_ENABLED) +#if defined(__AVX__) #define _avx_ #endif -#if defined(__AVX2__) || defined(AVX2_ENABLED) +#if defined(__AVX2__) #define _avx2_ #endif -#if defined(__FMA__) || defined(FMA_ENABLED) +#if defined(__FMA__) #define _fma_ #endif diff --git a/ydb/ci/rightlib.txt b/ydb/ci/rightlib.txt index c60670b1cb0..944635781f9 100644 --- a/ydb/ci/rightlib.txt +++ b/ydb/ci/rightlib.txt @@ -1 +1 @@ -323ef5e307824fc6e9e8531e4137575537a7e6ac +c786152f994b2816cd74fb4152cf122e256abc45 diff --git a/yt/yt/core/http/helpers.cpp b/yt/yt/core/http/helpers.cpp index ea2f4269dc4..f05295c3c4b 100644 --- a/yt/yt/core/http/helpers.cpp +++ b/yt/yt/core/http/helpers.cpp @@ -78,7 +78,7 @@ TError ParseYTError(const IResponsePtr& rsp, bool fromTrailers) if (errorHeader) { errorJson = *errorHeader; } else { - static const TString BodySource("body"); + static const std::string BodySource("body"); source = BodySource; errorJson = ToString(rsp->ReadAll()); } diff --git a/yt/yt/core/http/http.h b/yt/yt/core/http/http.h index 6c63e3dd4be..55a457548c1 100644 --- a/yt/yt/core/http/http.h +++ b/yt/yt/core/http/http.h @@ -208,7 +208,7 @@ private: TCompactVector<std::string, 1> Values; }; - THashMap<TString, TEntry, TCaseInsensitiveStringHasher, TCaseInsensitiveStringEqualityComparer> NameToEntry_; + THashMap<std::string, TEntry, TCaseInsensitiveStringHasher, TCaseInsensitiveStringEqualityComparer> NameToEntry_; }; DEFINE_REFCOUNTED_TYPE(THeaders) diff --git a/yt/yt/core/http/stream.cpp b/yt/yt/core/http/stream.cpp index c8dc92c7dec..39cc7b37c85 100644 --- a/yt/yt/core/http/stream.cpp +++ b/yt/yt/core/http/stream.cpp @@ -563,7 +563,7 @@ std::optional<TString> THttpInput::TryGetRedirectUrl() EnsureHeadersReceived(); if (IsRedirectCode(GetStatusCode())) { if (auto url = Headers_->Find("Location")) { - // TODO(babenko): migrate to std::string + // TODO(babenko): switch to std::string return TString(*url); } } diff --git a/yt/yt/core/http/unittests/http_ut.cpp b/yt/yt/core/http/unittests/http_ut.cpp index 08245d83b51..7c2f69ed0b0 100644 --- a/yt/yt/core/http/unittests/http_ut.cpp +++ b/yt/yt/core/http/unittests/http_ut.cpp @@ -101,7 +101,7 @@ TEST(TParseCookiesTest, ParseCookie) std::vector<std::string> ToVector(const auto& v) { - return std::vector<std::string>(v.begin(), v.end()); + return {v.begin(), v.end()}; } TEST(THeadersTest, Simple) @@ -111,8 +111,8 @@ TEST(THeadersTest, Simple) headers->Set("X-Test", "F"); ASSERT_EQ(std::vector<std::string>{{"F"}}, ToVector(headers->GetAll("X-Test"))); - ASSERT_EQ(std::string{"F"}, headers->GetOrThrow("X-Test")); - ASSERT_EQ(std::string{"F"}, *headers->Find("X-Test")); + ASSERT_EQ(std::string("F"), headers->GetOrThrow("X-Test")); + ASSERT_EQ(std::string("F"), *headers->Find("X-Test")); ASSERT_THROW(headers->GetAll("X-Test2"), TErrorException); ASSERT_THROW(headers->GetOrThrow("X-Test2"), TErrorException); diff --git a/yt/yt/core/rpc/authenticator.cpp b/yt/yt/core/rpc/authenticator.cpp index 95a732011ea..ccfd2cf9134 100644 --- a/yt/yt/core/rpc/authenticator.cpp +++ b/yt/yt/core/rpc/authenticator.cpp @@ -67,8 +67,8 @@ public: TFuture<TAuthenticationResult> AsyncAuthenticate( const TAuthenticationContext& context) override { - static const auto Realm = TString("noop"); - static const auto UserTicket = TString(); + static const auto Realm = std::string("noop"); + static const auto UserTicket = std::string(); TAuthenticationResult result{ context.Header->has_user() ? FromProto<std::string>(context.Header->user()) : RootUserName, Realm, diff --git a/yt/yt/core/rpc/authenticator.h b/yt/yt/core/rpc/authenticator.h index f08ac411fa4..2ae838876cc 100644 --- a/yt/yt/core/rpc/authenticator.h +++ b/yt/yt/core/rpc/authenticator.h @@ -13,8 +13,8 @@ namespace NYT::NRpc { struct TAuthenticationResult { std::string User; - TString Realm; - TString UserTicket; + std::string Realm; + std::string UserTicket; }; struct TAuthenticationContext diff --git a/yt/yt/core/rpc/balancing_channel.cpp b/yt/yt/core/rpc/balancing_channel.cpp index 7e9cd188d0a..eee3a7f5af6 100644 --- a/yt/yt/core/rpc/balancing_channel.cpp +++ b/yt/yt/core/rpc/balancing_channel.cpp @@ -98,7 +98,7 @@ private: const TBalancingChannelConfigPtr Config_; const std::string EndpointDescription_; const IAttributeDictionaryPtr EndpointAttributes_; - const TString ServiceName_; + const std::string ServiceName_; const TDynamicChannelPoolPtr Pool_; diff --git a/yt/yt/core/rpc/bus/channel.cpp b/yt/yt/core/rpc/bus/channel.cpp index a93471c95cc..d5d0175d004 100644 --- a/yt/yt/core/rpc/bus/channel.cpp +++ b/yt/yt/core/rpc/bus/channel.cpp @@ -229,7 +229,7 @@ private: YT_LOG_DEBUG("Created bus (ConnectionType: Client, VerificationMode: %v, EncryptionMode: %v, Endpoint: %v)", attrs.Get<EVerificationMode>("verification_mode"), attrs.Get<EEncryptionMode>("encryption_mode"), - attrs.Get<TString>("address")); + attrs.Get<std::string>("address")); session->Initialize(bus); bucket.Sessions.push_back(session); diff --git a/yt/yt/core/rpc/caching_channel_factory.cpp b/yt/yt/core/rpc/caching_channel_factory.cpp index df436d877ff..f7d269cd186 100644 --- a/yt/yt/core/rpc/caching_channel_factory.cpp +++ b/yt/yt/core/rpc/caching_channel_factory.cpp @@ -64,7 +64,7 @@ public: private: const TWeakPtr<TCachingChannelFactory> Factory_; - const TString Address_; + const std::string Address_; std::atomic<TInstant> LastActivityTime_; @@ -208,7 +208,7 @@ private: auto deadline = TInstant::Now() - IdleChannelTtl_; - std::vector<std::pair<TString, TCachedChannelPtr>> expiredItems; + std::vector<std::pair<std::string, TCachedChannelPtr>> expiredItems; auto it = TtlCheckQueue_.begin(); while (it != TtlCheckQueue_.end()) { auto channel = it->second.Lock(); diff --git a/yt/yt/core/rpc/client.cpp b/yt/yt/core/rpc/client.cpp index 9c97717ebdd..865c244c74c 100644 --- a/yt/yt/core/rpc/client.cpp +++ b/yt/yt/core/rpc/client.cpp @@ -251,7 +251,7 @@ void TClientRequest::SetUserTag(const std::string& tag) UserTag_ = tag; } -void TClientRequest::SetUserAgent(const TString& userAgent) +void TClientRequest::SetUserAgent(const std::string& userAgent) { Header_.set_user_agent(userAgent); } @@ -465,11 +465,11 @@ void TClientRequest::PrepareHeader() ToProto(Header_.mutable_server_attachments_streaming_parameters(), ServerAttachmentsStreamingParameters_); } - if (User_ && User_ != RootUserName) { + if (!User_.empty() && User_ != RootUserName) { Header_.set_user(User_); } - if (UserTag_ && UserTag_ != Header_.user()) { + if (!UserTag_.empty() && UserTag_ != Header_.user()) { Header_.set_user_tag(UserTag_); } @@ -510,7 +510,7 @@ TClientResponse::TClientResponse(TClientContextPtr clientContext) , ClientContext_(std::move(clientContext)) { } -const TString& TClientResponse::GetAddress() const +const std::string& TClientResponse::GetAddress() const { return Address_; } diff --git a/yt/yt/core/rpc/client.h b/yt/yt/core/rpc/client.h index 4ba8da31eee..0fb76bd9bee 100644 --- a/yt/yt/core/rpc/client.h +++ b/yt/yt/core/rpc/client.h @@ -72,7 +72,7 @@ struct IClientRequest virtual const std::string& GetUserTag() const = 0; virtual void SetUserTag(const std::string& tag) = 0; - virtual void SetUserAgent(const TString& userAgent) = 0; + virtual void SetUserAgent(const std::string& userAgent) = 0; virtual bool GetRetry() const = 0; virtual void SetRetry(bool value) = 0; @@ -186,7 +186,7 @@ public: const std::string& GetUserTag() const override; void SetUserTag(const std::string& tag) override; - void SetUserAgent(const TString& userAgent) override; + void SetUserAgent(const std::string& userAgent) override; bool GetRetry() const override; void SetRetry(bool value) override; @@ -246,8 +246,8 @@ private: TAttachmentsOutputStreamPtr RequestAttachmentsStream_; TAttachmentsInputStreamPtr ResponseAttachmentsStream_; - TString User_; - TString UserTag_; + std::string User_; + std::string UserTag_; TWeakPtr<IClientRequestControl> RequestControl_; @@ -337,7 +337,7 @@ public: //! Returns address of the response sender, as it was provided by the channel configuration (FQDN, IP address, etc). //! Empty if it is not supported by the underlying RPC stack or the OK response has not been received yet. //! Note: complex channels choose destination dynamically (hedging, roaming), so the address is not known beforehand. - const TString& GetAddress() const; + const std::string& GetAddress() const; const NProto::TResponseHeader& Header() const; @@ -371,7 +371,7 @@ protected: const IInvokerPtr& GetInvoker(); private: - TString Address_; + std::string Address_; NProto::TResponseHeader Header_; TSharedRefArray ResponseMessage_; diff --git a/yt/yt/core/rpc/grpc/channel.cpp b/yt/yt/core/rpc/grpc/channel.cpp index 880e6529084..37851d639d8 100644 --- a/yt/yt/core/rpc/grpc/channel.cpp +++ b/yt/yt/core/rpc/grpc/channel.cpp @@ -233,7 +233,7 @@ public: private: const TChannelConfigPtr Config_; - const TString EndpointAddress_; + const std::string EndpointAddress_; const IAttributeDictionaryPtr EndpointAttributes_; const IMemoryUsageTrackerPtr MemoryUsageTracker_ = GetNullMemoryUsageTracker(); @@ -298,11 +298,9 @@ private: NYT::Ref(Tracer_.Get()); } InitialMetadataBuilder_.Add(RequestIdMetadataKey, ToString(Request_->GetRequestId())); - // TODO(babenko): switch to std::string - InitialMetadataBuilder_.Add(UserMetadataKey, TString(Request_->GetUser())); + InitialMetadataBuilder_.Add(UserMetadataKey, Request_->GetUser()); if (!Request_->GetUserTag().empty()) { - // TODO(babenko): switch to std::string - InitialMetadataBuilder_.Add(UserTagMetadataKey, TString(Request_->GetUserTag())); + InitialMetadataBuilder_.Add(UserTagMetadataKey, Request_->GetUserTag()); } TProtocolVersion protocolVersion{ @@ -331,7 +329,7 @@ private: } } - if (const auto traceContext = NTracing::TryGetCurrentTraceContext()) { + if (const auto* traceContext = NTracing::TryGetCurrentTraceContext()) { InitialMetadataBuilder_.Add(TracingTraceIdMetadataKey, ToString(traceContext->GetTraceId())); InitialMetadataBuilder_.Add(TracingSpanIdMetadataKey, ToString(traceContext->GetSpanId())); if (traceContext->IsSampled()) { diff --git a/yt/yt/core/rpc/grpc/helpers.cpp b/yt/yt/core/rpc/grpc/helpers.cpp index 67bd81d1288..947982d7772 100644 --- a/yt/yt/core/rpc/grpc/helpers.cpp +++ b/yt/yt/core/rpc/grpc/helpers.cpp @@ -68,9 +68,9 @@ TStringBuf TGrpcMetadataArray::Find(const char* key) const return TStringBuf(); } -THashMap<std::string, TString> TGrpcMetadataArray::ToMap() const +THashMap<std::string, std::string> TGrpcMetadataArray::ToMap() const { - THashMap<std::string, TString> result; + THashMap<std::string, std::string> result; for (size_t index = 0; index < Native_.count; ++index) { const auto& metadata = Native_.metadata[index]; result[NYT::ToString(metadata.key)] = NYT::ToString(metadata.value); @@ -106,14 +106,14 @@ size_t TGrpcSlice::Size() const return GRPC_SLICE_LENGTH(Native_); } -TString TGrpcSlice::AsString() const +std::string TGrpcSlice::AsString() const { return NYT::ToString(Native_); } //////////////////////////////////////////////////////////////////////////////// -void TGrpcMetadataArrayBuilder::Add(const char* key, TString value) +void TGrpcMetadataArrayBuilder::Add(const char* key, std::string value) { Strings_.push_back(TSharedRef::FromString(std::move(value))); grpc_metadata metadata; @@ -195,7 +195,7 @@ grpc_channel_args* TGrpcChannelArgs::Unwrap() //////////////////////////////////////////////////////////////////////////////// -TGrpcPemKeyCertPair::TGrpcPemKeyCertPair(TString privateKey, TString certChain) +TGrpcPemKeyCertPair::TGrpcPemKeyCertPair(std::string privateKey, std::string certChain) : PrivateKey_(std::move(privateKey)) , CertChain_(std::move(certChain)) , Native_({ @@ -444,7 +444,7 @@ TErrorCode StatusCodeToErrorCode(grpc_status_code statusCode) } } -TString SerializeError(const TError& error) +std::string SerializeError(const TError& error) { TString serializedError; google::protobuf::io::StringOutputStream output(&serializedError); @@ -539,7 +539,7 @@ TX509Ptr ParsePemCertToX509(TStringBuf pemCert) return MakeX509Ptr(PEM_read_bio_X509(bio, nullptr, nullptr, nullptr)); } -std::optional<TString> ParseIssuerFromX509(const TX509Ptr& pemCertX509) +std::optional<std::string> ParseIssuerFromX509(const TX509Ptr& pemCertX509) { auto* issuerName = X509_get_issuer_name(pemCertX509.get()); @@ -549,10 +549,10 @@ std::optional<TString> ParseIssuerFromX509(const TX509Ptr& pemCertX509) return std::nullopt; } - return TString(issuerString); + return std::string(issuerString); } -std::optional<TString> ParseSerialNumberFromX509(const TX509Ptr& pemCertX509) +std::optional<std::string> ParseSerialNumberFromX509(const TX509Ptr& pemCertX509) { ASN1_STRING* serialNumber = X509_get_serialNumber(pemCertX509.get()); if (!serialNumber) { @@ -572,7 +572,7 @@ std::optional<TString> ParseSerialNumberFromX509(const TX509Ptr& pemCertX509) if (!hexSerialNumber) { return std::nullopt; } - return TString(hexSerialNumber); + return std::string(hexSerialNumber); } //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/rpc/grpc/helpers.h b/yt/yt/core/rpc/grpc/helpers.h index 40c2ced2eec..10610280c7b 100644 --- a/yt/yt/core/rpc/grpc/helpers.h +++ b/yt/yt/core/rpc/grpc/helpers.h @@ -165,7 +165,7 @@ class TGrpcMetadataArray public: TStringBuf Find(const char* key) const; - THashMap<std::string, TString> ToMap() const; + THashMap<std::string, std::string> ToMap() const; }; //////////////////////////////////////////////////////////////////////////////// @@ -190,7 +190,7 @@ public: const ui8* Data() const; size_t Size() const; - TString AsString() const; + std::string AsString() const; private: grpc_slice Native_ = grpc_empty_slice(); @@ -201,7 +201,7 @@ private: class TGrpcMetadataArrayBuilder { public: - void Add(const char* key, TString value); + void Add(const char* key, std::string value); size_t GetSize() const; grpc_metadata* Unwrap(); @@ -255,14 +255,14 @@ class TGrpcPemKeyCertPair { public: TGrpcPemKeyCertPair( - TString privateKey, - TString certChain); + std::string privateKey, + std::string certChain); grpc_ssl_pem_key_cert_pair* Unwrap(); private: - TString PrivateKey_; - TString CertChain_; + std::string PrivateKey_; + std::string CertChain_; grpc_ssl_pem_key_cert_pair Native_; }; @@ -288,15 +288,15 @@ TSharedRef ExtractMessageFromEnvelopedMessage(const TSharedRef& data); TErrorCode StatusCodeToErrorCode(grpc_status_code statusCode); -TString SerializeError(const TError& error); +std::string SerializeError(const TError& error); TError DeserializeError(TStringBuf serializedError); TGrpcPemKeyCertPair LoadPemKeyCertPair(const TSslPemKeyCertPairConfigPtr& config); TGrpcChannelCredentialsPtr LoadChannelCredentials(const TChannelCredentialsConfigPtr& config); TGrpcServerCredentialsPtr LoadServerCredentials(const TServerCredentialsConfigPtr& config); TX509Ptr ParsePemCertToX509(TStringBuf pemCert); -std::optional<TString> ParseIssuerFromX509(const TX509Ptr& pemCertX509); -std::optional<TString> ParseSerialNumberFromX509(const TX509Ptr& pemCertX509); +std::optional<std::string> ParseIssuerFromX509(const TX509Ptr& pemCertX509); +std::optional<std::string> ParseSerialNumberFromX509(const TX509Ptr& pemCertX509); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/rpc/grpc/server.cpp b/yt/yt/core/rpc/grpc/server.cpp index 422604b5714..51373549dc6 100644 --- a/yt/yt/core/rpc/grpc/server.cpp +++ b/yt/yt/core/rpc/grpc/server.cpp @@ -307,7 +307,7 @@ private: private: const TWeakPtr<TCallHandler> Handler_; const TNetworkAddress PeerAddress_; - const TString PeerAddressString_; + const std::string PeerAddressString_; const IAttributeDictionaryPtr EndpointAttributes_; TSingleShotCallbackList<void(const TError&)> TerminatedList_; @@ -402,19 +402,19 @@ private: bool CancelRequested_ = false; TSharedRefArray ResponseMessage_; - TString PeerAddressString_; + std::string PeerAddressString_; TNetworkAddress PeerAddress_; TRequestId RequestId_; - std::optional<TString> User_; - std::optional<TString> UserTag_; - std::optional<TString> UserAgent_; + std::optional<std::string> User_; + std::optional<std::string> UserTag_; + std::optional<std::string> UserAgent_; std::optional<NGrpc::NProto::TSslCredentialsExt> SslCredentialsExt_; std::optional<NRpc::NProto::TCredentialsExt> RpcCredentialsExt_; std::optional<NRpc::NProto::TCustomMetadataExt> CustomMetadataExt_; std::optional<NTracing::NProto::TTracingExt> TraceContext_; - TString ServiceName_; - TString MethodName_; + std::string ServiceName_; + std::string MethodName_; std::optional<TDuration> Timeout_; NCompression::ECodec RequestCodec_ = NCompression::ECodec::None; NCompression::ECodec ResponseCodec_ = NCompression::ECodec::None; @@ -430,7 +430,7 @@ private: std::optional<ui32> RequestMessageBodySize_; TProtocolVersion ProtocolVersion_ = DefaultProtocolVersion; TGrpcByteBufferPtr ResponseBodyBuffer_; - TString ErrorMessage_; + std::string ErrorMessage_; TGrpcSlice ErrorMessageSlice_; int RawCanceled_ = 0; @@ -549,20 +549,20 @@ private: bool TryParsePeerAddress() { auto addressString = MakeGprString(grpc_call_get_peer(Call_.Unwrap())); - PeerAddressString_ = TString(addressString.get()); + PeerAddressString_ = std::string(addressString.get()); // Drop ipvN: prefix. - if (PeerAddressString_.StartsWith("ipv6:") || PeerAddressString_.StartsWith("ipv4:")) { + if (PeerAddressString_.starts_with("ipv6:") || PeerAddressString_.starts_with("ipv4:")) { PeerAddressString_ = PeerAddressString_.substr(5); } - if (PeerAddressString_.StartsWith("unix:")) { + if (PeerAddressString_.starts_with("unix:")) { PeerAddress_ = NNet::TNetworkAddress::CreateUnixDomainSocketAddress(PeerAddressString_.substr(5)); return true; } // Decode URL-encoded square brackets. - CGIUnescape(PeerAddressString_); + PeerAddressString_ = CGIUnescapeRet(PeerAddressString_); auto address = NNet::TNetworkAddress::TryParse(PeerAddressString_); if (!address.IsOK()) { @@ -643,7 +643,7 @@ private: return; } - User_ = TString(userString); + User_ = std::string(userString); } void ParseUserTag() @@ -653,7 +653,7 @@ private: return; } - UserTag_ = TString(userTagString); + UserTag_ = std::string(userTagString); } void ParseUserAgent() @@ -663,7 +663,7 @@ private: return; } - UserAgent_ = TString(userAgentString); + UserAgent_ = std::string(userAgentString); } void ParseRequestCodec() @@ -734,19 +734,19 @@ private: RpcCredentialsExt_.emplace(); if (tokenString) { - RpcCredentialsExt_->set_token(TString(tokenString)); + RpcCredentialsExt_->set_token(std::string(tokenString)); } if (sessionIdString) { - RpcCredentialsExt_->set_session_id(TString(sessionIdString)); + RpcCredentialsExt_->set_session_id(std::string(sessionIdString)); } if (sslSessionIdString) { - RpcCredentialsExt_->set_ssl_session_id(TString(sslSessionIdString)); + RpcCredentialsExt_->set_ssl_session_id(std::string(sslSessionIdString)); } if (userTicketString) { - RpcCredentialsExt_->set_user_ticket(TString(userTicketString)); + RpcCredentialsExt_->set_user_ticket(std::string(userTicketString)); } if (serviceTicketString) { - RpcCredentialsExt_->set_service_ticket(TString(serviceTicketString)); + RpcCredentialsExt_->set_service_ticket(std::string(serviceTicketString)); } } @@ -800,7 +800,7 @@ private: if (!sslCredentialsExtension->has_value()) { sslCredentialsExtension->emplace(); } - (*sslCredentialsExtension)->set_peer_identity(TString(peerIdentityProperty->value, peerIdentityProperty->value_length)); + (*sslCredentialsExtension)->set_peer_identity(std::string(peerIdentityProperty->value, peerIdentityProperty->value_length)); } static void ParseIssuerAndSerialNumber(const TGrpcAuthContextPtr& authContext, std::optional<NGrpc::NProto::TSslCredentialsExt>* sslCredentialsExtension) diff --git a/yt/yt/core/rpc/hedging_channel-inl.h b/yt/yt/core/rpc/hedging_channel-inl.h index e8386e86185..d3d315f4785 100644 --- a/yt/yt/core/rpc/hedging_channel-inl.h +++ b/yt/yt/core/rpc/hedging_channel-inl.h @@ -9,7 +9,7 @@ namespace NYT::NRpc { //////////////////////////////////////////////////////////////////////////////// -static const TString BackupFailedKey("backup_failed"); +static const std::string BackupFailedKey("backup_failed"); template <class T> bool IsBackup(const TErrorOr<TIntrusivePtr<T>>& responseOrError) diff --git a/yt/yt/core/rpc/http/channel.cpp b/yt/yt/core/rpc/http/channel.cpp index 8532429ab66..ea7bd6f0412 100644 --- a/yt/yt/core/rpc/http/channel.cpp +++ b/yt/yt/core/rpc/http/channel.cpp @@ -135,7 +135,7 @@ private: IClientPtr Client_; std::optional<TDuration> ClientTimeout_; - const TString EndpointAddress_; + const std::string EndpointAddress_; const IAttributeDictionaryPtr EndpointAttributes_; const NConcurrency::IPollerPtr Poller_; const IMemoryUsageTrackerPtr MemoryUsageTracker_ = GetNullMemoryUsageTracker(); @@ -231,7 +231,7 @@ private: TFuture<IResponsePtr> Response_; static void OnResponse( - const TString& address, + const std::string& address, TRequestId requestId, const std::string& service, const std::string& method, @@ -324,19 +324,19 @@ private: } if (credentialsExt.has_session_id() || credentialsExt.has_ssl_session_id()) { - TString cookieString; + std::string cookieString; - static const TString SessionIdCookieName("Session_id"); - static const TString SessionId2CookieName("sessionid2"); if (credentialsExt.has_session_id()) { - cookieString = TString::Join(SessionIdCookieName, "=", credentialsExt.session_id()); + static const std::string SessionIdCookieName("Session_id"); + cookieString += SessionIdCookieName + "=" + credentialsExt.session_id(); } if (credentialsExt.has_ssl_session_id()) { - if (credentialsExt.has_session_id()) { + if (!cookieString.empty()) { cookieString += "; "; } - cookieString += TString::Join(SessionId2CookieName, "=", credentialsExt.ssl_session_id()); + static const std::string SessionId2CookieName("sessionid2"); + cookieString += SessionId2CookieName + "=" + credentialsExt.ssl_session_id(); } httpHeaders->Add(CookieHeaderName, cookieString); @@ -349,12 +349,12 @@ private: if (const auto& user = request->GetUser(); !user.empty()) { // TODO(babenko): switch to std:::string - httpHeaders->Add(UserNameHeaderName, TString(user)); + httpHeaders->Add(UserNameHeaderName, std::string(user)); } if (const auto& userTag = request->GetUserTag(); !userTag.empty()) { // TODO(babenko): switch to std:::string - httpHeaders->Add(UserTagHeaderName, TString(userTag)); + httpHeaders->Add(UserTagHeaderName, std::string(userTag)); } if (rpcHeader.has_timeout()) { @@ -372,7 +372,7 @@ private: if (rpcHeader.HasExtension(NRpc::NProto::TCustomMetadataExt::custom_metadata_ext)) { const auto& customMetadataExt = rpcHeader.GetExtension(NRpc::NProto::TCustomMetadataExt::custom_metadata_ext); for (const auto& [key, value] : customMetadataExt.entries()) { - httpHeaders->Add(TString::Join("X-", key), value); + httpHeaders->Add("X-" + key, value); } } diff --git a/yt/yt/core/rpc/http/helpers.cpp b/yt/yt/core/rpc/http/helpers.cpp index cf68dc741af..7d1946a58dc 100644 --- a/yt/yt/core/rpc/http/helpers.cpp +++ b/yt/yt/core/rpc/http/helpers.cpp @@ -4,7 +4,7 @@ namespace NYT::NRpc::NHttp { //////////////////////////////////////////////////////////////////////////////// -TString ToHttpContentType(EMessageFormat format) +std::string ToHttpContentType(EMessageFormat format) { switch (format) { case EMessageFormat::Protobuf: diff --git a/yt/yt/core/rpc/http/helpers.h b/yt/yt/core/rpc/http/helpers.h index 8a199233efd..2a10c91b542 100644 --- a/yt/yt/core/rpc/http/helpers.h +++ b/yt/yt/core/rpc/http/helpers.h @@ -6,7 +6,7 @@ namespace NYT::NRpc::NHttp { //////////////////////////////////////////////////////////////////////////////// -TString ToHttpContentType(EMessageFormat format); +std::string ToHttpContentType(EMessageFormat format); std::optional<EMessageFormat> FromHttpContentType(TStringBuf contentType); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/rpc/http/server.cpp b/yt/yt/core/rpc/http/server.cpp index 7da5707e05d..fd8dc7c9628 100644 --- a/yt/yt/core/rpc/http/server.cpp +++ b/yt/yt/core/rpc/http/server.cpp @@ -43,7 +43,7 @@ class THttpReplyBus public: THttpReplyBus( IResponseWriterPtr rsp, - TString endpointAddress, + std::string endpointAddress, IAttributeDictionaryPtr endpointAttributes, TNetworkAddress endpointNetworkAddress, const NLogging::TLogger& logger) @@ -158,7 +158,7 @@ public: private: const IResponseWriterPtr Rsp_; - const TString EndpointAddress_; + const std::string EndpointAddress_; const IAttributeDictionaryPtr EndpointAttributes_; const TNetworkAddress EndpointNetworkAddress_; const NLogging::TLogger Logger; @@ -175,7 +175,7 @@ class THttpHandler : public IHttpHandler { public: - THttpHandler(IServicePtr underlying, const TString& baseUrl, const NLogging::TLogger& logger) + THttpHandler(IServicePtr underlying, const std::string& baseUrl, const NLogging::TLogger& logger) : Underlying_(std::move(underlying)) , BaseUrl_(baseUrl) , Logger(logger) @@ -225,7 +225,7 @@ public: private: const IServicePtr Underlying_; - const TString BaseUrl_; + const std::string BaseUrl_; const NLogging::TLogger Logger; TError TranslateRequest(const IRequestPtr& req, NRpc::NProto::TRequestHeader* rpcHeader, TRequestId* requestId) @@ -305,13 +305,13 @@ private: if (const auto* cookieString = httpHeaders->Find(CookieHeaderName)) { auto cookieMap = ParseCookies(*cookieString); - static const TString SessionIdCookieName("Session_id"); + static const std::string SessionIdCookieName("Session_id"); auto sessionIdIt = cookieMap.find(SessionIdCookieName); if (sessionIdIt != cookieMap.end()) { getCredentialsExt()->set_session_id(sessionIdIt->second); } - static const TString SessionId2CookieName("sessionid2"); + static const std::string SessionId2CookieName("sessionid2"); auto sslSessionIdIt = cookieMap.find(SessionId2CookieName); if (sslSessionIdIt != cookieMap.end()) { getCredentialsExt()->set_ssl_session_id(sslSessionIdIt->second); @@ -350,7 +350,7 @@ private: if (!header.starts_with("X-") && !header.starts_with("x-")) { continue; } - auto key = ToProto(header.substr(2)); + auto key = header.substr(2); (*customMetadataExt.mutable_entries())[key] = value; hasCustomHeaders = true; } @@ -406,7 +406,7 @@ private: // COMPAT(babenko): remove this once fully migrated to new url scheme auto index = service->GetServiceId().ServiceName.find_last_of('.'); - if (index != TString::npos) { + if (index != std::string::npos) { auto anotherBaseUrl = Format("/%v/", service->GetServiceId().ServiceName.substr(index + 1)); HttpServer_->AddHandler(anotherBaseUrl, New<THttpHandler>(std::move(service), anotherBaseUrl, Logger)); } diff --git a/yt/yt/core/rpc/local_channel.cpp b/yt/yt/core/rpc/local_channel.cpp index 821e0f58859..156a34d305a 100644 --- a/yt/yt/core/rpc/local_channel.cpp +++ b/yt/yt/core/rpc/local_channel.cpp @@ -182,7 +182,7 @@ private: const std::string& GetEndpointAddress() const override { - static const TString EmptyAddress; + static const std::string EmptyAddress; return EmptyAddress; } diff --git a/yt/yt/core/rpc/message_format.cpp b/yt/yt/core/rpc/message_format.cpp index 34b390183d4..753068c5fb0 100644 --- a/yt/yt/core/rpc/message_format.cpp +++ b/yt/yt/core/rpc/message_format.cpp @@ -80,7 +80,7 @@ public: // NB: FormatOptionsYson is ignored, since YSON parser has no user-defined options. ParseYsonStringBuffer(TStringBuf(message.Begin(), message.End()), EYsonType::Node, converter.get()); } - return TSharedRef::FromString(FromProto<TString>(protoBuffer)); + return TSharedRef::FromString(FromProto<std::string>(protoBuffer)); } TSharedRef ConvertTo(const TSharedRef& message, const NYson::TProtobufMessageType* messageType, const TYsonString& /*formatOptionsYson*/) override @@ -119,7 +119,7 @@ public: } ParseJson(&input, converter.get(), formatConfig); } - return TSharedRef::FromString(FromProto<TString>(std::move(protoBuffer))); + return TSharedRef::FromString(FromProto<std::string>(std::move(protoBuffer))); } TSharedRef ConvertTo(const TSharedRef& message, const NYson::TProtobufMessageType* messageType, const TYsonString& formatOptionsYson) override diff --git a/yt/yt/core/rpc/null_channel.cpp b/yt/yt/core/rpc/null_channel.cpp index ce7b129a70b..38facc182e4 100644 --- a/yt/yt/core/rpc/null_channel.cpp +++ b/yt/yt/core/rpc/null_channel.cpp @@ -56,7 +56,7 @@ public: } private: - const TString Address_; + const std::string Address_; const IMemoryUsageTrackerPtr MemoryUsageTracker_ = GetNullMemoryUsageTracker(); }; diff --git a/yt/yt/core/rpc/per_key_request_queue_provider.cpp b/yt/yt/core/rpc/per_key_request_queue_provider.cpp index 314f53170d8..0bbc80f6023 100644 --- a/yt/yt/core/rpc/per_key_request_queue_provider.cpp +++ b/yt/yt/core/rpc/per_key_request_queue_provider.cpp @@ -26,7 +26,7 @@ bool TPerUserRequestQueueProvider::IsReconfigurationPermitted(const std::string& TPerUserRequestQueueProvider::TKeyFromRequestHeaderCallback TPerUserRequestQueueProvider::CreateKeyFromRequestHeaderCallback() { return BIND([] (const NProto::TRequestHeader& header) { - return header.has_user() ? ::NYT::FromProto<TString>(header.user()) : RootUserName; + return header.has_user() ? ::NYT::FromProto<std::string>(header.user()) : RootUserName; }); } diff --git a/yt/yt/core/rpc/public.cpp b/yt/yt/core/rpc/public.cpp index e8edfe126b0..ea09444f7d7 100644 --- a/yt/yt/core/rpc/public.cpp +++ b/yt/yt/core/rpc/public.cpp @@ -10,14 +10,14 @@ const TMutationId NullMutationId; const std::string RootUserName("root"); -const TString RequestIdAnnotation("rpc.request_id"); -const TString EndpointAnnotation("rpc.endpoint"); -const TString RequestInfoAnnotation("rpc.request_info"); -const TString RequestUser("rpc.request_user"); -const TString ResponseInfoAnnotation("rpc.response_info"); - -const TString FeatureIdAttributeKey("feature_id"); -const TString FeatureNameAttributeKey("feature_name"); +const std::string RequestIdAnnotation("rpc.request_id"); +const std::string EndpointAnnotation("rpc.endpoint"); +const std::string RequestInfoAnnotation("rpc.request_info"); +const std::string RequestUser("rpc.request_user"); +const std::string ResponseInfoAnnotation("rpc.response_info"); + +const std::string FeatureIdAttributeKey("feature_id"); +const std::string FeatureNameAttributeKey("feature_name"); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/rpc/public.h b/yt/yt/core/rpc/public.h index 9283922ec6e..5955185d368 100644 --- a/yt/yt/core/rpc/public.h +++ b/yt/yt/core/rpc/public.h @@ -165,14 +165,14 @@ using TFeatureIdFormatter = const std::function<std::optional<TStringBuf>(int fe //////////////////////////////////////////////////////////////////////////////// -extern const TString RequestIdAnnotation; -extern const TString EndpointAnnotation; -extern const TString RequestInfoAnnotation; -extern const TString RequestUser; -extern const TString ResponseInfoAnnotation; - -extern const TString FeatureIdAttributeKey; -extern const TString FeatureNameAttributeKey; +extern const std::string RequestIdAnnotation; +extern const std::string EndpointAnnotation; +extern const std::string RequestInfoAnnotation; +extern const std::string RequestUser; +extern const std::string ResponseInfoAnnotation; + +extern const std::string FeatureIdAttributeKey; +extern const std::string FeatureNameAttributeKey; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/rpc/server_detail.cpp b/yt/yt/core/rpc/server_detail.cpp index 376abafd44a..8bc75b1e7d6 100644 --- a/yt/yt/core/rpc/server_detail.cpp +++ b/yt/yt/core/rpc/server_detail.cpp @@ -339,7 +339,7 @@ const IAttributeDictionary& TServiceContextBase::GetEndpointAttributes() const const std::string& TServiceContextBase::GetEndpointDescription() const { - static const TString EmptyEndpointDescription; + static const std::string EmptyEndpointDescription; return EmptyEndpointDescription; } @@ -440,7 +440,7 @@ bool TServiceContextBase::IsLoggingEnabled() const return LoggingEnabled_; } -void TServiceContextBase::SetRawRequestInfo(TString info, bool incremental) +void TServiceContextBase::SetRawRequestInfo(std::string info, bool incremental) { YT_ASSERT(!Replied_); @@ -465,7 +465,7 @@ void TServiceContextBase::SuppressMissingRequestInfoCheck() RequestInfoSet_ = true; } -void TServiceContextBase::SetRawResponseInfo(TString info, bool incremental) +void TServiceContextBase::SetRawResponseInfo(std::string info, bool incremental) { YT_ASSERT(!Replied_); @@ -755,7 +755,7 @@ bool TServiceContextWrapper::IsLoggingEnabled() const return UnderlyingContext_->IsLoggingEnabled(); } -void TServiceContextWrapper::SetRawRequestInfo(TString info, bool incremental) +void TServiceContextWrapper::SetRawRequestInfo(std::string info, bool incremental) { UnderlyingContext_->SetRawRequestInfo(std::move(info), incremental); } @@ -765,7 +765,7 @@ void TServiceContextWrapper::SuppressMissingRequestInfoCheck() UnderlyingContext_->SuppressMissingRequestInfoCheck(); } -void TServiceContextWrapper::SetRawResponseInfo(TString info, bool incremental) +void TServiceContextWrapper::SetRawResponseInfo(std::string info, bool incremental) { UnderlyingContext_->SetRawResponseInfo(std::move(info), incremental); } diff --git a/yt/yt/core/rpc/server_detail.h b/yt/yt/core/rpc/server_detail.h index b1778237215..8bb7f74e924 100644 --- a/yt/yt/core/rpc/server_detail.h +++ b/yt/yt/core/rpc/server_detail.h @@ -99,9 +99,9 @@ public: NProto::TRequestHeader& RequestHeader() override; bool IsLoggingEnabled() const override; - void SetRawRequestInfo(TString info, bool incremental) override; + void SetRawRequestInfo(std::string info, bool incremental) override; void SuppressMissingRequestInfoCheck() override; - void SetRawResponseInfo(TString info, bool incremental) override; + void SetRawResponseInfo(std::string info, bool incremental) override; const IMemoryUsageTrackerPtr& GetMemoryUsageTracker() const override; @@ -149,8 +149,8 @@ protected: std::vector<TSharedRef> ResponseAttachments_; bool RequestInfoSet_ = false; - TCompactVector<TString, 4> RequestInfos_; - TCompactVector<TString, 4> ResponseInfos_; + TCompactVector<std::string, 4> RequestInfos_; + TCompactVector<std::string, 4> ResponseInfos_; NCompression::ECodec ResponseCodec_ = NCompression::ECodec::None; // COMPAT(danilalexeev) @@ -267,9 +267,9 @@ public: NProto::TRequestHeader& RequestHeader() override; bool IsLoggingEnabled() const override; - void SetRawRequestInfo(TString info, bool incremental) override; + void SetRawRequestInfo(std::string info, bool incremental) override; void SuppressMissingRequestInfoCheck() override; - void SetRawResponseInfo(TString info, bool incremental) override; + void SetRawResponseInfo(std::string info, bool incremental) override; const IMemoryUsageTrackerPtr& GetMemoryUsageTracker() const override; diff --git a/yt/yt/core/rpc/service.cpp b/yt/yt/core/rpc/service.cpp index 6387738d911..dc72677a747 100644 --- a/yt/yt/core/rpc/service.cpp +++ b/yt/yt/core/rpc/service.cpp @@ -6,12 +6,12 @@ namespace NYT::NRpc { void IServiceContext::SetRequestInfo() { - SetRawRequestInfo(TString(), false); + SetRawRequestInfo(std::string(), false); } void IServiceContext::SetResponseInfo() { - SetRawResponseInfo(TString(), false); + SetRawResponseInfo(std::string(), false); } void IServiceContext::ReplyFrom(TFuture<TSharedRefArray> asyncMessage) diff --git a/yt/yt/core/rpc/service.h b/yt/yt/core/rpc/service.h index b9bd49473ee..031f968b073 100644 --- a/yt/yt/core/rpc/service.h +++ b/yt/yt/core/rpc/service.h @@ -205,7 +205,7 @@ struct IServiceContext * Passing empty \p info in incremental mode is no-op. * Passing empty \p info in non-incremental mode flushes the logging message. */ - virtual void SetRawRequestInfo(TString info, bool incremental) = 0; + virtual void SetRawRequestInfo(std::string info, bool incremental) = 0; //! After this call there is no obligation to set request info for this request. virtual void SuppressMissingRequestInfoCheck() = 0; @@ -218,7 +218,7 @@ struct IServiceContext * Passing empty \p info in incremental mode is no-op. * Passing empty \p info in non-incremental mode clears the logging infos. */ - virtual void SetRawResponseInfo(TString info, bool incremental) = 0; + virtual void SetRawResponseInfo(std::string info, bool incremental) = 0; //! Returns the memory usage tracker for request/response messages. virtual const IMemoryUsageTrackerPtr& GetMemoryUsageTracker() const = 0; @@ -352,7 +352,7 @@ struct THash<NYT::NRpc::TServiceId> inline size_t operator()(const NYT::NRpc::TServiceId& id) const { return - THash<TString>()(id.ServiceName) * 497 + + THash<std::string>()(id.ServiceName) * 497 + THash<NYT::NRpc::TRealmId>()(id.RealmId); } }; diff --git a/yt/yt/core/rpc/service_detail.cpp b/yt/yt/core/rpc/service_detail.cpp index 455b438c612..b86f792f283 100644 --- a/yt/yt/core/rpc/service_detail.cpp +++ b/yt/yt/core/rpc/service_detail.cpp @@ -114,7 +114,7 @@ THandlerInvocationOptions THandlerInvocationOptions::SetResponseCodec(NCompressi //////////////////////////////////////////////////////////////////////////////// TServiceBase::TMethodDescriptor::TMethodDescriptor( - TString method, + std::string method, TLiteHandler liteHandler, THeavyHandler heavyHandler) : Method(std::move(method)) @@ -1853,7 +1853,7 @@ void TServiceBase::ReplyError(TError error, TIncomingRequest&& incomingRequest) YT_UNUSED_FUTURE(incomingRequest.ReplyBus->Send(errorMessage)); } -void TServiceBase::OnMethodError(TError* /*error*/, const TString& /*method*/) +void TServiceBase::OnMethodError(TError* /*error*/, const std::string& /*method*/) { } void TServiceBase::OnRequestAuthenticated( @@ -2531,7 +2531,7 @@ void TServiceBase::OnDiscoverRequestReplyDelayReached(TCtxDiscoverPtr context) } } -TString TServiceBase::GetDiscoverRequestPayload(const TCtxDiscoverPtr& context) +std::string TServiceBase::GetDiscoverRequestPayload(const TCtxDiscoverPtr& context) { auto request = context->Request(); request.set_reply_delay(0); @@ -2796,11 +2796,11 @@ bool TServiceBase::IsUp(const TCtxDiscoverPtr& /*context*/) void TServiceBase::EnrichDiscoverResponse(TRspDiscover* /*response*/) { } -std::vector<TString> TServiceBase::SuggestAddresses() +std::vector<std::string> TServiceBase::SuggestAddresses() { YT_ASSERT_THREAD_AFFINITY_ANY(); - return std::vector<TString>(); + return std::vector<std::string>(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/rpc/service_detail.h b/yt/yt/core/rpc/service_detail.h index 7239c44a00b..c8412a9ec5e 100644 --- a/yt/yt/core/rpc/service_detail.h +++ b/yt/yt/core/rpc/service_detail.h @@ -569,7 +569,7 @@ protected: { // Defaults. TMethodDescriptor( - TString method, + std::string method, TLiteHandler liteHandler, THeavyHandler heavyHandler); @@ -588,7 +588,7 @@ protected: TInvokerProvider InvokerProvider; //! Service method name. - TString Method; + std::string Method; //! A handler that will serve lite requests. TLiteHandler LiteHandler; @@ -892,7 +892,7 @@ protected: * \note * Thread affinity: any */ - virtual std::vector<TString> SuggestAddresses(); + virtual std::vector<std::string> SuggestAddresses(); //! Part of #DoConfigure //! #DoConfigure configures already registered methods. @@ -911,7 +911,7 @@ protected: protected: virtual void OnMethodError( TError* error, - const TString& method); + const std::string& method); private: friend class TRequestQueue; @@ -1086,7 +1086,7 @@ private: void OnDiscoverRequestReplyDelayReached(TCtxDiscoverPtr context); - static TString GetDiscoverRequestPayload(const TCtxDiscoverPtr& context); + static std::string GetDiscoverRequestPayload(const TCtxDiscoverPtr& context); void OnServiceLivenessCheck(); }; diff --git a/yt/yt/core/rpc/unittests/lib/common.h b/yt/yt/core/rpc/unittests/lib/common.h index 0af054cd8cc..cb3b0ab6b06 100644 --- a/yt/yt/core/rpc/unittests/lib/common.h +++ b/yt/yt/core/rpc/unittests/lib/common.h @@ -103,7 +103,7 @@ public: } IChannelPtr CreateChannel( - const std::optional<TString>& address = {}, + const std::optional<std::string>& address = {}, THashMap<std::string, NYTree::INodePtr> grpcArguments = {}) { return TImpl::CreateChannel( @@ -243,7 +243,7 @@ public: * openssl x509 -in server.csr -req -days 10000 -out server_cert.pem -CA root_cert.pem -CAkey root_key.pem -CAcreateserial * openssl x509 -in client.csr -req -days 10000 -out client_cert.pem -CA root_cert.pem -CAkey root_key.pem -CAserial root_cert.srl */ -inline TString RootCert( +inline std::string RootCert( "-----BEGIN CERTIFICATE-----\n" "MIID9DCCAtygAwIBAgIJAJLU9fgmNTujMA0GCSqGSIb3DQEBCwUAMFkxCzAJBgNV\n" "BAYTAlJVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\n" @@ -269,7 +269,7 @@ inline TString RootCert( "I2TYYgHjI3I=\n" "-----END CERTIFICATE-----\n"); -inline TString ClientKey( +inline std::string ClientKey( "-----BEGIN RSA PRIVATE KEY-----\n" "MIIEpAIBAAKCAQEArZpqucOdMlwZyyTWq+Sz3EGXpAX/4nMpH7s/05d9O4tm0MsK\n" "QUhUXRzt3VzOfMOb4cXAVwovHxiQ7NZIFBdmeyCHlT0HVkaqC76Tgi53scUMVKtE\n" @@ -298,7 +298,7 @@ inline TString ClientKey( "OY4A1p2EvY8/L6PmPXAURfsE8RTL0y4ww/7mPJTQXsteTawAPDdVKQ==\n" "-----END RSA PRIVATE KEY-----\n"); -inline TString ClientCert( +inline std::string ClientCert( "-----BEGIN CERTIFICATE-----\n" "MIIDLjCCAhYCCQCZd28+0jJVLTANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJS\n" "VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0\n" @@ -320,7 +320,7 @@ inline TString ClientCert( "3SA=\n" "-----END CERTIFICATE-----\n"); -inline TString ServerKey( +inline std::string ServerKey( "-----BEGIN RSA PRIVATE KEY-----\n" "MIIEowIBAAKCAQEAzbAyEJFSmPNJ3pLNNSWQVF53Ltof1Wc4JIfvNazl41LjNyuO\n" "SQV7+6GVFMIybBBoeWQ58hVJ/d8KxFBf6XIV6uGH9WtN38hWrxR6UEGkHxpUSfvg\n" @@ -349,7 +349,7 @@ inline TString ServerKey( "CyxY8hFTw3FSk+UYdAAm5qYabGY1DiuvyD1yVAX9aWjAHdbP3H5O\n" "-----END RSA PRIVATE KEY-----\n"); -inline TString ServerCert( +inline std::string ServerCert( "-----BEGIN CERTIFICATE-----\n" "MIIDLjCCAhYCCQCZd28+0jJVLDANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJS\n" "VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0\n" diff --git a/yt/yt/core/rpc/unittests/lib/test_service.cpp b/yt/yt/core/rpc/unittests/lib/test_service.cpp index fc21f1626d0..589579b7d89 100644 --- a/yt/yt/core/rpc/unittests/lib/test_service.cpp +++ b/yt/yt/core/rpc/unittests/lib/test_service.cpp @@ -114,7 +114,7 @@ public: if (request->wait_on_latch()) { Latch()->Wait(); } - response->set_allocated_string(TString("r", request->size())); + response->set_allocated_string(std::string("r", request->size())); context->Reply(); } diff --git a/yt/yt/core/rpc/unittests/mock/service.h b/yt/yt/core/rpc/unittests/mock/service.h index 152e5157946..0a9a890c363 100644 --- a/yt/yt/core/rpc/unittests/mock/service.h +++ b/yt/yt/core/rpc/unittests/mock/service.h @@ -281,13 +281,13 @@ public: MOCK_METHOD( void, SetRawRequestInfo, - (TString info, bool incremental), + (std::string info, bool incremental), (override)); MOCK_METHOD( void, SetRawResponseInfo, - (TString info, bool incremental), + (std::string info, bool incremental), (override)); MOCK_METHOD( diff --git a/yt/yt/core/rpc/unittests/rpc_ut.cpp b/yt/yt/core/rpc/unittests/rpc_ut.cpp index 64f846a480b..a23d844c0eb 100644 --- a/yt/yt/core/rpc/unittests/rpc_ut.cpp +++ b/yt/yt/core/rpc/unittests/rpc_ut.cpp @@ -37,9 +37,9 @@ public: //////////////////////////////////////////////////////////////////////////////// -TString StringFromSharedRef(const TSharedRef& sharedRef) +std::string StringFromRef(TRef ref) { - return TString(sharedRef.Begin(), sharedRef.Begin() + sharedRef.Size()); + return std::string(ref.Begin(), ref.Size()); } //////////////////////////////////////////////////////////////////////////////// @@ -399,7 +399,7 @@ TYPED_TEST(TNotGrpcTest, LaggyStreamingRequest) TYPED_TEST(TNotGrpcTest, VeryLaggyStreamingRequest) { - auto configText = TString(R"({ + auto configText = std::string(R"({ services = { TestService = { pending_payloads_timeout = 250; @@ -508,9 +508,9 @@ TYPED_TEST(TAttachmentsTest, RegularAttachments) const auto& attachments = rsp->Attachments(); EXPECT_EQ(3u, attachments.size()); - EXPECT_EQ("Hello_", StringFromSharedRef(attachments[0])); - EXPECT_EQ("from_", StringFromSharedRef(attachments[1])); - EXPECT_EQ("TTestProxy_", StringFromSharedRef(attachments[2])); + EXPECT_EQ("Hello_", StringFromRef(attachments[0])); + EXPECT_EQ("from_", StringFromRef(attachments[1])); + EXPECT_EQ("TTestProxy_", StringFromRef(attachments[2])); } TYPED_TEST(TNotGrpcTest, TrackedRegularAttachments) @@ -540,9 +540,9 @@ TYPED_TEST(TNotGrpcTest, TrackedRegularAttachments) EXPECT_GE(memoryUsageTracker->GetTotalUsage(), 4197 + 32768 + std::ssize(GetRpcUserAgent())); } EXPECT_EQ(3u, attachments.size()); - EXPECT_EQ("Hello_", StringFromSharedRef(attachments[0])); - EXPECT_EQ("from_", StringFromSharedRef(attachments[1])); - EXPECT_EQ("TTestProxy_", StringFromSharedRef(attachments[2])); + EXPECT_EQ("Hello_", StringFromRef(attachments[0])); + EXPECT_EQ("from_", StringFromRef(attachments[1])); + EXPECT_EQ("TTestProxy_", StringFromRef(attachments[2])); } TYPED_TEST(TAttachmentsTest, NullAndEmptyAttachments) @@ -572,8 +572,8 @@ TYPED_TEST(TNotGrpcTest, Compression) auto memoryUsageTracker = this->GetMemoryUsageTracker(); memoryUsageTracker->ClearTotalUsage(); - TString message("This is a message string."); - std::vector<TString> attachmentStrings({ + std::string message("This is a message string."); + std::vector<std::string> attachmentStrings({ "This is an attachment string.", "640K ought to be enough for anybody.", "According to all known laws of aviation, there is no way that a bee should be able to fly." @@ -618,7 +618,7 @@ TYPED_TEST(TNotGrpcTest, Compression) EXPECT_TRUE(rsp->GetResponseMessage().Size() == attachments.size() + 2); auto* responseCodec = NCompression::GetCodec(responseCodecId); for (int i = 0; i < std::ssize(attachments); ++i) { - EXPECT_TRUE(StringFromSharedRef(attachments[i]) == attachmentStrings[i]); + EXPECT_TRUE(StringFromRef(attachments[i]) == attachmentStrings[i]); auto compressedAttachment = responseCodec->Compress(attachments[i]); EXPECT_TRUE(TRef::AreBitwiseEqual(rsp->GetResponseMessage()[i + 2], compressedAttachment)); } @@ -626,7 +626,7 @@ TYPED_TEST(TNotGrpcTest, Compression) TYPED_TEST(TNotGrpcTest, RequestBytesThrottling) { - auto configText = TString(R"({ + auto configText = std::string(R"({ services = { TestService = { methods = { @@ -810,7 +810,7 @@ TYPED_TEST(TNotGrpcTest, RequestMemoryPressureException) proxy.SetDefaultTimeout(TDuration::Seconds(10.0)); auto req = proxy.SomeCall(); req->set_a(42); - req->Attachments().push_back(TSharedRef::FromString(TString(34_MB, 'x'))); + req->Attachments().push_back(TSharedRef::FromString(std::string(34_MB, 'x'))); auto result = WaitFor(req->Invoke().AsVoid()); // Limit of memory is 32 MB. @@ -903,7 +903,7 @@ TYPED_TEST(TNotGrpcTest, MemoryOvercommit) proxy.SetDefaultTimeout(TDuration::Seconds(60.0)); auto req = proxy.SlowCall(); req->set_request_codec(ToProto(requestCodecId)); - req->Attachments().push_back(TSharedRef::FromString(TString(6_KB, 'x'))); + req->Attachments().push_back(TSharedRef::FromString(std::string(6_KB, 'x'))); WaitFor(req->Invoke()).ThrowOnError(); if (TypeParam::MemoryUsageTrackingEnabled) { @@ -936,7 +936,7 @@ TYPED_TEST(TNotGrpcTest, RequestQueueByteSizeLimit) for (int i = 0; i < 15; ++i) { auto req = proxies[i].SlowCall(); req->set_request_codec(ToProto(requestCodecId)); - req->set_message(TString(2_MB, 'x')); + req->set_message(std::string(2_MB, 'x')); futures.push_back(req->Invoke().AsVoid()); } @@ -946,7 +946,7 @@ TYPED_TEST(TNotGrpcTest, RequestQueueByteSizeLimit) proxy.SetDefaultTimeout(TDuration::Seconds(60.0)); auto req = proxy.SlowCall(); req->set_request_codec(ToProto(requestCodecId)); - req->set_message(TString(1_MB, 'x')); + req->set_message(std::string(1_MB, 'x')); EXPECT_EQ(NRpc::EErrorCode::RequestQueueSizeLimitExceeded, req->Invoke().Get().GetCode()); } @@ -1062,7 +1062,7 @@ TYPED_TEST(TNotGrpcTest, RequiredServerFeatureNotSupported) auto rspOrError = req->Invoke().Get(); EXPECT_EQ(NRpc::EErrorCode::UnsupportedServerFeature, rspOrError.GetCode()); EXPECT_EQ(static_cast<int>(ETestFeature::Cool), rspOrError.Attributes().Get<int>(FeatureIdAttributeKey)); - EXPECT_EQ(ToString(ETestFeature::Cool), rspOrError.Attributes().Get<TString>(FeatureNameAttributeKey)); + EXPECT_EQ(ToString(ETestFeature::Cool), rspOrError.Attributes().Get<std::string>(FeatureNameAttributeKey)); } TYPED_TEST(TNotGrpcTest, RequiredClientFeatureSupported) @@ -1082,7 +1082,7 @@ TYPED_TEST(TNotGrpcTest, RequiredClientFeatureNotSupported) auto rspOrError = req->Invoke().Get(); EXPECT_EQ(NRpc::EErrorCode::UnsupportedClientFeature, rspOrError.GetCode()); EXPECT_EQ(static_cast<int>(ETestFeature::Cool), rspOrError.Attributes().Get<int>(FeatureIdAttributeKey)); - EXPECT_EQ(ToString(ETestFeature::Cool), rspOrError.Attributes().Get<TString>(FeatureNameAttributeKey)); + EXPECT_EQ(ToString(ETestFeature::Cool), rspOrError.Attributes().Get<std::string>(FeatureNameAttributeKey)); } TYPED_TEST(TRpcTest, StopWithoutActiveRequests) diff --git a/yt/yt/core/rpc/unittests/viable_peer_registry_ut.cpp b/yt/yt/core/rpc/unittests/viable_peer_registry_ut.cpp index c7f7896dd4c..578acbe9607 100644 --- a/yt/yt/core/rpc/unittests/viable_peer_registry_ut.cpp +++ b/yt/yt/core/rpc/unittests/viable_peer_registry_ut.cpp @@ -35,7 +35,7 @@ const NLogging::TLogger Logger{"ViablePeerRegistryUnitTest"}; TEST(TIndexedHashMapTest, Simple) { - TIndexedHashMap<TString, int> test; + TIndexedHashMap<std::string, int> test; EXPECT_EQ(test.Size(), 0); @@ -54,7 +54,7 @@ TEST(TIndexedHashMapTest, Simple) EXPECT_TRUE(test.Set("c", 42)); EXPECT_EQ(test.Size(), 3); - TIndexedHashMap<TString, int>::TUnderlyingStorage data; + TIndexedHashMap<std::string, int>::TUnderlyingStorage data; for (int i = 0; i < test.Size(); ++i) { data.push_back(test[i]); } @@ -336,7 +336,7 @@ TEST_P(TParametrizedViablePeerRegistryTest, GetChannelBasic) EXPECT_TRUE(viablePeerRegistry->RegisterPeer("d")); EXPECT_TRUE(viablePeerRegistry->RegisterPeer("e")); - TString retrievedPeer; + std::string retrievedPeer; { auto channel = viablePeerRegistry->PickRandomChannel(CreateRequest(), /*hedgingOptions*/ {}); retrievedPeer = channel->GetEndpointDescription(); @@ -399,7 +399,7 @@ TEST_P(TParametrizedViablePeerRegistryTest, GetStickyChannel) EXPECT_EQ(retrievedAddresses.size(), 1u); - THashMap<IClientRequestPtr, TString> requestToPeer; + THashMap<IClientRequestPtr, std::string> requestToPeer; for (int iter = 0; iter < 1000; ++iter) { auto request = CreateRequest(/*enableStickiness*/ true); auto channel = viablePeerRegistry->PickStickyChannel(request); diff --git a/yt/yt/core/ytree/ypath_client.cpp b/yt/yt/core/ytree/ypath_client.cpp index 934b2d498e7..bd18ac308bd 100644 --- a/yt/yt/core/ytree/ypath_client.cpp +++ b/yt/yt/core/ytree/ypath_client.cpp @@ -107,7 +107,7 @@ void TYPathRequest::SetUserTag(const std::string& /*tag*/) YT_ABORT(); } -void TYPathRequest::SetUserAgent(const TString& /*userAgent*/) +void TYPathRequest::SetUserAgent(const std::string& /*userAgent*/) { YT_ABORT(); } diff --git a/yt/yt/core/ytree/ypath_client.h b/yt/yt/core/ytree/ypath_client.h index 3e34958b488..c97e8e36d15 100644 --- a/yt/yt/core/ytree/ypath_client.h +++ b/yt/yt/core/ytree/ypath_client.h @@ -47,7 +47,7 @@ public: const std::string& GetUserTag() const override; void SetUserTag(const std::string& tag) override; - void SetUserAgent(const TString& userAgent) override; + void SetUserAgent(const std::string& userAgent) override; bool GetRetry() const override; void SetRetry(bool value) override; |