OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SYNC_RETRY_VERIFIER_H_ | |
6 #define CHROME_BROWSER_SYNC_RETRY_VERIFIER_H_ | |
7 #pragma once | |
8 | |
9 | |
Raghu Simha
2011/08/05 18:04:52
Delete extra blank line.
lipalani1
2011/08/05 21:33:57
Done.
| |
10 #include "base/time.h" | |
11 | |
12 | |
Raghu Simha
2011/08/05 18:04:52
Delete extra blank line.
lipalani1
2011/08/05 21:33:57
Done.
| |
13 namespace browser_sync { | |
14 namespace sessions { | |
Raghu Simha
2011/08/05 18:04:52
indent -= 2.
lipalani1
2011/08/05 21:33:57
Done.
| |
15 struct SyncSessionSnapshot; | |
Raghu Simha
2011/08/05 18:04:52
indent -= 4.
lipalani1
2011/08/05 21:33:57
Done.
| |
16 } | |
17 } | |
18 | |
19 // The minimum and maximum wait times for a retry. The actual retry would take | |
20 // place somewhere in this range. The algorithm that calculates the retry wait | |
21 // time uses rand functions. | |
22 struct DelayInfo { | |
23 int64 min_delay; | |
24 int64 max_delay; | |
25 }; | |
26 | |
27 // Class to verify retries take place using the exponential backoff algorithm. | |
28 class RetryVerifier { | |
29 public: | |
30 static const int kMaxRetry = 10; | |
31 RetryVerifier(); | |
32 ~RetryVerifier(); | |
33 int RetryCount() const { return retry_count_; } | |
34 void Initialize(const browser_sync::sessions::SyncSessionSnapshot& snap); | |
35 bool VerifyRetryInterval( | |
36 const browser_sync::sessions::SyncSessionSnapshot& snap); | |
37 | |
38 private: | |
39 int retry_count_; | |
40 base::Time last_sync_time_; | |
41 DelayInfo delay_table_[kMaxRetry]; | |
Raghu Simha
2011/08/05 18:04:52
DISALLOW_COPY_AND_ASSIGN(RetryVerifier);
lipalani1
2011/08/05 21:33:57
Done.
| |
42 }; | |
43 | |
44 #endif // CHROME_BROWSER_SYNC_RETRY_VERIFIER_H_ | |
OLD | NEW |