summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/http_client/raw_client.cpp
diff options
context:
space:
mode:
authorachains <[email protected]>2025-08-28 13:27:48 +0300
committerachains <[email protected]>2025-08-28 13:47:27 +0300
commit77ea11423f959e51795cc3ef36a48d808b4ffb98 (patch)
tree779bbe91b4a23bc8d729260203f9bdf7f6e31d29 /yt/cpp/mapreduce/http_client/raw_client.cpp
parent20d1c4dc5dd3136b9b4fc6cd3498c1e43a98c83c (diff)
YT-23616: support rpc write table
* Changelog entry Type: feature Component: cpp-sdk Support write table via RPC Proxy in C\+\+ client commit_hash:fccc00849eafded757e3f1332da1fe209a127ec9
Diffstat (limited to 'yt/cpp/mapreduce/http_client/raw_client.cpp')
-rw-r--r--yt/cpp/mapreduce/http_client/raw_client.cpp45
1 files changed, 10 insertions, 35 deletions
diff --git a/yt/cpp/mapreduce/http_client/raw_client.cpp b/yt/cpp/mapreduce/http_client/raw_client.cpp
index d2c64257222..48b0265f087 100644
--- a/yt/cpp/mapreduce/http_client/raw_client.cpp
+++ b/yt/cpp/mapreduce/http_client/raw_client.cpp
@@ -748,6 +748,15 @@ TNode::TListType THttpRawClient::SelectRows(
return NodeFromYsonString(responseInfo->GetResponse(), ::NYson::EYsonType::ListFragment).AsList();
}
+std::unique_ptr<IOutputStream> THttpRawClient::WriteTable(
+ const TTransactionId& transactionId,
+ const TRichYPath& path,
+ const TMaybe<TFormat>& format,
+ const TTableWriterOptions& options)
+{
+ return NRawClient::WriteTable(Context_, transactionId, path, format, options);
+}
+
std::unique_ptr<IInputStream> THttpRawClient::ReadTable(
const TTransactionId& transactionId,
const TRichYPath& path,
@@ -767,46 +776,12 @@ std::unique_ptr<IInputStream> THttpRawClient::ReadTable(
return std::make_unique<NHttpClient::THttpResponseStream>(std::move(responseInfo));
}
-struct THttpRequestStream
- : public IOutputStream
-{
-public:
- THttpRequestStream(NHttpClient::IHttpRequestPtr request)
- : Request_(std::move(request))
- , Underlying_(Request_->GetStream())
- { }
-
-private:
- void DoWrite(const void* buf, size_t len) override
- {
- Underlying_->Write(buf, len);
- }
-
- void DoFinish() override
- {
- Underlying_->Finish();
- Request_->Finish()->GetResponse();
- }
-
-private:
- NHttpClient::IHttpRequestPtr Request_;
- IOutputStream* Underlying_;
-};
-
std::unique_ptr<IOutputStream> THttpRawClient::WriteFile(
const TTransactionId& transactionId,
const TRichYPath& path,
const TFileWriterOptions& options)
{
- THttpHeader header("PUT", GetWriteFileCommand(Context_.Config->ApiVersion));
- header.AddTransactionId(transactionId);
- header.SetRequestCompression(ToString(Context_.Config->ContentEncoding));
- header.MergeParameters(FormIORequestParameters(path, options));
-
- TRequestConfig config;
- config.IsHeavy = true;
- auto request = StartRequestWithoutRetry(Context_, header, config);
- return std::make_unique<THttpRequestStream>(std::move(request));
+ return NRawClient::WriteFile(Context_, transactionId, path, options);
}
std::unique_ptr<IInputStream> THttpRawClient::ReadTablePartition(