batch_request_impl.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #pragma once
  2. #include <yt/cpp/mapreduce/interface/batch_request.h>
  3. #include <yt/cpp/mapreduce/interface/fwd.h>
  4. #include <yt/cpp/mapreduce/interface/node.h>
  5. #include <yt/cpp/mapreduce/http/requests.h>
  6. #include <library/cpp/threading/future/future.h>
  7. #include <util/generic/ptr.h>
  8. #include <util/generic/deque.h>
  9. #include <exception>
  10. namespace NYT {
  11. namespace NDetail {
  12. ////////////////////////////////////////////////////////////////////////////////
  13. struct TResponseInfo;
  14. class TClient;
  15. using TClientPtr = ::TIntrusivePtr<TClient>;
  16. namespace NRawClient {
  17. class TRawBatchRequest;
  18. }
  19. ////////////////////////////////////////////////////////////////////////////////
  20. class TBatchRequest
  21. : public IBatchRequest
  22. {
  23. public:
  24. TBatchRequest(const TTransactionId& defaultTransaction, ::TIntrusivePtr<TClient> client);
  25. ~TBatchRequest();
  26. virtual IBatchRequestBase& WithTransaction(const TTransactionId& transactionId) override;
  27. virtual ::NThreading::TFuture<TLockId> Create(
  28. const TYPath& path,
  29. ENodeType type,
  30. const TCreateOptions& options = TCreateOptions()) override;
  31. virtual ::NThreading::TFuture<void> Remove(
  32. const TYPath& path,
  33. const TRemoveOptions& options = TRemoveOptions()) override;
  34. virtual ::NThreading::TFuture<bool> Exists(
  35. const TYPath& path,
  36. const TExistsOptions& options = TExistsOptions()) override;
  37. virtual ::NThreading::TFuture<TNode> Get(
  38. const TYPath& path,
  39. const TGetOptions& options = TGetOptions()) override;
  40. virtual ::NThreading::TFuture<void> Set(
  41. const TYPath& path,
  42. const TNode& node,
  43. const TSetOptions& options = TSetOptions()) override;
  44. virtual ::NThreading::TFuture<TNode::TListType> List(
  45. const TYPath& path,
  46. const TListOptions& options = TListOptions()) override;
  47. virtual ::NThreading::TFuture<TNodeId> Copy(
  48. const TYPath& sourcePath,
  49. const TYPath& destinationPath,
  50. const TCopyOptions& options = TCopyOptions()) override;
  51. virtual ::NThreading::TFuture<TNodeId> Move(
  52. const TYPath& sourcePath,
  53. const TYPath& destinationPath,
  54. const TMoveOptions& options = TMoveOptions()) override;
  55. virtual ::NThreading::TFuture<TNodeId> Link(
  56. const TYPath& targetPath,
  57. const TYPath& linkPath,
  58. const TLinkOptions& options = TLinkOptions()) override;
  59. virtual ::NThreading::TFuture<ILockPtr> Lock(
  60. const TYPath& path,
  61. ELockMode mode,
  62. const TLockOptions& options) override;
  63. virtual ::NThreading::TFuture<void> Unlock(
  64. const TYPath& path,
  65. const TUnlockOptions& options) override;
  66. virtual ::NThreading::TFuture<void> AbortOperation(const TOperationId& operationId) override;
  67. virtual ::NThreading::TFuture<void> CompleteOperation(const TOperationId& operationId) override;
  68. ::NThreading::TFuture<void> SuspendOperation(
  69. const TOperationId& operationId,
  70. const TSuspendOperationOptions& options) override;
  71. ::NThreading::TFuture<void> ResumeOperation(
  72. const TOperationId& operationId,
  73. const TResumeOperationOptions& options) override;
  74. virtual ::NThreading::TFuture<void> UpdateOperationParameters(
  75. const TOperationId& operationId,
  76. const TUpdateOperationParametersOptions& options) override;
  77. virtual ::NThreading::TFuture<TRichYPath> CanonizeYPath(const TRichYPath& path) override;
  78. virtual ::NThreading::TFuture<TVector<TTableColumnarStatistics>> GetTableColumnarStatistics(
  79. const TVector<TRichYPath>& paths,
  80. const TGetTableColumnarStatisticsOptions& options) override;
  81. ::NThreading::TFuture<TCheckPermissionResponse> CheckPermission(
  82. const TString& user,
  83. EPermission permission,
  84. const TYPath& path,
  85. const TCheckPermissionOptions& options) override;
  86. virtual void ExecuteBatch(const TExecuteBatchOptions& executeBatch) override;
  87. private:
  88. TBatchRequest(NDetail::NRawClient::TRawBatchRequest* impl, ::TIntrusivePtr<TClient> client);
  89. private:
  90. TTransactionId DefaultTransaction_;
  91. ::TIntrusivePtr<NDetail::NRawClient::TRawBatchRequest> Impl_;
  92. THolder<TBatchRequest> TmpWithTransaction_;
  93. ::TIntrusivePtr<TClient> Client_;
  94. private:
  95. friend class NYT::NDetail::TClient;
  96. };
  97. ////////////////////////////////////////////////////////////////////////////////
  98. } // namespace NDetail
  99. } // namespace NYT