Skip to content

Commit 794bfc5

Browse files
author
hiddenpath
committed
YT-23616: Dispatch on some dyntable methods
commit_hash:c279c66b6d18c54f7f1794d2a0ba851119dd59c8
1 parent 7439a2b commit 794bfc5

File tree

4 files changed

+42
-87
lines changed

4 files changed

+42
-87
lines changed

yt/cpp/mapreduce/client/client.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ void TClient::InsertRows(
12261226
RequestWithRetry<void>(
12271227
ClientRetryPolicy_->CreatePolicyForGenericRequest(),
12281228
[this, &path, &rows, &options] (TMutationId /*mutationId*/) {
1229-
NRawClient::InsertRows(Context_, path, rows, options);
1229+
RawClient_->InsertRows(path, rows, options);
12301230
});
12311231
}
12321232

@@ -1239,7 +1239,7 @@ void TClient::DeleteRows(
12391239
RequestWithRetry<void>(
12401240
ClientRetryPolicy_->CreatePolicyForGenericRequest(),
12411241
[this, &path, &keys, &options] (TMutationId /*mutationId*/) {
1242-
NRawClient::DeleteRows(Context_, path, keys, options);
1242+
RawClient_->DeleteRows(path, keys, options);
12431243
});
12441244
}
12451245

@@ -1266,7 +1266,7 @@ TNode::TListType TClient::LookupRows(
12661266
return RequestWithRetry<TNode::TListType>(
12671267
ClientRetryPolicy_->CreatePolicyForGenericRequest(),
12681268
[this, &path, &keys, &options] (TMutationId /*mutationId*/) {
1269-
return NRawClient::LookupRows(Context_, path, keys, options);
1269+
return RawClient_->LookupRows(path, keys, options);
12701270
});
12711271
}
12721272

yt/cpp/mapreduce/http_client/raw_client.cpp

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,14 @@ void THttpRawClient::InsertRows(
677677
const TNode::TListType& rows,
678678
const TInsertRowsOptions& options)
679679
{
680-
NRawClient::InsertRows(Context_, path, rows, options);
680+
TMutationId mutationId;
681+
THttpHeader header("PUT", "insert_rows");
682+
header.SetInputFormat(TFormat::YsonBinary());
683+
header.MergeParameters(NRawClient::SerializeParametersForInsertRows(Context_.Config->Prefix, path, options));
684+
auto body = NodeListToYsonString(rows);
685+
TRequestConfig config;
686+
config.IsHeavy = true;
687+
RequestWithoutRetry(Context_, mutationId, header, body, config)->GetResponse();
681688
}
682689

683690
void THttpRawClient::TrimRows(
@@ -701,7 +708,28 @@ TNode::TListType THttpRawClient::LookupRows(
701708
const TNode::TListType& keys,
702709
const TLookupRowsOptions& options)
703710
{
704-
return NRawClient::LookupRows(Context_, path, keys, options);
711+
TMutationId mutationId;
712+
THttpHeader header("PUT", "lookup_rows");
713+
header.AddPath(AddPathPrefix(path, Context_.Config->ApiVersion));
714+
header.SetInputFormat(TFormat::YsonBinary());
715+
header.SetOutputFormat(TFormat::YsonBinary());
716+
717+
header.MergeParameters(BuildYsonNodeFluently().BeginMap()
718+
.DoIf(options.Timeout_.Defined(), [&] (TFluentMap fluent) {
719+
fluent.Item("timeout").Value(static_cast<i64>(options.Timeout_->MilliSeconds()));
720+
})
721+
.Item("keep_missing_rows").Value(options.KeepMissingRows_)
722+
.Item("versioned").Value(options.Versioned_)
723+
.DoIf(options.Columns_.Defined(), [&] (TFluentMap fluent) {
724+
fluent.Item("column_names").Value(*options.Columns_);
725+
})
726+
.EndMap());
727+
728+
auto body = NodeListToYsonString(keys);
729+
TRequestConfig config;
730+
config.IsHeavy = true;
731+
auto responseInfo = RequestWithoutRetry(Context_, mutationId, header, body, config);
732+
return NodeFromYsonString(responseInfo->GetResponse(), ::NYson::EYsonType::ListFragment).AsList();
705733
}
706734

707735
TNode::TListType THttpRawClient::SelectRows(
@@ -819,7 +847,15 @@ void THttpRawClient::DeleteRows(
819847
const TNode::TListType& keys,
820848
const TDeleteRowsOptions& options)
821849
{
822-
NRawClient::DeleteRows(Context_, path, keys, options);
850+
TMutationId mutationId;
851+
THttpHeader header("PUT", "delete_rows");
852+
header.SetInputFormat(TFormat::YsonBinary());
853+
header.MergeParameters(NRawClient::SerializeParametersForDeleteRows(Context_.Config->Prefix, path, options));
854+
855+
auto body = NodeListToYsonString(keys);
856+
TRequestConfig config;
857+
config.IsHeavy = true;
858+
RequestWithoutRetry(Context_, mutationId, header, body, config)->GetResponse();
823859
}
824860

825861
void THttpRawClient::FreezeTable(

yt/cpp/mapreduce/http_client/raw_requests.cpp

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -356,69 +356,6 @@ std::unique_ptr<IOutputStream> WriteTable(
356356
return std::make_unique<THttpRequestStream>(std::move(request), options.BufferSize_);
357357
}
358358

359-
void InsertRows(
360-
const TClientContext& context,
361-
const TYPath& path,
362-
const TNode::TListType& rows,
363-
const TInsertRowsOptions& options)
364-
{
365-
TMutationId mutationId;
366-
THttpHeader header("PUT", "insert_rows");
367-
header.SetInputFormat(TFormat::YsonBinary());
368-
header.MergeParameters(NRawClient::SerializeParametersForInsertRows(context.Config->Prefix, path, options));
369-
auto body = NodeListToYsonString(rows);
370-
TRequestConfig config;
371-
config.IsHeavy = true;
372-
RequestWithoutRetry(context, mutationId, header, body, config)->GetResponse();
373-
}
374-
375-
TNode::TListType LookupRows(
376-
const TClientContext& context,
377-
const TYPath& path,
378-
const TNode::TListType& keys,
379-
const TLookupRowsOptions& options)
380-
{
381-
TMutationId mutationId;
382-
THttpHeader header("PUT", "lookup_rows");
383-
header.AddPath(AddPathPrefix(path, context.Config->ApiVersion));
384-
header.SetInputFormat(TFormat::YsonBinary());
385-
header.SetOutputFormat(TFormat::YsonBinary());
386-
387-
header.MergeParameters(BuildYsonNodeFluently().BeginMap()
388-
.DoIf(options.Timeout_.Defined(), [&] (TFluentMap fluent) {
389-
fluent.Item("timeout").Value(static_cast<i64>(options.Timeout_->MilliSeconds()));
390-
})
391-
.Item("keep_missing_rows").Value(options.KeepMissingRows_)
392-
.Item("versioned").Value(options.Versioned_)
393-
.DoIf(options.Columns_.Defined(), [&] (TFluentMap fluent) {
394-
fluent.Item("column_names").Value(*options.Columns_);
395-
})
396-
.EndMap());
397-
398-
auto body = NodeListToYsonString(keys);
399-
TRequestConfig config;
400-
config.IsHeavy = true;
401-
auto responseInfo = RequestWithoutRetry(context, mutationId, header, body, config);
402-
return NodeFromYsonString(responseInfo->GetResponse(), ::NYson::EYsonType::ListFragment).AsList();
403-
}
404-
405-
void DeleteRows(
406-
const TClientContext& context,
407-
const TYPath& path,
408-
const TNode::TListType& keys,
409-
const TDeleteRowsOptions& options)
410-
{
411-
TMutationId mutationId;
412-
THttpHeader header("PUT", "delete_rows");
413-
header.SetInputFormat(TFormat::YsonBinary());
414-
header.MergeParameters(NRawClient::SerializeParametersForDeleteRows(context.Config->Prefix, path, options));
415-
416-
auto body = NodeListToYsonString(keys);
417-
TRequestConfig config;
418-
config.IsHeavy = true;
419-
RequestWithoutRetry(context, mutationId, header, body, config)->GetResponse();
420-
}
421-
422359
TAuthorizationInfo WhoAmI(const TClientContext& context)
423360
{
424361
TMutationId mutationId;

yt/cpp/mapreduce/http_client/raw_requests.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,6 @@ std::unique_ptr<IOutputStream> WriteTable(
5555
const TMaybe<TFormat>& format,
5656
const TTableWriterOptions& options);
5757

58-
void InsertRows(
59-
const TClientContext& context,
60-
const TYPath& path,
61-
const TNode::TListType& rows,
62-
const TInsertRowsOptions& options);
63-
64-
TNode::TListType LookupRows(
65-
const TClientContext& context,
66-
const TYPath& path,
67-
const TNode::TListType& keys,
68-
const TLookupRowsOptions& options);
69-
70-
void DeleteRows(
71-
const TClientContext& context,
72-
const TYPath& path,
73-
const TNode::TListType& keys,
74-
const TDeleteRowsOptions& options);
75-
7658
TAuthorizationInfo WhoAmI(const TClientContext& context);
7759

7860
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)