OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_SYNC_SCHEDULER_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_SYNC_SCHEDULER_H |
6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_SYNC_SCHEDULER_H | 6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_SYNC_SCHEDULER_H |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 | 13 |
14 namespace proximity_auth { | 14 namespace cryptauth { |
15 | 15 |
16 // Interface for scheduling the next CryptAuth sync (e.g. enrollment or device | 16 // Interface for scheduling the next CryptAuth sync (e.g. enrollment or device |
17 // sync). The scheduler has two different strategies affecting when to perform | 17 // sync). The scheduler has two different strategies affecting when to perform |
18 // the next operation: | 18 // the next operation: |
19 // PERIODIC_REFRESH: The last sync was made successfully, so we can wait a | 19 // PERIODIC_REFRESH: The last sync was made successfully, so we can wait a |
20 // relatively long time before making another sync. | 20 // relatively long time before making another sync. |
21 // AGGRESSIVE_RECOVERY: The last sync failed, so we try more aggressively to | 21 // AGGRESSIVE_RECOVERY: The last sync failed, so we try more aggressively to |
22 // make enrollment attempts with subsequent backoff for repeated | 22 // make enrollment attempts with subsequent backoff for repeated |
23 // failures. | 23 // failures. |
24 // A random jitter is applied to each sync period to smooth qps to the server. | 24 // A random jitter is applied to each sync period to smooth qps to the server. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 virtual Strategy GetStrategy() const = 0; | 86 virtual Strategy GetStrategy() const = 0; |
87 | 87 |
88 // Returns the current state of the scheduler. | 88 // Returns the current state of the scheduler. |
89 virtual SyncState GetSyncState() const = 0; | 89 virtual SyncState GetSyncState() const = 0; |
90 | 90 |
91 protected: | 91 protected: |
92 // Called by SyncRequest instances when the sync completes. | 92 // Called by SyncRequest instances when the sync completes. |
93 virtual void OnSyncCompleted(bool success) = 0; | 93 virtual void OnSyncCompleted(bool success) = 0; |
94 }; | 94 }; |
95 | 95 |
96 } // namespace proximity_auth | 96 } // namespace cryptauth |
97 | 97 |
98 #endif // COMPONENTS_PROXIMITY_CRYPTAUTH_SYNC_SCHEDULER_H | 98 #endif // COMPONENTS_PROXIMITY_CRYPTAUTH_SYNC_SCHEDULER_H |
OLD | NEW |