#pragma once #include "raw_batch_request.h" #include #include #include #include #include #include namespace NYT { //////////////////////////////////////////////////////////////////////////////// class IRequestRetryPolicy; struct TClientContext; struct TExecuteBatchOptions; //////////////////////////////////////////////////////////////////////////////// namespace NDetail::NRawClient { //////////////////////////////////////////////////////////////////////////////// TOperationAttributes ParseOperationAttributes(const TNode& node); TJobAttributes ParseJobAttributes(const TNode& node); TCheckPermissionResponse ParseCheckPermissionResponse(const TNode& node); //////////////////////////////////////////////////////////////////////////////// TRichYPath CanonizeYPath( const IRawClientPtr& rawClient, const TRichYPath& path); TVector CanonizeYPaths( const IRawClientPtr& rawClient, const TVector& paths); NHttpClient::IHttpResponsePtr SkyShareTable( const TClientContext& context, const std::vector& tablePaths, const TSkyShareTableOptions& options); TAuthorizationInfo WhoAmI(const TClientContext& context); //////////////////////////////////////////////////////////////////////////////// template auto BatchTransform( const IRawClientPtr& rawClient, const TSrc& src, TBatchAdder batchAdder, const TExecuteBatchOptions& executeBatchOptions = {}) { auto batch = rawClient->CreateRawBatchRequest(); using TFuture = decltype(batchAdder(batch, *std::begin(src))); TVector futures; for (const auto& el : src) { futures.push_back(batchAdder(batch, el)); } batch->ExecuteBatch(executeBatchOptions); using TDst = decltype(futures[0].ExtractValueSync()); TVector result; result.reserve(std::size(src)); for (auto& future : futures) { result.push_back(future.ExtractValueSync()); } return result; } //////////////////////////////////////////////////////////////////////////////// } // namespace NDetail::NRawClient } // namespace NYT