aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstanly <stanly@yandex-team.ru>2022-02-10 16:46:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:49 +0300
commitcde218e65dfef5ce03a48d641fd8f7913cf17b2d (patch)
treed3349caea4095825a55b5ba24fe758067b29ce6f
parent9f813499b4ef585cb3c2bb93de93ef003daf4fc4 (diff)
downloadydb-cde218e65dfef5ce03a48d641fd8f7913cf17b2d.tar.gz
Restoring authorship annotation for <stanly@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--build/ya.conf.json26
-rwxr-xr-xbuild/ymake_conf.py18
-rw-r--r--contrib/libs/ya.make28
-rw-r--r--library/cpp/actors/core/actor.h12
-rw-r--r--library/cpp/actors/core/event_pb.h6
-rw-r--r--library/cpp/coroutine/listener/listen.cpp6
-rw-r--r--library/cpp/coroutine/ya.make2
-rw-r--r--library/cpp/dbg_output/ut/dbg_output_ut.cpp2
-rw-r--r--library/cpp/deprecated/kmp/kmp.h2
-rw-r--r--library/cpp/deprecated/kmp/kmp_ut.cpp4
-rw-r--r--library/cpp/deprecated/split/delim_string_iter.h60
-rw-r--r--library/cpp/deprecated/split/delim_string_iter_ut.cpp2
-rw-r--r--library/cpp/deprecated/ya.make2
-rw-r--r--library/cpp/diff/diff.cpp10
-rw-r--r--library/cpp/diff/diff.h12
-rw-r--r--library/cpp/diff/diff_ut.cpp24
-rw-r--r--library/cpp/html/escape/escape.cpp42
-rw-r--r--library/cpp/html/escape/escape.h10
-rw-r--r--library/cpp/html/escape/ut/escape_ut.cpp24
-rw-r--r--library/cpp/html/escape/ut/ya.make24
-rw-r--r--library/cpp/html/escape/ya.make16
-rw-r--r--library/cpp/http/fetch/httpfetcher.h18
-rw-r--r--library/cpp/http/fetch/httpfsm.rl612
-rw-r--r--library/cpp/http/fetch/httpfsm_ut.cpp12
-rw-r--r--library/cpp/http/fetch/httpheader.h46
-rw-r--r--library/cpp/http/fetch/ya.make2
-rw-r--r--library/cpp/http/misc/ya.make4
-rw-r--r--library/cpp/http/server/options.h10
-rw-r--r--library/cpp/http/server/ya.make4
-rw-r--r--library/cpp/logger/global/global.h8
-rw-r--r--library/cpp/logger/log.cpp28
-rw-r--r--library/cpp/logger/log.h14
-rw-r--r--library/cpp/messagebus/actor/executor.cpp6
-rw-r--r--library/cpp/messagebus/base.h4
-rw-r--r--library/cpp/messagebus/config/netaddr.cpp32
-rw-r--r--library/cpp/messagebus/config/netaddr.h28
-rw-r--r--library/cpp/messagebus/coreconn.cpp4
-rw-r--r--library/cpp/messagebus/coreconn.h10
-rw-r--r--library/cpp/messagebus/locator.cpp40
-rw-r--r--library/cpp/messagebus/messqueue.cpp2
-rw-r--r--library/cpp/messagebus/netaddr.h6
-rw-r--r--library/cpp/messagebus/rain_check/core/task.cpp4
-rw-r--r--library/cpp/messagebus/rain_check/core/task.h6
-rw-r--r--library/cpp/messagebus/rain_check/messagebus/messagebus_server.h2
-rw-r--r--library/cpp/messagebus/session.cpp8
-rw-r--r--library/cpp/messagebus/ybus.h4
-rw-r--r--library/cpp/mime/types/mime.cpp10
-rw-r--r--library/cpp/mime/types/mime.h6
-rw-r--r--library/cpp/mime/types/ya.make22
-rw-r--r--library/cpp/mime/ya.make8
-rw-r--r--library/cpp/monlib/counters/counters.h4
-rw-r--r--library/cpp/monlib/service/service.cpp2
-rw-r--r--library/cpp/string_utils/base64/base64.cpp14
-rw-r--r--library/cpp/string_utils/base64/base64.h4
-rw-r--r--library/cpp/string_utils/quote/quote.cpp12
-rw-r--r--library/cpp/string_utils/quote/quote.h8
-rw-r--r--library/cpp/string_utils/quote/quote_ut.cpp72
-rw-r--r--library/cpp/string_utils/url/url_ut.cpp2
-rw-r--r--library/cpp/testing/unittest/registar.cpp626
-rw-r--r--library/cpp/testing/unittest/registar.h118
-rw-r--r--library/cpp/uri/location.cpp18
-rw-r--r--library/cpp/uri/location.h22
-rw-r--r--library/cpp/uri/location_ut.cpp42
-rw-r--r--library/cpp/uri/ut/ya.make2
-rw-r--r--library/cpp/uri/ya.make2
-rw-r--r--tools/ya.make2
-rw-r--r--util/folder/fts.cpp56
-rw-r--r--util/folder/fts.h2
-rw-r--r--util/folder/iterator.h8
-rw-r--r--util/folder/iterator_ut.cpp80
-rw-r--r--util/folder/path.cpp16
-rw-r--r--util/folder/path.h10
-rw-r--r--util/generic/array_ref.h6
-rw-r--r--util/generic/buffer.cpp14
-rw-r--r--util/generic/intrlist.h48
-rw-r--r--util/generic/iterator.h4
-rw-r--r--util/generic/iterator_range.cpp2
-rw-r--r--util/generic/iterator_range.h18
-rw-r--r--util/generic/iterator_range_ut.cpp40
-rw-r--r--util/generic/ptr_ut.cpp20
-rw-r--r--util/generic/stack.h6
-rw-r--r--util/generic/stack_ut.cpp20
-rw-r--r--util/generic/ut/ya.make2
-rw-r--r--util/generic/vector.h28
-rw-r--r--util/generic/vector_ut.cpp44
-rw-r--r--util/memory/pool.h16
-rw-r--r--util/memory/segmented_string_pool.h12
-rw-r--r--util/network/socket.cpp76
-rw-r--r--util/network/socket.h16
-rw-r--r--util/string/ascii.h34
-rw-r--r--util/string/ascii_ut.cpp20
-rw-r--r--util/string/printf_ut.cpp8
-rw-r--r--util/system/hostname.cpp82
-rw-r--r--util/system/hostname.h4
-rw-r--r--util/system/hostname_ut.cpp4
-rw-r--r--util/system/spin_wait.cpp2
-rw-r--r--util/thread/lfqueue.h62
-rw-r--r--util/ya.make2
-rw-r--r--ydb/core/base/events.h4
-rw-r--r--ydb/core/client/minikql_compile/ya.make2
-rw-r--r--ydb/core/client/server/grpc_base.h4
-rw-r--r--ydb/core/client/server/grpc_server.cpp194
-rw-r--r--ydb/core/client/server/grpc_server.h76
-rw-r--r--ydb/core/client/server/msgbus_server.cpp4
-rw-r--r--ydb/core/client/server/msgbus_server.h2
-rw-r--r--ydb/core/client/server/msgbus_server_persqueue.cpp42
-rw-r--r--ydb/core/client/server/msgbus_server_persqueue.h4
-rw-r--r--ydb/core/client/server/msgbus_server_sqs.cpp66
-rw-r--r--ydb/core/client/server/ya.make4
-rw-r--r--ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp12
-rw-r--r--ydb/core/driver_lib/run/config.h4
-rw-r--r--ydb/core/driver_lib/run/config_parser.cpp10
-rw-r--r--ydb/core/driver_lib/run/kikimr_services_initializers.cpp18
-rw-r--r--ydb/core/driver_lib/run/kikimr_services_initializers.h12
-rw-r--r--ydb/core/driver_lib/run/run.cpp54
-rw-r--r--ydb/core/driver_lib/run/run.h8
-rw-r--r--ydb/core/protos/config.proto24
-rw-r--r--ydb/core/protos/flat_scheme_op.proto12
-rw-r--r--ydb/core/protos/grpc.proto10
-rw-r--r--ydb/core/protos/msgbus.proto88
-rw-r--r--ydb/core/protos/services.proto8
-rw-r--r--ydb/core/protos/sqs.proto730
-rw-r--r--ydb/core/protos/ya.make2
-rw-r--r--ydb/core/testlib/test_client.cpp14
-rw-r--r--ydb/core/testlib/test_client.h2
-rw-r--r--ydb/core/util/iterator.h4
-rw-r--r--ydb/core/ymq/actor/action.h150
-rw-r--r--ydb/core/ymq/actor/actor.cpp106
-rw-r--r--ydb/core/ymq/actor/actor.h22
-rw-r--r--ydb/core/ymq/actor/change_visibility.cpp126
-rw-r--r--ydb/core/ymq/actor/create_queue.cpp146
-rw-r--r--ydb/core/ymq/actor/create_user.cpp90
-rw-r--r--ydb/core/ymq/actor/delete_message.cpp148
-rw-r--r--ydb/core/ymq/actor/delete_queue.cpp84
-rw-r--r--ydb/core/ymq/actor/delete_user.cpp178
-rw-r--r--ydb/core/ymq/actor/events.h264
-rw-r--r--ydb/core/ymq/actor/executor.cpp146
-rw-r--r--ydb/core/ymq/actor/executor.h68
-rw-r--r--ydb/core/ymq/actor/get_queue_attributes.cpp136
-rw-r--r--ydb/core/ymq/actor/get_queue_url.cpp96
-rw-r--r--ydb/core/ymq/actor/list_queues.cpp100
-rw-r--r--ydb/core/ymq/actor/list_users.cpp104
-rw-r--r--ydb/core/ymq/actor/params.h140
-rw-r--r--ydb/core/ymq/actor/proxy_service.cpp44
-rw-r--r--ydb/core/ymq/actor/proxy_service.h38
-rw-r--r--ydb/core/ymq/actor/purge.cpp60
-rw-r--r--ydb/core/ymq/actor/purge.h56
-rw-r--r--ydb/core/ymq/actor/purge_queue.cpp106
-rw-r--r--ydb/core/ymq/actor/receive_message.cpp134
-rw-r--r--ydb/core/ymq/actor/schema.cpp336
-rw-r--r--ydb/core/ymq/actor/schema.h114
-rw-r--r--ydb/core/ymq/actor/send_message.cpp194
-rw-r--r--ydb/core/ymq/actor/serviceid.h16
-rw-r--r--ydb/core/ymq/actor/set_queue_attributes.cpp126
-rw-r--r--ydb/core/ymq/actor/ya.make54
-rw-r--r--ydb/core/ymq/base/action.cpp20
-rw-r--r--ydb/core/ymq/base/action.h56
-rw-r--r--ydb/core/ymq/base/limits.h44
-rw-r--r--ydb/core/ymq/base/query_id.h12
-rw-r--r--ydb/core/ymq/base/table_info.h96
-rw-r--r--ydb/core/ymq/base/ya.make16
-rw-r--r--ydb/core/ymq/client/bin/main.cpp524
-rw-r--r--ydb/core/ymq/client/bin/ya.make20
-rw-r--r--ydb/core/ymq/client/cpp/client.cpp238
-rw-r--r--ydb/core/ymq/client/cpp/client.h166
-rw-r--r--ydb/core/ymq/client/cpp/ya.make20
-rw-r--r--ydb/core/ymq/client/ya.make8
-rw-r--r--ydb/core/ymq/http/http.cpp616
-rw-r--r--ydb/core/ymq/http/http.h62
-rw-r--r--ydb/core/ymq/http/params.h86
-rw-r--r--ydb/core/ymq/http/parser.rl6186
-rw-r--r--ydb/core/ymq/http/types.cpp20
-rw-r--r--ydb/core/ymq/http/types.h18
-rw-r--r--ydb/core/ymq/http/xml.cpp214
-rw-r--r--ydb/core/ymq/http/xml.h14
-rw-r--r--ydb/core/ymq/http/ya.make24
-rw-r--r--ydb/core/ymq/proto/records.proto40
-rw-r--r--ydb/core/ymq/proto/ya.make20
-rw-r--r--ydb/core/ymq/queues/fifo/queries.cpp772
-rw-r--r--ydb/core/ymq/queues/fifo/queries.h12
-rw-r--r--ydb/core/ymq/queues/fifo/schema.cpp198
-rw-r--r--ydb/core/ymq/queues/fifo/schema.h12
-rw-r--r--ydb/core/ymq/queues/fifo/ya.make22
-rw-r--r--ydb/core/ymq/queues/std/queries.cpp654
-rw-r--r--ydb/core/ymq/queues/std/queries.h12
-rw-r--r--ydb/core/ymq/queues/std/schema.cpp170
-rw-r--r--ydb/core/ymq/queues/std/schema.h14
-rw-r--r--ydb/core/ymq/queues/std/ya.make22
-rw-r--r--ydb/core/ymq/queues/ya.make8
-rw-r--r--ydb/core/ymq/ut/params_ut.cpp212
-rw-r--r--ydb/core/ymq/ut/ya.make20
-rw-r--r--ydb/core/ymq/ya.make14
-rw-r--r--ydb/public/lib/base/msgbus.h8
-rw-r--r--ydb/public/lib/deprecated/client/grpc_client.cpp2
-rw-r--r--ydb/public/lib/deprecated/client/grpc_client.h12
-rw-r--r--ydb/public/lib/deprecated/kicli/kicli.h2
-rw-r--r--ydb/public/lib/deprecated/kicli/kikimr.cpp6
-rw-r--r--ydb/public/lib/value/value.cpp64
-rw-r--r--ydb/public/lib/value/value.h338
-rw-r--r--ydb/public/lib/value/ya.make22
-rw-r--r--ydb/public/lib/ya.make2
-rw-r--r--ydb/services/persqueue_v1/grpc_pq_actor.h86
-rw-r--r--ydb/services/persqueue_v1/grpc_pq_write.cpp62
-rw-r--r--ydb/services/persqueue_v1/grpc_pq_write.h46
-rw-r--r--ydb/services/persqueue_v1/grpc_pq_write_actor.cpp74
-rw-r--r--ydb/tests/functional/sqs/ya.make2
206 files changed, 6294 insertions, 6294 deletions
diff --git a/build/ya.conf.json b/build/ya.conf.json
index 5f7cc875d6..912694e0ea 100644
--- a/build/ya.conf.json
+++ b/build/ya.conf.json
@@ -1109,14 +1109,14 @@
}
]
},
- "arc": {
- "tools": {
+ "arc": {
+ "tools": {
"arc": {
"bottle": "arc",
"executable": "arc"
}
- },
- "platforms": [
+ },
+ "platforms": [
{
"host": {
"os": "LINUX"
@@ -1135,8 +1135,8 @@
},
"default": true
}
- ]
- },
+ ]
+ },
"yo": {
"tools": {
"yo": {
@@ -5795,19 +5795,19 @@
]
}
},
- "arc": {
- "formula": {
+ "arc": {
+ "formula": {
"sandbox_id": [
1205199935
],
- "match": "arc"
- },
- "executable": {
+ "match": "arc"
+ },
+ "executable": {
"arc": [
"arc"
]
- }
- },
+ }
+ },
"godoc": {
"formula": {
"sandbox_id": 511821444,
diff --git a/build/ymake_conf.py b/build/ymake_conf.py
index 30219eb85e..0730447c48 100755
--- a/build/ymake_conf.py
+++ b/build/ymake_conf.py
@@ -646,7 +646,7 @@ class Build(object):
else:
def find_svn():
for i in range(0, 3):
- for path in (['.svn', 'wc.db'], ['.svn', 'entries'], ['.git', 'logs', 'HEAD']):
+ for path in (['.svn', 'wc.db'], ['.svn', 'entries'], ['.git', 'logs', 'HEAD']):
path_parts = [os.pardir] * i + path
full_path = os.path.join(self.arcadia.root, *path_parts)
# HACK(somov): No "normpath" here. ymake fails with the "source file name is outside the build tree" error
@@ -654,14 +654,14 @@ class Build(object):
if os.path.exists(full_path):
out_path = os.path.join('${ARCADIA_ROOT}', *path_parts)
return '${input;hide:"%s"}' % out_path
-
- # Special processing for arc repository since .arc may be a symlink.
- dot_arc = os.path.realpath(os.path.join(self.arcadia.root, '.arc'))
- full_path = os.path.join(dot_arc, 'TREE')
- if os.path.exists(full_path):
- out_path = os.path.join('${ARCADIA_ROOT}', os.path.relpath(full_path, self.arcadia.root))
- return '${input;hide:"%s"}' % out_path
-
+
+ # Special processing for arc repository since .arc may be a symlink.
+ dot_arc = os.path.realpath(os.path.join(self.arcadia.root, '.arc'))
+ full_path = os.path.join(dot_arc, 'TREE')
+ if os.path.exists(full_path):
+ out_path = os.path.join('${ARCADIA_ROOT}', os.path.relpath(full_path, self.arcadia.root))
+ return '${input;hide:"%s"}' % out_path
+
return ''
emit_with_ignore_comment('SVN_DEPENDS', find_svn())
diff --git a/contrib/libs/ya.make b/contrib/libs/ya.make
index 9c4640fdcf..9bfdd27c34 100644
--- a/contrib/libs/ya.make
+++ b/contrib/libs/ya.make
@@ -33,7 +33,7 @@ RECURSE(
chromaprint
clang12
clang12-rt
- clapack
+ clapack
cld2
cnpy
cookiemy
@@ -44,7 +44,7 @@ RECURSE(
crcutil
crfsuite
croaring
- ctemplate
+ ctemplate
curl
cxxsupp/libcxx
cxxsupp/libcxxabi-parts
@@ -62,7 +62,7 @@ RECURSE(
falconn
farmhash
farmhash/ut
- faster-rnnlm
+ faster-rnnlm
fastlz
fastops
fcgi
@@ -109,7 +109,7 @@ RECURSE(
i18n
i18n/ut
icu
- ImageMagick
+ ImageMagick
inja
inja/ut
intel
@@ -197,7 +197,7 @@ RECURSE(
libwebp
libx264
libx265
- libxml
+ libxml
libxml/dynamic
libxslt
libyang
@@ -235,7 +235,7 @@ RECURSE(
musl
nanosvg
nanosvg/ut
- nayuki_md5
+ nayuki_md5
nghttp2
node-addon-api
nodejs_12
@@ -271,9 +271,9 @@ RECURSE(
picohttpparser
#pire/ut
pixman
- poco
+ poco
portaudio
- porto_api
+ porto_api
proj
protobuf
protobuf/python
@@ -284,7 +284,7 @@ RECURSE(
pthreadpool
pugixml
pybind11
- pycxx
+ pycxx
python
python/ut
qhull
@@ -355,7 +355,7 @@ RECURSE(
woff2
xdelta3
xmlsec
- xpdf-3.04
+ xpdf-3.04
xxhash
xz
yajl
@@ -365,7 +365,7 @@ RECURSE(
zlib
zlib-ng-develop
zookeeper
- zstd
+ zstd
zstd06
zzip
)
@@ -382,7 +382,7 @@ ENDIF()
IF (OS_DARWIN)
RECURSE(
gperftools
- osxfuse
+ osxfuse
macfuse-headers
uuid
)
@@ -412,8 +412,8 @@ ENDIF()
IF (OS_WINDOWS)
RECURSE(
pthreads_win32
- dokany/dokan
- dokany/dokan_fuse
+ dokany/dokan
+ dokany/dokan_fuse
)
ELSE()
RECURSE(
diff --git a/library/cpp/actors/core/actor.h b/library/cpp/actors/core/actor.h
index ed29bd14b9..35008ff9be 100644
--- a/library/cpp/actors/core/actor.h
+++ b/library/cpp/actors/core/actor.h
@@ -98,10 +98,10 @@ namespace NActors {
}
bool Send(const TActorId& recipient, IEventBase* ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const;
- template <typename TEvent>
+ template <typename TEvent>
bool Send(const TActorId& recipient, THolder<TEvent> ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const {
- return Send(recipient, static_cast<IEventBase*>(ev.Release()), flags, cookie, std::move(traceId));
- }
+ return Send(recipient, static_cast<IEventBase*>(ev.Release()), flags, cookie, std::move(traceId));
+ }
bool Send(TAutoPtr<IEventHandle> ev) const;
TInstant Now() const;
@@ -351,10 +351,10 @@ namespace NActors {
protected:
void Describe(IOutputStream&) const noexcept override;
bool Send(const TActorId& recipient, IEventBase* ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const noexcept final;
- template <typename TEvent>
+ template <typename TEvent>
bool Send(const TActorId& recipient, THolder<TEvent> ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {}) const{
- return Send(recipient, static_cast<IEventBase*>(ev.Release()), flags, cookie, std::move(traceId));
- }
+ return Send(recipient, static_cast<IEventBase*>(ev.Release()), flags, cookie, std::move(traceId));
+ }
template <class TEvent, class ... TEventArgs>
bool Send(TActorId recipient, TEventArgs&& ... args) const {
diff --git a/library/cpp/actors/core/event_pb.h b/library/cpp/actors/core/event_pb.h
index d7546b901a..9713d0a85d 100644
--- a/library/cpp/actors/core/event_pb.h
+++ b/library/cpp/actors/core/event_pb.h
@@ -144,12 +144,12 @@ namespace NActors {
{
Record = rec;
}
-
+
explicit TEventPBBase(TRecord&& rec)
{
Record = std::move(rec);
}
-
+
TString ToStringHeader() const override {
return Record.GetTypeName();
}
@@ -216,7 +216,7 @@ namespace NActors {
return Record.SerializeToZeroCopyStream(chunker);
}
- ui32 CalculateSerializedSize() const override {
+ ui32 CalculateSerializedSize() const override {
ssize_t result = Record.ByteSize();
if (result >= 0 && Payload) {
++result; // marker
diff --git a/library/cpp/coroutine/listener/listen.cpp b/library/cpp/coroutine/listener/listen.cpp
index 3d4e711d1d..fa8a6085a3 100644
--- a/library/cpp/coroutine/listener/listen.cpp
+++ b/library/cpp/coroutine/listener/listen.cpp
@@ -139,9 +139,9 @@ private:
if (err == ECANCELED) {
break;
}
- if (errno == EMFILE) {
- C_->SleepT(TDuration::MilliSeconds(1));
- }
+ if (errno == EMFILE) {
+ C_->SleepT(TDuration::MilliSeconds(1));
+ }
ythrow TSystemError(err) << "can not accept";
}
diff --git a/library/cpp/coroutine/ya.make b/library/cpp/coroutine/ya.make
index 34e30f2b25..ce4cffb72f 100644
--- a/library/cpp/coroutine/ya.make
+++ b/library/cpp/coroutine/ya.make
@@ -7,5 +7,5 @@ RECURSE(
listener
test
ut
- util
+ util
)
diff --git a/library/cpp/dbg_output/ut/dbg_output_ut.cpp b/library/cpp/dbg_output/ut/dbg_output_ut.cpp
index 7b285c84cb..54ba4416ec 100644
--- a/library/cpp/dbg_output/ut/dbg_output_ut.cpp
+++ b/library/cpp/dbg_output/ut/dbg_output_ut.cpp
@@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TContainerPrintersTest) {
TStringStream out;
TVector<TVector<wchar16>> vec(2);
vec[0].push_back(0);
- vec[1] = {wchar16('a')};
+ vec[1] = {wchar16('a')};
out << DbgDump(vec);
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "[[w'\\0'], [w'a']]");
}
diff --git a/library/cpp/deprecated/kmp/kmp.h b/library/cpp/deprecated/kmp/kmp.h
index a7f72eece6..48df76df18 100644
--- a/library/cpp/deprecated/kmp/kmp.h
+++ b/library/cpp/deprecated/kmp/kmp.h
@@ -86,7 +86,7 @@ public:
ComputePrefixFunction(patternBegin, patternEnd, &pf);
PrefixFunction.Reset(pf);
}
-
+
void Push(const T& symbol) {
while ((State >= 0) && (Pattern[State] != symbol)) {
Y_ASSERT(State <= (ssize_t) Pattern.size());
diff --git a/library/cpp/deprecated/kmp/kmp_ut.cpp b/library/cpp/deprecated/kmp/kmp_ut.cpp
index c2eda83c57..3fa94c02d8 100644
--- a/library/cpp/deprecated/kmp/kmp_ut.cpp
+++ b/library/cpp/deprecated/kmp/kmp_ut.cpp
@@ -27,11 +27,11 @@ public:
void Test() {
TVector<int> ans = {0, 2};
UNIT_ASSERT_EQUAL(FindAll("a", "aba"), ans);
- ans = {0};
+ ans = {0};
UNIT_ASSERT_EQUAL(FindAll("aba", "aba"), ans);
ans.clear();
UNIT_ASSERT_EQUAL(FindAll("abad", "aba"), ans);
- ans = {0, 2};
+ ans = {0, 2};
UNIT_ASSERT_EQUAL(FindAll("ab", "abab"), ans);
}
diff --git a/library/cpp/deprecated/split/delim_string_iter.h b/library/cpp/deprecated/split/delim_string_iter.h
index 8e4ca171a0..bcfe07abc6 100644
--- a/library/cpp/deprecated/split/delim_string_iter.h
+++ b/library/cpp/deprecated/split/delim_string_iter.h
@@ -1,8 +1,8 @@
#pragma once
-#include <util/generic/algorithm.h>
-#include <util/generic/strbuf.h>
-#include <util/generic/yexception.h>
+#include <util/generic/algorithm.h>
+#include <util/generic/strbuf.h>
+#include <util/generic/yexception.h>
#include <util/string/cast.h>
#include <util/system/yassert.h>
@@ -35,9 +35,9 @@ public:
}
inline explicit operator bool() const {
- return IsValid;
- }
-
+ return IsValid;
+ }
+
// NOTE: this is a potentially unsafe operation (no overrun check)
inline TDelimStringIter& operator++() {
if (Current.end() != Str.end()) {
@@ -51,7 +51,7 @@ public:
return *this;
}
- inline void operator+=(size_t n) {
+ inline void operator+=(size_t n) {
for (; n > 0; --n) {
++(*this);
}
@@ -65,17 +65,17 @@ public:
return !(*this == rhs);
}
- inline TStringBuf operator*() const {
+ inline TStringBuf operator*() const {
return Current;
}
- inline const TStringBuf* operator->() const {
+ inline const TStringBuf* operator->() const {
return &Current;
}
- // Get & advance
+ // Get & advance
template <class T>
- inline bool TryNext(T& t) {
+ inline bool TryNext(T& t) {
if (IsValid) {
t = FromString<T>(Current);
operator++();
@@ -94,46 +94,46 @@ public:
}
template <class T>
- inline T GetNext() {
+ inline T GetNext() {
T res;
Next(res);
return res;
}
- inline const char* GetBegin() const {
+ inline const char* GetBegin() const {
return Current.begin();
}
- inline const char* GetEnd() const {
+ inline const char* GetEnd() const {
return Current.end();
}
- inline bool Valid() const {
+ inline bool Valid() const {
return IsValid;
}
// contents from next token to the end of string
- inline TStringBuf Cdr() const {
+ inline TStringBuf Cdr() const {
return Str.SubStr(Current.length() + Delim.length());
}
inline TDelimStringIter IterEnd() const {
return TDelimStringIter();
}
-
-private:
- inline void UpdateCurrent() {
- // it is much faster than TStringBuf::find
+
+private:
+ inline void UpdateCurrent() {
+ // it is much faster than TStringBuf::find
size_t pos = std::search(Str.begin(), Str.end(), Delim.begin(), Delim.end()) - Str.begin();
- Current = Str.Head(pos);
- }
-
-private:
- bool IsValid;
-
- TStringBuf Str;
- TStringBuf Current;
- TStringBuf Delim;
+ Current = Str.Head(pos);
+ }
+
+private:
+ bool IsValid;
+
+ TStringBuf Str;
+ TStringBuf Current;
+ TStringBuf Delim;
};
//example: for (TStringBuf field: TDelimStroka(line, "@@")) { ... }
@@ -141,7 +141,7 @@ struct TDelimStroka {
TStringBuf S;
TStringBuf Delim;
- inline TDelimStroka(TStringBuf s, TStringBuf delim)
+ inline TDelimStroka(TStringBuf s, TStringBuf delim)
: S(s)
, Delim(delim)
{
diff --git a/library/cpp/deprecated/split/delim_string_iter_ut.cpp b/library/cpp/deprecated/split/delim_string_iter_ut.cpp
index 18a8b2a160..da0ab5c0fd 100644
--- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp
+++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp
@@ -9,7 +9,7 @@ static void AssertStringSplit(const TString& str, const TString& delim, const TV
// test iterator invariants
for (const auto& expectedString : expected) {
UNIT_ASSERT(it.Valid());
- UNIT_ASSERT(bool(it));
+ UNIT_ASSERT(bool(it));
UNIT_ASSERT_STRINGS_EQUAL(it->ToString(), expectedString);
++it;
}
diff --git a/library/cpp/deprecated/ya.make b/library/cpp/deprecated/ya.make
index 6c753f68a9..04bff040c6 100644
--- a/library/cpp/deprecated/ya.make
+++ b/library/cpp/deprecated/ya.make
@@ -4,7 +4,7 @@ RECURSE(
accessors
accessors/ut
autoarray
- base64
+ base64
datafile
dater_old
dater_old/ut
diff --git a/library/cpp/diff/diff.cpp b/library/cpp/diff/diff.cpp
index be57da7f39..0598f005b0 100644
--- a/library/cpp/diff/diff.cpp
+++ b/library/cpp/diff/diff.cpp
@@ -58,18 +58,18 @@ struct TCollection<wchar16>: public TCollectionImpl<wchar16> {
}
};
-size_t NDiff::InlineDiff(TVector<TChunk<char>>& chunks, const TStringBuf& left, const TStringBuf& right, const TString& delims) {
+size_t NDiff::InlineDiff(TVector<TChunk<char>>& chunks, const TStringBuf& left, const TStringBuf& right, const TString& delims) {
if (delims.empty()) {
return InlineDiff<char>(chunks, TConstArrayRef<char>(left.data(), left.size()), TConstArrayRef<char>(right.data(), right.size()));
}
TCollection<char> c1(left, delims);
TCollection<char> c2(right, delims);
TVector<TChunk<ui64>> diff;
- const size_t dist = InlineDiff<ui64>(diff, c1.GetKeys(), c2.GetKeys());
+ 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)));
}
- return dist;
+ return dist;
}
size_t NDiff::InlineDiff(TVector<TChunk<wchar16>>& chunks, const TWtringBuf& left, const TWtringBuf& right, const TUtf16String& delims) {
@@ -79,9 +79,9 @@ 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;
- const size_t dist = InlineDiff<ui64>(diff, c1.GetKeys(), c2.GetKeys());
+ 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)));
}
- return dist;
+ return dist;
}
diff --git a/library/cpp/diff/diff.h b/library/cpp/diff/diff.h
index 94fb00cd0b..aded9022ad 100644
--- a/library/cpp/diff/diff.h
+++ b/library/cpp/diff/diff.h
@@ -27,7 +27,7 @@ namespace NDiff {
};
template <typename T>
- size_t InlineDiff(TVector<TChunk<T>>& chunks, const TConstArrayRef<T>& left, const TConstArrayRef<T>& right) {
+ size_t InlineDiff(TVector<TChunk<T>>& chunks, const TConstArrayRef<T>& left, const TConstArrayRef<T>& right) {
TConstArrayRef<T> s1(left);
TConstArrayRef<T> s2(right);
@@ -53,8 +53,8 @@ namespace NDiff {
const T* e1 = s1.begin();
const T* e2 = s2.begin();
- size_t dist = s1.size() - lcs.size();
-
+ size_t dist = s1.size() - lcs.size();
+
const size_t n = ctx.ResultBuffer.size();
for (size_t i = 0; i <= n && (e1 != s1.end() || e2 != s2.end());) {
if (i < n) {
@@ -86,8 +86,8 @@ namespace NDiff {
d1 = e1;
d2 = e2;
}
-
- return dist;
+
+ return dist;
}
template <typename TFormatter, typename T>
@@ -106,7 +106,7 @@ namespace NDiff {
// Without delimiters calculates character-wise diff
// With delimiters calculates token-wise diff
- size_t InlineDiff(TVector<TChunk<char>>& chunks, const TStringBuf& left, const TStringBuf& right, const TString& delims = TString());
+ size_t InlineDiff(TVector<TChunk<char>>& chunks, const TStringBuf& left, const TStringBuf& right, const TString& delims = TString());
size_t InlineDiff(TVector<TChunk<wchar16>>& chunks, const TWtringBuf& left, const TWtringBuf& right, const TUtf16String& delims = TUtf16String());
}
diff --git a/library/cpp/diff/diff_ut.cpp b/library/cpp/diff/diff_ut.cpp
index b82a7b000e..42285d228f 100644
--- a/library/cpp/diff/diff_ut.cpp
+++ b/library/cpp/diff/diff_ut.cpp
@@ -37,18 +37,18 @@ struct TDiffTester {
};
Y_UNIT_TEST_SUITE(DiffTokens) {
- Y_UNIT_TEST(ReturnValue) {
- TVector<TChunk<char>> res;
- UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "aaa"), 0);
- UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "aa"), 1);
- UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "a"), 2);
- UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "abc"), 2);
- UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "aba"), 1);
- UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "", "aba"), 3);
- UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "aaaa"), 1);
- UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "abc", "xyz"), 3);
- }
-
+ Y_UNIT_TEST(ReturnValue) {
+ TVector<TChunk<char>> res;
+ UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "aaa"), 0);
+ UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "aa"), 1);
+ UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "a"), 2);
+ UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "abc"), 2);
+ UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "aba"), 1);
+ UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "", "aba"), 3);
+ UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "aaa", "aaaa"), 1);
+ UNIT_ASSERT_VALUES_EQUAL(InlineDiff(res, "abc", "xyz"), 3);
+ }
+
Y_UNIT_TEST(EqualStringsOneToken) {
TDiffTester tester;
diff --git a/library/cpp/html/escape/escape.cpp b/library/cpp/html/escape/escape.cpp
index 5b8ed60f04..f6fc8dbb20 100644
--- a/library/cpp/html/escape/escape.cpp
+++ b/library/cpp/html/escape/escape.cpp
@@ -1,23 +1,23 @@
-#include "escape.h"
-
-#include <util/generic/array_size.h>
-#include <util/generic/strbuf.h>
-
-namespace NHtml {
+#include "escape.h"
+
+#include <util/generic/array_size.h>
+#include <util/generic/strbuf.h>
+
+namespace NHtml {
namespace {
struct TReplace {
char Char;
bool ForText;
TStringBuf Entity;
};
-
+
TReplace Escapable[] = {
{'"', false, TStringBuf("&quot;")},
{'&', true, TStringBuf("&amp;")},
{'<', true, TStringBuf("&lt;")},
{'>', true, TStringBuf("&gt;")},
};
-
+
TString EscapeImpl(const TString& value, bool isText) {
auto ci = value.begin();
// Looking for escapable characters.
@@ -27,17 +27,17 @@ namespace NHtml {
goto escape;
}
}
- }
-
+ }
+
// There is no escapable characters, so return original value.
return value;
-
+
escape:
TString tmp = TString(value.begin(), ci);
-
+
for (; ci != value.end(); ++ci) {
size_t i = (isText ? 1 : 0);
-
+
for (; i < Y_ARRAY_SIZE(Escapable); ++i) {
if (*ci == Escapable[i].Char) {
tmp += Escapable[i].Entity;
@@ -48,19 +48,19 @@ namespace NHtml {
if (i == Y_ARRAY_SIZE(Escapable)) {
tmp += *ci;
}
- }
+ }
return tmp;
- }
-
- }
-
+ }
+
+ }
+
TString EscapeAttributeValue(const TString& value) {
return EscapeImpl(value, false);
}
-
+
TString EscapeText(const TString& value) {
return EscapeImpl(value, true);
}
-
-}
+
+}
diff --git a/library/cpp/html/escape/escape.h b/library/cpp/html/escape/escape.h
index 1c45fc5193..cb9b0c860c 100644
--- a/library/cpp/html/escape/escape.h
+++ b/library/cpp/html/escape/escape.h
@@ -1,9 +1,9 @@
-#pragma once
-
+#pragma once
+
#include <util/generic/string.h>
-
-namespace NHtml {
+
+namespace NHtml {
TString EscapeAttributeValue(const TString& value);
TString EscapeText(const TString& value);
-
+
}
diff --git a/library/cpp/html/escape/ut/escape_ut.cpp b/library/cpp/html/escape/ut/escape_ut.cpp
index cd7b955138..436f3b6a28 100644
--- a/library/cpp/html/escape/ut/escape_ut.cpp
+++ b/library/cpp/html/escape/ut/escape_ut.cpp
@@ -1,16 +1,16 @@
#include <library/cpp/html/escape/escape.h>
#include <library/cpp/testing/unittest/registar.h>
-
-using namespace NHtml;
-
+
+using namespace NHtml;
+
Y_UNIT_TEST_SUITE(TEscapeHtml) {
Y_UNIT_TEST(Escape) {
- UNIT_ASSERT_EQUAL(EscapeText("in & out"), "in &amp; out");
- UNIT_ASSERT_EQUAL(EscapeText("&&"), "&amp;&amp;");
- UNIT_ASSERT_EQUAL(EscapeText("&amp;"), "&amp;amp;");
-
- UNIT_ASSERT_EQUAL(EscapeText("<script>"), "&lt;script&gt;");
-
- UNIT_ASSERT_EQUAL(EscapeText("text"), "text");
- }
-}
+ UNIT_ASSERT_EQUAL(EscapeText("in & out"), "in &amp; out");
+ UNIT_ASSERT_EQUAL(EscapeText("&&"), "&amp;&amp;");
+ UNIT_ASSERT_EQUAL(EscapeText("&amp;"), "&amp;amp;");
+
+ UNIT_ASSERT_EQUAL(EscapeText("<script>"), "&lt;script&gt;");
+
+ UNIT_ASSERT_EQUAL(EscapeText("text"), "text");
+ }
+}
diff --git a/library/cpp/html/escape/ut/ya.make b/library/cpp/html/escape/ut/ya.make
index 27d3a3d65a..4a0e12388d 100644
--- a/library/cpp/html/escape/ut/ya.make
+++ b/library/cpp/html/escape/ut/ya.make
@@ -1,13 +1,13 @@
-UNITTEST()
-
-OWNER(stanly)
-
-SRCS(
- escape_ut.cpp
-)
-
-PEERDIR(
+UNITTEST()
+
+OWNER(stanly)
+
+SRCS(
+ escape_ut.cpp
+)
+
+PEERDIR(
library/cpp/html/escape
-)
-
-END()
+)
+
+END()
diff --git a/library/cpp/html/escape/ya.make b/library/cpp/html/escape/ya.make
index 93a31e33d6..980481dfae 100644
--- a/library/cpp/html/escape/ya.make
+++ b/library/cpp/html/escape/ya.make
@@ -1,9 +1,9 @@
-LIBRARY()
+LIBRARY()
-OWNER(stanly)
-
-SRCS(
- escape.cpp
-)
-
-END()
+OWNER(stanly)
+
+SRCS(
+ escape.cpp
+)
+
+END()
diff --git a/library/cpp/http/fetch/httpfetcher.h b/library/cpp/http/fetch/httpfetcher.h
index 7fc251afd2..9c439ab60b 100644
--- a/library/cpp/http/fetch/httpfetcher.h
+++ b/library/cpp/http/fetch/httpfetcher.h
@@ -35,7 +35,7 @@ public:
static const size_t TCP_MIN = 1500;
static int TerminateNow;
- THttpFetcher()
+ THttpFetcher()
: THttpParser<TCheck>()
, TAlloc()
, TWriter()
@@ -55,15 +55,15 @@ public:
size_t schemelen = strlen(scheme);
if (*path == '/') {
header->base = TStringBuf(scheme, schemelen);
- header->base += TStringBuf("://", 3);
- header->base += TStringBuf(TAgent::pHostBeg, TAgent::pHostEnd - TAgent::pHostBeg);
- header->base += path;
+ header->base += TStringBuf("://", 3);
+ header->base += TStringBuf(TAgent::pHostBeg, TAgent::pHostEnd - TAgent::pHostBeg);
+ header->base += path;
} else {
- if (strlen(path) >= FETCHER_URL_MAX) {
- header->error = HTTP_URL_TOO_LARGE;
- return 0;
- }
- header->base = path;
+ if (strlen(path) >= FETCHER_URL_MAX) {
+ header->error = HTTP_URL_TOO_LARGE;
+ return 0;
+ }
+ header->base = path;
}
if ((ret = TAgent::RequestGet(path, headers, persistent, head_request))) {
diff --git a/library/cpp/http/fetch/httpfsm.rl6 b/library/cpp/http/fetch/httpfsm.rl6
index eab0328b18..d3b1425321 100644
--- a/library/cpp/http/fetch/httpfsm.rl6
+++ b/library/cpp/http/fetch/httpfsm.rl6
@@ -86,10 +86,10 @@ response_status_line = http_version ws+ status_code reason_phrase? eol %set_stat
############ request status line #################
action set_request_uri {
if (request_hd && buflen < FETCHER_URL_MAX) {
- if (!request_hd->request_uri.empty()) {
+ if (!request_hd->request_uri.empty()) {
return -2;
}
- request_hd->request_uri =TStringBuf(buf, buflen);
+ request_hd->request_uri =TStringBuf(buf, buflen);
}
}
action set_http_method {
@@ -225,8 +225,8 @@ mime_type = "text/plain"i %{c(MIME_TEXT)}
| "application/x-bzip2"i | "application/x-rar"i ) %{c(MIME_ARCHIVE)}
| "application/x-dosexec"i %{c(MIME_EXE)}
| "application/x-gzip"i %{c(MIME_GZIP)}
- | "application/json"i %{c(MIME_JSON)}
- | ("application/javascript"i | "text/javascript"i) %{c(MIME_JAVASCRIPT)}
+ | "application/json"i %{c(MIME_JSON)}
+ | ("application/javascript"i | "text/javascript"i) %{c(MIME_JAVASCRIPT)}
| "application/vnd.android.package-archive"i %{c(MIME_APK)}
| ("image/x-icon"i | "image/vnd.microsoft.icon"i) %{c(MIME_IMAGE_ICON)}
;
@@ -253,7 +253,7 @@ action set_location {
buflen --;
}
if (hd && buflen < FETCHER_URL_MAX) {
- hd->location = TStringBuf(buf, buflen);
+ hd->location = TStringBuf(buf, buflen);
}
}
@@ -304,7 +304,7 @@ x_robots_tag = "x-robots-tag"i def >{ AcceptingXRobots = true; } x_robots_value
################# rel_canonical ###############
action set_canonical {
if (hd && buflen < FETCHER_URL_MAX) {
- hd->rel_canonical = TStringBuf(buf, buflen);
+ hd->rel_canonical = TStringBuf(buf, buflen);
}
}
diff --git a/library/cpp/http/fetch/httpfsm_ut.cpp b/library/cpp/http/fetch/httpfsm_ut.cpp
index b018e80101..a581d87773 100644
--- a/library/cpp/http/fetch/httpfsm_ut.cpp
+++ b/library/cpp/http/fetch/httpfsm_ut.cpp
@@ -82,7 +82,7 @@ void THttpHeaderParserTestSuite::TestRequestHeader() {
UNIT_ASSERT_EQUAL(result, 2);
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(httpRequestHeader.request_uri, "/search?q=hi");
UNIT_ASSERT_EQUAL(httpRequestHeader.GetUrl(), "http://www.google.ru:8080/search?q=hi");
UNIT_ASSERT_EQUAL(httpHeaderParser->lastchar - request + 1,
(i32)strlen(request));
@@ -123,7 +123,7 @@ void THttpHeaderParserTestSuite::TestSplitRequestHeader() {
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(httpRequestHeader.request_uri, "/search?q=hi");
}
}
@@ -143,7 +143,7 @@ void THttpHeaderParserTestSuite::TestTrailingData() {
UNIT_ASSERT_EQUAL(result, 2);
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(httpRequestHeader.request_uri, "/search?q=hi");
UNIT_ASSERT_EQUAL(TString(httpHeaderParser->lastchar + 1), "high.ru");
UNIT_ASSERT_EQUAL(httpRequestHeader.http_minor, 1);
UNIT_ASSERT_EQUAL(httpRequestHeader.transfer_chunked, -1);
@@ -178,10 +178,10 @@ void THttpHeaderParserTestSuite::TestProxyRequestHeader() {
UNIT_ASSERT_EQUAL(httpRequestHeader.max_age, 100);
UNIT_ASSERT_VALUES_EQUAL(httpRequestHeader.if_modified_since,
TInstant::ParseIso8601Deprecated("1994-10-29 19:43:31Z").TimeT());
- UNIT_ASSERT_EQUAL(httpRequestHeader.request_uri,
+ UNIT_ASSERT_EQUAL(httpRequestHeader.request_uri,
"http://www.google.ru:8080/search?q=hi");
UNIT_ASSERT(httpRequestHeader.GetUrl() ==
- "http://www.google.ru:8080/search?q=hi");
+ "http://www.google.ru:8080/search?q=hi");
UNIT_ASSERT_EQUAL(strcmp(httpRequestHeader.host, ""), 0);
UNIT_ASSERT_EQUAL(strcmp(httpRequestHeader.from, "webadmin@yandex.ru"), 0);
UNIT_ASSERT_EQUAL(strcmp(httpRequestHeader.user_agent,
@@ -420,7 +420,7 @@ void THttpHeaderParserTestSuite::TestRelCanonical() {
"Link: <http://yandex.ru>; rel = \"canonical\"\r\n\r\n";
i32 result = httpHeaderParser->Execute(headers, strlen(headers));
UNIT_ASSERT_EQUAL(result, 2);
- UNIT_ASSERT_EQUAL(httpHeader.rel_canonical, "http://yandex.ru");
+ UNIT_ASSERT_EQUAL(httpHeader.rel_canonical, "http://yandex.ru");
TestFinish();
}
diff --git a/library/cpp/http/fetch/httpheader.h b/library/cpp/http/fetch/httpheader.h
index b2810bbd41..b2804c9689 100644
--- a/library/cpp/http/fetch/httpheader.h
+++ b/library/cpp/http/fetch/httpheader.h
@@ -1,9 +1,9 @@
#pragma once
-#include "exthttpcodes.h"
-
+#include "exthttpcodes.h"
+
#include <library/cpp/mime/types/mime.h>
-
+
#include <util/system/defaults.h>
#include <util/system/compat.h>
#include <util/generic/string.h>
@@ -24,10 +24,10 @@ extern const i64 DEFAULT_IF_MODIFIED_SINCE; /// == -1
extern const i32 DEFAULT_MAX_AGE; /// == -1
extern const i8 DEFAULT_REQUEST_PRIORITY; /// == -1
extern const i32 DEFAULT_RESPONSE_TIMEOUT; /// == -1
-
+
#define HTTP_PREFIX "http://"
#define MAX_LANGREGION_LEN 4
-#define MAXWORD_LEN 55
+#define MAXWORD_LEN 55
enum HTTP_COMPRESSION {
HTTP_COMPRESSION_UNSET = 0,
@@ -75,7 +75,7 @@ public:
i8 compression_method;
i8 transfer_chunked;
i8 connection_closed;
- TString base;
+ TString base;
public:
void Init() {
@@ -93,7 +93,7 @@ public:
content_range_start = -1;
content_range_end = -1;
content_range_entity_length = -1;
- base.clear();
+ base.clear();
}
void Print() const {
@@ -108,19 +108,19 @@ public:
printf("content_range_start: %" PRIi64 "\n", content_range_start);
printf("content_range_end: %" PRIi64 "\n", content_range_end);
printf("content_range_entity_length: %" PRIi64 "\n", content_range_entity_length);
- printf("base: \"%s\"\n", base.c_str());
+ printf("base: \"%s\"\n", base.c_str());
printf("error: %" PRIi16 "\n", error);
}
int SetBase(const char* path,
const char* hostNamePtr = nullptr,
int hostNameLength = 0) {
- if (*path == '/') {
- base = "http://";
- base += TStringBuf(hostNamePtr, hostNameLength);
- base += path;
+ if (*path == '/') {
+ base = "http://";
+ base += TStringBuf(hostNamePtr, hostNameLength);
+ base += path;
} else {
- base = path;
+ base = path;
}
return error;
}
@@ -134,8 +134,8 @@ public:
i8 squid_error;
i8 x_robots_tag; // deprecated, use x_robots_state instead
i16 http_status;
- TString location;
- TString rel_canonical;
+ TString location;
+ TString rel_canonical;
char hreflangs[HREFLANG_MAX];
i64 retry_after;
TString x_robots_state; // 'xxxxx' format, see `library/html/zoneconf/parsefunc.cpp`
@@ -146,9 +146,9 @@ public:
accept_ranges = -1;
squid_error = 0;
x_robots_tag = 0;
- rel_canonical.clear();
+ rel_canonical.clear();
http_status = -1;
- location.clear();
+ location.clear();
hreflangs[0] = 0;
retry_after = DEFAULT_RETRY_AFTER;
x_robots_state = "xxxxx";
@@ -159,14 +159,14 @@ public:
printf("http_status: %" PRIi16 "\n", http_status);
printf("squid_error: %" PRIi8 "\n", squid_error);
printf("accept_ranges: %" PRIi8 "\n", accept_ranges);
- printf("location: \"%s\"\n", location.c_str());
+ printf("location: \"%s\"\n", location.c_str());
printf("retry_after: %" PRIi64 "\n", retry_after);
}
};
struct THttpRequestHeader: public THttpBaseHeader {
public:
- TString request_uri;
+ TString request_uri;
char host[HOST_MAX];
char from[MAXWORD_LEN];
char user_agent[MAXWORD_LEN];
@@ -186,7 +186,7 @@ public:
}
void Init() {
- request_uri.clear();
+ request_uri.clear();
host[0] = 0;
from[0] = 0;
user_agent[0] = 0;
@@ -204,7 +204,7 @@ public:
void Print() const {
THttpBaseHeader::Print();
- printf("request_uri: \"%s\"\n", request_uri.c_str());
+ printf("request_uri: \"%s\"\n", request_uri.c_str());
printf("host: \"%s\"\n", host);
printf("from: \"%s\"\n", from);
printf("user_agent: \"%s\"\n", user_agent);
@@ -231,9 +231,9 @@ public:
char* GetUrl(char* buffer, size_t size) {
if (host[0] == 0 || !strcmp(host, "")) {
- strlcpy(buffer, request_uri.c_str(), size);
+ strlcpy(buffer, request_uri.c_str(), size);
} else {
- snprintf(buffer, size, "http://%s%s", host, request_uri.c_str());
+ snprintf(buffer, size, "http://%s%s", host, request_uri.c_str());
}
return buffer;
}
diff --git a/library/cpp/http/fetch/ya.make b/library/cpp/http/fetch/ya.make
index 7737127463..f5ed6fbcd7 100644
--- a/library/cpp/http/fetch/ya.make
+++ b/library/cpp/http/fetch/ya.make
@@ -35,4 +35,4 @@ SET(RAGEL6_FLAGS -CF1)
END()
-RECURSE_FOR_TESTS(ut)
+RECURSE_FOR_TESTS(ut)
diff --git a/library/cpp/http/misc/ya.make b/library/cpp/http/misc/ya.make
index fceb3cf79c..db4d848571 100644
--- a/library/cpp/http/misc/ya.make
+++ b/library/cpp/http/misc/ya.make
@@ -20,5 +20,5 @@ PEERDIR(
)
END()
-
-RECURSE_FOR_TESTS(ut)
+
+RECURSE_FOR_TESTS(ut)
diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h
index 38eda0e5e7..cfcf9ba330 100644
--- a/library/cpp/http/server/options.h
+++ b/library/cpp/http/server/options.h
@@ -70,11 +70,11 @@ public:
/// Default interface name to bind the server. Used when none of BindAddress are provided.
inline THttpServerOptions& SetHost(const TString& host) noexcept {
- Host = host;
-
- return *this;
- }
-
+ Host = host;
+
+ return *this;
+ }
+
/// Default port to bind the server. Used when none of BindAddress are provided.
inline THttpServerOptions& SetPort(ui16 port) noexcept {
Port = port;
diff --git a/library/cpp/http/server/ya.make b/library/cpp/http/server/ya.make
index bae6f33306..da2c664741 100644
--- a/library/cpp/http/server/ya.make
+++ b/library/cpp/http/server/ya.make
@@ -23,5 +23,5 @@ PEERDIR(
)
END()
-
-RECURSE_FOR_TESTS(ut)
+
+RECURSE_FOR_TESTS(ut)
diff --git a/library/cpp/logger/global/global.h b/library/cpp/logger/global/global.h
index cbe71b16ea..8a274cbc1b 100644
--- a/library/cpp/logger/global/global.h
+++ b/library/cpp/logger/global/global.h
@@ -24,8 +24,8 @@ public:
{
}
- TGlobalLog(THolder<TLogBackend> backend)
- : TLog(std::move(backend))
+ TGlobalLog(THolder<TLogBackend> backend)
+ : TLog(std::move(backend))
{
}
};
@@ -40,8 +40,8 @@ public:
{
}
- TNullLog(THolder<TLogBackend> backend)
- : TLog(std::move(backend))
+ TNullLog(THolder<TLogBackend> backend)
+ : TLog(std::move(backend))
{
}
};
diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp
index e1d70cc3d2..57e1b16475 100644
--- a/library/cpp/logger/log.cpp
+++ b/library/cpp/logger/log.cpp
@@ -12,17 +12,17 @@
#include <util/generic/scope.h>
#include <util/generic/yexception.h>
-THolder<TLogBackend> CreateLogBackend(const TString& fname, ELogPriority priority, bool threaded) {
+THolder<TLogBackend> CreateLogBackend(const TString& fname, ELogPriority priority, bool threaded) {
TLogBackendCreatorUninitialized creator;
creator.InitCustom(fname, priority, threaded);
return creator.CreateLogBackend();
}
-THolder<TLogBackend> CreateFilteredOwningThreadedLogBackend(const TString& fname, ELogPriority priority, size_t queueLen) {
+THolder<TLogBackend> CreateFilteredOwningThreadedLogBackend(const TString& fname, ELogPriority priority, size_t queueLen) {
return MakeHolder<TFilteredLogBackend>(CreateOwningThreadedLogBackend(fname, queueLen), priority);
}
-THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& fname, size_t queueLen) {
+THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& fname, size_t queueLen) {
return MakeHolder<TOwningThreadedLogBackend>(CreateLogBackend(fname, LOG_MAX_PRIORITY, false).Release(), queueLen);
}
@@ -45,7 +45,7 @@ class TLog::TImpl: public TAtomicRefCount<TImpl> {
};
public:
- inline TImpl(THolder<TLogBackend> backend)
+ inline TImpl(THolder<TLogBackend> backend)
: Backend_(std::move(backend))
{
}
@@ -76,11 +76,11 @@ public:
Printf(ls, format, args);
}
- inline void ResetBackend(THolder<TLogBackend> backend) noexcept {
+ inline void ResetBackend(THolder<TLogBackend> backend) noexcept {
Backend_ = std::move(backend);
}
- inline THolder<TLogBackend> ReleaseBackend() noexcept {
+ inline THolder<TLogBackend> ReleaseBackend() noexcept {
return std::move(Backend_);
}
@@ -135,7 +135,7 @@ TLog::TLog(const TString& fname, ELogPriority priority)
{
}
-TLog::TLog(THolder<TLogBackend> backend)
+TLog::TLog(THolder<TLogBackend> backend)
: Impl_(MakeIntrusive<TImpl>(std::move(backend)))
{
}
@@ -214,15 +214,15 @@ bool TLog::OpenLog(const char* path, ELogPriority lp) {
return true;
}
-void TLog::ResetBackend(THolder<TLogBackend> backend) noexcept {
- Impl_->ResetBackend(std::move(backend));
+void TLog::ResetBackend(THolder<TLogBackend> backend) noexcept {
+ Impl_->ResetBackend(std::move(backend));
}
bool TLog::IsNullLog() const noexcept {
return Impl_->IsNullLog();
}
-THolder<TLogBackend> TLog::ReleaseBackend() noexcept {
+THolder<TLogBackend> TLog::ReleaseBackend() noexcept {
return Impl_->ReleaseBackend();
}
@@ -235,10 +235,10 @@ void TLog::Write(ELogPriority priority, const char* data, size_t len) const {
}
}
-void TLog::Write(ELogPriority priority, const TStringBuf data) const {
- Write(priority, data.data(), data.size());
-}
-
+void TLog::Write(ELogPriority priority, const TStringBuf data) const {
+ Write(priority, data.data(), data.size());
+}
+
void TLog::Write(const char* data, size_t len) const {
Write(Impl_->DefaultPriority(), data, len);
}
diff --git a/library/cpp/logger/log.h b/library/cpp/logger/log.h
index 8be984ccc8..59409b4778 100644
--- a/library/cpp/logger/log.h
+++ b/library/cpp/logger/log.h
@@ -8,7 +8,7 @@
#include <util/generic/fwd.h>
#include <util/generic/ptr.h>
-
+
#include <functional>
#include <cstdarg>
@@ -37,7 +37,7 @@ public:
// Construct file logger.
TLog(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY);
// Construct any type of logger
- TLog(THolder<TLogBackend> backend);
+ TLog(THolder<TLogBackend> backend);
TLog(const TLog&);
TLog(TLog&&);
@@ -47,10 +47,10 @@ public:
// Change underlying backend.
// NOTE: not thread safe.
- void ResetBackend(THolder<TLogBackend> backend) noexcept;
+ void ResetBackend(THolder<TLogBackend> backend) noexcept;
// Reset underlying backend, `IsNullLog()` will return `true` after this call.
// NOTE: not thread safe.
- THolder<TLogBackend> ReleaseBackend() noexcept;
+ THolder<TLogBackend> ReleaseBackend() noexcept;
// Check if underlying backend is defined and is not null.
// NOTE: not thread safe with respect to `ResetBackend` and `ReleaseBackend`.
bool IsNullLog() const noexcept;
@@ -110,6 +110,6 @@ private:
TLogFormatter Formatter_;
};
-THolder<TLogBackend> CreateLogBackend(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY, bool threaded = false);
-THolder<TLogBackend> CreateFilteredOwningThreadedLogBackend(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY, size_t queueLen = 0);
-THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& fname, size_t queueLen = 0);
+THolder<TLogBackend> CreateLogBackend(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY, bool threaded = false);
+THolder<TLogBackend> CreateFilteredOwningThreadedLogBackend(const TString& fname, ELogPriority priority = LOG_MAX_PRIORITY, size_t queueLen = 0);
+THolder<TOwningThreadedLogBackend> CreateOwningThreadedLogBackend(const TString& fname, size_t queueLen = 0);
diff --git a/library/cpp/messagebus/actor/executor.cpp b/library/cpp/messagebus/actor/executor.cpp
index 7a2227a458..6325dd3821 100644
--- a/library/cpp/messagebus/actor/executor.cpp
+++ b/library/cpp/messagebus/actor/executor.cpp
@@ -233,7 +233,7 @@ void TExecutor::EnqueueWork(TArrayRef<IWorkItem* const> wis) {
}
}
-size_t TExecutor::GetWorkQueueSize() const {
+size_t TExecutor::GetWorkQueueSize() const {
return WorkItems.Size();
}
@@ -259,7 +259,7 @@ TString TExecutor::GetStatusSingleLine() const {
return ss.Str();
}
-TExecutorStatus TExecutor::GetStatusRecordInternal() const {
+TExecutorStatus TExecutor::GetStatusRecordInternal() const {
TExecutorStatus r;
r.WorkQueueSize = GetWorkQueueSize();
@@ -279,7 +279,7 @@ TExecutorStatus TExecutor::GetStatusRecordInternal() const {
return r;
}
-bool TExecutor::IsInExecutorThread() const {
+bool TExecutor::IsInExecutorThread() const {
return ThreadCurrentExecutor == this;
}
diff --git a/library/cpp/messagebus/base.h b/library/cpp/messagebus/base.h
index 79fccc312e..7448e6ede1 100644
--- a/library/cpp/messagebus/base.h
+++ b/library/cpp/messagebus/base.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/system/defaults.h>
-
+#include <util/system/defaults.h>
+
namespace NBus {
/// millis since epoch
using TBusInstant = ui64;
diff --git a/library/cpp/messagebus/config/netaddr.cpp b/library/cpp/messagebus/config/netaddr.cpp
index 962ac538e2..f82378c345 100644
--- a/library/cpp/messagebus/config/netaddr.cpp
+++ b/library/cpp/messagebus/config/netaddr.cpp
@@ -4,7 +4,7 @@
#include <cstdlib>
-namespace NBus {
+namespace NBus {
const char* ToCString(EIpVersion ipVersion) {
switch (ipVersion) {
case EIP_VERSION_ANY:
@@ -37,12 +37,12 @@ namespace NBus {
{
}
};
-
+
static bool Compare(const IRemoteAddr& l, const IRemoteAddr& r) noexcept {
if (l.Addr()->sa_family != r.Addr()->sa_family) {
return false;
}
-
+
switch (l.Addr()->sa_family) {
case AF_INET: {
return memcmp(&(((const sockaddr_in*)l.Addr())->sin_addr), &(((const sockaddr_in*)r.Addr())->sin_addr), sizeof(in_addr)) == 0 &&
@@ -53,25 +53,25 @@ namespace NBus {
return memcmp(&(((const sockaddr_in6*)l.Addr())->sin6_addr), &(((const sockaddr_in6*)r.Addr())->sin6_addr), sizeof(in6_addr)) == 0 &&
((const sockaddr_in6*)l.Addr())->sin6_port == ((const sockaddr_in6*)r.Addr())->sin6_port;
}
- }
-
+ }
+
return memcmp(l.Addr(), r.Addr(), Min<size_t>(l.Len(), r.Len())) == 0;
- }
-
+ }
+
TNetAddr::TNetAddr()
: Ptr(new TOpaqueAddr)
{
}
-
+
TNetAddr::TNetAddr(TAutoPtr<IRemoteAddr> addr)
: Ptr(addr)
{
Y_VERIFY(!!Ptr);
}
-
+
namespace {
using namespace NAddr;
-
+
const char* Describe(EIpVersion version) {
switch (version) {
case EIP_VERSION_4:
@@ -150,7 +150,7 @@ namespace NBus {
socklen_t TNetAddr::Len() const {
return Ptr->Len();
}
-
+
int TNetAddr::GetPort() const {
switch (Ptr->Addr()->sa_family) {
case AF_INET:
@@ -162,11 +162,11 @@ namespace NBus {
throw 1;
}
}
-
+
bool TNetAddr::IsIpv4() const {
return Ptr->Addr()->sa_family == AF_INET;
}
-
+
bool TNetAddr::IsIpv6() const {
return Ptr->Addr()->sa_family == AF_INET6;
}
@@ -177,7 +177,7 @@ namespace NBus {
}
-template <>
+template <>
void Out<NBus::TNetAddr>(IOutputStream& out, const NBus::TNetAddr& addr) {
- Out<NAddr::IRemoteAddr>(out, addr);
-}
+ Out<NAddr::IRemoteAddr>(out, addr);
+}
diff --git a/library/cpp/messagebus/config/netaddr.h b/library/cpp/messagebus/config/netaddr.h
index b79c0cc355..2e40f1464b 100644
--- a/library/cpp/messagebus/config/netaddr.h
+++ b/library/cpp/messagebus/config/netaddr.h
@@ -1,22 +1,22 @@
-#pragma once
-
+#pragma once
+
#include <util/digest/numeric.h>
#include <util/generic/hash.h>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/generic/strbuf.h>
-#include <util/generic/vector.h>
-#include <util/network/address.h>
-
-namespace NBus {
+#include <util/generic/vector.h>
+#include <util/network/address.h>
+
+namespace NBus {
using namespace NAddr;
-
+
/// IP protocol version.
enum EIpVersion {
EIP_VERSION_4 = 1,
EIP_VERSION_6 = 2,
EIP_VERSION_ANY = EIP_VERSION_4 | EIP_VERSION_6,
};
-
+
inline bool IsFamilyAllowed(ui16 sa_family, EIpVersion ipVersion) {
if (ipVersion == EIP_VERSION_4 && sa_family != AF_INET) {
return false;
@@ -51,26 +51,26 @@ namespace NBus {
inline explicit operator bool() const noexcept {
return !!Ptr;
}
-
+
const sockaddr* Addr() const override;
socklen_t Len() const override;
-
+
bool IsIpv4() const;
bool IsIpv6() const;
int GetPort() const;
-
+
private:
TAtomicSharedPtr<IRemoteAddr> Ptr;
};
using TSockAddrInVector = TVector<TNetAddr>;
-
+
struct TNetAddrHostPortHash {
inline size_t operator()(const TNetAddr& a) const {
const sockaddr* s = a.Addr();
const sockaddr_in* const sa = reinterpret_cast<const sockaddr_in*>(s);
const sockaddr_in6* const sa6 = reinterpret_cast<const sockaddr_in6*>(s);
-
+
switch (s->sa_family) {
case AF_INET:
return CombineHashes<size_t>(ComputeHash(TStringBuf(reinterpret_cast<const char*>(&sa->sin_addr), sizeof(sa->sin_addr))), IntHashImpl(sa->sin_port));
diff --git a/library/cpp/messagebus/coreconn.cpp b/library/cpp/messagebus/coreconn.cpp
index d9411bb5db..75b355d4a1 100644
--- a/library/cpp/messagebus/coreconn.cpp
+++ b/library/cpp/messagebus/coreconn.cpp
@@ -1,7 +1,7 @@
-#include "coreconn.h"
+#include "coreconn.h"
#include "remote_connection.h"
-
+
#include <util/datetime/base.h>
#include <util/generic/yexception.h>
#include <util/network/socket.h>
diff --git a/library/cpp/messagebus/coreconn.h b/library/cpp/messagebus/coreconn.h
index fca228d82e..39e085bf31 100644
--- a/library/cpp/messagebus/coreconn.h
+++ b/library/cpp/messagebus/coreconn.h
@@ -4,10 +4,10 @@
/// \file
/// \brief Definitions for asynchonous connection queue
-#include "base.h"
+#include "base.h"
#include "event_loop.h"
-#include "netaddr.h"
-
+#include "netaddr.h"
+
#include <util/datetime/base.h>
#include <util/generic/algorithm.h>
#include <util/generic/list.h>
@@ -15,7 +15,7 @@
#include <util/generic/set.h>
#include <util/generic/string.h>
#include <util/generic/vector.h>
-#include <util/network/address.h>
+#include <util/network/address.h>
#include <util/network/ip.h>
#include <util/network/poller.h>
#include <util/string/util.h>
@@ -58,7 +58,7 @@ namespace NBus {
exc << maxConnect;
}
};
-
+
enum EPollType {
POLL_READ,
POLL_WRITE
diff --git a/library/cpp/messagebus/locator.cpp b/library/cpp/messagebus/locator.cpp
index e38a35c426..242b9b3120 100644
--- a/library/cpp/messagebus/locator.cpp
+++ b/library/cpp/messagebus/locator.cpp
@@ -7,8 +7,8 @@
#include "ybus.h"
#include <util/generic/hash_set.h>
-#include <util/system/hostname.h>
-
+#include <util/system/hostname.h>
+
namespace NBus {
using namespace NAddr;
@@ -17,7 +17,7 @@ namespace NBus {
case AF_INET: {
return ntohs(((const sockaddr_in*)addr.Addr())->sin_port);
}
-
+
case AF_INET6: {
return ntohs(((const sockaddr_in6*)addr.Addr())->sin6_port);
}
@@ -26,9 +26,9 @@ namespace NBus {
ythrow yexception() << "not implemented";
break;
}
- }
+ }
}
-
+
static inline bool GetIp6AddressFromVector(const TVector<TNetAddr>& addrs, TNetAddr* addr) {
for (size_t i = 1; i < addrs.size(); ++i) {
if (addrs[i - 1].Addr()->sa_family == addrs[i].Addr()->sa_family) {
@@ -38,18 +38,18 @@ namespace NBus {
if (GetAddrPort(addrs[i - 1]) != GetAddrPort(addrs[i])) {
return false;
}
- }
-
+ }
+
for (size_t i = 0; i < addrs.size(); ++i) {
if (addrs[i].Addr()->sa_family == AF_INET6) {
*addr = addrs[i];
return true;
}
- }
+ }
return false;
- }
-
+ }
+
EMessageStatus TBusProtocol::GetDestination(const TBusClientSession*, TBusMessage* mess, TBusLocator* locator, TNetAddr* addr) {
TBusService service = GetService();
TBusKey key = GetKey(mess);
@@ -61,8 +61,8 @@ namespace NBus {
} else {
/// lookup address/port in the locator table
locator->LocateAll(service, key, addrs);
- }
-
+ }
+
if (addrs.size() == 0) {
return MESSAGE_SERVICE_UNKNOWN;
} else if (addrs.size() == 1) {
@@ -73,15 +73,15 @@ namespace NBus {
/// to implement custom routing strategy for your service.
return MESSAGE_SERVICE_TOOMANY;
}
- }
+ }
return MESSAGE_OK;
- }
-
+ }
+
static const sockaddr_in* SockAddrIpV4(const IRemoteAddr& a) {
return (const sockaddr_in*)a.Addr();
- }
-
+ }
+
static const sockaddr_in6* SockAddrIpV6(const IRemoteAddr& a) {
return (const sockaddr_in6*)a.Addr();
}
@@ -96,7 +96,7 @@ namespace NBus {
}
return false;
}
-
+
TBusLocator::TBusLocator()
: MyInterfaces(GetNetworkInterfaces())
{
@@ -137,7 +137,7 @@ namespace NBus {
const char* c = ServiceIdSet.insert(name).first->c_str();
return (ui64)c;
}
-
+
int TBusLocator::RegisterBreak(TBusService service, const TVector<TBusKey>& starts, const TNetAddr& addr) {
TGuard<TMutex> G(Lock);
@@ -399,7 +399,7 @@ namespace NBus {
TServiceId serviceId = GetServiceId(service);
TItems::const_iterator it;
-
+
TItem itemToReg(serviceId, start, end, addr);
for (it = Items.lower_bound(TItem(serviceId, 0, start, TNetAddr()));
it != Items.end() && it->ServiceId == serviceId;
diff --git a/library/cpp/messagebus/messqueue.cpp b/library/cpp/messagebus/messqueue.cpp
index 3474d62705..e0e3d5f296 100644
--- a/library/cpp/messagebus/messqueue.cpp
+++ b/library/cpp/messagebus/messqueue.cpp
@@ -78,7 +78,7 @@ bool TBusMessageQueue::IsRunning() {
return AtomicGet(Running);
}
-TBusMessageQueueStatus TBusMessageQueue::GetStatusRecordInternal() const {
+TBusMessageQueueStatus TBusMessageQueue::GetStatusRecordInternal() const {
TBusMessageQueueStatus r;
r.ExecutorStatus = WorkQueue->GetStatusRecordInternal();
r.Config = Config;
diff --git a/library/cpp/messagebus/netaddr.h b/library/cpp/messagebus/netaddr.h
index f915c8c574..f5c441b12f 100644
--- a/library/cpp/messagebus/netaddr.h
+++ b/library/cpp/messagebus/netaddr.h
@@ -1,4 +1,4 @@
-#pragma once
-
+#pragma once
+
#include <library/cpp/messagebus/config/netaddr.h>
-
+
diff --git a/library/cpp/messagebus/rain_check/core/task.cpp b/library/cpp/messagebus/rain_check/core/task.cpp
index a098437d53..f0ba062d8e 100644
--- a/library/cpp/messagebus/rain_check/core/task.cpp
+++ b/library/cpp/messagebus/rain_check/core/task.cpp
@@ -211,6 +211,6 @@ TString TTaskRunnerBase::GetStatusSingleLine() {
return TypeName(*Impl);
}
-bool NRainCheck::AreWeInsideTask() {
+bool NRainCheck::AreWeInsideTask() {
return ThreadCurrentTask != nullptr;
-}
+}
diff --git a/library/cpp/messagebus/rain_check/core/task.h b/library/cpp/messagebus/rain_check/core/task.h
index 7d8778bcda..2eebd6e01c 100644
--- a/library/cpp/messagebus/rain_check/core/task.h
+++ b/library/cpp/messagebus/rain_check/core/task.h
@@ -178,7 +178,7 @@ namespace NRainCheck {
}
};
- // Check that current method executed inside some task.
- bool AreWeInsideTask();
-
+ // Check that current method executed inside some task.
+ bool AreWeInsideTask();
+
}
diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_server.h b/library/cpp/messagebus/rain_check/messagebus/messagebus_server.h
index 1334f05fe4..429c8e34d0 100644
--- a/library/cpp/messagebus/rain_check/messagebus/messagebus_server.h
+++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_server.h
@@ -5,7 +5,7 @@
#include <library/cpp/messagebus/ybus.h>
-#include <util/system/yassert.h>
+#include <util/system/yassert.h>
namespace NRainCheck {
class TBusTaskStarter: public NBus::IBusServerHandler {
diff --git a/library/cpp/messagebus/session.cpp b/library/cpp/messagebus/session.cpp
index 46a7ece6a8..78f848beb2 100644
--- a/library/cpp/messagebus/session.cpp
+++ b/library/cpp/messagebus/session.cpp
@@ -24,11 +24,11 @@ namespace NBus {
case AF_INET6: {
return memcmp(&(((const sockaddr_in6*)l.Addr())->sin6_addr), &(((const sockaddr_in6*)r.Addr())->sin6_addr), sizeof(in6_addr));
}
- }
-
+ }
+
return memcmp(l.Addr(), r.Addr(), Min<size_t>(l.Len(), r.Len()));
- }
-
+ }
+
bool operator<(const TNetAddr& a1, const TNetAddr& a2) {
return CompareByHost(a1, a2) < 0;
}
diff --git a/library/cpp/messagebus/ybus.h b/library/cpp/messagebus/ybus.h
index de21ad8521..f1a32de69d 100644
--- a/library/cpp/messagebus/ybus.h
+++ b/library/cpp/messagebus/ybus.h
@@ -3,7 +3,7 @@
/// Asynchronous Messaging Library implements framework for sending and
/// receiving messages between loosely connected processes.
-#include "coreconn.h"
+#include "coreconn.h"
#include "defs.h"
#include "handler.h"
#include "handler_impl.h"
@@ -17,7 +17,7 @@
#include "session.h"
#include "session_config.h"
#include "socket_addr.h"
-
+
#include <library/cpp/messagebus/actor/executor.h>
#include <library/cpp/messagebus/scheduler/scheduler.h>
diff --git a/library/cpp/mime/types/mime.cpp b/library/cpp/mime/types/mime.cpp
index 706d776b24..4223a4f7d5 100644
--- a/library/cpp/mime/types/mime.cpp
+++ b/library/cpp/mime/types/mime.cpp
@@ -1,4 +1,4 @@
-#include "mime.h"
+#include "mime.h"
#include <util/system/defaults.h>
#include <util/generic/hash.h>
@@ -59,7 +59,7 @@ const TMimeTypes::TRecord TMimeTypes::Records[] = {
{MIME_RTF, "text/rtf\0application/rtf\0", "rtf\0"},
{MIME_DOC, "application/msword\0", "doc\0"},
{MIME_MPEG, "audio/mpeg\0", "mp3\0mpa\0m2a\0mp2\0mpg\0mpga\0"},
- {MIME_XML, "text/xml\0application/xml\0", "xml\0"},
+ {MIME_XML, "text/xml\0application/xml\0", "xml\0"},
{MIME_WML, "text/vnd.wap.wml\0", "wml\0"},
{MIME_SWF, "application/x-shockwave-flash\0", "swf\0"},
{MIME_XLS, "application/vnd.ms-excel\0", "xls\0"},
@@ -85,7 +85,7 @@ const TMimeTypes::TRecord TMimeTypes::Records[] = {
{MIME_EPUB, "application/epub+zip\0", "epub\0"},
{MIME_TEX, "application/x-tex\0application/x-latex\0text/x-tex\0", "tex\0"},
{MIME_JSON, "application/json\0", "json\0"},
- {MIME_APK, "application/vnd.android.package-archive\0", "apk\0"},
+ {MIME_APK, "application/vnd.android.package-archive\0", "apk\0"},
{MIME_CSS, "text/css\0", "css\0"},
{MIME_IMAGE_WEBP, "image/webp\0", "webp\0"},
{MIME_DJVU, "image/vnd.djvu\0image/x-djvu\0", "djvu\0djv\0"},
@@ -235,8 +235,8 @@ const char* MimeNames[MIME_MAX] = {
"js", // MIME_JAVASCRIPT // 29
"epub", // MIME_EPUB // 30
"tex", // MIME_TEX // 31
- "json", // MIME_JSON // 32
- "apk", // MIME_APK // 33
+ "json", // MIME_JSON // 32
+ "apk", // MIME_APK // 33
"css", // MIME_CSS // 34
"webp", // MIME_IMAGE_WEBP // 35
"djvu", // MIME_DJVU // 36
diff --git a/library/cpp/mime/types/mime.h b/library/cpp/mime/types/mime.h
index 05da389ea9..778f244445 100644
--- a/library/cpp/mime/types/mime.h
+++ b/library/cpp/mime/types/mime.h
@@ -44,7 +44,7 @@ enum MimeTypes {
MIME_EPUB = 30,
MIME_TEX = 31,
MIME_JSON = 32,
- MIME_APK = 33,
+ MIME_APK = 33,
MIME_CSS = 34,
MIME_IMAGE_WEBP = 35,
MIME_DJVU = 36,
@@ -67,6 +67,6 @@ const char* mimetypeByExt(const char* fname, const char* check_ext = nullptr);
MimeTypes mimeByStr(const char* mimeStr);
MimeTypes mimeByStr(const TStringBuf& mimeStr);
const char* strByMime(MimeTypes mime);
-
-// autogenerated with GENERATE_ENUM_SERIALIZATION
+
+// autogenerated with GENERATE_ENUM_SERIALIZATION
const TString& ToString(MimeTypes x);
diff --git a/library/cpp/mime/types/ya.make b/library/cpp/mime/types/ya.make
index a7f58aab3e..ee19420b14 100644
--- a/library/cpp/mime/types/ya.make
+++ b/library/cpp/mime/types/ya.make
@@ -1,11 +1,11 @@
-LIBRARY()
-
-OWNER(stanly)
-
-SRCS(
- mime.cpp
-)
-
-GENERATE_ENUM_SERIALIZATION(mime.h)
-
-END()
+LIBRARY()
+
+OWNER(stanly)
+
+SRCS(
+ mime.cpp
+)
+
+GENERATE_ENUM_SERIALIZATION(mime.h)
+
+END()
diff --git a/library/cpp/mime/ya.make b/library/cpp/mime/ya.make
index 8ce42f207d..0bddced9d0 100644
--- a/library/cpp/mime/ya.make
+++ b/library/cpp/mime/ya.make
@@ -1,5 +1,5 @@
-RECURSE(
- detect
+RECURSE(
+ detect
detect_ut
- types
-)
+ types
+)
diff --git a/library/cpp/monlib/counters/counters.h b/library/cpp/monlib/counters/counters.h
index 038b55f0c8..d30b78e12c 100644
--- a/library/cpp/monlib/counters/counters.h
+++ b/library/cpp/monlib/counters/counters.h
@@ -80,7 +80,7 @@ namespace NMonitoring {
TValueBase Sub(const TValue val) {
return AtomicAdd(Value, -val);
}
-
+
// operator overloads convinient
void operator++() {
Inc();
@@ -107,7 +107,7 @@ namespace NMonitoring {
AtomicSwap(&Value, rhs);
return rhs;
}
-
+
bool operator!() const {
return AtomicGet(Value) == 0;
}
diff --git a/library/cpp/monlib/service/service.cpp b/library/cpp/monlib/service/service.cpp
index 929efbf816..d61d0782fa 100644
--- a/library/cpp/monlib/service/service.cpp
+++ b/library/cpp/monlib/service/service.cpp
@@ -55,7 +55,7 @@ namespace NMonitoring {
}
const char* GetURI() const override {
- return Header.request_uri.c_str();
+ return Header.request_uri.c_str();
}
const char* GetPath() const override {
return Url.Get(THttpURL::FieldPath);
diff --git a/library/cpp/string_utils/base64/base64.cpp b/library/cpp/string_utils/base64/base64.cpp
index 05c201f0de..92060ad00f 100644
--- a/library/cpp/string_utils/base64/base64.cpp
+++ b/library/cpp/string_utils/base64/base64.cpp
@@ -246,14 +246,14 @@ size_t Base64Decode(void* dst, const char* b, const char* e) {
}
TString Base64DecodeUneven(const TStringBuf s) {
- if (s.length() % 4 == 0) {
- return Base64Decode(s);
- }
-
- // padding to 4
+ if (s.length() % 4 == 0) {
+ return Base64Decode(s);
+ }
+
+ // padding to 4
return Base64Decode(TString(s) + TString(4 - (s.length() % 4), '='));
-}
-
+}
+
char* Base64Encode(char* outstr, const unsigned char* instr, size_t len) {
static const TImpl IMPL = GetImpl();
if (Y_LIKELY(len < 8)) {
diff --git a/library/cpp/string_utils/base64/base64.h b/library/cpp/string_utils/base64/base64.h
index f778a6425a..7941dd4d03 100644
--- a/library/cpp/string_utils/base64/base64.h
+++ b/library/cpp/string_utils/base64/base64.h
@@ -88,9 +88,9 @@ inline TString Base64StrictDecode(const TStringBuf src) {
}
/// @}
-/// Works with strings which length is not divisible by 4.
+/// Works with strings which length is not divisible by 4.
TString Base64DecodeUneven(const TStringBuf s);
-
+
//encode
constexpr size_t Base64EncodeBufSize(const size_t len) noexcept {
return (len + 2) / 3 * 4 + 1;
diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp
index e523350b80..672e122d3d 100644
--- a/library/cpp/string_utils/quote/quote.cpp
+++ b/library/cpp/string_utils/quote/quote.cpp
@@ -276,14 +276,14 @@ TString UrlUnescapeRet(const TStringBuf from) {
return to;
}
-char* UrlEscape(char* to, const char* from, bool forceEscape) {
+char* UrlEscape(char* to, const char* from, bool forceEscape) {
from = FixZero(from);
while (*from) {
- const bool escapePercent = (*from == '%') &&
- (forceEscape || !((*(from + 1) && IsAsciiHex(*(from + 1)) && *(from + 2) && IsAsciiHex(*(from + 2)))));
-
- if (escapePercent || (unsigned char)*from <= ' ' || (unsigned char)*from > '~') {
+ const bool escapePercent = (*from == '%') &&
+ (forceEscape || !((*(from + 1) && IsAsciiHex(*(from + 1)) && *(from + 2) && IsAsciiHex(*(from + 2)))));
+
+ if (escapePercent || (unsigned char)*from <= ' ' || (unsigned char)*from > '~') {
*to++ = '%';
*to++ = d2x((unsigned char)*from >> 4);
*to++ = d2x((unsigned char)*from & 0xF);
@@ -297,7 +297,7 @@ char* UrlEscape(char* to, const char* from, bool forceEscape) {
return to;
}
-void UrlEscape(TString& url, bool forceEscape) {
+void UrlEscape(TString& url, bool forceEscape) {
TTempBuf tempBuf(CgiEscapeBufLen(url.size()));
char* to = tempBuf.Data();
url.AssignNoAlias(to, UrlEscape(to, url.data(), forceEscape));
diff --git a/library/cpp/string_utils/quote/quote.h b/library/cpp/string_utils/quote/quote.h
index 3b7221154e..9163769fc4 100644
--- a/library/cpp/string_utils/quote/quote.h
+++ b/library/cpp/string_utils/quote/quote.h
@@ -48,11 +48,11 @@ 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.
+// 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.
-char* UrlEscape(char* to, const char* from, bool forceEscape = false);
-void UrlEscape(TString& url, bool forceEscape = false);
+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);
//UrlUnescape:
diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp
index 6c552b279e..5f6fb583a3 100644
--- a/library/cpp/string_utils/quote/quote_ut.cpp
+++ b/library/cpp/string_utils/quote/quote_ut.cpp
@@ -178,25 +178,25 @@ Y_UNIT_TEST_SUITE(TCGIUnescapeTest) {
}
}
-Y_UNIT_TEST_SUITE(TUrlEscapeTest) {
- Y_UNIT_TEST(EscapeEscaped) {
- TString s;
-
- s = "hello%3dworld";
+Y_UNIT_TEST_SUITE(TUrlEscapeTest) {
+ Y_UNIT_TEST(EscapeEscaped) {
+ TString s;
+
+ s = "hello%3dworld";
UNIT_ASSERT_VALUES_EQUAL(UrlEscapeRet(s), "hello%3dworld");
- UrlEscape(s);
- UNIT_ASSERT_VALUES_EQUAL(s, "hello%3dworld");
- }
-
- Y_UNIT_TEST(EscapeUnescape) {
- TString s;
-
- s = "hello%3dworld";
- UrlEscape(s);
- UrlUnescape(s);
- UNIT_ASSERT_VALUES_EQUAL(s, "hello=world");
- }
-
+ UrlEscape(s);
+ UNIT_ASSERT_VALUES_EQUAL(s, "hello%3dworld");
+ }
+
+ Y_UNIT_TEST(EscapeUnescape) {
+ TString s;
+
+ s = "hello%3dworld";
+ UrlEscape(s);
+ UrlUnescape(s);
+ UNIT_ASSERT_VALUES_EQUAL(s, "hello=world");
+ }
+
Y_UNIT_TEST(EscapeUnescapeRet) {
TString s;
@@ -204,23 +204,23 @@ Y_UNIT_TEST_SUITE(TUrlEscapeTest) {
UNIT_ASSERT_VALUES_EQUAL(UrlUnescapeRet(UrlEscapeRet(s)), "hello=world");
}
- Y_UNIT_TEST(EscapeEscapedForce) {
- TString s;
-
- s = "hello%3dworld";
+ Y_UNIT_TEST(EscapeEscapedForce) {
+ TString s;
+
+ s = "hello%3dworld";
UNIT_ASSERT_VALUES_EQUAL(UrlEscapeRet(s, true), "hello%253dworld");
- UrlEscape(s, true);
- UNIT_ASSERT_VALUES_EQUAL(s, "hello%253dworld");
- }
-
- Y_UNIT_TEST(EscapeUnescapeForce) {
- TString s;
-
- s = "hello%3dworld";
- UrlEscape(s, true);
- UrlUnescape(s);
- UNIT_ASSERT_VALUES_EQUAL(s, "hello%3dworld");
- }
+ UrlEscape(s, true);
+ UNIT_ASSERT_VALUES_EQUAL(s, "hello%253dworld");
+ }
+
+ Y_UNIT_TEST(EscapeUnescapeForce) {
+ TString s;
+
+ s = "hello%3dworld";
+ UrlEscape(s, true);
+ UrlUnescape(s);
+ UNIT_ASSERT_VALUES_EQUAL(s, "hello%3dworld");
+ }
Y_UNIT_TEST(EscapeUnescapeForceRet) {
TString s;
@@ -228,8 +228,8 @@ Y_UNIT_TEST_SUITE(TUrlEscapeTest) {
s = "hello%3dworld";
UNIT_ASSERT_VALUES_EQUAL(UrlUnescapeRet(UrlEscapeRet(s, true)), "hello%3dworld");
}
-}
-
+}
+
Y_UNIT_TEST_SUITE(TUrlUnescapeTest) {
Y_UNIT_TEST(StrokaOutParameterInplace) {
TString s;
diff --git a/library/cpp/string_utils/url/url_ut.cpp b/library/cpp/string_utils/url/url_ut.cpp
index 1588013893..a103661002 100644
--- a/library/cpp/string_utils/url/url_ut.cpp
+++ b/library/cpp/string_utils/url/url_ut.cpp
@@ -97,7 +97,7 @@ Y_UNIT_TEST_SUITE(TUtilUrlTest) {
UNIT_ASSERT_VALUES_EQUAL("ftp://ya.ru", CutHttpPrefix("ftp://ya.ru"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru/zzz", CutHttpPrefix("http://ya.ru/zzz"));
- UNIT_ASSERT_VALUES_EQUAL("ya.ru/zzz", CutHttpPrefix("http://ya.ru/zzz", true));
+ UNIT_ASSERT_VALUES_EQUAL("ya.ru/zzz", CutHttpPrefix("http://ya.ru/zzz", true));
UNIT_ASSERT_VALUES_EQUAL("ya.ru/zzz", CutHttpPrefix("https://ya.ru/zzz"));
UNIT_ASSERT_VALUES_EQUAL("https://ya.ru/zzz", CutHttpPrefix("https://ya.ru/zzz", true));
UNIT_ASSERT_VALUES_EQUAL("", CutHttpPrefix("https://")); // is that right?
diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp
index 3679b768ed..b43f9c6a4f 100644
--- a/library/cpp/testing/unittest/registar.cpp
+++ b/library/cpp/testing/unittest/registar.cpp
@@ -155,189 +155,189 @@ TString NUnitTest::ColoredDiff(TStringBuf s1, TStringBuf s2, const TString& deli
}
return res.Str();
}
-
-static TString MakeTestName(const NUnitTest::ITestSuiteProcessor::TTest& test) {
- return TStringBuilder() << test.unit->name << "::" << test.name;
-}
-
+
+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) {
- size_t cnt = 0;
- for (const auto& t : testErrors) {
- if (succeeded && t.second == 0) {
- ++cnt;
- } else if (!succeeded && t.second > 0) {
- ++cnt;
- }
- }
- return cnt;
-}
-
-NUnitTest::ITestSuiteProcessor::ITestSuiteProcessor() = default;
-
-NUnitTest::ITestSuiteProcessor::~ITestSuiteProcessor() = default;
-
-void NUnitTest::ITestSuiteProcessor::Start() {
- OnStart();
-}
-
-void NUnitTest::ITestSuiteProcessor::End() {
- OnEnd();
-}
-
-void NUnitTest::ITestSuiteProcessor::UnitStart(const TUnit& unit) {
- CurTestErrors_.clear();
-
- OnUnitStart(&unit);
-}
-
-void NUnitTest::ITestSuiteProcessor::UnitStop(const TUnit& unit) {
- OnUnitStop(&unit);
-}
-
-void NUnitTest::ITestSuiteProcessor::Error(const TError& descr) {
- AddTestError(*descr.test);
-
- OnError(&descr);
-}
-
-void NUnitTest::ITestSuiteProcessor::BeforeTest(const TTest& test) {
- OnBeforeTest(&test);
-}
-
-void NUnitTest::ITestSuiteProcessor::Finish(const TFinish& descr) {
- AddTestFinish(*descr.test);
-
- OnFinish(&descr);
-}
-
-unsigned NUnitTest::ITestSuiteProcessor::GoodTests() const noexcept {
- return CountTests(TestErrors_, true);
-}
-
-unsigned NUnitTest::ITestSuiteProcessor::FailTests() const noexcept {
- return CountTests(TestErrors_, false);
-}
-
-unsigned NUnitTest::ITestSuiteProcessor::GoodTestsInCurrentUnit() const noexcept {
- return CountTests(CurTestErrors_, true);
-}
-
-unsigned NUnitTest::ITestSuiteProcessor::FailTestsInCurrentUnit() const noexcept {
- return CountTests(CurTestErrors_, false);
-}
-
-bool NUnitTest::ITestSuiteProcessor::CheckAccess(TString /*name*/, size_t /*num*/) {
- return true;
-}
-
-bool NUnitTest::ITestSuiteProcessor::CheckAccessTest(TString /*suite*/, const char* /*name*/) {
- return true;
-}
-
+ size_t cnt = 0;
+ for (const auto& t : testErrors) {
+ if (succeeded && t.second == 0) {
+ ++cnt;
+ } else if (!succeeded && t.second > 0) {
+ ++cnt;
+ }
+ }
+ return cnt;
+}
+
+NUnitTest::ITestSuiteProcessor::ITestSuiteProcessor() = default;
+
+NUnitTest::ITestSuiteProcessor::~ITestSuiteProcessor() = default;
+
+void NUnitTest::ITestSuiteProcessor::Start() {
+ OnStart();
+}
+
+void NUnitTest::ITestSuiteProcessor::End() {
+ OnEnd();
+}
+
+void NUnitTest::ITestSuiteProcessor::UnitStart(const TUnit& unit) {
+ CurTestErrors_.clear();
+
+ OnUnitStart(&unit);
+}
+
+void NUnitTest::ITestSuiteProcessor::UnitStop(const TUnit& unit) {
+ OnUnitStop(&unit);
+}
+
+void NUnitTest::ITestSuiteProcessor::Error(const TError& descr) {
+ AddTestError(*descr.test);
+
+ OnError(&descr);
+}
+
+void NUnitTest::ITestSuiteProcessor::BeforeTest(const TTest& test) {
+ OnBeforeTest(&test);
+}
+
+void NUnitTest::ITestSuiteProcessor::Finish(const TFinish& descr) {
+ AddTestFinish(*descr.test);
+
+ OnFinish(&descr);
+}
+
+unsigned NUnitTest::ITestSuiteProcessor::GoodTests() const noexcept {
+ return CountTests(TestErrors_, true);
+}
+
+unsigned NUnitTest::ITestSuiteProcessor::FailTests() const noexcept {
+ return CountTests(TestErrors_, false);
+}
+
+unsigned NUnitTest::ITestSuiteProcessor::GoodTestsInCurrentUnit() const noexcept {
+ return CountTests(CurTestErrors_, true);
+}
+
+unsigned NUnitTest::ITestSuiteProcessor::FailTestsInCurrentUnit() const noexcept {
+ return CountTests(CurTestErrors_, false);
+}
+
+bool NUnitTest::ITestSuiteProcessor::CheckAccess(TString /*name*/, size_t /*num*/) {
+ return true;
+}
+
+bool NUnitTest::ITestSuiteProcessor::CheckAccessTest(TString /*suite*/, const char* /*name*/) {
+ return true;
+}
+
void NUnitTest::ITestSuiteProcessor::Run(std::function<void()> f, const TString& /*suite*/, const char* /*name*/, const bool /*forceFork*/) {
- f();
-}
-
-bool NUnitTest::ITestSuiteProcessor::GetIsForked() const {
- return false;
-}
-
-bool NUnitTest::ITestSuiteProcessor::GetForkTests() const {
- return false;
-}
-
-void NUnitTest::ITestSuiteProcessor::OnStart() {
-}
-
-void NUnitTest::ITestSuiteProcessor::OnEnd() {
-}
-
-void NUnitTest::ITestSuiteProcessor::OnUnitStart(const TUnit* /*unit*/) {
-}
-
-void NUnitTest::ITestSuiteProcessor::OnUnitStop(const TUnit* /*unit*/) {
-}
-
-void NUnitTest::ITestSuiteProcessor::OnError(const TError* /*error*/) {
-}
-
-void NUnitTest::ITestSuiteProcessor::OnFinish(const TFinish* /*finish*/) {
-}
-
-void NUnitTest::ITestSuiteProcessor::OnBeforeTest(const TTest* /*test*/) {
-}
-
-void NUnitTest::ITestSuiteProcessor::AddTestError(const TTest& test) {
- const TString name = MakeTestName(test);
- ++TestErrors_[name];
- ++CurTestErrors_[name];
-}
-
-void NUnitTest::ITestSuiteProcessor::AddTestFinish(const TTest& test) {
- const TString name = MakeTestName(test);
- TestErrors_[name]; // zero errors if not touched
- CurTestErrors_[name]; // zero errors if not touched
-}
-
-NUnitTest::ITestBaseFactory::ITestBaseFactory() {
- Register();
-}
-
-NUnitTest::ITestBaseFactory::~ITestBaseFactory() = default;
-
-void NUnitTest::ITestBaseFactory::Register() noexcept {
- TTestFactory::Instance().Register(this);
-}
-
-NUnitTest::TTestBase::TTestBase() noexcept
+ f();
+}
+
+bool NUnitTest::ITestSuiteProcessor::GetIsForked() const {
+ return false;
+}
+
+bool NUnitTest::ITestSuiteProcessor::GetForkTests() const {
+ return false;
+}
+
+void NUnitTest::ITestSuiteProcessor::OnStart() {
+}
+
+void NUnitTest::ITestSuiteProcessor::OnEnd() {
+}
+
+void NUnitTest::ITestSuiteProcessor::OnUnitStart(const TUnit* /*unit*/) {
+}
+
+void NUnitTest::ITestSuiteProcessor::OnUnitStop(const TUnit* /*unit*/) {
+}
+
+void NUnitTest::ITestSuiteProcessor::OnError(const TError* /*error*/) {
+}
+
+void NUnitTest::ITestSuiteProcessor::OnFinish(const TFinish* /*finish*/) {
+}
+
+void NUnitTest::ITestSuiteProcessor::OnBeforeTest(const TTest* /*test*/) {
+}
+
+void NUnitTest::ITestSuiteProcessor::AddTestError(const TTest& test) {
+ const TString name = MakeTestName(test);
+ ++TestErrors_[name];
+ ++CurTestErrors_[name];
+}
+
+void NUnitTest::ITestSuiteProcessor::AddTestFinish(const TTest& test) {
+ const TString name = MakeTestName(test);
+ TestErrors_[name]; // zero errors if not touched
+ CurTestErrors_[name]; // zero errors if not touched
+}
+
+NUnitTest::ITestBaseFactory::ITestBaseFactory() {
+ Register();
+}
+
+NUnitTest::ITestBaseFactory::~ITestBaseFactory() = default;
+
+void NUnitTest::ITestBaseFactory::Register() noexcept {
+ TTestFactory::Instance().Register(this);
+}
+
+NUnitTest::TTestBase::TTestBase() noexcept
: Parent_(nullptr)
, TestErrors_()
, CurrentSubtest_()
{
-}
-
-NUnitTest::TTestBase::~TTestBase() = default;
-
-TString NUnitTest::TTestBase::TypeId() const {
+}
+
+NUnitTest::TTestBase::~TTestBase() = default;
+
+TString NUnitTest::TTestBase::TypeId() const {
return TypeName(*this);
-}
-
-void NUnitTest::TTestBase::SetUp() {
-}
-
-void NUnitTest::TTestBase::TearDown() {
-}
-
+}
+
+void NUnitTest::TTestBase::SetUp() {
+}
+
+void NUnitTest::TTestBase::TearDown() {
+}
+
void NUnitTest::TTestBase::AddError(const char* msg, const TString& backtrace, TTestContext* context) {
- ++TestErrors_;
- const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
- const NUnitTest::ITestSuiteProcessor::TTest test = {&unit, CurrentSubtest_};
- const NUnitTest::ITestSuiteProcessor::TError err = {&test, msg, backtrace, context};
-
- Processor()->Error(err);
-}
-
+ ++TestErrors_;
+ const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
+ const NUnitTest::ITestSuiteProcessor::TTest test = {&unit, CurrentSubtest_};
+ const NUnitTest::ITestSuiteProcessor::TError err = {&test, msg, backtrace, context};
+
+ Processor()->Error(err);
+}
+
void NUnitTest::TTestBase::AddError(const char* msg, TTestContext* context) {
- AddError(msg, TString(), context);
-}
-
+ AddError(msg, TString(), context);
+}
+
void NUnitTest::TTestBase::RunAfterTest(std::function<void()> f) {
with_lock (AfterTestFunctionsLock_) {
AfterTestFunctions_.emplace_back(std::move(f));
}
}
-bool NUnitTest::TTestBase::CheckAccessTest(const char* test) {
- return Processor()->CheckAccessTest(Name(), test);
-}
-
-void NUnitTest::TTestBase::BeforeTest(const char* func) {
- const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
- const NUnitTest::ITestSuiteProcessor::TTest test = {&unit, func};
+bool NUnitTest::TTestBase::CheckAccessTest(const char* test) {
+ return Processor()->CheckAccessTest(Name(), test);
+}
+
+void NUnitTest::TTestBase::BeforeTest(const char* func) {
+ const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
+ const NUnitTest::ITestSuiteProcessor::TTest test = {&unit, func};
rusage.Fill();
- Processor()->BeforeTest(test);
-}
-
+ Processor()->BeforeTest(test);
+}
+
void NUnitTest::TTestBase::Finish(const char* func, TTestContext* context) {
TRusage finishRusage = TRusage::Get();
context->Metrics["ru_rss"] = finishRusage.MaxRss - rusage.MaxRss;
@@ -345,37 +345,37 @@ void NUnitTest::TTestBase::Finish(const char* func, TTestContext* context) {
context->Metrics["ru_utime"] = (finishRusage.Utime - rusage.Utime).MicroSeconds();
context->Metrics["ru_stime"] = (finishRusage.Stime - rusage.Stime).MicroSeconds();
- const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
- const NUnitTest::ITestSuiteProcessor::TTest test = {&unit, func};
- const NUnitTest::ITestSuiteProcessor::TFinish finish = {&test, context, TestErrors_ == 0};
-
- Processor()->Finish(finish);
-}
-
-void NUnitTest::TTestBase::AtStart() {
- const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
-
- Processor()->UnitStart(unit);
-}
-
-void NUnitTest::TTestBase::AtEnd() {
- const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
-
- Processor()->UnitStop(unit);
-}
-
+ const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
+ const NUnitTest::ITestSuiteProcessor::TTest test = {&unit, func};
+ const NUnitTest::ITestSuiteProcessor::TFinish finish = {&test, context, TestErrors_ == 0};
+
+ Processor()->Finish(finish);
+}
+
+void NUnitTest::TTestBase::AtStart() {
+ const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
+
+ Processor()->UnitStart(unit);
+}
+
+void NUnitTest::TTestBase::AtEnd() {
+ const NUnitTest::ITestSuiteProcessor::TUnit unit = {Name()};
+
+ Processor()->UnitStop(unit);
+}
+
void NUnitTest::TTestBase::Run(std::function<void()> f, const TString& suite, const char* name, const bool forceFork) {
- TestErrors_ = 0;
- CurrentSubtest_ = name;
- Processor()->Run(f, suite, name, forceFork);
-}
-
-void NUnitTest::TTestBase::BeforeTest() {
- SetUp();
-}
-
-void NUnitTest::TTestBase::AfterTest() {
- TearDown();
+ TestErrors_ = 0;
+ CurrentSubtest_ = name;
+ Processor()->Run(f, suite, name, forceFork);
+}
+
+void NUnitTest::TTestBase::BeforeTest() {
+ SetUp();
+}
+
+void NUnitTest::TTestBase::AfterTest() {
+ TearDown();
TVector<std::function<void()>> afterTestFunctions;
with_lock (AfterTestFunctionsLock_) {
@@ -388,126 +388,126 @@ void NUnitTest::TTestBase::AfterTest() {
f();
}
}
-}
-
-bool NUnitTest::TTestBase::GetIsForked() const {
- return Processor()->GetIsForked();
-}
-
-bool NUnitTest::TTestBase::GetForkTests() const {
- return Processor()->GetForkTests();
-}
-
-NUnitTest::ITestSuiteProcessor* NUnitTest::TTestBase::Processor() const noexcept {
- return Parent_->Processor();
-}
-
-NUnitTest::TTestBase::TCleanUp::TCleanUp(TTestBase* base)
- : Base_(base)
-{
- ::NUnitTest::NPrivate::SetCurrentTest(base);
- ::NUnitTest::NPrivate::SetUnittestThread(true);
- Base_->BeforeTest();
-}
-
-NUnitTest::TTestBase::TCleanUp::~TCleanUp() {
- try {
- Base_->AfterTest();
- } catch (...) {
+}
+
+bool NUnitTest::TTestBase::GetIsForked() const {
+ return Processor()->GetIsForked();
+}
+
+bool NUnitTest::TTestBase::GetForkTests() const {
+ return Processor()->GetForkTests();
+}
+
+NUnitTest::ITestSuiteProcessor* NUnitTest::TTestBase::Processor() const noexcept {
+ return Parent_->Processor();
+}
+
+NUnitTest::TTestBase::TCleanUp::TCleanUp(TTestBase* base)
+ : Base_(base)
+{
+ ::NUnitTest::NPrivate::SetCurrentTest(base);
+ ::NUnitTest::NPrivate::SetUnittestThread(true);
+ Base_->BeforeTest();
+}
+
+NUnitTest::TTestBase::TCleanUp::~TCleanUp() {
+ try {
+ Base_->AfterTest();
+ } catch (...) {
Base_->AddError(CurrentExceptionMessage().data());
- }
- ::NUnitTest::NPrivate::SetUnittestThread(false);
- ::NUnitTest::NPrivate::SetCurrentTest(nullptr);
-}
-
-namespace {
- /*
- * by default do nothing
- */
- class TCommonProcessor: public NUnitTest::ITestSuiteProcessor {
- public:
- TCommonProcessor() = default;
-
- ~TCommonProcessor() override = default;
- };
-
- struct TCmp {
- template <class T>
- inline bool operator()(const T& l, const T& r) const noexcept {
+ }
+ ::NUnitTest::NPrivate::SetUnittestThread(false);
+ ::NUnitTest::NPrivate::SetCurrentTest(nullptr);
+}
+
+namespace {
+ /*
+ * by default do nothing
+ */
+ class TCommonProcessor: public NUnitTest::ITestSuiteProcessor {
+ public:
+ TCommonProcessor() = default;
+
+ ~TCommonProcessor() override = default;
+ };
+
+ struct TCmp {
+ template <class T>
+ inline bool operator()(const T& l, const T& r) const noexcept {
return stricmp(Fix(l.Name().data()), Fix(r.Name().data())) < 0;
- }
-
- static inline const char* Fix(const char* n) noexcept {
- if (*n == 'T') {
- return n + 1;
- }
-
- return n;
- }
- };
-}
-
-NUnitTest::TTestFactory::TTestFactory(ITestSuiteProcessor* processor)
- : Processor_(processor)
-{
-}
-
-NUnitTest::TTestFactory::~TTestFactory() = default;
-
-NUnitTest::TTestFactory& NUnitTest::TTestFactory::Instance() {
- static TCommonProcessor p;
- static TTestFactory f(&p);
-
- return f;
-}
-
-unsigned NUnitTest::TTestFactory::Execute() {
- Items_.QuickSort(TCmp());
- Processor_->Start();
-
+ }
+
+ static inline const char* Fix(const char* n) noexcept {
+ if (*n == 'T') {
+ return n + 1;
+ }
+
+ return n;
+ }
+ };
+}
+
+NUnitTest::TTestFactory::TTestFactory(ITestSuiteProcessor* processor)
+ : Processor_(processor)
+{
+}
+
+NUnitTest::TTestFactory::~TTestFactory() = default;
+
+NUnitTest::TTestFactory& NUnitTest::TTestFactory::Instance() {
+ static TCommonProcessor p;
+ static TTestFactory f(&p);
+
+ return f;
+}
+
+unsigned NUnitTest::TTestFactory::Execute() {
+ Items_.QuickSort(TCmp());
+ Processor_->Start();
+
TSet<TString> types;
- size_t cnt = 0;
-
- for (TIntrusiveList<ITestBaseFactory>::TIterator factory = Items_.Begin(); factory != Items_.End(); ++factory) {
- if (!Processor_->CheckAccess(factory->Name(), cnt++)) {
- continue;
- }
-
- THolder<TTestBase> test(factory->ConstructTest());
-
-#ifdef _unix_ // on Windows RTTI causes memory leaks
- TString type = test->TypeId();
- if (types.insert(type).second == false) {
+ size_t cnt = 0;
+
+ for (TIntrusiveList<ITestBaseFactory>::TIterator factory = Items_.Begin(); factory != Items_.End(); ++factory) {
+ if (!Processor_->CheckAccess(factory->Name(), cnt++)) {
+ continue;
+ }
+
+ THolder<TTestBase> test(factory->ConstructTest());
+
+#ifdef _unix_ // on Windows RTTI causes memory leaks
+ TString type = test->TypeId();
+ if (types.insert(type).second == false) {
warnx("Duplicate suite found: %s (%s). Probably you have copy-pasted suite without changing it name", factory->Name().c_str(), type.c_str());
- return 1;
- }
-#endif // _unix_
-
- test->Parent_ = this;
-
+ return 1;
+ }
+#endif // _unix_
+
+ test->Parent_ = this;
+
#ifdef UT_SKIP_EXCEPTIONS
- try {
-#endif
- test->Execute();
+ try {
+#endif
+ test->Execute();
#ifdef UT_SKIP_EXCEPTIONS
- } catch (...) {
- }
-#endif
- }
-
- Processor_->End();
-
+ } catch (...) {
+ }
+#endif
+ }
+
+ Processor_->End();
+
return bool(Processor_->FailTests());
-}
-
-void NUnitTest::TTestFactory::SetProcessor(ITestSuiteProcessor* processor) {
- Processor_ = processor;
-}
-
-void NUnitTest::TTestFactory::Register(ITestBaseFactory* b) noexcept {
- Items_.PushBack(b);
-}
-
-NUnitTest::ITestSuiteProcessor* NUnitTest::TTestFactory::Processor() const noexcept {
- return Processor_;
-}
+}
+
+void NUnitTest::TTestFactory::SetProcessor(ITestSuiteProcessor* processor) {
+ Processor_ = processor;
+}
+
+void NUnitTest::TTestFactory::Register(ITestBaseFactory* b) noexcept {
+ Items_.PushBack(b);
+}
+
+NUnitTest::ITestSuiteProcessor* NUnitTest::TTestFactory::Processor() const noexcept {
+ return Processor_;
+}
diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h
index 44517a0092..3aaf80ebe9 100644
--- a/library/cpp/testing/unittest/registar.h
+++ b/library/cpp/testing/unittest/registar.h
@@ -3,13 +3,13 @@
#include <library/cpp/dbg_output/dump.h>
#include <util/generic/bt_exception.h>
-#include <util/generic/hash.h>
+#include <util/generic/hash.h>
#include <util/generic/intrlist.h>
-#include <util/generic/map.h>
+#include <util/generic/map.h>
#include <util/generic/ptr.h>
#include <util/generic/set.h>
#include <util/generic/typetraits.h>
-#include <util/generic/vector.h>
+#include <util/generic/vector.h>
#include <util/generic/yexception.h>
#include <util/string/builder.h>
@@ -103,64 +103,64 @@ namespace NUnitTest {
bool Success;
};
- ITestSuiteProcessor();
+ ITestSuiteProcessor();
- virtual ~ITestSuiteProcessor();
+ virtual ~ITestSuiteProcessor();
- void Start();
+ void Start();
- void End();
+ void End();
- void UnitStart(const TUnit& unit);
+ void UnitStart(const TUnit& unit);
- void UnitStop(const TUnit& unit);
+ void UnitStop(const TUnit& unit);
- void Error(const TError& descr);
+ void Error(const TError& descr);
- void BeforeTest(const TTest& test);
+ void BeforeTest(const TTest& test);
- void Finish(const TFinish& descr);
+ void Finish(const TFinish& descr);
- unsigned GoodTests() const noexcept;
+ unsigned GoodTests() const noexcept;
- unsigned FailTests() const noexcept;
+ unsigned FailTests() const noexcept;
- unsigned GoodTestsInCurrentUnit() const noexcept;
+ unsigned GoodTestsInCurrentUnit() const noexcept;
- unsigned FailTestsInCurrentUnit() const noexcept;
+ unsigned FailTestsInCurrentUnit() const noexcept;
// Should execute test suite?
- virtual bool CheckAccess(TString /*name*/, size_t /*num*/);
+ virtual bool CheckAccess(TString /*name*/, size_t /*num*/);
// Should execute a test whitin suite?
- virtual bool CheckAccessTest(TString /*suite*/, const char* /*name*/);
+ virtual bool CheckAccessTest(TString /*suite*/, const char* /*name*/);
virtual void Run(std::function<void()> f, const TString& /*suite*/, const char* /*name*/, bool /*forceFork*/);
// This process is forked for current test
- virtual bool GetIsForked() const;
-
+ virtual bool GetIsForked() const;
+
// --fork-tests is set (warning: this may be false, but never the less test will be forked if called inside UNIT_FORKED_TEST)
- virtual bool GetForkTests() const;
+ virtual bool GetForkTests() const;
private:
- virtual void OnStart();
+ virtual void OnStart();
- virtual void OnEnd();
+ virtual void OnEnd();
- virtual void OnUnitStart(const TUnit* /*unit*/);
+ virtual void OnUnitStart(const TUnit* /*unit*/);
- virtual void OnUnitStop(const TUnit* /*unit*/);
+ virtual void OnUnitStop(const TUnit* /*unit*/);
- virtual void OnError(const TError* /*error*/);
+ virtual void OnError(const TError* /*error*/);
- virtual void OnFinish(const TFinish* /*finish*/);
+ virtual void OnFinish(const TFinish* /*finish*/);
- virtual void OnBeforeTest(const TTest* /*test*/);
+ virtual void OnBeforeTest(const TTest* /*test*/);
- void AddTestError(const TTest& test);
+ void AddTestError(const TTest& test);
- void AddTestFinish(const TTest& test);
+ void AddTestFinish(const TTest& test);
private:
TMap<TString, size_t> TestErrors_;
@@ -172,16 +172,16 @@ namespace NUnitTest {
class ITestBaseFactory: public TIntrusiveListItem<ITestBaseFactory> {
public:
- ITestBaseFactory();
+ ITestBaseFactory();
- virtual ~ITestBaseFactory();
+ virtual ~ITestBaseFactory();
// name of test suite
virtual TString Name() const noexcept = 0;
virtual TTestBase* ConstructTest() = 0;
private:
- void Register() noexcept;
+ void Register() noexcept;
};
class TTestBase {
@@ -189,18 +189,18 @@ namespace NUnitTest {
TRusage rusage;
public:
- TTestBase() noexcept;
+ TTestBase() noexcept;
- virtual ~TTestBase();
+ virtual ~TTestBase();
- virtual TString TypeId() const;
+ virtual TString TypeId() const;
virtual TString Name() const noexcept = 0;
virtual void Execute() = 0;
- virtual void SetUp();
+ virtual void SetUp();
- virtual void TearDown();
+ virtual void TearDown();
void AddError(const char* msg, const TString& backtrace = TString(), TTestContext* context = nullptr);
@@ -209,15 +209,15 @@ namespace NUnitTest {
void RunAfterTest(std::function<void()> f); // function like atexit to run after current unit test
protected:
- bool CheckAccessTest(const char* test);
+ bool CheckAccessTest(const char* test);
- void BeforeTest(const char* func);
+ void BeforeTest(const char* func);
void Finish(const char* func, TTestContext* context);
- void AtStart();
+ void AtStart();
- void AtEnd();
+ void AtEnd();
void Run(std::function<void()> f, const TString& suite, const char* name, bool forceFork);
@@ -225,21 +225,21 @@ namespace NUnitTest {
public:
explicit TCleanUp(TTestBase* base);
- ~TCleanUp();
+ ~TCleanUp();
private:
TTestBase* Base_;
};
- void BeforeTest();
-
- void AfterTest();
+ void BeforeTest();
- bool GetIsForked() const;
+ void AfterTest();
- bool GetForkTests() const;
+ bool GetIsForked() const;
- ITestSuiteProcessor* Processor() const noexcept;
+ bool GetForkTests() const;
+
+ ITestSuiteProcessor* Processor() const noexcept;
private:
TTestFactory* Parent_;
@@ -759,21 +759,21 @@ public: \
friend class ITestBaseFactory;
public:
- static TTestFactory& Instance();
+ static TTestFactory& Instance();
- unsigned Execute();
+ unsigned Execute();
- void SetProcessor(ITestSuiteProcessor* processor);
+ void SetProcessor(ITestSuiteProcessor* processor);
private:
- void Register(ITestBaseFactory* b) noexcept;
+ void Register(ITestBaseFactory* b) noexcept;
- ITestSuiteProcessor* Processor() const noexcept;
+ ITestSuiteProcessor* Processor() const noexcept;
private:
explicit TTestFactory(ITestSuiteProcessor* processor);
- ~TTestFactory();
+ ~TTestFactory();
private:
TIntrusiveList<ITestBaseFactory> Items_;
@@ -783,13 +783,13 @@ public: \
template <class T>
class TTestBaseFactory: public ITestBaseFactory {
public:
- ~TTestBaseFactory() override = default;
+ ~TTestBaseFactory() override = default;
- inline TTestBase* ConstructTest() override {
+ inline TTestBase* ConstructTest() override {
return new T;
}
- inline TString Name() const noexcept override {
+ inline TString Name() const noexcept override {
return T::StaticName();
}
};
@@ -804,7 +804,7 @@ public: \
: TBaseTestCase(nullptr, nullptr, false)
{
}
-
+
inline TBaseTestCase(const char* name, std::function<void(TTestContext&)> body, bool forceFork)
: Name_(name)
, Body_(std::move(body))
diff --git a/library/cpp/uri/location.cpp b/library/cpp/uri/location.cpp
index a6a4d11ffa..e5df7a3858 100644
--- a/library/cpp/uri/location.cpp
+++ b/library/cpp/uri/location.cpp
@@ -1,15 +1,15 @@
-#include "location.h"
-#include "uri.h"
-
-namespace NUri {
+#include "location.h"
+#include "uri.h"
+
+namespace NUri {
static const int URI_PARSE_FLAGS =
(TFeature::FeaturesRecommended | TFeature::FeatureConvertHostIDN | TFeature::FeatureEncodeExtendedDelim | TFeature::FeatureEncodePercent) & ~TFeature::FeatureHashBangToEscapedFragment;
-
+
TString ResolveRedirectLocation(const TStringBuf& baseUrl,
const TStringBuf& location) {
TUri baseUri;
TUri locationUri;
-
+
// Parse base URL.
if (baseUri.Parse(baseUrl, URI_PARSE_FLAGS) != NUri::TState::ParsedOK) {
return "";
@@ -26,6 +26,6 @@ namespace NUri {
TString res;
locationUri.Print(res, NUri::TField::FlagAllFields);
return res;
- }
-
-}
+ }
+
+}
diff --git a/library/cpp/uri/location.h b/library/cpp/uri/location.h
index 0f533fe0b5..ece4def07a 100644
--- a/library/cpp/uri/location.h
+++ b/library/cpp/uri/location.h
@@ -1,13 +1,13 @@
-#pragma once
-
-#include <util/generic/string.h>
-
-namespace NUri {
+#pragma once
+
+#include <util/generic/string.h>
+
+namespace NUri {
/**
- * Resolve Location header according to https://tools.ietf.org/html/rfc7231#section-7.1.2
- *
- * @return Resolved location's url or empty string in case of any error.
- */
+ * Resolve Location header according to https://tools.ietf.org/html/rfc7231#section-7.1.2
+ *
+ * @return Resolved location's url or empty string in case of any error.
+ */
TString ResolveRedirectLocation(const TStringBuf& baseUrl, const TStringBuf& location);
-
-}
+
+}
diff --git a/library/cpp/uri/location_ut.cpp b/library/cpp/uri/location_ut.cpp
index 26a0f64471..58d1578a7d 100644
--- a/library/cpp/uri/location_ut.cpp
+++ b/library/cpp/uri/location_ut.cpp
@@ -1,40 +1,40 @@
-#include "location.h"
-
+#include "location.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TResolveRedirectTests) {
Y_UNIT_TEST(Absolute) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub"), "http://redir-example.com/sub");
- }
+ }
Y_UNIT_TEST(AbsWithFragment) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub#Hello"), "http://redir-example.com/sub#Hello");
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com/#Hello", "http://redir-example.com/sub"), "http://redir-example.com/sub#Hello");
- }
+ }
Y_UNIT_TEST(Rel) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "/sub"), "http://example.com/sub");
- }
+ }
Y_UNIT_TEST(RelWithFragment) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "/sub#Hello"), "http://example.com/sub#Hello");
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com/#Hello", "/sub"), "http://example.com/sub#Hello");
- }
+ }
Y_UNIT_TEST(WrongLocation) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", ""), "");
- }
+ }
Y_UNIT_TEST(WrongBase) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("", "http://example.com"), "");
- }
+ }
Y_UNIT_TEST(HashBangIsNothingSpecial) {
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com", "http://redir-example.com/sub#!Hello"), "http://redir-example.com/sub#!Hello");
- UNIT_ASSERT_EQUAL(
+ UNIT_ASSERT_EQUAL(
NUri::ResolveRedirectLocation("http://example.com/#!Hello", "http://redir-example.com/sub"), "http://redir-example.com/sub#!Hello");
- }
-}
+ }
+}
diff --git a/library/cpp/uri/ut/ya.make b/library/cpp/uri/ut/ya.make
index b2b2c1291a..9f61239ab4 100644
--- a/library/cpp/uri/ut/ya.make
+++ b/library/cpp/uri/ut/ya.make
@@ -11,7 +11,7 @@ PEERDIR(
)
SRCS(
- location_ut.cpp
+ location_ut.cpp
uri-ru_ut.cpp
uri_ut.cpp
)
diff --git a/library/cpp/uri/ya.make b/library/cpp/uri/ya.make
index 8fc808a6af..ec2daed7c0 100644
--- a/library/cpp/uri/ya.make
+++ b/library/cpp/uri/ya.make
@@ -10,7 +10,7 @@ SRCS(
common.cpp
encode.cpp
http_url.h
- location.cpp
+ location.cpp
other.cpp
parse.cpp
qargs.cpp
diff --git a/tools/ya.make b/tools/ya.make
index 51a6b8b426..aef5e96545 100644
--- a/tools/ya.make
+++ b/tools/ya.make
@@ -90,7 +90,7 @@ RECURSE(
print_ranking_features
printcorpus
printdocstat
- printdom
+ printdom
printkeys
printlinks
printphones
diff --git a/util/folder/fts.cpp b/util/folder/fts.cpp
index 0e6a6f86eb..314e8d6d58 100644
--- a/util/folder/fts.cpp
+++ b/util/folder/fts.cpp
@@ -215,18 +215,18 @@ static int fts_safe_changedir(FTS*, FTSENT*, int, const char*);
#define BNAMES 2 /* yfts_children, names only */
#define BREAD 3 /* yfts_read */
-static u_short
-yfts_type_from_info(u_short info) {
- if (info == FTS_D || info == FTS_DP || info == FTS_DOT) {
- return FTS_D;
- } else if (info == FTS_F) {
- return FTS_F;
- } else if (info == FTS_SL || info == FTS_SLNONE) {
- return FTS_SL;
- }
- return FTS_NSOK;
-}
-
+static u_short
+yfts_type_from_info(u_short info) {
+ if (info == FTS_D || info == FTS_DP || info == FTS_DOT) {
+ return FTS_D;
+ } else if (info == FTS_F) {
+ return FTS_F;
+ } else if (info == FTS_SL || info == FTS_SLNONE) {
+ return FTS_SL;
+ }
+ return FTS_NSOK;
+}
+
static void*
yreallocf(void* ptr, size_t size)
{
@@ -314,7 +314,7 @@ FTS* yfts_open(char* const* argv, int options, int (*compar)(const FTSENT**, con
p->fts_parent = parent;
p->fts_accpath = p->fts_name;
p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW));
- p->fts_type = yfts_type_from_info(p->fts_info);
+ p->fts_type = yfts_type_from_info(p->fts_info);
/* Command-line "." and ".." are real directories. */
if (p->fts_info == FTS_DOT) {
@@ -482,7 +482,7 @@ yfts_read(FTS* sp) {
/* Any type of file may be re-visited; re-stat and re-turn. */
if (instr == FTS_AGAIN) {
p->fts_info = fts_stat(sp, p, 0);
- p->fts_type = yfts_type_from_info(p->fts_info);
+ p->fts_type = yfts_type_from_info(p->fts_info);
return (p);
}
@@ -495,7 +495,7 @@ yfts_read(FTS* sp) {
if (instr == FTS_FOLLOW &&
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
p->fts_info = fts_stat(sp, p, 1);
- p->fts_type = yfts_type_from_info(p->fts_info);
+ p->fts_type = yfts_type_from_info(p->fts_info);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
if (valid_dird(p->fts_symfd = get_cwdd())) {
p->fts_errno = errno;
@@ -591,7 +591,7 @@ next:
}
if (p->fts_instr == FTS_FOLLOW) {
p->fts_info = fts_stat(sp, p, 1);
- p->fts_type = yfts_type_from_info(p->fts_info);
+ p->fts_type = yfts_type_from_info(p->fts_info);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
if (valid_dird(p->fts_symfd =
get_cwdd())) {
@@ -981,16 +981,16 @@ fts_build(FTS* sp, int type)
p->fts_flags |= FTS_ISW;
#endif
-#ifdef _DIRENT_HAVE_D_TYPE
- if (dp->d_type == DT_DIR) {
- p->fts_type = FTS_D;
- } else if (dp->d_type == DT_REG) {
- p->fts_type = FTS_F;
- } else if (dp->d_type == DT_LNK) {
- p->fts_type = FTS_SL;
- }
-#endif
-
+#ifdef _DIRENT_HAVE_D_TYPE
+ if (dp->d_type == DT_DIR) {
+ p->fts_type = FTS_D;
+ } else if (dp->d_type == DT_REG) {
+ p->fts_type = FTS_F;
+ } else if (dp->d_type == DT_LNK) {
+ p->fts_type = FTS_SL;
+ }
+#endif
+
// coverity[dead_error_line]: false positive
if (cderrno) {
if (nlinks) {
@@ -1019,7 +1019,7 @@ fts_build(FTS* sp, int type)
}
/* Stat it. */
p->fts_info = fts_stat(sp, p, 0);
- p->fts_type = yfts_type_from_info(p->fts_info);
+ p->fts_type = yfts_type_from_info(p->fts_info);
/* Decrement link count if applicable. */
if (nlinks > 0 && (p->fts_info == FTS_D ||
@@ -1259,7 +1259,7 @@ fts_alloc(FTS* sp, const char* name, int namelen)
p->fts_instr = FTS_NOINSTR;
p->fts_number = 0;
p->fts_pointer = nullptr;
- p->fts_type = FTS_NSOK;
+ p->fts_type = FTS_NSOK;
return (p);
}
diff --git a/util/folder/fts.h b/util/folder/fts.h
index f3c799e8c8..6ee42fd803 100644
--- a/util/folder/fts.h
+++ b/util/folder/fts.h
@@ -84,7 +84,7 @@ typedef struct _ftsent {
#define FTS_SLNONE 13 /* symbolic link without target */
#define FTS_W 14 /* whiteout object */
u_short fts_info; /* user flags for FTSENT structure */
- u_short fts_type; /* type of fs node; one of FTS_D, FTS_F, FTS_SL */
+ u_short fts_type; /* type of fs node; one of FTS_D, FTS_F, FTS_SL */
#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
diff --git a/util/folder/iterator.h b/util/folder/iterator.h
index 69e025b9c4..f84cac2b99 100644
--- a/util/folder/iterator.h
+++ b/util/folder/iterator.h
@@ -97,10 +97,10 @@ public:
return ret;
}
- inline void Skip(FTSENT* ent) {
- yfts_set(FileTree_.Get(), ent, FTS_SKIP);
- }
-
+ inline void Skip(FTSENT* ent) {
+ yfts_set(FileTree_.Get(), ent, FTS_SKIP);
+ }
+
private:
TOptions Options_;
TString Path_;
diff --git a/util/folder/iterator_ut.cpp b/util/folder/iterator_ut.cpp
index 936becd139..9a3f92313f 100644
--- a/util/folder/iterator_ut.cpp
+++ b/util/folder/iterator_ut.cpp
@@ -22,7 +22,7 @@ class TDirIteratorTest: public TTestBase {
UNIT_TEST(TestIt)
UNIT_TEST(TestError)
UNIT_TEST(TestLocal)
- UNIT_TEST(TestSkip)
+ UNIT_TEST(TestSkip)
UNIT_TEST(TestSort)
UNIT_TEST_SUITE_END();
@@ -134,45 +134,45 @@ private:
}
}
- inline void TestSkip() {
- TDirHier hier;
-
- const TString dir = "tmpdir";
- const TDirHier::TPath path = {dir, 1};
-
- hier.Add(path);
- hier.AddDir(dir + LOCSLASH_C + "dir1");
- hier.AddDir(dir + LOCSLASH_C + "dir1" + LOCSLASH_C + "dir2");
- //
- // Without skip
- //
- {
- TDirIterator di(dir);
-
- UNIT_ASSERT(di.Next());
- UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
- UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir2");
- UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir2");
- UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
- UNIT_ASSERT(di.Next());
- UNIT_ASSERT_EQUAL(di.Next(), nullptr);
- }
- //
- // With skip
- //
- {
- TDirIterator di(dir);
-
- UNIT_ASSERT(di.Next());
- auto ent = di.Next();
- UNIT_ASSERT_EQUAL(TStringBuf(ent->fts_name), "dir1");
- di.Skip(ent);
- UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
- UNIT_ASSERT(di.Next());
- UNIT_ASSERT_EQUAL(di.Next(), nullptr);
- }
- }
-
+ inline void TestSkip() {
+ TDirHier hier;
+
+ const TString dir = "tmpdir";
+ const TDirHier::TPath path = {dir, 1};
+
+ hier.Add(path);
+ hier.AddDir(dir + LOCSLASH_C + "dir1");
+ hier.AddDir(dir + LOCSLASH_C + "dir1" + LOCSLASH_C + "dir2");
+ //
+ // Without skip
+ //
+ {
+ TDirIterator di(dir);
+
+ UNIT_ASSERT(di.Next());
+ UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
+ UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir2");
+ UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir2");
+ UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
+ UNIT_ASSERT(di.Next());
+ UNIT_ASSERT_EQUAL(di.Next(), nullptr);
+ }
+ //
+ // With skip
+ //
+ {
+ TDirIterator di(dir);
+
+ UNIT_ASSERT(di.Next());
+ auto ent = di.Next();
+ UNIT_ASSERT_EQUAL(TStringBuf(ent->fts_name), "dir1");
+ di.Skip(ent);
+ UNIT_ASSERT_EQUAL(TStringBuf(di.Next()->fts_name), "dir1");
+ UNIT_ASSERT(di.Next());
+ UNIT_ASSERT_EQUAL(di.Next(), nullptr);
+ }
+ }
+
inline void TestSort() {
TDirHier dh;
const TString dir("tmpdir");
diff --git a/util/folder/path.cpp b/util/folder/path.cpp
index bfe0c67d68..0b5a1a83ae 100644
--- a/util/folder/path.cpp
+++ b/util/folder/path.cpp
@@ -367,14 +367,14 @@ void TFsPath::MkDir(const int mode) const {
CheckDefined();
if (!Exists()) {
int r = Mkdir(this->c_str(), mode);
- if (r != 0) {
- // TODO (stanly) will still fail on Windows because
- // LastSystemError() returns windows specific ERROR_ALREADY_EXISTS
- // instead of EEXIST.
- if (LastSystemError() != EEXIST) {
- ythrow TIoSystemError() << "could not create directory " << Path_;
- }
- }
+ if (r != 0) {
+ // TODO (stanly) will still fail on Windows because
+ // LastSystemError() returns windows specific ERROR_ALREADY_EXISTS
+ // instead of EEXIST.
+ if (LastSystemError() != EEXIST) {
+ ythrow TIoSystemError() << "could not create directory " << Path_;
+ }
+ }
}
}
diff --git a/util/folder/path.h b/util/folder/path.h
index 2fb4d6b4ef..5ab77b2612 100644
--- a/util/folder/path.h
+++ b/util/folder/path.h
@@ -115,12 +115,12 @@ public:
}
TFsPath RelativeTo(const TFsPath& root) const; //must be subpath of root
-
- /**
- * @returns relative path or empty path if root equals to this.
- */
+
+ /**
+ * @returns relative path or empty path if root equals to this.
+ */
TFsPath RelativePath(const TFsPath& root) const; //..; for relative paths 1st component must be the same
-
+
/**
* Never fails. Returns this if already a root.
*/
diff --git a/util/generic/array_ref.h b/util/generic/array_ref.h
index 1ac60ac7d3..811147b212 100644
--- a/util/generic/array_ref.h
+++ b/util/generic/array_ref.h
@@ -252,12 +252,12 @@ TArrayRef<char> as_writable_bytes(TArrayRef<T> arrayRef) noexcept {
template <class Range>
constexpr TArrayRef<const typename Range::value_type> MakeArrayRef(const Range& range) {
return TArrayRef<const typename Range::value_type>(range);
-}
-
+}
+
template <class Range>
constexpr TArrayRef<typename Range::value_type> MakeArrayRef(Range& range) {
return TArrayRef<typename Range::value_type>(range);
-}
+}
template <class Range>
constexpr TArrayRef<const typename Range::value_type> MakeConstArrayRef(const Range& range) {
diff --git a/util/generic/buffer.cpp b/util/generic/buffer.cpp
index b92697e1d0..8fde049b6e 100644
--- a/util/generic/buffer.cpp
+++ b/util/generic/buffer.cpp
@@ -22,14 +22,14 @@ TBuffer::TBuffer(TBuffer&& b) noexcept
Swap(b);
}
-TBuffer::TBuffer(const char* buf, size_t len)
+TBuffer::TBuffer(const char* buf, size_t len)
: Data_(nullptr)
- , Len_(0)
- , Pos_(0)
-{
- Append(buf, len);
-}
-
+ , Len_(0)
+ , Pos_(0)
+{
+ Append(buf, len);
+}
+
TBuffer& TBuffer::operator=(TBuffer&& b) noexcept {
y_deallocate(Data_);
diff --git a/util/generic/intrlist.h b/util/generic/intrlist.h
index b5d3f2051b..5995c75fcf 100644
--- a/util/generic/intrlist.h
+++ b/util/generic/intrlist.h
@@ -11,7 +11,7 @@ struct TIntrusiveListDefaultTag {};
* two-way linked list
*/
template <class T, class Tag = TIntrusiveListDefaultTag>
-class TIntrusiveListItem {
+class TIntrusiveListItem {
private:
using TListItem = TIntrusiveListItem<T, Tag>;
@@ -110,16 +110,16 @@ public:
}
private:
- inline TIntrusiveListItem(const TIntrusiveListItem&) = delete;
- inline TIntrusiveListItem& operator=(const TIntrusiveListItem&) = delete;
-
-private:
+ inline TIntrusiveListItem(const TIntrusiveListItem&) = delete;
+ inline TIntrusiveListItem& operator=(const TIntrusiveListItem&) = delete;
+
+private:
TListItem* Next_;
TListItem* Prev_;
};
template <class T, class Tag>
-class TIntrusiveList {
+class TIntrusiveList {
private:
using TListItem = TIntrusiveListItem<T, Tag>;
@@ -342,8 +342,8 @@ public:
public:
inline TIntrusiveList() noexcept = default;
- inline ~TIntrusiveList() = default;
-
+ inline ~TIntrusiveList() = default;
+
inline TIntrusiveList(TIntrusiveList&& right) noexcept {
this->Swap(right);
}
@@ -362,7 +362,7 @@ public:
}
inline size_t Size() const noexcept {
- return std::distance(Begin(), End());
+ return std::distance(Begin(), End());
}
inline void Remove(TListItem* item) noexcept {
@@ -577,10 +577,10 @@ public:
}
private:
- inline TIntrusiveList(const TIntrusiveList&) = delete;
- inline TIntrusiveList& operator=(const TIntrusiveList&) = delete;
-
-private:
+ inline TIntrusiveList(const TIntrusiveList&) = delete;
+ inline TIntrusiveList& operator=(const TIntrusiveList&) = delete;
+
+private:
TListItem End_;
};
@@ -687,16 +687,16 @@ public:
template <class TListItem, class TNode>
class TIteratorBase {
public:
- using TItem = TListItem;
- using TReference = TNode&;
- using TPointer = TNode*;
-
- using difference_type = std::ptrdiff_t;
- using value_type = TNode;
- using pointer = TPointer;
- using reference = TReference;
- using iterator_category = std::forward_iterator_tag;
-
+ using TItem = TListItem;
+ using TReference = TNode&;
+ using TPointer = TNode*;
+
+ using difference_type = std::ptrdiff_t;
+ using value_type = TNode;
+ using pointer = TPointer;
+ using reference = TReference;
+ using iterator_category = std::forward_iterator_tag;
+
inline TIteratorBase(TListItem* item) noexcept
: Item_(item)
{
@@ -766,7 +766,7 @@ public:
}
inline size_t Size() const noexcept {
- return std::distance(Begin(), End());
+ return std::distance(Begin(), End());
}
inline void Clear() noexcept {
diff --git a/util/generic/iterator.h b/util/generic/iterator.h
index 19e9d20976..f7e718e85d 100644
--- a/util/generic/iterator.h
+++ b/util/generic/iterator.h
@@ -70,12 +70,12 @@ public: // TODO: private
public:
static constexpr bool IsNoexceptNext = noexcept(std::declval<TSlave>().Next());
- using difference_type = std::ptrdiff_t;
+ using difference_type = std::ptrdiff_t;
using pointer = decltype(std::declval<TSlave>().Next());
using reference = decltype(*std::declval<TSlave>().Next());
using value_type = std::remove_cv_t<std::remove_reference_t<reference>>;
using iterator_category = std::input_iterator_tag;
-
+
inline TIterator() noexcept
: Slave_(nullptr)
, Cur_()
diff --git a/util/generic/iterator_range.cpp b/util/generic/iterator_range.cpp
index bd8d7ff81b..97e1d8c3dd 100644
--- a/util/generic/iterator_range.cpp
+++ b/util/generic/iterator_range.cpp
@@ -1 +1 @@
-#include "iterator_range.h"
+#include "iterator_range.h"
diff --git a/util/generic/iterator_range.h b/util/generic/iterator_range.h
index 9f4d02da29..45db9f055d 100644
--- a/util/generic/iterator_range.h
+++ b/util/generic/iterator_range.h
@@ -49,9 +49,9 @@ public:
using difference_type = typename std::iterator_traits<iterator>::difference_type;
using size_type = std::size_t;
- TIteratorRange()
- : Begin_()
- , End_()
+ TIteratorRange()
+ : Begin_()
+ , End_()
{
}
@@ -70,13 +70,13 @@ public:
}
Y_PURE_FUNCTION bool empty() const {
- return Begin_ == End_;
- }
-
- size_type size() const {
+ return Begin_ == End_;
+ }
+
+ size_type size() const {
return End_ - Begin_;
- }
-
+ }
+
reference operator[](size_t at) const {
Y_ASSERT(at < size());
diff --git a/util/generic/iterator_range_ut.cpp b/util/generic/iterator_range_ut.cpp
index a7e3670ae1..e859c90b01 100644
--- a/util/generic/iterator_range_ut.cpp
+++ b/util/generic/iterator_range_ut.cpp
@@ -1,4 +1,4 @@
-#include "iterator_range.h"
+#include "iterator_range.h"
#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/algorithm.h>
@@ -6,9 +6,9 @@
Y_UNIT_TEST_SUITE(IteratorRange) {
Y_UNIT_TEST(DefaultConstructor) {
- TIteratorRange<int*> range;
- UNIT_ASSERT(range.empty());
- }
+ TIteratorRange<int*> range;
+ UNIT_ASSERT(range.empty());
+ }
Y_UNIT_TEST(DefaultConstructorSentinel) {
TIteratorRange<int*, void*> range;
@@ -16,11 +16,11 @@ Y_UNIT_TEST_SUITE(IteratorRange) {
}
Y_UNIT_TEST(RangeBasedForLoop) {
- // compileability test
- for (int i : TIteratorRange<int*>()) {
- Y_UNUSED(i);
- }
- }
+ // compileability test
+ for (int i : TIteratorRange<int*>()) {
+ Y_UNUSED(i);
+ }
+ }
Y_UNIT_TEST(RangeBasedForLoopSentinel) {
// compileability test
@@ -30,11 +30,11 @@ Y_UNIT_TEST_SUITE(IteratorRange) {
}
Y_UNIT_TEST(Works) {
- const int values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
- auto range = MakeIteratorRange(values, values + Y_ARRAY_SIZE(values));
- UNIT_ASSERT_VALUES_EQUAL(range.size(), Y_ARRAY_SIZE(values));
- UNIT_ASSERT(Equal(range.begin(), range.end(), values));
- UNIT_ASSERT(!range.empty());
+ const int values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ auto range = MakeIteratorRange(values, values + Y_ARRAY_SIZE(values));
+ UNIT_ASSERT_VALUES_EQUAL(range.size(), Y_ARRAY_SIZE(values));
+ UNIT_ASSERT(Equal(range.begin(), range.end(), values));
+ UNIT_ASSERT(!range.empty());
}
Y_UNIT_TEST(WorksSentinel) {
@@ -89,10 +89,10 @@ Y_UNIT_TEST_SUITE(IteratorRange) {
}
Y_UNIT_TEST(CanUseInAlgorithms) {
- const int values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
- auto range = MakeIteratorRange(values, values + Y_ARRAY_SIZE(values));
- // more like compileability test
- // we should be able to use TIteratorRange as a container parameter for standard algorithms
- UNIT_ASSERT(AllOf(range, [](int x) { return x > 0; }));
- }
+ const int values[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+ auto range = MakeIteratorRange(values, values + Y_ARRAY_SIZE(values));
+ // more like compileability test
+ // we should be able to use TIteratorRange as a container parameter for standard algorithms
+ UNIT_ASSERT(AllOf(range, [](int x) { return x > 0; }));
+ }
}
diff --git a/util/generic/ptr_ut.cpp b/util/generic/ptr_ut.cpp
index c2dcff23f6..c87d2e6374 100644
--- a/util/generic/ptr_ut.cpp
+++ b/util/generic/ptr_ut.cpp
@@ -708,7 +708,7 @@ void TPointerTest::TestMakeShared() {
UNIT_ASSERT(state == OS_NOT_CREATED || state == OS_DESTROYED);
}
}
-
+
template <class TPtr>
void TestPtrComparison(const TPtr& ptr) {
UNIT_ASSERT(ptr == ptr);
@@ -719,15 +719,15 @@ void TestPtrComparison(const TPtr& ptr) {
void TPointerTest::TestComparison() {
THolder<A> ptr1(new A);
- TAutoPtr<A> ptr2;
- TSimpleSharedPtr<int> ptr3(new int(6));
- TIntrusivePtr<A> ptr4;
+ TAutoPtr<A> ptr2;
+ TSimpleSharedPtr<int> ptr3(new int(6));
+ TIntrusivePtr<A> ptr4;
TIntrusiveConstPtr<A> ptr5 = ptr4;
-
- UNIT_ASSERT(ptr1 != nullptr);
- UNIT_ASSERT(ptr2 == nullptr);
- UNIT_ASSERT(ptr3 != nullptr);
- UNIT_ASSERT(ptr4 == nullptr);
+
+ UNIT_ASSERT(ptr1 != nullptr);
+ UNIT_ASSERT(ptr2 == nullptr);
+ UNIT_ASSERT(ptr3 != nullptr);
+ UNIT_ASSERT(ptr4 == nullptr);
UNIT_ASSERT(ptr5 == nullptr);
TestPtrComparison(ptr1);
@@ -735,7 +735,7 @@ void TPointerTest::TestComparison() {
TestPtrComparison(ptr3);
TestPtrComparison(ptr4);
TestPtrComparison(ptr5);
-}
+}
template <class T, class TRefCountedPtr>
void TPointerTest::TestRefCountedPtrsInHashSetImpl() {
diff --git a/util/generic/stack.h b/util/generic/stack.h
index dbcbf2b5c9..048de43c9a 100644
--- a/util/generic/stack.h
+++ b/util/generic/stack.h
@@ -12,7 +12,7 @@ class TStack: public std::stack<T, S> {
public:
using TBase::TBase;
- inline explicit operator bool() const noexcept {
- return !this->empty();
- }
+ inline explicit operator bool() const noexcept {
+ return !this->empty();
+ }
};
diff --git a/util/generic/stack_ut.cpp b/util/generic/stack_ut.cpp
index 248127d326..d60115caad 100644
--- a/util/generic/stack_ut.cpp
+++ b/util/generic/stack_ut.cpp
@@ -1,16 +1,16 @@
-#include "stack.h"
-
+#include "stack.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TYStackTest) {
Y_UNIT_TEST(ExplicitBool) {
TStack<int> s;
-
- UNIT_ASSERT(!s);
+
+ UNIT_ASSERT(!s);
UNIT_ASSERT(s.empty());
- s.push(100);
- s.push(200);
+ s.push(100);
+ s.push(200);
UNIT_ASSERT(s);
- UNIT_ASSERT(!s.empty());
- }
-}
+ UNIT_ASSERT(!s.empty());
+ }
+}
diff --git a/util/generic/ut/ya.make b/util/generic/ut/ya.make
index 6eaf24cc5f..c6bb8fe327 100644
--- a/util/generic/ut/ya.make
+++ b/util/generic/ut/ya.make
@@ -24,7 +24,7 @@ SRCS(
generic/intrlist_ut.cpp
generic/is_in_ut.cpp
generic/iterator_ut.cpp
- generic/iterator_range_ut.cpp
+ generic/iterator_range_ut.cpp
generic/lazy_value_ut.cpp
generic/list_ut.cpp
generic/map_ut.cpp
diff --git a/util/generic/vector.h b/util/generic/vector.h
index a5b258955a..d6631a8c60 100644
--- a/util/generic/vector.h
+++ b/util/generic/vector.h
@@ -6,7 +6,7 @@
#include <util/memory/alloc.h>
#include <vector>
-#include <initializer_list>
+#include <initializer_list>
template <class T, class A>
class TVector: public std::vector<T, TReboundAllocator<A, T>> {
@@ -58,15 +58,15 @@ public:
}
inline TVector(std::initializer_list<T> il)
- : TBase(il)
- {
- }
-
+ : TBase(il)
+ {
+ }
+
inline TVector(std::initializer_list<T> il, const typename TBase::allocator_type& a)
- : TBase(il, a)
- {
- }
-
+ : TBase(il, a)
+ {
+ }
+
inline TVector(const TSelf& src)
: TBase(src)
{
@@ -93,11 +93,11 @@ public:
return *this;
}
- inline TSelf& operator=(std::initializer_list<T> il) {
- this->assign(il.begin(), il.end());
- return *this;
- }
-
+ inline TSelf& operator=(std::initializer_list<T> il) {
+ this->assign(il.begin(), il.end());
+ return *this;
+ }
+
inline explicit operator bool() const noexcept {
return !this->empty();
}
diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp
index 0f6b4037a0..d829831fb6 100644
--- a/util/generic/vector_ut.cpp
+++ b/util/generic/vector_ut.cpp
@@ -29,7 +29,7 @@ class TYVectorTest: public TTestBase {
UNIT_TEST(TestFillInConstructor)
UNIT_TEST(TestYResize)
UNIT_TEST(TestCrop)
- UNIT_TEST(TestInitializeList)
+ UNIT_TEST(TestInitializeList)
UNIT_TEST_SUITE_END();
private:
@@ -563,34 +563,34 @@ private:
TestYResize<TPod>();
TestYResize<TNonPod>();
}
-
+
void CheckInitializeList(const TVector<int>& v) {
for (size_t i = 0; i < v.size(); ++i) {
UNIT_ASSERT_EQUAL(v[i], static_cast<int>(i));
- }
- }
-
- void TestInitializeList() {
- {
+ }
+ }
+
+ void TestInitializeList() {
+ {
TVector<int> v;
- v.assign({0, 1, 2});
- CheckInitializeList(v);
- }
- {
+ v.assign({0, 1, 2});
+ CheckInitializeList(v);
+ }
+ {
TVector<int> v = {0, 1, 2};
- CheckInitializeList(v);
- }
- {
+ CheckInitializeList(v);
+ }
+ {
TVector<int> v;
- v = {0, 1, 2};
- CheckInitializeList(v);
- }
- {
+ v = {0, 1, 2};
+ CheckInitializeList(v);
+ }
+ {
TVector<int> v = {0, 3};
- v.insert(v.begin() + 1, {1, 2});
- CheckInitializeList(v);
- }
- }
+ v.insert(v.begin() + 1, {1, 2});
+ CheckInitializeList(v);
+ }
+ }
};
UNIT_TEST_SUITE_REGISTRATION(TYVectorTest);
diff --git a/util/memory/pool.h b/util/memory/pool.h
index 13c8b6b9ed..58a5057b3c 100644
--- a/util/memory/pool.h
+++ b/util/memory/pool.h
@@ -8,7 +8,7 @@
#include <util/generic/utility.h>
#include <util/generic/intrlist.h>
#include <util/generic/strbuf.h>
-#include <util/generic/singleton.h>
+#include <util/generic/singleton.h>
#include <new>
#include <string>
@@ -67,7 +67,7 @@ private:
inline size_t Used() const noexcept {
return Cur_ - (const char*)this;
}
-
+
inline size_t Left() const noexcept {
return Left_;
}
@@ -146,7 +146,7 @@ public:
inline ~TMemoryPool() {
Clear();
}
-
+
inline void* Allocate(size_t len) {
return RawAllocate(AlignUp<size_t>(len, PLATFORM_DATA_ALIGN));
}
@@ -231,7 +231,7 @@ public:
*(ret + buf.size()) = 0;
return TBasicStringBuf<TChar>(ret, buf.size());
}
-
+
inline size_t Available() const noexcept {
return Current_->Left();
}
@@ -309,8 +309,8 @@ private:
template <typename TPool>
struct TPoolableBase {
inline void* operator new(size_t bytes, TPool& pool) {
- return pool.Allocate(bytes);
- }
+ return pool.Allocate(bytes);
+ }
inline void* operator new(size_t bytes, std::align_val_t align, TPool& pool) {
return pool.Allocate(bytes, (size_t)align);
@@ -324,8 +324,8 @@ struct TPoolableBase {
private:
inline void* operator new(size_t); // disallow default allocation
-};
-
+};
+
struct TPoolable: public TPoolableBase<TMemoryPool> {
};
diff --git a/util/memory/segmented_string_pool.h b/util/memory/segmented_string_pool.h
index a40aa408f5..c02b28606b 100644
--- a/util/memory/segmented_string_pool.h
+++ b/util/memory/segmented_string_pool.h
@@ -1,6 +1,6 @@
#pragma once
-#include <util/system/align.h>
+#include <util/system/align.h>
#include <util/system/yassert.h>
#include <util/system/defaults.h>
#include <util/generic/noncopyable.h>
@@ -95,9 +95,9 @@ public:
curseg->freepos += last_ins_size, last_free -= 1;
return (T*)rv;
}
- size_t get_segment_size() const {
- return segment_size;
- }
+ size_t get_segment_size() const {
+ return segment_size;
+ }
bool contains(const T* ptr) const {
for (seg_const_iterator i = segs.begin(), ie = segs.end(); i != ie; ++i)
if ((char*)ptr >= (char*)i->data && (char*)ptr < (char*)i->data + i->freepos)
@@ -186,9 +186,9 @@ public:
template <typename T, typename C>
inline T* pool_push(segmented_pool<C>& pool, const T* v) {
- static_assert(sizeof(C) == 1, "only char type supported");
+ static_assert(sizeof(C) == 1, "only char type supported");
size_t len = SizeOf(v);
- C* buf = pool.append(nullptr, AlignUp(len));
+ C* buf = pool.append(nullptr, AlignUp(len));
memcpy(buf, v, len);
return (T*)buf;
}
diff --git a/util/network/socket.cpp b/util/network/socket.cpp
index 4f6e804346..1b7445d612 100644
--- a/util/network/socket.cpp
+++ b/util/network/socket.cpp
@@ -368,61 +368,61 @@ size_t GetMaximumTransferUnit(SOCKET /*s*/) {
return 8192;
}
-int GetSocketToS(SOCKET s) {
- TOpaqueAddr addr;
-
+int GetSocketToS(SOCKET s) {
+ TOpaqueAddr addr;
+
if (getsockname(s, addr.MutableAddr(), addr.LenPtr()) < 0) {
ythrow TSystemError() << "getsockname() failed";
- }
-
- return GetSocketToS(s, &addr);
-}
-
-int GetSocketToS(SOCKET s, const IRemoteAddr* addr) {
- int result = 0;
-
- switch (addr->Addr()->sa_family) {
+ }
+
+ return GetSocketToS(s, &addr);
+}
+
+int GetSocketToS(SOCKET s, const IRemoteAddr* addr) {
+ int result = 0;
+
+ switch (addr->Addr()->sa_family) {
case AF_INET:
CheckedGetSockOpt(s, IPPROTO_IP, IP_TOS, result, "tos");
break;
-
+
case AF_INET6:
-#ifdef IPV6_TCLASS
+#ifdef IPV6_TCLASS
CheckedGetSockOpt(s, IPPROTO_IPV6, IPV6_TCLASS, result, "tos");
-#endif
+#endif
break;
- }
-
- return result;
-}
-
-void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos) {
- switch (addr->Addr()->sa_family) {
+ }
+
+ return result;
+}
+
+void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos) {
+ switch (addr->Addr()->sa_family) {
case AF_INET:
CheckedSetSockOpt(s, IPPROTO_IP, IP_TOS, tos, "tos");
return;
-
+
case AF_INET6:
-#ifdef IPV6_TCLASS
+#ifdef IPV6_TCLASS
CheckedSetSockOpt(s, IPPROTO_IPV6, IPV6_TCLASS, tos, "tos");
return;
-#endif
+#endif
break;
- }
-
- ythrow yexception() << "SetSocketToS unsupported for family " << addr->Addr()->sa_family;
-}
-
-void SetSocketToS(SOCKET s, int tos) {
- TOpaqueAddr addr;
-
+ }
+
+ ythrow yexception() << "SetSocketToS unsupported for family " << addr->Addr()->sa_family;
+}
+
+void SetSocketToS(SOCKET s, int tos) {
+ TOpaqueAddr addr;
+
if (getsockname(s, addr.MutableAddr(), addr.LenPtr()) < 0) {
ythrow TSystemError() << "getsockname() failed";
- }
-
- SetSocketToS(s, &addr, tos);
-}
-
+ }
+
+ SetSocketToS(s, &addr, tos);
+}
+
void SetSocketPriority(SOCKET s, int priority) {
#if defined(SO_PRIORITY)
CheckedSetSockOpt(s, SOL_SOCKET, SO_PRIORITY, priority, "priority");
diff --git a/util/network/socket.h b/util/network/socket.h
index 40c8648b40..4c8e045e7b 100644
--- a/util/network/socket.h
+++ b/util/network/socket.h
@@ -92,10 +92,10 @@ static inline void FixIPv6ListenSocket(SOCKET s) {
#endif
}
-namespace NAddr {
- class IRemoteAddr;
-}
-
+namespace NAddr {
+ class IRemoteAddr;
+}
+
void SetSocketTimeout(SOCKET s, long timeout);
void SetSocketTimeout(SOCKET s, long sec, long msec);
void SetNoDelay(SOCKET s, bool value);
@@ -112,10 +112,10 @@ bool GetRemoteAddr(SOCKET s, char* str, socklen_t size);
size_t GetMaximumSegmentSize(SOCKET s);
size_t GetMaximumTransferUnit(SOCKET s);
void SetDeferAccept(SOCKET s);
-void SetSocketToS(SOCKET s, int tos);
-void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos);
-int GetSocketToS(SOCKET s);
-int GetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr);
+void SetSocketToS(SOCKET s, int tos);
+void SetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr, int tos);
+int GetSocketToS(SOCKET s);
+int GetSocketToS(SOCKET s, const NAddr::IRemoteAddr* addr);
void SetSocketPriority(SOCKET s, int priority);
void SetTcpFastOpen(SOCKET s, int qlen);
/**
diff --git a/util/string/ascii.h b/util/string/ascii.h
index 10344384d3..f40482f679 100644
--- a/util/string/ascii.h
+++ b/util/string/ascii.h
@@ -212,8 +212,8 @@ static inline int AsciiCompareIgnoreCase(const char* s1, const char* s2) noexcep
* similar to stricmp.
*/
Y_PURE_FUNCTION int AsciiCompareIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept;
-
-/**
+
+/**
* ASCII case-sensitive string comparison (for proper UTF8 strings
* case-sensitive comparison consider using @c library/cpp/charset).
*
@@ -224,24 +224,24 @@ Y_PURE_FUNCTION int AsciiCompareIgnoreCase(const TStringBuf s1, const TStringBuf
*/
static inline bool AsciiHasPrefix(const TStringBuf s1, const TStringBuf s2) noexcept {
return (s1.size() >= s2.size()) && memcmp(s1.data(), s2.data(), s2.size()) == 0;
-}
-
-/**
- * ASCII case-insensitive string comparison (for proper UTF8 strings
+}
+
+/**
+ * ASCII case-insensitive string comparison (for proper UTF8 strings
* case-insensitive comparison consider using @c library/cpp/charset).
- *
- * @return true iff @c s2 are case-insensitively prefix of @c s1.
- */
+ *
+ * @return true iff @c s2 are case-insensitively prefix of @c s1.
+ */
static inline bool AsciiHasPrefixIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
return (s1.size() >= s2.size()) && strnicmp(s1.data(), s2.data(), s2.size()) == 0;
-}
-
-/**
- * ASCII case-insensitive string comparison (for proper UTF8 strings
+}
+
+/**
+ * ASCII case-insensitive string comparison (for proper UTF8 strings
* case-insensitive comparison consider using @c library/cpp/charset).
- *
- * @return true iff @c s2 are case-insensitively suffix of @c s1.
- */
+ *
+ * @return true iff @c s2 are case-insensitively suffix of @c s1.
+ */
static inline bool AsciiHasSuffixIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
return (s1.size() >= s2.size()) && strnicmp((s1.data() + (s1.size() - s2.size())), s2.data(), s2.size()) == 0;
-}
+}
diff --git a/util/string/ascii_ut.cpp b/util/string/ascii_ut.cpp
index 89069fee50..b35dc835ad 100644
--- a/util/string/ascii_ut.cpp
+++ b/util/string/ascii_ut.cpp
@@ -84,15 +84,15 @@ Y_UNIT_TEST_SUITE(TAsciiTest) {
UNIT_ASSERT(AsciiCompareIgnoreCase("qqQ", "qq") > 0);
UNIT_ASSERT(AsciiCompareIgnoreCase("qq", "qq") == 0);
-
- UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "qwe"), true);
- UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "qWe"), false);
- UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "eWq"), false);
-
- UNIT_ASSERT_EQUAL(AsciiHasPrefixIgnoreCase("qweasd", "qWe"), true);
- UNIT_ASSERT_EQUAL(AsciiHasPrefixIgnoreCase("qweasd", "eWq"), false);
-
- UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "asD"), true);
- UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "ast"), false);
+
+ UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "qwe"), true);
+ UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "qWe"), false);
+ UNIT_ASSERT_EQUAL(AsciiHasPrefix("qweasd", "eWq"), false);
+
+ UNIT_ASSERT_EQUAL(AsciiHasPrefixIgnoreCase("qweasd", "qWe"), true);
+ UNIT_ASSERT_EQUAL(AsciiHasPrefixIgnoreCase("qweasd", "eWq"), false);
+
+ UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "asD"), true);
+ UNIT_ASSERT_EQUAL(AsciiHasSuffixIgnoreCase("qweasd", "ast"), false);
}
}
diff --git a/util/string/printf_ut.cpp b/util/string/printf_ut.cpp
index 2b2f980b70..d11129b6b0 100644
--- a/util/string/printf_ut.cpp
+++ b/util/string/printf_ut.cpp
@@ -21,10 +21,10 @@ Y_UNIT_TEST_SUITE(TStringPrintf) {
}
Y_UNIT_TEST(TestSpecial) {
- UNIT_ASSERT_EQUAL("4294967295", Sprintf("%" PRIu32, (ui32)(-1)));
+ UNIT_ASSERT_EQUAL("4294967295", Sprintf("%" PRIu32, (ui32)(-1)));
}
-
+
Y_UNIT_TEST(TestExplicitPositions) {
- UNIT_ASSERT_EQUAL("abc xyz abc", Sprintf("%1$s %2$s %1$s", "abc", "xyz"));
- }
+ UNIT_ASSERT_EQUAL("abc xyz abc", Sprintf("%1$s %2$s %1$s", "abc", "xyz"));
+ }
}
diff --git a/util/system/hostname.cpp b/util/system/hostname.cpp
index 386f646d6b..56a322a790 100644
--- a/util/system/hostname.cpp
+++ b/util/system/hostname.cpp
@@ -1,7 +1,7 @@
#include <util/memory/tempbuf.h>
#include <util/generic/singleton.h>
#include <util/generic/yexception.h>
-#include <util/network/ip.h>
+#include <util/network/ip.h>
#if defined(_unix_)
#include <unistd.h>
@@ -31,24 +31,24 @@ namespace {
TString HostName;
};
-
- struct TFQDNHostNameHolder {
- inline TFQDNHostNameHolder() {
- struct addrinfo hints;
- struct addrinfo* ais{nullptr};
- char buf[1024];
-
- memset(buf, 0, sizeof(buf));
- int res = gethostname(buf, sizeof(buf) - 1);
- if (res) {
- ythrow TSystemError() << "can not get hostname";
- }
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_UNSPEC;
- hints.ai_flags = AI_CANONNAME;
- res = getaddrinfo(buf, nullptr, &hints, &ais);
- if (res) {
+
+ struct TFQDNHostNameHolder {
+ inline TFQDNHostNameHolder() {
+ struct addrinfo hints;
+ struct addrinfo* ais{nullptr};
+ char buf[1024];
+
+ memset(buf, 0, sizeof(buf));
+ int res = gethostname(buf, sizeof(buf) - 1);
+ if (res) {
+ ythrow TSystemError() << "can not get hostname";
+ }
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_flags = AI_CANONNAME;
+ res = getaddrinfo(buf, nullptr, &hints, &ais);
+ if (res) {
if (res != EAI_NONAME) {
ythrow TSystemError() << "can not get FQDN (return code is " << res << ", hostname is \"" << buf << "\")";
}
@@ -56,12 +56,12 @@ namespace {
} else {
FQDNHostName = ais->ai_canonname;
freeaddrinfo(ais);
- }
- FQDNHostName.to_lower();
- }
-
+ }
+ FQDNHostName.to_lower();
+ }
+
TString FQDNHostName;
- };
+ };
}
const TString& HostName() {
@@ -71,26 +71,26 @@ const TString& HostName() {
const char* GetHostName() {
return HostName().data();
}
-
+
const TString& FQDNHostName() {
- return (Singleton<TFQDNHostNameHolder>())->FQDNHostName;
-}
-
-const char* GetFQDNHostName() {
+ return (Singleton<TFQDNHostNameHolder>())->FQDNHostName;
+}
+
+const char* GetFQDNHostName() {
return FQDNHostName().data();
-}
-
+}
+
bool IsFQDN(const TString& name) {
TString absName = name;
if (!absName.EndsWith('.')) {
- absName.append(".");
- }
-
- try {
- // ResolveHost() can't be used since it is ipv4-only, port is not important
- TNetworkAddress addr(absName, 0);
+ absName.append(".");
+ }
+
+ try {
+ // ResolveHost() can't be used since it is ipv4-only, port is not important
+ TNetworkAddress addr(absName, 0);
} catch (const TNetworkResolutionError&) {
- return false;
- }
- return true;
-}
+ return false;
+ }
+ return true;
+}
diff --git a/util/system/hostname.h b/util/system/hostname.h
index 0839ee2b59..e25e1d0c05 100644
--- a/util/system/hostname.h
+++ b/util/system/hostname.h
@@ -4,7 +4,7 @@
const char* GetHostName();
const TString& HostName();
-
-const char* GetFQDNHostName();
+
+const char* GetFQDNHostName();
const TString& FQDNHostName();
bool IsFQDN(const TString& name);
diff --git a/util/system/hostname_ut.cpp b/util/system/hostname_ut.cpp
index fb1cb7dde4..03eacb8aeb 100644
--- a/util/system/hostname_ut.cpp
+++ b/util/system/hostname_ut.cpp
@@ -6,11 +6,11 @@ Y_UNIT_TEST_SUITE(THostNameTest) {
Y_UNIT_TEST(Test1) {
UNIT_ASSERT(*GetHostName() != '?');
}
-
+
Y_UNIT_TEST(TestFQDN) {
UNIT_ASSERT(*GetFQDNHostName() != '?');
}
-
+
Y_UNIT_TEST(TestIsFQDN) {
const auto x = GetFQDNHostName();
diff --git a/util/system/spin_wait.cpp b/util/system/spin_wait.cpp
index e27045e74f..88ce48d7b6 100644
--- a/util/system/spin_wait.cpp
+++ b/util/system/spin_wait.cpp
@@ -17,7 +17,7 @@ static inline T RandomizeSleepTime(T t) noexcept {
//arbitrary values
#define MIN_SLEEP_TIME 500
-#define MAX_SPIN_COUNT 0x7FF
+#define MAX_SPIN_COUNT 0x7FF
TSpinWait::TSpinWait() noexcept
: T(MIN_SLEEP_TIME)
diff --git a/util/thread/lfqueue.h b/util/thread/lfqueue.h
index ab523631e4..451bff0743 100644
--- a/util/thread/lfqueue.h
+++ b/util/thread/lfqueue.h
@@ -2,7 +2,7 @@
#include "fwd.h"
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/system/atomic.h>
#include <util/system/yassert.h>
#include "lfstack.h"
@@ -358,41 +358,41 @@ public:
return res;
}
};
-
+
template <class T, class TCounter>
-class TAutoLockFreeQueue {
-public:
+class TAutoLockFreeQueue {
+public:
using TRef = THolder<T>;
-
+
inline ~TAutoLockFreeQueue() {
- TRef tmp;
-
+ TRef tmp;
+
while (Dequeue(&tmp)) {
}
- }
-
- inline bool Dequeue(TRef* t) {
+ }
+
+ inline bool Dequeue(TRef* t) {
T* res = nullptr;
-
- if (Queue.Dequeue(&res)) {
- t->Reset(res);
-
- return true;
- }
-
- return false;
- }
-
- inline void Enqueue(TRef& t) {
- Queue.Enqueue(t.Get());
+
+ if (Queue.Dequeue(&res)) {
+ t->Reset(res);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ inline void Enqueue(TRef& t) {
+ Queue.Enqueue(t.Get());
Y_UNUSED(t.Release());
- }
-
- inline void Enqueue(TRef&& t) {
- Queue.Enqueue(t.Get());
+ }
+
+ inline void Enqueue(TRef&& t) {
+ Queue.Enqueue(t.Get());
Y_UNUSED(t.Release());
- }
-
+ }
+
inline bool IsEmpty() {
return Queue.IsEmpty();
}
@@ -401,6 +401,6 @@ public:
return Queue.GetCounter();
}
-private:
- TLockFreeQueue<T*, TCounter> Queue;
-};
+private:
+ TLockFreeQueue<T*, TCounter> Queue;
+};
diff --git a/util/ya.make b/util/ya.make
index 6ebe7e40cf..58822f630f 100644
--- a/util/ya.make
+++ b/util/ya.make
@@ -106,7 +106,7 @@ JOIN_SRCS(
generic/intrlist.cpp
generic/is_in.cpp
generic/iterator.cpp
- generic/iterator_range.cpp
+ generic/iterator_range.cpp
generic/lazy_value.cpp
generic/list.cpp
generic/map.cpp
diff --git a/ydb/core/base/events.h b/ydb/core/base/events.h
index f5fedfe19b..4c5c2ca7ac 100644
--- a/ydb/core/base/events.h
+++ b/ydb/core/base/events.h
@@ -69,7 +69,7 @@ struct TKikimrEvents : TEvents {
ES_BLACKBOX_VALIDATOR,
ES_SELF_PING,
ES_PIPECACHE,
- ES_PQ_PROXY,
+ ES_PQ_PROXY,
ES_CMS,
ES_NODE_BROKER,
ES_TX_ALLOCATOR, //4152
@@ -82,7 +82,7 @@ struct TKikimrEvents : TEvents {
ES_VIEWER,
ES_SUB_DOMAIN,
ES_GRPC_PROXY_STATUS, //OLD
- ES_SQS,
+ ES_SQS,
ES_BLOCKSTORE, //4162
ES_RTMR_ICBUS,
ES_TENANT_POOL,
diff --git a/ydb/core/client/minikql_compile/ya.make b/ydb/core/client/minikql_compile/ya.make
index a8bd3ca518..639039ea71 100644
--- a/ydb/core/client/minikql_compile/ya.make
+++ b/ydb/core/client/minikql_compile/ya.make
@@ -9,7 +9,7 @@ SRCS(
compile_result.h
db_key_resolver.cpp
db_key_resolver.h
- mkql_compile_service.cpp
+ mkql_compile_service.cpp
yql_expr_minikql.cpp
yql_expr_minikql.h
)
diff --git a/ydb/core/client/server/grpc_base.h b/ydb/core/client/server/grpc_base.h
index e104ef0c1b..6466f3fc2e 100644
--- a/ydb/core/client/server/grpc_base.h
+++ b/ydb/core/client/server/grpc_base.h
@@ -1,5 +1,5 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/protos/grpc.grpc.pb.h>
#include <ydb/core/base/counters.h>
diff --git a/ydb/core/client/server/grpc_server.cpp b/ydb/core/client/server/grpc_server.cpp
index aa122da36a..6b89a93aec 100644
--- a/ydb/core/client/server/grpc_server.cpp
+++ b/ydb/core/client/server/grpc_server.cpp
@@ -1,63 +1,63 @@
-#include "grpc_server.h"
+#include "grpc_server.h"
#include "grpc_proxy_status.h"
-
+
#include <ydb/core/client/server/msgbus_server_persqueue.h>
#include <ydb/core/grpc_services/grpc_helper.h>
#include <library/cpp/grpc/server/grpc_request.h>
#include <library/cpp/grpc/server/grpc_counters.h>
#include <library/cpp/grpc/server/grpc_async_ctx_base.h>
-
+
#include <library/cpp/json/json_writer.h>
-#include <util/string/join.h>
-
+#include <util/string/join.h>
+
#include <google/protobuf/text_format.h>
-#include <grpc++/resource_quota.h>
-#include <grpc++/security/server_credentials.h>
-#include <grpc++/server_builder.h>
-#include <grpc++/server_context.h>
-#include <grpc++/server.h>
-
-using grpc::Server;
-using grpc::ServerContext;
-using grpc::ServerAsyncResponseWriter;
+#include <grpc++/resource_quota.h>
+#include <grpc++/security/server_credentials.h>
+#include <grpc++/server_builder.h>
+#include <grpc++/server_context.h>
+#include <grpc++/server.h>
+
+using grpc::Server;
+using grpc::ServerContext;
+using grpc::ServerAsyncResponseWriter;
using grpc::ServerAsyncWriter;
-using grpc::Status;
-using grpc::StatusCode;
-using grpc::ServerCompletionQueue;
+using grpc::Status;
+using grpc::StatusCode;
+using grpc::ServerCompletionQueue;
using grpc::CompletionQueue;
-
+
using NKikimrClient::TResponse;
using NKikimrClient::TPersQueueRequest;
-
+
using NGrpc::IQueueEvent;
-using namespace NActors;
+using namespace NActors;
using namespace NThreading;
-
-namespace NKikimr {
-namespace NGRpcProxy {
-namespace {
-
+
+namespace NKikimr {
+namespace NGRpcProxy {
+namespace {
+
using TGrpcBaseAsyncContext = NGrpc::TBaseAsyncContext<NGRpcProxy::TGRpcService>;
template <typename TIn, typename TOut = TResponse>
-class TSimpleRequest
- : public IQueueEvent
+class TSimpleRequest
+ : public IQueueEvent
, public TGrpcBaseAsyncContext
- , public IRequestContext
-{
+ , public IRequestContext
+{
using TOnRequest = std::function<void (IRequestContext* ctx)>;
-
+
using TRequestCallback = void (NKikimrClient::TGRpcServer::AsyncService::*)(ServerContext*, TIn*,
ServerAsyncResponseWriter<TOut>*, CompletionQueue*, ServerCompletionQueue*, void*);
-public:
+public:
TSimpleRequest(TGRpcService* server,
NKikimrClient::TGRpcServer::AsyncService* service,
- ServerCompletionQueue* cq,
+ ServerCompletionQueue* cq,
TOnRequest cb,
TRequestCallback requestCallback,
TActorSystem& as,
@@ -76,10 +76,10 @@ public:
, ResponseSize(0)
, ResponseStatus(0)
, InProgress_(false)
- {
+ {
LOG_DEBUG(ActorSystem, NKikimrServices::GRPC_SERVER, "[%p] created request Name# %s", this, Name);
- }
-
+ }
+
~TSimpleRequest() {
if (InProgress_) {
//If we are ShuttingDown probably ActorSystem unable to recieve new events
@@ -101,7 +101,7 @@ public:
}
}
-public:
+public:
//! Start another instance of request to grab next incoming query (only when the server is not shutting down)
void Clone() {
if (!Server->IsShuttingDown()) {
@@ -110,25 +110,25 @@ public:
}
}
- bool Execute(bool ok) override {
+ bool Execute(bool ok) override {
return (this->*StateFunc)(ok);
- }
-
- void DestroyRequest() override {
+ }
+
+ void DestroyRequest() override {
if (RequestRegistered_) {
Server->DeregisterRequestCtx(this);
RequestRegistered_ = false;
}
- delete this;
- }
-
+ delete this;
+ }
+
public:
- //! Get pointer to the request's message.
- const NProtoBuf::Message* GetRequest() const override {
+ //! Get pointer to the request's message.
+ const NProtoBuf::Message* GetRequest() const override {
return &Request;
- }
-
- //! Send reply.
+ }
+
+ //! Send reply.
void Reply(const NKikimrClient::TResponse& resp) override {
if (const TOut *x = dynamic_cast<const TOut *>(&resp)) {
Finish(*x, 0);
@@ -169,14 +169,14 @@ public:
}
}
- void Reply(const NKikimrClient::TSqsResponse& resp) override {
- try {
+ void Reply(const NKikimrClient::TSqsResponse& resp) override {
+ try {
Finish(dynamic_cast<const TOut&>(resp), 0);
- } catch (const std::bad_cast&) {
- Y_FAIL("unexpected response type generated");
- }
- }
-
+ } catch (const std::bad_cast&) {
+ Y_FAIL("unexpected response type generated");
+ }
+ }
+
void Reply(const NKikimrClient::TS3ListingResponse& resp) override {
try {
Finish(dynamic_cast<const TOut&>(resp), 0);
@@ -198,8 +198,8 @@ public:
TOut resp;
GenerateErrorResponse(resp, reason);
Finish(resp, 0);
- }
-
+ }
+
static void GenerateErrorResponse(NKikimrClient::TResponse& resp, const TString& reason) {
resp.SetStatus(NMsgBusProxy::MSTATUS_ERROR);
if (reason) {
@@ -223,14 +223,14 @@ public:
resp.SetJSON(NJson::WriteJson(json, false));
}
- static void GenerateErrorResponse(NKikimrClient::TSqsResponse&, const TString&)
- { }
-
+ static void GenerateErrorResponse(NKikimrClient::TSqsResponse&, const TString&)
+ { }
+
static void GenerateErrorResponse(NKikimrClient::TS3ListingResponse& resp, const TString& reason) {
resp.SetStatus(NMsgBusProxy::MSTATUS_ERROR);
resp.SetDescription(reason);
}
-
+
static void GenerateErrorResponse(NKikimrClient::TConsoleResponse& resp, const TString& reason) {
resp.MutableStatus()->SetCode(Ydb::StatusIds::GENERIC_ERROR);
resp.MutableStatus()->SetReason(reason);
@@ -244,7 +244,7 @@ public:
return GetPeerName();
}
-private:
+private:
void* GetGRpcTag() {
return static_cast<IQueueEvent*>(this);
}
@@ -263,8 +263,8 @@ private:
ResponseStatus = status;
StateFunc = &TSimpleRequest::FinishDone;
Writer->Finish(resp, Status::OK, GetGRpcTag());
- }
-
+ }
+
void FinishNoResource() {
TOut resp;
TString msg = "no resource";
@@ -277,7 +277,7 @@ private:
GetGRpcTag());
}
- bool RequestDone(bool ok) {
+ bool RequestDone(bool ok) {
auto makeRequestString = [&] {
TString resp;
if (ok) {
@@ -323,8 +323,8 @@ private:
}
return true;
- }
-
+ }
+
bool FinishDone(bool ok) {
LOG_DEBUG(ActorSystem, NKikimrServices::GRPC_SERVER, "[%p] finished request Name# %s ok# %s peer# %s", this,
Name, ok ? "true" : "false", Context.peer().c_str());
@@ -340,21 +340,21 @@ private:
LOG_DEBUG(ActorSystem, NKikimrServices::GRPC_SERVER, "[%p] finished request without processing Name# %s ok# %s peer# %s", this,
Name, ok ? "true" : "false", Context.peer().c_str());
- return false;
- }
-
-private:
- using TStateFunc = bool (TSimpleRequest::*)(bool);
-
+ return false;
+ }
+
+private:
+ using TStateFunc = bool (TSimpleRequest::*)(bool);
+
TGRpcService* const Server;
TOnRequest Cb;
TRequestCallback RequestCallback;
TActorSystem& ActorSystem;
const char* const Name;
NGrpc::ICounterBlockPtr Counters;
-
+
THolder<ServerAsyncResponseWriter<TOut>> Writer;
-
+
TStateFunc StateFunc;
TIn Request;
ui32 RequestSize;
@@ -365,20 +365,20 @@ private:
TMaybe<NMsgBusProxy::TBusMessageContext> BusContext;
bool InProgress_;
bool RequestRegistered_ = false;
-};
-
-} // namespace
-
+};
+
+} // namespace
+
TGRpcService::TGRpcService()
: ActorSystem(nullptr)
{}
-
+
void TGRpcService::InitService(grpc::ServerCompletionQueue *cq, NGrpc::TLoggerPtr) {
CQ = cq;
Y_ASSERT(InitCb_);
InitCb_();
-}
-
+}
+
TFuture<void> TGRpcService::Prepare(TActorSystem* system, const TActorId& pqMeta, const TActorId& msgBusProxy,
TIntrusivePtr<NMonitoring::TDynamicCounters> counters) {
auto promise = NewPromise<void>();
@@ -388,7 +388,7 @@ TFuture<void> TGRpcService::Prepare(TActorSystem* system, const TActorId& pqMeta
PQMeta = pqMeta;
MsgBusProxy = msgBusProxy;
Counters = counters;
-
+
promise.SetValue();
} catch (...) {
promise.SetException(std::current_exception());
@@ -420,14 +420,14 @@ void TGRpcService::Start() {
ActorSystem->Send(MakeGRpcProxyStatusID(nodeId), new TEvGRpcProxyStatus::TEvSetup(true, PersQueueWriteSessionsMaxCount,
PersQueueReadSessionsMaxCount));
SetupIncomingRequests();
-}
-
+}
+
void TGRpcService::RegisterRequestActor(NActors::IActor* req) {
ActorSystem->Register(req, TMailboxType::HTSwap, ActorSystem->AppData<TAppData>()->UserPoolId);
}
void TGRpcService::SetupIncomingRequests() {
-
+
auto getCounterBlock = NGRpcService::CreateCounterCb(Counters, ActorSystem);
#define ADD_REQUEST(NAME, IN, OUT, ACTION) \
@@ -437,7 +437,7 @@ void TGRpcService::SetupIncomingRequests() {
ACTION; \
}, &NKikimrClient::TGRpcServer::AsyncService::Request ## NAME, \
*ActorSystem, #NAME, getCounterBlock("legacy", #NAME)))->Start();
-
+
#define ADD_ACTOR_REQUEST(NAME, TYPE, MTYPE) \
ADD_REQUEST(NAME, TYPE, TResponse, { \
NMsgBusProxy::TBusMessageContext msg(ctx->BindBusContext(NMsgBusProxy::MTYPE)); \
@@ -479,18 +479,18 @@ void TGRpcService::SetupIncomingRequests() {
RegisterRequestActor(CreateMessageBusCmsRequest(msg));
})
- // SQS request
- ADD_REQUEST(SqsRequest, TSqsRequest, TSqsResponse, {
- NMsgBusProxy::TBusMessageContext msg(ctx->BindBusContext(NMsgBusProxy::MTYPE_CLIENT_SQS_REQUEST));
+ // SQS request
+ ADD_REQUEST(SqsRequest, TSqsRequest, TSqsResponse, {
+ NMsgBusProxy::TBusMessageContext msg(ctx->BindBusContext(NMsgBusProxy::MTYPE_CLIENT_SQS_REQUEST));
RegisterRequestActor(CreateMessageBusSqsRequest(msg));
- })
-
+ })
+
// S3 listing request
ADD_REQUEST(S3Listing, TS3ListingRequest, TS3ListingResponse, {
NMsgBusProxy::TBusMessageContext msg(ctx->BindBusContext(NMsgBusProxy::MTYPE_CLIENT_S3_LISTING_REQUEST));
RegisterRequestActor(CreateMessageBusS3ListingRequest(msg));
})
-
+
// Console request
ADD_REQUEST(ConsoleRequest, TConsoleRequest, TConsoleResponse, {
NMsgBusProxy::TBusMessageContext msg(ctx->BindBusContext(NMsgBusProxy::MTYPE_CLIENT_CONSOLE_REQUEST));
@@ -525,7 +525,7 @@ void TGRpcService::SetupIncomingRequests() {
ADD_PROXY_REQUEST_JJ(DbSchema, TEvBusProxy::TEvDbSchema, MTYPE_CLIENT_DB_SCHEMA)
ADD_PROXY_REQUEST_JJ(DbOperation, TEvBusProxy::TEvDbOperation, MTYPE_CLIENT_DB_OPERATION)
ADD_PROXY_REQUEST_JJ(DbBatch, TEvBusProxy::TEvDbBatch, MTYPE_CLIENT_DB_BATCH)
-}
-
-}
-}
+}
+
+}
+}
diff --git a/ydb/core/client/server/grpc_server.h b/ydb/core/client/server/grpc_server.h
index 2f2ae1da6b..b8a218b239 100644
--- a/ydb/core/client/server/grpc_server.h
+++ b/ydb/core/client/server/grpc_server.h
@@ -1,42 +1,42 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/protos/grpc.grpc.pb.h>
-
+
#include <library/cpp/actors/core/actorsystem.h>
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/grpc/server/grpc_server.h>
#include <ydb/public/lib/deprecated/client/grpc_client.h>
#include <ydb/public/lib/base/defs.h>
#include <ydb/public/lib/base/msgbus.h>
-
+
#include <util/thread/factory.h>
#include <util/generic/queue.h>
-
-namespace NKikimr {
+
+namespace NKikimr {
namespace NMsgBusProxy {
class TBusMessageContext;
} // NMsgBusProxy
-namespace NGRpcProxy {
-
-//! State of current request. It allows to:
-//! - retrieve request's message;
-//! - send reply to caller.
-class IRequestContext {
-public:
- virtual ~IRequestContext() = default;
-
- //! Get pointer to the request's message.
- virtual const NProtoBuf::Message* GetRequest() const = 0;
-
- //! Send reply.
+namespace NGRpcProxy {
+
+//! State of current request. It allows to:
+//! - retrieve request's message;
+//! - send reply to caller.
+class IRequestContext {
+public:
+ virtual ~IRequestContext() = default;
+
+ //! Get pointer to the request's message.
+ virtual const NProtoBuf::Message* GetRequest() const = 0;
+
+ //! Send reply.
virtual void Reply(const NKikimrClient::TResponse& resp) = 0;
virtual void Reply(const NKikimrClient::TBsTestLoadResponse& resp) = 0;
virtual void Reply(const NKikimrClient::TJSON& resp) = 0;
virtual void Reply(const NKikimrClient::TNodeRegistrationResponse& resp) = 0;
virtual void Reply(const NKikimrClient::TCmsResponse& resp) = 0;
- virtual void Reply(const NKikimrClient::TSqsResponse& resp) = 0;
+ virtual void Reply(const NKikimrClient::TSqsResponse& resp) = 0;
virtual void Reply(const NKikimrClient::TS3ListingResponse& resp) = 0;
virtual void Reply(const NKikimrClient::TConsoleResponse& resp) = 0;
@@ -48,18 +48,18 @@ public:
//! Returns peer address
virtual TString GetPeer() const = 0;
-};
-
-//! Implements interaction Kikimr via gRPC protocol.
+};
+
+//! Implements interaction Kikimr via gRPC protocol.
class TGRpcService
: public NGrpc::TGrpcServiceBase<NKikimrClient::TGRpcServer>
-{
-public:
+{
+public:
TGRpcService();
-
+
void InitService(grpc::ServerCompletionQueue* cq, NGrpc::TLoggerPtr logger) override;
void SetGlobalLimiterHandle(NGrpc::TGlobalLimiter* limiter) override;
-
+
NThreading::TFuture<void> Prepare(NActors::TActorSystem* system, const NActors::TActorId& pqMeta, const NActors::TActorId& msgBusProxy, TIntrusivePtr<NMonitoring::TDynamicCounters> counters);
void Start();
@@ -67,32 +67,32 @@ public:
void DecRequest();
i64 GetCurrentInFlight() const;
-private:
+private:
void RegisterRequestActor(NActors::IActor* req);
//! Setup handlers for incoming requests.
void SetupIncomingRequests();
-
-private:
+
+private:
using IThreadRef = TAutoPtr<IThreadFactory::IThread>;
-
+
NActors::TActorSystem* ActorSystem;
NActors::TActorId PQMeta;
NActors::TActorId MsgBusProxy;
-
+
grpc::ServerCompletionQueue* CQ = nullptr;
-
+
size_t PersQueueWriteSessionsMaxCount = 1000000;
size_t PersQueueReadSessionsMaxCount = 100000;
-
+
TIntrusivePtr<NMonitoring::TDynamicCounters> Counters;
std::function<void()> InitCb_;
// In flight request management.
NGrpc::TGlobalLimiter* Limiter_ = nullptr;
-};
-
-}
-}
+};
+
+}
+}
diff --git a/ydb/core/client/server/msgbus_server.cpp b/ydb/core/client/server/msgbus_server.cpp
index 8a4d8a3bbd..4a312a6d1c 100644
--- a/ydb/core/client/server/msgbus_server.cpp
+++ b/ydb/core/client/server/msgbus_server.cpp
@@ -122,7 +122,7 @@ public:
MTYPE(TBusNodeRegistrationRequest)
MTYPE(TBusCmsRequest)
MTYPE(TBusChooseProxy)
- MTYPE(TBusSqsRequest)
+ MTYPE(TBusSqsRequest)
MTYPE(TBusWhoAmI)
MTYPE(TBusStreamRequest)
MTYPE(TBusS3ListingRequest)
@@ -174,7 +174,7 @@ public:
REPLY_OPTION(TBusBsTestLoadResponse)
REPLY_OPTION(TBusNodeRegistrationResponse)
REPLY_OPTION(TBusCmsResponse)
- REPLY_OPTION(TBusSqsResponse)
+ REPLY_OPTION(TBusSqsResponse)
REPLY_OPTION(TBusS3ListingResponse)
REPLY_OPTION(TBusConsoleResponse)
diff --git a/ydb/core/client/server/msgbus_server.h b/ydb/core/client/server/msgbus_server.h
index 3d40fc9001..fd1c2abcf8 100644
--- a/ydb/core/client/server/msgbus_server.h
+++ b/ydb/core/client/server/msgbus_server.h
@@ -303,7 +303,7 @@ IActor* CreateMessageBusFillNode(TBusMessageContext &msg);
IActor* CreateMessageBusResolveNode(TBusMessageContext &msg);
IActor* CreateMessageBusRegisterNode(TBusMessageContext &msg);
IActor* CreateMessageBusCmsRequest(TBusMessageContext &msg);
-IActor* CreateMessageBusSqsRequest(TBusMessageContext &msg);
+IActor* CreateMessageBusSqsRequest(TBusMessageContext &msg);
IActor* CreateMessageBusWhoAmI(TBusMessageContext &msg);
IActor* CreateMessageBusS3ListingRequest(TBusMessageContext& msg);
IActor* CreateMessageBusInterconnectDebug(TBusMessageContext& msg);
diff --git a/ydb/core/client/server/msgbus_server_persqueue.cpp b/ydb/core/client/server/msgbus_server_persqueue.cpp
index 78b83ef3a3..267edfdf0d 100644
--- a/ydb/core/client/server/msgbus_server_persqueue.cpp
+++ b/ydb/core/client/server/msgbus_server_persqueue.cpp
@@ -506,10 +506,10 @@ public:
return;
}
if (meta.HasCmdGetPartitionLocations()) {
- if (!GetTopicsList(meta.GetCmdGetPartitionLocations().topicrequest()))
+ if (!GetTopicsList(meta.GetCmdGetPartitionLocations().topicrequest()))
return;
} else if (meta.HasCmdGetPartitionOffsets()) {
- if (!GetTopicsList(meta.GetCmdGetPartitionOffsets().topicrequest()))
+ if (!GetTopicsList(meta.GetCmdGetPartitionOffsets().topicrequest()))
return;
} else if (meta.HasCmdGetTopicMetadata()) {
auto& d = meta.GetCmdGetTopicMetadata();
@@ -521,7 +521,7 @@ public:
TopicInfo[d.GetTopic(i)];
}
} else if (meta.HasCmdGetPartitionStatus()) {
- if (!GetTopicsList(meta.GetCmdGetPartitionStatus().topicrequest()))
+ if (!GetTopicsList(meta.GetCmdGetPartitionStatus().topicrequest()))
return;
} else if (meta.HasCmdGetReadSessionsInfo()) {
auto& d = meta.GetCmdGetReadSessionsInfo();
@@ -580,15 +580,15 @@ public:
auto& meta = RequestProto.GetMetaRequest();
THashMap<ui32, TString> hostName(NodesInfo->Nodes.size());
- for (const auto& n : NodesInfo->Nodes)
- hostName.insert(std::make_pair(n.NodeId, n.Host));
+ for (const auto& n : NodesInfo->Nodes)
+ hostName.insert(std::make_pair(n.NodeId, n.Host));
NKikimrClient::TResponse record;
record.SetStatus(MSTATUS_OK);
record.SetErrorCode(NPersQueue::NErrorCode::OK);
auto res = record.MutableMetaResponse()->MutableCmdGetPartitionLocationsResult();
- for (const auto& p : TopicInfo) {
+ for (const auto& p : TopicInfo) {
auto topicResult = res->AddTopicResult();
topicResult->SetTopic(p.first);
if (p.second.PartitionToTablet.empty()) {
@@ -596,7 +596,7 @@ public:
} else {
topicResult->SetErrorCode(NPersQueue::NErrorCode::OK);
}
- for (const auto& pp : p.second.PartitionToTablet) {
+ for (const auto& pp : p.second.PartitionToTablet) {
auto it = TabletInfo.find(pp.second);
Y_VERIFY(it != TabletInfo.end());
auto ht = hostName.find(it->second.NodeId);
@@ -629,7 +629,7 @@ public:
record.SetErrorCode(NPersQueue::NErrorCode::OK);
auto res = record.MutableMetaResponse()->MutableCmdGetTopicMetadataResult();
for (const auto& ti : TopicInfo) {
- auto topicInfo = res->AddTopicInfo();
+ auto topicInfo = res->AddTopicInfo();
topicInfo->SetTopic(ti.first);
topicInfo->MutableConfig()->CopyFrom(ti.second.Config);
topicInfo->SetNumPartitions(ti.second.NumParts);
@@ -658,7 +658,7 @@ public:
} else {
topicResult->SetErrorCode(NPersQueue::NErrorCode::OK);
}
- for (const auto& tablet: p.second.Tablets) {
+ for (const auto& tablet: p.second.Tablets) {
auto it = TabletInfo.find(tablet);
Y_VERIFY(it != TabletInfo.end());
for (const auto& r : it->second.OffsetResponses) {
@@ -669,7 +669,7 @@ public:
res->CopyFrom(r);
}
}
- for (const auto& part : p.second.PartitionToTablet) {
+ for (const auto& part : p.second.PartitionToTablet) {
auto res = topicResult->AddPartitionResult();
res->SetPartition(part.first);
res->SetErrorCode(NPersQueue::NErrorCode::INITIALIZING);
@@ -695,7 +695,7 @@ public:
topicResult->SetErrorCode(NPersQueue::NErrorCode::OK);
}
- for (const auto& tablet: p.second.Tablets) {
+ for (const auto& tablet: p.second.Tablets) {
auto it = TabletInfo.find(tablet);
Y_VERIFY(it != TabletInfo.end());
for (const auto& r : it->second.StatusResponses) {
@@ -706,7 +706,7 @@ public:
res->CopyFrom(r);
}
}
- for (const auto& part : p.second.PartitionToTablet) {
+ for (const auto& part : p.second.PartitionToTablet) {
auto res = topicResult->AddPartitionResult();
res->SetPartition(part.first);
res->SetStatus(NKikimrPQ::TStatusResponse::STATUS_UNKNOWN);
@@ -783,7 +783,7 @@ public:
return false;
if (DescribeRequests)
return false;
- const auto& meta = RequestProto.GetMetaRequest();
+ const auto& meta = RequestProto.GetMetaRequest();
if (meta.HasCmdGetPartitionLocations()) {
if (TopicsAnswered != TopicInfo.size() || TabletInfo.size() != TabletsDiscovered.size() || !NodesInfo)
return false;
@@ -1082,7 +1082,7 @@ public:
if (CanProcessFetchRequest) {
ProceedFetchRequest(ctx);
} else {
- const auto& tabletInfo = TabletInfo[tabletId];
+ const auto& tabletInfo = TabletInfo[tabletId];
LOG_DEBUG_S(ctx, NKikimrServices::PERSQUEUE, "sending HasDataInfoResponse " << it->second.FetchInfo[part]->Record);
NTabletPipe::SendData(ctx, tabletInfo.PipeClient, it->second.FetchInfo[part].Release());
@@ -1194,7 +1194,7 @@ public:
}
CanProcessFetchRequest = true;
Y_VERIFY(IsFetchRequest);
- const auto& fetch = RequestProto.GetFetchRequest();
+ const auto& fetch = RequestProto.GetFetchRequest();
if (FetchRequestReadsDone == fetch.PartitionSize()) {
NKikimrClient::TResponse record;
@@ -1203,7 +1203,7 @@ public:
record.SetErrorCode(NPersQueue::NErrorCode::OK);
return SendReplyAndDie(std::move(record), ctx);
}
- const auto& clientId = fetch.GetClientId();
+ const auto& clientId = fetch.GetClientId();
Y_VERIFY(FetchRequestReadsDone < fetch.PartitionSize());
const auto& req = fetch.GetPartition(FetchRequestReadsDone);
const auto& topic = req.GetTopic();
@@ -1297,7 +1297,7 @@ public:
return rec;
}
-
+
void Bootstrap(const TActorContext& ctx) {
LOG_INFO_S(ctx, NKikimrServices::PERSQUEUE, "proxy got request " << RequestId << " IsMetaRequest " << IsMetaRequest << " IsFetchRequest " << IsFetchRequest);
@@ -1316,7 +1316,7 @@ public:
if (RequestProto.HasMetaRequest() && (RequestProto.GetMetaRequest().HasCmdGetPartitionLocations()
|| RequestProto.GetMetaRequest().HasCmdGetReadSessionsInfo())) {
- //only for this request NodeId-s and Nodes names are required
+ //only for this request NodeId-s and Nodes names are required
const TActorId nameserviceId = GetNameserviceActorId();
ctx.Send(nameserviceId, new TEvInterconnect::TEvListNodes());
}
@@ -1338,9 +1338,9 @@ public:
CFunc(NActors::TEvents::TSystem::PoisonPill, Die);
)
private:
- bool GetTopicsList(const ::google::protobuf::RepeatedPtrField<::NKikimrClient::TPersQueueMetaRequest::TTopicRequest>& requests) {
- for (auto ri = requests.begin(); ri != requests.end(); ++ri) {
- const auto& topicRequest = *ri;
+ bool GetTopicsList(const ::google::protobuf::RepeatedPtrField<::NKikimrClient::TPersQueueMetaRequest::TTopicRequest>& requests) {
+ for (auto ri = requests.begin(); ri != requests.end(); ++ri) {
+ const auto& topicRequest = *ri;
if (!topicRequest.HasTopic() || topicRequest.GetTopic().empty()) {
ErrorReason = "TopicRequest must have Topic field.";
return false;
diff --git a/ydb/core/client/server/msgbus_server_persqueue.h b/ydb/core/client/server/msgbus_server_persqueue.h
index 52c67832e4..659c779e8e 100644
--- a/ydb/core/client/server/msgbus_server_persqueue.h
+++ b/ydb/core/client/server/msgbus_server_persqueue.h
@@ -1,6 +1,6 @@
#pragma once
-
-#include "grpc_server.h"
+
+#include "grpc_server.h"
#include "msgbus_tabletreq.h"
#include <ydb/core/base/tablet_pipe.h>
diff --git a/ydb/core/client/server/msgbus_server_sqs.cpp b/ydb/core/client/server/msgbus_server_sqs.cpp
index 82981f571a..f324332895 100644
--- a/ydb/core/client/server/msgbus_server_sqs.cpp
+++ b/ydb/core/client/server/msgbus_server_sqs.cpp
@@ -1,38 +1,38 @@
-#include "msgbus_servicereq.h"
-
+#include "msgbus_servicereq.h"
+
#include <ydb/core/ymq/actor/actor.h>
-
-namespace NKikimr {
-namespace NMsgBusProxy {
-namespace {
-
-class TMessageBusCallback
- : public NSQS::IReplyCallback
- , public NMsgBusProxy::TMessageBusSessionIdentHolder
-{
-public:
- TMessageBusCallback(NMsgBusProxy::TBusMessageContext& msg)
- : TMessageBusSessionIdentHolder(msg)
- {
- }
-
+
+namespace NKikimr {
+namespace NMsgBusProxy {
+namespace {
+
+class TMessageBusCallback
+ : public NSQS::IReplyCallback
+ , public NMsgBusProxy::TMessageBusSessionIdentHolder
+{
+public:
+ TMessageBusCallback(NMsgBusProxy::TBusMessageContext& msg)
+ : TMessageBusSessionIdentHolder(msg)
+ {
+ }
+
void DoSendReply(const NKikimrClient::TSqsResponse& resp) override {
- auto response = MakeHolder<NMsgBusProxy::TBusSqsResponse>();
- response->Record.CopyFrom(resp);
- SendReplyMove(response.Release());
- }
-};
-
-} // namespace
-
-IActor* CreateMessageBusSqsRequest(NMsgBusProxy::TBusMessageContext& msg)
-{
+ auto response = MakeHolder<NMsgBusProxy::TBusSqsResponse>();
+ response->Record.CopyFrom(resp);
+ SendReplyMove(response.Release());
+ }
+};
+
+} // namespace
+
+IActor* CreateMessageBusSqsRequest(NMsgBusProxy::TBusMessageContext& msg)
+{
NKikimrClient::TSqsRequest record
- = static_cast<NMsgBusProxy::TBusSqsRequest*>(msg.GetMessage())->Record;
+ = static_cast<NMsgBusProxy::TBusSqsRequest*>(msg.GetMessage())->Record;
record.SetRequestId(CreateGuidAsString());
-
+
return CreateProxyActionActor(record, MakeHolder<TMessageBusCallback>(msg), true);
-}
-
-} // namespace NMsgBusProxy
-} // namespace NKikimr
+}
+
+} // namespace NMsgBusProxy
+} // namespace NKikimr
diff --git a/ydb/core/client/server/ya.make b/ydb/core/client/server/ya.make
index 8cbeec21b7..c014629da1 100644
--- a/ydb/core/client/server/ya.make
+++ b/ydb/core/client/server/ya.make
@@ -46,7 +46,7 @@ SRCS(
msgbus_server_s3_listing.cpp
msgbus_server_scheme_initroot.cpp
msgbus_server_scheme_request.cpp
- msgbus_server_sqs.cpp
+ msgbus_server_sqs.cpp
msgbus_server_tablet_counters.cpp
msgbus_server_tablet_kill.cpp
msgbus_server_tablet_state.cpp
@@ -58,7 +58,7 @@ SRCS(
msgbus_server_whoami.cpp
msgbus_servicereq.h
msgbus_tabletreq.h
- grpc_server.cpp
+ grpc_server.cpp
grpc_server.h
grpc_proxy_status.h
grpc_proxy_status.cpp
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 6766dd3171..e62a7447e5 100644
--- a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp
+++ b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp
@@ -67,7 +67,7 @@ protected:
TString NodeResolveHost;
TString NodeDomain;
ui32 InterconnectPort;
- ui32 SqsHttpPort;
+ ui32 SqsHttpPort;
TString NodeType;
TString DataCenter;
TString Rack;
@@ -114,7 +114,7 @@ protected:
NodeBrokerUseTls = false;
FixedNodeID = false;
InterconnectPort = 0;
- SqsHttpPort = 0;
+ SqsHttpPort = 0;
IgnoreCmsConfigs = false;
DataCenter = "";
Rack = "";
@@ -162,8 +162,8 @@ protected:
.RequiredArgument("NAME").StoreResult(&NodeDomain);
config.Opts->AddLongOption("ic-port", "interconnect port")
.RequiredArgument("NUM").StoreResult(&InterconnectPort);
- config.Opts->AddLongOption("sqs-port", "sqs port")
- .RequiredArgument("NUM").StoreResult(&SqsHttpPort);
+ config.Opts->AddLongOption("sqs-port", "sqs port")
+ .RequiredArgument("NUM").StoreResult(&SqsHttpPort);
config.Opts->AddLongOption("proxy", "Bind to proxy(-ies)").RequiredArgument("ADDR").AppendTo(&ProxyBindToProxy);
config.Opts->AddLongOption("host-label-override", "overrides host label for slot").RequiredArgument("NAME").StoreResult(&HostLabelOverride);
config.Opts->AddLongOption("tenant", "add binding for Local service to specified tenant, might be one of {'no', 'dynamic', '/<root>', '/<root>/<path_to_user>'}")
@@ -215,7 +215,7 @@ protected:
config.Opts->AddLongOption("auth-token-file", "authorization token configuration").OptionalArgument("PATH");
config.Opts->AddLongOption("key-file", "tanant encryption key configuration").OptionalArgument("PATH");
config.Opts->AddLongOption("pdisk-key-file", "pdisk encryption key configuration").OptionalArgument("PATH");
- config.Opts->AddLongOption("sqs-file", "SQS config file").OptionalArgument("PATH");
+ config.Opts->AddLongOption("sqs-file", "SQS config file").OptionalArgument("PATH");
config.Opts->AddLongOption("bootstrap-file", "Bootstrap config file").OptionalArgument("PATH");
config.Opts->AddLongOption("dyn-nodes-file", "Dynamic nodes config file").OptionalArgument("PATH");
config.Opts->AddLongOption("cms-file", "CMS config file").OptionalArgument("PATH");
@@ -524,7 +524,7 @@ protected:
AppConfig.MutableMonitoringConfig()->SetMonitoringPort(MonitoringPort);
if (MonitoringAddress)
AppConfig.MutableMonitoringConfig()->SetMonitoringAddress(MonitoringAddress);
- if (SqsHttpPort)
+ if (SqsHttpPort)
RunConfig.AppConfig.MutableSqsConfig()->MutableHttpServerConfig()->SetPort(SqsHttpPort);
if (GRpcPort) {
auto& conf = *AppConfig.MutableGRpcConfig();
diff --git a/ydb/core/driver_lib/run/config.h b/ydb/core/driver_lib/run/config.h
index faf1797413..cba2578c38 100644
--- a/ydb/core/driver_lib/run/config.h
+++ b/ydb/core/driver_lib/run/config.h
@@ -42,13 +42,13 @@ union TBasicKikimrServicesMask {
bool EnablePersQueueL2Cache:1;
bool EnableKqp:1;
bool EnableMemoryLog:1;
- bool EnableGRpcService:1;
+ bool EnableGRpcService:1;
bool EnableNodeIdentifier:1;
bool EnableCms:1;
bool EnableNodeTable:1;
bool EnableGRpcProxyStatus:1;
bool EnablePQ:1;
- bool EnableSqs:1;
+ bool EnableSqs:1;
bool EnableConfigsDispatcher:1;
bool EnableSecurityServices:1;
bool EnableTabletInfo:1;
diff --git a/ydb/core/driver_lib/run/config_parser.cpp b/ydb/core/driver_lib/run/config_parser.cpp
index bb68656291..57ae08b4cd 100644
--- a/ydb/core/driver_lib/run/config_parser.cpp
+++ b/ydb/core/driver_lib/run/config_parser.cpp
@@ -71,7 +71,7 @@ void TRunCommandConfigParser::SetupLastGetOptForConfigFiles(NLastGetopt::TOpts&
opts.AddLongOption("auth-file", "authorization config file").OptionalArgument("PATH");
opts.AddLongOption("auth-token-file", "authorization token config file").OptionalArgument("PATH");
opts.AddLongOption("key-file", "encryption key config file").OptionalArgument("PATH");
- opts.AddLongOption("sqs-file", "SQS config file").OptionalArgument("PATH");
+ opts.AddLongOption("sqs-file", "SQS config file").OptionalArgument("PATH");
opts.AddLongOption("alloc-file", "Allocator config file").OptionalArgument("PATH");
opts.AddLongOption("yql-file", "Yql Analytics config file").OptionalArgument("PATH");
opts.AddLongOption("yq-file", "Yandex Query config file").OptionalArgument("PATH");
@@ -137,10 +137,10 @@ void TRunCommandConfigParser::ParseConfigFiles(const NLastGetopt::TOptsParseResu
Y_VERIFY(ParsePBFromFile(res.Get("feature-flags-file"), Config.AppConfig.MutableFeatureFlags(), true));
}
- if (res.Has("sqs-file")) {
- Y_VERIFY(ParsePBFromFile(res.Get("sqs-file"), Config.AppConfig.MutableSqsConfig()));
- }
-
+ if (res.Has("sqs-file")) {
+ Y_VERIFY(ParsePBFromFile(res.Get("sqs-file"), Config.AppConfig.MutableSqsConfig()));
+ }
+
if (res.Has("grpc-port")) {
auto& conf = *Config.AppConfig.MutableGRpcConfig();
conf.SetStartGRpcProxy(true);
diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
index 819c1478d1..fa67b131f3 100644
--- a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
+++ b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
@@ -132,7 +132,7 @@
#include <ydb/public/lib/deprecated/client/msgbus_client.h>
#include <ydb/core/ymq/actor/serviceid.h>
-
+
#include <ydb/core/yq/libs/init/init.h>
#include <ydb/core/yq/libs/logs/log.h>
@@ -184,8 +184,8 @@
#include <util/generic/algorithm.h>
#include <util/generic/size_literals.h>
-#include <util/system/hostname.h>
-
+#include <util/system/hostname.h>
+
namespace NKikimr {
namespace NKikimrServicesInitializers {
@@ -2085,12 +2085,12 @@ void TLeaseHolderInitializer::InitializeServices(NActors::TActorSystemSetup* set
}
TSqsServiceInitializer::TSqsServiceInitializer(const TKikimrRunConfig& runConfig, const std::shared_ptr<TModuleFactories>& factories)
- : IKikimrServicesInitializer(runConfig)
+ : IKikimrServicesInitializer(runConfig)
, Factories(factories)
-{
-}
+{
+}
-void TSqsServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) {
+void TSqsServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) {
if (Config.GetSqsConfig().GetEnableSqs()) {
ui32 grpcPort = 0;
if (Config.HasGRpcConfig())
@@ -2112,8 +2112,8 @@ void TSqsServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setu
Factories->SqsAuthFactory->Initialize(
setup->LocalServices, *appData, Config.GetSqsConfig());
}
-}
-
+}
+
TConfigsDispatcherInitializer::TConfigsDispatcherInitializer(const TKikimrRunConfig& runConfig)
: IKikimrServicesInitializer(runConfig)
{
diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.h b/ydb/core/driver_lib/run/kikimr_services_initializers.h
index 407ce1bb7b..46bf14d068 100644
--- a/ydb/core/driver_lib/run/kikimr_services_initializers.h
+++ b/ydb/core/driver_lib/run/kikimr_services_initializers.h
@@ -411,16 +411,16 @@ public:
void InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) override;
};
-class TSqsServiceInitializer : public IKikimrServicesInitializer {
-public:
+class TSqsServiceInitializer : public IKikimrServicesInitializer {
+public:
TSqsServiceInitializer(const TKikimrRunConfig& runConfig, const std::shared_ptr<TModuleFactories>& factories);
-
- void InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) override;
+
+ void InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) override;
private:
std::shared_ptr<TModuleFactories> Factories;
-};
-
+};
+
class TConfigsDispatcherInitializer : public IKikimrServicesInitializer {
public:
TConfigsDispatcherInitializer(const TKikimrRunConfig& runConfig);
diff --git a/ydb/core/driver_lib/run/run.cpp b/ydb/core/driver_lib/run/run.cpp
index a4f74aa4e0..80309e8359 100644
--- a/ydb/core/driver_lib/run/run.cpp
+++ b/ydb/core/driver_lib/run/run.cpp
@@ -326,14 +326,14 @@ TKikimrRunner::TKikimrRunner(std::shared_ptr<TModuleFactories> factories)
TKikimrRunner::~TKikimrRunner() {
if (!!ActorSystem) {
- // Stop ActorSystem first, so no one actor can call any grpc stuff.
+ // Stop ActorSystem first, so no one actor can call any grpc stuff.
ActorSystem->Stop();
- // After that stop sending any requests to actors
- // by destroing grpc subsystem.
+ // After that stop sending any requests to actors
+ // by destroing grpc subsystem.
for (auto& serv : GRpcServers) {
serv.second.Destroy();
}
-
+
ActorSystem.Destroy();
}
}
@@ -481,8 +481,8 @@ void TKikimrRunner::InitializeKqpController(const TKikimrRunConfig& runConfig) {
KqpShutdownController->Initialize(ActorSystem.Get());
}
-void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) {
- const auto& appConfig = runConfig.AppConfig;
+void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) {
+ const auto& appConfig = runConfig.AppConfig;
auto fillFn = [&](const NKikimrConfig::TGRpcConfig& grpcConfig, NGrpc::TGRpcServer& server, NGrpc::TServerOptions& opts) {
const auto& services = grpcConfig.GetServices();
@@ -729,14 +729,14 @@ void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) {
}
};
- if (appConfig.HasGRpcConfig() && appConfig.GetGRpcConfig().GetStartGRpcProxy()) {
- const auto& grpcConfig = appConfig.GetGRpcConfig();
-
+ if (appConfig.HasGRpcConfig() && appConfig.GetGRpcConfig().GetStartGRpcProxy()) {
+ const auto& grpcConfig = appConfig.GetGRpcConfig();
+
EnabledGrpcService = true;
NGrpc::TServerOptions opts;
- opts.SetHost(grpcConfig.GetHost());
- opts.SetPort(grpcConfig.GetPort());
- opts.SetWorkerThreads(grpcConfig.GetWorkerThreads());
+ opts.SetHost(grpcConfig.GetHost());
+ opts.SetPort(grpcConfig.GetPort());
+ opts.SetWorkerThreads(grpcConfig.GetWorkerThreads());
opts.SetGRpcMemoryQuotaBytes(grpcConfig.GetGRpcMemoryQuotaBytes());
opts.SetMaxMessageSize(grpcConfig.HasMaxMessageSize() ? grpcConfig.GetMaxMessageSize() : DEFAULT_GRPC_MESSAGE_SIZE_LIMIT);
opts.SetMaxGlobalRequestInFlight(grpcConfig.GetMaxInFlight());
@@ -747,7 +747,7 @@ void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) {
appConfig.GetDomainsConfig().GetSecurityConfig().HasEnforceUserTokenRequirement()) {
opts.SetUseAuth(appConfig.GetDomainsConfig().GetSecurityConfig().GetEnforceUserTokenRequirement());
}
-
+
if (grpcConfig.HasKeepAliveEnable()) {
if (grpcConfig.GetKeepAliveEnable()) {
Y_VERIFY(grpcConfig.HasKeepAliveIdleTimeoutTriggerSec(), "KeepAliveIdleTimeoutTriggerSec not set");
@@ -818,9 +818,9 @@ void TKikimrRunner::InitializeGRpc(const TKikimrRunConfig& runConfig) {
fillFn(ex, *GRpcServers.back().second, xopts);
}
}
- }
-}
-
+ }
+}
+
void TKikimrRunner::InitializeAllocator(const TKikimrRunConfig& runConfig) {
const auto& cfg = runConfig.AppConfig;
const auto& allocConfig = cfg.GetAllocatorConfig();
@@ -1102,7 +1102,7 @@ void TKikimrRunner::InitializeActorSystem(
Monitoring->RegisterActorPage(nullptr, "grpc", "GRPC", false, ActorSystem.Get(), NGRpcService::GrpcMonServiceId());
}
}
-
+
if (servicesMask.EnableSqs && AppData->SqsConfig.GetEnableSqs()) {
if (AppData->SqsConfig.GetHttpServerConfig().GetPort()) {
@@ -1111,8 +1111,8 @@ void TKikimrRunner::InitializeActorSystem(
GetServiceCounters(AppData->Counters, "sqs"),
GetServiceCounters(AppData->Counters, "ymq_public"),
AppData->UserPoolId);
- }
- }
+ }
+ }
if (runConfig.AppConfig.HasGRpcConfig()) {
if (const ui32 grpcPort = runConfig.AppConfig.GetGRpcConfig().GetPort()) {
@@ -1276,10 +1276,10 @@ TIntrusivePtr<TServiceInitializersList> TKikimrRunner::CreateServiceInitializers
sil->AddServiceInitializer(new TCmsServiceInitializer(runConfig));
}
- if (serviceMask.EnableSqs) {
+ if (serviceMask.EnableSqs) {
sil->AddServiceInitializer(new TSqsServiceInitializer(runConfig, ModuleFactories));
- }
-
+ }
+
if (serviceMask.EnableConfigsDispatcher) {
sil->AddServiceInitializer(new TConfigsDispatcherInitializer(runConfig));
}
@@ -1453,10 +1453,10 @@ void TKikimrRunner::KikimrStop(bool graceful) {
PollerThreads->Stop();
}
- if (SqsHttp) {
- SqsHttp.Destroy();
- }
-
+ if (SqsHttp) {
+ SqsHttp.Destroy();
+ }
+
// stop processing grpc requests/response - we must stop feeding ActorSystem
for (auto& server : GRpcServers) {
if (server.second) {
@@ -1471,7 +1471,7 @@ void TKikimrRunner::KikimrStop(bool graceful) {
for (auto& server : GRpcServers) {
server.second.Destroy();
}
-
+
if (Bus) {
Bus->Stop();
Bus.Drop();
diff --git a/ydb/core/driver_lib/run/run.h b/ydb/core/driver_lib/run/run.h
index dfd93a24e7..0d05790e08 100644
--- a/ydb/core/driver_lib/run/run.h
+++ b/ydb/core/driver_lib/run/run.h
@@ -42,7 +42,7 @@ protected:
bool EnabledGrpcService = false;
bool GracefulShutdownSupported = false;
THolder<NSQS::TAsyncHttpServer> SqsHttp;
-
+
THolder<NYdb::TDriver> YdbDriver;
THolder<NKqp::TKqpShutdownController> KqpShutdownController;
@@ -58,7 +58,7 @@ protected:
TIntrusivePtr<NMonitoring::TBusNgMonPage> BusMonPage;
TVector<std::pair<TString, TAutoPtr<NGrpc::TGRpcServer>>> GRpcServers;
-
+
TIntrusivePtr<NActors::NLog::TSettings> LogSettings;
std::shared_ptr<TLogBackend> LogBackend;
TAutoPtr<TActorSystem> ActorSystem;
@@ -86,8 +86,8 @@ protected:
std::shared_ptr<TModuleFactories> factories = nullptr
);
- void InitializeGRpc(const TKikimrRunConfig& runConfig);
-
+ void InitializeGRpc(const TKikimrRunConfig& runConfig);
+
void InitializeKqpController(const TKikimrRunConfig& runConfig);
void InitializeGracefulShutdown(const TKikimrRunConfig& runConfig);
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index d64169d4fc..fde1c669c3 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -557,11 +557,11 @@ message TMemoryLogConfig {
optional uint64 LogGrainSize = 2;
}
-message TGRpcConfig {
+message TGRpcConfig {
optional bool StartGRpcProxy = 1 [default = true];
optional string Host = 2 [default = "[::]"];
- optional uint32 Port = 3;
- optional uint32 WorkerThreads = 4 [default = 2];
+ optional uint32 Port = 3;
+ optional uint32 WorkerThreads = 4 [default = 2];
optional uint64 GRpcMemoryQuotaBytes = 5 [default = 1073741824]; // 1 GB default; 0 == unlimited
optional uint64 MaxMessageSize = 6; // default = DEFAULT_GRPC_MESSAGE_SIZE_LIMIT
optional uint32 MaxInFlight = 7; // 0 == unlimited [default]
@@ -595,8 +595,8 @@ message TGRpcConfig {
optional uint32 KeepAliveProbeIntervalSec = 103 [default = 10]; // TCP_KEEPINTVL
repeated TGRpcConfig ExtEndpoints = 200; // run specific services on separate endpoints
-}
-
+}
+
message TDynamicNodeConfig {
optional string NodeBrokerAddress = 1; //DEPRECATED
optional string DomainName = 2; //DEPRECATED
@@ -678,16 +678,16 @@ message TFeatureFlags {
optional bool EnablePredicateExtractForScanQueries = 62 [default = true];
}
-message TSqsConfig {
+message TSqsConfig {
optional bool EnableSqs = 5;
- optional string Root = 1 [default = "/Root/SQS"];
+ optional string Root = 1 [default = "/Root/SQS"];
// optional uint32 HttpPort = 2 [default = 8771]; // moved to HttpServerConfig
// URL that must be specified as an entry point to SQS cluster.
// It must be used if SQS nodes are placed behind the balancer.
// If this field is not specified, every node uses its own
// fqdn here.
- optional string Endpoint = 3;
+ optional string Endpoint = 3;
optional THttpServerConfig HttpServerConfig = 4;
@@ -871,8 +871,8 @@ message TSqsConfig {
optional TYcSearchEventsConfig YcSearchEventsConfig = 66;
optional TYdbAuthConfig AuthConfig = 67;
-}
-
+}
+
message TConfigsDispatcherConfig {
}
@@ -1350,13 +1350,13 @@ message TAppConfig {
repeated string UDFsPaths = 16;
optional TKQPConfig KQPConfig = 17;
optional TMemoryLogConfig MemoryLogConfig = 19;
- optional TGRpcConfig GRpcConfig = 20;
+ optional TGRpcConfig GRpcConfig = 20;
optional TDynamicNameserviceConfig DynamicNameserviceConfig = 22;
//optional TLocalConfig LocalConfig = 23; DEPRECATED
optional TDynamicNodeConfig DynamicNodeConfig = 24;
optional NKikimrCms.TCmsConfig CmsConfig = 25;
optional TFeatureFlags FeatureFlags = 26;
- optional TSqsConfig SqsConfig = 27;
+ optional TSqsConfig SqsConfig = 27;
optional NKikimrPQ.TPQConfig PQConfig = 28;
optional NKikimrTenantPool.TTenantPoolConfig TenantPoolConfig = 29;
optional NKikimrProto.TAuthConfig AuthConfig = 30;
diff --git a/ydb/core/protos/flat_scheme_op.proto b/ydb/core/protos/flat_scheme_op.proto
index 33e598c1c2..769d710936 100644
--- a/ydb/core/protos/flat_scheme_op.proto
+++ b/ydb/core/protos/flat_scheme_op.proto
@@ -1412,17 +1412,17 @@ message TShardError {
optional string Explain = 2;
};
-message TBackupProgress {
- optional uint32 NotCompleteYet = 1;
- optional uint32 Total = 2;
+message TBackupProgress {
+ optional uint32 NotCompleteYet = 1;
+ optional uint32 Total = 2;
optional uint32 ErrorCount = 3;
optional uint64 StartTime = 4;
repeated TShardError Errors = 5;
optional TYTSettings YTSettings = 6;
optional uint64 DataTotalSize = 7;
optional uint64 TxId = 8;
-}
-
+}
+
message TLastBackupResult {
optional uint32 ErrorCount = 1;
optional uint64 CompleteTimeStamp = 2;
@@ -1440,7 +1440,7 @@ message TPathDescription {
optional TTableDescription Table = 3; // for table
repeated TTablePartition TablePartitions = 4; // for table
optional TPersQueueGroupDescription PersQueueGroup = 5; // for pq group
- optional TBackupProgress BackupProgress = 6;
+ optional TBackupProgress BackupProgress = 6;
repeated TLastBackupResult LastBackupResult = 7;
optional NKikimrTableStats.TTableStats TableStats = 8;
optional NKikimrTabletBase.TMetrics TabletMetrics = 9;
diff --git a/ydb/core/protos/grpc.proto b/ydb/core/protos/grpc.proto
index 797cc2de82..bd224aa053 100644
--- a/ydb/core/protos/grpc.proto
+++ b/ydb/core/protos/grpc.proto
@@ -71,11 +71,11 @@ service TGRpcServer {
rpc CmsRequest(TCmsRequest) returns (TCmsResponse);
/////////////////////////////////////////////////////////////////////////////////////////////////
- // SQS INTERFACE
- /////////////////////////////////////////////////////////////////////////////////////////////////
- rpc SqsRequest(TSqsRequest) returns (TSqsResponse);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
+ // SQS INTERFACE
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ rpc SqsRequest(TSqsRequest) returns (TSqsResponse);
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////
// S3 LISTING INTERFACE
/////////////////////////////////////////////////////////////////////////////////////////////////
rpc S3Listing(TS3ListingRequest) returns (TS3ListingResponse);
diff --git a/ydb/core/protos/msgbus.proto b/ydb/core/protos/msgbus.proto
index df7cda5980..010e311c38 100644
--- a/ydb/core/protos/msgbus.proto
+++ b/ydb/core/protos/msgbus.proto
@@ -588,26 +588,26 @@ message TCmsResponse {
}
optional NKikimrCms.TStatus Status = 100;
}
-
-message TSqsRequest {
- oneof Request {
- NKikimr.NSQS.TChangeMessageVisibilityRequest ChangeMessageVisibility = 1;
- NKikimr.NSQS.TCreateQueueRequest CreateQueue = 2;
- NKikimr.NSQS.TGetQueueAttributesRequest GetQueueAttributes = 3;
- NKikimr.NSQS.TDeleteMessageRequest DeleteMessage = 4;
- NKikimr.NSQS.TDeleteQueueRequest DeleteQueue = 5;
- NKikimr.NSQS.TListQueuesRequest ListQueues = 6;
- NKikimr.NSQS.TPurgeQueueRequest PurgeQueue = 7;
- NKikimr.NSQS.TReceiveMessageRequest ReceiveMessage = 8;
- NKikimr.NSQS.TSendMessageRequest SendMessage = 9;
- NKikimr.NSQS.TSetQueueAttributesRequest SetQueueAttributes = 10;
- NKikimr.NSQS.TGetQueueUrlRequest GetQueueUrl = 11;
- NKikimr.NSQS.TChangeMessageVisibilityBatchRequest ChangeMessageVisibilityBatch = 12;
- NKikimr.NSQS.TDeleteMessageBatchRequest DeleteMessageBatch = 13;
- NKikimr.NSQS.TSendMessageBatchRequest SendMessageBatch = 14;
- NKikimr.NSQS.TCreateUserRequest CreateUser = 15;
- NKikimr.NSQS.TDeleteUserRequest DeleteUser = 16;
- NKikimr.NSQS.TListUsersRequest ListUsers = 17;
+
+message TSqsRequest {
+ oneof Request {
+ NKikimr.NSQS.TChangeMessageVisibilityRequest ChangeMessageVisibility = 1;
+ NKikimr.NSQS.TCreateQueueRequest CreateQueue = 2;
+ NKikimr.NSQS.TGetQueueAttributesRequest GetQueueAttributes = 3;
+ NKikimr.NSQS.TDeleteMessageRequest DeleteMessage = 4;
+ NKikimr.NSQS.TDeleteQueueRequest DeleteQueue = 5;
+ NKikimr.NSQS.TListQueuesRequest ListQueues = 6;
+ NKikimr.NSQS.TPurgeQueueRequest PurgeQueue = 7;
+ NKikimr.NSQS.TReceiveMessageRequest ReceiveMessage = 8;
+ NKikimr.NSQS.TSendMessageRequest SendMessage = 9;
+ NKikimr.NSQS.TSetQueueAttributesRequest SetQueueAttributes = 10;
+ NKikimr.NSQS.TGetQueueUrlRequest GetQueueUrl = 11;
+ NKikimr.NSQS.TChangeMessageVisibilityBatchRequest ChangeMessageVisibilityBatch = 12;
+ NKikimr.NSQS.TDeleteMessageBatchRequest DeleteMessageBatch = 13;
+ NKikimr.NSQS.TSendMessageBatchRequest SendMessageBatch = 14;
+ NKikimr.NSQS.TCreateUserRequest CreateUser = 15;
+ NKikimr.NSQS.TDeleteUserRequest DeleteUser = 16;
+ NKikimr.NSQS.TListUsersRequest ListUsers = 17;
NKikimr.NSQS.TModifyPermissionsRequest ModifyPermissions = 18;
NKikimr.NSQS.TListPermissionsRequest ListPermissions = 19;
NKikimr.NSQS.TDeleteQueueBatchRequest DeleteQueueBatch = 20;
@@ -615,30 +615,30 @@ message TSqsRequest {
NKikimr.NSQS.TGetQueueAttributesBatchRequest GetQueueAttributesBatch = 22;
NKikimr.NSQS.TListDeadLetterSourceQueuesRequest ListDeadLetterSourceQueues = 23;
NKikimr.NSQS.TCountQueuesRequest CountQueues = 24;
- }
+ }
optional string RequestId = 30;
optional bool RequestRateLimit = 31 [default = true];
-}
-
-message TSqsResponse {
- oneof Response {
- NKikimr.NSQS.TChangeMessageVisibilityResponse ChangeMessageVisibility = 1;
- NKikimr.NSQS.TCreateQueueResponse CreateQueue = 2;
- NKikimr.NSQS.TGetQueueAttributesResponse GetQueueAttributes = 3;
- NKikimr.NSQS.TDeleteMessageResponse DeleteMessage = 4;
- NKikimr.NSQS.TDeleteQueueResponse DeleteQueue = 5;
- NKikimr.NSQS.TListQueuesResponse ListQueues = 6;
- NKikimr.NSQS.TPurgeQueueResponse PurgeQueue = 7;
- NKikimr.NSQS.TReceiveMessageResponse ReceiveMessage = 8;
- NKikimr.NSQS.TSendMessageResponse SendMessage = 9;
- NKikimr.NSQS.TSetQueueAttributesResponse SetQueueAttributes = 10;
- NKikimr.NSQS.TGetQueueUrlResponse GetQueueUrl = 11;
- NKikimr.NSQS.TChangeMessageVisibilityBatchResponse ChangeMessageVisibilityBatch = 12;
- NKikimr.NSQS.TDeleteMessageBatchResponse DeleteMessageBatch = 13;
- NKikimr.NSQS.TSendMessageBatchResponse SendMessageBatch = 14;
- NKikimr.NSQS.TCreateUserResponse CreateUser = 15;
- NKikimr.NSQS.TDeleteUserResponse DeleteUser = 16;
- NKikimr.NSQS.TListUsersResponse ListUsers = 17;
+}
+
+message TSqsResponse {
+ oneof Response {
+ NKikimr.NSQS.TChangeMessageVisibilityResponse ChangeMessageVisibility = 1;
+ NKikimr.NSQS.TCreateQueueResponse CreateQueue = 2;
+ NKikimr.NSQS.TGetQueueAttributesResponse GetQueueAttributes = 3;
+ NKikimr.NSQS.TDeleteMessageResponse DeleteMessage = 4;
+ NKikimr.NSQS.TDeleteQueueResponse DeleteQueue = 5;
+ NKikimr.NSQS.TListQueuesResponse ListQueues = 6;
+ NKikimr.NSQS.TPurgeQueueResponse PurgeQueue = 7;
+ NKikimr.NSQS.TReceiveMessageResponse ReceiveMessage = 8;
+ NKikimr.NSQS.TSendMessageResponse SendMessage = 9;
+ NKikimr.NSQS.TSetQueueAttributesResponse SetQueueAttributes = 10;
+ NKikimr.NSQS.TGetQueueUrlResponse GetQueueUrl = 11;
+ NKikimr.NSQS.TChangeMessageVisibilityBatchResponse ChangeMessageVisibilityBatch = 12;
+ NKikimr.NSQS.TDeleteMessageBatchResponse DeleteMessageBatch = 13;
+ NKikimr.NSQS.TSendMessageBatchResponse SendMessageBatch = 14;
+ NKikimr.NSQS.TCreateUserResponse CreateUser = 15;
+ NKikimr.NSQS.TDeleteUserResponse DeleteUser = 16;
+ NKikimr.NSQS.TListUsersResponse ListUsers = 17;
NKikimr.NSQS.TModifyPermissionsResponse ModifyPermissions = 18;
NKikimr.NSQS.TListPermissionsResponse ListPermissions = 19;
NKikimr.NSQS.TDeleteQueueBatchResponse DeleteQueueBatch = 20;
@@ -646,12 +646,12 @@ message TSqsResponse {
NKikimr.NSQS.TGetQueueAttributesBatchResponse GetQueueAttributesBatch = 22;
NKikimr.NSQS.TListDeadLetterSourceQueuesResponse ListDeadLetterSourceQueues = 23;
NKikimr.NSQS.TCountQueuesResponse CountQueues = 24;
- }
+ }
optional string RequestId = 30;
optional string FolderId = 31;
optional string ResourceId = 32;
optional bool IsFifo = 33;
-}
+}
message TS3ListingRequest {
optional string SecurityToken = 1;
diff --git a/ydb/core/protos/services.proto b/ydb/core/protos/services.proto
index c17c8a7dc3..6df5a61443 100644
--- a/ydb/core/protos/services.proto
+++ b/ydb/core/protos/services.proto
@@ -177,13 +177,13 @@ enum EServiceKikimr {
GRPC_CLIENT = 461;
- // SQS section
- SQS = 470;
-
+ // SQS section
+ SQS = 470;
+
BOARD_REPLICA = 480;
BOARD_LOOKUP = 481;
BOARD_PUBLISH = 482;
-
+
QUOTER_SERVICE = 490;
QUOTER_PROXY = 491;
diff --git a/ydb/core/protos/sqs.proto b/ydb/core/protos/sqs.proto
index eae557a624..f1bf00838d 100644
--- a/ydb/core/protos/sqs.proto
+++ b/ydb/core/protos/sqs.proto
@@ -1,9 +1,9 @@
-package NKikimr.NSQS;
-
-message TAuthentification {
- optional string UserName = 1;
-}
-
+package NKikimr.NSQS;
+
+message TAuthentification {
+ optional string UserName = 1;
+}
+
message TCredentials {
oneof AccessKey {
string OAuthToken = 1;
@@ -12,157 +12,157 @@ message TCredentials {
}
}
-message TError {
- message TDebug {
- optional uint32 TransactionStatusCode = 1;
- optional bytes MiniKQLErrors = 2;
- optional bytes DataShardErrors = 3;
- }
-
- optional uint32 Status = 1;
- optional string Message = 2;
+message TError {
+ message TDebug {
+ optional uint32 TransactionStatusCode = 1;
+ optional bytes MiniKQLErrors = 2;
+ optional bytes DataShardErrors = 3;
+ }
+
+ optional uint32 Status = 1;
+ optional string Message = 2;
optional string ErrorCode = 4; // https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList - list of error codes
- optional TDebug Debug = 3;
-}
-
-message TAttribute {
- optional string Name = 1;
- optional bytes Value = 2;
-}
-
-message TMessageAttribute {
- optional string Name = 1;
- optional string DataType = 2;
- optional string StringValue = 3;
- optional bytes BinaryValue = 4;
-}
-
-message TChangeMessageVisibilityRequest {
+ optional TDebug Debug = 3;
+}
+
+message TAttribute {
+ optional string Name = 1;
+ optional bytes Value = 2;
+}
+
+message TMessageAttribute {
+ optional string Name = 1;
+ optional string DataType = 2;
+ optional string StringValue = 3;
+ optional bytes BinaryValue = 4;
+}
+
+message TChangeMessageVisibilityRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// Name of queue.
- optional string QueueName = 2;
- /// The receipt handle associated with the message
- /// whose visibility timeout is changed.
- optional bytes ReceiptHandle = 3;
- /// The new value for the message's visibility timeout (in seconds).
- optional uint32 VisibilityTimeout = 4;
- /// Batch Id. Available only in case of batch request.
- optional string Id = 5;
-}
-
-message TChangeMessageVisibilityResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- /// Batch Id. Available only in case of batch response.
- optional string Id = 3;
-}
-
-message TChangeMessageVisibilityBatchRequest {
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// Name of queue.
+ optional string QueueName = 2;
+ /// The receipt handle associated with the message
+ /// whose visibility timeout is changed.
+ optional bytes ReceiptHandle = 3;
+ /// The new value for the message's visibility timeout (in seconds).
+ optional uint32 VisibilityTimeout = 4;
+ /// Batch Id. Available only in case of batch request.
+ optional string Id = 5;
+}
+
+message TChangeMessageVisibilityResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ /// Batch Id. Available only in case of batch response.
+ optional string Id = 3;
+}
+
+message TChangeMessageVisibilityBatchRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// Name of queue.
- optional string QueueName = 2;
- repeated TChangeMessageVisibilityRequest Entries = 3;
-}
-
-message TChangeMessageVisibilityBatchResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- repeated TChangeMessageVisibilityResponse Entries = 3;
-}
-
-message TCreateQueueRequest {
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// Name of queue.
+ optional string QueueName = 2;
+ repeated TChangeMessageVisibilityRequest Entries = 3;
+}
+
+message TChangeMessageVisibilityBatchResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ repeated TChangeMessageVisibilityResponse Entries = 3;
+}
+
+message TCreateQueueRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// Name of queue. Should be unique for specified user.
- optional string QueueName = 2;
- /// Queue's attributes.
- repeated TAttribute Attributes = 3;
- /// Number of shards of messages tables.
- optional uint64 Shards = 4 [default = 4];
- /// Number of partitions of data table.
- optional uint64 Partitions = 5 [default = 8];
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// Name of queue. Should be unique for specified user.
+ optional string QueueName = 2;
+ /// Queue's attributes.
+ repeated TAttribute Attributes = 3;
+ /// Number of shards of messages tables.
+ optional uint64 Shards = 4 [default = 4];
+ /// Number of partitions of data table.
+ optional uint64 Partitions = 5 [default = 8];
/// Autosplit partitions with data
optional bool EnableAutosplit = 8;
/// Size in bytes when partition will be splitted on two parts.
optional uint64 SizeToSplit = 9 [default = 1073741824]; // 1GB
/// Enable internal tables' transactions out of order execution.
optional bool EnableOutOfOrderTransactionsExecution = 6 [default = true];
-}
-
-message TCreateQueueResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- optional string QueueName = 3;
- optional string QueueUrl = 4;
-}
-
-message TCreateUserRequest {
+}
+
+message TCreateQueueResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ optional string QueueName = 3;
+ optional string QueueUrl = 4;
+}
+
+message TCreateUserRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// Then user name we want to create.
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// Then user name we want to create.
optional string UserName = 2;
-}
-
-message TCreateUserResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
-}
-
-message TGetQueueAttributesRequest {
+}
+
+message TCreateUserResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+}
+
+message TGetQueueAttributesRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- optional string QueueName = 2;
- /// List of attribute's names to return.
- repeated string Names = 3;
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ optional string QueueName = 2;
+ /// List of attribute's names to return.
+ repeated string Names = 3;
/// Batch Id. Available only in case of batch request.
optional string Id = 4;
-}
-
-message TGetQueueAttributesResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
+}
+
+message TGetQueueAttributesResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
/// Batch Id. Available only in case of batch request.
optional string Id = 15;
- /// The approximate number of visible messages in a queue.
- optional uint64 ApproximateNumberOfMessages = 3;
- /// The approximate number of messages that are waiting
- /// to be added to the queue.
- optional uint64 ApproximateNumberOfMessagesDelayed = 4;
- /// The approximate number of messages that have not timed-out
- /// and aren't deleted.
- optional uint64 ApproximateNumberOfMessagesNotVisible = 5;
- /// The time when the queue was created in seconds (epoch time).
- optional uint64 CreatedTimestamp = 6;
- /// The default delay on the queue in seconds.
- optional uint64 DelaySeconds = 7;
- /// The time when the queue was last changed in seconds (epoch time).
- optional uint64 LastModifiedTimestamp = 8;
- /// The limit of how many bytes a message can contain before SQS rejects it.
- optional uint64 MaximumMessageSize = 9;
- /// The length of time, in seconds, for which SQS retains a message.
- optional uint64 MessageRetentionPeriod = 10;
- /// The length of time, in seconds, for which
- /// the ReceiveMessage action waits for a message to arrive.
- optional uint64 ReceiveMessageWaitTimeSeconds = 11;
- /// The visibility timeout for the queue.
- optional uint64 VisibilityTimeout = 12;
- /// Is the queue is FIFO.
- optional bool FifoQueue = 13;
- /// Is the content-based deduplication is enabled.
- optional bool ContentBasedDeduplication = 14;
+ /// The approximate number of visible messages in a queue.
+ optional uint64 ApproximateNumberOfMessages = 3;
+ /// The approximate number of messages that are waiting
+ /// to be added to the queue.
+ optional uint64 ApproximateNumberOfMessagesDelayed = 4;
+ /// The approximate number of messages that have not timed-out
+ /// and aren't deleted.
+ optional uint64 ApproximateNumberOfMessagesNotVisible = 5;
+ /// The time when the queue was created in seconds (epoch time).
+ optional uint64 CreatedTimestamp = 6;
+ /// The default delay on the queue in seconds.
+ optional uint64 DelaySeconds = 7;
+ /// The time when the queue was last changed in seconds (epoch time).
+ optional uint64 LastModifiedTimestamp = 8;
+ /// The limit of how many bytes a message can contain before SQS rejects it.
+ optional uint64 MaximumMessageSize = 9;
+ /// The length of time, in seconds, for which SQS retains a message.
+ optional uint64 MessageRetentionPeriod = 10;
+ /// The length of time, in seconds, for which
+ /// the ReceiveMessage action waits for a message to arrive.
+ optional uint64 ReceiveMessageWaitTimeSeconds = 11;
+ /// The visibility timeout for the queue.
+ optional uint64 VisibilityTimeout = 12;
+ /// Is the queue is FIFO.
+ optional bool FifoQueue = 13;
+ /// Is the content-based deduplication is enabled.
+ optional bool ContentBasedDeduplication = 14;
/// Contains maxReceiveCount and target DLQ ARN, defines DLQ params
optional string RedrivePolicy = 16;
/// Contains queue ARN
optional string QueueArn = 17;
-}
-
+}
+
message TGetQueueAttributesBatchRequest {
optional TCredentials Credentials = 100;
/// Sender's authentification.
@@ -178,67 +178,67 @@ message TGetQueueAttributesBatchResponse {
repeated TGetQueueAttributesResponse Entries = 3;
}
-message TGetQueueUrlRequest {
+message TGetQueueUrlRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// The name of the queue whose URL must be fetched.
- optional string QueueName = 2;
-}
-
-message TGetQueueUrlResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- optional string QueueUrl = 3;
-}
-
-message TDeleteMessageRequest {
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// The name of the queue whose URL must be fetched.
+ optional string QueueName = 2;
+}
+
+message TGetQueueUrlResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ optional string QueueUrl = 3;
+}
+
+message TDeleteMessageRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- optional string QueueName = 2;
- optional bytes ReceiptHandle = 3;
- /// Batch Id. Available only in case of batch request.
- optional string Id = 4;
-}
-
-message TDeleteMessageResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- /// Batch Id. Available only in case of batch response.
- optional string Id = 3;
-}
-
-message TDeleteMessageBatchRequest {
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ optional string QueueName = 2;
+ optional bytes ReceiptHandle = 3;
+ /// Batch Id. Available only in case of batch request.
+ optional string Id = 4;
+}
+
+message TDeleteMessageResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ /// Batch Id. Available only in case of batch response.
+ optional string Id = 3;
+}
+
+message TDeleteMessageBatchRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- optional string QueueName = 2;
- repeated TDeleteMessageRequest Entries = 3;
-}
-
-message TDeleteMessageBatchResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- repeated TDeleteMessageResponse Entries = 3;
-}
-
-message TDeleteQueueRequest {
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ optional string QueueName = 2;
+ repeated TDeleteMessageRequest Entries = 3;
+}
+
+message TDeleteMessageBatchResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ repeated TDeleteMessageResponse Entries = 3;
+}
+
+message TDeleteQueueRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- optional string QueueName = 2;
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ optional string QueueName = 2;
/// Batch Id. Available only in case of batch response.
optional string Id = 3;
-}
-
-message TDeleteQueueResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
+}
+
+message TDeleteQueueResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
/// Batch Id. Available only in case of batch response.
optional string Id = 3;
-}
-
+}
+
message TDeleteQueueBatchRequest {
optional TCredentials Credentials = 100;
/// Sender's authentification.
@@ -252,71 +252,71 @@ message TDeleteQueueBatchResponse {
repeated TDeleteQueueResponse Entries = 3;
}
-message TDeleteUserRequest {
+message TDeleteUserRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// Then user name we want to delete.
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// Then user name we want to delete.
optional string UserName = 2;
-}
-
-message TDeleteUserResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
-}
-
-message TListQueuesRequest {
+}
+
+message TDeleteUserResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+}
+
+message TListQueuesRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// A string to use for filtering the list results.
- // Only those queues whose name begins
- // with the specified string are returned.
- optional string QueueNamePrefix = 2;
-}
-
-message TListQueuesResponse {
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// A string to use for filtering the list results.
+ // Only those queues whose name begins
+ // with the specified string are returned.
+ optional string QueueNamePrefix = 2;
+}
+
+message TListQueuesResponse {
message TQueueType {
- optional string QueueName = 1;
- optional string QueueUrl = 2;
- }
- optional TError Error = 1;
- optional string RequestId = 2;
+ optional string QueueName = 1;
+ optional string QueueUrl = 2;
+ }
+ optional TError Error = 1;
+ optional string RequestId = 2;
repeated TQueueType Queues = 3;
-}
-
-message TListUsersRequest {
+}
+
+message TListUsersRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// A string to use for filtering the list results.
- // Only those users whose name begins
- // with the specified string are returned.
- optional string UserNamePrefix = 2;
-}
-
-message TListUsersResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- repeated string UserNames = 3;
-}
-
-message TPurgeQueueRequest {
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// A string to use for filtering the list results.
+ // Only those users whose name begins
+ // with the specified string are returned.
+ optional string UserNamePrefix = 2;
+}
+
+message TListUsersResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ repeated string UserNames = 3;
+}
+
+message TPurgeQueueRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- optional string QueueName = 2;
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ optional string QueueName = 2;
/// Batch Id. Available only in case of batch response.
optional string Id = 3;
-}
-
-message TPurgeQueueResponse {
- optional TError Error = 1;
- optional string RequestId = 3;
+}
+
+message TPurgeQueueResponse {
+ optional TError Error = 1;
+ optional string RequestId = 3;
/// Batch Id. Available only in case of batch response.
optional string Id = 4;
-}
-
+}
+
message TPurgeQueueBatchRequest {
optional TCredentials Credentials = 100;
/// Sender's authentification.
@@ -330,138 +330,138 @@ message TPurgeQueueBatchResponse {
repeated TPurgeQueueResponse Entries = 3;
}
-message TReceiveMessageRequest {
+message TReceiveMessageRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- optional string QueueName = 2;
- /// The maximum number of messages to return.
- optional uint32 MaxNumberOfMessages = 3;
- /// The token used for deduplication of ReceiveMessage calls.
- optional string ReceiveRequestAttemptId = 4;
- /// The duration (in seconds) that the received messages are hidden
- /// from subsequent retrieve requests after being retrieved
- /// by a ReceiveMessage request.
- optional uint32 VisibilityTimeout = 5;
- /// The duration (in seconds) for which the call waits
- /// for a message to arrive in the queue before returning.
- optional uint32 WaitTimeSeconds = 6;
- /// A list of attributes that need to be returned
- /// along with each message.
- repeated string AttributeName = 7;
- /// The name of the message attribute that need to be returned
- /// along with each message.
- repeated string MessageAttributeName = 8;
-}
-
-message TReceiveMessageResponse {
- message TMessage {
- /// The time the message was first received from the queue
- /// (epoch time in milliseconds).
- optional uint64 ApproximateFirstReceiveTimestamp = 1;
- /// The number of times a message has been received from the queue
- /// but not deleted.
- optional uint64 ApproximateReceiveCount = 2;
- /// Unique message id.
- optional string MessageId = 3;
- /// The value provided by the sender that calls the SendMessage action.
- optional string MessageDeduplicationId = 4;
- /// Sharding tag.
- optional string MessageGroupId = 5;
- /// An MD5 digest of the message body string.
- optional string MD5OfMessageBody = 6;
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ optional string QueueName = 2;
+ /// The maximum number of messages to return.
+ optional uint32 MaxNumberOfMessages = 3;
+ /// The token used for deduplication of ReceiveMessage calls.
+ optional string ReceiveRequestAttemptId = 4;
+ /// The duration (in seconds) that the received messages are hidden
+ /// from subsequent retrieve requests after being retrieved
+ /// by a ReceiveMessage request.
+ optional uint32 VisibilityTimeout = 5;
+ /// The duration (in seconds) for which the call waits
+ /// for a message to arrive in the queue before returning.
+ optional uint32 WaitTimeSeconds = 6;
+ /// A list of attributes that need to be returned
+ /// along with each message.
+ repeated string AttributeName = 7;
+ /// The name of the message attribute that need to be returned
+ /// along with each message.
+ repeated string MessageAttributeName = 8;
+}
+
+message TReceiveMessageResponse {
+ message TMessage {
+ /// The time the message was first received from the queue
+ /// (epoch time in milliseconds).
+ optional uint64 ApproximateFirstReceiveTimestamp = 1;
+ /// The number of times a message has been received from the queue
+ /// but not deleted.
+ optional uint64 ApproximateReceiveCount = 2;
+ /// Unique message id.
+ optional string MessageId = 3;
+ /// The value provided by the sender that calls the SendMessage action.
+ optional string MessageDeduplicationId = 4;
+ /// Sharding tag.
+ optional string MessageGroupId = 5;
+ /// An MD5 digest of the message body string.
+ optional string MD5OfMessageBody = 6;
/// An MD5 digest of the non-URL-encoded message attribute string.
/// https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#sqs-attributes-md5-message-digest-calculation
optional string MD5OfMessageAttributes = 12;
- /// Message's attributes.
- repeated TMessageAttribute MessageAttributes = 7;
- /// Message's data itself.
- optional bytes Data = 8;
- /// The receipt handle associated with the message.
- optional bytes ReceiptHandle = 9;
- /// The time the message was sent to the queue
- /// (epoch time in milliseconds).
- optional uint64 SentTimestamp = 10;
- /// The large, non-consecutive number that SQS assigns to each message.
- optional uint64 SequenceNumber = 11;
+ /// Message's attributes.
+ repeated TMessageAttribute MessageAttributes = 7;
+ /// Message's data itself.
+ optional bytes Data = 8;
+ /// The receipt handle associated with the message.
+ optional bytes ReceiptHandle = 9;
+ /// The time the message was sent to the queue
+ /// (epoch time in milliseconds).
+ optional uint64 SentTimestamp = 10;
+ /// The large, non-consecutive number that SQS assigns to each message.
+ optional uint64 SequenceNumber = 11;
/// Message sender's SID, may be empty in case of unauthenticated writes.
optional string SenderId = 13;
- }
-
- optional TError Error = 1;
- optional string RequestId = 2;
- /// List of retrived messages.
- repeated TMessage Messages = 3;
- /// If a caller of the ReceiveMessage action doesn't provide
- /// a ReceiveRequestAttemptId, SQS generates a ReceiveRequestAttemptId.
- optional string ReceiveRequestAttemptId = 4;
-}
-
-message TSendMessageRequest {
+ }
+
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ /// List of retrived messages.
+ repeated TMessage Messages = 3;
+ /// If a caller of the ReceiveMessage action doesn't provide
+ /// a ReceiveRequestAttemptId, SQS generates a ReceiveRequestAttemptId.
+ optional string ReceiveRequestAttemptId = 4;
+}
+
+message TSendMessageRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// The name of the queue in which the message should be placed.
- optional string QueueName = 2;
- /// Sharding tag.
- optional string MessageGroupId = 3;
- /// Deduplication token.
- optional string MessageDeduplicationId = 4;
- /// Message's data itself.
- optional bytes MessageBody = 5;
- /// Message's attributes.
- repeated TMessageAttribute MessageAttributes = 6;
- /// Batch Id. Available only in case of batch request.
- optional string Id = 7;
- /// The length of time, in seconds, for which to delay a specific message.
- optional uint64 DelaySeconds = 8;
-}
-
-message TSendMessageResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- /// An MD5 digest of the non-URL-encoded message attribute string.
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// The name of the queue in which the message should be placed.
+ optional string QueueName = 2;
+ /// Sharding tag.
+ optional string MessageGroupId = 3;
+ /// Deduplication token.
+ optional string MessageDeduplicationId = 4;
+ /// Message's data itself.
+ optional bytes MessageBody = 5;
+ /// Message's attributes.
+ repeated TMessageAttribute MessageAttributes = 6;
+ /// Batch Id. Available only in case of batch request.
+ optional string Id = 7;
+ /// The length of time, in seconds, for which to delay a specific message.
+ optional uint64 DelaySeconds = 8;
+}
+
+message TSendMessageResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ /// An MD5 digest of the non-URL-encoded message attribute string.
/// https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#sqs-attributes-md5-message-digest-calculation
- optional string MD5OfMessageAttributes = 3;
- /// An MD5 digest of the non-URL-encoded message body string.
- optional string MD5OfMessageBody = 4;
- /// Unique message id.
- optional string MessageId = 5;
- /// The large, non-consecutive number that SQS assigns to each message.
- optional uint64 SequenceNumber = 6;
- /// Batch Id. Available only in case of batch response.
- optional string Id = 7;
-}
-
-message TSendMessageBatchRequest {
+ optional string MD5OfMessageAttributes = 3;
+ /// An MD5 digest of the non-URL-encoded message body string.
+ optional string MD5OfMessageBody = 4;
+ /// Unique message id.
+ optional string MessageId = 5;
+ /// The large, non-consecutive number that SQS assigns to each message.
+ optional uint64 SequenceNumber = 6;
+ /// Batch Id. Available only in case of batch response.
+ optional string Id = 7;
+}
+
+message TSendMessageBatchRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// The name of the queue in which the message should be placed.
- optional string QueueName = 2;
- repeated TSendMessageRequest Entries = 3;
-}
-
-message TSendMessageBatchResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
- repeated TSendMessageResponse Entries = 3;
-}
-
-message TSetQueueAttributesRequest {
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// The name of the queue in which the message should be placed.
+ optional string QueueName = 2;
+ repeated TSendMessageRequest Entries = 3;
+}
+
+message TSendMessageBatchResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+ repeated TSendMessageResponse Entries = 3;
+}
+
+message TSetQueueAttributesRequest {
optional TCredentials Credentials = 100;
- /// Sender's authentification.
- optional TAuthentification Auth = 1;
- /// The name of the queue.
- optional string QueueName = 2;
- /// Queue's attributes.
- repeated TAttribute Attributes = 3;
-}
-
-message TSetQueueAttributesResponse {
- optional TError Error = 1;
- optional string RequestId = 2;
-}
+ /// Sender's authentification.
+ optional TAuthentification Auth = 1;
+ /// The name of the queue.
+ optional string QueueName = 2;
+ /// Queue's attributes.
+ repeated TAttribute Attributes = 3;
+}
+
+message TSetQueueAttributesResponse {
+ optional TError Error = 1;
+ optional string RequestId = 2;
+}
message TPermissions {
optional string Subject = 1;
diff --git a/ydb/core/protos/ya.make b/ydb/core/protos/ya.make
index 70bb65514c..44da35985b 100644
--- a/ydb/core/protos/ya.make
+++ b/ydb/core/protos/ya.make
@@ -91,7 +91,7 @@ SRCS(
serverless_proxy_config.proto
services.proto
shared_cache.proto
- sqs.proto
+ sqs.proto
follower_group.proto
ssa.proto
statestorage.proto
diff --git a/ydb/core/testlib/test_client.cpp b/ydb/core/testlib/test_client.cpp
index d4907c26f1..1d7f46e1a2 100644
--- a/ydb/core/testlib/test_client.cpp
+++ b/ydb/core/testlib/test_client.cpp
@@ -247,14 +247,14 @@ namespace Tests {
void TServer::EnableGRpc(const NGrpc::TServerOptions& options) {
GRpcServer.reset(new NGrpc::TGRpcServer(options));
auto grpcService = new NGRpcProxy::TGRpcService();
-
- auto system(Runtime->GetAnyNodeActorSystem());
+
+ auto system(Runtime->GetAnyNodeActorSystem());
auto grpcRequestProxy = NGRpcService::CreateGRpcRequestProxy(Settings->AppConfig);
auto grpcRequestProxyId = system->Register(grpcRequestProxy, TMailboxType::ReadAsFilled);
system->RegisterLocalService(NGRpcService::CreateGRpcRequestProxyId(), grpcRequestProxyId);
auto grpcMon = system->Register(NGRpcService::CreateGrpcMonService(), TMailboxType::ReadAsFilled);
system->RegisterLocalService(NGRpcService::GrpcMonServiceId(), grpcMon);
-
+
GRpcServerRootCounters = MakeIntrusive<NMonitoring::TDynamicCounters>();
auto& counters = GRpcServerRootCounters;
@@ -280,11 +280,11 @@ namespace Tests {
}
auto future = grpcService->Prepare(
- system,
+ system,
NMsgBusProxy::CreatePersQueueMetaCacheV2Id(),
NMsgBusProxy::CreateMsgBusProxyId(),
counters
- );
+ );
auto startCb = [grpcService] (NThreading::TFuture<void> result) {
if (result.HasException()) {
try {
@@ -331,8 +331,8 @@ namespace Tests {
GRpcServer->AddService(new NGRpcService::TGRpcYdbLogStoreService(system, counters, grpcRequestProxyId));
GRpcServer->AddService(new NGRpcService::TGRpcAuthService(system, counters, grpcRequestProxyId));
GRpcServer->Start();
- }
-
+ }
+
void TServer::EnableGRpc(ui16 port) {
EnableGRpc(NGrpc::TServerOptions()
.SetHost("localhost")
diff --git a/ydb/core/testlib/test_client.h b/ydb/core/testlib/test_client.h
index 2064752ab4..5c9cf5d565 100644
--- a/ydb/core/testlib/test_client.h
+++ b/ydb/core/testlib/test_client.h
@@ -216,7 +216,7 @@ namespace Tests {
TServer(TServer&& server) = default;
TServer& operator =(TServer&& server) = default;
virtual ~TServer();
-
+
void EnableGRpc(const NGrpc::TServerOptions& options);
void EnableGRpc(ui16 port);
diff --git a/ydb/core/util/iterator.h b/ydb/core/util/iterator.h
index 63f03f0fa4..a37a00e19b 100644
--- a/ydb/core/util/iterator.h
+++ b/ydb/core/util/iterator.h
@@ -2,8 +2,8 @@
#include "defs.h"
-#include <util/generic/iterator_range.h>
-
+#include <util/generic/iterator_range.h>
+
template<typename TDerived, typename TValue, typename TReference = TValue&, typename TDifference = ptrdiff_t>
struct TIteratorFacade {
TReference operator *() const {
diff --git a/ydb/core/ymq/actor/action.h b/ydb/core/ymq/actor/action.h
index 1801c98d68..b1b6f6ce7d 100644
--- a/ydb/core/ymq/actor/action.h
+++ b/ydb/core/ymq/actor/action.h
@@ -1,16 +1,16 @@
-#pragma once
+#pragma once
#include "defs.h"
-
-#include "actor.h"
+
+#include "actor.h"
#include "cfg.h"
#include "error.h"
-#include "events.h"
-#include "limits.h"
+#include "events.h"
+#include "limits.h"
#include "log.h"
#include "proxy_actor.h"
-#include "serviceid.h"
+#include "serviceid.h"
#include "schema.h"
-
+
#include <ydb/core/base/path.h>
#include <ydb/core/base/ticket_parser.h>
#include <ydb/core/base/quoter.h>
@@ -21,34 +21,34 @@
#include <ydb/core/ymq/base/debug_info.h>
#include <ydb/core/ymq/base/query_id.h>
#include <ydb/core/ymq/base/security.h>
-
+
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/hfunc.h>
-
+
#include <util/folder/path.h>
-#include <util/generic/guid.h>
+#include <util/generic/guid.h>
#include <util/generic/is_in.h>
-#include <util/string/ascii.h>
-#include <util/string/join.h>
-
+#include <util/string/ascii.h>
+#include <util/string/join.h>
+
namespace NKikimr::NSQS {
-
-template <typename TDerived>
-class TActionActor
+
+template <typename TDerived>
+class TActionActor
: public TActorBootstrapped<TDerived>
-{
-public:
+{
+public:
TActionActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, EAction action, THolder<IReplyCallback> cb)
: Action_(action)
, RequestId_(sourceSqsRequest.GetRequestId())
- , Cb_(std::move(cb))
- , Shards_(1)
+ , Cb_(std::move(cb))
+ , Shards_(1)
, SourceSqsRequest_(sourceSqsRequest)
- {
+ {
Y_VERIFY(RequestId_);
DebugInfo->ActionActors.emplace(RequestId_, this);
- }
-
+ }
+
~TActionActor() {
DebugInfo->ActionActors.EraseKeyValue(RequestId_, this);
}
@@ -96,14 +96,14 @@ public:
configurationFlags |= TSqsEvents::TEvGetConfiguration::EFlags::NeedQueueLeader;
}
this->Send(MakeSqsServiceID(this->SelfId().NodeId()),
- MakeHolder<TSqsEvents::TEvGetConfiguration>(
+ MakeHolder<TSqsEvents::TEvGetConfiguration>(
RequestId_,
- UserName_,
+ UserName_,
GetQueueName(),
configurationFlags)
- );
+ );
}
-
+
void CreateAccountOnTheFly() const {
// TODO: move to separate actor
this->Register(
@@ -132,7 +132,7 @@ public:
const auto& cfg = Cfg();
- this->Become(&TActionActor::InitialState);
+ this->Become(&TActionActor::InitialState);
// Set timeout
if (cfg.GetRequestTimeoutMs()) {
@@ -150,9 +150,9 @@ public:
}
DoBootstrap();
- }
-
-protected:
+ }
+
+protected:
template<typename TReq>
void CopySecurityToken(const TReq& request) {
SecurityToken_ = ExtractSecurityToken<TReq, TCredentials>(request);
@@ -164,11 +164,11 @@ protected:
}
virtual void DoAction() = 0;
-
+
virtual TError* MutableErrorDesc() = 0;
- virtual TString DoGetQueueName() const = 0;
-
+ virtual TString DoGetQueueName() const = 0;
+
virtual bool Validate() {
if (TDerived::NeedUserSpecified() && !UserName_) {
MakeError(MutableErrorDesc(), NErrors::ACCESS_DENIED, "No account name.");
@@ -176,19 +176,19 @@ protected:
return DoValidate();
}
- virtual bool DoValidate() {
- return true;
- }
-
+ virtual bool DoValidate() {
+ return true;
+ }
+
virtual bool IsFifoQueue() const {
Y_VERIFY(IsFifo_);
return *IsFifo_;
}
- virtual void DoStart() { }
-
- virtual void DoFinish() { }
-
+ virtual void DoStart() { }
+
+ virtual void DoFinish() { }
+
virtual TString DumpState() {
TStringBuilder ret;
ret << "SecurityCheckRequestsToWaitFor: " << SecurityCheckRequestsToWaitFor_
@@ -241,23 +241,23 @@ protected:
}
TString GetQueueName() const {
- return DoGetQueueName();
- }
-
+ return DoGetQueueName();
+ }
+
TQueuePath GetQueuePath() const {
const TString root = Cfg().GetRoot();
return TQueuePath(root, UserName_, DoGetQueueName());
- }
-
+ }
+
TQueuePath GetUserPath() const {
const TString root = Cfg().GetRoot();
return TQueuePath(root, UserName_, TString());
- }
-
+ }
+
TString MakeQueueUrl(const TString& name) const {
- return Join("/", RootUrl_, UserName_, name);
- }
-
+ return Join("/", RootUrl_, UserName_, name);
+ }
+
void SendReplyAndDie() {
RLOG_SQS_TRACE("SendReplyAndDie from action actor " << Response_);
auto actionCountersCouple = GetActionCounters();
@@ -298,8 +298,8 @@ protected:
Cb_->DoSendReply(Response_);
PassAway();
- }
-
+ }
+
void PassAway() {
if (TProxyActor::NeedCreateProxyActor(Action_)) {
if (TString queueName = GetQueueName()) {
@@ -348,7 +348,7 @@ protected:
void PrintSlowRequestWarning() {
RLOG_SQS_INFO("Request [" << UserName_ << "] [" << GetQueueName() << "] [" << Action_ << "] is slow. Working duration: " << GetRequestWorkingDuration().MilliSeconds() << "ms");
}
-
+
TString SanitizeNodePath(const TString& path) const {
TStringBuf sanitizedPath(path);
// just skip SQS root path if there's such a prefix
@@ -410,7 +410,7 @@ protected:
if (UserCounters_->NeedToShowDetailedCounters()) {
result.SqsCounters = &UserCounters_->SqsActionCounters[Action_];
}
- }
+ }
if (IsActionForQueueYMQ(Action_) && QueueCounters_) {
if (IsActionForMessage(Action_) || QueueCounters_->NeedToShowDetailedCounters()) {
result.YmqCounters = &QueueCounters_->YmqActionCounters[Action_];
@@ -421,8 +421,8 @@ protected:
}
}
return result;
- }
-
+ }
+
void RequestSchemeCache(const TString& path) {
auto schemeCacheRequest = MakeHolder<NSchemeCache::TSchemeCacheNavigate>();
NSchemeCache::TSchemeCacheNavigate::TEntry entry;
@@ -434,15 +434,15 @@ protected:
this->Send(SchemeCache_, new TEvTxProxySchemeCache::TEvNavigateKeySet(schemeCacheRequest.Release()));
}
-private:
+private:
STATEFN(InitialState) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TSqsEvents::TEvConfiguration, HandleConfiguration);
hFunc(TSqsEvents::TEvUserCreated, HandleAccountCreated);
hFunc(TEvWakeup, HandleWakeup);
- }
- }
-
+ }
+ }
+
STATEFN(WaitAuthCheckMessages) {
switch (ev->GetTypeRewrite()) {
hFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, HandleSchemeCacheResponse);
@@ -501,7 +501,7 @@ private:
RootUrl_ = std::move(ev->Get()->RootUrl);
UserExists_ = ev->Get()->UserExists;
QueueExists_ = ev->Get()->QueueExists;
- Shards_ = ev->Get()->Shards;
+ Shards_ = ev->Get()->Shards;
IsFifo_ = ev->Get()->Fifo;
QueueAttributes_ = std::move(ev->Get()->QueueAttributes);
SchemeCache_ = ev->Get()->SchemeCache;
@@ -510,7 +510,7 @@ private:
UserCounters_ = std::move(ev->Get()->UserCounters);
QueueLeader_ = ev->Get()->QueueLeader;
QuoterResources_ = std::move(ev->Get()->QuoterResources);
-
+
Y_VERIFY(SchemeCache_);
RLOG_SQS_TRACE("Got configuration. Root url: " << RootUrl_
@@ -565,7 +565,7 @@ private:
RequestSchemeCache(GetActionACLSourcePath()); // this also checks that requested queue (if any) does exist
RequestTicketParser();
- } else {
+ } else {
if (!isACLProtectedAccount) { // !IsCloud && !SecurityToken_ && account is in AccountsWithoutMandatoryAuth setting.
INC_COUNTER(UserCounters_, UnauthenticatedAccess); // if !ForceAccessControl, this counter is not initialized.
}
@@ -592,7 +592,7 @@ private:
SendReplyAndDie();
return;
- }
+ }
SecurityObject_ = navigate->ResultSet.front().SecurityObject;
@@ -612,8 +612,8 @@ private:
}
OnAuthCheckMessage();
- }
-
+ }
+
void OnAuthCheckMessage() {
--SecurityCheckRequestsToWaitFor_;
@@ -735,12 +735,12 @@ private:
}
}
-protected:
+protected:
static constexpr ui64 REQUEST_TIMEOUT_WAKEUP_TAG = 100;
const EAction Action_;
- const TString RequestId_;
- THolder<IReplyCallback> Cb_;
+ const TString RequestId_;
+ THolder<IReplyCallback> Cb_;
TString RootUrl_;
TString UserName_;
TString SecurityToken_;
@@ -760,7 +760,7 @@ protected:
TIntrusivePtr<TUserCounters> UserCounters_;
TIntrusivePtr<TQueueCounters> QueueCounters_;
TMaybe<TSqsEvents::TQueueAttributes> QueueAttributes_;
- NKikimrClient::TSqsResponse Response_;
+ NKikimrClient::TSqsResponse Response_;
TActorId SchemeCache_;
TActorId QueueLeader_;
bool StartRequestWasCalled_ = false;
@@ -771,6 +771,6 @@ protected:
bool NeedReportYmqActionInflyCounter = false;
TSchedulerCookieHolder TimeoutCookie_ = ISchedulerCookie::Make2Way();
NKikimrClient::TSqsRequest SourceSqsRequest_;
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/actor.cpp b/ydb/core/ymq/actor/actor.cpp
index d2ebd7cf50..3fe2a78735 100644
--- a/ydb/core/ymq/actor/actor.cpp
+++ b/ydb/core/ymq/actor/actor.cpp
@@ -1,82 +1,82 @@
-#include "actor.h"
-#include "action.h"
+#include "actor.h"
+#include "action.h"
#include "ping.h"
#include "proxy_actor.h"
-
+
#include <util/system/defaults.h>
-using namespace NKikimrTxUserProxy;
-
+using namespace NKikimrTxUserProxy;
+
namespace NKikimr::NSQS {
-
-class TUnimplementedRequestActor
- : public TActionActor<TUnimplementedRequestActor>
-{
-public:
+
+class TUnimplementedRequestActor
+ : public TActionActor<TUnimplementedRequestActor>
+{
+public:
TUnimplementedRequestActor(const NKikimrClient::TSqsRequest& req, THolder<IReplyCallback> cb)
: TActionActor(req, EAction::Unknown, std::move(cb))
- {
- Response_.MutableGetQueueUrl()->SetRequestId(RequestId_);
- }
-
-private:
+ {
+ Response_.MutableGetQueueUrl()->SetRequestId(RequestId_);
+ }
+
+private:
void DoAction() override {
SendReplyAndDie();
- }
-
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableGetQueueUrl()->MutableError();
}
- TString DoGetQueueName() const override {
- return TString();
- }
-};
-
+ TString DoGetQueueName() const override {
+ return TString();
+ }
+};
+
IActor* CreateActionActor(const NKikimrClient::TSqsRequest& req, THolder<IReplyCallback> cb) {
Y_VERIFY(req.GetRequestId());
-
-#define REQUEST_CASE(action) \
+
+#define REQUEST_CASE(action) \
case NKikimrClient::TSqsRequest::Y_CAT(k, action): { \
extern IActor* Y_CAT(Y_CAT(Create, action), Actor)(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb); \
return Y_CAT(Y_CAT(Create, action), Actor)(req, std::move(cb)); \
- }
-
- switch (req.GetRequestCase()) {
- REQUEST_CASE(ChangeMessageVisibility)
- REQUEST_CASE(ChangeMessageVisibilityBatch)
- REQUEST_CASE(CreateQueue)
- REQUEST_CASE(CreateUser)
- REQUEST_CASE(DeleteMessage)
- REQUEST_CASE(DeleteMessageBatch)
- REQUEST_CASE(DeleteQueue)
+ }
+
+ switch (req.GetRequestCase()) {
+ REQUEST_CASE(ChangeMessageVisibility)
+ REQUEST_CASE(ChangeMessageVisibilityBatch)
+ REQUEST_CASE(CreateQueue)
+ REQUEST_CASE(CreateUser)
+ REQUEST_CASE(DeleteMessage)
+ REQUEST_CASE(DeleteMessageBatch)
+ REQUEST_CASE(DeleteQueue)
REQUEST_CASE(DeleteQueueBatch)
- REQUEST_CASE(DeleteUser)
+ REQUEST_CASE(DeleteUser)
REQUEST_CASE(ListPermissions)
- REQUEST_CASE(GetQueueAttributes)
+ REQUEST_CASE(GetQueueAttributes)
REQUEST_CASE(GetQueueAttributesBatch)
- REQUEST_CASE(GetQueueUrl)
- REQUEST_CASE(ListQueues)
- REQUEST_CASE(ListUsers)
+ REQUEST_CASE(GetQueueUrl)
+ REQUEST_CASE(ListQueues)
+ REQUEST_CASE(ListUsers)
REQUEST_CASE(ModifyPermissions)
- REQUEST_CASE(PurgeQueue)
+ REQUEST_CASE(PurgeQueue)
REQUEST_CASE(PurgeQueueBatch)
- REQUEST_CASE(ReceiveMessage)
- REQUEST_CASE(SendMessage)
- REQUEST_CASE(SendMessageBatch)
- REQUEST_CASE(SetQueueAttributes)
+ REQUEST_CASE(ReceiveMessage)
+ REQUEST_CASE(SendMessage)
+ REQUEST_CASE(SendMessageBatch)
+ REQUEST_CASE(SetQueueAttributes)
REQUEST_CASE(ListDeadLetterSourceQueues)
REQUEST_CASE(CountQueues)
-
-#undef REQUEST_CASE
-
- case NKikimrClient::TSqsRequest::REQUEST_NOT_SET:
+
+#undef REQUEST_CASE
+
+ case NKikimrClient::TSqsRequest::REQUEST_NOT_SET:
return new TUnimplementedRequestActor(req, std::move(cb));
- }
-
- Y_FAIL();
-}
-
+ }
+
+ Y_FAIL();
+}
+
IActor* CreateProxyActionActor(const NKikimrClient::TSqsRequest& req, THolder<IReplyCallback> cb, bool enableQueueLeader) {
if (enableQueueLeader && TProxyActor::NeedCreateProxyActor(req)) {
return new TProxyActor(req, std::move(cb));
diff --git a/ydb/core/ymq/actor/actor.h b/ydb/core/ymq/actor/actor.h
index d6a825d2f8..4c3ce19e9e 100644
--- a/ydb/core/ymq/actor/actor.h
+++ b/ydb/core/ymq/actor/actor.h
@@ -1,18 +1,18 @@
-#pragma once
+#pragma once
#include "defs.h"
-
+
#include <ydb/core/protos/msgbus.pb.h>
#include <library/cpp/actors/core/actor.h>
-
+
namespace NKikimr::NSQS {
-
-class IReplyCallback {
-public:
- virtual ~IReplyCallback() = default;
-
+
+class IReplyCallback {
+public:
+ virtual ~IReplyCallback() = default;
+
virtual void DoSendReply(const NKikimrClient::TSqsResponse& resp) = 0;
-};
-
+};
+
class IPingReplyCallback {
public:
virtual ~IPingReplyCallback() = default;
@@ -23,7 +23,7 @@ public:
// Create actor that would process request.
// Called from leader node.
IActor* CreateActionActor(const NKikimrClient::TSqsRequest& req, THolder<IReplyCallback> cb);
-
+
// Create actor that would proxy request to leader
// or process it if leader is not required for given operation type.
IActor* CreateProxyActionActor(const NKikimrClient::TSqsRequest& req, THolder<IReplyCallback> cb, bool enableQueueLeader);
diff --git a/ydb/core/ymq/actor/change_visibility.cpp b/ydb/core/ymq/actor/change_visibility.cpp
index 5c3140bcc8..b7fdc52c3e 100644
--- a/ydb/core/ymq/actor/change_visibility.cpp
+++ b/ydb/core/ymq/actor/change_visibility.cpp
@@ -1,27 +1,27 @@
-#include "action.h"
+#include "action.h"
#include "error.h"
#include "executor.h"
#include "log.h"
-#include "params.h"
-
+#include "params.h"
+
#include <ydb/core/ymq/base/limits.h>
#include <ydb/core/ymq/base/helpers.h>
#include <ydb/core/ymq/proto/records.pb.h>
-
+
#include <library/cpp/string_utils/base64/base64.h>
-
-using NKikimr::NClient::TValue;
-
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TChangeMessageVisibilityActor
- : public TActionActor<TChangeMessageVisibilityActor>
-{
-public:
+
+class TChangeMessageVisibilityActor
+ : public TActionActor<TChangeMessageVisibilityActor>
+{
+public:
TChangeMessageVisibilityActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, bool isBatch, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, isBatch ? EAction::ChangeMessageVisibilityBatch : EAction::ChangeMessageVisibility, std::move(cb))
, IsBatch_(isBatch)
- {
+ {
if (IsBatch_) {
CopyAccountName(BatchRequest());
Response_.MutableChangeMessageVisibilityBatch()->SetRequestId(RequestId_);
@@ -31,9 +31,9 @@ public:
Response_.MutableChangeMessageVisibility()->SetRequestId(RequestId_);
CopySecurityToken(Request());
}
- }
-
-protected:
+ }
+
+protected:
void AppendEntry(const TChangeMessageVisibilityRequest& entry, TChangeMessageVisibilityResponse* resp, size_t requestIndexInBatch) {
try {
// Validate
@@ -41,7 +41,7 @@ protected:
MakeError(resp, NErrors::MISSING_PARAMETER, "VisibilityTimeout was not provided.");
return;
}
-
+
const TDuration newVisibilityTimeout = TDuration::Seconds(entry.GetVisibilityTimeout());
if (newVisibilityTimeout > TLimits::MaxVisibilityTimeout) {
MakeError(resp, NErrors::INVALID_PARAMETER_VALUE, "VisibilityTimeout parameter must be less than or equal to 12 hours.");
@@ -86,9 +86,9 @@ protected:
} catch (...) {
RLOG_SQS_WARN("Failed to process receipt handle " << entry.GetReceiptHandle() << ": " << CurrentExceptionMessage());
MakeError(resp, NErrors::RECEIPT_HANDLE_IS_INVALID);
- }
+ }
}
-
+
void ProcessAnswer(TChangeMessageVisibilityResponse* resp, const TSqsEvents::TEvChangeMessageVisibilityBatchResponse::TMessageResult& answer) {
switch (answer.Status) {
case TSqsEvents::TEvChangeMessageVisibilityBatchResponse::EMessageStatus::OK: {
@@ -107,31 +107,31 @@ protected:
break;
}
}
- }
-
- bool DoValidate() override {
- if (IsBatch_) {
+ }
+
+ bool DoValidate() override {
+ if (IsBatch_) {
if (BatchRequest().EntriesSize() == 0) {
MakeError(Response_.MutableChangeMessageVisibilityBatch(), NErrors::EMPTY_BATCH_REQUEST);
- return false;
+ return false;
} else if (BatchRequest().EntriesSize() > TLimits::MaxBatchSize) {
MakeError(Response_.MutableChangeMessageVisibilityBatch(), NErrors::TOO_MANY_ENTRIES_IN_BATCH_REQUEST);
return false;
- }
- }
-
- return true;
- }
-
+ }
+ }
+
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return IsBatch_ ? Response_.MutableChangeMessageVisibilityBatch()->MutableError() : Response_.MutableChangeMessageVisibility()->MutableError();
}
void DoAction() override {
- Become(&TThis::StateFunc);
+ Become(&TThis::StateFunc);
ShardInfo_.resize(Shards_);
NowTimestamp_ = TActivationContext::Now();
-
+
if (IsBatch_) {
for (size_t i = 0, size = BatchRequest().EntriesSize(); i < size; ++i) {
const auto& entry = BatchRequest().GetEntries(i);
@@ -141,32 +141,32 @@ protected:
}
} else {
AppendEntry(Request(), Response_.MutableChangeMessageVisibility(), 0);
- }
-
+ }
+
if (RequestsToLeader_) {
Y_VERIFY(RequestsToLeader_ <= Shards_);
for (auto& shardInfo : ShardInfo_) {
if (shardInfo.Request_) {
Send(QueueLeader_, shardInfo.Request_.Release());
- }
- }
- } else {
+ }
+ }
+ } else {
SendReplyAndDie();
- }
- }
-
- TString DoGetQueueName() const override {
+ }
+ }
+
+ TString DoGetQueueName() const override {
return IsBatch_ ? BatchRequest().GetQueueName() : Request().GetQueueName();
- }
-
-private:
+ }
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvChangeMessageVisibilityBatchResponse, HandleChangeMessageVisibilityBatchResponse);
- }
- }
-
+ }
+ }
+
void HandleChangeMessageVisibilityBatchResponse(TSqsEvents::TEvChangeMessageVisibilityBatchResponse::TPtr& ev) {
if (IsBatch_) {
Y_VERIFY(ev->Get()->Shard < Shards_);
@@ -176,19 +176,19 @@ private:
const size_t entryIndex = shardInfo.RequestToReplyIndexMapping_[i];
Y_VERIFY(entryIndex < Response_.GetChangeMessageVisibilityBatch().EntriesSize());
ProcessAnswer(Response_.MutableChangeMessageVisibilityBatch()->MutableEntries(entryIndex), ev->Get()->Statuses[i]);
- }
- } else {
+ }
+ } else {
Y_VERIFY(RequestsToLeader_ == 1);
Y_VERIFY(ev->Get()->Statuses.size() == 1);
ProcessAnswer(Response_.MutableChangeMessageVisibility(), ev->Get()->Statuses[0]);
- }
-
+ }
+
--RequestsToLeader_;
if (RequestsToLeader_ == 0) {
SendReplyAndDie();
- }
- }
-
+ }
+ }
+
const TChangeMessageVisibilityRequest& Request() const {
return SourceSqsRequest_.GetChangeMessageVisibility();
}
@@ -197,9 +197,9 @@ private:
return SourceSqsRequest_.GetChangeMessageVisibilityBatch();
}
-private:
+private:
const bool IsBatch_;
-
+
struct TShardInfo {
std::vector<size_t> RequestToReplyIndexMapping_;
THolder<TSqsEvents::TEvChangeMessageVisibilityBatch> Request_; // actual when processing initial request, then nullptr
@@ -207,14 +207,14 @@ private:
size_t RequestsToLeader_ = 0;
std::vector<TShardInfo> ShardInfo_;
TInstant NowTimestamp_;
-};
-
+};
+
IActor* CreateChangeMessageVisibilityActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TChangeMessageVisibilityActor(sourceSqsRequest, false, std::move(cb));
-}
-
+}
+
IActor* CreateChangeMessageVisibilityBatchActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TChangeMessageVisibilityActor(sourceSqsRequest, true, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/create_queue.cpp b/ydb/core/ymq/actor/create_queue.cpp
index 2d4b3af214..a446056efa 100644
--- a/ydb/core/ymq/actor/create_queue.cpp
+++ b/ydb/core/ymq/actor/create_queue.cpp
@@ -1,21 +1,21 @@
-#include "action.h"
+#include "action.h"
#include "error.h"
#include "log.h"
#include "queue_schema.h"
-
+
#include <ydb/core/ymq/base/constants.h>
#include <ydb/core/ymq/base/helpers.h>
#include <ydb/core/ymq/base/queue_id.h>
-#include <util/string/join.h>
+#include <util/string/join.h>
#include <util/string/type.h>
-
+
namespace NKikimr::NSQS {
-
-class TCreateQueueActor
- : public TActionActor<TCreateQueueActor>
-{
-public:
+
+class TCreateQueueActor
+ : public TActionActor<TCreateQueueActor>
+{
+public:
static constexpr bool NeedExistingQueue() {
return false;
}
@@ -26,21 +26,21 @@ public:
TCreateQueueActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::CreateQueue, std::move(cb))
- {
+ {
CopyAccountName(Request()); // will be replaced during bootstrap for cloud mode
- Response_.MutableCreateQueue()->SetRequestId(RequestId_);
+ Response_.MutableCreateQueue()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
+ }
protected:
bool IsFifoQueue() const override {
return AsciiHasSuffixIgnoreCase(Request().GetQueueName(), ".fifo"); // works for cloud too, since the custom name should end with '.fifo'
}
-
-private:
- bool DoValidate() override {
+
+private:
+ bool DoValidate() override {
auto* result = Response_.MutableCreateQueue();
-
+
if (!IsCloud() && !UserExists_) {
MakeError(result, NErrors::OPT_IN_REQUIRED, "The specified account does not exist.");
return false;
@@ -48,29 +48,29 @@ private:
TAttribute fifo;
for (const auto& attr : Request().attributes()) {
- if (attr.GetName() == "FifoQueue") {
- fifo = attr;
- break;
- }
- }
-
- if (IsFifoQueue()) {
+ if (attr.GetName() == "FifoQueue") {
+ fifo = attr;
+ break;
+ }
+ }
+
+ if (IsFifoQueue()) {
if (!fifo.HasName() || !IsTrue(fifo.GetValue())) {
MakeError(result, NErrors::INVALID_PARAMETER_VALUE, "The FifoQueue attribute should be set to true for FIFO queue.");
- return false;
- }
- } else {
+ return false;
+ }
+ } else {
if (fifo.HasName() && IsTrue(fifo.GetValue())) {
MakeError(result, NErrors::INVALID_PARAMETER_VALUE, "Name of FIFO queue should end with \".fifo\".");
- return false;
- }
- }
-
+ return false;
+ }
+ }
+
if (!Request().GetQueueName()) {
MakeError(result, NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
-
+ return false;
+ }
+
if (!ValidateQueueNameOrUserName(Request().GetQueueName())) {
MakeError(result, NErrors::INVALID_PARAMETER_VALUE, "Invalid queue name.");
return false;
@@ -78,9 +78,9 @@ private:
if (Request().GetShards() > MAX_SHARDS_COUNT) {
MakeError(result, NErrors::INVALID_PARAMETER_VALUE, "Too many shards.");
- return false;
- }
-
+ return false;
+ }
+
if (Request().GetPartitions() > MAX_PARTITIONS_COUNT) {
MakeError(result, NErrors::INVALID_PARAMETER_VALUE, "Too many partitions.");
return false;
@@ -91,9 +91,9 @@ private:
return false;
}
- return true;
- }
-
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableCreateQueue()->MutableError();
}
@@ -108,8 +108,8 @@ private:
}
void DoAction() override {
- Become(&TThis::StateFunc);
-
+ Become(&TThis::StateFunc);
+
if (IsCloud()) {
Register(new TAtomicCounterActor(SelfId(), Cfg().GetRoot(), RequestId_));
} else {
@@ -117,20 +117,20 @@ private:
StartQueueCreation(Request().GetQueueName(), UserName_, emptyCustomQueueName);
}
- }
-
- TString DoGetQueueName() const override {
+ }
+
+ TString DoGetQueueName() const override {
return TString();
- }
-
+ }
+
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvAtomicCounterIncrementResult, HandleAtomicCounterIncrement);
hFunc(TSqsEvents::TEvQueueCreated, HandleQueueCreated);
- }
- }
-
+ }
+ }
+
void HandleAtomicCounterIncrement(TSqsEvents::TEvAtomicCounterIncrementResult::TPtr& ev) {
auto event = ev->Get();
auto* result = Response_.MutableCreateQueue();
@@ -153,20 +153,20 @@ private:
void HandleQueueCreated(TSqsEvents::TEvQueueCreated::TPtr& ev) {
SchemaActor_ = TActorId();
- auto event = ev->Get();
+ auto event = ev->Get();
auto* result = Response_.MutableCreateQueue();
-
+
TStringBuilder errMsg;
if (!event->Success && ev->Get()->Error) {
errMsg << "Cannot create queue: " << ev->Get()->Error;
}
- switch (event->State) {
- case EQueueState::Creating:
+ switch (event->State) {
+ case EQueueState::Creating:
MakeError(result, *ev->Get()->ErrorClass, errMsg);
- break;
-
- case EQueueState::Active:
- if (event->Success) {
+ break;
+
+ case EQueueState::Active:
+ if (event->Success) {
const TString& name = Request().GetQueueName();
if (IsCloud()) {
const auto finalResourceId = event->AlreadyExists ? event->ExistingQueueResourceId : ResourceId_;
@@ -176,19 +176,19 @@ private:
result->SetQueueName(name);
result->SetQueueUrl(MakeQueueUrl(name));
}
- } else {
+ } else {
MakeError(result, *ev->Get()->ErrorClass, errMsg);
- }
- break;
-
- case EQueueState::Deleting:
+ }
+ break;
+
+ case EQueueState::Deleting:
MakeError(result, NErrors::QUEUE_DELETED_RECENTLY, errMsg);
- break;
- }
-
+ break;
+ }
+
SendReplyAndDie();
- }
-
+ }
+
void PassAway() override {
if (SchemaActor_) {
Send(SchemaActor_, new TEvPoisonPill());
@@ -201,13 +201,13 @@ private:
return SourceSqsRequest_.GetCreateQueue();
}
-private:
+private:
TString ResourceId_;
TActorId SchemaActor_;
-};
-
+};
+
IActor* CreateCreateQueueActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TCreateQueueActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/create_user.cpp b/ydb/core/ymq/actor/create_user.cpp
index deebfc54e8..62f2bcc5a3 100644
--- a/ydb/core/ymq/actor/create_user.cpp
+++ b/ydb/core/ymq/actor/create_user.cpp
@@ -1,77 +1,77 @@
-#include "action.h"
+#include "action.h"
#include "error.h"
-#include "schema.h"
-
+#include "schema.h"
+
#include <ydb/core/ymq/base/helpers.h>
namespace NKikimr::NSQS {
-
-class TCreateUserActor
- : public TActionActor<TCreateUserActor>
-{
-public:
+
+class TCreateUserActor
+ : public TActionActor<TCreateUserActor>
+{
+public:
static constexpr bool NeedExistingQueue() {
return false;
}
TCreateUserActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::CreateUser, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutableCreateUser()->SetRequestId(RequestId_);
+ Response_.MutableCreateUser()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
-
-private:
- bool DoValidate() override {
+ }
+
+private:
+ bool DoValidate() override {
if (!Request().GetUserName()) {
MakeError(Response_.MutableCreateUser(), NErrors::MISSING_PARAMETER, "No user name parameter.");
- return false;
- }
-
+ return false;
+ }
+
if (!ValidateQueueNameOrUserName(Request().GetUserName())) {
MakeError(Response_.MutableCreateUser(), NErrors::INVALID_PARAMETER_VALUE, "Invalid user name.");
return false;
}
- return true;
- }
-
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableCreateUser()->MutableError();
}
void DoAction() override {
- Become(&TThis::StateFunc);
-
+ Become(&TThis::StateFunc);
+
SchemaActor = Register(
new TCreateUserSchemaActor(Cfg().GetRoot(), Request().GetUserName(), SelfId(), RequestId_, UserCounters_)
- );
- }
-
- TString DoGetQueueName() const override {
- return TString();
- }
-
-private:
+ );
+ }
+
+ TString DoGetQueueName() const override {
+ return TString();
+ }
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvUserCreated, HandleUserCreated);
- }
- }
-
+ }
+ }
+
void HandleUserCreated(TSqsEvents::TEvUserCreated::TPtr& ev) {
SchemaActor = TActorId();
- if (ev->Get()->Success) {
- } else {
+ if (ev->Get()->Success) {
+ } else {
MakeError(Response_.MutableCreateUser(), NErrors::INTERNAL_FAILURE);
- }
-
+ }
+
SendReplyAndDie();
- }
-
+ }
+
void PassAway() override {
if (SchemaActor) {
Send(SchemaActor, new TEvPoisonPill());
@@ -84,12 +84,12 @@ private:
return SourceSqsRequest_.GetCreateUser();
}
-private:
+private:
TActorId SchemaActor;
-};
-
+};
+
IActor* CreateCreateUserActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TCreateUserActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/delete_message.cpp b/ydb/core/ymq/actor/delete_message.cpp
index 50b59ddcfb..7e1d0f081e 100644
--- a/ydb/core/ymq/actor/delete_message.cpp
+++ b/ydb/core/ymq/actor/delete_message.cpp
@@ -1,28 +1,28 @@
-#include "action.h"
+#include "action.h"
#include "error.h"
#include "executor.h"
#include "log.h"
-#include "params.h"
-
+#include "params.h"
+
#include <ydb/core/ymq/base/helpers.h>
#include <ydb/core/ymq/base/limits.h>
#include <ydb/core/ymq/proto/records.pb.h>
-
-#include <util/generic/hash.h>
-#include <util/generic/map.h>
-
-using NKikimr::NClient::TValue;
-
+
+#include <util/generic/hash.h>
+#include <util/generic/map.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TDeleteMessageActor
- : public TActionActor<TDeleteMessageActor>
-{
-public:
+
+class TDeleteMessageActor
+ : public TActionActor<TDeleteMessageActor>
+{
+public:
TDeleteMessageActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, bool isBatch, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, isBatch ? EAction::DeleteMessageBatch : EAction::DeleteMessage, std::move(cb))
, IsBatch_(isBatch)
- {
+ {
if (IsBatch_) {
CopyAccountName(BatchRequest());
Response_.MutableDeleteMessageBatch()->SetRequestId(RequestId_);
@@ -32,42 +32,42 @@ public:
Response_.MutableDeleteMessage()->SetRequestId(RequestId_);
CopySecurityToken(Request());
}
- }
-
- bool DoValidate() override {
- if (!GetQueueName()) {
+ }
+
+ bool DoValidate() override {
+ if (!GetQueueName()) {
MakeError(Response_.MutableDeleteMessage(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
-
- if (IsBatch_) {
+ return false;
+ }
+
+ if (IsBatch_) {
if (BatchRequest().EntriesSize() == 0) {
MakeError(Response_.MutableDeleteMessageBatch(), NErrors::EMPTY_BATCH_REQUEST);
- return false;
+ return false;
} else if (BatchRequest().EntriesSize() > TLimits::MaxBatchSize) {
MakeError(Response_.MutableDeleteMessageBatch(), NErrors::TOO_MANY_ENTRIES_IN_BATCH_REQUEST);
return false;
- }
- }
-
- return true;
- }
-
-private:
+ }
+ }
+
+ return true;
+ }
+
+private:
void AppendEntry(const TDeleteMessageRequest& entry, TDeleteMessageResponse* resp, size_t requestIndexInBatch) {
- try {
+ try {
// Validate
const TReceipt receipt = DecodeReceiptHandle(entry.GetReceiptHandle()); // can throw
RLOG_SQS_DEBUG("Decoded receipt handle: " << receipt);
if (receipt.GetShard() >= Shards_) {
throw yexception() << "Invalid shard: " << receipt.GetShard();
}
-
+
const bool isFifo = IsFifoQueue();
if (isFifo && !receipt.GetMessageGroupId()) {
throw yexception() << "No message group id";
}
-
+
auto& shardInfo = ShardInfo_[receipt.GetShard()];
// Create request
if (!shardInfo.Request_) {
@@ -75,7 +75,7 @@ private:
shardInfo.Request_ = MakeHolder<TSqsEvents::TEvDeleteMessageBatch>();
shardInfo.Request_->Shard = receipt.GetShard();
shardInfo.Request_->RequestId = RequestId_;
- }
+ }
// Add new message to shard request
if (IsBatch_) {
@@ -95,12 +95,12 @@ private:
const TDuration processingDuration = TActivationContext::Now() - lockTimestamp;
COLLECT_HISTOGRAM_COUNTER(QueueCounters_, ClientMessageProcessing_Duration, processingDuration.MilliSeconds());
COLLECT_HISTOGRAM_COUNTER(QueueCounters_, client_processing_duration_milliseconds, processingDuration.MilliSeconds());
- } catch (...) {
+ } catch (...) {
RLOG_SQS_WARN("Failed to process receipt handle " << entry.GetReceiptHandle() << ": " << CurrentExceptionMessage());
MakeError(resp, NErrors::RECEIPT_HANDLE_IS_INVALID);
- }
- }
-
+ }
+ }
+
void ProcessAnswer(TDeleteMessageResponse* resp, const TSqsEvents::TEvDeleteMessageBatchResponse::TMessageResult& answer) {
switch (answer.Status) {
case TSqsEvents::TEvDeleteMessageBatchResponse::EDeleteMessageStatus::OK: {
@@ -115,18 +115,18 @@ private:
MakeError(resp, NErrors::INTERNAL_FAILURE);
break;
}
- }
- }
-
+ }
+ }
+
TError* MutableErrorDesc() override {
return IsBatch_ ? Response_.MutableDeleteMessageBatch()->MutableError() : Response_.MutableDeleteMessage()->MutableError();
}
void DoAction() override {
- Become(&TThis::StateFunc);
+ Become(&TThis::StateFunc);
ShardInfo_.resize(Shards_);
- if (IsBatch_) {
+ if (IsBatch_) {
for (size_t i = 0, size = BatchRequest().EntriesSize(); i < size; ++i) {
const auto& entry = BatchRequest().GetEntries(i);
auto* response = Response_.MutableDeleteMessageBatch()->AddEntries();
@@ -136,30 +136,30 @@ private:
} else {
AppendEntry(Request(), Response_.MutableDeleteMessage(), 0);
}
-
+
if (RequestsToLeader_) {
Y_VERIFY(RequestsToLeader_ <= Shards_);
for (auto& shardInfo : ShardInfo_) {
if (shardInfo.Request_) {
Send(QueueLeader_, shardInfo.Request_.Release());
- }
- }
- } else {
+ }
+ }
+ } else {
SendReplyAndDie();
- }
- }
-
- TString DoGetQueueName() const override {
+ }
+ }
+
+ TString DoGetQueueName() const override {
return IsBatch_ ? BatchRequest().GetQueueName() : Request().GetQueueName();
- }
-
+ }
+
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvDeleteMessageBatchResponse, HandleDeleteMessageBatchResponse);
- }
- }
-
+ }
+ }
+
void HandleDeleteMessageBatchResponse(TSqsEvents::TEvDeleteMessageBatchResponse::TPtr& ev) {
if (IsBatch_) {
Y_VERIFY(ev->Get()->Shard < Shards_);
@@ -169,19 +169,19 @@ private:
const size_t entryIndex = shardInfo.RequestToReplyIndexMapping_[i];
Y_VERIFY(entryIndex < Response_.GetDeleteMessageBatch().EntriesSize());
ProcessAnswer(Response_.MutableDeleteMessageBatch()->MutableEntries(entryIndex), ev->Get()->Statuses[i]);
- }
- } else {
+ }
+ } else {
Y_VERIFY(RequestsToLeader_ == 1);
Y_VERIFY(ev->Get()->Statuses.size() == 1);
ProcessAnswer(Response_.MutableDeleteMessage(), ev->Get()->Statuses[0]);
- }
-
+ }
+
--RequestsToLeader_;
if (RequestsToLeader_ == 0) {
SendReplyAndDie();
- }
- }
-
+ }
+ }
+
const TDeleteMessageRequest& Request() const {
return SourceSqsRequest_.GetDeleteMessage();
}
@@ -190,23 +190,23 @@ private:
return SourceSqsRequest_.GetDeleteMessageBatch();
}
-private:
- const bool IsBatch_;
-
+private:
+ const bool IsBatch_;
+
struct TShardInfo {
std::vector<size_t> RequestToReplyIndexMapping_;
THolder<TSqsEvents::TEvDeleteMessageBatch> Request_; // actual when processing initial request, then nullptr
};
size_t RequestsToLeader_ = 0;
std::vector<TShardInfo> ShardInfo_;
-};
-
+};
+
IActor* CreateDeleteMessageActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TDeleteMessageActor(sourceSqsRequest, false, std::move(cb));
-}
-
+}
+
IActor* CreateDeleteMessageBatchActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TDeleteMessageActor(sourceSqsRequest, true, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/delete_queue.cpp b/ydb/core/ymq/actor/delete_queue.cpp
index 9711b91734..9dfb77a252 100644
--- a/ydb/core/ymq/actor/delete_queue.cpp
+++ b/ydb/core/ymq/actor/delete_queue.cpp
@@ -1,69 +1,69 @@
-#include "action.h"
+#include "action.h"
#include "common_batch_actor.h"
#include "error.h"
#include "queue_schema.h"
-
-#include <util/string/join.h>
-
+
+#include <util/string/join.h>
+
namespace NKikimr::NSQS {
-
-class TDeleteQueueActor
- : public TActionActor<TDeleteQueueActor>
-{
-public:
+
+class TDeleteQueueActor
+ : public TActionActor<TDeleteQueueActor>
+{
+public:
TDeleteQueueActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::DeleteQueue, std::move(cb))
- {
+ {
UserName_ = Request().GetAuth().GetUserName();
- Response_.MutableDeleteQueue()->SetRequestId(RequestId_);
-
+ Response_.MutableDeleteQueue()->SetRequestId(RequestId_);
+
CopySecurityToken(Request());
}
-private:
- bool DoValidate() override {
- if (!GetQueueName()) {
+private:
+ bool DoValidate() override {
+ if (!GetQueueName()) {
MakeError(Response_.MutableDeleteQueue(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
-
- return true;
- }
-
+ return false;
+ }
+
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableDeleteQueue()->MutableError();
}
void DoAction() override {
- Become(&TThis::StateFunc);
-
+ Become(&TThis::StateFunc);
+
SchemaActor_ = Register(
new TDeleteQueueSchemaActorV2(
TQueuePath(Cfg().GetRoot(), UserName_, GetQueueName()), SelfId(), RequestId_, UserCounters_)
);
- }
-
- TString DoGetQueueName() const override {
+ }
+
+ TString DoGetQueueName() const override {
return Request().GetQueueName();
- }
-
-private:
+ }
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvQueueDeleted, HandleQueueDeleted);
- }
- }
-
+ }
+ }
+
void HandleQueueDeleted(TSqsEvents::TEvQueueDeleted::TPtr& ev) {
SchemaActor_ = TActorId();
if (!ev->Get()->Success) {
MakeError(Response_.MutableDeleteQueue(), NErrors::INTERNAL_FAILURE, ev->Get()->Message);
- }
-
+ }
+
SendReplyAndDie();
- }
-
+ }
+
void PassAway() override {
if (SchemaActor_) {
Send(SchemaActor_, new TEvPoisonPill());
@@ -76,10 +76,10 @@ private:
return SourceSqsRequest_.GetDeleteQueue();
}
-private:
+private:
TActorId SchemaActor_;
-};
-
+};
+
class TDeleteQueueBatchActor
: public TCommonBatchActor<TDeleteQueueBatchActor>
{
@@ -149,8 +149,8 @@ private:
IActor* CreateDeleteQueueActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TDeleteQueueActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
IActor* CreateDeleteQueueBatchActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TDeleteQueueBatchActor(sourceSqsRequest, std::move(cb));
}
diff --git a/ydb/core/ymq/actor/delete_user.cpp b/ydb/core/ymq/actor/delete_user.cpp
index bea58c5a7a..4c65367502 100644
--- a/ydb/core/ymq/actor/delete_user.cpp
+++ b/ydb/core/ymq/actor/delete_user.cpp
@@ -1,51 +1,51 @@
-#include "action.h"
+#include "action.h"
#include "error.h"
#include "executor.h"
#include "log.h"
#include "queue_schema.h"
-
+
#include <ydb/public/lib/value/value.h>
-
-#include <util/generic/set.h>
-
-using NKikimr::NClient::TValue;
-
+
+#include <util/generic/set.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TDeleteUserActor
- : public TActionActor<TDeleteUserActor>
-{
-public:
+
+class TDeleteUserActor
+ : public TActionActor<TDeleteUserActor>
+{
+public:
static constexpr bool NeedExistingQueue() {
return false;
}
TDeleteUserActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::DeleteUser, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutableDeleteUser()->SetRequestId(RequestId_);
+ Response_.MutableDeleteUser()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
-
-private:
- bool DoValidate() override {
+ }
+
+private:
+ bool DoValidate() override {
if (!Request().GetUserName()) {
MakeError(Response_.MutableDeleteUser(), NErrors::MISSING_PARAMETER, "No user name parameter.");
- return false;
- }
-
- return true;
- }
-
+ return false;
+ }
+
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableDeleteUser()->MutableError();
}
void DoAction() override {
- Become(&TThis::StateFunc);
-
+ Become(&TThis::StateFunc);
+
TExecutorBuilder(SelfId(), RequestId_)
.User(Request().GetUserName())
.QueryId(LIST_QUEUES_ID)
@@ -55,97 +55,97 @@ private:
.Utf8("FOLDERID", "")
.Utf8("USER_NAME", UserName_)
.ParentBuilder().Start();
- }
-
- TString DoGetQueueName() const override {
- return TString();
- }
-
-private:
+ }
+
+ TString DoGetQueueName() const override {
+ return TString();
+ }
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
hFunc(TSqsEvents::TEvQueueDeleted, HandleQueueDeleted);
hFunc(TSqsEvents::TEvUserDeleted, HandleUserDeleted);
- }
- }
-
+ }
+ }
+
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
const auto& record = ev->Get()->Record;
- ui32 status = record.GetStatus();
+ ui32 status = record.GetStatus();
auto* result = Response_.MutableDeleteUser();
-
- if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete) {
- const TValue val(TValue::Create(record.GetExecutionEngineEvaluatedResponse()));
- const TValue queues(val["queues"]);
-
- if (queues.Size() == 0) {
+
+ if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete) {
+ const TValue val(TValue::Create(record.GetExecutionEngineEvaluatedResponse()));
+ const TValue queues(val["queues"]);
+
+ if (queues.Size() == 0) {
Register(
- new TDeleteUserSchemaActor(
+ new TDeleteUserSchemaActor(
Cfg().GetRoot(), Request().GetUserName(), SelfId(), RequestId_, UserCounters_)
- );
- return;
- }
-
- for (size_t i = 0; i < queues.Size(); ++i) {
- const TString name((TString(queues[i]["QueueName"])));
-
- Queues_.insert(name);
-
+ );
+ return;
+ }
+
+ for (size_t i = 0; i < queues.Size(); ++i) {
+ const TString name((TString(queues[i]["QueueName"])));
+
+ Queues_.insert(name);
+
Register(
new TDeleteQueueSchemaActorV2(
TQueuePath(Cfg().GetRoot(), Request().GetUserName(), name), SelfId(), RequestId_, UserCounters_)
- );
- }
-
- return;
- } else {
+ );
+ }
+
+ return;
+ } else {
RLOG_SQS_WARN("Request failed: " << record);
MakeError(result, NErrors::INTERNAL_FAILURE);
- }
-
+ }
+
SendReplyAndDie();
- }
-
+ }
+
void HandleQueueDeleted(TSqsEvents::TEvQueueDeleted::TPtr& ev) {
- if (ev->Get()->Success) {
- Queues_.erase(ev->Get()->QueuePath.QueueName);
-
- if (Queues_.empty()) {
+ if (ev->Get()->Success) {
+ Queues_.erase(ev->Get()->QueuePath.QueueName);
+
+ if (Queues_.empty()) {
Register(
- new TDeleteUserSchemaActor(
+ new TDeleteUserSchemaActor(
Cfg().GetRoot(), Request().GetUserName(), SelfId(), RequestId_, UserCounters_)
- );
- }
-
- return;
- } else {
+ );
+ }
+
+ return;
+ } else {
MakeError(Response_.MutableDeleteUser(), NErrors::INTERNAL_FAILURE, ev->Get()->Message);
- }
-
+ }
+
SendReplyAndDie();
- }
-
+ }
+
void HandleUserDeleted(TSqsEvents::TEvUserDeleted::TPtr& ev) {
- if (ev->Get()->Success) {
- } else {
+ if (ev->Get()->Success) {
+ } else {
MakeError(Response_.MutableDeleteUser(), NErrors::INTERNAL_FAILURE, "Can't delete user: " + ev->Get()->Error);
- }
-
+ }
+
SendReplyAndDie();
- }
-
+ }
+
const TDeleteUserRequest& Request() const {
return SourceSqsRequest_.GetDeleteUser();
}
-private:
- TSet<TString> Queues_;
-};
-
+private:
+ TSet<TString> Queues_;
+};
+
IActor* CreateDeleteUserActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TDeleteUserActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/events.h b/ydb/core/ymq/actor/events.h
index 9fff62c7cf..c790420590 100644
--- a/ydb/core/ymq/actor/events.h
+++ b/ydb/core/ymq/actor/events.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "defs.h"
#include <ydb/core/base/defs.h>
@@ -19,43 +19,43 @@
#include <library/cpp/actors/core/event_pb.h>
#include <library/cpp/actors/core/event_local.h>
#include <library/cpp/monlib/dynamic_counters/counters.h>
-
+
#include <util/generic/hash.h>
#include <util/generic/maybe.h>
#include <util/generic/ptr.h>
-
+
#include <map>
#include <set>
namespace NKikimr::NSQS {
-
-enum class EQueueState {
- Creating = 0,
- Active = 1,
- Deleting = 2,
-};
-
-struct TSqsEvents {
- enum EEv {
+
+enum class EQueueState {
+ Creating = 0,
+ Active = 1,
+ Deleting = 2,
+};
+
+struct TSqsEvents {
+ enum EEv {
/// Request for queue configuration
- EvGetConfiguration = EventSpaceBegin(TKikimrEvents::ES_SQS),
- EvConfiguration,
+ EvGetConfiguration = EventSpaceBegin(TKikimrEvents::ES_SQS),
+ EvConfiguration,
/// Request for transaction execution
- EvExecute,
+ EvExecute,
/// Notification about completed transaction
- EvExecuted,
+ EvExecuted,
/// Request to select the requested number of visible messages
EvLockRequest, // not used
EvLockResponse, // not used
/// Notification about queue creation
- EvQueueCreated,
+ EvQueueCreated,
/// Notification about queue deletion
- EvQueueDeleted,
+ EvQueueDeleted,
/// Notification about catalogs creation for a new user
- EvUserCreated,
- EvUserDeleted,
+ EvUserCreated,
+ EvUserDeleted,
/// Clear the queue
- EvPurgeQueue,
+ EvPurgeQueue,
/// Go to the next request from a packet
EvNextRequest, // not used
/// Request from a proxy to sqs service
@@ -126,11 +126,11 @@ struct TSqsEvents {
EvCleanupQueryComplete,
- EvEnd,
- };
-
+ EvEnd,
+ };
+
using TExecutedCallback = std::function<void (const NKikimrTxUserProxy::TEvProposeTransactionStatus&)>;
-
+
struct TQueueAttributes {
bool ContentBasedDeduplication = false;
TDuration DelaySeconds = TDuration::Zero();
@@ -143,27 +143,27 @@ struct TSqsEvents {
// has operator<<
};
- struct TEvGetConfiguration : public NActors::TEventLocal<TEvGetConfiguration, EvGetConfiguration> {
+ struct TEvGetConfiguration : public NActors::TEventLocal<TEvGetConfiguration, EvGetConfiguration> {
TString RequestId;
- TString UserName;
- TString QueueName;
+ TString UserName;
+ TString QueueName;
ui64 Flags = 0;
-
+
enum EFlags {
NeedQueueLeader = 1,
NeedQueueAttributes = NeedQueueLeader | 2, // attributes are stored in leader actor, so, when you need attributes, you need leader
};
-
+
TEvGetConfiguration() = default;
TEvGetConfiguration(const TEvGetConfiguration& other) = default;
TEvGetConfiguration(TString requestId, const TString& user, const TString& name, ui64 flags = 0)
: RequestId(std::move(requestId))
- , UserName(user)
- , QueueName(name)
+ , UserName(user)
+ , QueueName(name)
, Flags(flags)
- { }
- };
-
+ { }
+ };
+
struct TQuoterResourcesForActions : public TAtomicRefCount<TQuoterResourcesForActions> {
virtual ~TQuoterResourcesForActions() = default;
@@ -177,7 +177,7 @@ struct TSqsEvents {
TResourceDescription CreateQueueAction; // Separate action for create queue. Quota is requested only when actor knows that there is no such queue. https://st.yandex-team.ru/SQS-620
};
- struct TEvConfiguration : public NActors::TEventLocal<TEvConfiguration, EvConfiguration> {
+ struct TEvConfiguration : public NActors::TEventLocal<TEvConfiguration, EvConfiguration> {
// Success status
bool Fail = false;
@@ -195,77 +195,77 @@ struct TSqsEvents {
TIntrusivePtr<NMonitoring::TDynamicCounters> SqsCoreCounters; // Raw counters interface. Is is not prefered to use them
TIntrusivePtr<TUserCounters> UserCounters;
TIntrusivePtr<TQueueCounters> QueueCounters;
-
+
// Common info
TString RootUrl;
TActorId SchemeCache;
TActorId QueueLeader;
- };
-
+ };
+
struct TEvClearQueueAttributesCache : public NActors::TEventLocal<TEvClearQueueAttributesCache, EvClearQueueAttributesCache> {
};
- struct TEvExecute : public NActors::TEventLocal<TEvExecute, EvExecute> {
+ struct TEvExecute : public NActors::TEventLocal<TEvExecute, EvExecute> {
/// Query sender
TActorId Sender;
// User request id this query belongs to
TString RequestId;
/// Queue path in the catalog
- TQueuePath QueuePath;
+ TQueuePath QueuePath;
/// Shard id we address by this query
- ui64 Shard;
+ ui64 Shard;
/// Query index to execute
EQueryId QueryIdx;
/// Query params
- NKikimrMiniKQL::TParams Params;
+ NKikimrMiniKQL::TParams Params;
/// Callback that is called on response receiving
- TExecutedCallback Cb;
+ TExecutedCallback Cb;
/// This option specifies if it safe to retry transaction in case of undertermined transaction status,
/// for example timeout. If transaction is idempotent, this options makes the whole system less sensitive to
/// tablets restarts.
bool RetryOnTimeout = false;
-
+
TEvExecute() = default;
-
+
TEvExecute(const TEvExecute& other) = default;
-
+
TEvExecute(const TActorId& sender, TString requestId, const TQueuePath& path, const EQueryId idx, const ui64 shard = 0)
- : Sender(sender)
+ : Sender(sender)
, RequestId(std::move(requestId))
- , QueuePath(path)
- , Shard(shard)
+ , QueuePath(path)
+ , Shard(shard)
, QueryIdx(idx)
{
Y_VERIFY(QueryIdx < EQueryId::QUERY_VECTOR_SIZE);
}
- };
-
- struct TEvExecuted : public NActors::TEventPB<TEvExecuted, NKikimrTxUserProxy::TEvProposeTransactionStatus, EvExecuted> {
- using TRecord = ProtoRecordType;
-
- TExecutedCallback Cb;
- ui64 Shard;
-
+ };
+
+ struct TEvExecuted : public NActors::TEventPB<TEvExecuted, NKikimrTxUserProxy::TEvProposeTransactionStatus, EvExecuted> {
+ using TRecord = ProtoRecordType;
+
+ TExecutedCallback Cb;
+ ui64 Shard;
+
TEvExecuted()
- : Shard(0)
- { }
-
+ : Shard(0)
+ { }
+
explicit TEvExecuted(TExecutedCallback cb, ui64 shard)
- : Cb(cb)
- , Shard(shard)
- { }
-
+ : Cb(cb)
+ , Shard(shard)
+ { }
+
TEvExecuted(const TRecord& rec, TExecutedCallback cb, ui64 shard)
- : TEventPB(rec)
- , Cb(cb)
- , Shard(shard)
- { }
-
+ : TEventPB(rec)
+ , Cb(cb)
+ , Shard(shard)
+ { }
+
void Call() {
- if (Cb) {
+ if (Cb) {
Cb(Record);
- }
- }
+ }
+ }
static bool IsOk(const NKikimrTxUserProxy::TEvProposeTransactionStatus& record) {
const ui32 status = record.GetStatus();
@@ -298,29 +298,29 @@ struct TSqsEvents {
bool IsResolvingError() const {
return IsResolvingError(Record);
}
- };
-
- struct TEvUserCreated : public NActors::TEventLocal<TEvUserCreated, EvUserCreated> {
- bool Success;
-
+ };
+
+ struct TEvUserCreated : public NActors::TEventLocal<TEvUserCreated, EvUserCreated> {
+ bool Success;
+
TEvUserCreated(bool success)
- : Success(success)
- {
- }
- };
-
- struct TEvUserDeleted : public NActors::TEventLocal<TEvUserDeleted, EvUserDeleted> {
- bool Success;
- TString Error;
-
- TEvUserDeleted(bool success, const TString& error = TString())
- : Success(success)
- , Error(error)
- {
- }
- };
-
- struct TEvQueueCreated : public NActors::TEventLocal<TEvQueueCreated, EvQueueCreated> {
+ : Success(success)
+ {
+ }
+ };
+
+ struct TEvUserDeleted : public NActors::TEventLocal<TEvUserDeleted, EvUserDeleted> {
+ bool Success;
+ TString Error;
+
+ TEvUserDeleted(bool success, const TString& error = TString())
+ : Success(success)
+ , Error(error)
+ {
+ }
+ };
+
+ struct TEvQueueCreated : public NActors::TEventLocal<TEvQueueCreated, EvQueueCreated> {
TString QueueId;
TString ExistingQueueResourceId;
TString Error;
@@ -328,28 +328,28 @@ struct TSqsEvents {
bool AlreadyExists;
bool Success;
const TErrorClass* ErrorClass = nullptr;
- };
-
- struct TEvQueueDeleted : public NActors::TEventLocal<TEvQueueDeleted, EvQueueDeleted> {
- TQueuePath QueuePath;
- TString Message;
- bool Success;
-
- TEvQueueDeleted(const TQueuePath& path, bool success, const TString& message = TString())
- : QueuePath(path)
- , Message(message)
- , Success(success)
- {
- }
-
- TEvQueueDeleted(const TEvQueueDeleted& other)
- : QueuePath(other.QueuePath)
- , Message(other.Message)
- , Success(other.Success)
- {
- }
- };
-
+ };
+
+ struct TEvQueueDeleted : public NActors::TEventLocal<TEvQueueDeleted, EvQueueDeleted> {
+ TQueuePath QueuePath;
+ TString Message;
+ bool Success;
+
+ TEvQueueDeleted(const TQueuePath& path, bool success, const TString& message = TString())
+ : QueuePath(path)
+ , Message(message)
+ , Success(success)
+ {
+ }
+
+ TEvQueueDeleted(const TEvQueueDeleted& other)
+ : QueuePath(other.QueuePath)
+ , Message(other.Message)
+ , Success(other.Success)
+ {
+ }
+ };
+
struct TEvAtomicCounterIncrementResult : public NActors::TEventLocal<TEvAtomicCounterIncrementResult, EvAtomicCounterIncrementResult> {
bool Success;
TString Error;
@@ -365,23 +365,23 @@ struct TSqsEvents {
TEvAtomicCounterIncrementResult(const TEvAtomicCounterIncrementResult& other) = default;
};
- struct TEvPurgeQueue : public NActors::TEventLocal<TEvPurgeQueue, EvPurgeQueue> {
+ struct TEvPurgeQueue : public NActors::TEventLocal<TEvPurgeQueue, EvPurgeQueue> {
/// Queue path in the catalog
- TQueuePath QueuePath;
+ TQueuePath QueuePath;
/// All messages must be deleted until this timestamp
- TInstant Boundary;
- ui64 Shard;
-
+ TInstant Boundary;
+ ui64 Shard;
+
TEvPurgeQueue() = default;
-
- TEvPurgeQueue(const TEvPurgeQueue& other)
+
+ TEvPurgeQueue(const TEvPurgeQueue& other)
: QueuePath(other.QueuePath)
- , Boundary(other.Boundary)
- , Shard(other.Shard)
- {
- }
- };
-
+ , Boundary(other.Boundary)
+ , Shard(other.Shard)
+ {
+ }
+ };
+
// Request that is sent from proxy to sqs service actor on other (leader) node
struct TEvSqsRequest : public NActors::TEventPB<TEvSqsRequest, NKikimrClient::TSqsRequest, EvSqsRequest> {
using TEventPB::TEventPB;
@@ -885,6 +885,6 @@ struct TSqsEvents {
TString Name;
ui64 Type;
};
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/executor.cpp b/ydb/core/ymq/actor/executor.cpp
index e17dc68fe9..20851215ce 100644
--- a/ydb/core/ymq/actor/executor.cpp
+++ b/ydb/core/ymq/actor/executor.cpp
@@ -1,7 +1,7 @@
-#include "executor.h"
+#include "executor.h"
#include "log.h"
#include "cfg.h"
-
+
#include <ydb/core/protos/tx_proxy.pb.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
@@ -13,12 +13,12 @@
#include <ydb/library/yql/minikql/mkql_node_serialization.h>
#include <ydb/library/yql/public/issue/yql_issue_message.h>
-
+
#include <util/generic/ptr.h>
#include <util/generic/utility.h>
namespace NKikimr::NSQS {
-
+
constexpr ui64 EXECUTE_RETRY_WAKEUP_TAG = 1;
constexpr ui64 COMPILE_RETRY_WAKEUP_TAG = 2;
@@ -115,32 +115,32 @@ const char* TExecutorBuilder::GetQueryById(size_t idx) {
return query;
}
-TMiniKqlExecutionActor::TMiniKqlExecutionActor(
+TMiniKqlExecutionActor::TMiniKqlExecutionActor(
const TActorId sender,
TString requestId,
- THolder<TRequest> req,
+ THolder<TRequest> req,
bool retryOnTimeout,
const TQueuePath& path, // queue or user
const TIntrusivePtr<TTransactionCounters>& counters,
TSqsEvents::TExecutedCallback cb)
- : Sender_(sender)
+ : Sender_(sender)
, RequestId_(std::move(requestId))
- , Cb_(cb)
- , Request_(std::move(req))
+ , Cb_(cb)
+ , Request_(std::move(req))
, Counters_(counters)
, QueuePath_(path)
, RetryOnTimeout_(retryOnTimeout)
-{
+{
DebugInfo->ExecutorActors.emplace(RequestId_, this);
-}
-
+}
+
TMiniKqlExecutionActor::~TMiniKqlExecutionActor() {
DebugInfo->ExecutorActors.EraseKeyValue(RequestId_, this);
}
void TMiniKqlExecutionActor::Bootstrap() {
StartTs_ = TActivationContext::Now();
-
+
auto& transaction = *Request_->Record.MutableTransaction();
if (RequestId_) {
transaction.SetUserRequestId(RequestId_);
@@ -171,57 +171,57 @@ void TMiniKqlExecutionActor::Bootstrap() {
LogRequestDuration();
PassAway();
return;
- }
- }
-
- if (mkqlTx.HasProgram() && mkqlTx.GetProgram().HasText()) {
- MkqlProgramText_ = mkqlTx.GetProgram().GetText();
+ }
+ }
+
+ if (mkqlTx.HasProgram() && mkqlTx.GetProgram().HasText()) {
+ MkqlProgramText_ = mkqlTx.GetProgram().GetText();
const bool compileMode = mkqlTx.GetMode() == NKikimrTxUserProxy::TMiniKQLTransaction::COMPILE;
Mode_ = compileMode ? EMode::Compile : EMode::CompileAndExec;
CompileProgram(compileMode);
- } else {
+ } else {
Mode_ = EMode::Exec;
ProceedWithExecution();
- }
-
- Become(&TMiniKqlExecutionActor::AwaitState);
-}
-
+ }
+
+ Become(&TMiniKqlExecutionActor::AwaitState);
+}
+
void TMiniKqlExecutionActor::CompileProgram(bool forceRefresh) {
- auto compileEv = MakeHolder<TMiniKQLCompileServiceEvents::TEvCompile>(MkqlProgramText_);
- compileEv->ForceRefresh = forceRefresh;
- if (!CompileResolveCookies_.empty()) {
- compileEv->CompileResolveCookies = std::move(CompileResolveCookies_);
- }
+ auto compileEv = MakeHolder<TMiniKQLCompileServiceEvents::TEvCompile>(MkqlProgramText_);
+ compileEv->ForceRefresh = forceRefresh;
+ if (!CompileResolveCookies_.empty()) {
+ compileEv->CompileResolveCookies = std::move(CompileResolveCookies_);
+ }
RLOG_SQS_TRACE(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " Compile program: " << MkqlProgramText_);
Send(MakeMiniKQLCompileServiceID(), compileEv.Release());
- CompilationPending_ = true;
+ CompilationPending_ = true;
INC_COUNTER(Counters_, CompileQueryCount);
-}
-
+}
+
void TMiniKqlExecutionActor::ProceedWithExecution() {
- if (!CompilationPending_) {
- THolder<TRequest> ev = MakeHolder<TRequest>();
- ev->Record.CopyFrom(Request_->Record);
-
+ if (!CompilationPending_) {
+ THolder<TRequest> ev = MakeHolder<TRequest>();
+ ev->Record.CopyFrom(Request_->Record);
+
RLOG_SQS_TRACE(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " Execute program: " << ev->Record << ". Params: " << MiniKQLParamsToString(ProtoParamsForDebug));
StartExecutionTs_ = TActivationContext::Now();
Send(MakeTxProxyID(), std::move(ev));
++AttemptNumber_;
INC_COUNTER(Counters_, TransactionsInfly);
- }
-}
-
+ }
+}
+
void TMiniKqlExecutionActor::HandleCompile(TMiniKQLCompileServiceEvents::TEvCompileStatus::TPtr& ev) {
if (Mode_ == EMode::CompileAndExec) {
const TDuration duration = TActivationContext::Now() - StartTs_;
RLOG_SQS_DEBUG(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " Compilation duration: " << duration.MilliSeconds() << "ms");
}
- const auto& result = ev->Get()->Result;
- auto& mkqlTx = *Request_->Record.MutableTransaction()->MutableMiniKQLTransaction();
-
- if (!result.Errors.Empty()) {
+ const auto& result = ev->Get()->Result;
+ auto& mkqlTx = *Request_->Record.MutableTransaction()->MutableMiniKQLTransaction();
+
+ if (!result.Errors.Empty()) {
const TString errors = result.Errors.ToString();
RLOG_SQS_ERROR(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " Errors while compiling program: " << errors << ", program text: " << MkqlProgramText_);
@@ -248,32 +248,32 @@ void TMiniKqlExecutionActor::HandleCompile(TMiniKQLCompileServiceEvents::TEvComp
LogRequestDuration();
PassAway();
}
- return;
+ return;
} else {
PrevAttemptWaitTime_ = TDuration::Zero();
- }
-
- if (mkqlTx.GetMode() == NKikimrTxUserProxy::TMiniKQLTransaction::COMPILE) {
- NKikimrTxUserProxy::TEvProposeTransactionStatus resp;
- resp.SetStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete);
- resp.MutableMiniKQLCompileResults()->SetCompiledProgram(result.CompiledProgram);
+ }
+
+ if (mkqlTx.GetMode() == NKikimrTxUserProxy::TMiniKQLTransaction::COMPILE) {
+ NKikimrTxUserProxy::TEvProposeTransactionStatus resp;
+ resp.SetStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete);
+ resp.MutableMiniKQLCompileResults()->SetCompiledProgram(result.CompiledProgram);
RLOG_SQS_TRACE(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " Compile program response: " << resp);
Send(Sender_, MakeHolder<TSqsEvents::TEvExecuted>(resp, Cb_, ui64(0)));
LogRequestDuration();
PassAway();
- return;
- }
-
- auto& pgm = *mkqlTx.MutableProgram();
- pgm.ClearText();
- pgm.SetBin(result.CompiledProgram);
-
- CompileResolveCookies_ = std::move(ev->Get()->CompileResolveCookies);
-
- CompilationPending_ = false;
+ return;
+ }
+
+ auto& pgm = *mkqlTx.MutableProgram();
+ pgm.ClearText();
+ pgm.SetBin(result.CompiledProgram);
+
+ CompileResolveCookies_ = std::move(ev->Get()->CompileResolveCookies);
+
+ CompilationPending_ = false;
ProceedWithExecution();
-}
-
+}
+
template<typename TKikimrResultRecord>
bool TMiniKqlExecutionActor::ShouldRetryOnFail(const TKikimrResultRecord& record) const {
const auto status = NKikimr::NTxProxy::TResultStatus::EStatus(record.GetStatus());
@@ -284,7 +284,7 @@ bool TMiniKqlExecutionActor::ShouldRetryOnFail(const TKikimrResultRecord& record
void TMiniKqlExecutionActor::HandleResponse(TResponse::TPtr& ev) {
const TDuration executionDuration = TActivationContext::Now() - StartExecutionTs_;
- auto& response = *ev->Get();
+ auto& response = *ev->Get();
auto& record = response.Record;
const auto status = NKikimr::NTxProxy::TResultStatus::EStatus(record.GetStatus());
RLOG_SQS_TRACE(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " HandleResponse " << record);
@@ -296,18 +296,18 @@ void TMiniKqlExecutionActor::HandleResponse(TResponse::TPtr& ev) {
Counters_->QueryTypeCounters[*QueryId_].TransactionsCount->Inc();
}
}
-
- const bool resolveError =
- status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError ||
- status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyShardNotAvailable;
-
+
+ const bool resolveError =
+ status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError ||
+ status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyShardNotAvailable;
+
if (resolveError && CompilationRetries_ > 0 && !MkqlProgramText_.empty()) {
RLOG_SQS_INFO(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " Resolve error. Retrying mkql request");
--CompilationRetries_;
ScheduleRetry(true);
- return;
- }
-
+ return;
+ }
+
bool retryableError = false;
bool failed = false;
if (status != TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete
@@ -356,8 +356,8 @@ void TMiniKqlExecutionActor::HandleResponse(TResponse::TPtr& ev) {
PassAway();
}
}
-}
-
+}
+
void TMiniKqlExecutionActor::HandleWakeup(TEvWakeup::TPtr& ev) {
Y_VERIFY(ev->Get()->Tag != 0);
switch (ev->Get()->Tag) {
diff --git a/ydb/core/ymq/actor/executor.h b/ydb/core/ymq/actor/executor.h
index 5dd51c6da2..befb9ffa05 100644
--- a/ydb/core/ymq/actor/executor.h
+++ b/ydb/core/ymq/actor/executor.h
@@ -1,23 +1,23 @@
-#pragma once
+#pragma once
#include "defs.h"
-#include "events.h"
-
+#include "events.h"
+
#include <ydb/core/base/tablet_pipe.h>
#include <ydb/core/client/minikql_compile/mkql_compile_service.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/ymq/actor/params.h>
#include <ydb/core/ymq/base/counters.h>
-
+
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/actor.h>
#include <library/cpp/actors/core/hfunc.h>
#include <library/cpp/monlib/dynamic_counters/counters.h>
-
-#include <util/generic/hash.h>
+
+#include <util/generic/hash.h>
#include <util/generic/maybe.h>
-
+
namespace NKikimr::NSQS {
-
+
// Builds transaction request and properly executes it
// Can either send TEvExecute to queue leader or create execution actor.
class TExecutorBuilder {
@@ -145,26 +145,26 @@ private:
TIntrusivePtr<TTransactionCounters> TransactionCounters_;
};
-class TMiniKqlExecutionActor
+class TMiniKqlExecutionActor
: public TActorBootstrapped<TMiniKqlExecutionActor>
-{
- using TRequest = TEvTxUserProxy::TEvProposeTransaction;
- using TResponse = TEvTxUserProxy::TEvProposeTransactionStatus;
-
-public:
- TMiniKqlExecutionActor(
+{
+ using TRequest = TEvTxUserProxy::TEvProposeTransaction;
+ using TResponse = TEvTxUserProxy::TEvProposeTransactionStatus;
+
+public:
+ TMiniKqlExecutionActor(
const TActorId sender,
TString requestId,
- THolder<TRequest> req,
+ THolder<TRequest> req,
bool retryOnTimeout,
const TQueuePath& path, // queue or user
const TIntrusivePtr<TTransactionCounters>& counters,
TSqsEvents::TExecutedCallback cb = TSqsEvents::TExecutedCallback());
-
+
~TMiniKqlExecutionActor();
void Bootstrap();
-
+
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::SQS_EXECUTOR_ACTOR;
}
@@ -173,27 +173,27 @@ public:
QueryId_ = queryId;
}
-private:
+private:
void CompileProgram(bool forceRefresh);
-
+
void ProceedWithExecution();
-
+
TString GetRequestType() const;
TString GetActionType() const;
void LogRequestDuration();
-private:
+private:
STATEFN(AwaitState) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvTxUserProxy::TEvProposeTransactionStatus, HandleResponse);
hFunc(TMiniKQLCompileServiceEvents::TEvCompileStatus, HandleCompile);
hFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, HandleResult);
hFunc(TEvTabletPipe::TEvClientDestroyed, HandlePipeClientDisconnected);
hFunc(TEvTabletPipe::TEvClientConnected, HandlePipeClientConnected);
hFunc(TEvWakeup, HandleWakeup);
- }
- }
-
+ }
+ }
+
void PassAway();
void HandleCompile(TMiniKQLCompileServiceEvents::TEvCompileStatus::TPtr& ev);
@@ -206,14 +206,14 @@ private:
void HandleResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev);
void HandlePipeClientConnected(TEvTabletPipe::TEvClientConnected::TPtr& ev);
void HandlePipeClientDisconnected(TEvTabletPipe::TEvClientDestroyed::TPtr& ev);
-
+
TDuration NextAttemptWaitDuration() const;
void ScheduleRetry(bool compilation);
bool RetryTimeoutExpired();
void WaitForCompletion(bool retry = false);
-private:
+private:
enum class EMode {
Compile,
Exec,
@@ -223,11 +223,11 @@ private:
private:
const TActorId Sender_;
const TString RequestId_;
- const TSqsEvents::TExecutedCallback Cb_;
- THolder<TRequest> Request_;
- TString MkqlProgramText_;
+ const TSqsEvents::TExecutedCallback Cb_;
+ THolder<TRequest> Request_;
+ TString MkqlProgramText_;
THashMap<TString, ui64> CompileResolveCookies_;
- bool CompilationPending_ = false;
+ bool CompilationPending_ = false;
size_t CompilationRetries_ = 3;
TMaybe<EQueryId> QueryId_; // information for logging
TInstant StartTs_;
@@ -243,6 +243,6 @@ private:
// Waiting for transaction to complete
TResponse::TPtr ResponseEvent_;
TActorId TabletPipeClient_;
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/get_queue_attributes.cpp b/ydb/core/ymq/actor/get_queue_attributes.cpp
index 28dc67b14f..479b082db9 100644
--- a/ydb/core/ymq/actor/get_queue_attributes.cpp
+++ b/ydb/core/ymq/actor/get_queue_attributes.cpp
@@ -1,22 +1,22 @@
-#include "action.h"
+#include "action.h"
#include "common_batch_actor.h"
#include "error.h"
#include "executor.h"
#include "log.h"
-#include "params.h"
-#include "serviceid.h"
-
+#include "params.h"
+#include "serviceid.h"
+
#include <ydb/core/ymq/base/constants.h>
#include <ydb/core/ymq/base/limits.h>
#include <ydb/core/ymq/base/dlq_helpers.h>
#include <ydb/public/lib/value/value.h>
-
-#include <util/string/cast.h>
-
-using NKikimr::NClient::TValue;
-
+
+#include <util/string/cast.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
+
struct TAttributeInfo {
bool NeedRuntimeAttributes = false;
bool NeedAttributesTable = false;
@@ -40,20 +40,20 @@ static const std::map<TString, TAttributeInfo> AttributesInfo = {
{ "QueueArn", { false, false, true, false } },
};
-class TGetQueueAttributesActor
- : public TActionActor<TGetQueueAttributesActor>
-{
-public:
+class TGetQueueAttributesActor
+ : public TActionActor<TGetQueueAttributesActor>
+{
+public:
TGetQueueAttributesActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::GetQueueAttributes, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutableGetQueueAttributes()->SetRequestId(RequestId_);
+ Response_.MutableGetQueueAttributes()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
-
-private:
+ }
+
+private:
bool ExpandNames() {
if (!Request().NamesSize()) {
return false;
@@ -61,7 +61,7 @@ private:
bool all = false;
for (const auto& name : Request().names()) {
- if (name == "All") {
+ if (name == "All") {
all = true;
} else {
const auto info = AttributesInfo.find(name);
@@ -82,39 +82,39 @@ private:
AttributesSet_.insert(name);
}
}
-
+
if (all) {
const bool isFifo = IsFifoQueue();
for (const auto& [name, props] : AttributesInfo) {
if (!props.FifoOnly || isFifo) {
AttributesSet_.insert(name);
}
- }
+ }
NeedRuntimeAttributes_ = true;
NeedAttributesTable_ = true;
NeedArn_ = true;
- }
+ }
return true;
- }
-
-private:
- bool HasAttributeName(const TStringBuf name) const {
+ }
+
+private:
+ bool HasAttributeName(const TStringBuf name) const {
return IsIn(AttributesSet_, name);
- }
-
+ }
+
TString MakeQueueArn(const TString& prefix, const TString& region, const TString& account, const TString& queueName) const {
return Join(":", prefix, region, account, queueName);
}
- bool DoValidate() override {
- if (!GetQueueName()) {
+ bool DoValidate() override {
+ if (!GetQueueName()) {
MakeError(Response_.MutableGetQueueAttributes(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
-
- return true;
- }
-
+ return false;
+ }
+
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableGetQueueAttributes()->MutableError();
}
@@ -126,8 +126,8 @@ private:
}
void DoAction() override {
- Become(&TThis::StateFunc);
-
+ Become(&TThis::StateFunc);
+
if (!ExpandNames()) {
SendReplyAndDie();
return;
@@ -145,11 +145,11 @@ private:
.Start();
++WaitCount_;
}
-
+
if (NeedRuntimeAttributes_) {
Send(QueueLeader_, MakeHolder<TSqsEvents::TEvGetRuntimeQueueAttributes>(RequestId_));
++WaitCount_;
- }
+ }
if (NeedArn_) {
if (IsCloud()) {
@@ -162,30 +162,30 @@ private:
}
ReplyIfReady();
- }
-
- TString DoGetQueueName() const override {
+ }
+
+ TString DoGetQueueName() const override {
return Request().GetQueueName();
- }
-
+ }
+
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
hFunc(TSqsEvents::TEvGetRuntimeQueueAttributesResponse, HandleRuntimeAttributes);
hFunc(TSqsEvents::TEvQueueFolderIdAndCustomName, HandleQueueFolderIdAndCustomName);
- }
- }
-
+ }
+ }
+
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
const auto& record = ev->Get()->Record;
const ui32 status = record.GetStatus();
auto* result = Response_.MutableGetQueueAttributes();
-
- if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete) {
- const TValue val(TValue::Create(record.GetExecutionEngineEvaluatedResponse()));
+
+ if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete) {
+ const TValue val(TValue::Create(record.GetExecutionEngineEvaluatedResponse()));
const TValue& attrs(val["attrs"]);
-
+
if (HasAttributeName("ContentBasedDeduplication")) {
result->SetContentBasedDeduplication(bool(attrs["ContentBasedDeduplication"]));
}
@@ -223,21 +223,21 @@ private:
SendReplyAndDie();
return;
}
-
+
--WaitCount_;
ReplyIfReady();
}
-
+
void HandleRuntimeAttributes(TSqsEvents::TEvGetRuntimeQueueAttributesResponse::TPtr& ev) {
auto* result = Response_.MutableGetQueueAttributes();
-
+
if (ev->Get()->Failed) {
RLOG_SQS_ERROR("Get runtime queue attributes failed");
MakeError(result, NErrors::INTERNAL_FAILURE);
SendReplyAndDie();
return;
- }
-
+ }
+
if (HasAttributeName("CreatedTimestamp")) {
result->SetCreatedTimestamp(ev->Get()->CreatedTimestamp.Seconds());
}
@@ -250,7 +250,7 @@ private:
if (HasAttributeName("ApproximateNumberOfMessagesDelayed")) {
result->SetApproximateNumberOfMessagesDelayed(ev->Get()->MessagesDelayed);
}
-
+
--WaitCount_;
ReplyIfReady();
}
@@ -263,7 +263,7 @@ private:
MakeError(result, NErrors::INTERNAL_FAILURE);
SendReplyAndDie();
return;
- }
+ }
if (NeedArn_) {
result->SetQueueArn(MakeQueueArn(cloudArnPrefix, Cfg().GetYandexCloudServiceRegion(), ev->Get()->QueueFolderId, ev->Get()->QueueCustomName));
@@ -271,20 +271,20 @@ private:
--WaitCount_;
ReplyIfReady();
- }
-
+ }
+
const TGetQueueAttributesRequest& Request() const {
return SourceSqsRequest_.GetGetQueueAttributes();
}
-private:
+private:
THashSet<TString> AttributesSet_;
bool NeedRuntimeAttributes_ = false;
bool NeedAttributesTable_ = false;
bool NeedArn_ = false;
size_t WaitCount_ = 0;
-};
-
+};
+
class TGetQueueAttributesBatchActor
: public TCommonBatchActor<TGetQueueAttributesBatchActor>
{
@@ -355,8 +355,8 @@ private:
IActor* CreateGetQueueAttributesActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TGetQueueAttributesActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
IActor* CreateGetQueueAttributesBatchActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TGetQueueAttributesBatchActor(sourceSqsRequest, std::move(cb));
}
diff --git a/ydb/core/ymq/actor/get_queue_url.cpp b/ydb/core/ymq/actor/get_queue_url.cpp
index 95554d7bb0..63c77d8bc5 100644
--- a/ydb/core/ymq/actor/get_queue_url.cpp
+++ b/ydb/core/ymq/actor/get_queue_url.cpp
@@ -1,66 +1,66 @@
-#include "action.h"
+#include "action.h"
#include "error.h"
#include "log.h"
-#include "params.h"
-#include "serviceid.h"
-
+#include "params.h"
+#include "serviceid.h"
+
#include <ydb/public/lib/value/value.h>
#include <ydb/core/ymq/actor/executor.h>
-
-#include <util/string/join.h>
-#include <util/string/printf.h>
-
-using NKikimr::NClient::TValue;
-
+
+#include <util/string/join.h>
+#include <util/string/printf.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TGetQueueUrlActor
- : public TActionActor<TGetQueueUrlActor>
-{
-public:
+
+class TGetQueueUrlActor
+ : public TActionActor<TGetQueueUrlActor>
+{
+public:
TGetQueueUrlActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::GetQueueUrl, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutableGetQueueUrl()->SetRequestId(RequestId_);
+ Response_.MutableGetQueueUrl()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
-
+ }
+
static constexpr bool NeedExistingQueue() {
return false;
}
-private:
- bool DoValidate() override {
- if (!GetQueueName()) {
+private:
+ bool DoValidate() override {
+ if (!GetQueueName()) {
MakeError(MutableErrorDesc(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
-
- return true;
- }
-
+ return false;
+ }
+
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableGetQueueUrl()->MutableError();
}
void DoAction() override {
- Become(&TThis::StateFunc);
+ Become(&TThis::StateFunc);
Send(MakeSqsServiceID(SelfId().NodeId()), new TSqsEvents::TEvGetQueueId(RequestId_, UserName_, Request().GetQueueName(), FolderId_));
- }
-
- TString DoGetQueueName() const override {
+ }
+
+ TString DoGetQueueName() const override {
return Request().GetQueueName();
- }
-
+ }
+
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvQueueId, HandleQueueId);
- }
- }
-
+ }
+ }
+
void HandleQueueId(TSqsEvents::TEvQueueId::TPtr& ev) {
if (ev->Get()->Failed) {
RLOG_SQS_WARN("Get queue id failed");
@@ -73,21 +73,21 @@ private:
} else {
result->SetQueueUrl(MakeQueueUrl(ev->Get()->QueueId));
}
- } else {
+ } else {
MakeError(MutableErrorDesc(), NErrors::NON_EXISTENT_QUEUE);
- }
- }
-
+ }
+ }
+
SendReplyAndDie();
- }
-
+ }
+
const TGetQueueUrlRequest& Request() const {
return SourceSqsRequest_.GetGetQueueUrl();
}
-};
-
+};
+
IActor* CreateGetQueueUrlActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TGetQueueUrlActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/list_queues.cpp b/ydb/core/ymq/actor/list_queues.cpp
index 25ae108376..4818745f48 100644
--- a/ydb/core/ymq/actor/list_queues.cpp
+++ b/ydb/core/ymq/actor/list_queues.cpp
@@ -1,38 +1,38 @@
-#include "action.h"
+#include "action.h"
#include "error.h"
#include "log.h"
#include "params.h"
-#include "serviceid.h"
+#include "serviceid.h"
#include "executor.h"
-
+
#include <ydb/public/lib/value/value.h>
-
-#include <util/string/ascii.h>
-#include <util/string/cast.h>
-#include <util/string/join.h>
-
-using NKikimr::NClient::TValue;
-
+
+#include <util/string/ascii.h>
+#include <util/string/cast.h>
+#include <util/string/join.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TListQueuesActor
- : public TActionActor<TListQueuesActor>
-{
-public:
+
+class TListQueuesActor
+ : public TActionActor<TListQueuesActor>
+{
+public:
static constexpr bool NeedExistingQueue() {
return false;
}
TListQueuesActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::ListQueues, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutableListQueues()->SetRequestId(RequestId_);
+ Response_.MutableListQueues()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
-
-private:
+ }
+
+private:
TError* MutableErrorDesc() override {
return Response_.MutableListQueues()->MutableError();
}
@@ -47,8 +47,8 @@ private:
.Utf8("FOLDERID", FolderId_)
.Utf8("USER_NAME", UserName_)
.ParentBuilder().Start();
- }
-
+ }
+
void DoAction() override {
Become(&TThis::StateFunc);
@@ -63,56 +63,56 @@ private:
DiscoverQueues();
}
- TString DoGetQueueName() const override {
- return TString();
- }
-
-private:
+ TString DoGetQueueName() const override {
+ return TString();
+ }
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
- }
- }
-
+ }
+ }
+
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
const auto& record = ev->Get()->Record;
auto* result = Response_.MutableListQueues();
-
+
if (ev->Get()->IsOk()) {
- const TValue val(TValue::Create(record.GetExecutionEngineEvaluatedResponse()));
- const TValue queues(val["queues"]);
+ const TValue val(TValue::Create(record.GetExecutionEngineEvaluatedResponse()));
+ const TValue queues(val["queues"]);
const TString prefix = Request().GetQueueNamePrefix();
-
- for (size_t i = 0; i < queues.Size(); ++i) {
- const TString name((TString(queues[i]["QueueName"])));
+
+ for (size_t i = 0; i < queues.Size(); ++i) {
+ const TString name((TString(queues[i]["QueueName"])));
const TString customQueueName((TString(queues[i]["CustomQueueName"])));
-
+
if (prefix.empty() || AsciiHasPrefix((IsCloud() ? customQueueName : name), prefix)) {
auto* item = result->AddQueues();
- item->SetQueueName(name);
+ item->SetQueueName(name);
if (IsCloud()) {
item->SetQueueUrl(MakeQueueUrl(TString::Join(name, '/', customQueueName)));
} else {
item->SetQueueUrl(MakeQueueUrl(name));
}
- }
- }
- } else {
+ }
+ }
+ } else {
RLOG_SQS_WARN("Request failed: " << record);
MakeError(result, NErrors::INTERNAL_FAILURE);
- }
-
+ }
+
SendReplyAndDie();
- }
-
+ }
+
const TListQueuesRequest& Request() const {
return SourceSqsRequest_.GetListQueues();
}
-};
-
+};
+
IActor* CreateListQueuesActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TListQueuesActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/list_users.cpp b/ydb/core/ymq/actor/list_users.cpp
index d653fc20a3..119efb6df3 100644
--- a/ydb/core/ymq/actor/list_users.cpp
+++ b/ydb/core/ymq/actor/list_users.cpp
@@ -1,72 +1,72 @@
-#include "action.h"
-
+#include "action.h"
+
#include <ydb/core/base/tablet_pipe.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/core/util/yverify_stream.h>
-
-#include <util/string/ascii.h>
-#include <util/string/vector.h>
-#include <util/string/cast.h>
-#include <util/string/join.h>
-
+
+#include <util/string/ascii.h>
+#include <util/string/vector.h>
+#include <util/string/cast.h>
+#include <util/string/join.h>
+
namespace NKikimr::NSQS {
-
-class TListUsersActor
- : public TActionActor<TListUsersActor>
-{
-public:
+
+class TListUsersActor
+ : public TActionActor<TListUsersActor>
+{
+public:
static constexpr bool NeedExistingQueue() {
return false;
}
TListUsersActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::ListUsers, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutableListUsers()->SetRequestId(RequestId_);
+ Response_.MutableListUsers()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
-
-private:
+ }
+
+private:
void PassAway() override {
TActionActor<TListUsersActor>::PassAway();
- }
-
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableListUsers()->MutableError();
}
void DoAction() override {
- Become(&TThis::StateFunc);
-
+ Become(&TThis::StateFunc);
+
auto proxy = MakeTxProxyID();
-
+
auto ev = MakeHolder<TEvTxUserProxy::TEvNavigate>();
ev->Record.MutableDescribePath()->SetPath(Cfg().GetRoot());
-
+
RLOG_SQS_TRACE("TListUsersActor generate request."
<< ". Proxy actor: " << proxy
<< ". TEvNavigate: " << ev->Record.ShortDebugString());
-
+
Send(proxy, ev.Release());
- }
-
- TString DoGetQueueName() const override {
- return TString();
- }
-
-private:
+ }
+
+ TString DoGetQueueName() const override {
+ return TString();
+ }
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleDescribeSchemeResult);
- }
- }
-
+ }
+ }
+
void HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
- const auto& record = ev->Get()->GetRecord();
- const auto& desc = record.GetPathDescription();
+ const auto& record = ev->Get()->GetRecord();
+ const auto& desc = record.GetPathDescription();
if (record.GetStatus() != NKikimrScheme::StatusSuccess) {
RLOG_SQS_CRIT("No error handler at TListUsersActor in HandleDescribeSchemeResult"
@@ -76,25 +76,25 @@ private:
}
const TString prefix = Request().GetUserNamePrefix();
-
- for (const auto& child : desc.children()) {
+
+ for (const auto& child : desc.children()) {
if (child.GetPathType() == NKikimrSchemeOp::EPathTypeDir) {
- if (prefix.empty() || AsciiHasPrefix(child.GetName(), prefix)) {
- Response_.MutableListUsers()->AddUserNames(child.GetName());
- }
- }
- }
-
+ if (prefix.empty() || AsciiHasPrefix(child.GetName(), prefix)) {
+ Response_.MutableListUsers()->AddUserNames(child.GetName());
+ }
+ }
+ }
+
SendReplyAndDie();
- }
-
+ }
+
const TListUsersRequest& Request() const {
return SourceSqsRequest_.GetListUsers();
}
-};
-
+};
+
IActor* CreateListUsersActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TListUsersActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/params.h b/ydb/core/ymq/actor/params.h
index abe1154c8d..848ec2fc0e 100644
--- a/ydb/core/ymq/actor/params.h
+++ b/ydb/core/ymq/actor/params.h
@@ -1,52 +1,52 @@
-#pragma once
+#pragma once
#include "defs.h"
-
+
#include <ydb/library/mkql_proto/protos/minikql.pb.h>
#include <ydb/public/lib/value/value.h>
-
-#include <util/generic/maybe.h>
-
+
+#include <util/generic/maybe.h>
+
namespace NKikimr::NSQS {
-
+
class TExecutorBuilder;
-class TParameters {
-public:
+class TParameters {
+public:
explicit TParameters(NKikimrMiniKQL::TParams* params, TExecutorBuilder* parent = nullptr)
- : Params_(params)
+ : Params_(params)
, Parent(parent)
- {
- Params_->MutableType()->SetKind(NKikimrMiniKQL::ETypeKind::Struct);
- }
-
+ {
+ Params_->MutableType()->SetKind(NKikimrMiniKQL::ETypeKind::Struct);
+ }
+
explicit TParameters(NKikimrMiniKQL::TParams& params, TExecutorBuilder* parent = nullptr)
: TParameters(&params, parent)
- {
- }
-
+ {
+ }
+
TExecutorBuilder& ParentBuilder() {
Y_VERIFY(Parent);
return *Parent;
}
TParameters& Bool(const TString& name, const bool value) {
- DataType(name, NScheme::NTypeIds::Bool);
- Params_->MutableValue()->AddStruct()->SetBool(value);
- return *this;
- }
-
+ DataType(name, NScheme::NTypeIds::Bool);
+ Params_->MutableValue()->AddStruct()->SetBool(value);
+ return *this;
+ }
+
TParameters& String(const TString& name, const TString& value) {
- DataType(name, NScheme::NTypeIds::String);
- Params_->MutableValue()->AddStruct()->SetBytes(value);
- return *this;
- }
-
+ DataType(name, NScheme::NTypeIds::String);
+ Params_->MutableValue()->AddStruct()->SetBytes(value);
+ return *this;
+ }
+
TParameters& Uint64(const TString& name, ui64 value) {
- DataType(name, NScheme::NTypeIds::Uint64);
- Params_->MutableValue()->AddStruct()->SetUint64(value);
- return *this;
- }
-
+ DataType(name, NScheme::NTypeIds::Uint64);
+ Params_->MutableValue()->AddStruct()->SetUint64(value);
+ return *this;
+ }
+
TParameters& Uint32(const TString& name, ui32 value) {
DataType(name, NScheme::NTypeIds::Uint32);
Params_->MutableValue()->AddStruct()->SetUint32(value);
@@ -54,31 +54,31 @@ public:
}
TParameters& OptionalBool(const TString& name, const TMaybe<bool>& value) {
- OptionalDataType(name, NScheme::NTypeIds::Bool);
- if (value) {
- Params_->MutableValue()->AddStruct()->MutableOptional()->SetBool(*value);
- } else {
- Params_->MutableValue()->AddStruct();
- }
- return *this;
- }
-
+ OptionalDataType(name, NScheme::NTypeIds::Bool);
+ if (value) {
+ Params_->MutableValue()->AddStruct()->MutableOptional()->SetBool(*value);
+ } else {
+ Params_->MutableValue()->AddStruct();
+ }
+ return *this;
+ }
+
TParameters& OptionalUint64(const TString& name, const TMaybe<ui64>& value) {
- OptionalDataType(name, NScheme::NTypeIds::Uint64);
- if (value) {
- Params_->MutableValue()->AddStruct()->MutableOptional()->SetUint64(*value);
- } else {
- Params_->MutableValue()->AddStruct();
- }
- return *this;
- }
-
+ OptionalDataType(name, NScheme::NTypeIds::Uint64);
+ if (value) {
+ Params_->MutableValue()->AddStruct()->MutableOptional()->SetUint64(*value);
+ } else {
+ Params_->MutableValue()->AddStruct();
+ }
+ return *this;
+ }
+
TParameters& Utf8(const TString& name, const TString& value) {
- DataType(name, NScheme::NTypeIds::Utf8);
- Params_->MutableValue()->AddStruct()->SetText(value);
- return *this;
- }
-
+ DataType(name, NScheme::NTypeIds::Utf8);
+ Params_->MutableValue()->AddStruct()->SetText(value);
+ return *this;
+ }
+
TParameters& OptionalUtf8(const TString& name, const TMaybe<TString>& value) {
OptionalDataType(name, NScheme::NTypeIds::Utf8);
if (value) {
@@ -90,25 +90,25 @@ public:
return *this;
}
-private:
+private:
void DataType(const TString& name, NScheme::TTypeId typeId) {
auto* member = Params_->MutableType()->MutableStruct()->AddMember();
- member->SetName(name);
- member->MutableType()->SetKind(NKikimrMiniKQL::Data);
- member->MutableType()->MutableData()->SetScheme(typeId);
- }
-
+ member->SetName(name);
+ member->MutableType()->SetKind(NKikimrMiniKQL::Data);
+ member->MutableType()->MutableData()->SetScheme(typeId);
+ }
+
void OptionalDataType(const TString& name, NScheme::TTypeId typeId) {
auto* member = Params_->MutableType()->MutableStruct()->AddMember();
- member->SetName(name);
- member->MutableType()->SetKind(NKikimrMiniKQL::Optional);
- member->MutableType()->MutableOptional()->MutableItem()->SetKind(NKikimrMiniKQL::Data);
- member->MutableType()->MutableOptional()->MutableItem()->MutableData()->SetScheme(typeId);
- }
-
-private:
- NKikimrMiniKQL::TParams* const Params_;
+ member->SetName(name);
+ member->MutableType()->SetKind(NKikimrMiniKQL::Optional);
+ member->MutableType()->MutableOptional()->MutableItem()->SetKind(NKikimrMiniKQL::Data);
+ member->MutableType()->MutableOptional()->MutableItem()->MutableData()->SetScheme(typeId);
+ }
+
+private:
+ NKikimrMiniKQL::TParams* const Params_;
TExecutorBuilder* Parent = nullptr;
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/proxy_service.cpp b/ydb/core/ymq/actor/proxy_service.cpp
index 1eecd85103..fa3996de76 100644
--- a/ydb/core/ymq/actor/proxy_service.cpp
+++ b/ydb/core/ymq/actor/proxy_service.cpp
@@ -1,30 +1,30 @@
#include "actor.h"
-#include "executor.h"
+#include "executor.h"
#include "log.h"
#include "service.h"
#include "queue_leader.h"
-#include "params.h"
+#include "params.h"
#include "proxy_service.h"
-#include "serviceid.h"
-
+#include "serviceid.h"
+
#include <ydb/core/base/counters.h>
#include <ydb/core/ymq/base/debug_info.h>
#include <ydb/core/ymq/actor/actor.h>
#include <ydb/core/ymq/base/counters.h>
#include <ydb/core/ymq/base/secure_protobuf_printer.h>
-
+
#include <util/generic/hash.h>
#include <util/generic/hash_set.h>
-#include <util/generic/map.h>
-#include <util/generic/queue.h>
-
+#include <util/generic/map.h>
+#include <util/generic/queue.h>
+
#include <queue>
-using namespace NKikimrTxUserProxy;
-using NKikimr::NClient::TValue;
-
+using namespace NKikimrTxUserProxy;
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
+
struct TSqsProxyService::TNodeInfo : public TAtomicRefCount<TNodeInfo> {
explicit TNodeInfo(ui32 nodeId)
: NodeId(nodeId)
@@ -55,26 +55,26 @@ TSqsProxyService::TSqsProxyService() {
TSqsProxyService::~TSqsProxyService() {
DebugInfo->SqsProxyServiceActorPtr = nullptr;
}
-
+
void TSqsProxyService::Bootstrap() {
LOG_SQS_INFO("Start SQS proxy service actor");
- Become(&TThis::StateFunc);
-
+ Become(&TThis::StateFunc);
+
SqsCounters_ = GetSqsServiceCounters(AppData()->Counters, "core");
YmqPublicCounters_ = GetYmqPublicCounters(AppData()->Counters);
-}
-
+}
+
void TSqsProxyService::HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
ev->Get()->Call();
-}
-
+}
+
void TSqsProxyService::HandleSqsRequest(TSqsEvents::TEvSqsRequest::TPtr& ev) {
auto replier = MakeHolder<TReplierToSenderActorCallback>(ev);
const auto& request = replier->Request->Get()->Record;
RLOG_SQS_REQ_DEBUG(request.GetRequestId(), "Received Sqs Request: " << SecureShortUtf8DebugString(request));
Register(CreateActionActor(request, std::move(replier)));
}
-
+
void TSqsProxyService::HandleProxySqsRequest(TSqsEvents::TEvProxySqsRequest::TPtr& ev) {
TProxyRequestInfoRef request = new TProxyRequestInfo(std::move(ev));
RequestsToProxy_.emplace(request->RequestId, request);
@@ -114,8 +114,8 @@ void TSqsProxyService::HandleGetLeaderNodeForQueueResponse(TSqsEvents::TEvGetLea
} else {
SendProxyError(request, GetLeaderNodeForQueueStatusToProxyStatus(ev->Get()->Status));
}
-}
-
+}
+
void TSqsProxyService::HandleSqsResponse(TSqsEvents::TEvSqsResponse::TPtr& ev) {
LOG_SQS_TRACE("HandleSqsResponse " << SecureShortUtf8DebugString(ev->Get()->Record));
const ui32 nodeId = ev->Sender.NodeId();
diff --git a/ydb/core/ymq/actor/proxy_service.h b/ydb/core/ymq/actor/proxy_service.h
index a3c991105f..9904a04f6b 100644
--- a/ydb/core/ymq/actor/proxy_service.h
+++ b/ydb/core/ymq/actor/proxy_service.h
@@ -1,9 +1,9 @@
-#pragma once
+#pragma once
#include "defs.h"
#include "log.h"
-#include "events.h"
+#include "events.h"
#include <ydb/core/ymq/base/query_id.h>
-
+
#include <ydb/core/base/tablet_resolver.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/protos/config.pb.h>
@@ -14,14 +14,14 @@
#include <library/cpp/actors/core/interconnect.h>
#include <library/cpp/actors/core/event_pb.h>
#include <library/cpp/actors/core/hfunc.h>
-
-#include <util/generic/hash.h>
+
+#include <util/generic/hash.h>
#include <util/generic/hash_set.h>
-#include <util/generic/queue.h>
-#include <util/generic/vector.h>
-
+#include <util/generic/queue.h>
+#include <util/generic/vector.h>
+
namespace NKikimr::NSQS {
-
+
struct TReplierToSenderActorCallback : public IReplyCallback {
TReplierToSenderActorCallback(TSqsEvents::TEvSqsRequest::TPtr& ev)
: Request(ev)
@@ -46,7 +46,7 @@ struct TReplierToSenderActorCallback : public IReplyCallback {
class TSqsProxyService
: public TActorBootstrapped<TSqsProxyService>
-{
+{
public:
struct TNodeInfo;
using TNodeInfoRef = TIntrusivePtr<TNodeInfo>;
@@ -54,17 +54,17 @@ public:
struct TProxyRequestInfo;
using TProxyRequestInfoRef = TIntrusivePtr<TProxyRequestInfo>;
-public:
+public:
TSqsProxyService();
~TSqsProxyService();
-
+
void Bootstrap();
-
+
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::SQS_PROXY_SERVICE_ACTOR;
}
-private:
+private:
void SendProxyRequestToNode(TNodeInfo& nodeInfo, TProxyRequestInfoRef request);
TNodeInfoRef GetNodeInfo(ui32 nodeId);
@@ -72,7 +72,7 @@ private:
void SendProxyError(TProxyRequestInfoRef request, TSqsEvents::TEvProxySqsResponse::EProxyStatus proxyStatus);
void SendProxyErrors(TNodeInfo& nodeInfo, TSqsEvents::TEvProxySqsResponse::EProxyStatus proxyStatus);
-private:
+private:
STATEFN(StateFunc);
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev);
void HandleSqsRequest(TSqsEvents::TEvSqsRequest::TPtr& ev); // request from proxy
@@ -83,8 +83,8 @@ private:
void HandleUndelivered(TEvents::TEvUndelivered::TPtr& ev);
void HandleDisconnect(ui32 nodeId);
void HandleGetLeaderNodeForQueueResponse(TSqsEvents::TEvGetLeaderNodeForQueueResponse::TPtr& ev);
-
-private:
+
+private:
TIntrusivePtr<NMonitoring::TDynamicCounters> SqsCounters_;
TIntrusivePtr<NMonitoring::TDynamicCounters> YmqPublicCounters_;
@@ -92,6 +92,6 @@ private:
THashMap<ui32, TNodeInfoRef> NodesInfo_;
THashMap<TString, TProxyRequestInfoRef> RequestsToProxy_;
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/purge.cpp b/ydb/core/ymq/actor/purge.cpp
index aff713d784..b44bda648e 100644
--- a/ydb/core/ymq/actor/purge.cpp
+++ b/ydb/core/ymq/actor/purge.cpp
@@ -1,20 +1,20 @@
#include "log.h"
#include "cfg.h"
#include "executor.h"
-#include "params.h"
-#include "purge.h"
-#include "serviceid.h"
-
+#include "params.h"
+#include "purge.h"
+#include "serviceid.h"
+
#include <ydb/core/ymq/base/counters.h>
#include <ydb/core/ymq/base/debug_info.h>
#include <ydb/core/ymq/base/query_id.h>
-
-using NKikimr::NClient::TValue;
-
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
+
TPurgeActor::TPurgeActor(const TQueuePath& queuePath, TIntrusivePtr<TQueueCounters> counters, const TActorId& queueLeader, bool isFifo)
- : QueuePath_(queuePath)
+ : QueuePath_(queuePath)
, RequestId_(CreateGuidAsString())
, Counters_(std::move(counters))
, QueueLeader_(queueLeader)
@@ -22,16 +22,16 @@ TPurgeActor::TPurgeActor(const TQueuePath& queuePath, TIntrusivePtr<TQueueCounte
{
DebugInfo->QueuePurgeActors.emplace(TStringBuilder() << TLogQueueName(QueuePath_), this);
}
-
+
TPurgeActor::~TPurgeActor() {
DebugInfo->QueuePurgeActors.EraseKeyValue(TStringBuilder() << TLogQueueName(QueuePath_), this);
}
-
+
void TPurgeActor::Bootstrap() {
RLOG_SQS_INFO("Create purge actor for queue " << TString(QueuePath_));
- Become(&TThis::StateFunc);
-}
-
+ Become(&TThis::StateFunc);
+}
+
void TPurgeActor::MakeGetRetentionOffsetRequest(const ui64 shardId, TShard* shard) {
shard->KeysTruncated = false;
const TInstant boundary = shard->TargetBoundary;
@@ -160,7 +160,7 @@ void TPurgeActor::MakeStage2Request(ui64 cleanupVersion, const TValue& messages,
notification->NewMessagesCount = static_cast<ui64>(newMessagesCount);
Send(QueueLeader_, std::move(notification));
}
-
+
shard->BoundaryPurged = shard->CurrentLastMessage.SentTimestamp;
if (shard->KeysTruncated) {
MakeGetRetentionOffsetRequest(shardId, shard);
@@ -173,7 +173,7 @@ void TPurgeActor::MakeStage2Request(ui64 cleanupVersion, const TValue& messages,
shard->TargetBoundary = shard->BoundaryPurged;
}
};
-
+
TExecutorBuilder builder(SelfId(), RequestId_);
builder
.User(QueuePath_.UserName)
@@ -202,34 +202,34 @@ void TPurgeActor::MakeStage2Request(ui64 cleanupVersion, const TValue& messages,
}
builder.Start();
-}
-
+}
+
void TPurgeActor::HandlePurgeQueue(TSqsEvents::TEvPurgeQueue::TPtr& ev) {
- auto& shard = Shards_[ev->Get()->Shard];
-
+ auto& shard = Shards_[ev->Get()->Shard];
+
const char* skipReason = "";
if (ev->Get()->Boundary > shard.TargetBoundary) {
shard.TargetBoundary = ev->Get()->Boundary;
-
+
if (!shard.Purging) {
- shard.Purging = true;
+ shard.Purging = true;
MakeGetRetentionOffsetRequest(ev->Get()->Shard, &shard);
} else {
skipReason = ". Skipping (already purging)";
- }
+ }
} else {
skipReason = ". Skipping (old boundary)";
- }
+ }
RLOG_SQS_INFO("Purge queue request [" << QueuePath_ << "/" << ev->Get()->Shard << "] to " << ev->Get()->Boundary.MilliSeconds() << " (" << ev->Get()->Boundary << ")" << skipReason);
-}
-
+}
+
void TPurgeActor::HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
ev->Get()->Call();
-}
-
+}
+
void TPurgeActor::HandlePoisonPill(TEvPoisonPill::TPtr&) {
PassAway();
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/purge.h b/ydb/core/ymq/actor/purge.h
index 2a16a5aa24..ce76d589c9 100644
--- a/ydb/core/ymq/actor/purge.h
+++ b/ydb/core/ymq/actor/purge.h
@@ -1,20 +1,20 @@
-#pragma once
+#pragma once
#include "defs.h"
-#include "events.h"
-
+#include "events.h"
+
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/actor.h>
#include <library/cpp/actors/core/hfunc.h>
-
-#include <util/generic/map.h>
-
+
+#include <util/generic/map.h>
+
namespace NKikimr::NSQS {
-
+
class TPurgeActor : public TActorBootstrapped<TPurgeActor> {
- struct TShard {
+ struct TShard {
TInstant TargetBoundary = TInstant::Zero(); // Target state
TInstant BoundaryPurged = TInstant::Zero(); // Current state in database
- bool Purging = false;
+ bool Purging = false;
bool KeysTruncated = false;
struct TMessageBoundary {
@@ -24,45 +24,45 @@ class TPurgeActor : public TActorBootstrapped<TPurgeActor> {
std::pair<ui64, ui64> CurrentOffsets;
TMessageBoundary CurrentLastMessage;
TMessageBoundary PreviousSuccessfullyProcessedLastMessage;
- };
-
-public:
+ };
+
+public:
TPurgeActor(const TQueuePath& queuePath, TIntrusivePtr<TQueueCounters> counters, const TActorId& queueLeader, bool isFifo);
- ~TPurgeActor();
-
+ ~TPurgeActor();
+
void Bootstrap();
-
+
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::SQS_PURGE_ACTOR;
}
-private:
+private:
void MakeGetRetentionOffsetRequest(const ui64 shardId, TShard* shard);
void MakeStage1Request(const ui64 shardId, TShard* shard, const std::pair<ui64, ui64>& offsets);
void MakeStage2Request(ui64 cleanupVersion, const NClient::TValue& messages, const TMaybe<NClient::TValue>& inflyMessages, const ui64 shardId, TShard* shard);
-
-private:
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TSqsEvents::TEvPurgeQueue, HandlePurgeQueue);
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
hFunc(TEvPoisonPill, HandlePoisonPill);
- }
- }
-
+ }
+ }
+
void HandlePurgeQueue(TSqsEvents::TEvPurgeQueue::TPtr& ev);
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev);
void HandlePoisonPill(TEvPoisonPill::TPtr&);
-
-private:
- const TQueuePath QueuePath_;
+
+private:
+ const TQueuePath QueuePath_;
/// A state of shard processing
- TMap<ui64, TShard> Shards_;
+ TMap<ui64, TShard> Shards_;
const TString RequestId_;
TIntrusivePtr<TQueueCounters> Counters_;
TIntrusivePtr<NMonitoring::TCounterForPtr> PurgedMessagesCounter_;
const TActorId QueueLeader_;
const bool IsFifo_;
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/purge_queue.cpp b/ydb/core/ymq/actor/purge_queue.cpp
index 72830bdd4a..db16424493 100644
--- a/ydb/core/ymq/actor/purge_queue.cpp
+++ b/ydb/core/ymq/actor/purge_queue.cpp
@@ -1,47 +1,47 @@
-#include "action.h"
+#include "action.h"
#include "common_batch_actor.h"
#include "error.h"
#include "executor.h"
#include "log.h"
-#include "params.h"
-#include "serviceid.h"
-
-#include <util/string/join.h>
-
-using NKikimr::NClient::TValue;
-
+#include "params.h"
+#include "serviceid.h"
+
+#include <util/string/join.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TPurgeQueueActor
- : public TActionActor<TPurgeQueueActor>
-{
-public:
+
+class TPurgeQueueActor
+ : public TActionActor<TPurgeQueueActor>
+{
+public:
TPurgeQueueActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::PurgeQueue, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutablePurgeQueue()->SetRequestId(RequestId_);
+ Response_.MutablePurgeQueue()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
-
-private:
- bool DoValidate() override {
- if (!GetQueueName()) {
+ }
+
+private:
+ bool DoValidate() override {
+ if (!GetQueueName()) {
MakeError(Response_.MutablePurgeQueue(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
-
- return true;
- }
-
+ return false;
+ }
+
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutablePurgeQueue()->MutableError();
}
void DoAction() override {
- Become(&TThis::StateFunc);
-
+ Become(&TThis::StateFunc);
+
TExecutorBuilder(SelfId(), RequestId_)
.User(UserName_)
.Queue(GetQueueName())
@@ -53,53 +53,53 @@ private:
.Uint64("NOW", Now().MilliSeconds())
.Bool("PURGE", true)
.ParentBuilder().Start();
- }
-
- TString DoGetQueueName() const override {
+ }
+
+ TString DoGetQueueName() const override {
return Request().GetQueueName();
- }
-
+ }
+
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
- }
- }
-
+ }
+ }
+
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
const auto& record = ev->Get()->Record;
const ui32 status = record.GetStatus();
auto* result = Response_.MutablePurgeQueue();
-
- if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete) {
- const TValue val(TValue::Create(record.GetExecutionEngineEvaluatedResponse()));
+
+ if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete) {
+ const TValue val(TValue::Create(record.GetExecutionEngineEvaluatedResponse()));
const TValue list(val["result"]);
-
+
for (size_t i = 0; i < list.Size(); ++i) {
auto req = MakeHolder<TSqsEvents::TEvPurgeQueue>();
req->QueuePath = GetQueuePath();
req->Boundary = TInstant::MilliSeconds(ui64(list[i]["RetentionBoundary"]));
req->Shard = ui64(list[i]["Shard"]);
-
+
RLOG_SQS_INFO("Purging queue. Set retention boundary for queue [" << req->QueuePath << "/" << req->Shard << "] to " << req->Boundary.MilliSeconds() << " (" << req->Boundary << ")");
Send(QueueLeader_, std::move(req));
- }
- } else {
+ }
+ } else {
RLOG_SQS_ERROR("Failed to set retention boundary for queue [" << GetQueuePath() << "] while purging");
RLOG_SQS_ERROR("Request failed: " << record);
-
+
MakeError(result, NErrors::INTERNAL_FAILURE);
- }
-
+ }
+
SendReplyAndDie();
- }
-
+ }
+
const TPurgeQueueRequest& Request() const {
return SourceSqsRequest_.GetPurgeQueue();
}
-};
-
+};
+
class TPurgeQueueBatchActor
: public TCommonBatchActor<TPurgeQueueBatchActor>
{
@@ -169,8 +169,8 @@ private:
IActor* CreatePurgeQueueActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TPurgeQueueActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
IActor* CreatePurgeQueueBatchActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TPurgeQueueBatchActor(sourceSqsRequest, std::move(cb));
}
diff --git a/ydb/core/ymq/actor/receive_message.cpp b/ydb/core/ymq/actor/receive_message.cpp
index 2b5bf0e517..61f430ddf2 100644
--- a/ydb/core/ymq/actor/receive_message.cpp
+++ b/ydb/core/ymq/actor/receive_message.cpp
@@ -1,53 +1,53 @@
-#include "action.h"
+#include "action.h"
#include "attributes_md5.h"
#include "cfg.h"
#include "error.h"
#include "executor.h"
#include "log.h"
-#include "params.h"
-
+#include "params.h"
+
#include <ydb/core/ymq/base/limits.h>
#include <ydb/core/ymq/base/helpers.h>
#include <ydb/core/ymq/proto/records.pb.h>
#include <ydb/public/lib/value/value.h>
-
+
#include <library/cpp/digest/md5/md5.h>
#include <library/cpp/monlib/metrics/histogram_collector.h>
-
-using NKikimr::NClient::TValue;
-
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TReceiveMessageActor
- : public TActionActor<TReceiveMessageActor>
-{
-public:
+
+class TReceiveMessageActor
+ : public TActionActor<TReceiveMessageActor>
+{
+public:
static constexpr bool NeedQueueAttributes() {
return true;
}
TReceiveMessageActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::ReceiveMessage, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutableReceiveMessage()->SetRequestId(RequestId_);
+ Response_.MutableReceiveMessage()->SetRequestId(RequestId_);
CopySecurityToken(Request());
- }
-
-private:
+ }
+
+private:
TDuration GetVisibilityTimeout() const {
if (Request().HasVisibilityTimeout()) {
return TDuration::Seconds(Request().GetVisibilityTimeout());
} else {
return QueueAttributes_->VisibilityTimeout;
}
- }
-
+ }
+
TInstant WaitDeadline() const {
return StartTs_ + WaitTime_;
- }
-
+ }
+
bool MaybeScheduleWait() {
const TInstant waitDeadline = WaitDeadline();
const TInstant now = TActivationContext::Now();
@@ -59,17 +59,17 @@ private:
RLOG_SQS_DEBUG("Schedule wait for " << waitStep.MilliSeconds() << "ms");
Retried_ = true;
return true;
- } else {
+ } else {
return false;
- }
- }
-
- bool DoValidate() override {
- if (!GetQueueName()) {
+ }
+ }
+
+ bool DoValidate() override {
+ if (!GetQueueName()) {
MakeError(Response_.MutableReceiveMessage(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
-
+ return false;
+ }
+
const auto& cfg = Cfg();
if (Request().GetWaitTimeSeconds()
@@ -93,9 +93,9 @@ private:
return false;
}
- return true;
- }
-
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableReceiveMessage()->MutableError();
}
@@ -105,28 +105,28 @@ private:
return;
}
ParamsAreInited_ = true;
-
+
if (Request().HasWaitTimeSeconds()) {
WaitTime_ = TDuration::Seconds(Request().GetWaitTimeSeconds());
} else {
WaitTime_ = QueueAttributes_->ReceiveMessageWaitTime;
}
- if (IsFifoQueue()) {
+ if (IsFifoQueue()) {
if (Request().GetReceiveRequestAttemptId()) {
ReceiveAttemptId_ = Request().GetReceiveRequestAttemptId();
- } else {
+ } else {
ReceiveAttemptId_ = CreateGuidAsString();
- }
+ }
}
-
+
MaxMessagesCount_ = ClampVal(static_cast<size_t>(Request().GetMaxNumberOfMessages()), TLimits::MinBatchSize, TLimits::MaxBatchSize);
}
-
+
void DoAction() override {
Become(&TThis::StateFunc);
Y_VERIFY(QueueAttributes_.Defined());
-
+
InitParams();
auto receiveRequest = MakeHolder<TSqsEvents::TEvReceiveMessageBatch>();
@@ -136,35 +136,35 @@ private:
receiveRequest->VisibilityTimeout = GetVisibilityTimeout();
if (WaitTime_) {
receiveRequest->WaitDeadline = WaitDeadline();
- }
+ }
Send(QueueLeader_, std::move(receiveRequest));
- }
-
- TString DoGetQueueName() const override {
+ }
+
+ TString DoGetQueueName() const override {
return Request().GetQueueName();
- }
-
- void DoFinish() override {
+ }
+
+ void DoFinish() override {
if (auto* detailedCounters = QueueCounters_ ? QueueCounters_->GetDetailedCounters() : nullptr; !Retried_ && detailedCounters) {
const TDuration duration = GetRequestDuration();
COLLECT_HISTOGRAM_COUNTER(detailedCounters, ReceiveMessageImmediate_Duration, duration.MilliSeconds());
}
- }
-
+ }
+
private:
STATEFN(StateFunc) {
switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvReceiveMessageBatchResponse, HandleReceiveMessageBatchResponse);
- }
- }
-
+ }
+ }
+
void HandleReceiveMessageBatchResponse(TSqsEvents::TEvReceiveMessageBatchResponse::TPtr& ev) {
if (ev->Get()->Retried) {
Retried_ = true;
- }
-
+ }
+
if (ev->Get()->Failed) {
MakeError(Response_.MutableReceiveMessage(), NErrors::INTERNAL_FAILURE);
} else if (ev->Get()->OverLimit) {
@@ -192,8 +192,8 @@ private:
if (attrs.ParseFromString(message.MessageAttributes)) {
for (auto& a : *attrs.MutableAttributes()) {
item->AddMessageAttributes()->Swap(&a);
- }
- }
+ }
+ }
if (item->MessageAttributesSize() > 0) {
const TString md5 = CalcMD5OfMessageAttributes(item->GetMessageAttributes());
item->SetMD5OfMessageAttributes(md5);
@@ -217,18 +217,18 @@ private:
}
if (ev->Get()->Messages.empty()) {
INC_COUNTER_COUPLE(QueueCounters_, ReceiveMessage_EmptyCount, empty_receive_attempts_count_per_second);
- }
- }
+ }
+ }
SendReplyAndDie();
- }
-
+ }
+
bool HandleWakeup(TEvWakeup::TPtr& ev) override {
if (!TActionActor::HandleWakeup(ev)) {
DoAction();
}
return true;
- }
-
+ }
+
TDuration GetRequestWaitDuration() const override {
return TotalWaitDuration_;
}
@@ -249,17 +249,17 @@ private:
return SourceSqsRequest_.GetReceiveMessage();
}
-private:
+private:
TString ReceiveAttemptId_;
bool Retried_ = false;
TDuration WaitTime_ = TDuration::Zero();
bool ParamsAreInited_ = false;
size_t MaxMessagesCount_ = 0;
TDuration TotalWaitDuration_;
-};
-
+};
+
IActor* CreateReceiveMessageActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TReceiveMessageActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/schema.cpp b/ydb/core/ymq/actor/schema.cpp
index 20e84581fe..f03201dd31 100644
--- a/ydb/core/ymq/actor/schema.cpp
+++ b/ydb/core/ymq/actor/schema.cpp
@@ -1,32 +1,32 @@
#include "cfg.h"
-#include "executor.h"
+#include "executor.h"
#include "log.h"
-#include "params.h"
-#include "schema.h"
+#include "params.h"
+#include "schema.h"
#include <ydb/core/ymq/base/constants.h>
#include <ydb/core/ymq/base/limits.h>
#include <ydb/core/ymq/queues/fifo/schema.h>
#include <ydb/core/ymq/queues/std/schema.h>
-
+
#include <ydb/core/base/tablet_pipe.h>
#include <ydb/core/client/minikql_compile/mkql_compile_service.h>
#include <ydb/public/lib/value/value.h>
-
-#include <util/generic/guid.h>
+
+#include <util/generic/guid.h>
#include <util/generic/utility.h>
-#include <util/string/ascii.h>
-#include <util/string/cast.h>
-#include <util/string/join.h>
-
-using NKikimr::NClient::TValue;
-
+#include <util/string/ascii.h>
+#include <util/string/cast.h>
+#include <util/string/join.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
extern const TString QUOTER_KESUS_NAME = ".Quoter";
extern const TString RPS_QUOTA_NAME = "RPSQuota";
-namespace {
-
+namespace {
+
static const char* const GetNextAtomicValueQuery = R"__(
(
(let counterTable '%1$s/.AtomicCounter)
@@ -47,62 +47,62 @@ static const char* const GetNextAtomicValueQuery = R"__(
)
)__";
-static bool SuccessStatusCode(ui32 code) {
- switch (NTxProxy::TResultStatus::EStatus(code)) {
- case NTxProxy::TResultStatus::EStatus::ExecComplete:
- case NTxProxy::TResultStatus::EStatus::ExecAlready:
- return true;
- default:
- return false;
- }
-}
-
+static bool SuccessStatusCode(ui32 code) {
+ switch (NTxProxy::TResultStatus::EStatus(code)) {
+ case NTxProxy::TResultStatus::EStatus::ExecComplete:
+ case NTxProxy::TResultStatus::EStatus::ExecAlready:
+ return true;
+ default:
+ return false;
+ }
+}
+
static void SetCompactionPolicyForSmallTable(NKikimrSchemeOp::TPartitionConfig& partitionConfig) {
- auto& policyPb = *partitionConfig.MutableCompactionPolicy();
- policyPb.SetInMemSizeToSnapshot(100000);
- policyPb.SetInMemStepsToSnapshot(300);
- policyPb.SetInMemForceStepsToSnapshot(500);
- policyPb.SetInMemForceSizeToSnapshot(400000);
- policyPb.SetInMemCompactionBrokerQueue(0);
- policyPb.SetReadAheadHiThreshold(64 * 1024 * 1024);
- policyPb.SetReadAheadLoThreshold(16 * 1024 * 1024);
- policyPb.SetMinDataPageSize(7168);
-}
-
+ auto& policyPb = *partitionConfig.MutableCompactionPolicy();
+ policyPb.SetInMemSizeToSnapshot(100000);
+ policyPb.SetInMemStepsToSnapshot(300);
+ policyPb.SetInMemForceStepsToSnapshot(500);
+ policyPb.SetInMemForceSizeToSnapshot(400000);
+ policyPb.SetInMemCompactionBrokerQueue(0);
+ policyPb.SetReadAheadHiThreshold(64 * 1024 * 1024);
+ policyPb.SetReadAheadLoThreshold(16 * 1024 * 1024);
+ policyPb.SetMinDataPageSize(7168);
+}
+
static void SetCompactionPolicyForTimestampOrdering(NKikimrSchemeOp::TPartitionConfig& partitionConfig) {
const bool enableCompression = false;
-
- auto& policyPb = *partitionConfig.MutableCompactionPolicy();
- policyPb.SetInMemSizeToSnapshot(1*1024*1024);
- policyPb.SetInMemStepsToSnapshot(100000);
- policyPb.SetInMemForceStepsToSnapshot(100000);
- policyPb.SetInMemForceSizeToSnapshot(4*1024*1024);
- policyPb.SetInMemCompactionBrokerQueue(0);
- policyPb.SetReadAheadHiThreshold(64 * 1024 * 1024);
- policyPb.SetReadAheadLoThreshold(16 * 1024 * 1024);
- policyPb.SetMinDataPageSize(enableCompression ? 256*1024 : 63*1024);
- policyPb.SetSnapBrokerQueue(0);
- policyPb.SetBackupBrokerQueue(0);
-
- auto& g1 = *policyPb.AddGeneration();
- g1.SetGenerationId(0);
- g1.SetSizeToCompact(100 * 1024 * 1024);
- g1.SetCountToCompact(40);
- g1.SetForceCountToCompact(60);
- g1.SetForceSizeToCompact(140 * 1024 * 1024);
- g1.SetCompactionBrokerQueue(1);
- g1.SetKeepInCache(true);
-
- auto& g2 = *policyPb.AddGeneration();
- g2.SetGenerationId(1);
- g2.SetSizeToCompact(500ull * 1024 * 1024);
- g2.SetCountToCompact(30);
- g2.SetForceCountToCompact(60);
- g2.SetForceSizeToCompact(700ull * 1024 * 1024);
- g2.SetCompactionBrokerQueue(2);
- g2.SetKeepInCache(false);
-}
-
+
+ auto& policyPb = *partitionConfig.MutableCompactionPolicy();
+ policyPb.SetInMemSizeToSnapshot(1*1024*1024);
+ policyPb.SetInMemStepsToSnapshot(100000);
+ policyPb.SetInMemForceStepsToSnapshot(100000);
+ policyPb.SetInMemForceSizeToSnapshot(4*1024*1024);
+ policyPb.SetInMemCompactionBrokerQueue(0);
+ policyPb.SetReadAheadHiThreshold(64 * 1024 * 1024);
+ policyPb.SetReadAheadLoThreshold(16 * 1024 * 1024);
+ policyPb.SetMinDataPageSize(enableCompression ? 256*1024 : 63*1024);
+ policyPb.SetSnapBrokerQueue(0);
+ policyPb.SetBackupBrokerQueue(0);
+
+ auto& g1 = *policyPb.AddGeneration();
+ g1.SetGenerationId(0);
+ g1.SetSizeToCompact(100 * 1024 * 1024);
+ g1.SetCountToCompact(40);
+ g1.SetForceCountToCompact(60);
+ g1.SetForceSizeToCompact(140 * 1024 * 1024);
+ g1.SetCompactionBrokerQueue(1);
+ g1.SetKeepInCache(true);
+
+ auto& g2 = *policyPb.AddGeneration();
+ g2.SetGenerationId(1);
+ g2.SetSizeToCompact(500ull * 1024 * 1024);
+ g2.SetCountToCompact(30);
+ g2.SetForceCountToCompact(60);
+ g2.SetForceSizeToCompact(700ull * 1024 * 1024);
+ g2.SetCompactionBrokerQueue(2);
+ g2.SetKeepInCache(false);
+}
+
static void SetOnePartitionPerShardSettings(NKikimrSchemeOp::TTableDescription& desc, size_t queueShardsCount) {
for (size_t boundary = 1; boundary < queueShardsCount; ++boundary) {
NKikimrSchemeOp::TSplitBoundary* splitBoundarySetting = desc.AddSplitBoundary();
@@ -125,48 +125,48 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
}
THolder<TEvTxUserProxy::TEvProposeTransaction>
- MakeCreateTableEvent(const TString& root,
+ MakeCreateTableEvent(const TString& root,
const TTable& table,
size_t queueShardsCount)
-{
- auto ev = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
- // Transaction info
+{
+ auto ev = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
+ // Transaction info
auto* trans = ev->Record.MutableTransaction()->MutableModifyScheme();
-
- if (table.Shard != -1) {
+
+ if (table.Shard != -1) {
trans->SetWorkingDir(TString::Join(root, "/", ToString(table.Shard)));
- } else {
- trans->SetWorkingDir(root);
- }
+ } else {
+ trans->SetWorkingDir(root);
+ }
trans->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
- // Table info
+ // Table info
auto* desc = trans->MutableCreateTable();
- desc->SetName(table.Name);
- // Columns info
- for (const auto& col : table.Columns) {
+ desc->SetName(table.Name);
+ // Columns info
+ for (const auto& col : table.Columns) {
if (col.Partitions && !table.EnableAutosplit) {
- desc->SetUniformPartitionsCount(col.Partitions);
- }
- if (col.Key) {
- desc->AddKeyColumnNames(col.Name);
- }
-
+ desc->SetUniformPartitionsCount(col.Partitions);
+ }
+ if (col.Key) {
+ desc->AddKeyColumnNames(col.Name);
+ }
+
auto* item = desc->AddColumns();
- item->SetName(col.Name);
- item->SetType(NScheme::TypeName(col.TypeId));
- }
-
- if (table.InMemory) {
+ item->SetName(col.Name);
+ item->SetType(NScheme::TypeName(col.TypeId));
+ }
+
+ if (table.InMemory) {
auto* def = desc->MutablePartitionConfig()->AddColumnFamilies();
- def->SetId(0);
+ def->SetId(0);
def->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
- }
-
- if (table.Sequential) {
- SetCompactionPolicyForTimestampOrdering(*desc->MutablePartitionConfig());
- } else if (table.Small) {
- SetCompactionPolicyForSmallTable(*desc->MutablePartitionConfig());
- }
+ }
+
+ if (table.Sequential) {
+ SetCompactionPolicyForTimestampOrdering(*desc->MutablePartitionConfig());
+ } else if (table.Small) {
+ SetCompactionPolicyForSmallTable(*desc->MutablePartitionConfig());
+ }
if (table.OnePartitionPerShard) {
Y_VERIFY(queueShardsCount > 0);
SetOnePartitionPerShardSettings(*desc, queueShardsCount);
@@ -178,10 +178,10 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
partitioningPolicy->SetMinPartitionsCount(1);
partitioningPolicy->SetMaxPartitionsCount(MAX_PARTITIONS_COUNT);
}
-
- return ev;
-}
-
+
+ return ev;
+}
+
THolder<TEvTxUserProxy::TEvProposeTransaction>
MakeDeleteTableEvent(const TString& root,
const TTable& table)
@@ -247,39 +247,39 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
return ev;
}
-TCreateUserSchemaActor::TCreateUserSchemaActor(const TString& root,
+TCreateUserSchemaActor::TCreateUserSchemaActor(const TString& root,
const TString& userName,
const TActorId& sender,
const TString& requestId,
TIntrusivePtr<TUserCounters> userCounters)
- : Root_(root)
+ : Root_(root)
, UserName_(userName)
- , Sender_(sender)
+ , Sender_(sender)
, SI_(static_cast<int>(ECreating::MakeDirectory))
, RequestId_(requestId)
, UserCounters_(std::move(userCounters))
-{
-}
-
+{
+}
+
TCreateUserSchemaActor::~TCreateUserSchemaActor() = default;
-
+
void TCreateUserSchemaActor::Bootstrap() {
Process();
- Become(&TThis::StateFunc);
-}
-
+ Become(&TThis::StateFunc);
+}
+
void TCreateUserSchemaActor::NextAction() {
SI_++;
-
+
if (!Cfg().GetQuotingConfig().GetEnableQuoting() || !Cfg().GetQuotingConfig().HasKesusQuoterConfig()) {
while (ECreating(SI_) == ECreating::Quoter || ECreating(SI_) == ECreating::RPSQuota) {
SI_++;
}
- }
-
+ }
+
Process();
-}
-
+}
+
THolder<TEvTxUserProxy::TEvProposeTransaction> TCreateUserSchemaActor::MakeMkDirRequest(const TString& root, const TString& dirName) {
auto ev = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
auto* trans = ev->Record.MutableTransaction()->MutableModifyScheme();
@@ -292,7 +292,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction> TCreateUserSchemaActor::MakeMkDir
}
void TCreateUserSchemaActor::Process() {
- switch (ECreating(SI_)) {
+ switch (ECreating(SI_)) {
case ECreating::MakeRootSqsDirectory: {
CreateRootSqsDirAttemptWasMade_ = true;
TStringBuf rootSqs = Root_;
@@ -307,10 +307,10 @@ void TCreateUserSchemaActor::Process() {
Register(new TMiniKqlExecutionActor(SelfId(), RequestId_, MakeMkDirRequest(TString(mainRoot), TString(sqsDirName)), false, TQueuePath(Root_, UserName_, TString()), GetTransactionCounters(UserCounters_)));
break;
}
- case ECreating::MakeDirectory: {
+ case ECreating::MakeDirectory: {
Register(new TMiniKqlExecutionActor(SelfId(), RequestId_, MakeMkDirRequest(Root_, UserName_), false, TQueuePath(Root_, UserName_, TString()), GetTransactionCounters(UserCounters_)));
- break;
- }
+ break;
+ }
case ECreating::Quoter: {
Register(new TMiniKqlExecutionActor(
SelfId(), RequestId_, MakeCreateKesusEvent(Root_ + "/" + UserName_, QUOTER_KESUS_NAME), false, TQueuePath(Root_, UserName_, TString()), GetTransactionCounters(UserCounters_))
@@ -321,25 +321,25 @@ void TCreateUserSchemaActor::Process() {
AddRPSQuota();
break;
}
- case ECreating::Finish: {
+ case ECreating::Finish: {
Send(Sender_, MakeHolder<TSqsEvents::TEvUserCreated>(true));
PassAway();
- break;
- }
- }
-}
-
+ break;
+ }
+ }
+}
+
void TCreateUserSchemaActor::HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
- const auto& record = ev->Get()->Record;
+ const auto& record = ev->Get()->Record;
const auto status = record.GetStatus();
-
+
if (SuccessStatusCode(status)) {
if (ECreating(SI_) == ECreating::Quoter) {
KesusPathId_ = std::make_pair(record.GetSchemeShardTabletId(), record.GetPathId());
}
NextAction();
- } else {
+ } else {
// Try to create /Root/SQS directory only if error occurs, because this is very rare operation.
if (ECreating(SI_) == ECreating::MakeDirectory
&& record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusPathDoesNotExist
@@ -352,12 +352,12 @@ void TCreateUserSchemaActor::HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
return;
}
RLOG_SQS_WARN("request execution error: " << record);
-
+
Send(Sender_, MakeHolder<TSqsEvents::TEvUserCreated>(false));
PassAway();
- }
-}
-
+ }
+}
+
void TCreateUserSchemaActor::HandleAddQuoterResource(NKesus::TEvKesus::TEvAddQuoterResourceResult::TPtr& ev) {
AddQuoterResourceActor_ = TActorId();
auto status = ev->Get()->Record.GetError().GetStatus();
@@ -387,27 +387,27 @@ void TCreateUserSchemaActor::PassAway() {
TActorBootstrapped<TCreateUserSchemaActor>::PassAway();
}
-TDeleteUserSchemaActor::TDeleteUserSchemaActor(const TString& root,
- const TString& name,
+TDeleteUserSchemaActor::TDeleteUserSchemaActor(const TString& root,
+ const TString& name,
const TActorId& sender,
const TString& requestId,
TIntrusivePtr<TUserCounters> userCounters)
- : Root_(root)
- , Name_(name)
- , Sender_(sender)
- , SI_(0)
+ : Root_(root)
+ , Name_(name)
+ , Sender_(sender)
+ , SI_(0)
, RequestId_(requestId)
, UserCounters_(std::move(userCounters))
-{
-}
-
+{
+}
+
TDeleteUserSchemaActor::~TDeleteUserSchemaActor() = default;
-
+
void TDeleteUserSchemaActor::Bootstrap() {
Process();
- Become(&TThis::StateFunc);
-}
-
+ Become(&TThis::StateFunc);
+}
+
void TDeleteUserSchemaActor::SkipQuoterStages() {
if (EDeleting(SI_) == EDeleting::RemoveQuoter && (!Cfg().GetQuotingConfig().GetEnableQuoting() || !Cfg().GetQuotingConfig().HasKesusQuoterConfig())) {
SI_++;
@@ -418,46 +418,46 @@ void TDeleteUserSchemaActor::NextAction() {
SI_++;
Process();
-}
-
+}
+
void TDeleteUserSchemaActor::Process() {
SkipQuoterStages();
- switch (EDeleting(SI_)) {
+ switch (EDeleting(SI_)) {
case EDeleting::RemoveQuoter: {
Register(new TMiniKqlExecutionActor(
SelfId(), RequestId_, MakeRemoveKesusEvent(Root_ + "/" + Name_, QUOTER_KESUS_NAME), false, TQueuePath(Root_, Name_, TString()), GetTransactionCounters(UserCounters_))
);
break;
}
- case EDeleting::RemoveDirectory: {
+ case EDeleting::RemoveDirectory: {
Register(new TMiniKqlExecutionActor(
SelfId(), RequestId_, MakeRemoveDirectoryEvent(Root_, Name_), false, TQueuePath(Root_, Name_, TString()), GetTransactionCounters(UserCounters_))
- );
- break;
- }
- case EDeleting::Finish: {
+ );
+ break;
+ }
+ case EDeleting::Finish: {
Send(Sender_, MakeHolder<TSqsEvents::TEvUserDeleted>(true));
PassAway();
- break;
- }
- }
-}
-
+ break;
+ }
+ }
+}
+
void TDeleteUserSchemaActor::HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
- const auto& record = ev->Get()->Record;
+ const auto& record = ev->Get()->Record;
const auto status = record.GetStatus();
-
+
if (SuccessStatusCode(status)) {
NextAction();
- } else {
+ } else {
RLOG_SQS_WARN("request execution error: " << record);
-
+
Send(Sender_, MakeHolder<TSqsEvents::TEvUserDeleted>(false, record.GetMiniKQLErrors()));
PassAway();
- }
-}
-
+ }
+}
+
TAtomicCounterActor::TAtomicCounterActor(const TActorId& sender, const TString& rootPath, const TString& requestId)
: Sender_(sender)
, RootPath_(rootPath)
diff --git a/ydb/core/ymq/actor/schema.h b/ydb/core/ymq/actor/schema.h
index c88face921..eaacadf416 100644
--- a/ydb/core/ymq/actor/schema.h
+++ b/ydb/core/ymq/actor/schema.h
@@ -1,23 +1,23 @@
-#pragma once
+#pragma once
#include "defs.h"
-
-#include "events.h"
+
+#include "events.h"
#include <ydb/core/ymq/base/table_info.h>
#include <ydb/core/protos/sqs.pb.h>
-
+
#include <ydb/core/node_whiteboard/node_whiteboard.h>
#include <ydb/core/kesus/tablet/events.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
-
+
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/actor.h>
#include <library/cpp/actors/core/event_pb.h>
#include <library/cpp/actors/core/hfunc.h>
-
-#include <util/generic/hash.h>
-
+
+#include <util/generic/hash.h>
+
namespace NKikimr::NSQS {
-
+
extern const TString QUOTER_KESUS_NAME;
extern const TString RPS_QUOTA_NAME;
@@ -48,52 +48,52 @@ inline TIntrusivePtr<TTransactionCounters> GetTransactionCounters(const TIntrusi
return nullptr;
}
-class TCreateUserSchemaActor
+class TCreateUserSchemaActor
: public TActorBootstrapped<TCreateUserSchemaActor>
-{
-public:
+{
+public:
TCreateUserSchemaActor(const TString& root, const TString& userName, const TActorId& sender, const TString& requestId, TIntrusivePtr<TUserCounters> userCounters);
- ~TCreateUserSchemaActor();
-
+ ~TCreateUserSchemaActor();
+
void Bootstrap();
-
+
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::SQS_ACTOR;
}
-private:
+private:
void NextAction();
-
+
void Process();
-
-private:
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
hFunc(NKesus::TEvKesus::TEvAddQuoterResourceResult, HandleAddQuoterResource);
cFunc(TEvPoisonPill::EventType, PassAway);
- }
- }
-
+ }
+ }
+
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev);
void HandleAddQuoterResource(NKesus::TEvKesus::TEvAddQuoterResourceResult::TPtr& ev);
-
+
THolder<TEvTxUserProxy::TEvProposeTransaction> MakeMkDirRequest(const TString& root, const TString& dirName);
void AddRPSQuota();
void PassAway() override;
-private:
+private:
enum class ECreating : int {
MakeRootSqsDirectory = -1, // optional state
- MakeDirectory = 0,
+ MakeDirectory = 0,
Quoter,
RPSQuota,
Finish,
- };
-
- const TString Root_;
+ };
+
+ const TString Root_;
const TString UserName_;
const TActorId Sender_;
int SI_;
@@ -102,52 +102,52 @@ private:
TIntrusivePtr<TUserCounters> UserCounters_;
std::pair<ui64, ui64> KesusPathId_ = {}; // SchemeShardTableId, PathId for quoter kesus
TActorId AddQuoterResourceActor_;
-};
-
-class TDeleteUserSchemaActor
+};
+
+class TDeleteUserSchemaActor
: public TActorBootstrapped<TDeleteUserSchemaActor>
-{
-public:
+{
+public:
TDeleteUserSchemaActor(const TString& root, const TString& name, const TActorId& sender, const TString& requestId, TIntrusivePtr<TUserCounters> userCounters);
- ~TDeleteUserSchemaActor();
-
+ ~TDeleteUserSchemaActor();
+
void Bootstrap();
-
+
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::SQS_ACTOR;
}
-private:
+private:
void NextAction();
-
+
void Process();
-
-private:
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
- }
- }
-
+ }
+ }
+
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev);
-
+
void SkipQuoterStages();
-private:
- enum class EDeleting : ui32 {
+private:
+ enum class EDeleting : ui32 {
RemoveQuoter = 0,
- RemoveDirectory,
- Finish
- };
-
- const TString Root_;
- const TString Name_;
+ RemoveDirectory,
+ Finish
+ };
+
+ const TString Root_;
+ const TString Name_;
const TActorId Sender_;
- ui32 SI_;
+ ui32 SI_;
const TString RequestId_;
TIntrusivePtr<TUserCounters> UserCounters_;
-};
-
+};
+
class TAtomicCounterActor
: public TActorBootstrapped<TAtomicCounterActor>
{
diff --git a/ydb/core/ymq/actor/send_message.cpp b/ydb/core/ymq/actor/send_message.cpp
index e596b8f2e3..9b551e7c62 100644
--- a/ydb/core/ymq/actor/send_message.cpp
+++ b/ydb/core/ymq/actor/send_message.cpp
@@ -1,29 +1,29 @@
-#include "action.h"
+#include "action.h"
#include "attributes_md5.h"
#include "error.h"
#include "executor.h"
#include "log.h"
-#include "params.h"
-#include "serviceid.h"
-
+#include "params.h"
+#include "serviceid.h"
+
#include <ydb/core/ymq/base/helpers.h>
#include <ydb/core/ymq/base/limits.h>
#include <ydb/core/ymq/actor/sha256.h>
#include <ydb/core/ymq/proto/records.pb.h>
-
+
#include <ydb/public/lib/value/value.h>
-
+
#include <library/cpp/digest/md5/md5.h>
-#include <util/random/random.h>
-
-using NKikimr::NClient::TValue;
-
+#include <util/random/random.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TSendMessageActor
- : public TActionActor<TSendMessageActor>
-{
-public:
+
+class TSendMessageActor
+ : public TActionActor<TSendMessageActor>
+{
+public:
static constexpr bool NeedQueueAttributes() {
return true;
}
@@ -31,7 +31,7 @@ public:
TSendMessageActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, bool isBatch, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, isBatch ? EAction::SendMessageBatch : EAction::SendMessage, std::move(cb))
, IsBatch_(isBatch)
- {
+ {
if (IsBatch_) {
CopyAccountName(BatchRequest());
Response_.MutableSendMessageBatch()->SetRequestId(RequestId_);
@@ -41,26 +41,26 @@ public:
Response_.MutableSendMessage()->SetRequestId(RequestId_);
CopySecurityToken(Request());
}
- }
-
-private:
- size_t CalculateMessageSize(const TSendMessageRequest& req) const {
- size_t ret = 0;
- for (const auto& a : req.GetMessageAttributes()) {
- ret += a.ByteSize();
- }
- ret += req.GetMessageBody().size();
- return ret;
- }
-
+ }
+
+private:
+ size_t CalculateMessageSize(const TSendMessageRequest& req) const {
+ size_t ret = 0;
+ for (const auto& a : req.GetMessageAttributes()) {
+ ret += a.ByteSize();
+ }
+ ret += req.GetMessageBody().size();
+ return ret;
+ }
+
TDuration GetDelay(const TSendMessageRequest& request) const {
if (request.HasDelaySeconds()) {
return TDuration::Seconds(request.GetDelaySeconds());
} else {
return QueueAttributes_->DelaySeconds;
}
- }
-
+ }
+
bool ValidateSingleRequest(const TSendMessageRequest& req, TSendMessageResponse* resp) {
if (IsFifoQueue()) {
if (!req.GetMessageGroupId()) {
@@ -106,13 +106,13 @@ private:
return true;
}
- bool DoValidate() override {
+ bool DoValidate() override {
const size_t maxMessageSize = Min(TLimits::MaxMessageSize, QueueAttributes_->MaximumMessageSize);
- if (IsBatch_) {
- size_t size = 0;
- size_t count = 0;
+ if (IsBatch_) {
+ size_t size = 0;
+ size_t count = 0;
bool tooBig = false;
-
+
for (const auto& req : BatchRequest().GetEntries()) {
const size_t msgSize = CalculateMessageSize(req);
if (msgSize > maxMessageSize) {
@@ -120,9 +120,9 @@ private:
break;
}
size += msgSize;
- count += 1;
- }
-
+ count += 1;
+ }
+
if (tooBig) {
MakeError(Response_.MutableSendMessageBatch(), NErrors::INVALID_PARAMETER_VALUE,
TStringBuilder() << "Each message must be shorter than " << maxMessageSize << " bytes.");
@@ -131,56 +131,56 @@ private:
if (size > TLimits::MaxMessageSize) {
MakeError(Response_.MutableSendMessageBatch(), NErrors::BATCH_REQUEST_TOO_LONG);
- return false;
- }
- if (count == 0) {
+ return false;
+ }
+ if (count == 0) {
MakeError(Response_.MutableSendMessageBatch(), NErrors::EMPTY_BATCH_REQUEST);
- return false;
- }
- if (count > TLimits::MaxBatchSize) {
+ return false;
+ }
+ if (count > TLimits::MaxBatchSize) {
MakeError(Response_.MutableSendMessageBatch(), NErrors::TOO_MANY_ENTRIES_IN_BATCH_REQUEST);
- return false;
- }
-
- if (!GetQueueName()) {
+ return false;
+ }
+
+ if (!GetQueueName()) {
MakeError(Response_.MutableSendMessageBatch(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
- } else {
+ return false;
+ }
+ } else {
if (CalculateMessageSize(Request()) > maxMessageSize) {
MakeError(Response_.MutableSendMessage(), NErrors::INVALID_PARAMETER_VALUE, TStringBuilder() << "Message must be shorter than " << maxMessageSize << " bytes.");
- return false;
- }
-
- if (!GetQueueName()) {
+ return false;
+ }
+
+ if (!GetQueueName()) {
MakeError(Response_.MutableSendMessage(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
- }
-
- return true;
- }
-
+ return false;
+ }
+ }
+
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return IsBatch_ ? Response_.MutableSendMessageBatch()->MutableError() : Response_.MutableSendMessage()->MutableError();
}
// coverity[var_deref_model]: false positive
void DoAction() override {
- Become(&TThis::StateFunc);
+ Become(&TThis::StateFunc);
Y_VERIFY(QueueAttributes_.Defined());
-
+
const bool isFifo = IsFifoQueue();
THolder<TSqsEvents::TEvSendMessageBatch> req;
for (size_t i = 0, size = IsBatch_ ? BatchRequest().EntriesSize() : 1; i < size; ++i) {
auto* currentRequest = IsBatch_ ? &BatchRequest().GetEntries(i) : &Request();
auto* currentResponse = IsBatch_ ? Response_.MutableSendMessageBatch()->AddEntries() : Response_.MutableSendMessage();
-
+
currentResponse->SetId(currentRequest->GetId());
if (!ValidateSingleRequest(*currentRequest, currentResponse)) {
continue;
}
-
+
TString deduplicationId;
if (isFifo) {
const TString& dedupParam = currentRequest->GetMessageDeduplicationId();
@@ -220,33 +220,33 @@ private:
messageReq.Attributes = ProtobufToString(attrs);
}
}
-
+
if (req) {
Send(QueueLeader_, req.Release());
} else {
SendReplyAndDie();
}
- }
+ }
+
-
- TString DoGetQueueName() const override {
+ TString DoGetQueueName() const override {
return IsBatch_ ? BatchRequest().GetQueueName() : Request().GetQueueName();
- }
-
- static TString ProtobufToString(const NProtoBuf::Message& proto) {
- TString ret;
+ }
+
+ static TString ProtobufToString(const NProtoBuf::Message& proto) {
+ TString ret;
Y_PROTOBUF_SUPPRESS_NODISCARD proto.SerializeToString(&ret);
- return ret;
- }
-
-private:
+ return ret;
+ }
+
+private:
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvSendMessageBatchResponse, HandleSendResponse);
- }
- }
-
+ }
+ }
+
void HandleSendResponse(TSqsEvents::TEvSendMessageBatchResponse::TPtr& ev) {
const bool isFifo = IsFifoQueue();
for (size_t i = 0, size = ev->Get()->Statuses.size(); i < size; ++i) {
@@ -266,7 +266,7 @@ private:
currentResponse->SetMD5OfMessageAttributes(md5);
RLOG_SQS_DEBUG("Calculating MD5 of message attributes. Request: " << *currentRequest << "\nMD5 of message attributes: " << md5);
}
-
+
// counters
if (status.Status == TSqsEvents::TEvSendMessageBatchResponse::ESendMessageStatus::AlreadySent) {
INC_COUNTER_COUPLE(QueueCounters_, SendMessage_DeduplicationCount, deduplicated_count_per_second);
@@ -276,12 +276,12 @@ private:
}
} else {
MakeError(currentResponse, NErrors::INTERNAL_FAILURE);
- }
- }
-
+ }
+ }
+
SendReplyAndDie();
- }
-
+ }
+
const TSendMessageRequest& Request() const {
return SourceSqsRequest_.GetSendMessage();
}
@@ -290,18 +290,18 @@ private:
return SourceSqsRequest_.GetSendMessageBatch();
}
-private:
+private:
std::vector<size_t> RequestToReplyIndexMapping_;
-
- const bool IsBatch_;
-};
-
+
+ const bool IsBatch_;
+};
+
IActor* CreateSendMessageActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TSendMessageActor(sourceSqsRequest, false, std::move(cb));
-}
-
+}
+
IActor* CreateSendMessageBatchActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TSendMessageActor(sourceSqsRequest, true, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/serviceid.h b/ydb/core/ymq/actor/serviceid.h
index 7219d918ba..911d587be0 100644
--- a/ydb/core/ymq/actor/serviceid.h
+++ b/ydb/core/ymq/actor/serviceid.h
@@ -1,19 +1,19 @@
-#pragma once
+#pragma once
#include "defs.h"
-
+
#include <library/cpp/actors/core/actor.h>
-
+
#include <library/cpp/logger/file.h>
-#include <util/generic/strbuf.h>
-
+#include <util/generic/strbuf.h>
+
namespace NKikimr::NSQS {
-
+
inline TActorId MakeSqsServiceID(ui32 nodeId) {
Y_VERIFY(nodeId != 0);
return TActorId(nodeId, TStringBuf("SQS_SERVICE"));
-}
-
+}
+
inline TActorId MakeSqsProxyServiceID(ui32 nodeId) {
Y_VERIFY(nodeId != 0);
return TActorId(nodeId, TStringBuf("SQS_PROXY"));
diff --git a/ydb/core/ymq/actor/set_queue_attributes.cpp b/ydb/core/ymq/actor/set_queue_attributes.cpp
index df33ad99e6..b3650861d8 100644
--- a/ydb/core/ymq/actor/set_queue_attributes.cpp
+++ b/ydb/core/ymq/actor/set_queue_attributes.cpp
@@ -1,56 +1,56 @@
-#include "action.h"
+#include "action.h"
#include "error.h"
#include "executor.h"
#include "log.h"
-#include "params.h"
-#include "serviceid.h"
-
+#include "params.h"
+#include "serviceid.h"
+
#include <ydb/core/ymq/base/limits.h>
#include <ydb/core/ymq/base/dlq_helpers.h>
#include <ydb/core/ymq/base/queue_attributes.h>
#include <ydb/public/lib/value/value.h>
-
+
#include <library/cpp/scheme/scheme.h>
-#include <util/generic/maybe.h>
+#include <util/generic/maybe.h>
#include <util/generic/utility.h>
-#include <util/string/cast.h>
-
-using NKikimr::NClient::TValue;
-
+#include <util/string/cast.h>
+
+using NKikimr::NClient::TValue;
+
namespace NKikimr::NSQS {
-
-class TSetQueueAttributesActor
- : public TActionActor<TSetQueueAttributesActor>
-{
-public:
+
+class TSetQueueAttributesActor
+ : public TActionActor<TSetQueueAttributesActor>
+{
+public:
TSetQueueAttributesActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb)
: TActionActor(sourceSqsRequest, EAction::SetQueueAttributes, std::move(cb))
- {
+ {
CopyAccountName(Request());
- Response_.MutableSetQueueAttributes()->SetRequestId(RequestId_);
-
+ Response_.MutableSetQueueAttributes()->SetRequestId(RequestId_);
+
for (const auto& attr : Request().attributes()) {
- Attributes_[attr.GetName()] = attr.GetValue();
- }
+ Attributes_[attr.GetName()] = attr.GetValue();
+ }
CopySecurityToken(Request());
- }
-
-private:
- static TMaybe<ui64> ToMilliSeconds(const TMaybe<ui64>& value) {
- if (value) {
- return TDuration::Seconds(*value).MilliSeconds();
- }
- return Nothing();
- }
-
- bool DoValidate() override {
- if (!GetQueueName()) {
+ }
+
+private:
+ static TMaybe<ui64> ToMilliSeconds(const TMaybe<ui64>& value) {
+ if (value) {
+ return TDuration::Seconds(*value).MilliSeconds();
+ }
+ return Nothing();
+ }
+
+ bool DoValidate() override {
+ if (!GetQueueName()) {
MakeError(Response_.MutableSetQueueAttributes(), NErrors::MISSING_PARAMETER, "No QueueName parameter.");
- return false;
- }
-
+ return false;
+ }
+
const bool clampValues = !Cfg().GetEnableQueueAttributesValidation();
ValidatedAttributes_ = TQueueAttributes::FromAttributesAndConfig(Attributes_, Cfg(), IsFifoQueue(), clampValues);
if (!ValidatedAttributes_.Validate()) {
@@ -58,9 +58,9 @@ private:
return false;
}
- return true;
- }
-
+ return true;
+ }
+
TError* MutableErrorDesc() override {
return Response_.MutableSetQueueAttributes()->MutableError();
}
@@ -74,7 +74,7 @@ private:
.QueryId(SET_QUEUE_ATTRIBUTES_ID)
.Counters(QueueCounters_)
.RetryOnTimeout();
-
+
builder.Params().OptionalUint64("MAX_RECEIVE_COUNT", ValidatedAttributes_.RedrivePolicy.MaxReceiveCount);
builder.Params().OptionalUtf8("DLQ_TARGET_ARN", ValidatedAttributes_.RedrivePolicy.TargetArn);
builder.Params().OptionalUtf8("DLQ_TARGET_NAME", ValidatedAttributes_.RedrivePolicy.TargetQueueName);
@@ -84,7 +84,7 @@ private:
builder.Params().OptionalUint64("RETENTION", ToMilliSeconds(ValidatedAttributes_.MessageRetentionPeriod));
builder.Params().OptionalUint64("WAIT", ToMilliSeconds(ValidatedAttributes_.ReceiveMessageWaitTimeSeconds));
builder.Params().OptionalUint64("MAX_MESSAGE_SIZE", ValidatedAttributes_.MaximumMessageSize);
-
+
if (IsFifoQueue()) {
builder.Params().OptionalBool("CONTENT_BASED_DEDUPLICATION", ValidatedAttributes_.ContentBasedDeduplication);
}
@@ -92,8 +92,8 @@ private:
builder.Params().Utf8("USER_NAME", UserName_);
builder.Start();
- }
-
+ }
+
void DoAction() override {
Become(&TThis::StateFunc);
@@ -108,18 +108,18 @@ private:
}
}
- TString DoGetQueueName() const override {
+ TString DoGetQueueName() const override {
return Request().GetQueueName();
- }
-
+ }
+
STATEFN(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
hFunc(TSqsEvents::TEvQueueId, HandleQueueId);
- }
- }
-
+ }
+ }
+
void HandleQueueId(TSqsEvents::TEvQueueId::TPtr& ev) {
if (ev->Get()->Failed) {
RLOG_SQS_WARN("Get queue id failed");
@@ -140,31 +140,31 @@ private:
const auto& record = ev->Get()->Record;
const ui32 status = record.GetStatus();
auto* result = Response_.MutableSetQueueAttributes();
-
- if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete) {
- // OK
+
+ if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete) {
+ // OK
RLOG_SQS_DEBUG("Sending clear attributes cache event for queue [" << UserName_ << "/" << GetQueueName() << "]");
Send(QueueLeader_, MakeHolder<TSqsEvents::TEvClearQueueAttributesCache>());
- } else {
+ } else {
RLOG_SQS_WARN("Request failed: " << record);
MakeError(result, NErrors::INTERNAL_FAILURE);
- }
-
+ }
+
SendReplyAndDie();
- }
-
+ }
+
const TSetQueueAttributesRequest& Request() const {
return SourceSqsRequest_.GetSetQueueAttributes();
}
-private:
- THashMap<TString, TString> Attributes_;
+private:
+ THashMap<TString, TString> Attributes_;
TQueueAttributes ValidatedAttributes_;
-};
-
+};
+
IActor* CreateSetQueueAttributesActor(const NKikimrClient::TSqsRequest& sourceSqsRequest, THolder<IReplyCallback> cb) {
return new TSetQueueAttributesActor(sourceSqsRequest, std::move(cb));
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/actor/ya.make b/ydb/core/ymq/actor/ya.make
index 070653bb57..7d431d9380 100644
--- a/ydb/core/ymq/actor/ya.make
+++ b/ydb/core/ymq/actor/ya.make
@@ -3,57 +3,57 @@ OWNER(
g:sqs
)
-LIBRARY()
+LIBRARY()
-SRCS(
- actor.cpp
+SRCS(
+ actor.cpp
auth_factory.cpp
attributes_md5.cpp
cfg.cpp
- change_visibility.cpp
+ change_visibility.cpp
count_queues.cpp
- create_queue.cpp
- create_user.cpp
- delete_message.cpp
- delete_queue.cpp
- delete_user.cpp
+ create_queue.cpp
+ create_user.cpp
+ delete_message.cpp
+ delete_queue.cpp
+ delete_user.cpp
error.cpp
- executor.cpp
+ executor.cpp
fifo_cleanup.cpp
garbage_collector.cpp
- get_queue_attributes.cpp
- get_queue_url.cpp
+ get_queue_attributes.cpp
+ get_queue_url.cpp
index_events_processor.cpp
infly.cpp
log.cpp
list_dead_letter_source_queues.cpp
list_permissions.cpp
- list_queues.cpp
- list_users.cpp
+ list_queues.cpp
+ list_users.cpp
local_rate_limiter_allocator.cpp
message_delay_stats.cpp
metering.cpp
migration.cpp
modify_permissions.cpp
proxy_actor.cpp
- purge.cpp
- purge_queue.cpp
+ purge.cpp
+ purge_queue.cpp
queue_leader.cpp
- receive_message.cpp
+ receive_message.cpp
retention.cpp
- schema.cpp
+ schema.cpp
sha256.cpp
- send_message.cpp
- service.cpp
- set_queue_attributes.cpp
+ send_message.cpp
+ service.cpp
+ set_queue_attributes.cpp
proxy_service.cpp
queues_list_reader.cpp
queue_schema.cpp
user_settings_names.cpp
user_settings_reader.cpp
-)
-
-PEERDIR(
+)
+
+PEERDIR(
contrib/libs/openssl
contrib/libs/protobuf
library/cpp/actors/core
@@ -90,12 +90,12 @@ PEERDIR(
ydb/public/lib/value
ydb/public/sdk/cpp/client/ydb_types/credentials
ydb/library/yql/minikql
-)
-
+)
+
YQL_LAST_ABI_VERSION()
GENERATE_ENUM_SERIALIZATION(events.h)
GENERATE_ENUM_SERIALIZATION(metering.h)
-END()
+END()
diff --git a/ydb/core/ymq/base/action.cpp b/ydb/core/ymq/base/action.cpp
index b601d72d87..1bf9f5ba40 100644
--- a/ydb/core/ymq/base/action.cpp
+++ b/ydb/core/ymq/base/action.cpp
@@ -1,11 +1,11 @@
#include "action.h"
-
+
#include <util/generic/is_in.h>
-#include <util/generic/hash.h>
+#include <util/generic/hash.h>
#include <util/generic/hash_set.h>
-
+
namespace NKikimr::NSQS {
-
+
namespace {
constexpr ui32 FOR_QUEUE = 1;
@@ -76,14 +76,14 @@ const THashMap<TString, EAction> StringToAction = GetStringToAction();
} // namespace
-EAction ActionFromString(const TString& name) {
+EAction ActionFromString(const TString& name) {
auto ai = StringToAction.find(name);
if (ai == StringToAction.end()) {
- return EAction::Unknown;
- }
- return ai->second;
-}
-
+ return EAction::Unknown;
+ }
+ return ai->second;
+}
+
const TString& ActionToString(EAction action) {
return GetProps(action).StringName;
}
diff --git a/ydb/core/ymq/base/action.h b/ydb/core/ymq/base/action.h
index ede7922dd1..1156cc56bb 100644
--- a/ydb/core/ymq/base/action.h
+++ b/ydb/core/ymq/base/action.h
@@ -1,43 +1,43 @@
-#pragma once
-
-#include <util/generic/string.h>
-
+#pragma once
+
+#include <util/generic/string.h>
+
namespace NKikimr::NSQS {
-
+
enum EAction {
- Unknown = 0,
- ChangeMessageVisibility,
- ChangeMessageVisibilityBatch,
- CreateQueue,
- CreateUser,
- GetQueueAttributes,
+ Unknown = 0,
+ ChangeMessageVisibility,
+ ChangeMessageVisibilityBatch,
+ CreateQueue,
+ CreateUser,
+ GetQueueAttributes,
GetQueueAttributesBatch,
- GetQueueUrl,
- DeleteMessage,
- DeleteMessageBatch,
- DeleteQueue,
+ GetQueueUrl,
+ DeleteMessage,
+ DeleteMessageBatch,
+ DeleteQueue,
DeleteQueueBatch,
- DeleteUser,
- ListQueues,
- ListUsers,
- PurgeQueue,
+ DeleteUser,
+ ListQueues,
+ ListUsers,
+ PurgeQueue,
PurgeQueueBatch,
- ReceiveMessage,
- SendMessage,
- SendMessageBatch,
- SetQueueAttributes,
+ ReceiveMessage,
+ SendMessage,
+ SendMessageBatch,
+ SetQueueAttributes,
ModifyPermissions,
ListPermissions,
ListDeadLetterSourceQueues,
CountQueues,
-
+
ActionsArraySize,
-};
-
-EAction ActionFromString(const TString& name);
+};
+
+EAction ActionFromString(const TString& name);
const TString& ActionToString(EAction action);
const TString& ActionToCloudConvMethod(EAction action);
-
+
bool IsBatchAction(EAction action);
bool IsActionForQueue(EAction action);
bool IsActionForQueueYMQ(EAction action);
diff --git a/ydb/core/ymq/base/limits.h b/ydb/core/ymq/base/limits.h
index b251b3ff62..96fdea6b66 100644
--- a/ydb/core/ymq/base/limits.h
+++ b/ydb/core/ymq/base/limits.h
@@ -1,34 +1,34 @@
-#pragma once
-
+#pragma once
+
#include <util/datetime/base.h>
-#include <util/system/defaults.h>
-
+#include <util/system/defaults.h>
+
namespace NKikimr::NSQS {
-
-namespace TLimits {
+
+namespace TLimits {
static constexpr size_t MinBatchSize = 1;
- static constexpr size_t MaxBatchSize = 10;
-
- static constexpr size_t MaxDelaySeconds = 900;
-
- static constexpr size_t MaxInflightStandard = 120000;
-
- static constexpr size_t MaxMessageAttributes = 10;
-
- static constexpr size_t MaxMessageSize = (256 * 1024);
-
+ static constexpr size_t MaxBatchSize = 10;
+
+ static constexpr size_t MaxDelaySeconds = 900;
+
+ static constexpr size_t MaxInflightStandard = 120000;
+
+ static constexpr size_t MaxMessageAttributes = 10;
+
+ static constexpr size_t MaxMessageSize = (256 * 1024);
+
static constexpr TDuration MaxMessageRetentionPeriod = TDuration::Days(14);
-
- static constexpr size_t DelaySeconds = 0;
-
- static constexpr size_t VisibilityTimeout = 30;
+
+ static constexpr size_t DelaySeconds = 0;
+
+ static constexpr size_t VisibilityTimeout = 30;
static constexpr TDuration MaxVisibilityTimeout = TDuration::Hours(12);
static constexpr size_t MinMaxReceiveCount = 1;
static constexpr size_t MaxMaxReceiveCount = 1000;
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/base/query_id.h b/ydb/core/ymq/base/query_id.h
index ad54d0c70d..e4f4d8fe7e 100644
--- a/ydb/core/ymq/base/query_id.h
+++ b/ydb/core/ymq/base/query_id.h
@@ -1,9 +1,9 @@
-#pragma once
-
-#include <util/system/defaults.h>
-
+#pragma once
+
+#include <util/system/defaults.h>
+
namespace NKikimr::NSQS {
-
+
enum EQueryId {
DELETE_MESSAGE_ID = 0,
LOCK_GROUP_ID = 1,
@@ -30,7 +30,7 @@ enum EQueryId {
READ_OR_REDRIVE_MESSAGE_ID = 22,
GET_USER_SETTINGS_ID = 23,
GET_QUEUES_LIST_ID = 24,
-
+
QUERY_VECTOR_SIZE,
};
diff --git a/ydb/core/ymq/base/table_info.h b/ydb/core/ymq/base/table_info.h
index 2ea37f8f0e..5f3b38c3dd 100644
--- a/ydb/core/ymq/base/table_info.h
+++ b/ydb/core/ymq/base/table_info.h
@@ -1,31 +1,31 @@
-#pragma once
-
+#pragma once
+
#include <ydb/public/lib/scheme_types/scheme_type_id.h>
-
-#include <util/generic/vector.h>
-
+
+#include <util/generic/vector.h>
+
namespace NKikimr::NSQS {
-
-struct TColumn {
- TString Name;
- NScheme::TTypeId TypeId;
- bool Key;
- size_t Partitions;
-
+
+struct TColumn {
+ TString Name;
+ NScheme::TTypeId TypeId;
+ bool Key;
+ size_t Partitions;
+
TColumn(const TString& name,
const NScheme::TTypeId type,
const bool key = false,
const size_t partitions = 0)
- : Name(name)
- , TypeId(type)
- , Key(key)
- , Partitions(partitions)
- { }
-};
-
-struct TTable {
- TString Name;
- TVector<TColumn> Columns;
+ : Name(name)
+ , TypeId(type)
+ , Key(key)
+ , Partitions(partitions)
+ { }
+};
+
+struct TTable {
+ TString Name;
+ TVector<TColumn> Columns;
bool InMemory = false;
bool Sequential = false;
bool Small = false;
@@ -34,42 +34,42 @@ struct TTable {
bool HasLeaderTablet = false;
bool EnableAutosplit = false;
ui64 SizeToSplit = 0;
-
+
TTable() = default;
-
+
TTable(const TString& name)
- : Name(name)
- { }
-
+ : Name(name)
+ { }
+
TTable& SetColumns(const TVector<TColumn>& columns) {
- Columns = columns;
- return *this;
- }
-
+ Columns = columns;
+ return *this;
+ }
+
TTable& SetInMemory(bool value) {
- InMemory = value;
- return *this;
- }
-
+ InMemory = value;
+ return *this;
+ }
+
TTable& SetSequential(bool value) {
- Sequential = value;
- return *this;
- }
-
+ Sequential = value;
+ return *this;
+ }
+
TTable& SetSmall(bool value) {
- Small = value;
- return *this;
- }
-
+ Small = value;
+ return *this;
+ }
+
TTable& SetOnePartitionPerShard(bool value) {
OnePartitionPerShard = value;
return *this;
}
TTable& SetShard(i64 value) {
- Shard = value;
- return *this;
- }
+ Shard = value;
+ return *this;
+ }
TTable& SetHasLeaderTablet(bool value = true) {
HasLeaderTablet = value;
@@ -81,6 +81,6 @@ struct TTable {
SizeToSplit = sizeToSplit;
return *this;
}
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/base/ya.make b/ydb/core/ymq/base/ya.make
index 14cd4e72a1..7bcb137f7a 100644
--- a/ydb/core/ymq/base/ya.make
+++ b/ydb/core/ymq/base/ya.make
@@ -3,9 +3,9 @@ OWNER(
g:sqs
)
-LIBRARY()
+LIBRARY()
-SRCS(
+SRCS(
acl.cpp
action.cpp
counters.cpp
@@ -17,13 +17,13 @@ SRCS(
queue_id.cpp
secure_protobuf_printer.cpp
events_writer_iface.h
-)
-
+)
+
GENERATE_ENUM_SERIALIZATION(query_id.h)
GENERATE_ENUM_SERIALIZATION(cloud_enums.h)
-PEERDIR(
+PEERDIR(
contrib/libs/openssl
library/cpp/cgiparam
library/cpp/ipmath
@@ -39,6 +39,6 @@ PEERDIR(
ydb/library/http_proxy/error
ydb/library/protobuf_printer
ydb/public/lib/scheme_types
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/ymq/client/bin/main.cpp b/ydb/core/ymq/client/bin/main.cpp
index cb7dbd2a2c..754da3706a 100644
--- a/ydb/core/ymq/client/bin/main.cpp
+++ b/ydb/core/ymq/client/bin/main.cpp
@@ -1,21 +1,21 @@
#include <util/random/shuffle.h>
#include <ydb/core/ymq/client/cpp/client.h>
-
+
#include <library/cpp/getopt/opt.h>
#include <library/cpp/getopt/modchooser.h>
-
-#include <util/stream/file.h>
-#include <util/stream/output.h>
+
+#include <util/stream/file.h>
+#include <util/stream/output.h>
#include <util/system/env.h>
-#include <util/system/user.h>
-
+#include <util/system/user.h>
+
#include <google/protobuf/text_format.h>
-
-#include <random>
-
-using namespace NLastGetopt;
-using namespace NKikimr::NSQS;
-
+
+#include <random>
+
+using namespace NLastGetopt;
+using namespace NKikimr::NSQS;
+
class TSqsOptions : public TOpts {
public:
TSqsOptions(bool addUserOption = true) {
@@ -73,11 +73,11 @@ public:
TString TVMTicket;
};
-static int HandleChange(int argc, const char* argv[]) {
- TString name;
- TString receipt;
- ui64 timeout;
-
+static int HandleChange(int argc, const char* argv[]) {
+ TString name;
+ TString receipt;
+ ui64 timeout;
+
TSqsOptions opts;
opts.AddLongOption('q', "queue-name", "name of creating queue")
.Required()
@@ -88,30 +88,30 @@ static int HandleChange(int argc, const char* argv[]) {
opts.AddLongOption('t', "timeout", "visibility timeout")
.Required()
.StoreResult(&timeout);
-
+
TOptsParseResult res(&opts, argc, argv);
-
- TChangeMessageVisibilityRequest req;
+
+ TChangeMessageVisibilityRequest req;
req.MutableAuth()->SetUserName(opts.User);
- req.SetQueueName(name);
- req.SetReceiptHandle(receipt);
- req.SetVisibilityTimeout(timeout);
+ req.SetQueueName(name);
+ req.SetReceiptHandle(receipt);
+ req.SetVisibilityTimeout(timeout);
opts.SetCredentials(req);
auto resp = TQueueClient(TClientOptions().SetHost(opts.Host).SetPort(opts.Port)).ChangeMessageVisibility(req);
-
- if (resp.HasError()) {
- Cerr << "Got error for queue : "
- << name << " : "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else {
- Cerr << "Visibility timeout has been changed" << Endl;
- }
- return 0;
-}
-
-static int HandleCreate(int argc, const char* argv[]) {
- TString queue;
+
+ if (resp.HasError()) {
+ Cerr << "Got error for queue : "
+ << name << " : "
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else {
+ Cerr << "Visibility timeout has been changed" << Endl;
+ }
+ return 0;
+}
+
+static int HandleCreate(int argc, const char* argv[]) {
+ TString queue;
ui64 shards = 0;
ui64 partitions = 0;
ui64 retentionSeconds = 0;
@@ -121,7 +121,7 @@ static int HandleCreate(int argc, const char* argv[]) {
bool enableAutosplit = false;
bool disableAutosplit = false;
ui64 sizeToSplit = 0;
-
+
TCreateQueueRequest req;
TSqsOptions opts;
@@ -163,11 +163,11 @@ static int HandleCreate(int argc, const char* argv[]) {
.Optional()
.StoreResult(&sizeToSplit)
.DefaultValue(ToString(req.GetSizeToSplit()));
-
+
TOptsParseResult res(&opts, argc, argv);
-
+
req.MutableAuth()->SetUserName(opts.User);
- req.SetQueueName(queue);
+ req.SetQueueName(queue);
if (queue.EndsWith(".fifo")) {
auto fifoAttr = req.AddAttributes();
fifoAttr->SetName("FifoQueue");
@@ -178,8 +178,8 @@ static int HandleCreate(int argc, const char* argv[]) {
dedupAttr->SetName("ContentBasedDeduplication");
dedupAttr->SetValue("true");
}
- req.SetShards(shards);
- req.SetPartitions(partitions);
+ req.SetShards(shards);
+ req.SetPartitions(partitions);
if (enableOutOfOrderExecution) {
req.SetEnableOutOfOrderTransactionsExecution(true);
} else if (disableOutOfOrderExecution) {
@@ -207,78 +207,78 @@ static int HandleCreate(int argc, const char* argv[]) {
}
auto resp = TQueueClient(TClientOptions().SetHost(opts.Host).SetPort(opts.Port)).CreateQueue(req);
-
- if (resp.HasError()) {
- Cerr << "Got error for queue : "
- << queue << " : "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else {
- Cerr << "New queue has been created : "
- << resp.GetQueueName() << Endl;
+
+ if (resp.HasError()) {
+ Cerr << "Got error for queue : "
+ << queue << " : "
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else {
+ Cerr << "New queue has been created : "
+ << resp.GetQueueName() << Endl;
Cout << resp.GetQueueUrl() << Endl;
- }
- return 0;
-}
-
-static int HandleDelete(int argc, const char* argv[]) {
- TString queue;
-
+ }
+ return 0;
+}
+
+static int HandleDelete(int argc, const char* argv[]) {
+ TString queue;
+
TSqsOptions opts;
opts.AddLongOption('q', "queue-name", "name of deleting queue")
.Required()
.StoreResult(&queue);
-
+
TOptsParseResult res(&opts, argc, argv);
-
- TDeleteQueueRequest req;
+
+ TDeleteQueueRequest req;
req.MutableAuth()->SetUserName(opts.User);
- req.SetQueueName(queue);
+ req.SetQueueName(queue);
opts.SetCredentials(req);
auto resp = TQueueClient(TClientOptions().SetHost(opts.Host).SetPort(opts.Port)).DeleteQueue(req);
-
- if (resp.HasError()) {
- Cerr << "Got error for queue : "
- << queue << " : "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else {
- Cerr << "The queue has been deleted"
- << Endl;
- }
- return 0;
-}
-
-static int HandleList(int argc, const char* argv[]) {
+
+ if (resp.HasError()) {
+ Cerr << "Got error for queue : "
+ << queue << " : "
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else {
+ Cerr << "The queue has been deleted"
+ << Endl;
+ }
+ return 0;
+}
+
+static int HandleList(int argc, const char* argv[]) {
TSqsOptions opts;
-
+
TOptsParseResult res(&opts, argc, argv);
-
- TListQueuesRequest req;
+
+ TListQueuesRequest req;
req.MutableAuth()->SetUserName(opts.User);
opts.SetCredentials(req);
-
+
auto resp = TQueueClient(TClientOptions().SetHost(opts.Host).SetPort(opts.Port)).ListQueues(req);
-
- if (resp.HasError()) {
- Cerr << "Got error: "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else {
- for (auto item : resp.queues()) {
- Cout << "Queue : " << item.GetQueueName() << Endl;
- }
- }
- return 0;
-}
-
-static int HandleSend(int argc, const char* argv[]) {
- TString queueName;
- TString data;
- TString groupId;
- TString dedup;
-
+
+ if (resp.HasError()) {
+ Cerr << "Got error: "
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else {
+ for (auto item : resp.queues()) {
+ Cout << "Queue : " << item.GetQueueName() << Endl;
+ }
+ }
+ return 0;
+}
+
+static int HandleSend(int argc, const char* argv[]) {
+ TString queueName;
+ TString data;
+ TString groupId;
+ TString dedup;
+
TSqsOptions opts;
opts.AddLongOption('q', "queue-name", "name of queue")
.Required()
@@ -292,40 +292,40 @@ static int HandleSend(int argc, const char* argv[]) {
opts.AddLongOption("dedup", "deduplication token")
.Optional()
.StoreResult(&dedup);
-
+
TOptsParseResult res(&opts, argc, argv);
-
- TSendMessageRequest req;
+
+ TSendMessageRequest req;
req.MutableAuth()->SetUserName(opts.User);
- req.SetQueueName(queueName);
- req.SetMessageBody(data);
- req.SetMessageGroupId(groupId);
- req.SetMessageDeduplicationId(dedup);
+ req.SetQueueName(queueName);
+ req.SetMessageBody(data);
+ req.SetMessageGroupId(groupId);
+ req.SetMessageDeduplicationId(dedup);
opts.SetCredentials(req);
-
+
auto resp = TQueueClient(TClientOptions().SetHost(opts.Host).SetPort(opts.Port)).SendMessage(req);
-
- if (resp.HasError()) {
- Cerr << "Got error for queue : "
- << queueName << " : "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else {
- Cerr << "The message has been sent:"
- << " id = " << resp.GetMessageId()
- << " seqno = " << resp.GetSequenceNumber()
- << Endl;
- }
- return 0;
-}
-
-static int HandleRead(int argc, const char* argv[]) {
- TString queueName;
- TString attemptId;
- int count = 1;
- ui64 waitTime = 0;
- bool keep = false;
-
+
+ if (resp.HasError()) {
+ Cerr << "Got error for queue : "
+ << queueName << " : "
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else {
+ Cerr << "The message has been sent:"
+ << " id = " << resp.GetMessageId()
+ << " seqno = " << resp.GetSequenceNumber()
+ << Endl;
+ }
+ return 0;
+}
+
+static int HandleRead(int argc, const char* argv[]) {
+ TString queueName;
+ TString attemptId;
+ int count = 1;
+ ui64 waitTime = 0;
+ bool keep = false;
+
TSqsOptions opts;
opts.AddLongOption('q', "queue-name", "name of deleting queue")
.Required()
@@ -345,103 +345,103 @@ static int HandleRead(int argc, const char* argv[]) {
.Optional()
.StoreResult(&waitTime)
.DefaultValue("0");
-
+
TOptsParseResult res(&opts, argc, argv);
-
+
TQueueClient client(TClientOptions().SetHost(opts.Host).SetPort(opts.Port));
-
- TReceiveMessageRequest req;
+
+ TReceiveMessageRequest req;
req.MutableAuth()->SetUserName(opts.User);
- req.SetQueueName(queueName);
- req.SetMaxNumberOfMessages(count);
- req.SetVisibilityTimeout(60);
- req.SetReceiveRequestAttemptId(attemptId);
- req.SetWaitTimeSeconds(waitTime);
+ req.SetQueueName(queueName);
+ req.SetMaxNumberOfMessages(count);
+ req.SetVisibilityTimeout(60);
+ req.SetReceiveRequestAttemptId(attemptId);
+ req.SetWaitTimeSeconds(waitTime);
opts.SetCredentials(req);
- auto resp = client.ReceiveMessage(req);
-
- if (resp.HasError()) {
- Cerr << "Got error for queue : "
- << queueName << " : "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else if (resp.MessagesSize()) {
+ auto resp = client.ReceiveMessage(req);
+
+ if (resp.HasError()) {
+ Cerr << "Got error for queue : "
+ << queueName << " : "
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else if (resp.MessagesSize()) {
TVector<TString> receipts;
-
- for (size_t i = 0; i < resp.MessagesSize(); ++i) {
- const auto& msg = resp.GetMessages(i);
-
- Cout << "The message has been received: data = " << msg.GetData() << " "
- << "groupId = " << msg.GetMessageGroupId() << " "
- << "attemptId = " << resp.GetReceiveRequestAttemptId()
- << Endl;
-
- receipts.push_back(msg.GetReceiptHandle());
- }
-
- if (!keep) {
+
+ for (size_t i = 0; i < resp.MessagesSize(); ++i) {
+ const auto& msg = resp.GetMessages(i);
+
+ Cout << "The message has been received: data = " << msg.GetData() << " "
+ << "groupId = " << msg.GetMessageGroupId() << " "
+ << "attemptId = " << resp.GetReceiveRequestAttemptId()
+ << Endl;
+
+ receipts.push_back(msg.GetReceiptHandle());
+ }
+
+ if (!keep) {
Shuffle(receipts.begin(), receipts.end());
-
- for (auto ri = receipts.begin(); ri != receipts.end(); ++ri) {
- TDeleteMessageRequest d;
+
+ for (auto ri = receipts.begin(); ri != receipts.end(); ++ri) {
+ TDeleteMessageRequest d;
d.MutableAuth()->SetUserName(opts.User);
- d.SetQueueName(queueName);
- d.SetReceiptHandle(*ri);
- auto del = client.DeleteMessage(d);
-
- if (del.HasError()) {
- Cerr << "Got error for queue on deletion : "
- << queueName << " : "
- << del.GetError().GetMessage() << Endl;
- }
- }
- } else {
- for (auto ri = receipts.begin(); ri != receipts.end(); ++ri) {
- Cout << "Receipt: " << *ri << Endl;
- }
- }
- } else {
- Cout << "No messages" << Endl;
- }
- return 0;
-}
-
-static int HandlePurge(int argc, const char* argv[]) {
- TString queueName;
-
+ d.SetQueueName(queueName);
+ d.SetReceiptHandle(*ri);
+ auto del = client.DeleteMessage(d);
+
+ if (del.HasError()) {
+ Cerr << "Got error for queue on deletion : "
+ << queueName << " : "
+ << del.GetError().GetMessage() << Endl;
+ }
+ }
+ } else {
+ for (auto ri = receipts.begin(); ri != receipts.end(); ++ri) {
+ Cout << "Receipt: " << *ri << Endl;
+ }
+ }
+ } else {
+ Cout << "No messages" << Endl;
+ }
+ return 0;
+}
+
+static int HandlePurge(int argc, const char* argv[]) {
+ TString queueName;
+
TSqsOptions opts;
opts.AddLongOption('q', "queue-name", "name of deleting queue")
.Required()
.StoreResult(&queueName);
-
+
TOptsParseResult res(&opts, argc, argv);
-
+
TQueueClient client(TClientOptions().SetHost(opts.Host).SetPort(opts.Port));
-
- TPurgeQueueRequest req;
+
+ TPurgeQueueRequest req;
req.MutableAuth()->SetUserName(opts.User);
- req.SetQueueName(queueName);
+ req.SetQueueName(queueName);
opts.SetCredentials(req);
-
- auto resp = client.PurgeQueue(req);
- if (resp.HasError()) {
- Cerr << "Got error for queue : "
- << queueName << " : "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else {
- Cerr << "The queue has been purged"
- << Endl;
- }
-
- return 0;
-}
-
-static int HandleUser(int argc, const char* argv[]) {
- bool list = false;
- bool del = false;
+
+ auto resp = client.PurgeQueue(req);
+ if (resp.HasError()) {
+ Cerr << "Got error for queue : "
+ << queueName << " : "
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else {
+ Cerr << "The queue has been purged"
+ << Endl;
+ }
+
+ return 0;
+}
+
+static int HandleUser(int argc, const char* argv[]) {
+ bool list = false;
+ bool del = false;
TString name;
-
+
TSqsOptions opts;
opts.AddLongOption("list", "list configured users")
.Optional()
@@ -455,62 +455,62 @@ static int HandleUser(int argc, const char* argv[]) {
.Optional()
.RequiredArgument("NAME")
.StoreResult(&name);
-
+
TOptsParseResult res(&opts, argc, argv);
-
+
TQueueClient client(TClientOptions().SetHost(opts.Host).SetPort(opts.Port));
-
+
if (!list && !name) {
Cerr << "Name parameter is required for creation/deletion." << Endl;
return 1;
}
- if (list) {
- TListUsersRequest req;
- req.MutableAuth()->SetUserName(GetUsername());
+ if (list) {
+ TListUsersRequest req;
+ req.MutableAuth()->SetUserName(GetUsername());
opts.SetCredentials(req);
-
- auto resp = client.ListUsers(req);
- for (size_t i = 0; i < resp.UserNamesSize(); ++i) {
- Cout << resp.GetUserNames(i) << Endl;
- }
- } else if (del) {
- TDeleteUserRequest req;
+
+ auto resp = client.ListUsers(req);
+ for (size_t i = 0; i < resp.UserNamesSize(); ++i) {
+ Cout << resp.GetUserNames(i) << Endl;
+ }
+ } else if (del) {
+ TDeleteUserRequest req;
req.MutableAuth()->SetUserName(opts.User);
req.SetUserName(name);
opts.SetCredentials(req);
-
- auto resp = client.DeleteUser(req);
- if (resp.HasError()) {
- Cerr << "Got error for user : "
+
+ auto resp = client.DeleteUser(req);
+ if (resp.HasError()) {
+ Cerr << "Got error for user : "
<< opts.User << " : "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else {
- Cerr << "The user has been deleted"
- << Endl;
- }
- } else {
- TCreateUserRequest req;
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else {
+ Cerr << "The user has been deleted"
+ << Endl;
+ }
+ } else {
+ TCreateUserRequest req;
req.MutableAuth()->SetUserName(opts.User);
req.SetUserName(name);
opts.SetCredentials(req);
-
- auto resp = client.CreateUser(req);
- if (resp.HasError()) {
- Cerr << "Got error for user : "
+
+ auto resp = client.CreateUser(req);
+ if (resp.HasError()) {
+ Cerr << "Got error for user : "
<< opts.User << " : "
- << resp.GetError().GetMessage() << Endl;
- return 1;
- } else {
- Cerr << "The user has been initialized"
- << Endl;
- }
- }
-
- return 0;
-}
-
+ << resp.GetError().GetMessage() << Endl;
+ return 1;
+ } else {
+ Cerr << "The user has been initialized"
+ << Endl;
+ }
+ }
+
+ return 0;
+}
+
static int HandlePermissions(int argc, const char* argv[]) {
TString resource;
TString grantRequest;
@@ -693,8 +693,8 @@ static int HandleSetQueueAttributes(int argc, const char* argv[]) {
return 0;
}
-int main(int argc, const char* argv[]) {
- try {
+int main(int argc, const char* argv[]) {
+ try {
TModChooser mods;
mods.SetDescription("SQS client tool");
mods.AddMode("change", HandleChange, "change visibility timeout");
@@ -710,14 +710,14 @@ int main(int argc, const char* argv[]) {
mods.AddMode("set-attributes", HandleSetQueueAttributes, "set queue attributes");
mods.AddMode("list-permissions", HandleListPermissions, "list permissions");
return mods.Run(argc, argv);
- } catch (const TQueueException& e) {
- Cerr << "Queue Error: "
+ } catch (const TQueueException& e) {
+ Cerr << "Queue Error: "
<< e.Error().GetErrorCode() << " (" << e.Status() << "): " << e.Message() << Endl;
Cerr << "Request id: " << e.GetRequestId() << Endl;
- return 1;
- } catch (...) {
- Cerr << CurrentExceptionMessage() << Endl;
- return 1;
- }
- return 0;
-}
+ return 1;
+ } catch (...) {
+ Cerr << CurrentExceptionMessage() << Endl;
+ return 1;
+ }
+ return 0;
+}
diff --git a/ydb/core/ymq/client/bin/ya.make b/ydb/core/ymq/client/bin/ya.make
index d00ca35587..7ade68136c 100644
--- a/ydb/core/ymq/client/bin/ya.make
+++ b/ydb/core/ymq/client/bin/ya.make
@@ -3,16 +3,16 @@ OWNER(
g:sqs
)
-PROGRAM(sqs)
-
-SRCS(
- main.cpp
-)
-
-PEERDIR(
+PROGRAM(sqs)
+
+SRCS(
+ main.cpp
+)
+
+PEERDIR(
library/cpp/getopt
ydb/core/ymq/client/cpp
ydb/core/ymq/proto
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/ymq/client/cpp/client.cpp b/ydb/core/ymq/client/cpp/client.cpp
index c96f2dcaab..26263ef2ee 100644
--- a/ydb/core/ymq/client/cpp/client.cpp
+++ b/ydb/core/ymq/client/cpp/client.cpp
@@ -1,135 +1,135 @@
-#include "client.h"
-
+#include "client.h"
+
#include <ydb/public/lib/deprecated/client/grpc_client.h>
-
-#include <util/generic/yexception.h>
-#include <util/string/join.h>
+
+#include <util/generic/yexception.h>
+#include <util/string/join.h>
#include <util/system/defaults.h>
-#include <util/system/event.h>
-#include <util/system/user.h>
-
-using namespace NKikimr::NGRpcProxy;
-
+#include <util/system/event.h>
+#include <util/system/user.h>
+
+using namespace NKikimr::NGRpcProxy;
+
namespace NKikimr::NSQS {
-
-class TQueueClient::TImpl {
-public:
- TImpl(const TClientOptions& options)
- : Options_(options)
- , Client_(TGRpcClientConfig(Join(":", options.Host, options.Port)))
- {
- }
-
-#define METHOD_IMPL(name, hint) \
+
+class TQueueClient::TImpl {
+public:
+ TImpl(const TClientOptions& options)
+ : Options_(options)
+ , Client_(TGRpcClientConfig(Join(":", options.Host, options.Port)))
+ {
+ }
+
+#define METHOD_IMPL(name, hint) \
Y_CAT(Y_CAT(T, name), Response) name(const Y_CAT(Y_CAT(T, name), Request)& req) { \
- NKikimrClient::TSqsRequest request; \
+ NKikimrClient::TSqsRequest request; \
Y_CAT(Y_CAT(T, name), Response) resp; \
request.Y_CAT(Mutable, name)()->CopyFrom(req); \
- TAutoEvent e; \
+ TAutoEvent e; \
Client_.SqsRequest(request, [e, &resp] (const NGRpcProxy::TGrpcError* error, const NKikimrClient::TSqsResponse& result) mutable \
- { \
- if (error) { \
- resp.MutableError()->SetStatus(502); \
- resp.MutableError()->SetMessage(error->first); \
- } else { \
+ { \
+ if (error) { \
+ resp.MutableError()->SetStatus(502); \
+ resp.MutableError()->SetMessage(error->first); \
+ } else { \
resp.CopyFrom(result.Y_CAT(Get, name)()); \
- } \
- e.Signal(); \
- } \
- ); \
- e.WaitI(); \
- if (resp.HasError() && Options_.Throw) { \
+ } \
+ e.Signal(); \
+ } \
+ ); \
+ e.WaitI(); \
+ if (resp.HasError() && Options_.Throw) { \
ythrow TQueueException(resp.GetError(), resp.GetRequestId()); \
- } \
- return resp; \
- }
-
- METHOD_IMPL(ChangeMessageVisibility, "can't change visibility");
- METHOD_IMPL(CreateQueue, "can't create a queue");
- METHOD_IMPL(CreateUser, "can't create a user");
- METHOD_IMPL(DeleteMessage, "can't delete a message");
- METHOD_IMPL(DeleteMessageBatch, "can't delete messages");
- METHOD_IMPL(DeleteQueue, "can't delete a queue");
- METHOD_IMPL(DeleteUser, "can't delete user");
- METHOD_IMPL(ListQueues, "can't list queues");
- METHOD_IMPL(ListUsers, "can't list users");
- METHOD_IMPL(PurgeQueue, "can't purge queue");
- METHOD_IMPL(ReceiveMessage, "can't receive a message");
- METHOD_IMPL(SendMessage, "can't enqueue a message");
+ } \
+ return resp; \
+ }
+
+ METHOD_IMPL(ChangeMessageVisibility, "can't change visibility");
+ METHOD_IMPL(CreateQueue, "can't create a queue");
+ METHOD_IMPL(CreateUser, "can't create a user");
+ METHOD_IMPL(DeleteMessage, "can't delete a message");
+ METHOD_IMPL(DeleteMessageBatch, "can't delete messages");
+ METHOD_IMPL(DeleteQueue, "can't delete a queue");
+ METHOD_IMPL(DeleteUser, "can't delete user");
+ METHOD_IMPL(ListQueues, "can't list queues");
+ METHOD_IMPL(ListUsers, "can't list users");
+ METHOD_IMPL(PurgeQueue, "can't purge queue");
+ METHOD_IMPL(ReceiveMessage, "can't receive a message");
+ METHOD_IMPL(SendMessage, "can't enqueue a message");
METHOD_IMPL(ModifyPermissions, "can't modify permissions");
METHOD_IMPL(GetQueueAttributes, "can't get queue attributes");
METHOD_IMPL(SetQueueAttributes, "can't set queue attributes");
METHOD_IMPL(ListPermissions, "can't list permissions");
-
-#undef METHOD_IMPL
-
-private:
- const TClientOptions Options_;
- TGRpcClient Client_;
-};
-
-TQueueClient::TQueueClient(const TClientOptions& options)
- : Impl_(new TImpl(options))
-{ }
-
-TQueueClient::~TQueueClient()
-{ }
-
-TChangeMessageVisibilityResponse TQueueClient::ChangeMessageVisibility(const TChangeMessageVisibilityRequest& req) {
- return Impl_->ChangeMessageVisibility(req);
-}
-
-TCreateQueueResponse TQueueClient::CreateQueue(const TCreateQueueRequest& req) {
- return Impl_->CreateQueue(req);
-}
-
-TCreateUserResponse TQueueClient::CreateUser(const TCreateUserRequest& req) {
- return Impl_->CreateUser(req);
-}
-
-TDeleteMessageResponse TQueueClient::DeleteMessage(const TDeleteMessageRequest& req) {
- return Impl_->DeleteMessage(req);
-}
-
-TDeleteMessageBatchResponse TQueueClient::DeleteMessageBatch(const TDeleteMessageBatchRequest& req) {
- return Impl_->DeleteMessageBatch(req);
-}
-
-TDeleteQueueResponse TQueueClient::DeleteQueue(const TString& name) {
- TDeleteQueueRequest req;
- req.MutableAuth()->SetUserName(GetUsername());
- req.SetQueueName(name);
- return Impl_->DeleteQueue(req);
-}
-
-TDeleteQueueResponse TQueueClient::DeleteQueue(const TDeleteQueueRequest& req) {
- return Impl_->DeleteQueue(req);
-}
-
-TDeleteUserResponse TQueueClient::DeleteUser(const TDeleteUserRequest& req) {
- return Impl_->DeleteUser(req);
-}
-
-TListQueuesResponse TQueueClient::ListQueues(const TListQueuesRequest& req) {
- return Impl_->ListQueues(req);
-}
-
-TListUsersResponse TQueueClient::ListUsers(const TListUsersRequest& req) {
- return Impl_->ListUsers(req);
-}
-
-TPurgeQueueResponse TQueueClient::PurgeQueue(const TPurgeQueueRequest& req) {
- return Impl_->PurgeQueue(req);
-}
-
-TReceiveMessageResponse TQueueClient::ReceiveMessage(const TReceiveMessageRequest& req) {
- return Impl_->ReceiveMessage(req);
-}
-
-TSendMessageResponse TQueueClient::SendMessage(const TSendMessageRequest& req) {
- return Impl_->SendMessage(req);
-}
-
+
+#undef METHOD_IMPL
+
+private:
+ const TClientOptions Options_;
+ TGRpcClient Client_;
+};
+
+TQueueClient::TQueueClient(const TClientOptions& options)
+ : Impl_(new TImpl(options))
+{ }
+
+TQueueClient::~TQueueClient()
+{ }
+
+TChangeMessageVisibilityResponse TQueueClient::ChangeMessageVisibility(const TChangeMessageVisibilityRequest& req) {
+ return Impl_->ChangeMessageVisibility(req);
+}
+
+TCreateQueueResponse TQueueClient::CreateQueue(const TCreateQueueRequest& req) {
+ return Impl_->CreateQueue(req);
+}
+
+TCreateUserResponse TQueueClient::CreateUser(const TCreateUserRequest& req) {
+ return Impl_->CreateUser(req);
+}
+
+TDeleteMessageResponse TQueueClient::DeleteMessage(const TDeleteMessageRequest& req) {
+ return Impl_->DeleteMessage(req);
+}
+
+TDeleteMessageBatchResponse TQueueClient::DeleteMessageBatch(const TDeleteMessageBatchRequest& req) {
+ return Impl_->DeleteMessageBatch(req);
+}
+
+TDeleteQueueResponse TQueueClient::DeleteQueue(const TString& name) {
+ TDeleteQueueRequest req;
+ req.MutableAuth()->SetUserName(GetUsername());
+ req.SetQueueName(name);
+ return Impl_->DeleteQueue(req);
+}
+
+TDeleteQueueResponse TQueueClient::DeleteQueue(const TDeleteQueueRequest& req) {
+ return Impl_->DeleteQueue(req);
+}
+
+TDeleteUserResponse TQueueClient::DeleteUser(const TDeleteUserRequest& req) {
+ return Impl_->DeleteUser(req);
+}
+
+TListQueuesResponse TQueueClient::ListQueues(const TListQueuesRequest& req) {
+ return Impl_->ListQueues(req);
+}
+
+TListUsersResponse TQueueClient::ListUsers(const TListUsersRequest& req) {
+ return Impl_->ListUsers(req);
+}
+
+TPurgeQueueResponse TQueueClient::PurgeQueue(const TPurgeQueueRequest& req) {
+ return Impl_->PurgeQueue(req);
+}
+
+TReceiveMessageResponse TQueueClient::ReceiveMessage(const TReceiveMessageRequest& req) {
+ return Impl_->ReceiveMessage(req);
+}
+
+TSendMessageResponse TQueueClient::SendMessage(const TSendMessageRequest& req) {
+ return Impl_->SendMessage(req);
+}
+
TModifyPermissionsResponse TQueueClient::ModifyPermissions(const TModifyPermissionsRequest& req) {
return Impl_->ModifyPermissions(req);
}
diff --git a/ydb/core/ymq/client/cpp/client.h b/ydb/core/ymq/client/cpp/client.h
index d42ed84326..fe48f8b7c4 100644
--- a/ydb/core/ymq/client/cpp/client.h
+++ b/ydb/core/ymq/client/cpp/client.h
@@ -1,95 +1,95 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/protos/sqs.pb.h>
-
-#include <util/generic/yexception.h>
-#include <util/generic/vector.h>
+
+#include <util/generic/yexception.h>
+#include <util/generic/vector.h>
#include <util/system/defaults.h>
-
+
namespace NKikimr::NSQS {
-
-struct TClientOptions {
-#define DECLARE_FIELD(name, type, default) \
- type name{default}; \
+
+struct TClientOptions {
+#define DECLARE_FIELD(name, type, default) \
+ type name{default}; \
TClientOptions& Y_CAT(Set, name)(const type& value) { \
- name = value; \
- return *this; \
- }
-
- /// Hostname of server to bind to.
- DECLARE_FIELD(Host, TString, "127.0.0.1");
- /// Service port.
- DECLARE_FIELD(Port, ui16, 2135);
- /// Throw exception when queue's request finished with error.
- DECLARE_FIELD(Throw, bool, true);
-
-#undef DECLARE_FIELD
-};
-
-class TQueueException : public yexception {
-public:
- TQueueException()
- { }
-
+ name = value; \
+ return *this; \
+ }
+
+ /// Hostname of server to bind to.
+ DECLARE_FIELD(Host, TString, "127.0.0.1");
+ /// Service port.
+ DECLARE_FIELD(Port, ui16, 2135);
+ /// Throw exception when queue's request finished with error.
+ DECLARE_FIELD(Throw, bool, true);
+
+#undef DECLARE_FIELD
+};
+
+class TQueueException : public yexception {
+public:
+ TQueueException()
+ { }
+
TQueueException(const TError& error, const TString& requestId)
- : Error_(error)
+ : Error_(error)
, RequestId(requestId)
- {
- Append(error.GetMessage());
- }
-
+ {
+ Append(error.GetMessage());
+ }
+
TString Message() const {
- return Error_.GetMessage();
- }
-
+ return Error_.GetMessage();
+ }
+
int Status() const {
- return Error_.GetStatus();
- }
-
+ return Error_.GetStatus();
+ }
+
const TError& Error() const {
- return Error_;
- }
-
+ return Error_;
+ }
+
const TString& GetRequestId() const {
return RequestId;
}
-private:
- TError Error_;
+private:
+ TError Error_;
TString RequestId;
-};
-
-class TQueueClient {
-public:
- TQueueClient(const TClientOptions& options = TClientOptions());
- ~TQueueClient();
-
- TChangeMessageVisibilityResponse ChangeMessageVisibility(const TChangeMessageVisibilityRequest& req);
-
- TCreateQueueResponse CreateQueue(const TCreateQueueRequest& req);
-
- TCreateUserResponse CreateUser(const TCreateUserRequest& req);
-
- /// Deletes message from a specified persistent queue.
- TDeleteMessageResponse DeleteMessage(const TDeleteMessageRequest& req);
- TDeleteMessageBatchResponse DeleteMessageBatch(const TDeleteMessageBatchRequest& req);
-
- TDeleteQueueResponse DeleteQueue(const TString& name);
-
- TDeleteQueueResponse DeleteQueue(const TDeleteQueueRequest& req);
-
- TDeleteUserResponse DeleteUser(const TDeleteUserRequest& req);
-
- TListQueuesResponse ListQueues(const TListQueuesRequest& req);
-
- TListUsersResponse ListUsers(const TListUsersRequest& req);
-
- TPurgeQueueResponse PurgeQueue(const TPurgeQueueRequest& req);
-
- TReceiveMessageResponse ReceiveMessage(const TReceiveMessageRequest& req);
-
- TSendMessageResponse SendMessage(const TSendMessageRequest& req);
-
+};
+
+class TQueueClient {
+public:
+ TQueueClient(const TClientOptions& options = TClientOptions());
+ ~TQueueClient();
+
+ TChangeMessageVisibilityResponse ChangeMessageVisibility(const TChangeMessageVisibilityRequest& req);
+
+ TCreateQueueResponse CreateQueue(const TCreateQueueRequest& req);
+
+ TCreateUserResponse CreateUser(const TCreateUserRequest& req);
+
+ /// Deletes message from a specified persistent queue.
+ TDeleteMessageResponse DeleteMessage(const TDeleteMessageRequest& req);
+ TDeleteMessageBatchResponse DeleteMessageBatch(const TDeleteMessageBatchRequest& req);
+
+ TDeleteQueueResponse DeleteQueue(const TString& name);
+
+ TDeleteQueueResponse DeleteQueue(const TDeleteQueueRequest& req);
+
+ TDeleteUserResponse DeleteUser(const TDeleteUserRequest& req);
+
+ TListQueuesResponse ListQueues(const TListQueuesRequest& req);
+
+ TListUsersResponse ListUsers(const TListUsersRequest& req);
+
+ TPurgeQueueResponse PurgeQueue(const TPurgeQueueRequest& req);
+
+ TReceiveMessageResponse ReceiveMessage(const TReceiveMessageRequest& req);
+
+ TSendMessageResponse SendMessage(const TSendMessageRequest& req);
+
TModifyPermissionsResponse ModifyPermissions(const TModifyPermissionsRequest& req);
TGetQueueAttributesResponse GetQueueAttributes(const TGetQueueAttributesRequest& req);
@@ -98,9 +98,9 @@ public:
TListPermissionsResponse ListPermissions(const TListPermissionsRequest& req);
-private:
- class TImpl;
- THolder<TImpl> Impl_;
-};
-
+private:
+ class TImpl;
+ THolder<TImpl> Impl_;
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/client/cpp/ya.make b/ydb/core/ymq/client/cpp/ya.make
index 96d064b19c..c764ece2c7 100644
--- a/ydb/core/ymq/client/cpp/ya.make
+++ b/ydb/core/ymq/client/cpp/ya.make
@@ -3,15 +3,15 @@ OWNER(
g:sqs
)
-LIBRARY()
-
-SRCS(
- client.cpp
-)
-
-PEERDIR(
+LIBRARY()
+
+SRCS(
+ client.cpp
+)
+
+PEERDIR(
ydb/core/protos
ydb/public/lib/deprecated/client
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/ymq/client/ya.make b/ydb/core/ymq/client/ya.make
index fdb750c718..4ad297bf8d 100644
--- a/ydb/core/ymq/client/ya.make
+++ b/ydb/core/ymq/client/ya.make
@@ -3,7 +3,7 @@ OWNER(
g:sqs
)
-RECURSE(
- bin
- cpp
-)
+RECURSE(
+ bin
+ cpp
+)
diff --git a/ydb/core/ymq/http/http.cpp b/ydb/core/ymq/http/http.cpp
index 5d0963bfb2..8f1bbfcbb8 100644
--- a/ydb/core/ymq/http/http.cpp
+++ b/ydb/core/ymq/http/http.cpp
@@ -1,5 +1,5 @@
-#include "http.h"
-#include "xml.h"
+#include "http.h"
+#include "xml.h"
#include <ydb/core/protos/services.pb.h>
#include <ydb/library/http_proxy/authorization/auth_helpers.h>
@@ -12,28 +12,28 @@
#include <ydb/core/ymq/base/helpers.h>
#include <ydb/core/ymq/base/limits.h>
#include <ydb/core/ymq/base/secure_protobuf_printer.h>
-
+
#include <library/cpp/actors/core/actorsystem.h>
#include <library/cpp/actors/core/log.h>
#include <library/cpp/http/server/response.h>
#include <library/cpp/http/misc/parsed_request.h>
-
+
#include <util/generic/guid.h>
-#include <util/generic/hash.h>
+#include <util/generic/hash.h>
#include <util/generic/set.h>
#include <util/generic/hash_set.h>
#include <util/network/init.h>
-#include <util/string/ascii.h>
+#include <util/string/ascii.h>
#include <util/string/builder.h>
#include <library/cpp/string_utils/quote/quote.h>
-#include <util/string/split.h>
+#include <util/string/split.h>
#include <library/cpp/string_utils/url/url.h>
-
+
namespace NKikimr::NSQS {
-
-using NKikimrClient::TSqsRequest;
-using NKikimrClient::TSqsResponse;
-
+
+using NKikimrClient::TSqsRequest;
+using NKikimrClient::TSqsResponse;
+
namespace {
constexpr TStringBuf AUTHORIZATION_HEADER = "authorization";
@@ -61,15 +61,15 @@ bool IsPrivateTokenHeader(TStringBuf headerName) {
}
return false;
}
-
+
class THttpCallback : public IReplyCallback {
-public:
+public:
THttpCallback(THttpRequest* req, const TSqsRequest& requestParams)
- : Request_(req)
+ : Request_(req)
, RequestParams_(requestParams)
- {
- }
-
+ {
+ }
+
void DoSendReply(const TSqsResponse& resp) override {
auto response = ResponseToAmazonXmlFormat(resp);
LogRequest(resp, response);
@@ -79,10 +79,10 @@ public:
response.ResourceId = resp.GetResourceId();
Request_->SendResponse(response);
- }
-
+ }
+
-private:
+private:
TString LogString(const TSqsResponse& resp) const {
TStringBuilder rec;
rec << "Request: " << SecureShortUtf8DebugString(RequestParams_)
@@ -100,15 +100,15 @@ private:
private:
THttpRequest* const Request_;
const TSqsRequest RequestParams_;
-};
-
+};
+
class TPingHttpCallback : public IPingReplyCallback {
public:
TPingHttpCallback(THttpRequest* req)
: Request_(req)
{
}
-
+
void DoSendReply() override {
Request_->SendResponse(TSqsHttpResponse("pong", 200, PLAIN_TEXT_CONTENT_TYPE));
}
@@ -120,12 +120,12 @@ private:
} // namespace
THttpRequest::THttpRequest(TAsyncHttpServer* p)
- : Parent_(p)
-{
+ : Parent_(p)
+{
Parent_->UpdateConnectionsCountCounter();
DebugInfo->UnparsedHttpRequests.emplace(this);
-}
-
+}
+
THttpRequest::~THttpRequest() {
Parent_->UpdateConnectionsCountCounter();
DebugInfo->EraseHttpRequest(RequestId_, this);
@@ -135,17 +135,17 @@ void THttpRequest::SendResponse(const TSqsHttpResponse& r) {
auto* parent = Parent_;
auto& actorSystem = *Parent_->ActorSystem_;
const TString reqId = RequestId_;
- Response_ = r;
-
- try {
+ Response_ = r;
+
+ try {
static_cast<IObjectInQueue*>(this)->Process(nullptr); // calls DoReply()
- } catch (...) {
+ } catch (...) {
// Note: The 'this' pointer has been destroyed inside Process.
RLOG_SQS_REQ_BASE_ERROR(actorSystem, reqId, "Error while sending response: " << CurrentExceptionMessage());
INC_COUNTER(parent->HttpCounters_, InternalExceptions);
- }
-}
-
+ }
+}
+
void THttpRequest::WriteResponse(const TReplyParams& replyParams, const TSqsHttpResponse& response) {
LogHttpRequestResponse(replyParams, response);
THttpResponse httpResponse(static_cast<HttpCodes>(response.StatusCode));
@@ -172,8 +172,8 @@ void THttpRequest::WriteResponse(const TReplyParams& replyParams, const TSqsHttp
}
httpResponse.OutTo(replyParams.Output);
-}
-
+}
+
TString THttpRequest::LogHttpRequestResponseCommonInfoString() {
const TDuration duration = TInstant::Now() - StartTime_;
TStringBuilder logString;
@@ -217,11 +217,11 @@ void THttpRequest::LogHttpRequestResponse(const TReplyParams& replyParams, const
bool THttpRequest::DoReply(const TReplyParams& p) {
// this function is called two times
- if (Response_.Defined()) {
+ if (Response_.Defined()) {
WriteResponse(p, *Response_);
- return true;
- }
-
+ return true;
+ }
+
try {
ParseHeaders(p.Input);
@@ -229,8 +229,8 @@ bool THttpRequest::DoReply(const TReplyParams& p) {
return false;
}
- ParseRequest(p.Input);
-
+ ParseRequest(p.Input);
+
const TDuration parseTime = TInstant::Now() - StartTime_;
RLOG_SQS_BASE_DEBUG(*Parent_->ActorSystem_, "Parse time: [" << parseTime.MilliSeconds() << "ms]");
RLOG_SQS_BASE_INFO(
@@ -242,34 +242,34 @@ bool THttpRequest::DoReply(const TReplyParams& p) {
if (!Parent_->Config.GetYandexCloudMode() && UserName_.empty()) {
WriteResponse(p, MakeErrorXmlResponse(NErrors::MISSING_PARAMETER, Parent_->AggregatedUserCounters_.Get(), "No user name was provided."));
- return true;
- }
-
- if (SetupRequest()) {
- return false;
- } else {
- if (Response_.Defined()) {
+ return true;
+ }
+
+ if (SetupRequest()) {
+ return false;
+ } else {
+ if (Response_.Defined()) {
WriteResponse(p, *Response_);
- } else {
+ } else {
WriteResponse(p, MakeErrorXmlResponse(NErrors::INTERNAL_FAILURE, Parent_->AggregatedUserCounters_.Get()));
- }
- return true;
- }
- } catch (...) {
+ }
+ return true;
+ }
+ } catch (...) {
if (UserCounters_) {
INC_COUNTER(UserCounters_, RequestExceptions);
} else if (Parent_->HttpCounters_) {
INC_COUNTER(Parent_->HttpCounters_, RequestExceptions);
}
-
+
RLOG_SQS_BASE_INFO(*Parent_->ActorSystem_, "http exception: "
- << "message=" << CurrentExceptionMessage());
-
+ << "message=" << CurrentExceptionMessage());
+
WriteResponse(p, MakeErrorXmlResponseFromCurrentException(Parent_->AggregatedUserCounters_.Get(), RequestId_));
- return true;
- }
-}
-
+ return true;
+ }
+}
+
TString THttpRequest::GetRequestPathPart(TStringBuf path, size_t partIdx) const {
if (IsPrivateRequest_) {
path.SkipPrefix(PRIVATE_REQUEST_PATH_PREFIX);
@@ -279,10 +279,10 @@ TString THttpRequest::GetRequestPathPart(TStringBuf path, size_t partIdx) const
StringSplitter(path).Split('/').AddTo(&items);
if (items.size() > partIdx) {
return TString(items[partIdx]);
- }
- return TString();
-}
-
+ }
+ return TString();
+}
+
TString THttpRequest::ExtractQueueNameFromPath(const TStringBuf path) {
return GetRequestPathPart(path, 2);
}
@@ -295,13 +295,13 @@ void THttpRequest::ExtractQueueAndAccountNames(const TStringBuf path) {
if (Action_ == EAction::ModifyPermissions)
return;
- if (Action_ == EAction::GetQueueUrl || Action_ == EAction::CreateQueue) {
- if (!QueryParams_.QueueName) {
+ if (Action_ == EAction::GetQueueUrl || Action_ == EAction::CreateQueue) {
+ if (!QueryParams_.QueueName) {
throw TSQSException(NErrors::MISSING_PARAMETER) << "No queue name was provided.";
- }
-
- QueueName_ = *QueryParams_.QueueName;
- } else {
+ }
+
+ QueueName_ = *QueryParams_.QueueName;
+ } else {
const auto pathAndQuery = QueryParams_.QueueUrl ? GetPathAndQuery(*QueryParams_.QueueUrl) : GetPathAndQuery(path);
QueueName_ = ExtractQueueNameFromPath(pathAndQuery);
AccountName_ = ExtractAccountNameFromPath(pathAndQuery);
@@ -317,9 +317,9 @@ void THttpRequest::ExtractQueueAndAccountNames(const TStringBuf path) {
}
}
}
- }
+ }
}
-
+
TString THttpRequest::HttpHeadersLogString(const THttpInput& input) {
TStringBuilder headersStr;
for (const auto& header : input.Headers()) {
@@ -343,9 +343,9 @@ TString THttpRequest::HttpHeadersLogString(const THttpInput& input) {
void THttpRequest::ParseHeaders(const THttpInput& input) {
TString sourceReqId;
- for (const auto& header : input.Headers()) {
+ for (const auto& header : input.Headers()) {
if (AsciiEqualsIgnoreCase(header.Name(), AUTHORIZATION_HEADER)) {
- ParseAuthorization(header.Value());
+ ParseAuthorization(header.Value());
} else if (AsciiEqualsIgnoreCase(header.Name(), SECURITY_TOKEN_HEADER)) {
SecurityToken_ = header.Value();
} else if (AsciiEqualsIgnoreCase(header.Name(), IAM_TOKEN_HEADER)) {
@@ -354,8 +354,8 @@ void THttpRequest::ParseHeaders(const THttpInput& input) {
SourceAddress_ = header.Value();
} else if (AsciiEqualsIgnoreCase(header.Name(), REQUEST_ID_HEADER)) {
sourceReqId = header.Value();
- }
- }
+ }
+ }
GenerateRequestId(sourceReqId);
@@ -364,28 +364,28 @@ void THttpRequest::ParseHeaders(const THttpInput& input) {
}
RLOG_SQS_BASE_TRACE(*Parent_->ActorSystem_, HttpHeadersLogString(input));
-}
-
+}
+
void THttpRequest::ParseAuthorization(const TString& value) {
TMap<TString, TString> params = ParseAuthorizationParams(value);
-
+
TString credential = params[CREDENTIAL_PARAM];
const size_t slashPos = credential.find('/');
if (slashPos == TString::npos) {
UserName_ = credential;
} else {
UserName_ = credential.substr(0, slashPos);
- }
-}
-
+ }
+}
+
void THttpRequest::ParseCgiParameters(const TCgiParameters& params) {
- TParametersParser parser(&QueryParams_);
-
- for (auto pi = params.begin(); pi != params.end(); ++pi) {
- parser.Append(pi->first, pi->second);
- }
-}
-
+ TParametersParser parser(&QueryParams_);
+
+ for (auto pi = params.begin(); pi != params.end(); ++pi) {
+ parser.Append(pi->first, pi->second);
+ }
+}
+
void THttpRequest::ParsePrivateRequestPathPrefix(const TStringBuf& path) {
if (path.StartsWith(PRIVATE_REQUEST_PATH_PREFIX)) {
IsPrivateRequest_ = true;
@@ -411,7 +411,7 @@ void THttpRequest::ParseRequest(THttpInput& input) {
UserCounters_ = Parent_->HttpCounters_->GetUserCounters(UserName_);
}
- TParsedHttpFull parsed(input.FirstLine());
+ TParsedHttpFull parsed(input.FirstLine());
HttpMethod = TString(parsed.Method);
ui64 contentLength = 0;
if (HttpMethod == "POST") {
@@ -424,12 +424,12 @@ void THttpRequest::ParseRequest(THttpInput& input) {
}
} else {
throw TSQSException(NErrors::MISSING_PARAMETER) << "No Content-Length.";
- }
+ }
} catch (...) {
RLOG_SQS_BASE_ERROR(*Parent_->ActorSystem_, "Failed to parse http request \"" << input.FirstLine() << "\": " << CurrentExceptionMessage());
}
}
-
+
RLOG_SQS_BASE_DEBUG(*Parent_->ActorSystem_, "Incoming http request: " << input.FirstLine());
ParsePrivateRequestPathPrefix(parsed.Path);
@@ -439,12 +439,12 @@ void THttpRequest::ParseRequest(THttpInput& input) {
if (HttpMethod == "POST") {
ParseCgiParameters(TCgiParameters(TStringBuf(InputData->Data(), contentLength)));
} else if (HttpMethod == "GET") {
- ParseCgiParameters(TCgiParameters(parsed.Cgi));
- } else {
+ ParseCgiParameters(TCgiParameters(parsed.Cgi));
+ } else {
throw TSQSException(NErrors::MALFORMED_QUERY_STRING) << "Unsupported method: \"" << parsed.Method << "\".";
- }
-
- if (QueryParams_.Action) {
+ }
+
+ if (QueryParams_.Action) {
if (IsIn(ModifyPermissionsActions, *QueryParams_.Action)) {
Action_ = EAction::ModifyPermissions;
} else {
@@ -453,10 +453,10 @@ void THttpRequest::ParseRequest(THttpInput& input) {
THttpActionCounters* counters = GetActionCounters();
INC_COUNTER(counters, Requests);
- } else {
+ } else {
throw TSQSException(NErrors::MISSING_ACTION) << "Action param was not found.";
- }
-
+ }
+
if (QueryParams_.FolderId) {
FolderId_ = *QueryParams_.FolderId;
}
@@ -466,8 +466,8 @@ void THttpRequest::ParseRequest(THttpInput& input) {
if (Parent_->Config.GetYandexCloudMode() && !IamToken_ && !FolderId_) {
AwsSignature_.Reset(new TAwsRequestSignV4(input, parsed, InputData));
}
-}
-
+}
+
#define HANDLE_SETUP_ACTION_CASE(NAME) \
case EAction::NAME: { \
Y_CAT(Setup, NAME)(requestHolder->Y_CAT(Mutable, NAME)()); \
@@ -492,7 +492,7 @@ void THttpRequest::ParseRequest(THttpInput& input) {
bool THttpRequest::SetupRequest() {
auto requestHolder = MakeHolder<TSqsRequest>();
requestHolder->SetRequestId(RequestId_);
-
+
// Validate batches
if (IsBatchAction(Action_)) {
if (QueryParams_.BatchEntries.empty()) {
@@ -513,7 +513,7 @@ bool THttpRequest::SetupRequest() {
}
}
- switch (Action_) {
+ switch (Action_) {
HANDLE_SETUP_ACTION_CASE(ChangeMessageVisibility);
HANDLE_SETUP_ACTION_CASE(ChangeMessageVisibilityBatch);
HANDLE_SETUP_ACTION_CASE(CreateQueue);
@@ -534,18 +534,18 @@ bool THttpRequest::SetupRequest() {
HANDLE_SETUP_ACTION_CASE(SendMessage);
HANDLE_SETUP_ACTION_CASE(SendMessageBatch);
HANDLE_SETUP_ACTION_CASE(SetQueueAttributes);
-
+
HANDLE_SETUP_PRIVATE_ACTION_CASE(DeleteQueueBatch);
HANDLE_SETUP_PRIVATE_ACTION_CASE(CountQueues);
HANDLE_SETUP_PRIVATE_ACTION_CASE(PurgeQueueBatch);
HANDLE_SETUP_PRIVATE_ACTION_CASE(GetQueueAttributesBatch);
-
+
case EAction::Unknown:
case EAction::ActionsArraySize: // to avoid compiler warning
Response_ = MakeErrorXmlResponse(NErrors::MISSING_ACTION, Parent_->AggregatedUserCounters_.Get(), TStringBuilder() << "Unknown action: \"" + *QueryParams_.Action << "\".");
return false;
- }
-
+ }
+
RLOG_SQS_BASE_DEBUG(*Parent_->ActorSystem_, "Create proxy action actor for request " << SecureShortUtf8DebugString(*requestHolder));
const bool enableQueueLeader = Parent_->Config.HasEnableQueueMaster()
@@ -572,89 +572,89 @@ bool THttpRequest::SetupRequest() {
*Parent_->ActorSystem_,
std::move(data));
- return true;
-}
-
+ return true;
+}
+
void THttpRequest::SetupChangeMessageVisibility(TChangeMessageVisibilityRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-
- if (QueryParams_.ReceiptHandle) {
- req->SetReceiptHandle(CGIEscapeRet(*QueryParams_.ReceiptHandle));
- }
- if (QueryParams_.VisibilityTimeout) {
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+
+ if (QueryParams_.ReceiptHandle) {
+ req->SetReceiptHandle(CGIEscapeRet(*QueryParams_.ReceiptHandle));
+ }
+ if (QueryParams_.VisibilityTimeout) {
req->SetVisibilityTimeout(*QueryParams_.VisibilityTimeout);
- }
-}
-
+ }
+}
+
void THttpRequest::SetupChangeMessageVisibilityBatch(TChangeMessageVisibilityBatchRequest* const req) {
- req->MutableAuth()->SetUserName(UserName_);
- req->SetQueueName(QueueName_);
-
- for (const auto& item : QueryParams_.BatchEntries) {
- const TParameters& params = item.second;
- TChangeMessageVisibilityRequest* const entry = req->AddEntries();
-
- if (params.Id) {
- entry->SetId(*params.Id);
- }
- if (params.ReceiptHandle) {
- entry->SetReceiptHandle(CGIEscapeRet(*params.ReceiptHandle));
- }
- if (params.VisibilityTimeout) {
+ req->MutableAuth()->SetUserName(UserName_);
+ req->SetQueueName(QueueName_);
+
+ for (const auto& item : QueryParams_.BatchEntries) {
+ const TParameters& params = item.second;
+ TChangeMessageVisibilityRequest* const entry = req->AddEntries();
+
+ if (params.Id) {
+ entry->SetId(*params.Id);
+ }
+ if (params.ReceiptHandle) {
+ entry->SetReceiptHandle(CGIEscapeRet(*params.ReceiptHandle));
+ }
+ if (params.VisibilityTimeout) {
entry->SetVisibilityTimeout(*params.VisibilityTimeout);
- }
- }
-}
-
+ }
+ }
+}
+
void THttpRequest::SetupCreateQueue(TCreateQueueRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-
- for (const auto& attr : QueryParams_.Attributes) {
- req->AddAttributes()->CopyFrom(attr.second);
- }
-}
-
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+
+ for (const auto& attr : QueryParams_.Attributes) {
+ req->AddAttributes()->CopyFrom(attr.second);
+ }
+}
+
void THttpRequest::SetupCreateUser(TCreateUserRequest* const req) {
- req->MutableAuth()->SetUserName(UserName_);
-
- if (QueryParams_.UserName) {
+ req->MutableAuth()->SetUserName(UserName_);
+
+ if (QueryParams_.UserName) {
req->SetUserName(*QueryParams_.UserName);
- }
-}
-
+ }
+}
+
void THttpRequest::SetupDeleteMessage(TDeleteMessageRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-
- if (QueryParams_.ReceiptHandle) {
- req->SetReceiptHandle(CGIEscapeRet(*QueryParams_.ReceiptHandle));
- }
-}
-
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+
+ if (QueryParams_.ReceiptHandle) {
+ req->SetReceiptHandle(CGIEscapeRet(*QueryParams_.ReceiptHandle));
+ }
+}
+
void THttpRequest::SetupDeleteMessageBatch(TDeleteMessageBatchRequest* const req) {
- req->MutableAuth()->SetUserName(UserName_);
- req->SetQueueName(QueueName_);
-
- for (const auto& item : QueryParams_.BatchEntries) {
- const TParameters& params = item.second;
- TDeleteMessageRequest* const entry = req->AddEntries();
-
- if (params.Id) {
- entry->SetId(*params.Id);
- }
- if (params.ReceiptHandle) {
- entry->SetReceiptHandle(CGIEscapeRet(*params.ReceiptHandle));
- }
- }
-}
-
+ req->MutableAuth()->SetUserName(UserName_);
+ req->SetQueueName(QueueName_);
+
+ for (const auto& item : QueryParams_.BatchEntries) {
+ const TParameters& params = item.second;
+ TDeleteMessageRequest* const entry = req->AddEntries();
+
+ if (params.Id) {
+ entry->SetId(*params.Id);
+ }
+ if (params.ReceiptHandle) {
+ entry->SetReceiptHandle(CGIEscapeRet(*params.ReceiptHandle));
+ }
+ }
+}
+
void THttpRequest::SetupDeleteQueue(TDeleteQueueRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-}
-
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+}
+
void THttpRequest::SetupListPermissions(TListPermissionsRequest* const req) {
if (QueryParams_.Path) {
req->SetPath(*QueryParams_.Path);
@@ -717,42 +717,42 @@ void THttpRequest::SetupPrivateGetQueueAttributesBatch(TGetQueueAttributesBatchR
void THttpRequest::SetupDeleteUser(TDeleteUserRequest* const req) {
req->MutableAuth()->SetUserName(UserName_);
-
- if (QueryParams_.UserName) {
+
+ if (QueryParams_.UserName) {
req->SetUserName(*QueryParams_.UserName);
- }
-}
-
+ }
+}
+
void THttpRequest::SetupGetQueueAttributes(TGetQueueAttributesRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-
- for (const auto& name : QueryParams_.AttributeNames) {
- req->AddNames(name.second);
- }
-}
-
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+
+ for (const auto& name : QueryParams_.AttributeNames) {
+ req->AddNames(name.second);
+ }
+}
+
void THttpRequest::SetupGetQueueUrl(TGetQueueUrlRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-}
-
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+}
+
void THttpRequest::SetupListQueues(TListQueuesRequest* const req) {
- req->MutableAuth()->SetUserName(UserName_);
-
- if (QueryParams_.QueueNamePrefix) {
- req->SetQueueNamePrefix(*QueryParams_.QueueNamePrefix);
- }
-}
-
+ req->MutableAuth()->SetUserName(UserName_);
+
+ if (QueryParams_.QueueNamePrefix) {
+ req->SetQueueNamePrefix(*QueryParams_.QueueNamePrefix);
+ }
+}
+
void THttpRequest::SetupListUsers(TListUsersRequest* const req) {
- req->MutableAuth()->SetUserName(UserName_);
-
- if (QueryParams_.UserNamePrefix) {
- req->SetUserNamePrefix(*QueryParams_.UserNamePrefix);
- }
-}
-
+ req->MutableAuth()->SetUserName(UserName_);
+
+ if (QueryParams_.UserNamePrefix) {
+ req->SetUserNamePrefix(*QueryParams_.UserNamePrefix);
+ }
+}
+
template<typename TModifyPermissionsAction>
static void SetupModifyPermissionsAction(const TParameters& queryParams, TModifyPermissionsAction& action) {
if (queryParams.Subject) {
@@ -791,37 +791,37 @@ void THttpRequest::SetupModifyPermissions(TModifyPermissionsRequest* const req)
}
void THttpRequest::SetupPurgeQueue(TPurgeQueueRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-}
-
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+}
+
void THttpRequest::SetupReceiveMessage(TReceiveMessageRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-
- if (QueryParams_.MaxNumberOfMessages) {
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+
+ if (QueryParams_.MaxNumberOfMessages) {
req->SetMaxNumberOfMessages(*QueryParams_.MaxNumberOfMessages);
- } else {
- req->SetMaxNumberOfMessages(1);
- }
- if (QueryParams_.ReceiveRequestAttemptId) {
- req->SetReceiveRequestAttemptId(*QueryParams_.ReceiveRequestAttemptId);
- }
- if (QueryParams_.VisibilityTimeout) {
+ } else {
+ req->SetMaxNumberOfMessages(1);
+ }
+ if (QueryParams_.ReceiveRequestAttemptId) {
+ req->SetReceiveRequestAttemptId(*QueryParams_.ReceiveRequestAttemptId);
+ }
+ if (QueryParams_.VisibilityTimeout) {
req->SetVisibilityTimeout(*QueryParams_.VisibilityTimeout);
- }
- if (QueryParams_.WaitTimeSeconds) {
+ }
+ if (QueryParams_.WaitTimeSeconds) {
req->SetWaitTimeSeconds(*QueryParams_.WaitTimeSeconds);
- }
-
- for (const auto& name : QueryParams_.AttributeNames) {
- req->AddAttributeName(name.second);
- }
- for (const auto& item : QueryParams_.MessageAttributes) {
- req->AddMessageAttributeName(item.second.GetName());
- }
-}
-
+ }
+
+ for (const auto& name : QueryParams_.AttributeNames) {
+ req->AddAttributeName(name.second);
+ }
+ for (const auto& item : QueryParams_.MessageAttributes) {
+ req->AddMessageAttributeName(item.second.GetName());
+ }
+}
+
static void ValidateMessageAttribute(const TMessageAttribute& attr, bool allowYandexPrefix, bool& hasYandexPrefix) {
if (!ValidateMessageAttributeName(attr.GetName(), hasYandexPrefix, allowYandexPrefix)) {
throw TSQSException(NErrors::INVALID_PARAMETER_VALUE) << "Invalid message attribute name.";
@@ -862,78 +862,78 @@ static TString FormatNames(const TMap<int, TMessageAttribute>& messageAttributes
}
void THttpRequest::SetupSendMessage(TSendMessageRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-
- if (QueryParams_.DelaySeconds) {
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+
+ if (QueryParams_.DelaySeconds) {
req->SetDelaySeconds(*QueryParams_.DelaySeconds);
- }
- if (QueryParams_.MessageBody) {
- req->SetMessageBody(*QueryParams_.MessageBody);
- }
- if (QueryParams_.MessageDeduplicationId) {
- req->SetMessageDeduplicationId(*QueryParams_.MessageDeduplicationId);
- }
- if (QueryParams_.MessageGroupId) {
- req->SetMessageGroupId(*QueryParams_.MessageGroupId);
- }
-
+ }
+ if (QueryParams_.MessageBody) {
+ req->SetMessageBody(*QueryParams_.MessageBody);
+ }
+ if (QueryParams_.MessageDeduplicationId) {
+ req->SetMessageDeduplicationId(*QueryParams_.MessageDeduplicationId);
+ }
+ if (QueryParams_.MessageGroupId) {
+ req->SetMessageGroupId(*QueryParams_.MessageGroupId);
+ }
+
bool hasYandexPrefix = false;
ValidateMessageAttributes(QueryParams_.MessageAttributes, Parent_->Config.GetAllowYandexAttributePrefix(), hasYandexPrefix);
if (hasYandexPrefix) {
RLOG_SQS_BASE_WARN(*Parent_->ActorSystem_, "Attribute names contain yandex reserved prefix: " << FormatNames(QueryParams_.MessageAttributes));
}
- for (const auto& item : QueryParams_.MessageAttributes) {
- req->AddMessageAttributes()->CopyFrom(item.second);
- }
-}
-
+ for (const auto& item : QueryParams_.MessageAttributes) {
+ req->AddMessageAttributes()->CopyFrom(item.second);
+ }
+}
+
void THttpRequest::SetupSendMessageBatch(TSendMessageBatchRequest* const req) {
- req->MutableAuth()->SetUserName(UserName_);
- req->SetQueueName(QueueName_);
-
- for (const auto& item : QueryParams_.BatchEntries) {
- const TParameters& params = item.second;
- TSendMessageRequest* const entry = req->AddEntries();
-
- if (params.DelaySeconds) {
+ req->MutableAuth()->SetUserName(UserName_);
+ req->SetQueueName(QueueName_);
+
+ for (const auto& item : QueryParams_.BatchEntries) {
+ const TParameters& params = item.second;
+ TSendMessageRequest* const entry = req->AddEntries();
+
+ if (params.DelaySeconds) {
entry->SetDelaySeconds(*params.DelaySeconds);
- }
- if (params.Id) {
- entry->SetId(*params.Id);
- }
- if (params.MessageBody) {
- entry->SetMessageBody(*params.MessageBody);
- }
- if (params.MessageDeduplicationId) {
- entry->SetMessageDeduplicationId(*params.MessageDeduplicationId);
- }
- if (params.MessageGroupId) {
- entry->SetMessageGroupId(*params.MessageGroupId);
- }
-
+ }
+ if (params.Id) {
+ entry->SetId(*params.Id);
+ }
+ if (params.MessageBody) {
+ entry->SetMessageBody(*params.MessageBody);
+ }
+ if (params.MessageDeduplicationId) {
+ entry->SetMessageDeduplicationId(*params.MessageDeduplicationId);
+ }
+ if (params.MessageGroupId) {
+ entry->SetMessageGroupId(*params.MessageGroupId);
+ }
+
bool hasYandexPrefix = false;
ValidateMessageAttributes(params.MessageAttributes, Parent_->Config.GetAllowYandexAttributePrefix(), hasYandexPrefix);
if (hasYandexPrefix) {
RLOG_SQS_BASE_WARN(*Parent_->ActorSystem_, "Attribute names contain yandex reserved prefix: " << FormatNames(params.MessageAttributes));
}
- for (const auto& attr : params.MessageAttributes) {
- entry->AddMessageAttributes()->CopyFrom(attr.second);
- }
- }
-}
-
+ for (const auto& attr : params.MessageAttributes) {
+ entry->AddMessageAttributes()->CopyFrom(attr.second);
+ }
+ }
+}
+
void THttpRequest::SetupSetQueueAttributes(TSetQueueAttributesRequest* const req) {
- req->SetQueueName(QueueName_);
- req->MutableAuth()->SetUserName(UserName_);
-
- for (const auto& attr : QueryParams_.Attributes) {
- req->AddAttributes()->CopyFrom(attr.second);
- }
-}
-
+ req->SetQueueName(QueueName_);
+ req->MutableAuth()->SetUserName(UserName_);
+
+ for (const auto& attr : QueryParams_.Attributes) {
+ req->AddAttributes()->CopyFrom(attr.second);
+ }
+}
+
void THttpRequest::ExtractSourceAddressFromSocket() {
struct sockaddr_in6 addr;
socklen_t addrSize = sizeof(struct sockaddr_in6);
@@ -982,25 +982,25 @@ bool THttpRequest::SetupPing(const TReplyParams& params) {
return false;
}
-///////////////////////////////////////////////////////////////////////////////
-
+///////////////////////////////////////////////////////////////////////////////
+
TAsyncHttpServer::TAsyncHttpServer(const NKikimrConfig::TSqsConfig& config)
: THttpServer(this, MakeHttpServerOptions(config))
, Config(config)
-{
+{
DebugInfo->HttpServer = this;
-}
-
+}
+
TAsyncHttpServer::~TAsyncHttpServer() {
Stop();
DebugInfo->HttpServer = nullptr;
}
-
+
void TAsyncHttpServer::Initialize(
NActors::TActorSystem* as, TIntrusivePtr<NMonitoring::TDynamicCounters> sqsCounters,
TIntrusivePtr<NMonitoring::TDynamicCounters> ymqCounters, ui32 poolId
) {
- ActorSystem_ = as;
+ ActorSystem_ = as;
HttpCounters_ = new THttpCounters(Config, sqsCounters->GetSubgroup("subsystem", "http"));
if (Config.GetYandexCloudMode()) {
CloudAuthCounters_ = MakeHolder<TCloudAuthCounters>(Config, sqsCounters->GetSubgroup("subsystem", "cloud_auth"));
@@ -1011,8 +1011,8 @@ void TAsyncHttpServer::Initialize(
);
AggregatedUserCounters_->ShowDetailedCounters(TInstant::Max());
PoolId_ = poolId;
-}
-
+}
+
void TAsyncHttpServer::Start() {
if (!THttpServer::Start()) {
Y_FAIL("Unable to start http server for SQS service on port %" PRIu16, Options().Port);
@@ -1021,8 +1021,8 @@ void TAsyncHttpServer::Start() {
TClientRequest* TAsyncHttpServer::CreateClient() {
return new THttpRequest(this);
-}
-
+}
+
void TAsyncHttpServer::UpdateConnectionsCountCounter() {
if (HttpCounters_) {
*HttpCounters_->ConnectionsCount = GetClientCount();
diff --git a/ydb/core/ymq/http/http.h b/ydb/core/ymq/http/http.h
index 01a2b0edc4..c63b9263f5 100644
--- a/ydb/core/ymq/http/http.h
+++ b/ydb/core/ymq/http/http.h
@@ -1,33 +1,33 @@
-#pragma once
-
-#include "params.h"
-#include "types.h"
+#pragma once
+
+#include "params.h"
+#include "types.h"
#include <ydb/core/protos/config.pb.h>
#include <ydb/core/protos/sqs.pb.h>
-
+
#include <ydb/library/http_proxy/authorization/signature.h>
#include <ydb/core/ymq/base/counters.h>
#include <library/cpp/actors/core/actorsystem.h>
#include <library/cpp/http/server/http.h>
-
+
#include <util/generic/buffer.h>
-#include <util/generic/maybe.h>
+#include <util/generic/maybe.h>
#include <library/cpp/cgiparam/cgiparam.h>
-
+
namespace NKikimr::NSQS {
-
+
class TAsyncHttpServer;
class THttpRequest;
-
+
class THttpRequest : public TRequestReplier {
public:
THttpRequest(TAsyncHttpServer* p);
~THttpRequest();
-
+
void SendResponse(const TSqsHttpResponse& r);
-
+
const TString& GetRequestId() const {
return RequestId_;
}
@@ -38,13 +38,13 @@ public:
private:
bool DoReply(const TReplyParams& p) override;
-
+
void WriteResponse(const TReplyParams& replyParams, const TSqsHttpResponse& response);
TString LogHttpRequestResponseCommonInfoString();
TString LogHttpRequestResponseDebugInfoString(const TReplyParams& replyParams, const TSqsHttpResponse& response);
void LogHttpRequestResponse(const TReplyParams& replyParams, const TSqsHttpResponse& response);
-
+
private:
template<typename T>
void CopyCredentials(T* const request, const NKikimrConfig::TSqsConfig& config) {
@@ -57,19 +57,19 @@ private:
TString GetRequestPathPart(TStringBuf path, size_t partIdx) const;
TString ExtractQueueNameFromPath(const TStringBuf path);
TString ExtractAccountNameFromPath(const TStringBuf path);
-
+
ui64 CalculateRequestSizeInBytes(const THttpInput& input, const ui64 contentLength) const;
void ExtractQueueAndAccountNames(const TStringBuf path);
-
+
TString HttpHeadersLogString(const THttpInput& input);
void ParseHeaders(const THttpInput& input);
void ParseAuthorization(const TString& value);
void ParseRequest(THttpInput& input);
void ParseCgiParameters(const TCgiParameters& params);
void ParsePrivateRequestPathPrefix(const TStringBuf& path);
-
+
bool SetupRequest();
-
+
void SetupChangeMessageVisibility(TChangeMessageVisibilityRequest* const req);
void SetupChangeMessageVisibilityBatch(TChangeMessageVisibilityBatchRequest* const req);
void SetupCreateQueue(TCreateQueueRequest* const req);
@@ -94,7 +94,7 @@ private:
void SetupSendMessageBatch(TSendMessageBatchRequest* const req);
void SetupPurgeQueue(TPurgeQueueRequest* const req);
void SetupSetQueueAttributes(TSetQueueAttributesRequest* const req);
-
+
void ExtractSourceAddressFromSocket();
void GenerateRequestId(const TString& sourceReqId);
@@ -108,7 +108,7 @@ private:
private:
TAsyncHttpServer* const Parent_;
TIntrusivePtr<THttpUserCounters> UserCounters_;
-
+
TParameters QueryParams_;
EAction Action_ = EAction::Unknown;
TString UserName_;
@@ -118,7 +118,7 @@ private:
TString IamToken_;
TString FolderId_;
TString ApiMethod_;
-
+
THolder<TAwsRequestSignV4> AwsSignature_;
TMaybe<TBuffer> InputData;
@@ -134,44 +134,44 @@ private:
bool IsPrivateRequest_ = false; // Has "/private" path prefix
TInstant StartTime_ = TInstant::Now();
};
-
+
class TAsyncHttpServer
: public THttpServer
, public THttpServer::ICallBack
{
friend THttpRequest;
-public:
+public:
TAsyncHttpServer(const NKikimrConfig::TSqsConfig& config);
~TAsyncHttpServer();
-
+
void Initialize(
NActors::TActorSystem* as,
TIntrusivePtr<NMonitoring::TDynamicCounters> sqsCounters,
TIntrusivePtr<NMonitoring::TDynamicCounters> ymqCounters,
ui32 poolId);
-
+
void Start();
NActors::TActorSystem* GetActorSystem() const {
return ActorSystem_;
}
-private:
+private:
// THttpServer::ICallback
- TClientRequest* CreateClient() override;
+ TClientRequest* CreateClient() override;
void OnException() override;
static THttpServerOptions MakeHttpServerOptions(const NKikimrConfig::TSqsConfig& config);
-
+
void UpdateConnectionsCountCounter();
-private:
+private:
const NKikimrConfig::TSqsConfig Config;
NActors::TActorSystem* ActorSystem_ = nullptr;
TIntrusivePtr<THttpCounters> HttpCounters_; // http subsystem counters
THolder<TCloudAuthCounters> CloudAuthCounters_; // cloud_auth subsystem counters
TIntrusivePtr<TUserCounters> AggregatedUserCounters_; // aggregated counters for user in core subsystem
ui32 PoolId_ = 0;
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/http/params.h b/ydb/core/ymq/http/params.h
index 7834fc4f0f..9a3a9728a3 100644
--- a/ydb/core/ymq/http/params.h
+++ b/ydb/core/ymq/http/params.h
@@ -1,55 +1,55 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/protos/sqs.pb.h>
-
-#include <util/generic/map.h>
-#include <util/generic/maybe.h>
-#include <util/generic/string.h>
-
+
+#include <util/generic/map.h>
+#include <util/generic/maybe.h>
+#include <util/generic/string.h>
+
namespace NKikimr::NSQS {
-
-struct TParameters {
- TMaybe<TString> Action;
+
+struct TParameters {
+ TMaybe<TString> Action;
TMaybe<TString> Clear;
TMaybe<ui64> DelaySeconds;
TMaybe<TString> FolderId;
- TMaybe<TString> Id;
+ TMaybe<TString> Id;
TMaybe<ui32> MaxNumberOfMessages;
- TMaybe<TString> MessageBody;
- TMaybe<TString> MessageDeduplicationId;
- TMaybe<TString> MessageGroupId;
+ TMaybe<TString> MessageBody;
+ TMaybe<TString> MessageDeduplicationId;
+ TMaybe<TString> MessageGroupId;
TMaybe<TString> Path;
- TMaybe<TString> QueueName;
- TMaybe<TString> QueueNamePrefix;
- TMaybe<TString> QueueUrl;
- TMaybe<TString> ReceiptHandle;
- TMaybe<TString> ReceiveRequestAttemptId;
+ TMaybe<TString> QueueName;
+ TMaybe<TString> QueueNamePrefix;
+ TMaybe<TString> QueueUrl;
+ TMaybe<TString> ReceiptHandle;
+ TMaybe<TString> ReceiveRequestAttemptId;
TMaybe<TString> Subject;
- TMaybe<TString> UserName;
- TMaybe<TString> UserNamePrefix;
- TMaybe<TString> Version;
+ TMaybe<TString> UserName;
+ TMaybe<TString> UserNamePrefix;
+ TMaybe<TString> Version;
TMaybe<ui64> VisibilityTimeout;
TMaybe<ui64> WaitTimeSeconds;
-
- TMap<int, TString> AttributeNames;
- TMap<int, TAttribute> Attributes;
- TMap<int, TMessageAttribute> MessageAttributes;
- TMap<int, TParameters> BatchEntries;
-};
-
-class TParametersParser {
-public:
- TParametersParser(TParameters* params);
- ~TParametersParser();
-
+
+ TMap<int, TString> AttributeNames;
+ TMap<int, TAttribute> Attributes;
+ TMap<int, TMessageAttribute> MessageAttributes;
+ TMap<int, TParameters> BatchEntries;
+};
+
+class TParametersParser {
+public:
+ TParametersParser(TParameters* params);
+ ~TParametersParser();
+
// Throws TSQSException
- void Append(const TString& name, const TString& value);
-
-private:
- TParameters* const Params_;
- TParameters* CurrentParams_;
- int Id_;
- int Num_;
-};
-
+ void Append(const TString& name, const TString& value);
+
+private:
+ TParameters* const Params_;
+ TParameters* CurrentParams_;
+ int Id_;
+ int Num_;
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/http/parser.rl6 b/ydb/core/ymq/http/parser.rl6
index b617c334a3..fc42e7a99c 100644
--- a/ydb/core/ymq/http/parser.rl6
+++ b/ydb/core/ymq/http/parser.rl6
@@ -1,14 +1,14 @@
#include <ydb/library/http_proxy/error/error.h>
#include <ydb/core/ymq/base/helpers.h>
#include <ydb/core/ymq/http/params.h>
-
+
#include <library/cpp/string_utils/base64/base64.h>
#include <util/string/cast.h>
#include <util/generic/strbuf.h>
namespace NKikimr::NSQS {
-namespace {
+namespace {
const TString& ValidateAlphaNumAndPunctuation128ForAssign(const TString& value, TStringBuf parameterName) {
if (value.size() > 128 || !IsAlphaNumAndPunctuation(value)) {
@@ -53,50 +53,50 @@ TParameterValidator ParseAndValidate(TStringBuf value, TStringBuf parameterName)
return TParameterValidator(value, parameterName);
}
-%%{
-machine params_parser;
-
+%%{
+machine params_parser;
+
include HttpDateTimeParser "../../../../util/datetime/parser.rl6";
-
-alphtype unsigned char;
-
-attribute =
- "Attribute" > { Num_ = 1; } ('.' int %{ Num_ = I; }) ? '.'
- (("Name" % { CurrentParams_->Attributes[Num_].SetName(value); }) |
- ("Value" % { CurrentParams_->Attributes[Num_].SetValue(value); }));
-
-attribute_name =
- "AttributeName" > { Num_ = 1; } ('.' int %{ Num_ = I; }) ?
- % { CurrentParams_->AttributeNames[Num_] = value; };
-
-message_attribute =
- "MessageAttribute" > { Num_ = 1; } ('.' int %{ Num_ = I; }) ? '.'
- (("Name" % { CurrentParams_->MessageAttributes[Num_].SetName(value); }) |
- ("Value" '.'
- (("StringValue" % { CurrentParams_->MessageAttributes[Num_].SetStringValue(value); }) |
+
+alphtype unsigned char;
+
+attribute =
+ "Attribute" > { Num_ = 1; } ('.' int %{ Num_ = I; }) ? '.'
+ (("Name" % { CurrentParams_->Attributes[Num_].SetName(value); }) |
+ ("Value" % { CurrentParams_->Attributes[Num_].SetValue(value); }));
+
+attribute_name =
+ "AttributeName" > { Num_ = 1; } ('.' int %{ Num_ = I; }) ?
+ % { CurrentParams_->AttributeNames[Num_] = value; };
+
+message_attribute =
+ "MessageAttribute" > { Num_ = 1; } ('.' int %{ Num_ = I; }) ? '.'
+ (("Name" % { CurrentParams_->MessageAttributes[Num_].SetName(value); }) |
+ ("Value" '.'
+ (("StringValue" % { CurrentParams_->MessageAttributes[Num_].SetStringValue(value); }) |
("DataType" % { CurrentParams_->MessageAttributes[Num_].SetDataType(value); }) |
("BinaryValue" % { CurrentParams_->MessageAttributes[Num_].SetBinaryValue(Base64Decode(value)); }))));
-
-change_visibility_entry =
- "ChangeMessageVisibilityBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.'
- (("Id" % { CurrentParams_->Id = value; }) |
- ("ReceiptHandle" % { CurrentParams_->ReceiptHandle = value; }) |
+
+change_visibility_entry =
+ "ChangeMessageVisibilityBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.'
+ (("Id" % { CurrentParams_->Id = value; }) |
+ ("ReceiptHandle" % { CurrentParams_->ReceiptHandle = value; }) |
("VisibilityTimeout" % { CurrentParams_->VisibilityTimeout = ParseAndValidate(value, TStringBuf("VisibilityTimeout")); }));
-
-delete_message_entry =
- "DeleteMessageBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.'
- (("Id" % { CurrentParams_->Id = value; }) |
- ("ReceiptHandle" % { CurrentParams_->ReceiptHandle = value; }));
-
-send_message_entry =
- "SendMessageBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.'
+
+delete_message_entry =
+ "DeleteMessageBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.'
+ (("Id" % { CurrentParams_->Id = value; }) |
+ ("ReceiptHandle" % { CurrentParams_->ReceiptHandle = value; }));
+
+send_message_entry =
+ "SendMessageBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.'
(("DelaySeconds" % { CurrentParams_->DelaySeconds = ParseAndValidate(value, TStringBuf("DelaySeconds")); }) |
- ("Id" % { CurrentParams_->Id = value; }) |
- ("MessageBody" % { CurrentParams_->MessageBody = value; }) |
+ ("Id" % { CurrentParams_->Id = value; }) |
+ ("MessageBody" % { CurrentParams_->MessageBody = value; }) |
("MessageDeduplicationId" % { CurrentParams_->MessageDeduplicationId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageDeduplicationId")); }) |
("MessageGroupId" % { CurrentParams_->MessageGroupId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageGroupId")); }) |
- message_attribute);
-
+ message_attribute);
+
delete_queue_entry =
"DeleteQueueBatchRequestEntry" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; }) '.'
(("Id" % { CurrentParams_->Id = value; }) |
@@ -115,75 +115,75 @@ get_queue_attributes_entry =
permissions_entry =
"Permission" > { Id_ = 1; } ('.' int %{ Id_ = I; CurrentParams_ = &Params_->BatchEntries[Id_]; CurrentParams_->Action = value; });
-main := |*
- ('Action') { CurrentParams_->Action = value; };
+main := |*
+ ('Action') { CurrentParams_->Action = value; };
('Clear') { CurrentParams_->Clear = value; };
('DelaySeconds') { CurrentParams_->DelaySeconds = ParseAndValidate(value, TStringBuf("DelaySeconds")); };
('folderId') { CurrentParams_->FolderId = value; };
('MaxNumberOfMessages') { CurrentParams_->MaxNumberOfMessages = ParseAndValidate(value, TStringBuf("MaxNumberOfMessages")); };
- ('MessageBody') { CurrentParams_->MessageBody = value; };
+ ('MessageBody') { CurrentParams_->MessageBody = value; };
('MessageDeduplicationId') { CurrentParams_->MessageDeduplicationId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageDeduplicationId")); };
('MessageGroupId') { CurrentParams_->MessageGroupId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("MessageGroupId")); };
('Path') { CurrentParams_->Path = value; };
- ('QueueName') { CurrentParams_->QueueName = value; };
- ('QueueNamePrefix') { CurrentParams_->QueueNamePrefix = value; };
- ('QueueUrl') { CurrentParams_->QueueUrl = value; };
- ('ReceiptHandle') { CurrentParams_->ReceiptHandle = value; };
+ ('QueueName') { CurrentParams_->QueueName = value; };
+ ('QueueNamePrefix') { CurrentParams_->QueueNamePrefix = value; };
+ ('QueueUrl') { CurrentParams_->QueueUrl = value; };
+ ('ReceiptHandle') { CurrentParams_->ReceiptHandle = value; };
('ReceiveRequestAttemptId') { CurrentParams_->ReceiveRequestAttemptId = ValidateAlphaNumAndPunctuation128ForAssign(value, TStringBuf("ReceiveRequestAttemptId")); };
('Subject') { CurrentParams_->Subject = value; };
- ('UserName') { CurrentParams_->UserName = value; };
- ('UserNamePrefix') { CurrentParams_->UserNamePrefix = value; };
+ ('UserName') { CurrentParams_->UserName = value; };
+ ('UserNamePrefix') { CurrentParams_->UserNamePrefix = value; };
('Version') { CurrentParams_->Version = value; };
('VisibilityTimeout') { CurrentParams_->VisibilityTimeout = ParseAndValidate(value, TStringBuf("VisibilityTimeout")); };
('WaitTimeSeconds') { CurrentParams_->WaitTimeSeconds = ParseAndValidate(value, TStringBuf("WaitTimeSeconds")); };
-
- attribute;
- attribute_name;
- change_visibility_entry;
- delete_message_entry;
- message_attribute;
+
+ attribute;
+ attribute_name;
+ change_visibility_entry;
+ delete_message_entry;
+ message_attribute;
permissions_entry;
- send_message_entry;
+ send_message_entry;
delete_queue_entry;
purge_queue_entry;
get_queue_attributes_entry;
-*|;
-
-}%%
-
-%% write data;
-
-} // namespace
-
-TParametersParser::TParametersParser(TParameters* params)
- : Params_(params)
- , CurrentParams_(params)
- , Id_(1)
- , Num_(1)
-{
-}
-
-TParametersParser::~TParametersParser()
-{ }
-
-void TParametersParser::Append(const TString& name, const TString& value) {
- CurrentParams_ = Params_;
-
- int cs;
- int act;
- int I = 0;
- int Dc = 0;
- const unsigned char *ts, *te;
- %% write init;
-
- Y_UNUSED(ts);
+*|;
+
+}%%
+
+%% write data;
+
+} // namespace
+
+TParametersParser::TParametersParser(TParameters* params)
+ : Params_(params)
+ , CurrentParams_(params)
+ , Id_(1)
+ , Num_(1)
+{
+}
+
+TParametersParser::~TParametersParser()
+{ }
+
+void TParametersParser::Append(const TString& name, const TString& value) {
+ CurrentParams_ = Params_;
+
+ int cs;
+ int act;
+ int I = 0;
+ int Dc = 0;
+ const unsigned char *ts, *te;
+ %% write init;
+
+ Y_UNUSED(ts);
Y_UNUSED(act);
-
- const unsigned char* p = (const unsigned char*)name.data();
- const unsigned char* pe = p + name.size();
- const unsigned char *eof = pe;
-
- %% write exec;
-}
-
+
+ const unsigned char* p = (const unsigned char*)name.data();
+ const unsigned char* pe = p + name.size();
+ const unsigned char *eof = pe;
+
+ %% write exec;
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/http/types.cpp b/ydb/core/ymq/http/types.cpp
index 36da2414ad..5b22048ae5 100644
--- a/ydb/core/ymq/http/types.cpp
+++ b/ydb/core/ymq/http/types.cpp
@@ -1,19 +1,19 @@
-#include "types.h"
-
+#include "types.h"
+
#include <util/generic/is_in.h>
-#include <util/generic/hash.h>
+#include <util/generic/hash.h>
#include <util/generic/hash_set.h>
-
+
namespace NKikimr::NSQS {
-
+
extern const TString XML_CONTENT_TYPE = "application/xml";
extern const TString PLAIN_TEXT_CONTENT_TYPE = "text/plain";
TSqsHttpResponse::TSqsHttpResponse(const TString& body, int status, const TString& contentType)
- : Body(body)
+ : Body(body)
, ContentType(contentType)
- , StatusCode(status)
-{
-}
-
+ , StatusCode(status)
+{
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/http/types.h b/ydb/core/ymq/http/types.h
index c33574572e..cbd7b837a0 100644
--- a/ydb/core/ymq/http/types.h
+++ b/ydb/core/ymq/http/types.h
@@ -1,25 +1,25 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/ymq/base/action.h>
-#include <util/generic/string.h>
-
+#include <util/generic/string.h>
+
namespace NKikimr::NSQS {
-
+
extern const TString XML_CONTENT_TYPE;
extern const TString PLAIN_TEXT_CONTENT_TYPE;
struct TSqsHttpResponse {
- TString Body;
+ TString Body;
TString ContentType;
int StatusCode = 0;
-
+
TString FolderId;
TString ResourceId;
bool IsFifo = false;
TSqsHttpResponse() = default;
TSqsHttpResponse(const TString& body, int status, const TString& contentType = XML_CONTENT_TYPE);
-};
-
+};
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/http/xml.cpp b/ydb/core/ymq/http/xml.cpp
index 0cb6f85274..f0a3c4dfaa 100644
--- a/ydb/core/ymq/http/xml.cpp
+++ b/ydb/core/ymq/http/xml.cpp
@@ -1,16 +1,16 @@
-#include "xml.h"
+#include "xml.h"
#include "xml_builder.h"
-
+
#include <library/cpp/protobuf/json/proto2json.h>
#include <library/cpp/string_utils/base64/base64.h>
-#include <util/string/builder.h>
+#include <util/string/builder.h>
#include <util/string/cast.h>
-
+
namespace NKikimr::NSQS {
-
-using NKikimrClient::TSqsResponse;
-
+
+using NKikimrClient::TSqsResponse;
+
// https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
// https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList - list of error codes
TString BuildErrorXmlString(const TString& message, const TString& errorCode, const TString& requestId) {
@@ -26,8 +26,8 @@ TString BuildErrorXmlString(const TString& message, const TString& errorCode, co
}
}
return XML_RESULT();
-}
-
+}
+
TString BuildErrorXmlString(const TError& error, const TString& requestId) {
return BuildErrorXmlString(error.GetMessage(), error.GetErrorCode(), requestId);
}
@@ -60,15 +60,15 @@ TSqsHttpResponse MakeErrorXmlResponseFromCurrentException(TUserCounters* userCou
}
}
-template <typename T>
-static bool MaybeErrorResponse(const T& resp, TStringBuilder& builder) {
- if (resp.HasError()) {
+template <typename T>
+static bool MaybeErrorResponse(const T& resp, TStringBuilder& builder) {
+ if (resp.HasError()) {
builder << BuildErrorXmlString(resp.GetError(), resp.GetRequestId());
- return true;
- }
- return false;
-}
-
+ return true;
+ }
+ return false;
+}
+
static TString BoolToString(const bool b) {
return TString(b ? "true" : "false");
}
@@ -155,16 +155,16 @@ void WriteQueueAttributesToXml(const TGetQueueAttributesResponse& rec, TXmlStrin
}
TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
- TStringBuilder result;
-
+ TStringBuilder result;
+
#define HANDLE_ERROR(METHOD) \
if (MaybeErrorResponse(resp.Y_CAT(Get, METHOD)(), result)) { \
return TSqsHttpResponse(result, resp.Y_CAT(Get, METHOD)().GetError().GetStatus()); \
} \
/**/
- switch (resp.GetResponseCase()) {
- case TSqsResponse::kChangeMessageVisibility: {
+ switch (resp.GetResponseCase()) {
+ case TSqsResponse::kChangeMessageVisibility: {
HANDLE_ERROR(ChangeMessageVisibility);
XML_BUILDER() {
XML_DOC() {
@@ -176,10 +176,10 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kChangeMessageVisibilityBatch: {
+ break;
+ }
+
+ case TSqsResponse::kChangeMessageVisibilityBatch: {
HANDLE_ERROR(ChangeMessageVisibilityBatch);
XML_BUILDER() {
XML_DOC() {
@@ -204,13 +204,13 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
XML_ELEM_CONT("RequestId", resp.GetChangeMessageVisibilityBatch().GetRequestId());
}
}
- }
- }
+ }
+ }
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kCreateQueue: {
+ break;
+ }
+
+ case TSqsResponse::kCreateQueue: {
HANDLE_ERROR(CreateQueue);
XML_BUILDER() {
XML_DOC() {
@@ -225,10 +225,10 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kDeleteMessage: {
+ break;
+ }
+
+ case TSqsResponse::kDeleteMessage: {
HANDLE_ERROR(DeleteMessage);
XML_BUILDER() {
XML_DOC() {
@@ -240,10 +240,10 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kDeleteMessageBatch: {
+ break;
+ }
+
+ case TSqsResponse::kDeleteMessageBatch: {
HANDLE_ERROR(DeleteMessageBatch);
XML_BUILDER() {
XML_DOC() {
@@ -268,13 +268,13 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
XML_ELEM_CONT("RequestId", resp.GetDeleteMessageBatch().GetRequestId());
}
}
- }
- }
+ }
+ }
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kDeleteQueue: {
+ break;
+ }
+
+ case TSqsResponse::kDeleteQueue: {
HANDLE_ERROR(DeleteQueue);
XML_BUILDER() {
XML_DOC() {
@@ -286,8 +286,8 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
+ break;
+ }
case TSqsResponse::kDeleteQueueBatch: {
HANDLE_ERROR(DeleteQueueBatch);
@@ -320,7 +320,7 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
break;
}
- case TSqsResponse::kGetQueueAttributes: {
+ case TSqsResponse::kGetQueueAttributes: {
HANDLE_ERROR(GetQueueAttributes);
XML_BUILDER() {
XML_DOC() {
@@ -365,13 +365,13 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
XML_ELEM_CONT("RequestId", resp.GetGetQueueAttributesBatch().GetRequestId());
}
}
- }
- }
+ }
+ }
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kGetQueueUrl: {
+ break;
+ }
+
+ case TSqsResponse::kGetQueueUrl: {
HANDLE_ERROR(GetQueueUrl);
XML_BUILDER() {
XML_DOC() {
@@ -386,10 +386,10 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kListQueues: {
+ break;
+ }
+
+ case TSqsResponse::kListQueues: {
HANDLE_ERROR(ListQueues);
XML_BUILDER() {
XML_DOC() {
@@ -404,11 +404,11 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
}
- }
+ }
result << XML_RESULT();
- break;
- }
-
+ break;
+ }
+
case TSqsResponse::kCountQueues: {
HANDLE_ERROR(CountQueues);
XML_BUILDER() {
@@ -427,7 +427,7 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
break;
}
- case TSqsResponse::kListUsers: {
+ case TSqsResponse::kListUsers: {
HANDLE_ERROR(ListUsers);
XML_BUILDER() {
XML_DOC() {
@@ -442,12 +442,12 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
}
- }
+ }
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kPurgeQueue: {
+ break;
+ }
+
+ case TSqsResponse::kPurgeQueue: {
HANDLE_ERROR(PurgeQueue);
XML_BUILDER() {
XML_DOC() {
@@ -459,9 +459,9 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
+ break;
+ }
+
case TSqsResponse::kPurgeQueueBatch: {
HANDLE_ERROR(PurgeQueueBatch);
XML_BUILDER() {
@@ -493,7 +493,7 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
break;
}
- case TSqsResponse::kReceiveMessage: {
+ case TSqsResponse::kReceiveMessage: {
HANDLE_ERROR(ReceiveMessage);
XML_BUILDER() {
XML_DOC() {
@@ -538,7 +538,7 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
if (message.HasSenderId()) {
ATTRIBUTE("SenderId", message.GetSenderId());
}
-
+
// message attributes
for (const auto& attr : message.messageattributes()) {
XML_ELEM("MessageAttribute") {
@@ -563,14 +563,14 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
XML_ELEM("ResponseMetadata") {
XML_ELEM_CONT("RequestId", resp.GetReceiveMessage().GetRequestId());
}
- }
- }
- }
+ }
+ }
+ }
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kSendMessage: {
+ break;
+ }
+
+ case TSqsResponse::kSendMessage: {
HANDLE_ERROR(SendMessage);
XML_BUILDER() {
XML_DOC() {
@@ -592,10 +592,10 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kSendMessageBatch: {
+ break;
+ }
+
+ case TSqsResponse::kSendMessageBatch: {
HANDLE_ERROR(SendMessageBatch);
XML_BUILDER() {
XML_DOC() {
@@ -628,13 +628,13 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
XML_ELEM_CONT("RequestId", resp.GetSendMessageBatch().GetRequestId());
}
}
- }
- }
+ }
+ }
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kSetQueueAttributes: {
+ break;
+ }
+
+ case TSqsResponse::kSetQueueAttributes: {
HANDLE_ERROR(SetQueueAttributes);
XML_BUILDER() {
XML_DOC() {
@@ -646,10 +646,10 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kCreateUser: {
+ break;
+ }
+
+ case TSqsResponse::kCreateUser: {
HANDLE_ERROR(CreateUser);
XML_BUILDER() {
XML_DOC() {
@@ -661,10 +661,10 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
- case TSqsResponse::kDeleteUser: {
+ break;
+ }
+
+ case TSqsResponse::kDeleteUser: {
HANDLE_ERROR(DeleteUser);
XML_BUILDER() {
XML_DOC() {
@@ -676,9 +676,9 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
}
}
result << XML_RESULT();
- break;
- }
-
+ break;
+ }
+
case TSqsResponse::kModifyPermissions: {
HANDLE_ERROR(ModifyPermissions);
XML_BUILDER() {
@@ -756,14 +756,14 @@ TSqsHttpResponse ResponseToAmazonXmlFormat(const TSqsResponse& resp) {
break;
}
- case TSqsResponse::RESPONSE_NOT_SET: {
+ case TSqsResponse::RESPONSE_NOT_SET: {
return MakeErrorXmlResponse(NErrors::INTERNAL_FAILURE, nullptr, "Not implemented.");
- }
- }
-
+ }
+ }
+
return TSqsHttpResponse(result, 200);
#undef HANDLE_ERROR
-}
-
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/http/xml.h b/ydb/core/ymq/http/xml.h
index 4b0ce5758b..f07a006f67 100644
--- a/ydb/core/ymq/http/xml.h
+++ b/ydb/core/ymq/http/xml.h
@@ -1,15 +1,15 @@
-#pragma once
-
-#include "types.h"
+#pragma once
+
+#include "types.h"
#include <ydb/library/http_proxy/error/error.h>
#include <ydb/core/protos/msgbus.pb.h>
#include <ydb/core/ymq/base/counters.h>
-
+
namespace NKikimr::NSQS {
-
+
TSqsHttpResponse MakeErrorXmlResponse(const TErrorClass& errorClass, TUserCounters* userCounters, const TString& message = TString(), const TString& requestId = TString());
TSqsHttpResponse MakeErrorXmlResponseFromCurrentException(TUserCounters* userCounters, const TString& requestId);
-
+
TSqsHttpResponse ResponseToAmazonXmlFormat(const NKikimrClient::TSqsResponse& resp);
-
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/http/ya.make b/ydb/core/ymq/http/ya.make
index a8c5f62386..9fde2c457e 100644
--- a/ydb/core/ymq/http/ya.make
+++ b/ydb/core/ymq/http/ya.make
@@ -3,17 +3,17 @@ OWNER(
g:sqs
)
-LIBRARY()
+LIBRARY()
-SRCS(
- parser.rl6
- http.cpp
- types.cpp
- xml.cpp
+SRCS(
+ parser.rl6
+ http.cpp
+ types.cpp
+ xml.cpp
xml_builder.cpp
-)
-
-PEERDIR(
+)
+
+PEERDIR(
contrib/libs/libxml
library/cpp/actors/core
library/cpp/cgiparam
@@ -28,6 +28,6 @@ PEERDIR(
ydb/core/ymq/base
ydb/library/http_proxy/authorization
ydb/library/http_proxy/error
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/ymq/proto/records.proto b/ydb/core/ymq/proto/records.proto
index 37598ccc41..af75a5354b 100644
--- a/ydb/core/ymq/proto/records.proto
+++ b/ydb/core/ymq/proto/records.proto
@@ -1,21 +1,21 @@
-package NKikimr.NSQS;
-
+package NKikimr.NSQS;
+
import "ydb/core/protos/sqs.proto";
-
-message TMessageAttributeList {
- /// Message's attributes.
- repeated TMessageAttribute Attributes = 1;
-}
-
-message TReceipt {
- /// The group identifier.
- optional string MessageGroupId = 1;
- /// Unique message identifier.
- optional uint64 Offset = 2;
- /// The token is used for deduplication of ReceiveMessage calls.
- optional string ReceiveRequestAttemptId = 3;
- /// The lock timestamp of the message.
- optional uint64 LockTimestamp = 4;
- /// The number of queue shard.
- optional uint64 Shard = 5;
-}
+
+message TMessageAttributeList {
+ /// Message's attributes.
+ repeated TMessageAttribute Attributes = 1;
+}
+
+message TReceipt {
+ /// The group identifier.
+ optional string MessageGroupId = 1;
+ /// Unique message identifier.
+ optional uint64 Offset = 2;
+ /// The token is used for deduplication of ReceiveMessage calls.
+ optional string ReceiveRequestAttemptId = 3;
+ /// The lock timestamp of the message.
+ optional uint64 LockTimestamp = 4;
+ /// The number of queue shard.
+ optional uint64 Shard = 5;
+}
diff --git a/ydb/core/ymq/proto/ya.make b/ydb/core/ymq/proto/ya.make
index 6a2e1949e2..ce644079b0 100644
--- a/ydb/core/ymq/proto/ya.make
+++ b/ydb/core/ymq/proto/ya.make
@@ -3,16 +3,16 @@ OWNER(
g:sqs
)
-PROTO_LIBRARY()
-
-SRCS(
- records.proto
-)
-
-PEERDIR(
+PROTO_LIBRARY()
+
+SRCS(
+ records.proto
+)
+
+PEERDIR(
ydb/core/protos
-)
-
+)
+
EXCLUDE_TAGS(GO_PROTO)
-END()
+END()
diff --git a/ydb/core/ymq/queues/fifo/queries.cpp b/ydb/core/ymq/queues/fifo/queries.cpp
index 5876be81d6..0d4f9db68e 100644
--- a/ydb/core/ymq/queues/fifo/queries.cpp
+++ b/ydb/core/ymq/queues/fifo/queries.cpp
@@ -1,11 +1,11 @@
-#include "queries.h"
+#include "queries.h"
#include <ydb/core/ymq/base/constants.h>
-
+
namespace NKikimr::NSQS {
-namespace {
-
-const char* const ChangeMessageVisibilityQuery = R"__(
- (
+namespace {
+
+const char* const ChangeMessageVisibilityQuery = R"__(
+ (
(let now (Parameter 'NOW (DataType 'Uint64)))
(let groupsReadAttemptIdsPeriod (Parameter 'GROUPS_READ_ATTEMPT_IDS_PERIOD (DataType 'Uint64)))
(let keys (Parameter 'KEYS
@@ -15,10 +15,10 @@ const char* const ChangeMessageVisibilityQuery = R"__(
'('ReceiveAttemptId (DataType 'Utf8String))
'('LockTimestamp (DataType 'Uint64))
'('NewVisibilityDeadline (DataType 'Uint64))))))
-
- (let groupTable '%1$s/Groups)
+
+ (let groupTable '%1$s/Groups)
(let readsTable '%1$s/Reads)
-
+
(let records
(MapParameter keys (lambda '(item) (block '(
(let groupRow '(
@@ -29,7 +29,7 @@ const char* const ChangeMessageVisibilityQuery = R"__(
'VisibilityDeadline
'ReceiveAttemptId))
(let groupRead (SelectRow groupTable groupRow groupSelect))
-
+
(let readsRow '(
'('ReceiveAttemptId (Member item 'ReceiveAttemptId))))
(let readsSelect '(
@@ -37,7 +37,7 @@ const char* const ChangeMessageVisibilityQuery = R"__(
(let readsRead (SelectRow readsTable readsRow readsSelect))
(let exists (Exists groupRead))
-
+
(let changeCond
(IfPresent groupRead
(lambda '(x)
@@ -47,7 +47,7 @@ const char* const ChangeMessageVisibilityQuery = R"__(
(LessOrEqual now (Member groupRead 'VisibilityDeadline)))
(Bool 'false)))
(Bool 'false)))
-
+
(let lockTimestamp (Member item 'LockTimestamp))
(let readDeadline (Member readsRead 'Deadline))
(let readCreateTimestamp (Sub readDeadline groupsReadAttemptIdsPeriod))
@@ -98,20 +98,20 @@ const char* const ChangeMessageVisibilityQuery = R"__(
(return (EraseRow readsTable readsRow))
))))
))
- )
-)__";
-
-const char* const PurgeQueueQuery = R"__(
- (
+ )
+)__";
+
+const char* const PurgeQueueQuery = R"__(
+ (
(let offsetFrom (Parameter 'OFFSET_FROM (DataType 'Uint64)))
(let offsetTo (Parameter 'OFFSET_TO (DataType 'Uint64)))
(let now (Parameter 'NOW (DataType 'Uint64)))
(let shard (Parameter 'SHARD (DataType 'Uint64)))
(let batchSize (Parameter 'BATCH_SIZE (DataType 'Uint64)))
- (let messageTable '%1$s/Messages)
- (let stateTable '%1$s/State)
-
+ (let messageTable '%1$s/Messages)
+ (let stateTable '%1$s/State)
+
(let stateRow '(
'('State shard)))
(let stateSelect '(
@@ -119,22 +119,22 @@ const char* const PurgeQueueQuery = R"__(
'LastModifiedTimestamp))
(let stateRead
(SelectRow stateTable stateRow stateSelect))
-
+
(let modifiedTimestamp (Max now (Member stateRead 'LastModifiedTimestamp)))
- (let messageRange '(
+ (let messageRange '(
'('Offset offsetFrom offsetTo)))
- (let messageSelect '(
+ (let messageSelect '(
'SentTimestamp
- 'Offset
+ 'Offset
'RandomId))
-
+
(let selectResult (SelectRange messageTable messageRange messageSelect '('('"ItemsLimit" batchSize))))
-
+
(let messages (Member selectResult 'List))
(let truncated (Member selectResult 'Truncated))
(let newCleanupVersion (Add (Member stateRead 'CleanupVersion) (Uint64 '1)))
-
+
(let stateUpdate '(
'('LastModifiedTimestamp modifiedTimestamp)
'('CleanupVersion newCleanupVersion)
@@ -186,8 +186,8 @@ const char* const PurgeQueueStage2Query = R"__(
(return (Exists item))
)))))
- (let stateRow '(
- '('State (Uint64 '0))))
+ (let stateRow '(
+ '('State (Uint64 '0))))
(let stateSelect '(
'MessageCount
'CleanupVersion
@@ -197,10 +197,10 @@ const char* const PurgeQueueStage2Query = R"__(
(let count (Sub (Member stateRead 'MessageCount) (Length recordsExisted)))
(let modifiedTimestamp (Max now (Member stateRead 'LastModifiedTimestamp)))
- (let stateUpdate '(
+ (let stateUpdate '(
'('LastModifiedTimestamp modifiedTimestamp)
'('MessageCount count)))
-
+
(let versionIsSame
(Coalesce
(Equal (Member stateRead 'CleanupVersion) cleanupVersion)
@@ -208,18 +208,18 @@ const char* const PurgeQueueStage2Query = R"__(
)
)
- (return (Extend
+ (return (Extend
(AsList (SetResult 'versionIsSame versionIsSame))
(AsList (SetResult 'messagesDeleted
(If versionIsSame
(Length recordsExisted)
(Uint64 '0))
))
-
+
(If versionIsSame
(AsList (UpdateRow stateTable stateRow stateUpdate))
(AsList (Void)))
-
+
(If versionIsSame
(Map recordsExisted (lambda '(item) (block '(
(let groupRow '(
@@ -227,7 +227,7 @@ const char* const PurgeQueueStage2Query = R"__(
(let update '(
'('RandomId (Member item 'NextRandomId))
'('Head (Member item 'NextOffset))))
-
+
# If we delete the last message, we need to delete the empty group
(let groupIsEmpty
(Coalesce
@@ -235,7 +235,7 @@ const char* const PurgeQueueStage2Query = R"__(
(Bool 'false)
)
)
-
+
(return
(If groupIsEmpty
(EraseRow groupTable groupRow)
@@ -243,7 +243,7 @@ const char* const PurgeQueueStage2Query = R"__(
)
)))))
(AsList (Void)))
-
+
(If versionIsSame
(Map recordsExisted (lambda '(item) (block '(
(let row '(
@@ -251,7 +251,7 @@ const char* const PurgeQueueStage2Query = R"__(
'('Offset (Member item 'Offset))))
(return (EraseRow dataTable row))))))
(AsList (Void)))
-
+
(If versionIsSame
(Map recordsExisted (lambda '(item) (block '(
(let row '(
@@ -266,47 +266,47 @@ const char* const PurgeQueueStage2Query = R"__(
'('Offset (Member item 'Offset))))
(return (EraseRow sentTsIdx row))))))
(AsList (Void)))
- ))
- )
-)__";
-
-const char* const DeleteMessageQuery = R"__(
- (
- (let keys (Parameter 'KEYS
- (ListType (StructType
- '('GroupId (DataType 'String))
- '('Offset (DataType 'Uint64))
+ ))
+ )
+)__";
+
+const char* const DeleteMessageQuery = R"__(
+ (
+ (let keys (Parameter 'KEYS
+ (ListType (StructType
+ '('GroupId (DataType 'String))
+ '('Offset (DataType 'Uint64))
'('LockTimestamp (DataType 'Uint64))
'('ReceiveAttemptId (DataType 'Utf8String))))))
- (let now (Parameter 'NOW (DataType 'Uint64)))
+ (let now (Parameter 'NOW (DataType 'Uint64)))
(let groupsReadAttemptIdsPeriod (Parameter 'GROUPS_READ_ATTEMPT_IDS_PERIOD (DataType 'Uint64)))
-
- (let dataTable '%1$s/Data)
- (let groupTable '%1$s/Groups)
- (let messageTable '%1$s/Messages)
- (let sentTsIdx '%1$s/SentTimestampIdx)
- (let stateTable '%1$s/State)
+
+ (let dataTable '%1$s/Data)
+ (let groupTable '%1$s/Groups)
+ (let messageTable '%1$s/Messages)
+ (let sentTsIdx '%1$s/SentTimestampIdx)
+ (let stateTable '%1$s/State)
(let readsTable '%1$s/Reads)
-
- (let records
- (MapParameter keys (lambda '(item) (block '(
- (let messageRow '(
- '('Offset (Member item 'Offset))))
- (let messageSelect '(
- 'Offset
- 'RandomId
- 'NextOffset
- 'NextRandomId
- 'SentTimestamp))
-
- (let groupRow '(
- '('GroupId (Member item 'GroupId))))
- (let groupSelect '(
- 'GroupId
- 'Head
+
+ (let records
+ (MapParameter keys (lambda '(item) (block '(
+ (let messageRow '(
+ '('Offset (Member item 'Offset))))
+ (let messageSelect '(
+ 'Offset
+ 'RandomId
+ 'NextOffset
+ 'NextRandomId
+ 'SentTimestamp))
+
+ (let groupRow '(
+ '('GroupId (Member item 'GroupId))))
+ (let groupSelect '(
+ 'GroupId
+ 'Head
'LockTimestamp
'ReceiveAttemptId))
-
+
(let readsRow '(
'('ReceiveAttemptId (Member item 'ReceiveAttemptId))))
(let readsSelect '(
@@ -326,100 +326,100 @@ const char* const DeleteMessageQuery = R"__(
)
)
- (return '(
- (SelectRow groupTable groupRow groupSelect)
- (SelectRow messageTable messageRow messageSelect)
+ (return '(
+ (SelectRow groupTable groupRow groupSelect)
+ (SelectRow messageTable messageRow messageSelect)
(Member item 'LockTimestamp)
(Member item 'ReceiveAttemptId)
sameReceiveAttempt)))))))
-
- (let valid
- (Filter records (lambda '(item) (block '(
- (let group (Nth item '0))
- (let msg (Nth item '1))
- (let lockTimestamp (Nth item '2))
-
- (return
- (Coalesce
- (And
- (Equal (Member group 'Head) (Member msg 'Offset))
- (Equal (Member group 'LockTimestamp) lockTimestamp))
- (Bool 'false))))))))
-
+
+ (let valid
+ (Filter records (lambda '(item) (block '(
+ (let group (Nth item '0))
+ (let msg (Nth item '1))
+ (let lockTimestamp (Nth item '2))
+
+ (return
+ (Coalesce
+ (And
+ (Equal (Member group 'Head) (Member msg 'Offset))
+ (Equal (Member group 'LockTimestamp) lockTimestamp))
+ (Bool 'false))))))))
+
(let validWithReceiveAttemptToDelete
(Filter records (lambda '(item) (block '(
(let sameReceiveAttempt (Nth item '4))
(return sameReceiveAttempt))))))
- (let result
- (Map valid (lambda '(item) (block '(
- (let msg (Nth item '1))
-
- (return (AsStruct
- '('Offset (Member msg 'Offset)))))))))
-
- (let stateRow '(
- '('State (Uint64 '0))))
- (let stateSelect '(
+ (let result
+ (Map valid (lambda '(item) (block '(
+ (let msg (Nth item '1))
+
+ (return (AsStruct
+ '('Offset (Member msg 'Offset)))))))))
+
+ (let stateRow '(
+ '('State (Uint64 '0))))
+ (let stateSelect '(
'MessageCount
'LastModifiedTimestamp))
- (let stateRead (SelectRow stateTable stateRow stateSelect))
-
+ (let stateRead (SelectRow stateTable stateRow stateSelect))
+
(let modifiedTimestamp (Max now (Member stateRead 'LastModifiedTimestamp)))
- (let count (Sub (Member stateRead 'MessageCount) (Length valid)))
+ (let count (Sub (Member stateRead 'MessageCount) (Length valid)))
- (let stateUpdate '(
+ (let stateUpdate '(
'('LastModifiedTimestamp modifiedTimestamp)
- '('MessageCount count)))
-
- (return (Extend
- (AsList (SetResult 'deleted result))
- (ListIf (HasItems valid) (UpdateRow stateTable stateRow stateUpdate))
-
- (Map valid (lambda '(item) (block '(
- (let group (Nth item '0))
- (let msg (Nth item '1))
-
- (let row '(
- '('GroupId (Member group 'GroupId))))
- (let update '(
- '('RandomId (Member msg 'NextRandomId))
- '('Head (Member msg 'NextOffset))
- '('LockTimestamp (Uint64 '0))
- '('VisibilityDeadline (Uint64 '0))))
-
- (return
- (If (Coalesce (Equal (Member msg 'NextOffset) (Uint64 '0)) (Bool 'false))
- (EraseRow groupTable row)
- (UpdateRow groupTable row update)))))))
-
- (Map valid (lambda '(item) (block '(
- (let row '(
- '('RandomId (Member (Nth item '1) 'RandomId))
- '('Offset (Member (Nth item '1) 'Offset))))
- (return (EraseRow dataTable row))))))
-
- (Map valid (lambda '(item) (block '(
- (let row '(
- '('Offset (Member (Nth item '1) 'Offset))))
- (return (EraseRow messageTable row))))))
-
- (Map valid (lambda '(item) (block '(
- (let row '(
- '('SentTimestamp (Member (Nth item '1) 'SentTimestamp))
- '('Offset (Member (Nth item '1) 'Offset))))
- (return (EraseRow sentTsIdx row))))))
+ '('MessageCount count)))
+
+ (return (Extend
+ (AsList (SetResult 'deleted result))
+ (ListIf (HasItems valid) (UpdateRow stateTable stateRow stateUpdate))
+
+ (Map valid (lambda '(item) (block '(
+ (let group (Nth item '0))
+ (let msg (Nth item '1))
+
+ (let row '(
+ '('GroupId (Member group 'GroupId))))
+ (let update '(
+ '('RandomId (Member msg 'NextRandomId))
+ '('Head (Member msg 'NextOffset))
+ '('LockTimestamp (Uint64 '0))
+ '('VisibilityDeadline (Uint64 '0))))
+
+ (return
+ (If (Coalesce (Equal (Member msg 'NextOffset) (Uint64 '0)) (Bool 'false))
+ (EraseRow groupTable row)
+ (UpdateRow groupTable row update)))))))
+
+ (Map valid (lambda '(item) (block '(
+ (let row '(
+ '('RandomId (Member (Nth item '1) 'RandomId))
+ '('Offset (Member (Nth item '1) 'Offset))))
+ (return (EraseRow dataTable row))))))
+
+ (Map valid (lambda '(item) (block '(
+ (let row '(
+ '('Offset (Member (Nth item '1) 'Offset))))
+ (return (EraseRow messageTable row))))))
+
+ (Map valid (lambda '(item) (block '(
+ (let row '(
+ '('SentTimestamp (Member (Nth item '1) 'SentTimestamp))
+ '('Offset (Member (Nth item '1) 'Offset))))
+ (return (EraseRow sentTsIdx row))))))
(Map validWithReceiveAttemptToDelete (lambda '(item) (block '(
(let row '(
'('ReceiveAttemptId (Nth item '3))))
(return (EraseRow readsTable row))))))
- ))
- )
-)__";
-
-const char* const SetQueueAttributesQuery = R"__(
- (
+ ))
+ )
+)__";
+
+const char* const SetQueueAttributesQuery = R"__(
+ (
(let delay (Parameter 'DELAY (OptionalType (DataType 'Uint64))))
(let retention (Parameter 'RETENTION (OptionalType (DataType 'Uint64))))
(let visibility (Parameter 'VISIBILITY (OptionalType (DataType 'Uint64))))
@@ -430,34 +430,34 @@ const char* const SetQueueAttributesQuery = R"__(
(let dlqArn (Parameter 'DLQ_TARGET_ARN (OptionalType (DataType 'Utf8String))))
(let dlqName (Parameter 'DLQ_TARGET_NAME (OptionalType (DataType 'Utf8String))))
(let userName (Parameter 'USER_NAME (DataType 'Utf8String)))
-
- (let attrsTable '%1$s/Attributes)
-
- (let attrsRow '(
- '('State (Uint64 '0))))
- (let attrsSelect '(
- 'DelaySeconds
- 'MessageRetentionPeriod
- 'ReceiveMessageWaitTime
+
+ (let attrsTable '%1$s/Attributes)
+
+ (let attrsRow '(
+ '('State (Uint64 '0))))
+ (let attrsSelect '(
+ 'DelaySeconds
+ 'MessageRetentionPeriod
+ 'ReceiveMessageWaitTime
'VisibilityTimeout
'MaximumMessageSize
'DlqName
'DlqArn
'MaxReceiveCount
'ContentBasedDeduplication))
- (let attrsRead (SelectRow attrsTable attrsRow attrsSelect))
-
- (let attrsUpdate '(
- '('DelaySeconds (Coalesce delay (Member attrsRead 'DelaySeconds)))
- '('MessageRetentionPeriod (Coalesce retention (Member attrsRead 'MessageRetentionPeriod)))
- '('ReceiveMessageWaitTime (Coalesce wait (Member attrsRead 'ReceiveMessageWaitTime)))
+ (let attrsRead (SelectRow attrsTable attrsRow attrsSelect))
+
+ (let attrsUpdate '(
+ '('DelaySeconds (Coalesce delay (Member attrsRead 'DelaySeconds)))
+ '('MessageRetentionPeriod (Coalesce retention (Member attrsRead 'MessageRetentionPeriod)))
+ '('ReceiveMessageWaitTime (Coalesce wait (Member attrsRead 'ReceiveMessageWaitTime)))
'('VisibilityTimeout (Coalesce visibility (Member attrsRead 'VisibilityTimeout)))
'('MaximumMessageSize (Coalesce maxMessageSize (Member attrsRead 'MaximumMessageSize)))
'('MaxReceiveCount (Coalesce maxReceiveCount (Member attrsRead 'MaxReceiveCount)))
'('DlqName (Coalesce dlqName (Member attrsRead 'DlqName)))
'('DlqArn (Coalesce dlqArn (Member attrsRead 'DlqArn)))
'('ContentBasedDeduplication (Coalesce contentBasedDeduplication (Member attrsRead 'ContentBasedDeduplication)))))
-
+
(let queuesTable '%5$s/.Queues)
(let queuesRow '(
'('Account userName)
@@ -471,12 +471,12 @@ const char* const SetQueueAttributesQuery = R"__(
(let queuesRowUpdate '(
'('DlqName (Coalesce dlqName (Member queuesRowRead 'DlqName)))))
- (return (AsList
+ (return (AsList
(UpdateRow attrsTable attrsRow attrsUpdate)
(UpdateRow queuesTable queuesRow queuesRowUpdate)))
- )
-)__";
-
+ )
+)__";
+
const char* const InternalGetQueueAttributesQuery = R"__(
(
(let attrsTable '%1$s/Attributes)
@@ -501,22 +501,22 @@ const char* const InternalGetQueueAttributesQuery = R"__(
)
)__";
-const char* const ListQueuesQuery = R"__(
- (
+const char* const ListQueuesQuery = R"__(
+ (
(let folderId (Parameter 'FOLDERID (DataType 'Utf8String)))
(let userName (Parameter 'USER_NAME (DataType 'Utf8String)))
-
+
(let queuesTable '%5$s/.Queues)
(let skipFolderIdFilter (Equal folderId (Utf8String '"")))
(let queuesRange '(
'('Account userName userName)
- '('QueueName (Utf8String '"") (Void))))
+ '('QueueName (Utf8String '"") (Void))))
(let queueSelect '('QueueName 'QueueId 'QueueState 'FifoQueue 'CreatedTimestamp 'CustomQueueName 'FolderId 'MasterTabletId 'Version 'Shards))
(let queues (Member (SelectRange queuesTable queuesRange queueSelect '()) 'List))
-
- (let filtered (Filter queues (lambda '(item) (block '(
+
+ (let filtered (Filter queues (lambda '(item) (block '(
(return (Coalesce
(And
(Or
@@ -526,144 +526,144 @@ const char* const ListQueuesQuery = R"__(
(Equal (Member item 'FolderId) folderId)
skipFolderIdFilter))
(Bool 'false)))
- )))))
-
- (return (AsList
- (SetResult 'queues filtered)))
- )
-)__";
-
-const char* const LockGroupsQuery = R"__(
- (
- (let attemptId (Parameter 'ATTEMPT_ID (DataType 'Utf8String)))
- (let now (Parameter 'NOW (DataType 'Uint64)))
- (let count (Parameter 'COUNT (DataType 'Uint64)))
+ )))))
+
+ (return (AsList
+ (SetResult 'queues filtered)))
+ )
+)__";
+
+const char* const LockGroupsQuery = R"__(
+ (
+ (let attemptId (Parameter 'ATTEMPT_ID (DataType 'Utf8String)))
+ (let now (Parameter 'NOW (DataType 'Uint64)))
+ (let count (Parameter 'COUNT (DataType 'Uint64)))
(let visibilityTimeout (Parameter 'VISIBILITY_TIMEOUT (DataType 'Uint64)))
(let groupsReadAttemptIdsPeriod (Parameter 'GROUPS_READ_ATTEMPT_IDS_PERIOD (DataType 'Uint64)))
(let fromGroup (Parameter 'FROM_GROUP (DataType 'String)))
(let batchSize (Parameter 'BATCH_SIZE (DataType 'Uint64)))
-
- (let groupTable '%1$s/Groups)
- (let readsTable '%1$s/Reads)
- (let sentTsIdx '%1$s/SentTimestampIdx)
-
- (let readsRow '(
- '('ReceiveAttemptId attemptId)))
- (let readsSelect (SelectRow readsTable readsRow '('Deadline)))
- (let readsUpdate '(
+
+ (let groupTable '%1$s/Groups)
+ (let readsTable '%1$s/Reads)
+ (let sentTsIdx '%1$s/SentTimestampIdx)
+
+ (let readsRow '(
+ '('ReceiveAttemptId attemptId)))
+ (let readsSelect (SelectRow readsTable readsRow '('Deadline)))
+ (let readsUpdate '(
'('Deadline (Add now groupsReadAttemptIdsPeriod))))
-
- (let sameCond (IfPresent readsSelect (lambda '(x) (Coalesce (Less now (Member x 'Deadline)) (Bool 'false))) (Bool 'false)))
-
- (let groupRange '(
+
+ (let sameCond (IfPresent readsSelect (lambda '(x) (Coalesce (Less now (Member x 'Deadline)) (Bool 'false))) (Bool 'false)))
+
+ (let groupRange '(
'('GroupId fromGroup (Void))))
- (let groupSelect '(
- 'GroupId
- 'RandomId
- 'Head
- 'ReceiveAttemptId
- 'VisibilityDeadline))
+ (let groupSelect '(
+ 'GroupId
+ 'RandomId
+ 'Head
+ 'ReceiveAttemptId
+ 'VisibilityDeadline))
(let groupsRead (SelectRange groupTable groupRange groupSelect '('('"ItemsLimit" batchSize))))
(let groups (Member groupsRead 'List))
(let truncated (Member groupsRead 'Truncated))
(let lastProcessedGroup (ToOptional (Skip groups (Sub (Length groups) (Uint64 '1)))))
-
- (let previous (Take (Filter groups (lambda '(item) (block '(
- (return (Coalesce (Equal (Member item 'ReceiveAttemptId) attemptId) (Bool 'false)))
- )))) count))
-
- (let filtered_1 (Filter groups (lambda '(item) (block '(
- (return (Coalesce (Less (Member item 'VisibilityDeadline) now) (Bool 'false)))
- )))))
-
- (let filtered (Take (Sort filtered_1 (Bool 'true) (lambda '(item) (block '(
- (return (Member item 'Head))
- )))) count))
-
- (let update (lambda '(item) (block '(
- (let groupId (Member item 'GroupId))
-
- (let groupRow '(
- '('GroupId groupId)))
- (let groupUpdate '(
- '('ReceiveAttemptId attemptId)
- '('LockTimestamp now)
+
+ (let previous (Take (Filter groups (lambda '(item) (block '(
+ (return (Coalesce (Equal (Member item 'ReceiveAttemptId) attemptId) (Bool 'false)))
+ )))) count))
+
+ (let filtered_1 (Filter groups (lambda '(item) (block '(
+ (return (Coalesce (Less (Member item 'VisibilityDeadline) now) (Bool 'false)))
+ )))))
+
+ (let filtered (Take (Sort filtered_1 (Bool 'true) (lambda '(item) (block '(
+ (return (Member item 'Head))
+ )))) count))
+
+ (let update (lambda '(item) (block '(
+ (let groupId (Member item 'GroupId))
+
+ (let groupRow '(
+ '('GroupId groupId)))
+ (let groupUpdate '(
+ '('ReceiveAttemptId attemptId)
+ '('LockTimestamp now)
'('VisibilityDeadline (Add now visibilityTimeout))))
- (return (UpdateRow groupTable groupRow groupUpdate))
- ))))
-
- (return (Extend
- (AsList (SetResult 'sameCond sameCond))
+ (return (UpdateRow groupTable groupRow groupUpdate))
+ ))))
+
+ (return (Extend
+ (AsList (SetResult 'sameCond sameCond))
(AsList (SetResult 'truncated truncated))
(AsList (SetResult 'lastProcessedGroup lastProcessedGroup))
- (AsList (If sameCond (SetResult 'offsets previous) (SetResult 'offsets filtered)))
- (ListIf (And (Not sameCond) (HasItems filtered)) (UpdateRow readsTable readsRow readsUpdate))
- (If sameCond (Map previous update) (Map filtered update))))
- )
-)__";
-
-const char* const ReadMessageQuery = R"__(
- (
- (let keys (Parameter 'KEYS
- (ListType (StructType
- '('RandomId (DataType 'Uint64))
- '('Offset (DataType 'Uint64))))))
- (let now (Parameter 'NOW (DataType 'Uint64)))
-
- (let dataTable '%1$s/Data)
- (let messageTable '%1$s/Messages)
-
+ (AsList (If sameCond (SetResult 'offsets previous) (SetResult 'offsets filtered)))
+ (ListIf (And (Not sameCond) (HasItems filtered)) (UpdateRow readsTable readsRow readsUpdate))
+ (If sameCond (Map previous update) (Map filtered update))))
+ )
+)__";
+
+const char* const ReadMessageQuery = R"__(
+ (
+ (let keys (Parameter 'KEYS
+ (ListType (StructType
+ '('RandomId (DataType 'Uint64))
+ '('Offset (DataType 'Uint64))))))
+ (let now (Parameter 'NOW (DataType 'Uint64)))
+
+ (let dataTable '%1$s/Data)
+ (let messageTable '%1$s/Messages)
+
(let unfilteredResult
- (MapParameter keys (lambda '(item) (block '(
- (let dataRow '(
- '('RandomId (Member item 'RandomId))
- '('Offset (Member item 'Offset))))
- (let dataFields '(
- 'Offset
- 'DedupId
- 'Attributes
- 'Data
+ (MapParameter keys (lambda '(item) (block '(
+ (let dataRow '(
+ '('RandomId (Member item 'RandomId))
+ '('Offset (Member item 'Offset))))
+ (let dataFields '(
+ 'Offset
+ 'DedupId
+ 'Attributes
+ 'Data
'MessageId
'SenderId))
-
- (let messageRow '(
- '('Offset (Member item 'Offset))))
- (let messageFields '(
- 'GroupId
- 'Offset
- 'ReceiveCount
- 'FirstReceiveTimestamp
- 'SentTimestamp))
-
+
+ (let messageRow '(
+ '('Offset (Member item 'Offset))))
+ (let messageFields '(
+ 'GroupId
+ 'Offset
+ 'ReceiveCount
+ 'FirstReceiveTimestamp
+ 'SentTimestamp))
+
(let sourceDataFieldsRead (SelectRow dataTable dataRow dataFields))
(return (AsStruct
'('Valid (Exists sourceDataFieldsRead))
'('SourceDataFieldsRead sourceDataFieldsRead)
'('SourceMessageFieldsRead (SelectRow messageTable messageRow messageFields)))))))))
-
+
(let result
(Filter unfilteredResult (lambda '(item) (block '(
(return (Coalesce (Member item 'Valid) (Bool 'false)))
)))))
- (return (Extend
- (AsList (SetResult 'result result))
+ (return (Extend
+ (AsList (SetResult 'result result))
(AsList (SetResult 'movedMessagesCount (Uint64 '0)))
-
- (Map result (lambda '(item) (block '(
+
+ (Map result (lambda '(item) (block '(
(let message (Member item 'SourceMessageFieldsRead))
- (let row '(
- '('Offset (Member message 'Offset))))
- (let receiveTimestamp
- (If (Coalesce (Equal (Member message 'FirstReceiveTimestamp) (Uint64 '0)) (Bool 'false)) now (Member message 'FirstReceiveTimestamp)))
- (let update '(
- '('FirstReceiveTimestamp receiveTimestamp)
- '('ReceiveCount (Add (Member message 'ReceiveCount) (Uint32 '1)))))
- (return (UpdateRow messageTable row update))))))))
- )
-)__";
-
+ (let row '(
+ '('Offset (Member message 'Offset))))
+ (let receiveTimestamp
+ (If (Coalesce (Equal (Member message 'FirstReceiveTimestamp) (Uint64 '0)) (Bool 'false)) now (Member message 'FirstReceiveTimestamp)))
+ (let update '(
+ '('FirstReceiveTimestamp receiveTimestamp)
+ '('ReceiveCount (Add (Member message 'ReceiveCount) (Uint32 '1)))))
+ (return (UpdateRow messageTable row update))))))))
+ )
+)__";
+
const char* const ReadOrRedriveMessageQuery = R"__(
(
(let keys (Parameter 'KEYS
@@ -929,10 +929,10 @@ const char* const ReadOrRedriveMessageQuery = R"__(
)
)__";
-const char* const WriteMessageQuery = R"__(
- (
- (let randomId (Parameter 'RANDOM_ID (DataType 'Uint64)))
- (let timestamp (Parameter 'TIMESTAMP (DataType 'Uint64)))
+const char* const WriteMessageQuery = R"__(
+ (
+ (let randomId (Parameter 'RANDOM_ID (DataType 'Uint64)))
+ (let timestamp (Parameter 'TIMESTAMP (DataType 'Uint64)))
(let deduplicationPeriod (Parameter 'DEDUPLICATION_PERIOD (DataType 'Uint64)))
(let messages (Parameter 'MESSAGES
(ListType (StructType
@@ -946,26 +946,26 @@ const char* const WriteMessageQuery = R"__(
'('Index (DataType 'Uint64))
))
))
-
- (let dataTable '%1$s/Data)
- (let dedupTable '%1$s/Deduplication)
- (let stateTable '%1$s/State)
- (let msgTable '%1$s/Messages)
- (let groupTable '%1$s/Groups)
- (let sentTsIdx '%1$s/SentTimestampIdx)
-
- (let stateRow '(
- '('State (Uint64 '0))))
- (let stateSelect '(
- 'MessageCount
+
+ (let dataTable '%1$s/Data)
+ (let dedupTable '%1$s/Deduplication)
+ (let stateTable '%1$s/State)
+ (let msgTable '%1$s/Messages)
+ (let groupTable '%1$s/Groups)
+ (let sentTsIdx '%1$s/SentTimestampIdx)
+
+ (let stateRow '(
+ '('State (Uint64 '0))))
+ (let stateSelect '(
+ 'MessageCount
'WriteOffset
'LastModifiedTimestamp))
-
- (let stateRead (SelectRow stateTable stateRow stateSelect))
-
+
+ (let stateRead (SelectRow stateTable stateRow stateSelect))
+
(let sentTimestamp (Max timestamp (Member stateRead 'LastModifiedTimestamp)))
(let startOffset (Add (Member stateRead 'WriteOffset) (Uint64 '1)))
-
+
(let messagesInfo
(MapParameter messages (lambda '(item) (block '(
(let dedupRow '(
@@ -975,7 +975,7 @@ const char* const WriteMessageQuery = R"__(
'MessageId
'Offset))
(let dedupRead (SelectRow dedupTable dedupRow dedupSelect))
-
+
(let dedupCond (IfPresent dedupRead (lambda '(x) (Coalesce (Less (Member x 'Deadline) sentTimestamp) (Bool 'false))) (Bool 'true)))
(let groupRow '(
@@ -1040,16 +1040,16 @@ const char* const WriteMessageQuery = R"__(
))
)))))
- (let stateUpdate '(
+ (let stateUpdate '(
'('LastModifiedTimestamp sentTimestamp)
'('MessageCount newMessagesCount)
'('WriteOffset newWriteOffset)))
-
+
(return (Extend
(AsList (SetResult 'result result))
-
+
(AsList (If (Greater (Length messagesAdded) (Uint64 '0)) (UpdateRow stateTable stateRow stateUpdate) (Void)))
-
+
(Map messagesInfoWithProperIndexesSorted (lambda '(item) (block '(
(let dedupCond (Member (Nth item '1) 'dedupCond))
(let dedupRow '(
@@ -1059,7 +1059,7 @@ const char* const WriteMessageQuery = R"__(
'('Offset (Nth item '0))
'('MessageId (Member (Nth item '1) 'MessageId))))
(return (If dedupCond (UpdateRow dedupTable dedupRow dedupUpdate) (Void)))))))
-
+
(Map messagesInfoWithProperIndexesSorted (lambda '(item) (block '(
(let dedupCond (Member (Nth item '1) 'dedupCond))
(let dataRow '(
@@ -1072,7 +1072,7 @@ const char* const WriteMessageQuery = R"__(
'('SenderId (Member (Nth item '1) 'SenderId))
'('MessageId (Member (Nth item '1) 'MessageId))))
(return (If dedupCond (UpdateRow dataTable dataRow dataUpdate) (Void)))))))
-
+
(Map messagesInfoWithProperIndexesSorted (lambda '(item) (block '(
(let dedupCond (Member (Nth item '1) 'dedupCond))
(let msgRow '(
@@ -1086,7 +1086,7 @@ const char* const WriteMessageQuery = R"__(
'('FirstReceiveTimestamp (Uint64 '0))
'('SentTimestamp sentTimestamp)))
(return (If dedupCond (UpdateRow msgTable msgRow messageUpdate) (Void)))))))
-
+
(Map messagesInfoWithProperIndexesSorted (lambda '(item) (block '(
(let dedupCond (Member (Nth item '1) 'dedupCond))
(let sentTsRow '(
@@ -1099,7 +1099,7 @@ const char* const WriteMessageQuery = R"__(
'('DelayDeadline delayDeadline)
'('GroupId (Member (Nth item '1) 'GroupId))))
(return (If dedupCond (UpdateRow sentTsIdx sentTsRow sentTsUpdate) (Void)))))))
-
+
(Map messagesInfoWithProperIndexesSorted (lambda '(item) (block '(
(let dedupCond (Member (Nth item '1) 'dedupCond))
(let groupRow '(
@@ -1140,24 +1140,24 @@ const char* const WriteMessageQuery = R"__(
(Void))
)))))
))
- )
-)__";
-
+ )
+)__";
+
static const char* const DeduplicationCleanupQuery = R"__(
- (
+ (
(let now (Parameter 'NOW (DataType 'Uint64)))
(let batchSize (Parameter 'BATCH_SIZE (DataType 'Uint64)))
(let keyRangeStart (Parameter 'KEY_RANGE_START (DataType 'String)))
-
- (let dedupTable '%1$s/Deduplication)
-
- (let dedupRange '(
+
+ (let dedupTable '%1$s/Deduplication)
+
+ (let dedupRange '(
'('DedupId keyRangeStart (Void))))
- (let dedupSelect '(
- 'DedupId
- 'Deadline))
+ (let dedupSelect '(
+ 'DedupId
+ 'Deadline))
(let dedups (SelectRange dedupTable dedupRange dedupSelect '('('"ItemsLimit" batchSize))))
-
+
(let dedupsList (Member dedups 'List))
(let dedupToErase (Filter dedupsList (lambda '(item) (block '(
(return (Coalesce (Less (Member item 'Deadline) now) (Bool 'false)))
@@ -1185,86 +1185,86 @@ static const char* const ReadsCleanupQuery = R"__(
(let readsTable '%1$s/Reads)
- (let readRange '(
+ (let readRange '(
'('ReceiveAttemptId keyRangeStart (Void))))
- (let readSelect '(
- 'ReceiveAttemptId
- 'Deadline))
+ (let readSelect '(
+ 'ReceiveAttemptId
+ 'Deadline))
(let reads (SelectRange readsTable readRange readSelect '('('"ItemsLimit" batchSize))))
-
+
(let readsList (Member reads 'List))
(let readsToErase (Filter readsList (lambda '(item) (block '(
- (return (Coalesce (Less (Member item 'Deadline) now) (Bool 'false)))
- )))))
-
+ (return (Coalesce (Less (Member item 'Deadline) now) (Bool 'false)))
+ )))))
+
(let readsCount (Length readsList))
(let lastSelectedRow (ToOptional (Skip readsList (Max (Sub readsCount (Uint64 '1)) (Uint64 '0)))))
-
- (return (Extend
+
+ (return (Extend
(AsList (SetResult 'moreData (Member reads 'Truncated)))
(AsList (SetResult 'lastProcessedKey (Member lastSelectedRow 'ReceiveAttemptId)))
- (Map readsToErase (lambda '(item) (block '(
- (return (EraseRow readsTable '(
- '('ReceiveAttemptId (Member item 'ReceiveAttemptId)))))))))
- ))
- )
-)__";
-
-const char* const SetRetentionQuery = R"__(
- (
- (let now (Parameter 'NOW (DataType 'Uint64)))
- (let purge (Parameter 'PURGE (DataType 'Bool)))
-
- (let attrsTable '%1$s/Attributes)
- (let stateTable '%1$s/State)
-
- (let attrs (block '(
- (let row '(
- '('State (Uint64 '0))))
- (let fields '(
- 'MessageRetentionPeriod))
- (return (SelectRow attrsTable row fields)))))
-
- (let boundary
- (If purge now (Coalesce (Sub now (Member attrs 'MessageRetentionPeriod)) (Uint64 '0))))
-
+ (Map readsToErase (lambda '(item) (block '(
+ (return (EraseRow readsTable '(
+ '('ReceiveAttemptId (Member item 'ReceiveAttemptId)))))))))
+ ))
+ )
+)__";
+
+const char* const SetRetentionQuery = R"__(
+ (
+ (let now (Parameter 'NOW (DataType 'Uint64)))
+ (let purge (Parameter 'PURGE (DataType 'Bool)))
+
+ (let attrsTable '%1$s/Attributes)
+ (let stateTable '%1$s/State)
+
+ (let attrs (block '(
+ (let row '(
+ '('State (Uint64 '0))))
+ (let fields '(
+ 'MessageRetentionPeriod))
+ (return (SelectRow attrsTable row fields)))))
+
+ (let boundary
+ (If purge now (Coalesce (Sub now (Member attrs 'MessageRetentionPeriod)) (Uint64 '0))))
+
(let range '(
'('State (Uint64 '0) (Uint64 '18446744073709551615))))
(let fields '(
'State
'RetentionBoundary))
(let records (Member (SelectRange stateTable range fields '()) 'List))
-
+
(let result
(Map records (lambda '(item) (block '(
(let updated
(Coalesce
(Less (Member item 'RetentionBoundary) boundary)
(Bool 'false)))
-
+
(return (AsStruct
'('Shard (Member item 'State))
'('RetentionBoundary (Max boundary (Member item 'RetentionBoundary)))
'('Updated updated))))))))
-
+
(let updated (Filter result (lambda '(item) (block '(
(return (Coalesce (Equal (Member item 'Updated) (Bool 'true)) (Bool 'false))))))))
-
- (return (Extend
- (AsList (SetResult 'result result))
- (AsList (SetResult 'retention (Member attrs 'MessageRetentionPeriod)))
-
+
+ (return (Extend
+ (AsList (SetResult 'result result))
+ (AsList (SetResult 'retention (Member attrs 'MessageRetentionPeriod)))
+
(Map updated (lambda '(item) (block '(
- (let row '(
- '('State (Member item 'Shard))))
- (let update '(
- '('RetentionBoundary (Member item 'RetentionBoundary))))
- (return (UpdateRow stateTable row update))))))
- ))
- )
-)__";
-
+ (let row '(
+ '('State (Member item 'Shard))))
+ (let update '(
+ '('RetentionBoundary (Member item 'RetentionBoundary))))
+ (return (UpdateRow stateTable row update))))))
+ ))
+ )
+)__";
+
const char* const GetMessageCountMetricsQuery = R"__(
(
(let shard (Parameter 'SHARD (DataType 'Uint64)))
@@ -1380,10 +1380,10 @@ const char* const ListDeadLetterSourceQueuesQuery = R"__(
)
)__";
-} // namespace
-
-const char* GetFifoQueryById(size_t id) {
- switch (id) {
+} // namespace
+
+const char* GetFifoQueryById(size_t id) {
+ switch (id) {
case DELETE_MESSAGE_ID: // 0
return DeleteMessageQuery;
case LOCK_GROUP_ID: // 1
@@ -1420,9 +1420,9 @@ const char* GetFifoQueryById(size_t id) {
return ListDeadLetterSourceQueuesQuery;
case READ_OR_REDRIVE_MESSAGE_ID: // 22
return ReadOrRedriveMessageQuery;
- }
-
- return nullptr;
-}
-
+ }
+
+ return nullptr;
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/queues/fifo/queries.h b/ydb/core/ymq/queues/fifo/queries.h
index 6886062974..18cdc65701 100644
--- a/ydb/core/ymq/queues/fifo/queries.h
+++ b/ydb/core/ymq/queues/fifo/queries.h
@@ -1,9 +1,9 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/ymq/base/query_id.h>
-
+
namespace NKikimr::NSQS {
-
-const char* GetFifoQueryById(size_t id);
-
+
+const char* GetFifoQueryById(size_t id);
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/queues/fifo/schema.cpp b/ydb/core/ymq/queues/fifo/schema.cpp
index 49e04d773b..d3fe9f1c08 100644
--- a/ydb/core/ymq/queues/fifo/schema.cpp
+++ b/ydb/core/ymq/queues/fifo/schema.cpp
@@ -1,113 +1,113 @@
-#include "schema.h"
-
+#include "schema.h"
+
namespace NKikimr::NSQS {
-
-static const TVector<TColumn> AttributesColumns = {
- TColumn("State", NScheme::NTypeIds::Uint64, true),
- TColumn("ContentBasedDeduplication", NScheme::NTypeIds::Bool),
- TColumn("DelaySeconds", NScheme::NTypeIds::Uint64),
- TColumn("FifoQueue", NScheme::NTypeIds::Bool),
- TColumn("MaximumMessageSize", NScheme::NTypeIds::Uint64),
- TColumn("MessageRetentionPeriod", NScheme::NTypeIds::Uint64),
- TColumn("ReceiveMessageWaitTime", NScheme::NTypeIds::Uint64),
+
+static const TVector<TColumn> AttributesColumns = {
+ TColumn("State", NScheme::NTypeIds::Uint64, true),
+ TColumn("ContentBasedDeduplication", NScheme::NTypeIds::Bool),
+ TColumn("DelaySeconds", NScheme::NTypeIds::Uint64),
+ TColumn("FifoQueue", NScheme::NTypeIds::Bool),
+ TColumn("MaximumMessageSize", NScheme::NTypeIds::Uint64),
+ TColumn("MessageRetentionPeriod", NScheme::NTypeIds::Uint64),
+ TColumn("ReceiveMessageWaitTime", NScheme::NTypeIds::Uint64),
TColumn("VisibilityTimeout", NScheme::NTypeIds::Uint64),
TColumn("DlqName", NScheme::NTypeIds::Utf8),
TColumn("DlqArn", NScheme::NTypeIds::Utf8),
TColumn("MaxReceiveCount", NScheme::NTypeIds::Uint64),
TColumn("ShowDetailedCountersDeadline", NScheme::NTypeIds::Uint64)};
-
-static const TVector<TColumn> StateColumns = {
- TColumn("State", NScheme::NTypeIds::Uint64, true),
- TColumn("CleanupTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("CreatedTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("LastModifiedTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("RetentionBoundary", NScheme::NTypeIds::Uint64),
- TColumn("MessageCount", NScheme::NTypeIds::Int64),
- TColumn("InflyCount", NScheme::NTypeIds::Int64),
- TColumn("ReadOffset", NScheme::NTypeIds::Uint64),
+
+static const TVector<TColumn> StateColumns = {
+ TColumn("State", NScheme::NTypeIds::Uint64, true),
+ TColumn("CleanupTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("CreatedTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("LastModifiedTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("RetentionBoundary", NScheme::NTypeIds::Uint64),
+ TColumn("MessageCount", NScheme::NTypeIds::Int64),
+ TColumn("InflyCount", NScheme::NTypeIds::Int64),
+ TColumn("ReadOffset", NScheme::NTypeIds::Uint64),
TColumn("WriteOffset", NScheme::NTypeIds::Uint64),
TColumn("CleanupVersion", NScheme::NTypeIds::Uint64),
TColumn("InflyVersion", NScheme::NTypeIds::Uint64)};
-
-static const TVector<TColumn> DataColumns = {
- TColumn("RandomId", NScheme::NTypeIds::Uint64, true, 20),
- TColumn("Offset", NScheme::NTypeIds::Uint64, true),
- TColumn("DedupId", NScheme::NTypeIds::String),
- TColumn("Attributes", NScheme::NTypeIds::String),
- TColumn("Data", NScheme::NTypeIds::String),
- TColumn("MessageId", NScheme::NTypeIds::String),
+
+static const TVector<TColumn> DataColumns = {
+ TColumn("RandomId", NScheme::NTypeIds::Uint64, true, 20),
+ TColumn("Offset", NScheme::NTypeIds::Uint64, true),
+ TColumn("DedupId", NScheme::NTypeIds::String),
+ TColumn("Attributes", NScheme::NTypeIds::String),
+ TColumn("Data", NScheme::NTypeIds::String),
+ TColumn("MessageId", NScheme::NTypeIds::String),
TColumn("SenderId", NScheme::NTypeIds::String),
-};
-
-static const TVector<TColumn> MessagesColumns = {
- TColumn("Offset", NScheme::NTypeIds::Uint64, true),
- TColumn("RandomId", NScheme::NTypeIds::Uint64),
- TColumn("GroupId", NScheme::NTypeIds::String),
- TColumn("NextOffset", NScheme::NTypeIds::Uint64),
- TColumn("NextRandomId", NScheme::NTypeIds::Uint64),
- TColumn("ReceiveCount", NScheme::NTypeIds::Uint32),
- TColumn("FirstReceiveTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("SentTimestamp", NScheme::NTypeIds::Uint64)};
-
-static const TVector<TColumn> GroupsColumns = {
- TColumn("GroupId", NScheme::NTypeIds::String, true),
- TColumn("RandomId", NScheme::NTypeIds::Uint64),
- TColumn("Head", NScheme::NTypeIds::Uint64),
- TColumn("Tail", NScheme::NTypeIds::Uint64),
- TColumn("ReceiveAttemptId", NScheme::NTypeIds::Utf8),
- TColumn("LockTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("VisibilityDeadline", NScheme::NTypeIds::Uint64)};
-
-static const TVector<TColumn> DeduplicationColumns = {
- TColumn("DedupId", NScheme::NTypeIds::String, true),
- TColumn("Deadline", NScheme::NTypeIds::Uint64),
- TColumn("Offset", NScheme::NTypeIds::Uint64),
- TColumn("MessageId", NScheme::NTypeIds::String)};
-
-static const TVector<TColumn> ReadsColumns = {
- TColumn("ReceiveAttemptId", NScheme::NTypeIds::Utf8, true),
- TColumn("Deadline", NScheme::NTypeIds::Uint64)};
-
-static const TVector<TColumn> SentTimestampIdxColumns = {
- TColumn("SentTimestamp", NScheme::NTypeIds::Uint64, true),
- TColumn("Offset", NScheme::NTypeIds::Uint64, true),
- TColumn("RandomId", NScheme::NTypeIds::Uint64),
- TColumn("DelayDeadline", NScheme::NTypeIds::Uint64),
- TColumn("GroupId", NScheme::NTypeIds::String)};
-
-TVector<TTable> GetFifoTables() {
- TVector<TTable> list;
+};
+
+static const TVector<TColumn> MessagesColumns = {
+ TColumn("Offset", NScheme::NTypeIds::Uint64, true),
+ TColumn("RandomId", NScheme::NTypeIds::Uint64),
+ TColumn("GroupId", NScheme::NTypeIds::String),
+ TColumn("NextOffset", NScheme::NTypeIds::Uint64),
+ TColumn("NextRandomId", NScheme::NTypeIds::Uint64),
+ TColumn("ReceiveCount", NScheme::NTypeIds::Uint32),
+ TColumn("FirstReceiveTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("SentTimestamp", NScheme::NTypeIds::Uint64)};
+
+static const TVector<TColumn> GroupsColumns = {
+ TColumn("GroupId", NScheme::NTypeIds::String, true),
+ TColumn("RandomId", NScheme::NTypeIds::Uint64),
+ TColumn("Head", NScheme::NTypeIds::Uint64),
+ TColumn("Tail", NScheme::NTypeIds::Uint64),
+ TColumn("ReceiveAttemptId", NScheme::NTypeIds::Utf8),
+ TColumn("LockTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("VisibilityDeadline", NScheme::NTypeIds::Uint64)};
+
+static const TVector<TColumn> DeduplicationColumns = {
+ TColumn("DedupId", NScheme::NTypeIds::String, true),
+ TColumn("Deadline", NScheme::NTypeIds::Uint64),
+ TColumn("Offset", NScheme::NTypeIds::Uint64),
+ TColumn("MessageId", NScheme::NTypeIds::String)};
+
+static const TVector<TColumn> ReadsColumns = {
+ TColumn("ReceiveAttemptId", NScheme::NTypeIds::Utf8, true),
+ TColumn("Deadline", NScheme::NTypeIds::Uint64)};
+
+static const TVector<TColumn> SentTimestampIdxColumns = {
+ TColumn("SentTimestamp", NScheme::NTypeIds::Uint64, true),
+ TColumn("Offset", NScheme::NTypeIds::Uint64, true),
+ TColumn("RandomId", NScheme::NTypeIds::Uint64),
+ TColumn("DelayDeadline", NScheme::NTypeIds::Uint64),
+ TColumn("GroupId", NScheme::NTypeIds::String)};
+
+TVector<TTable> GetFifoTables() {
+ TVector<TTable> list;
list.reserve(8);
-
- list.push_back(TTable("Attributes")
- .SetColumns(AttributesColumns)
+
+ list.push_back(TTable("Attributes")
+ .SetColumns(AttributesColumns)
.SetShard(-1)
.SetHasLeaderTablet());
- list.push_back(TTable("Data")
- .SetColumns(DataColumns)
- .SetShard(-1));
- list.push_back(TTable("Deduplication")
- .SetColumns(DeduplicationColumns)
- .SetShard(-1));
- list.push_back(TTable("Groups")
- .SetColumns(GroupsColumns)
- .SetShard(-1));
- list.push_back(TTable("Messages")
- .SetColumns(MessagesColumns)
- .SetSequential(true)
- .SetShard(-1));
- list.push_back(TTable("Reads")
- .SetColumns(ReadsColumns)
- .SetShard(-1));
- list.push_back(TTable("State")
- .SetColumns(StateColumns)
- .SetShard(-1));
- list.push_back(TTable("SentTimestampIdx")
- .SetColumns(SentTimestampIdxColumns)
- .SetSequential(true)
- .SetShard(-1));
-
- return list;
-}
-
+ list.push_back(TTable("Data")
+ .SetColumns(DataColumns)
+ .SetShard(-1));
+ list.push_back(TTable("Deduplication")
+ .SetColumns(DeduplicationColumns)
+ .SetShard(-1));
+ list.push_back(TTable("Groups")
+ .SetColumns(GroupsColumns)
+ .SetShard(-1));
+ list.push_back(TTable("Messages")
+ .SetColumns(MessagesColumns)
+ .SetSequential(true)
+ .SetShard(-1));
+ list.push_back(TTable("Reads")
+ .SetColumns(ReadsColumns)
+ .SetShard(-1));
+ list.push_back(TTable("State")
+ .SetColumns(StateColumns)
+ .SetShard(-1));
+ list.push_back(TTable("SentTimestampIdx")
+ .SetColumns(SentTimestampIdxColumns)
+ .SetSequential(true)
+ .SetShard(-1));
+
+ return list;
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/queues/fifo/schema.h b/ydb/core/ymq/queues/fifo/schema.h
index 788fab0ba7..c01185a5ed 100644
--- a/ydb/core/ymq/queues/fifo/schema.h
+++ b/ydb/core/ymq/queues/fifo/schema.h
@@ -1,9 +1,9 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/ymq/base/table_info.h>
-
+
namespace NKikimr::NSQS {
-
-TVector<TTable> GetFifoTables();
-
+
+TVector<TTable> GetFifoTables();
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/queues/fifo/ya.make b/ydb/core/ymq/queues/fifo/ya.make
index 770b3147a9..8edd9ab276 100644
--- a/ydb/core/ymq/queues/fifo/ya.make
+++ b/ydb/core/ymq/queues/fifo/ya.make
@@ -3,15 +3,15 @@ OWNER(
g:sqs
)
-LIBRARY()
-
-SRCS(
- queries.cpp
- schema.cpp
-)
-
-PEERDIR(
+LIBRARY()
+
+SRCS(
+ queries.cpp
+ schema.cpp
+)
+
+PEERDIR(
ydb/core/ymq/base
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/ymq/queues/std/queries.cpp b/ydb/core/ymq/queues/std/queries.cpp
index 202d9c1489..9a7842d6a6 100644
--- a/ydb/core/ymq/queues/std/queries.cpp
+++ b/ydb/core/ymq/queues/std/queries.cpp
@@ -1,20 +1,20 @@
-#include "queries.h"
+#include "queries.h"
#include <ydb/core/ymq/base/constants.h>
-
+
namespace NKikimr::NSQS {
-namespace {
-
+namespace {
+
static const char* const AddMessagesToInflyQuery = R"__(
- (
+ (
(let inflyLimit (Parameter 'INFLY_LIMIT (DataType 'Uint64)))
(let shard (Parameter 'SHARD (DataType 'Uint64)))
(let from (Parameter 'FROM (DataType 'Uint64)))
(let expectedMaxCount (Parameter 'EXPECTED_MAX_COUNT (DataType 'Uint64)))
-
- (let inflyTable '%1$s/%2$i/Infly)
- (let msgTable '%1$s/%2$i/Messages)
- (let stateTable '%1$s/State)
-
+
+ (let inflyTable '%1$s/%2$i/Infly)
+ (let msgTable '%1$s/%2$i/Messages)
+ (let stateTable '%1$s/State)
+
(let stateRow '(
'('State shard)))
(let stateFields '(
@@ -23,7 +23,7 @@ static const char* const AddMessagesToInflyQuery = R"__(
'ReadOffset
'InflyVersion))
(let state (SelectRow stateTable stateRow stateFields))
-
+
(let inflyMaxCountToAdd
(Convert
(Coalesce
@@ -45,7 +45,7 @@ static const char* const AddMessagesToInflyQuery = R"__(
'SentTimestamp
'DelayDeadline))
(let messages (Take (Member (SelectRange msgTable msgRange msgFields '('('"ItemsLimit" expectedMaxCount))) 'List) inflyMaxCountToAdd))
-
+
(let inflyCount (Add (Member state 'InflyCount) (Length messages)))
(let lastElement (ToOptional (Skip messages (Sub (Length messages) (Uint64 '1)))))
(let nextReadOffset
@@ -61,56 +61,56 @@ static const char* const AddMessagesToInflyQuery = R"__(
)
)
(let newInflyVersion (If (HasItems messages) (Add currentInflyVersion (Uint64 '1)) currentInflyVersion))
-
- (return (Extend
+
+ (return (Extend
(AsList (SetResult 'messages messages))
(AsList (SetResult 'inflyCount inflyCount))
(AsList (SetResult 'messagesCount (Member state 'MessageCount)))
(AsList (SetResult 'readOffset nextReadOffset))
(AsList (SetResult 'currentInflyVersion currentInflyVersion))
(AsList (SetResult 'newInflyVersion newInflyVersion))
-
+
(ListIf (HasItems messages) (block '(
- (let row '(
- '('State shard)))
- (let update '(
+ (let row '(
+ '('State shard)))
+ (let update '(
'('ReadOffset nextReadOffset)
'('InflyCount inflyCount)
'('InflyVersion newInflyVersion)))
- (return (UpdateRow stateTable row update)))))
-
+ (return (UpdateRow stateTable row update)))))
+
(Map messages (lambda '(item) (block '(
- (let row '(
- '('Offset (Member item 'Offset))))
- (let update '(
- '('RandomId (Member item 'RandomId))
+ (let row '(
+ '('Offset (Member item 'Offset))))
+ (let update '(
+ '('RandomId (Member item 'RandomId))
'('LoadId (Uint64 '0))
- '('FirstReceiveTimestamp (Uint64 '0))
- '('LockTimestamp (Uint64 '0))
- '('ReceiveCount (Uint32 '0))
- '('SentTimestamp (Member item 'SentTimestamp))
+ '('FirstReceiveTimestamp (Uint64 '0))
+ '('LockTimestamp (Uint64 '0))
+ '('ReceiveCount (Uint32 '0))
+ '('SentTimestamp (Member item 'SentTimestamp))
'('DelayDeadline (Member item 'DelayDeadline))
- '('VisibilityDeadline (Uint64 '0))))
- (return (UpdateRow inflyTable row update))))))
-
+ '('VisibilityDeadline (Uint64 '0))))
+ (return (UpdateRow inflyTable row update))))))
+
(Map messages (lambda '(item) (block '(
- (let row '(
- '('Offset (Member item 'Offset))))
- (return (EraseRow msgTable row))))))))
- )
-)__";
-
-const char* const ChangeMessageVisibilityQuery = R"__(
- (
+ (let row '(
+ '('Offset (Member item 'Offset))))
+ (return (EraseRow msgTable row))))))))
+ )
+)__";
+
+const char* const ChangeMessageVisibilityQuery = R"__(
+ (
(let now (Parameter 'NOW (DataType 'Uint64)))
(let keys (Parameter 'KEYS
(ListType (StructType
'('Offset (DataType 'Uint64))
'('LockTimestamp (DataType 'Uint64))
'('NewVisibilityDeadline (DataType 'Uint64))))))
-
- (let inflyTable '%1$s/%2$i/Infly)
-
+
+ (let inflyTable '%1$s/%2$i/Infly)
+
(let records
(MapParameter keys (lambda '(item) (block '(
(let messageRow '(
@@ -119,9 +119,9 @@ const char* const ChangeMessageVisibilityQuery = R"__(
'VisibilityDeadline
'LockTimestamp))
(let inflyRead (SelectRow inflyTable messageRow inflySelect))
-
+
(let exists (Exists inflyRead))
-
+
(let changeCond
(Coalesce
(And
@@ -129,14 +129,14 @@ const char* const ChangeMessageVisibilityQuery = R"__(
(Equal (Member item 'LockTimestamp) (Member inflyRead 'LockTimestamp))
)
(Bool 'false)))
-
+
(return (AsStruct
'('Offset (Member item 'Offset))
'('Exists exists)
'('ChangeCond changeCond)
'('CurrentVisibilityDeadline (Member inflyRead 'VisibilityDeadline))
'('NewVisibilityDeadline (Member item 'NewVisibilityDeadline)))))))))
-
+
(let recordsToChange
(Filter records (lambda '(item) (block '(
(return (And (Member item 'Exists) (Member item 'ChangeCond)))
@@ -152,30 +152,30 @@ const char* const ChangeMessageVisibilityQuery = R"__(
'('VisibilityDeadline (Member item 'NewVisibilityDeadline))))
(return (UpdateRow inflyTable messageRow visibilityUpdate))
))))
- ))
- )
-)__";
-
-const char* const PurgeQueueQuery = R"__(
- (
+ ))
+ )
+)__";
+
+const char* const PurgeQueueQuery = R"__(
+ (
(let offsetFrom (Parameter 'OFFSET_FROM (DataType 'Uint64)))
(let offsetTo (Parameter 'OFFSET_TO (DataType 'Uint64)))
(let now (Parameter 'NOW (DataType 'Uint64)))
(let shard (Parameter 'SHARD (DataType 'Uint64)))
(let batchSize (Parameter 'BATCH_SIZE (DataType 'Uint64)))
-
+
(let msgTable '%1$s/%2$i/Messages)
(let inflyTable '%1$s/%2$i/Infly)
(let stateTable '%1$s/State)
-
- (let stateRow '(
- '('State shard)))
- (let stateSelect '(
+
+ (let stateRow '(
+ '('State shard)))
+ (let stateSelect '(
'CleanupVersion
'LastModifiedTimestamp))
- (let stateRead
- (SelectRow stateTable stateRow stateSelect))
-
+ (let stateRead
+ (SelectRow stateTable stateRow stateSelect))
+
(let modifiedTimestamp (Max now (Member stateRead 'LastModifiedTimestamp)))
(let messageRange '(
@@ -183,9 +183,9 @@ const char* const PurgeQueueQuery = R"__(
(let inflyRange '(
'('Offset offsetFrom offsetTo)))
(let messageSelect '(
- 'SentTimestamp
- 'Offset
- 'RandomId))
+ 'SentTimestamp
+ 'Offset
+ 'RandomId))
(let selectResult (SelectRange msgTable messageRange messageSelect '('('"ItemsLimit" batchSize))))
(let selectInflyResult (SelectRange inflyTable inflyRange messageSelect '('('"ItemsLimit" batchSize))))
@@ -194,22 +194,22 @@ const char* const PurgeQueueQuery = R"__(
(let inflyMessages (Member selectInflyResult 'List))
(let truncated (Coalesce (Member selectResult 'Truncated) (Member selectInflyResult 'Truncated) (Bool 'false)))
(let newCleanupVersion (Add (Member stateRead 'CleanupVersion) (Uint64 '1)))
-
- (let stateUpdate '(
+
+ (let stateUpdate '(
'('LastModifiedTimestamp modifiedTimestamp)
'('CleanupVersion newCleanupVersion)
))
-
- (return (Extend
+
+ (return (Extend
(AsList (SetResult 'messages messages))
(AsList (SetResult 'inflyMessages inflyMessages))
(AsList (SetResult 'truncated truncated))
(AsList (SetResult 'cleanupVersion newCleanupVersion))
- (AsList (UpdateRow stateTable stateRow stateUpdate))
+ (AsList (UpdateRow stateTable stateRow stateUpdate))
))
)
)__";
-
+
const char* const PurgeQueueStage2Query = R"__(
(
(let shard (Parameter 'SHARD (DataType 'Uint64)))
@@ -221,13 +221,13 @@ const char* const PurgeQueueStage2Query = R"__(
'('RandomId (DataType 'Uint64))
'('SentTimestamp (DataType 'Uint64))
))))
-
+
(let dataTable '%1$s/%2$i/MessageData)
(let inflyTable '%1$s/%2$i/Infly)
(let msgTable '%1$s/%2$i/Messages)
(let sentTsIdx '%1$s/%2$i/SentTimestampIdx)
(let stateTable '%1$s/State)
-
+
(let stateRow '(
'('State shard)))
(let stateSelect '(
@@ -237,7 +237,7 @@ const char* const PurgeQueueStage2Query = R"__(
'LastModifiedTimestamp))
(let stateRead
(SelectRow stateTable stateRow stateSelect))
-
+
(let modifiedTimestamp (Max now (Member stateRead 'LastModifiedTimestamp)))
(let inflyRecords
@@ -278,7 +278,7 @@ const char* const PurgeQueueStage2Query = R"__(
'('LastModifiedTimestamp modifiedTimestamp)
'('MessageCount newMessagesCount)
'('InflyCount (Sub (Member stateRead 'InflyCount) (Length inflyRecordsExisted)))
- ))
+ ))
(let versionIsSame
(Coalesce
@@ -327,94 +327,94 @@ const char* const PurgeQueueStage2Query = R"__(
'('Offset (Member item 'Offset)))))))))
(AsList (Void)))
))
- )
-)__";
-
-const char* const DeleteMessageQuery = R"__(
- (
- (let keys (Parameter 'KEYS
- (ListType (StructType
- '('Offset (DataType 'Uint64))
- '('LockTimestamp (DataType 'Uint64))))))
- (let now (Parameter 'NOW (DataType 'Uint64)))
- (let shard (Parameter 'SHARD (DataType 'Uint64)))
-
- (let dataTable '%1$s/%2$i/MessageData)
- (let inflyTable '%1$s/%2$i/Infly)
- (let sentTsIdx '%1$s/%2$i/SentTimestampIdx)
- (let stateTable '%1$s/State)
-
- (let records
- (MapParameter keys (lambda '(item) (block '(
- (let row '(
- '('Offset (Member item 'Offset))))
- (let fields '(
- 'Offset
- 'RandomId
- 'SentTimestamp))
- (return (SelectRow inflyTable row fields)))))))
-
- (let existed
- (Filter records (lambda '(item) (block '(
- (return (Exists item))
- )))))
-
- (let result
- (Map existed (lambda '(item) (block '(
- (return (AsStruct
- '('Offset (Member item 'Offset)))))))))
-
- (let stateRow '(
- '('State shard)))
- (let stateSelect '(
- 'InflyCount
+ )
+)__";
+
+const char* const DeleteMessageQuery = R"__(
+ (
+ (let keys (Parameter 'KEYS
+ (ListType (StructType
+ '('Offset (DataType 'Uint64))
+ '('LockTimestamp (DataType 'Uint64))))))
+ (let now (Parameter 'NOW (DataType 'Uint64)))
+ (let shard (Parameter 'SHARD (DataType 'Uint64)))
+
+ (let dataTable '%1$s/%2$i/MessageData)
+ (let inflyTable '%1$s/%2$i/Infly)
+ (let sentTsIdx '%1$s/%2$i/SentTimestampIdx)
+ (let stateTable '%1$s/State)
+
+ (let records
+ (MapParameter keys (lambda '(item) (block '(
+ (let row '(
+ '('Offset (Member item 'Offset))))
+ (let fields '(
+ 'Offset
+ 'RandomId
+ 'SentTimestamp))
+ (return (SelectRow inflyTable row fields)))))))
+
+ (let existed
+ (Filter records (lambda '(item) (block '(
+ (return (Exists item))
+ )))))
+
+ (let result
+ (Map existed (lambda '(item) (block '(
+ (return (AsStruct
+ '('Offset (Member item 'Offset)))))))))
+
+ (let stateRow '(
+ '('State shard)))
+ (let stateSelect '(
+ 'InflyCount
'MessageCount
'LastModifiedTimestamp))
- (let stateRead (SelectRow stateTable stateRow stateSelect))
-
+ (let stateRead (SelectRow stateTable stateRow stateSelect))
+
(let modifiedTimestamp (Max now (Member stateRead 'LastModifiedTimestamp)))
(let newMessagesCount (Sub (Member stateRead 'MessageCount) (Length existed)))
- (let stateUpdate '(
+ (let stateUpdate '(
'('LastModifiedTimestamp modifiedTimestamp)
- '('InflyCount (Sub (Member stateRead 'InflyCount) (Length existed)))
+ '('InflyCount (Sub (Member stateRead 'InflyCount) (Length existed)))
'('MessageCount newMessagesCount)))
-
- (let deleteCond (HasItems existed))
-
- (return (Extend
- (AsList (SetResult 'deleted result))
+
+ (let deleteCond (HasItems existed))
+
+ (return (Extend
+ (AsList (SetResult 'deleted result))
(AsList (SetResult 'newMessagesCount newMessagesCount))
- (ListIf deleteCond (UpdateRow stateTable stateRow stateUpdate))
-
- (If deleteCond
- (Map existed (lambda '(item) (block '(
- (let row '(
- '('Offset (Member item 'Offset))))
- (return (EraseRow inflyTable row))))))
- (AsList (Void)))
-
- (If deleteCond
- (Map existed (lambda '(item) (block '(
- (let row '(
- '('RandomId (Member item 'RandomId))
- '('Offset (Member item 'Offset))))
- (return (EraseRow dataTable row))))))
- (AsList (Void)))
-
- (If deleteCond
- (Map existed (lambda '(item) (block '(
- (let row '(
- '('SentTimestamp (Member item 'SentTimestamp))
- '('Offset (Member item 'Offset))))
- (return (EraseRow sentTsIdx row))))))
- (AsList (Void)))
- ))
- )
-)__";
-
-const char* const SetQueueAttributesQuery = R"__(
- (
+ (ListIf deleteCond (UpdateRow stateTable stateRow stateUpdate))
+
+ (If deleteCond
+ (Map existed (lambda '(item) (block '(
+ (let row '(
+ '('Offset (Member item 'Offset))))
+ (return (EraseRow inflyTable row))))))
+ (AsList (Void)))
+
+ (If deleteCond
+ (Map existed (lambda '(item) (block '(
+ (let row '(
+ '('RandomId (Member item 'RandomId))
+ '('Offset (Member item 'Offset))))
+ (return (EraseRow dataTable row))))))
+ (AsList (Void)))
+
+ (If deleteCond
+ (Map existed (lambda '(item) (block '(
+ (let row '(
+ '('SentTimestamp (Member item 'SentTimestamp))
+ '('Offset (Member item 'Offset))))
+ (return (EraseRow sentTsIdx row))))))
+ (AsList (Void)))
+ ))
+ )
+)__";
+
+const char* const SetQueueAttributesQuery = R"__(
+ (
(let delay (Parameter 'DELAY (OptionalType (DataType 'Uint64))))
(let retention (Parameter 'RETENTION (OptionalType (DataType 'Uint64))))
(let visibility (Parameter 'VISIBILITY (OptionalType (DataType 'Uint64))))
@@ -424,32 +424,32 @@ const char* const SetQueueAttributesQuery = R"__(
(let dlqArn (Parameter 'DLQ_TARGET_ARN (OptionalType (DataType 'Utf8String))))
(let dlqName (Parameter 'DLQ_TARGET_NAME (OptionalType (DataType 'Utf8String))))
(let userName (Parameter 'USER_NAME (DataType 'Utf8String)))
-
- (let attrsTable '%1$s/Attributes)
-
- (let attrsRow '(
- '('State (Uint64 '0))))
- (let attrsSelect '(
- 'DelaySeconds
- 'MessageRetentionPeriod
- 'ReceiveMessageWaitTime
+
+ (let attrsTable '%1$s/Attributes)
+
+ (let attrsRow '(
+ '('State (Uint64 '0))))
+ (let attrsSelect '(
+ 'DelaySeconds
+ 'MessageRetentionPeriod
+ 'ReceiveMessageWaitTime
'VisibilityTimeout
'MaximumMessageSize
'DlqName
'DlqArn
'MaxReceiveCount))
- (let attrsRead (SelectRow attrsTable attrsRow attrsSelect))
-
- (let attrsUpdate '(
- '('DelaySeconds (Coalesce delay (Member attrsRead 'DelaySeconds)))
- '('MessageRetentionPeriod (Coalesce retention (Member attrsRead 'MessageRetentionPeriod)))
- '('ReceiveMessageWaitTime (Coalesce wait (Member attrsRead 'ReceiveMessageWaitTime)))
+ (let attrsRead (SelectRow attrsTable attrsRow attrsSelect))
+
+ (let attrsUpdate '(
+ '('DelaySeconds (Coalesce delay (Member attrsRead 'DelaySeconds)))
+ '('MessageRetentionPeriod (Coalesce retention (Member attrsRead 'MessageRetentionPeriod)))
+ '('ReceiveMessageWaitTime (Coalesce wait (Member attrsRead 'ReceiveMessageWaitTime)))
'('VisibilityTimeout (Coalesce visibility (Member attrsRead 'VisibilityTimeout)))
'('MaxReceiveCount (Coalesce maxReceiveCount (Member attrsRead 'MaxReceiveCount)))
'('DlqName (Coalesce dlqName (Member attrsRead 'DlqName)))
'('DlqArn (Coalesce dlqArn (Member attrsRead 'DlqArn)))
'('MaximumMessageSize (Coalesce maxMessageSize (Member attrsRead 'MaximumMessageSize)))))
-
+
(let queuesTable '%5$s/.Queues)
(let queuesRow '(
'('Account userName)
@@ -463,12 +463,12 @@ const char* const SetQueueAttributesQuery = R"__(
(let queuesRowUpdate '(
'('DlqName (Coalesce dlqName (Member queuesRowRead 'DlqName)))))
- (return (AsList
+ (return (AsList
(UpdateRow attrsTable attrsRow attrsUpdate)
(UpdateRow queuesTable queuesRow queuesRowUpdate)))
- )
-)__";
-
+ )
+)__";
+
const char* const InternalGetQueueAttributesQuery = R"__(
(
(let attrsTable '%1$s/Attributes)
@@ -493,22 +493,22 @@ const char* const InternalGetQueueAttributesQuery = R"__(
)
)__";
-const char* const ListQueuesQuery = R"__(
- (
+const char* const ListQueuesQuery = R"__(
+ (
(let folderId (Parameter 'FOLDERID (DataType 'Utf8String)))
(let userName (Parameter 'USER_NAME (DataType 'Utf8String)))
-
+
(let queuesTable '%5$s/.Queues)
(let skipFolderIdFilter (Equal folderId (Utf8String '"")))
(let queuesRange '(
'('Account userName userName)
- '('QueueName (Utf8String '"") (Void))))
+ '('QueueName (Utf8String '"") (Void))))
(let queueSelect '('QueueName 'QueueId 'QueueState 'FifoQueue 'CreatedTimestamp 'CustomQueueName 'FolderId 'MasterTabletId 'Version 'Shards))
(let queues (Member (SelectRange queuesTable queuesRange queueSelect '()) 'List))
-
- (let filtered (Filter queues (lambda '(item) (block '(
+
+ (let filtered (Filter queues (lambda '(item) (block '(
(return (Coalesce
(And
(Or
@@ -518,58 +518,58 @@ const char* const ListQueuesQuery = R"__(
(Equal (Member item 'FolderId) folderId)
skipFolderIdFilter))
(Bool 'false)))
- )))))
-
- (return (AsList
- (SetResult 'queues filtered)))
- )
-)__";
-
-const char* const LoadMessageQuery = R"__(
- (
- (let keys (Parameter 'KEYS
- (ListType (StructType
- '('RandomId (DataType 'Uint64))
- '('Offset (DataType 'Uint64))
+ )))))
+
+ (return (AsList
+ (SetResult 'queues filtered)))
+ )
+)__";
+
+const char* const LoadMessageQuery = R"__(
+ (
+ (let keys (Parameter 'KEYS
+ (ListType (StructType
+ '('RandomId (DataType 'Uint64))
+ '('Offset (DataType 'Uint64))
'('CurrentVisibilityDeadline (DataType 'Uint64))
'('DlqIndex (DataType 'Uint64))
'('IsDeadLetter (DataType 'Bool))
'('VisibilityDeadline (DataType 'Uint64))))))
- (let now (Parameter 'NOW (DataType 'Uint64)))
- (let readId (Parameter 'READ_ID (DataType 'Uint64)))
- (let shard (Parameter 'SHARD (DataType 'Uint64)))
-
- (let dataTable '%1$s/%2$i/MessageData)
- (let inflyTable '%1$s/%2$i/Infly)
-
- (let records
- (MapParameter keys (lambda '(item) (block '(
- (let read (block '(
+ (let now (Parameter 'NOW (DataType 'Uint64)))
+ (let readId (Parameter 'READ_ID (DataType 'Uint64)))
+ (let shard (Parameter 'SHARD (DataType 'Uint64)))
+
+ (let dataTable '%1$s/%2$i/MessageData)
+ (let inflyTable '%1$s/%2$i/Infly)
+
+ (let records
+ (MapParameter keys (lambda '(item) (block '(
+ (let read (block '(
(let row '(
- '('Offset (Member item 'Offset))))
- (let fields '(
- 'LoadId
- 'FirstReceiveTimestamp
- 'ReceiveCount
- 'SentTimestamp
+ '('Offset (Member item 'Offset))))
+ (let fields '(
+ 'LoadId
+ 'FirstReceiveTimestamp
+ 'ReceiveCount
+ 'SentTimestamp
'VisibilityDeadline
'DelayDeadline))
- (return (SelectRow inflyTable row fields)))))
-
- (let data (block '(
- (let row '(
- '('RandomId (Member item 'RandomId))
- '('Offset (Member item 'Offset))))
- (let fields '(
- 'Attributes
- 'Data
+ (return (SelectRow inflyTable row fields)))))
+
+ (let data (block '(
+ (let row '(
+ '('RandomId (Member item 'RandomId))
+ '('Offset (Member item 'Offset))))
+ (let fields '(
+ 'Attributes
+ 'Data
'SenderId
- 'MessageId))
- (return (SelectRow dataTable row fields)))))
-
- (let receiveTimestamp
- (If (Coalesce (Equal (Member read 'FirstReceiveTimestamp) (Uint64 '0)) (Bool 'false)) now (Member read 'FirstReceiveTimestamp)))
-
+ 'MessageId))
+ (return (SelectRow dataTable row fields)))))
+
+ (let receiveTimestamp
+ (If (Coalesce (Equal (Member read 'FirstReceiveTimestamp) (Uint64 '0)) (Bool 'false)) now (Member read 'FirstReceiveTimestamp)))
+
(let visibilityDeadlineInDb
(Max
(Member read 'VisibilityDeadline)
@@ -580,56 +580,56 @@ const char* const LoadMessageQuery = R"__(
)
)
- (let valid
- (Coalesce
+ (let valid
+ (Coalesce
(Or
(Equal visibilityDeadlineInDb (Member item 'CurrentVisibilityDeadline))
(And
(Equal (Member read 'LoadId) readId)
(Equal (Member read 'VisibilityDeadline) (Member item 'VisibilityDeadline))))
- (Bool 'false)))
-
- (return
- (AsStruct
- '('Offset (Member item 'Offset))
- '('RandomId (Member item 'RandomId))
- '('LoadId readId)
- '('Attributes (Member data 'Attributes))
- '('Data (Member data 'Data))
+ (Bool 'false)))
+
+ (return
+ (AsStruct
+ '('Offset (Member item 'Offset))
+ '('RandomId (Member item 'RandomId))
+ '('LoadId readId)
+ '('Attributes (Member data 'Attributes))
+ '('Data (Member data 'Data))
'('SenderId (Member data 'SenderId))
- '('MessageId (Member data 'MessageId))
- '('FirstReceiveTimestamp receiveTimestamp)
- '('LockTimestamp now)
+ '('MessageId (Member data 'MessageId))
+ '('FirstReceiveTimestamp receiveTimestamp)
+ '('LockTimestamp now)
'('IsDeadLetter (Member item 'IsDeadLetter))
'('DlqIndex (Member item 'DlqIndex))
- '('ReceiveCount (Add (Member read 'ReceiveCount) (Uint32 '1)))
- '('SentTimestamp (Member read 'SentTimestamp))
+ '('ReceiveCount (Add (Member read 'ReceiveCount) (Uint32 '1)))
+ '('SentTimestamp (Member read 'SentTimestamp))
'('VisibilityDeadline (If valid (Member item 'VisibilityDeadline) (Member read 'VisibilityDeadline)))
'('Valid valid)
'('Exists (Exists read))))
- )))))
-
- (let result
- (Filter records (lambda '(item) (block '(
- (return (Coalesce (Member item 'Valid) (Bool 'false))))))))
-
- (return (Extend
+ )))))
+
+ (let result
+ (Filter records (lambda '(item) (block '(
+ (return (Coalesce (Member item 'Valid) (Bool 'false))))))))
+
+ (return (Extend
(AsList (SetResult 'result records))
(AsList (SetResult 'movedMessagesCount (Uint64 '0)))
-
- (Map result (lambda '(item) (block '(
- (let row '(
- '('Offset (Member item 'Offset))))
- (let update '(
+
+ (Map result (lambda '(item) (block '(
+ (let row '(
+ '('Offset (Member item 'Offset))))
+ (let update '(
'('LoadId readId)
- '('FirstReceiveTimestamp (Member item 'FirstReceiveTimestamp))
- '('LockTimestamp (Member item 'LockTimestamp))
- '('ReceiveCount (Member item 'ReceiveCount))
+ '('FirstReceiveTimestamp (Member item 'FirstReceiveTimestamp))
+ '('LockTimestamp (Member item 'LockTimestamp))
+ '('ReceiveCount (Member item 'ReceiveCount))
'('VisibilityDeadline (Member item 'VisibilityDeadline))))
- (return (UpdateRow inflyTable row update))))))))
- )
-)__";
-
+ (return (UpdateRow inflyTable row update))))))))
+ )
+)__";
+
const char* const LoadOrRedriveMessageQuery = R"__(
(
(let keys (Parameter 'KEYS
@@ -828,8 +828,8 @@ const char* const LoadOrRedriveMessageQuery = R"__(
)
)__";
-const char* const WriteMessageQuery = R"__(
- (
+const char* const WriteMessageQuery = R"__(
+ (
(let randomId (Parameter 'RANDOM_ID (DataType 'Uint64)))
(let timestamp (Parameter 'TIMESTAMP (DataType 'Uint64)))
(let shard (Parameter 'SHARD (DataType 'Uint64)))
@@ -843,31 +843,31 @@ const char* const WriteMessageQuery = R"__(
'('Index (DataType 'Uint64))
))
))
-
- (let dataTable '%1$s/%2$i/MessageData)
- (let msgTable '%1$s/%2$i/Messages)
- (let sentTsIdx '%1$s/%2$i/SentTimestampIdx)
- (let stateTable '%1$s/State)
-
- (let stateRow '(
- '('State shard)))
- (let stateSelect '(
- 'MessageCount
+
+ (let dataTable '%1$s/%2$i/MessageData)
+ (let msgTable '%1$s/%2$i/Messages)
+ (let sentTsIdx '%1$s/%2$i/SentTimestampIdx)
+ (let stateTable '%1$s/State)
+
+ (let stateRow '(
+ '('State shard)))
+ (let stateSelect '(
+ 'MessageCount
'WriteOffset
'LastModifiedTimestamp))
- (let stateRead (SelectRow stateTable stateRow stateSelect))
-
+ (let stateRead (SelectRow stateTable stateRow stateSelect))
+
(let sentTimestamp (Max timestamp (Member stateRead 'LastModifiedTimestamp)))
(let newMessagesCount (Add (Member stateRead 'MessageCount) (Length messages)))
(let newWriteOffset (Add (Member stateRead 'WriteOffset) (Length messages)))
(let startOffset (Add (Member stateRead 'WriteOffset) (Uint64 '1)))
-
+
(let stateUpdate '(
'('LastModifiedTimestamp sentTimestamp)
'('MessageCount newMessagesCount)
'('WriteOffset newWriteOffset)))
-
+
(let result
(MapParameter messages (lambda '(item) (block '(
(return
@@ -875,13 +875,13 @@ const char* const WriteMessageQuery = R"__(
'('dedupCond (Bool 'true))
))
)))))
-
+
(return (Extend
(AsList (SetResult 'newMessagesCount newMessagesCount))
(AsList (SetResult 'result result))
-
+
(AsList (UpdateRow stateTable stateRow stateUpdate))
-
+
(MapParameter messages (lambda '(item) (block '(
(let msgRow '(
'('Offset (Add startOffset (Member item 'Index)))))
@@ -892,7 +892,7 @@ const char* const WriteMessageQuery = R"__(
'('SentTimestamp sentTimestamp)
'('DelayDeadline delayDeadline)))
(return (UpdateRow msgTable msgRow messageUpdate))))))
-
+
(MapParameter messages (lambda '(item) (block '(
(let sentTsRow '(
'('SentTimestamp sentTimestamp)
@@ -903,76 +903,76 @@ const char* const WriteMessageQuery = R"__(
'('RandomId randomId)
'('DelayDeadline delayDeadline)))
(return (UpdateRow sentTsIdx sentTsRow sentTsUpdate))))))
-
+
(MapParameter messages (lambda '(item) (block '(
(let dataRow '(
'('RandomId randomId)
'('Offset (Add startOffset (Member item 'Index)))))
-
+
(let dataUpdate '(
'('Data (Member item 'Data))
'('Attributes (Member item 'Attributes))
'('SenderId (Member item 'SenderId))
'('MessageId (Member item 'MessageId))))
(return (UpdateRow dataTable dataRow dataUpdate))))))
- ))
- )
-)__";
-
-const char* const SetRetentionQuery = R"__(
- (
- (let now (Parameter 'NOW (DataType 'Uint64)))
- (let purge (Parameter 'PURGE (DataType 'Bool)))
-
- (let attrsTable '%1$s/Attributes)
- (let stateTable '%1$s/State)
-
- (let attrs (block '(
- (let row '(
- '('State (Uint64 '0))))
- (let fields '(
- 'MessageRetentionPeriod))
- (return (SelectRow attrsTable row fields)))))
-
- (let boundary
- (If purge now (Coalesce (Sub now (Member attrs 'MessageRetentionPeriod)) (Uint64 '0))))
-
+ ))
+ )
+)__";
+
+const char* const SetRetentionQuery = R"__(
+ (
+ (let now (Parameter 'NOW (DataType 'Uint64)))
+ (let purge (Parameter 'PURGE (DataType 'Bool)))
+
+ (let attrsTable '%1$s/Attributes)
+ (let stateTable '%1$s/State)
+
+ (let attrs (block '(
+ (let row '(
+ '('State (Uint64 '0))))
+ (let fields '(
+ 'MessageRetentionPeriod))
+ (return (SelectRow attrsTable row fields)))))
+
+ (let boundary
+ (If purge now (Coalesce (Sub now (Member attrs 'MessageRetentionPeriod)) (Uint64 '0))))
+
(let range '(
'('State (Uint64 '0) (Uint64 '18446744073709551615))))
(let fields '(
'State
'RetentionBoundary))
(let records (Member (SelectRange stateTable range fields '()) 'List))
-
+
(let result
(Map records (lambda '(item) (block '(
(let updated
(Coalesce
(Less (Member item 'RetentionBoundary) boundary)
(Bool 'false)))
-
+
(return (AsStruct
'('Shard (Member item 'State))
'('RetentionBoundary (Max boundary (Member item 'RetentionBoundary)))
'('Updated updated))))))))
-
+
(let updated (Filter result (lambda '(item) (block '(
(return (Coalesce (Equal (Member item 'Updated) (Bool 'true)) (Bool 'false))))))))
-
- (return (Extend
- (AsList (SetResult 'result result))
- (AsList (SetResult 'retention (Member attrs 'MessageRetentionPeriod)))
-
+
+ (return (Extend
+ (AsList (SetResult 'result result))
+ (AsList (SetResult 'retention (Member attrs 'MessageRetentionPeriod)))
+
(Map updated (lambda '(item) (block '(
- (let row '(
- '('State (Member item 'Shard))))
- (let update '(
- '('RetentionBoundary (Member item 'RetentionBoundary))))
- (return (UpdateRow stateTable row update))))))
- ))
- )
-)__";
-
+ (let row '(
+ '('State (Member item 'Shard))))
+ (let update '(
+ '('RetentionBoundary (Member item 'RetentionBoundary))))
+ (return (UpdateRow stateTable row update))))))
+ ))
+ )
+)__";
+
const char* const GetOldestMessageTimestampMetricsQuery = R"__(
(
(let timeFrom (Parameter 'TIME_FROM (DataType 'Uint64)))
@@ -1198,10 +1198,10 @@ const char* const GetQueuesListQuery = R"__(
)
)__";
-} // namespace
-
-const char* GetStdQueryById(size_t id) {
- switch (id) {
+} // namespace
+
+const char* GetStdQueryById(size_t id) {
+ switch (id) {
case DELETE_MESSAGE_ID: // 0
return DeleteMessageQuery;
case WRITE_MESSAGE_ID: // 3
@@ -1242,8 +1242,8 @@ const char* GetStdQueryById(size_t id) {
return GetQueuesListQuery;
case GET_MESSAGE_COUNT_METRIC_ID: // 14
return GetMessageCountMetricsQuery;
- }
- return nullptr;
-}
-
+ }
+ return nullptr;
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/queues/std/queries.h b/ydb/core/ymq/queues/std/queries.h
index 00cdf8b4fa..50495caa71 100644
--- a/ydb/core/ymq/queues/std/queries.h
+++ b/ydb/core/ymq/queues/std/queries.h
@@ -1,9 +1,9 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/ymq/base/query_id.h>
-
+
namespace NKikimr::NSQS {
-
-const char* GetStdQueryById(size_t id);
-
+
+const char* GetStdQueryById(size_t id);
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/queues/std/schema.cpp b/ydb/core/ymq/queues/std/schema.cpp
index 4ba75d17a2..f5d395fecd 100644
--- a/ydb/core/ymq/queues/std/schema.cpp
+++ b/ydb/core/ymq/queues/std/schema.cpp
@@ -1,121 +1,121 @@
-#include "schema.h"
-
+#include "schema.h"
+
namespace NKikimr::NSQS {
-
+
TVector<TTable> GetStandardTables(ui64 shards, ui64 partitions, bool enableAutosplit, ui64 sizeToSplit) {
- const TVector<TColumn> AttributesColumns = {
- TColumn("State", NScheme::NTypeIds::Uint64, true),
- TColumn("ContentBasedDeduplication", NScheme::NTypeIds::Bool),
- TColumn("DelaySeconds", NScheme::NTypeIds::Uint64),
- TColumn("FifoQueue", NScheme::NTypeIds::Bool),
- TColumn("MaximumMessageSize", NScheme::NTypeIds::Uint64),
- TColumn("MessageRetentionPeriod", NScheme::NTypeIds::Uint64),
- TColumn("ReceiveMessageWaitTime", NScheme::NTypeIds::Uint64),
+ const TVector<TColumn> AttributesColumns = {
+ TColumn("State", NScheme::NTypeIds::Uint64, true),
+ TColumn("ContentBasedDeduplication", NScheme::NTypeIds::Bool),
+ TColumn("DelaySeconds", NScheme::NTypeIds::Uint64),
+ TColumn("FifoQueue", NScheme::NTypeIds::Bool),
+ TColumn("MaximumMessageSize", NScheme::NTypeIds::Uint64),
+ TColumn("MessageRetentionPeriod", NScheme::NTypeIds::Uint64),
+ TColumn("ReceiveMessageWaitTime", NScheme::NTypeIds::Uint64),
TColumn("VisibilityTimeout", NScheme::NTypeIds::Uint64),
TColumn("DlqName", NScheme::NTypeIds::Utf8),
TColumn("DlqArn", NScheme::NTypeIds::Utf8),
TColumn("MaxReceiveCount", NScheme::NTypeIds::Uint64),
TColumn("ShowDetailedCountersDeadline", NScheme::NTypeIds::Uint64)};
-
- const TVector<TColumn> StateColumns = {
- TColumn("State", NScheme::NTypeIds::Uint64, true),
- TColumn("CleanupTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("CreatedTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("LastModifiedTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("RetentionBoundary", NScheme::NTypeIds::Uint64),
- TColumn("InflyCount", NScheme::NTypeIds::Int64),
- TColumn("MessageCount", NScheme::NTypeIds::Int64),
- TColumn("ReadOffset", NScheme::NTypeIds::Uint64),
+
+ const TVector<TColumn> StateColumns = {
+ TColumn("State", NScheme::NTypeIds::Uint64, true),
+ TColumn("CleanupTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("CreatedTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("LastModifiedTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("RetentionBoundary", NScheme::NTypeIds::Uint64),
+ TColumn("InflyCount", NScheme::NTypeIds::Int64),
+ TColumn("MessageCount", NScheme::NTypeIds::Int64),
+ TColumn("ReadOffset", NScheme::NTypeIds::Uint64),
TColumn("WriteOffset", NScheme::NTypeIds::Uint64),
TColumn("CleanupVersion", NScheme::NTypeIds::Uint64),
TColumn("InflyVersion", NScheme::NTypeIds::Uint64)};
-
- const TVector<TColumn> MessagesDataColumns = {
- TColumn("RandomId", NScheme::NTypeIds::Uint64, true, partitions),
- TColumn("Offset", NScheme::NTypeIds::Uint64, true),
- TColumn("Attributes", NScheme::NTypeIds::String),
- TColumn("Data", NScheme::NTypeIds::String),
+
+ const TVector<TColumn> MessagesDataColumns = {
+ TColumn("RandomId", NScheme::NTypeIds::Uint64, true, partitions),
+ TColumn("Offset", NScheme::NTypeIds::Uint64, true),
+ TColumn("Attributes", NScheme::NTypeIds::String),
+ TColumn("Data", NScheme::NTypeIds::String),
TColumn("MessageId", NScheme::NTypeIds::String),
TColumn("SenderId", NScheme::NTypeIds::String)};
-
+
const TVector<TColumn> MessagesColumns = {
- TColumn("Offset", NScheme::NTypeIds::Uint64, true),
- TColumn("RandomId", NScheme::NTypeIds::Uint64),
- TColumn("SentTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("DelayDeadline", NScheme::NTypeIds::Uint64)};
-
+ TColumn("Offset", NScheme::NTypeIds::Uint64, true),
+ TColumn("RandomId", NScheme::NTypeIds::Uint64),
+ TColumn("SentTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("DelayDeadline", NScheme::NTypeIds::Uint64)};
+
const TVector<TColumn> InflyColumns = {
- TColumn("Offset", NScheme::NTypeIds::Uint64, true),
- TColumn("RandomId", NScheme::NTypeIds::Uint64),
- TColumn("LoadId", NScheme::NTypeIds::Uint64),
- TColumn("FirstReceiveTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("LockTimestamp", NScheme::NTypeIds::Uint64),
- TColumn("ReceiveCount", NScheme::NTypeIds::Uint32),
- TColumn("SentTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("Offset", NScheme::NTypeIds::Uint64, true),
+ TColumn("RandomId", NScheme::NTypeIds::Uint64),
+ TColumn("LoadId", NScheme::NTypeIds::Uint64),
+ TColumn("FirstReceiveTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("LockTimestamp", NScheme::NTypeIds::Uint64),
+ TColumn("ReceiveCount", NScheme::NTypeIds::Uint32),
+ TColumn("SentTimestamp", NScheme::NTypeIds::Uint64),
TColumn("VisibilityDeadline", NScheme::NTypeIds::Uint64),
TColumn("DelayDeadline", NScheme::NTypeIds::Uint64)};
-
- const TVector<TColumn> SentTimestampIdxColumns = {
- TColumn("SentTimestamp", NScheme::NTypeIds::Uint64, true),
- TColumn("Offset", NScheme::NTypeIds::Uint64, true),
- TColumn("RandomId", NScheme::NTypeIds::Uint64),
- TColumn("DelayDeadline", NScheme::NTypeIds::Uint64)};
-
- TVector<TTable> list;
+
+ const TVector<TColumn> SentTimestampIdxColumns = {
+ TColumn("SentTimestamp", NScheme::NTypeIds::Uint64, true),
+ TColumn("Offset", NScheme::NTypeIds::Uint64, true),
+ TColumn("RandomId", NScheme::NTypeIds::Uint64),
+ TColumn("DelayDeadline", NScheme::NTypeIds::Uint64)};
+
+ TVector<TTable> list;
list.reserve(2 + 4 * shards);
-
- list.push_back(TTable("Attributes")
- .SetColumns(AttributesColumns)
- .SetSmall(true)
- .SetInMemory(true)
+
+ list.push_back(TTable("Attributes")
+ .SetColumns(AttributesColumns)
+ .SetSmall(true)
+ .SetInMemory(true)
.SetShard(-1)
.SetHasLeaderTablet());
- list.push_back(TTable("State")
- .SetColumns(StateColumns)
- .SetSmall(true)
+ list.push_back(TTable("State")
+ .SetColumns(StateColumns)
+ .SetSmall(true)
.SetOnePartitionPerShard(true)
- .SetInMemory(true)
- .SetShard(-1));
-
- for (ui64 i = 0; i < shards; ++i) {
- list.push_back(TTable("MessageData")
+ .SetInMemory(true)
+ .SetShard(-1));
+
+ for (ui64 i = 0; i < shards; ++i) {
+ list.push_back(TTable("MessageData")
.SetColumns(MessagesDataColumns)
.SetSequential(true)
.SetShard(i)
.SetAutosplit(enableAutosplit, sizeToSplit));
- list.push_back(TTable("Messages")
+ list.push_back(TTable("Messages")
.SetColumns(MessagesColumns)
.SetSequential(true)
.SetShard(i));
- list.push_back(TTable("Infly")
+ list.push_back(TTable("Infly")
.SetColumns(InflyColumns)
.SetSmall(true)
.SetInMemory(true)
.SetShard(i));
- list.push_back(TTable("SentTimestampIdx")
+ list.push_back(TTable("SentTimestampIdx")
.SetColumns(SentTimestampIdxColumns)
.SetSequential(true)
.SetShard(i));
- }
-
- return list;
-}
-
-TVector<TTable> GetStandardTableNames(ui64 shards) {
- TVector<TTable> list;
+ }
+
+ return list;
+}
+
+TVector<TTable> GetStandardTableNames(ui64 shards) {
+ TVector<TTable> list;
list.reserve(2 + 4 * shards);
-
- list.push_back(TTable("Attributes").SetShard(-1));
- list.push_back(TTable("State").SetShard(-1));
-
- for (ui64 i = 0; i < shards; ++i) {
- list.push_back(TTable("MessageData").SetShard(i));
- list.push_back(TTable("Messages").SetShard(i));
- list.push_back(TTable("Infly").SetShard(i));
- list.push_back(TTable("SentTimestampIdx").SetShard(i));
- }
-
- return list;
-}
-
+
+ list.push_back(TTable("Attributes").SetShard(-1));
+ list.push_back(TTable("State").SetShard(-1));
+
+ for (ui64 i = 0; i < shards; ++i) {
+ list.push_back(TTable("MessageData").SetShard(i));
+ list.push_back(TTable("Messages").SetShard(i));
+ list.push_back(TTable("Infly").SetShard(i));
+ list.push_back(TTable("SentTimestampIdx").SetShard(i));
+ }
+
+ return list;
+}
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/queues/std/schema.h b/ydb/core/ymq/queues/std/schema.h
index 7358490ca8..f9694fe3f4 100644
--- a/ydb/core/ymq/queues/std/schema.h
+++ b/ydb/core/ymq/queues/std/schema.h
@@ -1,11 +1,11 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/ymq/base/table_info.h>
-
+
namespace NKikimr::NSQS {
-
+
TVector<TTable> GetStandardTables(ui64 shards, ui64 partitions, bool enableAutosplit, ui64 sizeToSplit);
-
-TVector<TTable> GetStandardTableNames(ui64 shards);
-
+
+TVector<TTable> GetStandardTableNames(ui64 shards);
+
} // namespace NKikimr::NSQS
diff --git a/ydb/core/ymq/queues/std/ya.make b/ydb/core/ymq/queues/std/ya.make
index 770b3147a9..8edd9ab276 100644
--- a/ydb/core/ymq/queues/std/ya.make
+++ b/ydb/core/ymq/queues/std/ya.make
@@ -3,15 +3,15 @@ OWNER(
g:sqs
)
-LIBRARY()
-
-SRCS(
- queries.cpp
- schema.cpp
-)
-
-PEERDIR(
+LIBRARY()
+
+SRCS(
+ queries.cpp
+ schema.cpp
+)
+
+PEERDIR(
ydb/core/ymq/base
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/ymq/queues/ya.make b/ydb/core/ymq/queues/ya.make
index fe960b5c98..5907f377ca 100644
--- a/ydb/core/ymq/queues/ya.make
+++ b/ydb/core/ymq/queues/ya.make
@@ -3,8 +3,8 @@ OWNER(
g:sqs
)
-RECURSE(
+RECURSE(
common
- fifo
- std
-)
+ fifo
+ std
+)
diff --git a/ydb/core/ymq/ut/params_ut.cpp b/ydb/core/ymq/ut/params_ut.cpp
index 8cc3aae9ef..e150efff7e 100644
--- a/ydb/core/ymq/ut/params_ut.cpp
+++ b/ydb/core/ymq/ut/params_ut.cpp
@@ -1,79 +1,79 @@
#include <library/cpp/testing/unittest/registar.h>
#include <ydb/library/http_proxy/error/error.h>
#include <ydb/core/ymq/http/params.h>
-
-using namespace NKikimr::NSQS;
-
+
+using namespace NKikimr::NSQS;
+
Y_UNIT_TEST_SUITE(TParseParamsTests) {
Y_UNIT_TEST(CreateUser) {
- TParameters params;
- TParametersParser parser(&params);
- parser.Append("Action", "CreateUser");
- parser.Append("UserName", "test");
- parser.Append("Attribute.1.Name", "DelaySeconds");
- parser.Append("Attribute.1.Value", "1");
-
- UNIT_ASSERT_EQUAL(params.Action, "CreateUser");
- UNIT_ASSERT_EQUAL(params.UserName, "test");
-
- UNIT_ASSERT_EQUAL(params.Attributes[1].GetName(), "DelaySeconds");
- UNIT_ASSERT_EQUAL(params.Attributes[1].GetValue(), "1");
- }
-
+ TParameters params;
+ TParametersParser parser(&params);
+ parser.Append("Action", "CreateUser");
+ parser.Append("UserName", "test");
+ parser.Append("Attribute.1.Name", "DelaySeconds");
+ parser.Append("Attribute.1.Value", "1");
+
+ UNIT_ASSERT_EQUAL(params.Action, "CreateUser");
+ UNIT_ASSERT_EQUAL(params.UserName, "test");
+
+ UNIT_ASSERT_EQUAL(params.Attributes[1].GetName(), "DelaySeconds");
+ UNIT_ASSERT_EQUAL(params.Attributes[1].GetValue(), "1");
+ }
+
Y_UNIT_TEST(ChangeMessageVisibilityBatchRequest) {
- TParameters params;
- TParametersParser parser(&params);
- parser.Append("ChangeMessageVisibilityBatchRequestEntry.2.ReceiptHandle", "batch message 2");
- parser.Append("ChangeMessageVisibilityBatchRequestEntry.1.VisibilityTimeout", "10");
- parser.Append("Action", "ChangeMessageVisibilityBatch");
- parser.Append("ChangeMessageVisibilityBatchRequestEntry.2.VisibilityTimeout", "20");
- parser.Append("ChangeMessageVisibilityBatchRequestEntry.1.ReceiptHandle", "batch message 1");
- parser.Append("SendMessageBatchRequestEntry.2.Id", "Y");
-
- UNIT_ASSERT_EQUAL(params.Action, "ChangeMessageVisibilityBatch");
- UNIT_ASSERT_EQUAL(params.BatchEntries.size(), 2);
+ TParameters params;
+ TParametersParser parser(&params);
+ parser.Append("ChangeMessageVisibilityBatchRequestEntry.2.ReceiptHandle", "batch message 2");
+ parser.Append("ChangeMessageVisibilityBatchRequestEntry.1.VisibilityTimeout", "10");
+ parser.Append("Action", "ChangeMessageVisibilityBatch");
+ parser.Append("ChangeMessageVisibilityBatchRequestEntry.2.VisibilityTimeout", "20");
+ parser.Append("ChangeMessageVisibilityBatchRequestEntry.1.ReceiptHandle", "batch message 1");
+ parser.Append("SendMessageBatchRequestEntry.2.Id", "Y");
+
+ UNIT_ASSERT_EQUAL(params.Action, "ChangeMessageVisibilityBatch");
+ UNIT_ASSERT_EQUAL(params.BatchEntries.size(), 2);
UNIT_ASSERT_EQUAL(*params.BatchEntries[1].VisibilityTimeout, 10);
UNIT_ASSERT_EQUAL(*params.BatchEntries[2].VisibilityTimeout, 20);
- UNIT_ASSERT_EQUAL(params.BatchEntries[1].ReceiptHandle, "batch message 1");
- UNIT_ASSERT_EQUAL(params.BatchEntries[2].ReceiptHandle, "batch message 2");
- UNIT_ASSERT_EQUAL(params.BatchEntries[2].Id, "Y");
- }
-
+ UNIT_ASSERT_EQUAL(params.BatchEntries[1].ReceiptHandle, "batch message 1");
+ UNIT_ASSERT_EQUAL(params.BatchEntries[2].ReceiptHandle, "batch message 2");
+ UNIT_ASSERT_EQUAL(params.BatchEntries[2].Id, "Y");
+ }
+
Y_UNIT_TEST(DeleteMessageBatchRequest) {
- TParameters params;
- TParametersParser parser(&params);
- parser.Append("DeleteMessageBatchRequestEntry.2.ReceiptHandle", "batch message 2");
- parser.Append("Action", "DeleteMessageBatch");
- parser.Append("DeleteMessageBatchRequestEntry.1.ReceiptHandle", "batch message 1");
- parser.Append("SendMessageBatchRequestEntry.2.Id", "Y");
-
- UNIT_ASSERT_EQUAL(params.Action, "DeleteMessageBatch");
- UNIT_ASSERT_EQUAL(params.BatchEntries.size(), 2);
- UNIT_ASSERT_EQUAL(params.BatchEntries[1].ReceiptHandle, "batch message 1");
- UNIT_ASSERT_EQUAL(params.BatchEntries[2].ReceiptHandle, "batch message 2");
- UNIT_ASSERT_EQUAL(params.BatchEntries[2].Id, "Y");
- }
-
+ TParameters params;
+ TParametersParser parser(&params);
+ parser.Append("DeleteMessageBatchRequestEntry.2.ReceiptHandle", "batch message 2");
+ parser.Append("Action", "DeleteMessageBatch");
+ parser.Append("DeleteMessageBatchRequestEntry.1.ReceiptHandle", "batch message 1");
+ parser.Append("SendMessageBatchRequestEntry.2.Id", "Y");
+
+ UNIT_ASSERT_EQUAL(params.Action, "DeleteMessageBatch");
+ UNIT_ASSERT_EQUAL(params.BatchEntries.size(), 2);
+ UNIT_ASSERT_EQUAL(params.BatchEntries[1].ReceiptHandle, "batch message 1");
+ UNIT_ASSERT_EQUAL(params.BatchEntries[2].ReceiptHandle, "batch message 2");
+ UNIT_ASSERT_EQUAL(params.BatchEntries[2].Id, "Y");
+ }
+
Y_UNIT_TEST(MessageBody) {
- TParameters params;
- TParametersParser parser(&params);
- parser.Append("Action", "SendMessage");
- parser.Append("MessageBody", "test");
- parser.Append("Attribute.1.Name", "DelaySeconds");
- parser.Append("Attribute.1.Value", "1");
- parser.Append("MessageAttribute.3.Name", "MyAttr");
- parser.Append("MessageAttribute.3.Value.StringValue", "test attr");
- parser.Append("MessageAttribute.3.Value.DataType", "string");
+ TParameters params;
+ TParametersParser parser(&params);
+ parser.Append("Action", "SendMessage");
+ parser.Append("MessageBody", "test");
+ parser.Append("Attribute.1.Name", "DelaySeconds");
+ parser.Append("Attribute.1.Value", "1");
+ parser.Append("MessageAttribute.3.Name", "MyAttr");
+ parser.Append("MessageAttribute.3.Value.StringValue", "test attr");
+ parser.Append("MessageAttribute.3.Value.DataType", "string");
parser.Append("MessageAttribute.5.Name", "MyBinaryAttr");
parser.Append("MessageAttribute.5.Value.BinaryValue", "YmluYXJ5X2RhdGE=");
parser.Append("MessageAttribute.5.Value.DataType", "Binary");
-
- UNIT_ASSERT_EQUAL(params.Action, "SendMessage");
- UNIT_ASSERT_EQUAL(params.MessageBody, "test");
-
- UNIT_ASSERT_EQUAL(params.Attributes[1].GetName(), "DelaySeconds");
- UNIT_ASSERT_EQUAL(params.Attributes[1].GetValue(), "1");
-
+
+ UNIT_ASSERT_EQUAL(params.Action, "SendMessage");
+ UNIT_ASSERT_EQUAL(params.MessageBody, "test");
+
+ UNIT_ASSERT_EQUAL(params.Attributes[1].GetName(), "DelaySeconds");
+ UNIT_ASSERT_EQUAL(params.Attributes[1].GetValue(), "1");
+
UNIT_ASSERT_VALUES_EQUAL(params.MessageAttributes.size(), 2);
UNIT_ASSERT_STRINGS_EQUAL(params.MessageAttributes[3].GetName(), "MyAttr");
UNIT_ASSERT_STRINGS_EQUAL(params.MessageAttributes[3].GetStringValue(), "test attr");
@@ -81,32 +81,32 @@ Y_UNIT_TEST_SUITE(TParseParamsTests) {
UNIT_ASSERT_STRINGS_EQUAL(params.MessageAttributes[5].GetName(), "MyBinaryAttr");
UNIT_ASSERT_STRINGS_EQUAL(params.MessageAttributes[5].GetBinaryValue(), "binary_data");
UNIT_ASSERT_STRINGS_EQUAL(params.MessageAttributes[5].GetDataType(), "Binary");
- }
-
+ }
+
Y_UNIT_TEST(SendMessageBatchRequest) {
- TParameters params;
- TParametersParser parser(&params);
- parser.Append("SendMessageBatchRequestEntry.2.MessageBody", "batch message 2");
- parser.Append("SendMessageBatchRequestEntry.1.MessageGroupId", "1");
- parser.Append("SendMessageBatchRequestEntry.2.MessageGroupId", "2");
- parser.Append("SendMessageBatchRequestEntry.1.MessageBody", "batch message 1");
- parser.Append("Version", "2012-11-05");
- parser.Append("SendMessageBatchRequestEntry.2.MessageDeduplicationId", "b2");
- parser.Append("SendMessageBatchRequestEntry.1.MessageDeduplicationId", "b1");
- parser.Append("Action", "SendMessageBatch");
- parser.Append("SendMessageBatchRequestEntry.1.Id", "1");
- parser.Append("SendMessageBatchRequestEntry.2.Id", "Y");
- parser.Append("SendMessageBatchRequestEntry.2.MessageAttribute.1.Value.DataType", "string");
-
- UNIT_ASSERT_EQUAL(params.Action, "SendMessageBatch");
- UNIT_ASSERT_EQUAL(params.BatchEntries.size(), 2);
- UNIT_ASSERT_EQUAL(params.BatchEntries[1].Id, "1");
- UNIT_ASSERT_EQUAL(params.BatchEntries[2].Id, "Y");
- UNIT_ASSERT_EQUAL(params.BatchEntries[1].MessageBody, "batch message 1");
- UNIT_ASSERT_EQUAL(params.BatchEntries[2].MessageBody, "batch message 2");
- UNIT_ASSERT_EQUAL(params.BatchEntries[2].MessageAttributes[1].GetDataType(), "string");
- }
-
+ TParameters params;
+ TParametersParser parser(&params);
+ parser.Append("SendMessageBatchRequestEntry.2.MessageBody", "batch message 2");
+ parser.Append("SendMessageBatchRequestEntry.1.MessageGroupId", "1");
+ parser.Append("SendMessageBatchRequestEntry.2.MessageGroupId", "2");
+ parser.Append("SendMessageBatchRequestEntry.1.MessageBody", "batch message 1");
+ parser.Append("Version", "2012-11-05");
+ parser.Append("SendMessageBatchRequestEntry.2.MessageDeduplicationId", "b2");
+ parser.Append("SendMessageBatchRequestEntry.1.MessageDeduplicationId", "b1");
+ parser.Append("Action", "SendMessageBatch");
+ parser.Append("SendMessageBatchRequestEntry.1.Id", "1");
+ parser.Append("SendMessageBatchRequestEntry.2.Id", "Y");
+ parser.Append("SendMessageBatchRequestEntry.2.MessageAttribute.1.Value.DataType", "string");
+
+ UNIT_ASSERT_EQUAL(params.Action, "SendMessageBatch");
+ UNIT_ASSERT_EQUAL(params.BatchEntries.size(), 2);
+ UNIT_ASSERT_EQUAL(params.BatchEntries[1].Id, "1");
+ UNIT_ASSERT_EQUAL(params.BatchEntries[2].Id, "Y");
+ UNIT_ASSERT_EQUAL(params.BatchEntries[1].MessageBody, "batch message 1");
+ UNIT_ASSERT_EQUAL(params.BatchEntries[2].MessageBody, "batch message 2");
+ UNIT_ASSERT_EQUAL(params.BatchEntries[2].MessageAttributes[1].GetDataType(), "string");
+ }
+
Y_UNIT_TEST(DeleteQueueBatchRequest) {
TParameters params;
TParametersParser parser(&params);
@@ -141,24 +141,24 @@ Y_UNIT_TEST_SUITE(TParseParamsTests) {
}
Y_UNIT_TEST(UnnumberedAttribute) {
- TParameters params;
- TParametersParser parser(&params);
- parser.Append("Attribute.Name", "DelaySeconds");
- parser.Append("Attribute.Value", "1");
-
- UNIT_ASSERT_EQUAL(params.Attributes.size(), 1);
- UNIT_ASSERT_EQUAL(params.Attributes[1].GetName(), "DelaySeconds");
- UNIT_ASSERT_EQUAL(params.Attributes[1].GetValue(), "1");
- }
-
+ TParameters params;
+ TParametersParser parser(&params);
+ parser.Append("Attribute.Name", "DelaySeconds");
+ parser.Append("Attribute.Value", "1");
+
+ UNIT_ASSERT_EQUAL(params.Attributes.size(), 1);
+ UNIT_ASSERT_EQUAL(params.Attributes[1].GetName(), "DelaySeconds");
+ UNIT_ASSERT_EQUAL(params.Attributes[1].GetValue(), "1");
+ }
+
Y_UNIT_TEST(UnnumberedAttributeName) {
- TParameters params;
- TParametersParser parser(&params);
- parser.Append("AttributeName", "All");
-
- UNIT_ASSERT_EQUAL(params.AttributeNames.size(), 1);
- UNIT_ASSERT_EQUAL(params.AttributeNames[1], "All");
- }
+ TParameters params;
+ TParametersParser parser(&params);
+ parser.Append("AttributeName", "All");
+
+ UNIT_ASSERT_EQUAL(params.AttributeNames.size(), 1);
+ UNIT_ASSERT_EQUAL(params.AttributeNames[1], "All");
+ }
Y_UNIT_TEST(FailsOnInvalidDeduplicationId) {
TParameters params;
@@ -201,4 +201,4 @@ Y_UNIT_TEST_SUITE(TParseParamsTests) {
UNIT_CHECK_GENERATED_EXCEPTION(parser.Append("SendMessageBatchRequestEntry.2.DelaySeconds", "1.0"), TSQSException);
UNIT_CHECK_GENERATED_EXCEPTION(parser.Append("DelaySeconds", "1+3"), TSQSException);
}
-}
+}
diff --git a/ydb/core/ymq/ut/ya.make b/ydb/core/ymq/ut/ya.make
index 27db5cd822..cf5482ae85 100644
--- a/ydb/core/ymq/ut/ya.make
+++ b/ydb/core/ymq/ut/ya.make
@@ -3,17 +3,17 @@ OWNER(
g:sqs
)
-UNITTEST()
-
-SRCS(
+UNITTEST()
+
+SRCS(
queue_id_ut.cpp
- params_ut.cpp
-)
-
-PEERDIR(
+ params_ut.cpp
+)
+
+PEERDIR(
ydb/core/ymq/base
ydb/core/ymq/http
ydb/library/http_proxy/error
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/ymq/ya.make b/ydb/core/ymq/ya.make
index 341606be22..e6e3f8b52e 100644
--- a/ydb/core/ymq/ya.make
+++ b/ydb/core/ymq/ya.make
@@ -3,15 +3,15 @@ OWNER(
g:sqs
)
-RECURSE(
- actor
- base
- client
- http
- queues
+RECURSE(
+ actor
+ base
+ client
+ http
+ queues
proto
)
RECURSE_FOR_TESTS(
ut
-)
+)
diff --git a/ydb/public/lib/base/msgbus.h b/ydb/public/lib/base/msgbus.h
index f11bd9771f..72599eb292 100644
--- a/ydb/public/lib/base/msgbus.h
+++ b/ydb/public/lib/base/msgbus.h
@@ -77,8 +77,8 @@ enum {
MTYPE_CLIENT_CMS_RESPONSE = 10466,
MTYPE_CLIENT_RESOURCE_BROKER_SET_CONFIG = 10467,
MTYPE_CLIENT_CHOOSE_PROXY = 10468,
- MTYPE_CLIENT_SQS_REQUEST = 10469,
- MTYPE_CLIENT_SQS_RESPONSE = 10470,
+ MTYPE_CLIENT_SQS_REQUEST = 10469,
+ MTYPE_CLIENT_SQS_RESPONSE = 10470,
MTYPE_CLIENT_WHOAMI = 10471,
MTYPE_CLIENT_STREAM_REQUEST = 10472,
MTYPE_CLIENT_S3_LISTING_REQUEST = 10474,
@@ -141,8 +141,8 @@ struct TBusNodeRegistrationResponse : TBusMessage<TBusNodeRegistrationResponse,
struct TBusCmsRequest : TBusMessage<TBusCmsRequest, NKikimrClient::TCmsRequest, MTYPE_CLIENT_CMS_REQUEST> {};
struct TBusCmsResponse : TBusMessage<TBusCmsResponse, NKikimrClient::TCmsResponse, MTYPE_CLIENT_CMS_RESPONSE> {};
struct TBusChooseProxy : TBusMessage<TBusChooseProxy, NKikimrClient::TChooseProxyRequest, MTYPE_CLIENT_CHOOSE_PROXY> {};
-struct TBusSqsRequest : TBusMessage<TBusSqsRequest, NKikimrClient::TSqsRequest, MTYPE_CLIENT_SQS_REQUEST> {};
-struct TBusSqsResponse : TBusMessage<TBusSqsResponse, NKikimrClient::TSqsResponse, MTYPE_CLIENT_SQS_RESPONSE> {};
+struct TBusSqsRequest : TBusMessage<TBusSqsRequest, NKikimrClient::TSqsRequest, MTYPE_CLIENT_SQS_REQUEST> {};
+struct TBusSqsResponse : TBusMessage<TBusSqsResponse, NKikimrClient::TSqsResponse, MTYPE_CLIENT_SQS_RESPONSE> {};
struct TBusWhoAmI : TBusMessage<TBusWhoAmI, NKikimrClient::TWhoAmI, MTYPE_CLIENT_WHOAMI> {};
struct TBusStreamRequest : TBusMessage<TBusStreamRequest, NKikimrClient::TRequest, MTYPE_CLIENT_STREAM_REQUEST> {};
struct TBusS3ListingRequest : TBusMessage<TBusS3ListingRequest, NKikimrClient::TS3ListingRequest, MTYPE_CLIENT_S3_LISTING_REQUEST> {};
diff --git a/ydb/public/lib/deprecated/client/grpc_client.cpp b/ydb/public/lib/deprecated/client/grpc_client.cpp
index dbf808ef75..222edb786f 100644
--- a/ydb/public/lib/deprecated/client/grpc_client.cpp
+++ b/ydb/public/lib/deprecated/client/grpc_client.cpp
@@ -330,7 +330,7 @@ namespace NKikimr {
IMPL_REQUEST(KeyValue, TKeyValueRequest, TResponse)
IMPL_REQUEST(RegisterNode, TNodeRegistrationRequest, TNodeRegistrationResponse)
IMPL_REQUEST(CmsRequest, TCmsRequest, TCmsResponse)
- IMPL_REQUEST(SqsRequest, TSqsRequest, TSqsResponse)
+ IMPL_REQUEST(SqsRequest, TSqsRequest, TSqsResponse)
IMPL_REQUEST(S3Listing, TS3ListingRequest, TS3ListingResponse)
IMPL_REQUEST(LocalMKQL, TLocalMKQL, TResponse)
IMPL_REQUEST(LocalSchemeTx, TLocalSchemeTx, TResponse)
diff --git a/ydb/public/lib/deprecated/client/grpc_client.h b/ydb/public/lib/deprecated/client/grpc_client.h
index b0483a2646..69191f56e4 100644
--- a/ydb/public/lib/deprecated/client/grpc_client.h
+++ b/ydb/public/lib/deprecated/client/grpc_client.h
@@ -22,7 +22,7 @@ namespace NKikimr {
using TJSONCallback = TCallback<NKikimrClient::TJSON>;
using TNodeRegistrationResponseCallback = TCallback<NKikimrClient::TNodeRegistrationResponse>;
using TCmsResponseCallback = TCallback<NKikimrClient::TCmsResponse>;
- using TSqsResponseCallback = TCallback<NKikimrClient::TSqsResponse>;
+ using TSqsResponseCallback = TCallback<NKikimrClient::TSqsResponse>;
using TS3ListingResponseCallback = TCallback<NKikimrClient::TS3ListingResponse>;
using TConsoleResponseCallback = TCallback<NKikimrClient::TConsoleResponse>;
@@ -86,11 +86,11 @@ namespace NKikimr {
void CmsRequest(const NKikimrClient::TCmsRequest& request, TCmsResponseCallback callback);
/////////////////////////////////////////////////////////////////////////////////////////////////
- // SQS INTERFACE
- /////////////////////////////////////////////////////////////////////////////////////////////////
- void SqsRequest(const NKikimrClient::TSqsRequest& request, TSqsResponseCallback callback);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
+ // SQS INTERFACE
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ void SqsRequest(const NKikimrClient::TSqsRequest& request, TSqsResponseCallback callback);
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////
// S3 LISTING INTERFACE
/////////////////////////////////////////////////////////////////////////////////////////////////
void S3Listing(const NKikimrClient::TS3ListingRequest& request, TS3ListingResponseCallback callback);
diff --git a/ydb/public/lib/deprecated/kicli/kicli.h b/ydb/public/lib/deprecated/kicli/kicli.h
index 9dc472d231..a16432d97a 100644
--- a/ydb/public/lib/deprecated/kicli/kicli.h
+++ b/ydb/public/lib/deprecated/kicli/kicli.h
@@ -450,7 +450,7 @@ class TTextQuery : public TQuery {
public:
TTextQuery(TTextQuery&&) = default;
TTextQuery& operator = (TTextQuery&&) = default;
- TTextQuery(const TTextQuery&) = delete;
+ TTextQuery(const TTextQuery&) = delete;
TTextQuery& operator = (const TTextQuery&) = delete;
// prepare query using round-trip to server
diff --git a/ydb/public/lib/deprecated/kicli/kikimr.cpp b/ydb/public/lib/deprecated/kicli/kikimr.cpp
index 4156d72d4b..2ce06ea233 100644
--- a/ydb/public/lib/deprecated/kicli/kikimr.cpp
+++ b/ydb/public/lib/deprecated/kicli/kikimr.cpp
@@ -275,8 +275,8 @@ public:
return ExecuteGRpcRequest<NMsgBusProxy::TBusCmsRequest, NMsgBusProxy::TBusCmsResponse>(&NGRpcProxy::TGRpcClient::CmsRequest, promise, request);
case NMsgBusProxy::MTYPE_CLIENT_CHOOSE_PROXY:
return ExecuteGRpcRequest<NMsgBusProxy::TBusChooseProxy>(&NGRpcProxy::TGRpcClient::ChooseProxy, promise, request);
- case NMsgBusProxy::MTYPE_CLIENT_SQS_REQUEST:
- return ExecuteGRpcRequest<NMsgBusProxy::TBusSqsRequest, NMsgBusProxy::TBusSqsResponse>(&NGRpcProxy::TGRpcClient::SqsRequest, promise, request);
+ case NMsgBusProxy::MTYPE_CLIENT_SQS_REQUEST:
+ return ExecuteGRpcRequest<NMsgBusProxy::TBusSqsRequest, NMsgBusProxy::TBusSqsResponse>(&NGRpcProxy::TGRpcClient::SqsRequest, promise, request);
case NMsgBusProxy::MTYPE_CLIENT_S3_LISTING_REQUEST:
return ExecuteGRpcRequest<NMsgBusProxy::TBusS3ListingRequest, NMsgBusProxy::TBusS3ListingResponse>(&NGRpcProxy::TGRpcClient::S3Listing, promise, request);
case NMsgBusProxy::MTYPE_CLIENT_INTERCONNECT_DEBUG:
@@ -494,7 +494,7 @@ NThreading::TFuture<TPrepareResult> TKikimr::PrepareQuery(const TTextQuery& quer
mkqlTx->SetMode(NKikimrTxUserProxy::TMiniKQLTransaction::COMPILE);
mkqlTx->MutableProgram()->SetText(query.TextProgram);
auto future = ExecuteRequest(request.Release());
- return future.Apply([&query](const NThreading::TFuture<TResult>& result) -> TPrepareResult {
+ return future.Apply([&query](const NThreading::TFuture<TResult>& result) -> TPrepareResult {
return TPrepareResult(result.GetValue(TDuration::Max()), query);
});
}
diff --git a/ydb/public/lib/value/value.cpp b/ydb/public/lib/value/value.cpp
index 0ed8b82689..7e54f091bf 100644
--- a/ydb/public/lib/value/value.cpp
+++ b/ydb/public/lib/value/value.cpp
@@ -1,13 +1,13 @@
-#include "value.h"
-
+#include "value.h"
+
#include <ydb/library/yql/public/decimal/yql_decimal.h>
#include <library/cpp/string_utils/base64/base64.h>
-#include <util/charset/utf8.h>
-#include <util/string/cast.h>
+#include <util/charset/utf8.h>
+#include <util/string/cast.h>
#include <util/string/escape.h>
-#include <util/string/printf.h>
+#include <util/string/printf.h>
namespace NKikimr {
namespace NClient {
@@ -23,10 +23,10 @@ TValue TValue::Create(const NKikimrMiniKQL::TValue& value, const NKikimrMiniKQL:
return TValue(const_cast<NKikimrMiniKQL::TValue&>(value), const_cast<NKikimrMiniKQL::TType&>(type));
}
-TValue TValue::Create(const NKikimrMiniKQL::TResult& result) {
- return TValue::Create(result.GetValue(), result.GetType());
-}
-
+TValue TValue::Create(const NKikimrMiniKQL::TResult& result) {
+ return TValue::Create(result.GetValue(), result.GetType());
+}
+
bool TValue::HaveValue() const {
return !IsNull();
}
@@ -38,24 +38,24 @@ bool TValue::IsNull() const {
}
TValue TValue::operator [](const char* name) const {
- return this->operator [](TStringBuf(name));
-}
-
-int TValue::GetMemberIndex(TStringBuf name) const {
- // TODO: add support for Dict
- Y_ASSERT(Type.HasStruct());
- const auto& structField = Type.GetStruct();
- size_t size = structField.MemberSize();
- for (size_t n = 0; n < size; ++n) {
- const auto& memberField = structField.GetMember(n);
- if (memberField.GetName() == name) {
- return n;
- }
- }
- ythrow yexception() << "Unknown Struct member name: " << name;
-}
-
-TValue TValue::operator [](const TStringBuf name) const {
+ return this->operator [](TStringBuf(name));
+}
+
+int TValue::GetMemberIndex(TStringBuf name) const {
+ // TODO: add support for Dict
+ Y_ASSERT(Type.HasStruct());
+ const auto& structField = Type.GetStruct();
+ size_t size = structField.MemberSize();
+ for (size_t n = 0; n < size; ++n) {
+ const auto& memberField = structField.GetMember(n);
+ if (memberField.GetName() == name) {
+ return n;
+ }
+ }
+ ythrow yexception() << "Unknown Struct member name: " << name;
+}
+
+TValue TValue::operator [](const TStringBuf name) const {
// TODO: add support for Dict
Y_ASSERT(Type.HasStruct());
const auto& structField = Type.GetStruct();
@@ -116,10 +116,10 @@ TWriteValue::TWriteValue(NKikimrMiniKQL::TValue& value, NKikimrMiniKQL::TType& t
{}
TWriteValue TWriteValue::operator [](const char* name) {
- return this->operator [](TStringBuf(name));
-}
-
-TWriteValue TWriteValue::operator [](const TStringBuf name) {
+ return this->operator [](TStringBuf(name));
+}
+
+TWriteValue TWriteValue::operator [](const TStringBuf name) {
Y_ASSERT(!Type.HasList() && !Type.HasTuple() && !Type.HasDict());
Type.SetKind(NKikimrMiniKQL::ETypeKind::Struct);
auto& structField = *Type.MutableStruct();
@@ -138,7 +138,7 @@ TWriteValue TWriteValue::operator [](const TStringBuf name) {
}
}
auto& memberField = *structField.AddMember();
- memberField.SetName(TString(name));
+ memberField.SetName(TString(name));
return TWriteValue::Create(*Value.AddStruct(), *memberField.MutableType());
}
diff --git a/ydb/public/lib/value/value.h b/ydb/public/lib/value/value.h
index 8ae368ac02..90ad161fd4 100644
--- a/ydb/public/lib/value/value.h
+++ b/ydb/public/lib/value/value.h
@@ -1,175 +1,175 @@
-#pragma once
-
+#pragma once
+
#include <ydb/library/mkql_proto/protos/minikql.pb.h>
#include <ydb/public/lib/scheme_types/scheme_type_id.h>
-
-#include <util/generic/vector.h>
+
+#include <util/generic/vector.h>
#include <util/string/builder.h>
-
+
#include <google/protobuf/text_format.h>
-
-namespace NKikimr {
-namespace NClient {
-
-template <typename ParameterType> struct SchemeMapper {};
-template <> struct SchemeMapper<ui32> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Uint32; };
-template <> struct SchemeMapper<i32> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Int32; };
-template <> struct SchemeMapper<ui64> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Uint64; };
-template <> struct SchemeMapper<i64> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Int64; };
-template <> struct SchemeMapper<TString> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Utf8; };
-template <> struct SchemeMapper<const char*> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Utf8; };
-template <> struct SchemeMapper<bool> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Bool; };
-template <> struct SchemeMapper<double> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Double; };
-template <> struct SchemeMapper<float> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Float; };
-
-template <NScheme::TTypeId SchemeType> struct ProtoMapper {};
-template <> struct ProtoMapper<NScheme::NTypeIds::Int32> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(i32) = &NKikimrMiniKQL::TValue::SetInt32; };
-template <> struct ProtoMapper<NScheme::NTypeIds::Uint32> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(ui32) = &NKikimrMiniKQL::TValue::SetUint32; };
-template <> struct ProtoMapper<NScheme::NTypeIds::Int64> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(i64) = &NKikimrMiniKQL::TValue::SetInt64; };
-template <> struct ProtoMapper<NScheme::NTypeIds::Uint64> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(ui64) = &NKikimrMiniKQL::TValue::SetUint64; };
-template <> struct ProtoMapper<NScheme::NTypeIds::Utf8> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(const TString&) = &NKikimrMiniKQL::TValue::SetText; };
-template <> struct ProtoMapper<NScheme::NTypeIds::String> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(const TString&) = &NKikimrMiniKQL::TValue::SetBytes; };
-template <> struct ProtoMapper<NScheme::NTypeIds::String4k> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(const TString&) = &NKikimrMiniKQL::TValue::SetBytes; };
-template <> struct ProtoMapper<NScheme::NTypeIds::String2m> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(const TString&) = &NKikimrMiniKQL::TValue::SetBytes; };
-template <> struct ProtoMapper<NScheme::NTypeIds::Bool> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(bool) = &NKikimrMiniKQL::TValue::SetBool; };
-template <> struct ProtoMapper<NScheme::NTypeIds::Double> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(double) = &NKikimrMiniKQL::TValue::SetDouble; };
-template <> struct ProtoMapper<NScheme::NTypeIds::Float> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(float) = &NKikimrMiniKQL::TValue::SetFloat; };
-
-template <typename ValueType, NScheme::TTypeId SchemeType = SchemeMapper<ValueType>::SchemeType>
-class TDataValue {
-public:
- ValueType Value;
-
- explicit TDataValue(ValueType value)
- : Value(value)
- {}
-
- static void StoreType(NKikimrMiniKQL::TType& type) {
- type.SetKind(NKikimrMiniKQL::ETypeKind::Data);
- type.MutableData()->SetScheme(SchemeType);
- }
-
- void StoreValue(NKikimrMiniKQL::TValue& value) const {
- (value.*ProtoMapper<SchemeType>::Setter)(Value);
- }
-};
-
-class TValue {
-public:
- // generic universal handler of result values of MiniKQL programs execution
- // it helps access to different values using short and intuitive syntax
- // for examples see cpp_ut.cpp
- static TValue Create(const NKikimrMiniKQL::TValue& value, const NKikimrMiniKQL::TType& type);
- static TValue Create(const NKikimrMiniKQL::TResult& result);
-
- // check for value existence (in optional)
- bool HaveValue() const;
- bool IsNull() const;
- // named indexer - for struct members and dictionaries
- TValue operator [](const char* name) const;
- TValue operator [](const TStringBuf name) const;
- // numeric indexer - for lists and tuples
- TValue operator [](int index) const;
- // accessors
- operator bool() const;
- operator ui8() const;
- operator i8() const;
- operator ui16() const;
- operator i16() const;
- operator ui64() const;
- operator i64() const;
- operator ui32() const;
- operator i32() const;
- operator double() const;
- operator float() const;
- operator TString() const;
- // returns size of container values (like list or tuple)
- size_t Size() const;
- // gets NScheme::NTypeIds enum value of 'Data' type
- NScheme::TTypeId GetDataType() const;
- // gets text representation of simple 'Data' types
- TString GetDataText() const;
- // returns text representation of value's type
- template <typename Format> TString GetTypeText(const Format& format = Format()) const;
- // returns text representation of value itself
- template <typename Format> TString GetValueText(const Format& format = Format()) const;
- // returns member name by index
- TString GetMemberName(int index) const;
- // returns all members
+
+namespace NKikimr {
+namespace NClient {
+
+template <typename ParameterType> struct SchemeMapper {};
+template <> struct SchemeMapper<ui32> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Uint32; };
+template <> struct SchemeMapper<i32> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Int32; };
+template <> struct SchemeMapper<ui64> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Uint64; };
+template <> struct SchemeMapper<i64> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Int64; };
+template <> struct SchemeMapper<TString> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Utf8; };
+template <> struct SchemeMapper<const char*> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Utf8; };
+template <> struct SchemeMapper<bool> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Bool; };
+template <> struct SchemeMapper<double> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Double; };
+template <> struct SchemeMapper<float> { static constexpr NScheme::TTypeId SchemeType = NScheme::NTypeIds::Float; };
+
+template <NScheme::TTypeId SchemeType> struct ProtoMapper {};
+template <> struct ProtoMapper<NScheme::NTypeIds::Int32> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(i32) = &NKikimrMiniKQL::TValue::SetInt32; };
+template <> struct ProtoMapper<NScheme::NTypeIds::Uint32> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(ui32) = &NKikimrMiniKQL::TValue::SetUint32; };
+template <> struct ProtoMapper<NScheme::NTypeIds::Int64> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(i64) = &NKikimrMiniKQL::TValue::SetInt64; };
+template <> struct ProtoMapper<NScheme::NTypeIds::Uint64> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(ui64) = &NKikimrMiniKQL::TValue::SetUint64; };
+template <> struct ProtoMapper<NScheme::NTypeIds::Utf8> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(const TString&) = &NKikimrMiniKQL::TValue::SetText; };
+template <> struct ProtoMapper<NScheme::NTypeIds::String> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(const TString&) = &NKikimrMiniKQL::TValue::SetBytes; };
+template <> struct ProtoMapper<NScheme::NTypeIds::String4k> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(const TString&) = &NKikimrMiniKQL::TValue::SetBytes; };
+template <> struct ProtoMapper<NScheme::NTypeIds::String2m> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(const TString&) = &NKikimrMiniKQL::TValue::SetBytes; };
+template <> struct ProtoMapper<NScheme::NTypeIds::Bool> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(bool) = &NKikimrMiniKQL::TValue::SetBool; };
+template <> struct ProtoMapper<NScheme::NTypeIds::Double> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(double) = &NKikimrMiniKQL::TValue::SetDouble; };
+template <> struct ProtoMapper<NScheme::NTypeIds::Float> { static constexpr void (NKikimrMiniKQL::TValue::* Setter)(float) = &NKikimrMiniKQL::TValue::SetFloat; };
+
+template <typename ValueType, NScheme::TTypeId SchemeType = SchemeMapper<ValueType>::SchemeType>
+class TDataValue {
+public:
+ ValueType Value;
+
+ explicit TDataValue(ValueType value)
+ : Value(value)
+ {}
+
+ static void StoreType(NKikimrMiniKQL::TType& type) {
+ type.SetKind(NKikimrMiniKQL::ETypeKind::Data);
+ type.MutableData()->SetScheme(SchemeType);
+ }
+
+ void StoreValue(NKikimrMiniKQL::TValue& value) const {
+ (value.*ProtoMapper<SchemeType>::Setter)(Value);
+ }
+};
+
+class TValue {
+public:
+ // generic universal handler of result values of MiniKQL programs execution
+ // it helps access to different values using short and intuitive syntax
+ // for examples see cpp_ut.cpp
+ static TValue Create(const NKikimrMiniKQL::TValue& value, const NKikimrMiniKQL::TType& type);
+ static TValue Create(const NKikimrMiniKQL::TResult& result);
+
+ // check for value existence (in optional)
+ bool HaveValue() const;
+ bool IsNull() const;
+ // named indexer - for struct members and dictionaries
+ TValue operator [](const char* name) const;
+ TValue operator [](const TStringBuf name) const;
+ // numeric indexer - for lists and tuples
+ TValue operator [](int index) const;
+ // accessors
+ operator bool() const;
+ operator ui8() const;
+ operator i8() const;
+ operator ui16() const;
+ operator i16() const;
+ operator ui64() const;
+ operator i64() const;
+ operator ui32() const;
+ operator i32() const;
+ operator double() const;
+ operator float() const;
+ operator TString() const;
+ // returns size of container values (like list or tuple)
+ size_t Size() const;
+ // gets NScheme::NTypeIds enum value of 'Data' type
+ NScheme::TTypeId GetDataType() const;
+ // gets text representation of simple 'Data' types
+ TString GetDataText() const;
+ // returns text representation of value's type
+ template <typename Format> TString GetTypeText(const Format& format = Format()) const;
+ // returns text representation of value itself
+ template <typename Format> TString GetValueText(const Format& format = Format()) const;
+ // returns member name by index
+ TString GetMemberName(int index) const;
+ // returns all members
TVector<TString> GetMembersNames() const;
- // returns member index by name
- int GetMemberIndex(TStringBuf name) const;
-
+ // returns member index by name
+ int GetMemberIndex(TStringBuf name) const;
+
TString DumpToString() const {
TStringBuilder dump;
- TString res;
- ::google::protobuf::TextFormat::PrintToString(Type, &res);
+ TString res;
+ ::google::protobuf::TextFormat::PrintToString(Type, &res);
dump << "Type:" << Endl << res << Endl;
- ::google::protobuf::TextFormat::PrintToString(Value, &res);
+ ::google::protobuf::TextFormat::PrintToString(Value, &res);
dump << "Value:" << Endl << res << Endl;
return std::move(dump);
- }
-
+ }
+
void DumpValue() const {
Cerr << DumpToString();
}
- const NKikimrMiniKQL::TType& GetType() const { return Type; };
- const NKikimrMiniKQL::TValue& GetValue() const { return Value; };
-
-protected:
- TValue(NKikimrMiniKQL::TValue& value, NKikimrMiniKQL::TType& type);
- TValue EatOptional() const;
-
- static const NKikimrMiniKQL::TValue Null;
- NKikimrMiniKQL::TType& Type;
- NKikimrMiniKQL::TValue& Value;
-};
-
-class TWriteValue : public TValue {
-public:
- static TWriteValue Create(NKikimrMiniKQL::TValue& value, NKikimrMiniKQL::TType& type);
- // named indexer - for struct members and dictionaries
- TWriteValue operator [](const char* name);
- TWriteValue operator [](const TStringBuf name);
- // numeric indexer - for lists and tuples
- TWriteValue operator [](int index);
- // accessors
- TWriteValue Optional();
- TWriteValue AddListItem();
- TWriteValue AddTupleItem();
- TWriteValue& Void();
- TWriteValue& Bytes(const char* value);
- TWriteValue& Bytes(const TString& value);
- TWriteValue& Yson(const char* value);
- TWriteValue& Yson(const TString& value);
- TWriteValue& Json(const char* value);
- TWriteValue& Json(const TString& value);
- TWriteValue& Date(ui16 value);
- TWriteValue& Datetime(ui32 value);
- TWriteValue& Timestamp(ui64 value);
- TWriteValue& Interval(i64 value);
- TWriteValue& operator =(bool value);
- TWriteValue& operator =(ui8 value);
- TWriteValue& operator =(i8 value);
- TWriteValue& operator =(ui16 value);
- TWriteValue& operator =(i16 value);
- TWriteValue& operator =(ui64 value);
- TWriteValue& operator =(i64 value);
- TWriteValue& operator =(ui32 value);
- TWriteValue& operator =(i32 value);
- TWriteValue& operator =(double value);
- TWriteValue& operator =(float value);
- TWriteValue& operator =(const char* value);
- TWriteValue& operator =(const TString& value);
- TWriteValue& operator =(const TValue& value);
-
- template <typename ParameterType, NScheme::TTypeId SchemeType = SchemeMapper<ParameterType>::SchemeType>
- TWriteValue& EmptyData() {
- TDataValue<ParameterType, SchemeType>::StoreType(Type);
- return *this;
- }
-
+ const NKikimrMiniKQL::TType& GetType() const { return Type; };
+ const NKikimrMiniKQL::TValue& GetValue() const { return Value; };
+
+protected:
+ TValue(NKikimrMiniKQL::TValue& value, NKikimrMiniKQL::TType& type);
+ TValue EatOptional() const;
+
+ static const NKikimrMiniKQL::TValue Null;
+ NKikimrMiniKQL::TType& Type;
+ NKikimrMiniKQL::TValue& Value;
+};
+
+class TWriteValue : public TValue {
+public:
+ static TWriteValue Create(NKikimrMiniKQL::TValue& value, NKikimrMiniKQL::TType& type);
+ // named indexer - for struct members and dictionaries
+ TWriteValue operator [](const char* name);
+ TWriteValue operator [](const TStringBuf name);
+ // numeric indexer - for lists and tuples
+ TWriteValue operator [](int index);
+ // accessors
+ TWriteValue Optional();
+ TWriteValue AddListItem();
+ TWriteValue AddTupleItem();
+ TWriteValue& Void();
+ TWriteValue& Bytes(const char* value);
+ TWriteValue& Bytes(const TString& value);
+ TWriteValue& Yson(const char* value);
+ TWriteValue& Yson(const TString& value);
+ TWriteValue& Json(const char* value);
+ TWriteValue& Json(const TString& value);
+ TWriteValue& Date(ui16 value);
+ TWriteValue& Datetime(ui32 value);
+ TWriteValue& Timestamp(ui64 value);
+ TWriteValue& Interval(i64 value);
+ TWriteValue& operator =(bool value);
+ TWriteValue& operator =(ui8 value);
+ TWriteValue& operator =(i8 value);
+ TWriteValue& operator =(ui16 value);
+ TWriteValue& operator =(i16 value);
+ TWriteValue& operator =(ui64 value);
+ TWriteValue& operator =(i64 value);
+ TWriteValue& operator =(ui32 value);
+ TWriteValue& operator =(i32 value);
+ TWriteValue& operator =(double value);
+ TWriteValue& operator =(float value);
+ TWriteValue& operator =(const char* value);
+ TWriteValue& operator =(const TString& value);
+ TWriteValue& operator =(const TValue& value);
+
+ template <typename ParameterType, NScheme::TTypeId SchemeType = SchemeMapper<ParameterType>::SchemeType>
+ TWriteValue& EmptyData() {
+ TDataValue<ParameterType, SchemeType>::StoreType(Type);
+ return *this;
+ }
+
template <typename ItemType, NScheme::TTypeId SchemeType = SchemeMapper<ItemType>::SchemeType>
TWriteValue& EmptyOptional() {
Type.SetKind(NKikimrMiniKQL::ETypeKind::Optional);
@@ -192,14 +192,14 @@ public:
return *this;
}
- ui32 GetValueBytesSize() const;
- ui32 GetTypeBytesSize() const;
- ui32 GetBytesSize() const;
-
-protected:
- TWriteValue(NKikimrMiniKQL::TValue& value, NKikimrMiniKQL::TType& type);
-};
-
+ ui32 GetValueBytesSize() const;
+ ui32 GetTypeBytesSize() const;
+ ui32 GetBytesSize() const;
+
+protected:
+ TWriteValue(NKikimrMiniKQL::TValue& value, NKikimrMiniKQL::TType& type);
+};
+
struct TFormatCxx {};
struct TFormatJSON {
@@ -218,12 +218,12 @@ struct TFormatCSV {
: Delim(delim)
, PrintHeader(printHeader)
{}
-
+
static TString EscapeString(const TString& s);
TString Delim;
bool PrintHeader;
};
-} // namespace NClient
-} // namespace NKikimr
+} // namespace NClient
+} // namespace NKikimr
diff --git a/ydb/public/lib/value/ya.make b/ydb/public/lib/value/ya.make
index 36a3851ddf..faca7819ff 100644
--- a/ydb/public/lib/value/ya.make
+++ b/ydb/public/lib/value/ya.make
@@ -1,17 +1,17 @@
-LIBRARY()
+LIBRARY()
OWNER(g:kikimr)
-
-SRCS(
- value.cpp
-)
-
-PEERDIR(
- contrib/libs/protobuf
+
+SRCS(
+ value.cpp
+)
+
+PEERDIR(
+ contrib/libs/protobuf
library/cpp/string_utils/base64
ydb/core/protos
ydb/library/mkql_proto/protos
ydb/public/lib/scheme_types
-)
-
-END()
+)
+
+END()
diff --git a/ydb/public/lib/ya.make b/ydb/public/lib/ya.make
index a4f529b44b..983d1e25e8 100644
--- a/ydb/public/lib/ya.make
+++ b/ydb/public/lib/ya.make
@@ -9,7 +9,7 @@ RECURSE(
jwt
operation_id
scheme_types
- value
+ value
ydb_cli
yq
yson_value
diff --git a/ydb/services/persqueue_v1/grpc_pq_actor.h b/ydb/services/persqueue_v1/grpc_pq_actor.h
index 65c8aca1db..378a1b3d5f 100644
--- a/ydb/services/persqueue_v1/grpc_pq_actor.h
+++ b/ydb/services/persqueue_v1/grpc_pq_actor.h
@@ -1,23 +1,23 @@
-#pragma once
+#pragma once
#include "persqueue_utils.h"
#include <ydb/core/grpc_services/grpc_request_proxy.h>
#include <ydb/core/grpc_services/rpc_deferrable.h>
#include <ydb/core/grpc_services/rpc_calls.h>
-
+
#include <ydb/core/client/server/msgbus_server_pq_metacache.h>
#include <ydb/core/client/server/msgbus_server_persqueue.h>
#include <ydb/core/base/events.h>
#include <ydb/core/tx/scheme_cache/scheme_cache.h>
-
+
#include <ydb/core/protos/grpc_pq_old.pb.h>
#include <ydb/core/protos/pqconfig.pb.h>
#include <library/cpp/containers/disjoint_interval_tree/disjoint_interval_tree.h>
-
+
#include <ydb/core/persqueue/events/global.h>
#include <ydb/core/persqueue/writer/writer.h>
@@ -37,7 +37,7 @@
#include <util/system/compiler.h>
namespace NKikimr::NGRpcProxy::V1 {
-
+
using namespace Ydb;
using namespace NKikimr::NGRpcService;
@@ -49,7 +49,7 @@ void FillIssue(Ydb::Issue::IssueMessage* issue, const PersQueue::ErrorCode::Erro
Ydb::StatusIds::StatusCode ConvertPersQueueInternalCodeToStatus(const PersQueue::ErrorCode::ErrorCode code);
const TString& TopicPrefix(const TActorContext& ctx);
-
+
static const TDuration CHECK_ACL_DELAY = TDuration::Minutes(5);
// Codec ID size in bytes
@@ -97,9 +97,9 @@ struct TCommitCookie {
struct TEvPQProxy {
- enum EEv {
+ enum EEv {
EvWriteInit = EventSpaceBegin(TKikimrEvents::ES_PQ_PROXY_NEW), // TODO: Replace 'NEW' with version or something
- EvWrite,
+ EvWrite,
EvDone,
EvReadInit,
EvRead,
@@ -130,8 +130,8 @@ struct TEvPQProxy {
EvUpdateToken,
EvCommitRange,
EvEnd
- };
-
+ };
+
struct TEvReadSessionStatus : public TEventPB<TEvReadSessionStatus, NKikimrPQ::TReadSessionStatus, EvReadSessionStatus> {
};
@@ -199,20 +199,20 @@ struct TEvPQProxy {
TEvWriteInit(PersQueue::V1::StreamingWriteClientMessage&& req, const TString& peerName)
: Request(std::move(req))
, PeerName(peerName)
- { }
-
+ { }
+
PersQueue::V1::StreamingWriteClientMessage Request;
TString PeerName;
- };
-
- struct TEvWrite : public NActors::TEventLocal<TEvWrite, EvWrite> {
+ };
+
+ struct TEvWrite : public NActors::TEventLocal<TEvWrite, EvWrite> {
explicit TEvWrite(PersQueue::V1::StreamingWriteClientMessage&& req)
: Request(std::move(req))
- { }
-
+ { }
+
PersQueue::V1::StreamingWriteClientMessage Request;
- };
-
+ };
+
struct TEvDone : public NActors::TEventLocal<TEvDone, EvDone> {
TEvDone()
{ }
@@ -447,33 +447,33 @@ struct TEvPQProxy {
bool Init;
};
-};
-
+};
+
/// WRITE ACTOR
-class TWriteSessionActor : public NActors::TActorBootstrapped<TWriteSessionActor> {
+class TWriteSessionActor : public NActors::TActorBootstrapped<TWriteSessionActor> {
using IContext = NGRpcServer::IGRpcStreamingContext<PersQueue::V1::StreamingWriteClientMessage, PersQueue::V1::StreamingWriteServerMessage>;
using TEvDescribeTopicsResponse = NMsgBusProxy::NPqMetaCacheV2::TEvPqNewMetaCache::TEvDescribeTopicsResponse;
using TEvDescribeTopicsRequest = NMsgBusProxy::NPqMetaCacheV2::TEvPqNewMetaCache::TEvDescribeTopicsRequest;
-public:
+public:
TWriteSessionActor(NKikimr::NGRpcService::TEvStreamPQWriteRequest* request, const ui64 cookie,
const NActors::TActorId& schemeCache, const NActors::TActorId& newSchemeCache,
TIntrusivePtr<NMonitoring::TDynamicCounters> counters, const TMaybe<TString> clientDC,
const NPersQueue::TTopicsListController& topicsController);
- ~TWriteSessionActor();
-
- void Bootstrap(const NActors::TActorContext& ctx);
-
- void Die(const NActors::TActorContext& ctx) override;
-
+ ~TWriteSessionActor();
+
+ void Bootstrap(const NActors::TActorContext& ctx);
+
+ void Die(const NActors::TActorContext& ctx) override;
+
static constexpr NKikimrServices::TActivity::EType ActorActivityType() { return NKikimrServices::TActivity::FRONT_PQ_WRITE; }
-private:
+private:
STFUNC(StateFunc) {
- switch (ev->GetTypeRewrite()) {
+ switch (ev->GetTypeRewrite()) {
CFunc(NActors::TEvents::TSystem::Wakeup, HandleWakeup);
-
+
HFunc(IContext::TEvReadFinished, Handle);
HFunc(IContext::TEvWriteFinished, Handle);
CFunc(IContext::TEvNotifiedWhenDone::EventType, HandleDone);
@@ -498,11 +498,11 @@ private:
HFunc(NKqp::TEvKqp::TEvQueryResponse, Handle);
HFunc(NKqp::TEvKqp::TEvProcessResponse, Handle);
- default:
- break;
- };
- }
-
+ default:
+ break;
+ };
+ }
+
void Handle(IContext::TEvReadFinished::TPtr& ev, const TActorContext &ctx);
void Handle(IContext::TEvWriteFinished::TPtr& ev, const TActorContext &ctx);
@@ -542,8 +542,8 @@ private:
void Handle(TEvPersQueue::TEvGetPartitionIdForWriteResponse::TPtr& ev, const NActors::TActorContext& ctx);
void HandlePoison(TEvPQProxy::TEvDieCommand::TPtr& ev, const NActors::TActorContext& ctx);
- void HandleWakeup(const NActors::TActorContext& ctx);
-
+ void HandleWakeup(const NActors::TActorContext& ctx);
+
void CloseSession(const TString& errorReason, const PersQueue::ErrorCode::ErrorCode errorCode, const NActors::TActorContext& ctx);
void CheckFinish(const NActors::TActorContext& ctx);
@@ -553,7 +553,7 @@ private:
void SetupCounters();
void SetupCounters(const TString& cloudId, const TString& dbId, const TString& folderId);
-private:
+private:
std::unique_ptr<NKikimr::NGRpcService::TEvStreamPQWriteRequest> Request;
enum EState {
@@ -669,8 +669,8 @@ private:
TInstant StartTime;
NKikimr::NPQ::TPercentileCounter InitLatency;
NKikimr::NPQ::TMultiCounter SLIBigLatency;
-};
-
+};
+
class TReadInitAndAuthActor : public NActors::TActorBootstrapped<TReadInitAndAuthActor> {
using TEvDescribeTopicsResponse = NMsgBusProxy::NPqMetaCacheV2::TEvPqNewMetaCache::TEvDescribeTopicsResponse;
@@ -1219,4 +1219,4 @@ public:
-}
+}
diff --git a/ydb/services/persqueue_v1/grpc_pq_write.cpp b/ydb/services/persqueue_v1/grpc_pq_write.cpp
index 5f17a2f3ab..28115a8ffb 100644
--- a/ydb/services/persqueue_v1/grpc_pq_write.cpp
+++ b/ydb/services/persqueue_v1/grpc_pq_write.cpp
@@ -1,30 +1,30 @@
-#include "grpc_pq_write.h"
-#include "grpc_pq_actor.h"
-
+#include "grpc_pq_write.h"
+#include "grpc_pq_actor.h"
+
#include <ydb/core/tx/scheme_board/cache.h>
#include <ydb/core/base/appdata.h>
-#include <util/generic/queue.h>
-
-using namespace NActors;
-using namespace NKikimrClient;
-
-using grpc::Status;
-
-namespace NKikimr {
-namespace NGRpcProxy {
+#include <util/generic/queue.h>
+
+using namespace NActors;
+using namespace NKikimrClient;
+
+using grpc::Status;
+
+namespace NKikimr {
+namespace NGRpcProxy {
namespace V1 {
-
+
using namespace PersQueue::V1;
-///////////////////////////////////////////////////////////////////////////////
-
+///////////////////////////////////////////////////////////////////////////////
+
IActor* CreatePQWriteService(const TActorId& schemeCache, const TActorId& newSchemeCache,
TIntrusivePtr<NMonitoring::TDynamicCounters> counters, const ui32 maxSessions) {
return new TPQWriteService(schemeCache, newSchemeCache, counters, maxSessions);
}
+
-
-
+
TPQWriteService::TPQWriteService(const TActorId& schemeCache, const TActorId& newSchemeCache,
TIntrusivePtr<NMonitoring::TDynamicCounters> counters, const ui32 maxSessions)
: SchemeCache(schemeCache)
@@ -34,8 +34,8 @@ TPQWriteService::TPQWriteService(const TActorId& schemeCache, const TActorId& ne
, Enabled(false)
{
}
-
-
+
+
void TPQWriteService::Bootstrap(const TActorContext& ctx) {
HaveClusters = !AppData(ctx)->PQConfig.GetTopicsAreFirstClassCitizen(); // ToDo[migration]: switch to proper option
if (HaveClusters) {
@@ -48,7 +48,7 @@ void TPQWriteService::Bootstrap(const TActorContext& ctx) {
);
Become(&TThis::StateFunc);
}
-
+
ui64 TPQWriteService::NextCookie() {
return ++LastCookie;
@@ -130,7 +130,7 @@ void TPQWriteService::Handle(NPQ::NClusterTracker::TEvClusterTracker::TEvCluster
}
}
}
-
+
void TPQWriteService::Handle(TEvPQProxy::TEvSessionSetPreferredCluster::TPtr& ev, const TActorContext& ctx) {
const auto& cookie = ev->Get()->Cookie;
const auto& preferredCluster = ev->Get()->PreferredCluster;
@@ -155,20 +155,20 @@ void TPQWriteService::Handle(TEvPQProxy::TEvSessionDead::TPtr& ev, const TActorC
}
RemotePreferredClusterBySessionCookie.erase(cookie);
}
-}
-
-
+}
+
+
StreamingWriteServerMessage FillWriteResponse(const TString& errorReason, const PersQueue::ErrorCode::ErrorCode code) {
StreamingWriteServerMessage res;
FillIssue(res.add_issues(), code, errorReason);
res.set_status(ConvertPersQueueInternalCodeToStatus(code));
return res;
-}
-
+}
+
void TPQWriteService::Handle(NKikimr::NGRpcService::TEvStreamPQWriteRequest::TPtr& ev, const TActorContext& ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::PQ_WRITE_PROXY, "new grpc connection");
-
+
if (TooMuchSessions()) {
LOG_INFO_S(ctx, NKikimrServices::PQ_WRITE_PROXY, "new grpc connection failed - too much sessions");
ev->Get()->GetStreamCtx()->Attach(ctx.SelfID);
@@ -195,7 +195,7 @@ void TPQWriteService::Handle(NKikimr::NGRpcService::TEvStreamPQWriteRequest::TPt
const ui64 cookie = NextCookie();
LOG_DEBUG_S(ctx, NKikimrServices::PQ_WRITE_PROXY, "new session created cookie " << cookie);
-
+
auto ip = ev->Get()->GetStreamCtx()->GetPeerName();
TActorId worker = ctx.Register(new TWriteSessionActor(
ev->Release().Release(), cookie, SchemeCache, NewSchemeCache, Counters,
@@ -204,9 +204,9 @@ void TPQWriteService::Handle(NKikimr::NGRpcService::TEvStreamPQWriteRequest::TPt
));
Sessions[cookie] = worker;
- }
-}
-
+ }
+}
+
bool TPQWriteService::TooMuchSessions() {
return Sessions.size() >= MaxSessions;
}
diff --git a/ydb/services/persqueue_v1/grpc_pq_write.h b/ydb/services/persqueue_v1/grpc_pq_write.h
index 73148388b2..0502329ff3 100644
--- a/ydb/services/persqueue_v1/grpc_pq_write.h
+++ b/ydb/services/persqueue_v1/grpc_pq_write.h
@@ -1,22 +1,22 @@
-#pragma once
-
+#pragma once
+
#include "grpc_pq_actor.h"
#include "persqueue.h"
-
+
#include <ydb/core/client/server/grpc_base.h>
#include <ydb/core/persqueue/cluster_tracker.h>
#include <ydb/core/mind/address_classification/net_classifier.h>
#include <library/cpp/actors/core/actorsystem.h>
-
-#include <util/generic/hash.h>
+
+#include <util/generic/hash.h>
#include <util/generic/maybe.h>
-#include <util/system/mutex.h>
-
-namespace NKikimr {
-namespace NGRpcProxy {
+#include <util/system/mutex.h>
+
+namespace NKikimr {
+namespace NGRpcProxy {
namespace V1 {
-
+
inline TActorId GetPQWriteServiceActorID() {
return TActorId(0, "PQWriteSvc");
}
@@ -25,21 +25,21 @@ IActor* CreatePQWriteService(const NActors::TActorId& schemeCache, const NActors
TIntrusivePtr<NMonitoring::TDynamicCounters> counters, const ui32 maxSessions);
class TPQWriteService : public NActors::TActorBootstrapped<TPQWriteService> {
-public:
+public:
TPQWriteService(const NActors::TActorId& schemeCache, const NActors::TActorId& newSchemeCache,
TIntrusivePtr<NMonitoring::TDynamicCounters> counters, const ui32 maxSessions);
-
+
~TPQWriteService()
{}
void Bootstrap(const TActorContext& ctx);
-private:
- ui64 NextCookie();
-
+private:
+ ui64 NextCookie();
+
bool TooMuchSessions();
TString AvailableLocalCluster(const TActorContext& ctx) const;
-
+
STFUNC(StateFunc) {
switch (ev->GetTypeRewrite()) {
HFunc(NKikimr::NGRpcService::TEvStreamPQWriteRequest, Handle);
@@ -51,7 +51,7 @@ private:
}
}
-private:
+private:
void Handle(NKikimr::NGRpcService::TEvStreamPQWriteRequest::TPtr& ev, const TActorContext& ctx);
void Handle(NPQ::NClusterTracker::TEvClusterTracker::TEvClustersUpdate::TPtr& ev, const TActorContext& ctx);
void Handle(NNetClassifier::TEvNetClassifier::TEvClassifierUpdate::TPtr& ev, const TActorContext& ctx);
@@ -61,9 +61,9 @@ private:
NActors::TActorId SchemeCache;
NActors::TActorId NewSchemeCache;
-
+
TAtomic LastCookie = 0;
-
+
THashMap<ui64, TActorId> Sessions;
// Created at by session cookie map by remote preferred cluster name
THashMap<TString, THashMap<ui64, TInstant>> SessionsByRemotePreferredCluster;
@@ -84,9 +84,9 @@ private:
bool HaveClusters;
NPersQueue::TConverterFactoryPtr ConverterFactory;
std::unique_ptr<NPersQueue::TTopicsListController> TopicsHandler;
-};
+};
+
-
-}
-}
+}
+}
}
diff --git a/ydb/services/persqueue_v1/grpc_pq_write_actor.cpp b/ydb/services/persqueue_v1/grpc_pq_write_actor.cpp
index 3038cc82a6..9304cb87f1 100644
--- a/ydb/services/persqueue_v1/grpc_pq_write_actor.cpp
+++ b/ydb/services/persqueue_v1/grpc_pq_write_actor.cpp
@@ -1,7 +1,7 @@
-#include "grpc_pq_actor.h"
+#include "grpc_pq_actor.h"
#include "grpc_pq_write.h"
#include "grpc_pq_codecs.h"
-
+
#include <ydb/core/persqueue/pq_database.h>
#include <ydb/core/persqueue/write_meta.h>
#include <ydb/core/persqueue/writer/source_id_encoding.h>
@@ -15,13 +15,13 @@
#include <util/string/vector.h>
#include <util/string/escape.h>
#include <util/string/printf.h>
-
-using namespace NActors;
-using namespace NKikimrClient;
+
+using namespace NActors;
+using namespace NKikimrClient;
+
-
-namespace NKikimr {
+namespace NKikimr {
using namespace NSchemeCache;
Ydb::PersQueue::V1::Codec CodecByName(const TString& codec) {
@@ -73,11 +73,11 @@ void FillChunkDataFromReq(
proto.SetData(writeRequest.blocks_data(messageIndex));
}
-namespace NGRpcProxy {
+namespace NGRpcProxy {
namespace V1 {
-
+
using namespace Ydb::PersQueue::V1;
-
+
static const ui32 MAX_RESERVE_REQUESTS_INFLIGHT = 5;
static const ui32 MAX_BYTES_INFLIGHT = 1 << 20; //1mb
@@ -143,14 +143,14 @@ TWriteSessionActor::TWriteSessionActor(
, LastSourceIdUpdate(TInstant::Zero())
, SourceIdCreateTime(0)
, SourceIdUpdateInfly(false)
-{
+{
Y_ASSERT(Request);
++(*GetServiceCounters(Counters, "pqproxy|writeSession")->GetCounter("SessionsCreatedTotal", true));
-}
-
-
-TWriteSessionActor::~TWriteSessionActor() = default;
+}
+
+TWriteSessionActor::~TWriteSessionActor() = default;
+
void TWriteSessionActor::Bootstrap(const TActorContext& ctx) {
Y_VERIFY(Request);
@@ -165,8 +165,8 @@ void TWriteSessionActor::Bootstrap(const TActorContext& ctx) {
}
Become(&TThis::StateFunc);
StartTime = ctx.Now();
-}
-
+}
+
void TWriteSessionActor::HandleDone(const TActorContext& ctx) {
@@ -224,7 +224,7 @@ void TWriteSessionActor::Handle(IContext::TEvWriteFinished::TPtr& ev, const TAct
}
-void TWriteSessionActor::Die(const TActorContext& ctx) {
+void TWriteSessionActor::Die(const TActorContext& ctx) {
if (Writer)
ctx.Send(Writer, new TEvents::TEvPoisonPill());
@@ -238,9 +238,9 @@ void TWriteSessionActor::Die(const TActorContext& ctx) {
ctx.Send(GetPQWriteServiceActorID(), new TEvPQProxy::TEvSessionDead(Cookie));
- TActorBootstrapped<TWriteSessionActor>::Die(ctx);
-}
-
+ TActorBootstrapped<TWriteSessionActor>::Die(ctx);
+}
+
void TWriteSessionActor::CheckFinish(const TActorContext& ctx) {
if (!WritesDone)
return;
@@ -291,14 +291,14 @@ void TWriteSessionActor::CheckACL(const TActorContext& ctx) {
void TWriteSessionActor::Handle(TEvPQProxy::TEvWriteInit::TPtr& ev, const TActorContext& ctx) {
THolder<TEvPQProxy::TEvWriteInit> event(ev->Release());
-
+
if (State != ES_CREATED) {
//answer error
CloseSession("got second init request", PersQueue::ErrorCode::BAD_REQUEST, ctx);
return;
}
const auto& init = event->Request.init_request();
-
+
if (init.topic().empty() || init.message_group_id().empty()) {
CloseSession("no topic or message_group_id in init request", PersQueue::ErrorCode::BAD_REQUEST, ctx);
return;
@@ -415,7 +415,7 @@ void TWriteSessionActor::Handle(TEvDescribeTopicsResponse::TPtr& ev, const TActo
if (processResult.IsFatal) {
CloseSession(processResult.Reason, processResult.ErrorCode, ctx);
return;
- }
+ }
auto& description = entry.PQGroupInfo->Description;
Y_VERIFY(description.PartitionsSize() > 0);
Y_VERIFY(description.HasPQTabletConfig());
@@ -743,14 +743,14 @@ void TWriteSessionActor::CloseSession(const TString& errorReason, const PersQueu
}
LOG_INFO_S(ctx, NKikimrServices::PQ_WRITE_PROXY, "session v1 closed cookie: " << Cookie << " sessionId: " << OwnerCookie);
}
- Die(ctx);
-}
-
+ Die(ctx);
+}
+
void TWriteSessionActor::Handle(NPQ::TEvPartitionWriter::TEvInitResult::TPtr& ev, const TActorContext& ctx) {
if (State != ES_WAIT_WRITER_INIT) {
return CloseSession("got init result but not wait for it", PersQueue::ErrorCode::ERROR, ctx);
}
-
+
const auto& result = *ev->Get();
if (!result.IsSuccess()) {
const auto& error = result.GetError();
@@ -760,10 +760,10 @@ void TWriteSessionActor::Handle(NPQ::TEvPartitionWriter::TEvInitResult::TPtr& ev
return CloseSession("error at writer init: " + error.Reason, PersQueue::ErrorCode::ERROR, ctx);
}
}
-
+
OwnerCookie = result.GetResult().OwnerCookie;
const auto& maxSeqNo = result.GetResult().SourceIdInfo.GetSeqNo();
-
+
StreamingWriteServerMessage response;
response.set_status(Ydb::StatusIds::SUCCESS);
auto init = response.mutable_init_response();
@@ -797,10 +797,10 @@ void TWriteSessionActor::Handle(NPQ::TEvPartitionWriter::TEvInitResult::TPtr& ev
if (!Request->GetStreamCtx()->Read()) {
LOG_INFO_S(ctx, NKikimrServices::PQ_WRITE_PROXY, "session v1 cookie: " << Cookie << " sessionId: " << OwnerCookie << " grpc read failed");
Die(ctx);
- return;
- }
+ return;
+ }
}
-
+
void TWriteSessionActor::Handle(NPQ::TEvPartitionWriter::TEvWriteAccepted::TPtr& ev, const TActorContext& ctx) {
if (State != ES_INITED) {
return CloseSession("got write permission but not wait for it", PersQueue::ErrorCode::ERROR, ctx);
@@ -922,8 +922,8 @@ void TWriteSessionActor::Handle(NPQ::TEvPartitionWriter::TEvWriteResponse::TPtr&
void TWriteSessionActor::Handle(NPQ::TEvPartitionWriter::TEvDisconnected::TPtr&, const TActorContext& ctx) {
CloseSession("pipe to partition's tablet is dead", PersQueue::ErrorCode::ERROR, ctx);
-}
-
+}
+
void TWriteSessionActor::Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev, const TActorContext& ctx) {
TEvTabletPipe::TEvClientConnected *msg = ev->Get();
//TODO: add here retries for connecting to PQRB
@@ -931,12 +931,12 @@ void TWriteSessionActor::Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev, con
CloseSession(TStringBuilder() << "pipe to tablet is dead " << msg->TabletId, PersQueue::ErrorCode::ERROR, ctx);
return;
}
-}
+}
void TWriteSessionActor::Handle(TEvTabletPipe::TEvClientDestroyed::TPtr& ev, const TActorContext& ctx) {
//TODO: add here retries for connecting to PQRB
CloseSession(TStringBuilder() << "pipe to tablet is dead " << ev->Get()->TabletId, PersQueue::ErrorCode::ERROR, ctx);
-}
+}
void TWriteSessionActor::GenerateNextWriteRequest(const TActorContext& ctx) {
TWriteRequestBatchInfo::TPtr writeRequest = new TWriteRequestBatchInfo();
diff --git a/ydb/tests/functional/sqs/ya.make b/ydb/tests/functional/sqs/ya.make
index bbb0a57bb8..c7502fd45b 100644
--- a/ydb/tests/functional/sqs/ya.make
+++ b/ydb/tests/functional/sqs/ya.make
@@ -39,7 +39,7 @@ ELSE()
cpu:4
ram:16
)
- TIMEOUT(600)
+ TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()