async_context.h 933 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "response/object_resp.h"
  3. #include "trsf/transfer_handler.h"
  4. #include <memory>
  5. namespace qcloud_cos {
  6. class AsyncContext {
  7. public:
  8. AsyncContext(const SharedTransferHandler& handler) : m_handler(handler) {}
  9. /// @brief 取消操作
  10. void Cancel() { return m_handler->Cancel(); }
  11. /// @brief 等待操作结束
  12. void WaitUntilFinish() { return m_handler->WaitUntilFinish(); }
  13. std::string GetBucketName() const { return m_handler->GetBucketName(); }
  14. std::string GetObjectName() const { return m_handler->GetObjectName(); }
  15. std::string GetLocalFilePath() const { return m_handler->GetLocalFilePath(); }
  16. /// @brief 获取操作结果
  17. CosResult GetResult() const { return m_handler->GetResult(); }
  18. /// @brief 获取多线程上传响应
  19. AsyncResp GetAsyncResp() const {
  20. return m_handler->GetAsyncResp();
  21. }
  22. private:
  23. SharedTransferHandler m_handler;
  24. };
  25. } // namespace qcloud_cos