Skip to content

Commit ddd2ab6

Browse files
committed
cc userver: reformat everything
commit_hash:4eb7fb5949eb259d42d1d1d65eb3e6d647c946c3
1 parent faa6c61 commit ddd2ab6

7 files changed

Lines changed: 63 additions & 59 deletions

File tree

rabbitmq/src/urabbitmq/impl/amqp_channel.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ AMQP::Table CreateHeadersForPublish(const Envelope& envelope) {
106106

107107
} // namespace
108108

109-
AmqpChannel::AmqpChannel(AmqpConnection& conn) : conn_{conn} {}
109+
AmqpChannel::AmqpChannel(AmqpConnection& conn)
110+
: conn_{conn}
111+
{}
110112

111113
AmqpChannel::~AmqpChannel() = default;
112114

@@ -270,7 +272,9 @@ void AmqpChannel::CancelConsumer(const std::optional<std::string>& consumer_tag)
270272

271273
void AmqpChannel::AccountMessageConsumed() { conn_.GetStatistics().AccountMessageConsumed(); }
272274

273-
AmqpReliableChannel::AmqpReliableChannel(AmqpConnection& conn) : conn_{conn} {}
275+
AmqpReliableChannel::AmqpReliableChannel(AmqpConnection& conn)
276+
: conn_{conn}
277+
{}
274278

275279
AmqpReliableChannel::~AmqpReliableChannel() = default;
276280

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"scylla_settings": {
3-
"scylla_example": {
4-
"hosts": "scylla"
5-
}
2+
"scylla_settings": {
3+
"scylla_example": {
4+
"hosts": "scylla"
65
}
6+
}
77
}

samples/scylla_service/src/main.cpp

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include <userver/storages/scylla/session.hpp>
2121
#include <userver/storages/secdist/component.hpp>
2222
#include <userver/storages/secdist/provider_component.hpp>
23-
#include <userver/utils/daemon_run.hpp>
2423
#include <userver/utest/using_namespace_userver.hpp>
24+
#include <userver/utils/daemon_run.hpp>
2525

2626
#include "helpers.hpp"
2727

@@ -58,7 +58,8 @@ class KeyValueHandler final : public server::handlers::HttpHandlerBase {
5858

5959
KeyValueHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
6060
: HttpHandlerBase(config, context),
61-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
61+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
62+
{}
6263

6364
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
6465
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -136,7 +137,8 @@ class ListHandler final : public server::handlers::HttpHandlerBase {
136137

137138
ListHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
138139
: HttpHandlerBase(config, context),
139-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
140+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
141+
{}
140142

141143
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
142144
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -162,7 +164,8 @@ class CountHandler final : public server::handlers::HttpHandlerBase {
162164

163165
CountHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
164166
: HttpHandlerBase(config, context),
165-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
167+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
168+
{}
166169

167170
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
168171
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -184,7 +187,8 @@ class BulkInsertHandler final : public server::handlers::HttpHandlerBase {
184187

185188
BulkInsertHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
186189
: HttpHandlerBase(config, context),
187-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
190+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
191+
{}
188192

189193
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
190194
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -203,8 +207,7 @@ class BulkInsertHandler final : public server::handlers::HttpHandlerBase {
203207
BindBasicFields(op, row);
204208
}
205209
session_->GetTable(std::string{kBasicTable}).Execute(op);
206-
return formats::json::ToString(
207-
formats::json::MakeObject("inserted", static_cast<std::int64_t>(body.GetSize()))
210+
return formats::json::ToString(formats::json::MakeObject("inserted", static_cast<std::int64_t>(body.GetSize()))
208211
);
209212
}
210213

@@ -218,7 +221,8 @@ class PaginatedHandler final : public server::handlers::HttpHandlerBase {
218221

219222
PaginatedHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
220223
: HttpHandlerBase(config, context),
221-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
224+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
225+
{}
222226

223227
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
224228
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -259,7 +263,8 @@ class CreateIfAbsentHandler final : public server::handlers::HttpHandlerBase {
259263

260264
CreateIfAbsentHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
261265
: HttpHandlerBase(config, context),
262-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
266+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
267+
{}
263268

264269
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
265270
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -291,7 +296,8 @@ class CompareAndSetHandler final : public server::handlers::HttpHandlerBase {
291296

292297
CompareAndSetHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
293298
: HttpHandlerBase(config, context),
294-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
299+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
300+
{}
295301

296302
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
297303
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -305,26 +311,22 @@ class CompareAndSetHandler final : public server::handlers::HttpHandlerBase {
305311
operations::UpdateOne op;
306312
for (const auto [name, value] : Items(set)) {
307313
if (!IsKnownOptionalField(name)) {
308-
BadRequest(
309-
fmt::format(
310-
"field '{}' is not allowed in 'set' (allowed: bln, "
311-
"i32, i64, flt, dbl)",
312-
name
313-
)
314-
);
314+
BadRequest(fmt::format(
315+
"field '{}' is not allowed in 'set' (allowed: bln, "
316+
"i32, i64, flt, dbl)",
317+
name
318+
));
315319
}
316320
op.Set(std::string{name}, JsonToBasicValue(name, value));
317321
}
318322
op.WhereString("key", RequireArg(request, "key"));
319323
for (const auto [name, value] : Items(expect)) {
320324
if (!IsKnownOptionalField(name)) {
321-
BadRequest(
322-
fmt::format(
323-
"field '{}' is not allowed in 'expect' (allowed: bln, "
324-
"i32, i64, flt, dbl)",
325-
name
326-
)
327-
);
325+
BadRequest(fmt::format(
326+
"field '{}' is not allowed in 'expect' (allowed: bln, "
327+
"i32, i64, flt, dbl)",
328+
name
329+
));
328330
}
329331
op.If(std::string{name}, JsonToBasicValue(name, value));
330332
}
@@ -348,7 +350,8 @@ class DeleteIfExistsHandler final : public server::handlers::HttpHandlerBase {
348350

349351
DeleteIfExistsHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
350352
: HttpHandlerBase(config, context),
351-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
353+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
354+
{}
352355

353356
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
354357
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -374,7 +377,8 @@ class TruncateHandler final : public server::handlers::HttpHandlerBase {
374377

375378
TruncateHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
376379
: HttpHandlerBase(config, context),
377-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
380+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
381+
{}
378382

379383
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
380384
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -392,7 +396,8 @@ class SchemaInitHandler final : public server::handlers::HttpHandlerBase {
392396

393397
SchemaInitHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
394398
: HttpHandlerBase(config, context),
395-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
399+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
400+
{}
396401

397402
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
398403
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -431,7 +436,8 @@ class RawQueryHandler final : public server::handlers::HttpHandlerBase {
431436

432437
RawQueryHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
433438
: HttpHandlerBase(config, context),
434-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
439+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
440+
{}
435441

436442
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
437443
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -479,7 +485,8 @@ class EventHandler final : public server::handlers::HttpHandlerBase {
479485

480486
EventHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
481487
: HttpHandlerBase(config, context),
482-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
488+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
489+
{}
483490

484491
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
485492
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);
@@ -578,7 +585,8 @@ class EventListHandler final : public server::handlers::HttpHandlerBase {
578585

579586
EventListHandler(const components::ComponentConfig& config, const components::ComponentContext& context)
580587
: HttpHandlerBase(config, context),
581-
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession()) {}
588+
session_(context.FindComponent<components::Scylla>(kComponentName).GetSession())
589+
{}
582590

583591
std::string HandleRequest(server::http::HttpRequest& request, server::request::RequestContext&) const override {
584592
request.GetHttpResponse().SetContentType(http::content_type::kApplicationJson);

samples/scylla_service/testsuite/conftest.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import os
33

44
import pytest
5-
65
from pytest_userver.plugins.scylla import ConnectionInfo
76

87
pytest_plugins = ['pytest_userver.plugins.scylla']
@@ -11,16 +10,8 @@
1110

1211
@pytest.fixture(scope='session')
1312
def scylla_connection_info(pytestconfig) -> ConnectionInfo:
14-
host = (
15-
pytestconfig.option.scylla_host
16-
or os.environ.get('TESTSUITE_SCYLLA_HOST')
17-
or 'scylla'
18-
)
19-
port = (
20-
pytestconfig.option.scylla_port
21-
or int(os.environ.get('TESTSUITE_SCYLLA_PORT') or 9042)
22-
)
23-
13+
host = pytestconfig.option.scylla_host or os.environ.get('TESTSUITE_SCYLLA_HOST') or 'scylla'
14+
port = pytestconfig.option.scylla_port or int(os.environ.get('TESTSUITE_SCYLLA_PORT') or 9042)
2415

2516
return ConnectionInfo(host=host, port=port)
2617

samples/scylla_service/testsuite/test_scylla.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ async def test_events_list_page_size(service_client):
269269
assert response.status == 200
270270

271271
response = await service_client.get(
272-
'/v1/events/list', params={'page_size': 2},
272+
'/v1/events/list',
273+
params={'page_size': 2},
273274
)
274275
assert response.status == 200
275276
body = response.json()
@@ -375,10 +376,7 @@ async def test_raw_ddl_void(service_client):
375376
response = await service_client.post(
376377
'/v1/raw',
377378
json={
378-
'query': (
379-
'CREATE INDEX IF NOT EXISTS idx_events_name '
380-
'ON examples.events (name)'
381-
),
379+
'query': ('CREATE INDEX IF NOT EXISTS idx_events_name ON examples.events (name)'),
382380
'void': True,
383381
},
384382
)
@@ -435,7 +433,8 @@ async def test_pagination_cursor_contract(service_client):
435433
assert response.status == 200
436434

437435
response = await service_client.get(
438-
'/v1/kv/pages', params={'page_size': 2},
436+
'/v1/kv/pages',
437+
params={'page_size': 2},
439438
)
440439
assert response.status == 200
441440
first = response.json()
@@ -490,7 +489,9 @@ async def test_raw_full_table_scan(service_client):
490489
body = response.json()
491490
assert body['count'] == 3
492491
assert {row['key'] for row in body['rows']} == {
493-
'scan-a', 'scan-b', 'scan-c',
492+
'scan-a',
493+
'scan-b',
494+
'scan-c',
494495
}
495496

496497

scripts/docs/en/userver/scylladb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ a Rust reimplementation of the DataStax C/C++ driver.
99
The framework wraps that C API in a thin
1010
coroutine-friendly layer. Every `CassFuture` is bridged into an awaitable task,
1111
so CQL calls suspend the current coroutine instead of blocking a task
12-
processor thread, while the driver's own I/O threads keep talking to the cluster.
12+
processor thread, while the driver's own I/O threads keep talking to the cluster.
1313

1414
## Main features
1515

scripts/docs/en/userver/tutorial/scylla_service.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private:
4545
4646
The component holds a storages::scylla::SessionPtr, a client to the
4747
ScyllaDB cluster. That client is thread safe, you can use it concurrently from
48-
different threads and tasks.
48+
different threads and tasks.
4949
5050
5151
### KeyValueHandler::Post
@@ -157,7 +157,7 @@ if (!result.applied) {
157157
### Paging
158158

159159
For large result sets, storages::scylla::operations::SelectMany together with
160-
ExecutePaged gives you one page plus an opaque cursor.
160+
ExecutePaged gives you one page plus an opaque cursor.
161161

162162
```cpp
163163
storages::scylla::operations::SelectMany op;
@@ -185,7 +185,7 @@ while (!cursor.Done()) {
185185

186186
### Rich CQL types
187187

188-
Examples of the non-scalar CQL types.
188+
Examples of the non-scalar CQL types.
189189

190190
```cpp
191191
storages::scylla::operations::InsertOne op;
@@ -252,7 +252,7 @@ cqlsh.
252252

253253
Static configuration of service is quite close to the configuration from
254254
@ref scripts/docs/en/userver/tutorial/hello_service.md except for the handlers
255-
and DB. Secdist carries the cluster contact points so
255+
and DB. Secdist carries the cluster contact points so
256256
they are not checked into the config file.
257257

258258
```yaml

0 commit comments

Comments
 (0)