1111#include " util/log_util.h"
1212
1313namespace qcloud_cos {
14+
15+ #define COS_DEFAULT_MAX_RETRY_TIMES 3
16+
17+ #define COS_DEFAULT_RETRY_INTERVAL_MS 100
18+
1419class CosConfig {
1520 public:
1621 // / \brief CosConfig构造函数
@@ -31,7 +36,9 @@ class CosConfig {
3136 m_dest_domain(" " ),
3237 m_is_domain_same_to_host(false ),
3338 m_is_domain_same_to_host_enable(false ),
34- m_config_parsed(false ) {}
39+ m_config_parsed(false ),
40+ m_max_retry_times(COS_DEFAULT_MAX_RETRY_TIMES),
41+ m_retry_interval_ms(COS_DEFAULT_RETRY_INTERVAL_MS) {}
3542
3643 // / \brief CosConfig构造函数
3744 // /
@@ -52,7 +59,9 @@ class CosConfig {
5259 m_dest_domain(" " ),
5360 m_is_domain_same_to_host(false ),
5461 m_is_domain_same_to_host_enable(false ),
55- m_config_parsed(false ) {}
62+ m_config_parsed(false ),
63+ m_max_retry_times(COS_DEFAULT_MAX_RETRY_TIMES),
64+ m_retry_interval_ms(COS_DEFAULT_RETRY_INTERVAL_MS) {}
5665
5766 // / \brief CosConfig构造函数
5867 // /
@@ -74,7 +83,9 @@ class CosConfig {
7483 m_dest_domain(" " ),
7584 m_is_domain_same_to_host(false ),
7685 m_is_domain_same_to_host_enable(false ),
77- m_config_parsed(false ) {}
86+ m_config_parsed(false ),
87+ m_max_retry_times(COS_DEFAULT_MAX_RETRY_TIMES),
88+ m_retry_interval_ms(COS_DEFAULT_RETRY_INTERVAL_MS) {}
7889
7990 // / \brief CosConfig复制构造函数
8091 // /
@@ -92,6 +103,8 @@ class CosConfig {
92103 m_is_domain_same_to_host = config.m_is_domain_same_to_host ;
93104 m_is_domain_same_to_host_enable = config.m_is_domain_same_to_host ;
94105 m_config_parsed = config.m_config_parsed ;
106+ m_max_retry_times = config.m_max_retry_times ;
107+ m_retry_interval_ms = config.m_retry_interval_ms ;
95108 }
96109
97110 // / \brief CosConfig赋值构造函数
@@ -110,6 +123,8 @@ class CosConfig {
110123 m_is_domain_same_to_host = config.m_is_domain_same_to_host ;
111124 m_is_domain_same_to_host_enable = config.m_is_domain_same_to_host ;
112125 m_config_parsed = config.m_config_parsed ;
126+ m_max_retry_times = config.m_max_retry_times ;
127+ m_retry_interval_ms = config.m_retry_interval_ms ;
113128 return *this ;
114129 }
115130
@@ -198,6 +213,14 @@ class CosConfig {
198213 // / \brief 设置日志回调
199214 void SetLogCallback (const LogCallback log_callback);
200215
216+ uint64_t GetMaxRetryTimes () const ;
217+
218+ void SetMaxRetryTimes (uint64_t max_retry_times);
219+
220+ uint64_t GetRetryIntervalMs () const ;
221+
222+ void SetRetryIntervalMs (uint64_t retry_interval_ms);
223+
201224 static bool JsonObjectGetStringValue (
202225 const Poco::JSON::Object::Ptr& json_object, const std::string& key,
203226 std::string* value);
@@ -222,6 +245,8 @@ class CosConfig {
222245 bool m_is_domain_same_to_host;
223246 bool m_is_domain_same_to_host_enable;
224247 bool m_config_parsed;
248+ uint64_t m_max_retry_times;
249+ uint64_t m_retry_interval_ms;
225250};
226251
227252typedef std::shared_ptr<CosConfig> SharedConfig;
0 commit comments