file_copy_task.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include <stdint.h>
  3. #include <map>
  4. #include <string>
  5. #include "Poco/Foundation.h"
  6. #include "Poco/Runnable.h"
  7. namespace qcloud_cos {
  8. class FileCopyTask : public Poco::Runnable {
  9. public:
  10. FileCopyTask(const std::string& full_url, uint64_t conn_timeout_in_ms,
  11. uint64_t recv_timeout_in_ms);
  12. ~FileCopyTask() {}
  13. void run();
  14. void CopyTask();
  15. bool IsTaskSuccess() const;
  16. int GetHttpStatus() const;
  17. std::string GetTaskResp() const;
  18. std::map<std::string, std::string> GetRespHeaders() const;
  19. void SetParams(const std::map<std::string, std::string>& params);
  20. void SetHeaders(const std::map<std::string, std::string>& headers);
  21. void SetVerifyCert(bool verify_cert);
  22. void SetCaLocation(const std::string& ca_location);
  23. std::string GetErrMsg() const { return m_err_msg; }
  24. std::string GetEtag() const { return m_etag; }
  25. std::string GetLastModified() const { return m_last_modified; }
  26. private:
  27. std::string m_full_url;
  28. std::map<std::string, std::string> m_headers;
  29. std::map<std::string, std::string> m_params;
  30. uint64_t m_conn_timeout_in_ms;
  31. uint64_t m_recv_timeout_in_ms;
  32. std::string m_resp;
  33. bool m_is_task_success;
  34. int m_http_status;
  35. std::map<std::string, std::string> m_resp_headers;
  36. std::string m_err_msg;
  37. std::string m_etag;
  38. std::string m_last_modified;
  39. bool m_verify_cert;
  40. std::string m_ca_location;
  41. };
  42. } // namespace qcloud_cos