@@ -280,42 +280,6 @@ void CheckContinuationToken(
280
280
CheckRow (lastKey.GetCells (), goldRow, types);
281
281
}
282
282
283
- template <typename TKeyType>
284
- TVector<TCell> ToCells (const std::vector<TKeyType>& keys) {
285
- TVector<TCell> cells;
286
- for (auto & key: keys) {
287
- cells.emplace_back (TCell::Make (key));
288
- }
289
- return cells;
290
- }
291
-
292
- void AddKeyQuery (
293
- TEvDataShard::TEvRead& request,
294
- const std::vector<ui32>& keys)
295
- {
296
- // convertion is ugly, but for tests is OK
297
- auto cells = ToCells (keys);
298
- request.Keys .emplace_back (cells);
299
- }
300
-
301
- template <typename TCellType>
302
- void AddRangeQuery (
303
- TEvDataShard::TEvRead& request,
304
- std::vector<TCellType> from,
305
- bool fromInclusive,
306
- std::vector<TCellType> to,
307
- bool toInclusive)
308
- {
309
- auto fromCells = ToCells (from);
310
- auto toCells = ToCells (to);
311
-
312
- // convertion is ugly, but for tests is OK
313
- auto fromBuf = TSerializedCellVec::Serialize (fromCells);
314
- auto toBuf = TSerializedCellVec::Serialize (toCells);
315
-
316
- request.Ranges .emplace_back (fromBuf, toBuf, fromInclusive, toInclusive);
317
- }
318
-
319
283
struct TTableInfo {
320
284
TString Name;
321
285
@@ -502,20 +466,6 @@ struct TTestHelper {
502
466
{
503
467
const auto & table = Tables[tableName];
504
468
505
- std::unique_ptr<TEvDataShard::TEvRead> request (new TEvDataShard::TEvRead ());
506
- auto & record = request->Record ;
507
-
508
- record.SetReadId (readId);
509
- record.MutableTableId ()->SetOwnerId (table.TableId .PathId .OwnerId );
510
- record.MutableTableId ()->SetTableId (table.UserTable .GetPathId ());
511
-
512
- const auto & description = table.UserTable .GetDescription ();
513
- for (const auto & column: description.GetColumns ()) {
514
- record.AddColumns (column.GetId ());
515
- }
516
-
517
- record.MutableTableId ()->SetSchemaVersion (description.GetTableSchemaVersion ());
518
-
519
469
TRowVersion readVersion;
520
470
if (!snapshot) {
521
471
readVersion = CreateVolatileSnapshot (
@@ -526,12 +476,13 @@ struct TTestHelper {
526
476
readVersion = snapshot;
527
477
}
528
478
529
- record.MutableSnapshot ()->SetStep (readVersion.Step );
530
- record.MutableSnapshot ()->SetTxId (readVersion.TxId );
531
-
532
- record.SetResultFormat (format);
533
-
534
- return request;
479
+ return ::NKikimr::GetBaseReadRequest (
480
+ table.TableId ,
481
+ table.UserTable .GetDescription (),
482
+ readId,
483
+ format,
484
+ readVersion
485
+ );
535
486
}
536
487
537
488
std::unique_ptr<TEvDataShard::TEvRead> GetUserTablesRequest (
@@ -558,14 +509,7 @@ struct TTestHelper {
558
509
}
559
510
560
511
std::unique_ptr<TEvDataShard::TEvReadResult> WaitReadResult (TDuration timeout = TDuration::Max()) {
561
- auto &runtime = *Server->GetRuntime ();
562
- TAutoPtr<IEventHandle> handle;
563
- runtime.GrabEdgeEventRethrow <TEvDataShard::TEvReadResult>(handle, timeout);
564
- if (!handle) {
565
- return nullptr ;
566
- }
567
- std::unique_ptr<TEvDataShard::TEvReadResult> event (handle->Release <TEvDataShard::TEvReadResult>().Release ());
568
- return event;
512
+ return ::NKikimr::WaitReadResult (Server, timeout);
569
513
}
570
514
571
515
void SendReadAsync (
@@ -579,14 +523,15 @@ struct TTestHelper {
579
523
}
580
524
581
525
const auto & table = Tables[tableName];
582
- auto &runtime = *Server-> GetRuntime ();
583
- runtime. SendToPipe (
526
+ ::NKikimr::SendReadAsync (
527
+ Server,
584
528
table.TabletId,
585
- sender,
586
529
request,
530
+ sender,
587
531
node,
588
532
GetTestPipeConfig (),
589
- table.ClientId );
533
+ table.ClientId
534
+ );
590
535
}
591
536
592
537
std::unique_ptr<TEvDataShard::TEvReadResult> SendRead (
@@ -596,9 +541,21 @@ struct TTestHelper {
596
541
TActorId sender = {},
597
542
TDuration timeout = TDuration::Max())
598
543
{
599
- SendReadAsync (tableName, request, node, sender);
544
+ if (!sender) {
545
+ sender = Sender;
546
+ }
600
547
601
- return WaitReadResult (timeout);
548
+ const auto & table = Tables[tableName];
549
+ return ::NKikimr::SendRead (
550
+ Server,
551
+ table.TabletId ,
552
+ request,
553
+ sender,
554
+ node,
555
+ GetTestPipeConfig (),
556
+ table.ClientId ,
557
+ timeout
558
+ );
602
559
}
603
560
604
561
void SendReadAck (
0 commit comments