From 3bd4aa5fcb0f9a73ef9fcc548c26a0aa81011981 Mon Sep 17 00:00:00 2001 From: achains Date: Fri, 12 Dec 2025 11:12:23 +0300 Subject: YT-26906: start session from tx * Changelog entry Type: feature Component: cpp-sdk Start distributed session methods (file/table) now support attaching to transaction. commit_hash:0a40dfd6d556f9890fa5abccf29c0baf33df4e7d --- yt/cpp/mapreduce/client/client.cpp | 50 ++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'yt/cpp/mapreduce/client/client.cpp') diff --git a/yt/cpp/mapreduce/client/client.cpp b/yt/cpp/mapreduce/client/client.cpp index 37bf2a509f9..c0fef27be62 100644 --- a/yt/cpp/mapreduce/client/client.cpp +++ b/yt/cpp/mapreduce/client/client.cpp @@ -100,6 +100,30 @@ ITransactionPtr TClientBase::StartTransaction( return MakeIntrusive(RawClient_, GetParentClientImpl(), Context_, TransactionId_, options); } +TDistributedWriteFileSessionWithCookies TClientBase::StartDistributedWriteFileSession( + const TRichYPath& richPath, + i64 cookieCount, + const TStartDistributedWriteFileOptions& options) +{ + return RequestWithRetry( + ClientRetryPolicy_->CreatePolicyForGenericRequest(), + [this, cookieCount, &richPath, &options] (TMutationId& mutationId) { + return RawClient_->StartDistributedWriteFileSession(mutationId, TransactionId_, richPath, cookieCount, options); + }); +} + +TDistributedWriteTableSessionWithCookies TClientBase::StartDistributedWriteTableSession( + const TRichYPath& richPath, + i64 cookieCount, + const TStartDistributedWriteTableOptions& options) +{ + return RequestWithRetry( + ClientRetryPolicy_->CreatePolicyForGenericRequest(), + [this, cookieCount, &richPath, &options] (TMutationId& mutationId) { + return RawClient_->StartDistributedWriteTableSession(mutationId, TransactionId_, richPath, cookieCount, options); + }); +} + TNodeId TClientBase::Create( const TYPath& path, ENodeType type, @@ -1569,19 +1593,6 @@ void TClient::ResumeOperation( }); } -TDistributedWriteTableSessionWithCookies TClient::StartDistributedWriteTableSession( - const TRichYPath& richPath, - i64 cookieCount, - const TStartDistributedWriteTableOptions& options) -{ - CheckShutdown(); - return RequestWithRetry( - ClientRetryPolicy_->CreatePolicyForGenericRequest(), - [this, cookieCount, &richPath, &options] (TMutationId& mutationId) { - return RawClient_->StartDistributedWriteTableSession(mutationId, richPath, cookieCount, options); - }); -} - void TClient::PingDistributedWriteTableSession( const TDistributedWriteTableSession& session, const TPingDistributedWriteTableOptions& options) @@ -1607,19 +1618,6 @@ void TClient::FinishDistributedWriteTableSession( }); } -TDistributedWriteFileSessionWithCookies TClient::StartDistributedWriteFileSession( - const TRichYPath& richPath, - i64 cookieCount, - const TStartDistributedWriteFileOptions& options) -{ - CheckShutdown(); - return RequestWithRetry( - ClientRetryPolicy_->CreatePolicyForGenericRequest(), - [this, cookieCount, &richPath, &options] (TMutationId& mutationId) { - return RawClient_->StartDistributedWriteFileSession(mutationId, richPath, cookieCount, options); - }); -} - void TClient::PingDistributedWriteFileSession( const TDistributedWriteFileSession& session, const TPingDistributedWriteFileOptions& options) -- cgit v1.3