aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/raw_client
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-12-13 10:22:13 +0000
committerGitHub <noreply@github.com>2024-12-13 10:22:13 +0000
commite73e490feb4e1f63d097697324aa48b643a62317 (patch)
treef63fe3d15819a5148ade51609c5211251d93e425 /yt/cpp/mapreduce/raw_client
parent19346460a8060a0ed4731edb192745642ff34b3d (diff)
parent4dde77404d1eae4a633d1cc3807142409a9938eb (diff)
downloadydb-e73e490feb4e1f63d097697324aa48b643a62317.tar.gz
Merge pull request #12582 from vitalyisaev2/rightlib_20241212
Merge rightlib 20241212
Diffstat (limited to 'yt/cpp/mapreduce/raw_client')
-rw-r--r--yt/cpp/mapreduce/raw_client/raw_client.cpp33
-rw-r--r--yt/cpp/mapreduce/raw_client/raw_client.h33
-rw-r--r--yt/cpp/mapreduce/raw_client/raw_requests.cpp9
-rw-r--r--yt/cpp/mapreduce/raw_client/raw_requests.h8
-rw-r--r--yt/cpp/mapreduce/raw_client/ya.make1
5 files changed, 73 insertions, 11 deletions
diff --git a/yt/cpp/mapreduce/raw_client/raw_client.cpp b/yt/cpp/mapreduce/raw_client/raw_client.cpp
new file mode 100644
index 0000000000..9a8a9fca84
--- /dev/null
+++ b/yt/cpp/mapreduce/raw_client/raw_client.cpp
@@ -0,0 +1,33 @@
+#include "raw_client.h"
+
+#include "rpc_parameters_serialization.h"
+
+#include <yt/cpp/mapreduce/http/http.h>
+#include <yt/cpp/mapreduce/http/retry_request.h>
+
+#include <library/cpp/yson/node/node_io.h>
+
+namespace NYT::NDetail {
+
+////////////////////////////////////////////////////////////////////////////////
+
+THttpRawClient::THttpRawClient(const TClientContext& context)
+ : Context_(context)
+{ }
+
+void THttpRawClient::Set(
+ TMutationId& mutationId,
+ const TTransactionId& transactionId,
+ const TYPath& path,
+ const TNode& value,
+ const TSetOptions& options)
+{
+ THttpHeader header("PUT", "set");
+ header.MergeParameters(NRawClient::SerializeParamsForSet(transactionId, Context_.Config->Prefix, path, options));
+ auto body = NodeToYsonString(value);
+ RequestWithoutRetry(Context_, mutationId, header, body);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT::NDetail
diff --git a/yt/cpp/mapreduce/raw_client/raw_client.h b/yt/cpp/mapreduce/raw_client/raw_client.h
new file mode 100644
index 0000000000..def521a918
--- /dev/null
+++ b/yt/cpp/mapreduce/raw_client/raw_client.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <yt/cpp/mapreduce/http/context.h>
+
+#include <yt/cpp/mapreduce/interface/client_method_options.h>
+#include <yt/cpp/mapreduce/interface/raw_client.h>
+
+namespace NYT::NDetail {
+
+////////////////////////////////////////////////////////////////////////////////
+
+class THttpRawClient
+ : public IRawClient
+{
+public:
+ THttpRawClient(const TClientContext& context);
+
+ // Cypress
+
+ void Set(
+ TMutationId& mutationId,
+ const TTransactionId& transactionId,
+ const TYPath& path,
+ const TNode& value,
+ const TSetOptions& options = {}) override;
+
+private:
+ const TClientContext Context_;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT::NDetail
diff --git a/yt/cpp/mapreduce/raw_client/raw_requests.cpp b/yt/cpp/mapreduce/raw_client/raw_requests.cpp
index 0b7bcf2c66..d10c818489 100644
--- a/yt/cpp/mapreduce/raw_client/raw_requests.cpp
+++ b/yt/cpp/mapreduce/raw_client/raw_requests.cpp
@@ -173,9 +173,10 @@ TNodeId CopyWithoutRetries(
const TCopyOptions& options)
{
THttpHeader header("POST", "copy");
+ TMutationId mutationId;
header.AddMutationId();
header.MergeParameters(SerializeParamsForCopy(transactionId, context.Config->Prefix, sourcePath, destinationPath, options));
- return ParseGuidFromResponse(RequestWithoutRetry(context, header).Response);
+ return ParseGuidFromResponse(RequestWithoutRetry(context, mutationId, header).Response);
}
TNodeId CopyInsideMasterCell(
@@ -204,9 +205,10 @@ TNodeId MoveWithoutRetries(
const TMoveOptions& options)
{
THttpHeader header("POST", "move");
+ TMutationId mutationId;
header.AddMutationId();
header.MergeParameters(SerializeParamsForMove(transactionId, context.Config->Prefix, sourcePath, destinationPath, options));
- return ParseGuidFromResponse(RequestWithoutRetry( context, header).Response);
+ return ParseGuidFromResponse(RequestWithoutRetry(context, mutationId, header).Response);
}
TNodeId MoveInsideMasterCell(
@@ -309,9 +311,10 @@ void Concatenate(
const TConcatenateOptions& options)
{
THttpHeader header("POST", "concatenate");
+ TMutationId mutationId;
header.AddMutationId();
header.MergeParameters(SerializeParamsForConcatenate(transactionId, context.Config->Prefix, sourcePaths, destinationPath, options));
- RequestWithoutRetry(context, header);
+ RequestWithoutRetry(context, mutationId, header);
}
void PingTx(
diff --git a/yt/cpp/mapreduce/raw_client/raw_requests.h b/yt/cpp/mapreduce/raw_client/raw_requests.h
index 0a183d617c..8cb226ab86 100644
--- a/yt/cpp/mapreduce/raw_client/raw_requests.h
+++ b/yt/cpp/mapreduce/raw_client/raw_requests.h
@@ -53,14 +53,6 @@ TNode TryGet(
const TYPath& path,
const TGetOptions& options);
-void Set(
- const IRequestRetryPolicyPtr& retryPolicy,
- const TClientContext& context,
- const TTransactionId& transactionId,
- const TYPath& path,
- const TNode& value,
- const TSetOptions& options = TSetOptions());
-
void MultisetAttributes(
const IRequestRetryPolicyPtr& retryPolicy,
const TClientContext& context,
diff --git a/yt/cpp/mapreduce/raw_client/ya.make b/yt/cpp/mapreduce/raw_client/ya.make
index c201b86f05..a038b2931f 100644
--- a/yt/cpp/mapreduce/raw_client/ya.make
+++ b/yt/cpp/mapreduce/raw_client/ya.make
@@ -4,6 +4,7 @@ INCLUDE(${ARCADIA_ROOT}/yt/ya_cpp.make.inc)
SRCS(
raw_batch_request.cpp
+ raw_client.cpp
raw_requests.cpp
rpc_parameters_serialization.cpp
)