Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: components/sync/engine_impl/cycle/nudge_tracker.h

Issue 2475043002: [Sync] Sync client should to exponential backoff when receive partial failure (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_
6 #define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ 6 #define COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // These functions should be called to keep this class informed of the status 77 // These functions should be called to keep this class informed of the status
78 // of the connection to the invalidations server. 78 // of the connection to the invalidations server.
79 void OnInvalidationsEnabled(); 79 void OnInvalidationsEnabled();
80 void OnInvalidationsDisabled(); 80 void OnInvalidationsDisabled();
81 81
82 // Marks |types| as being throttled from |now| until |now| + |length|. 82 // Marks |types| as being throttled from |now| until |now| + |length|.
83 void SetTypesThrottledUntil(ModelTypeSet types, 83 void SetTypesThrottledUntil(ModelTypeSet types,
84 base::TimeDelta length, 84 base::TimeDelta length,
85 base::TimeTicks now); 85 base::TimeTicks now);
86 86
87 // Removes any throttling that have expired by time |now|. 87 // Marks |type| as being backed off from |now| until |now| + |length|.
88 void UpdateTypeThrottlingState(base::TimeTicks now); 88 void SetTypeBackedOff(ModelType type,
89 base::TimeDelta length,
90 base::TimeTicks now);
89 91
90 // Returns the time of the next type unthrottling, relative to 92 // Removes any throttling and backoff that have expired.
91 // the input |now| value. 93 void UpdateTypeThrottlingAndBackoffState();
92 base::TimeDelta GetTimeUntilNextUnthrottle(base::TimeTicks now) const;
93 94
94 // Returns true if any type is currenlty throttled. 95 // Returns the time of the next type unthrottling or unbackoff.
95 bool IsAnyTypeThrottled() const; 96 base::TimeDelta GetTimeUntilNextUnblock() const;
96 97
97 // Returns true if |type| is currently throttled. 98 // Returns the time of for type last backing off interval.
98 bool IsTypeThrottled(ModelType type) const; 99 base::TimeDelta GetTypeLastBackoffInterval(ModelType type) const;
99 100
100 // Returns the set of currently throttled types. 101 // Returns true if any type is currenlty throttled or backed off.
101 ModelTypeSet GetThrottledTypes() const; 102 bool IsAnyTypeBlocked() const;
103
104 // Returns true if |type| is currently blocked.
105 bool IsTypeBlocked(ModelType type) const;
106
107 // Returns |type|'s blocking mode.
108 WaitInterval::BlockingMode GetTypeBlockingMode(ModelType type) const;
109
110 // Returns the set of currently throttled or backed off types.
111 ModelTypeSet GetBlockedTypes() const;
102 112
103 // Returns the set of types with local changes pending. 113 // Returns the set of types with local changes pending.
104 ModelTypeSet GetNudgedTypes() const; 114 ModelTypeSet GetNudgedTypes() const;
105 115
106 // Returns the set of types that have pending invalidations. 116 // Returns the set of types that have pending invalidations.
107 ModelTypeSet GetNotifiedTypes() const; 117 ModelTypeSet GetNotifiedTypes() const;
108 118
109 // Returns the set of types that have pending refresh requests. 119 // Returns the set of types that have pending refresh requests.
110 ModelTypeSet GetRefreshRequestedTypes() const; 120 ModelTypeSet GetRefreshRequestedTypes() const;
111 121
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Update the per-datatype local change nudge delays. 161 // Update the per-datatype local change nudge delays.
152 void OnReceivedCustomNudgeDelays( 162 void OnReceivedCustomNudgeDelays(
153 const std::map<ModelType, base::TimeDelta>& delay_map); 163 const std::map<ModelType, base::TimeDelta>& delay_map);
154 164
155 // Update the default nudge delay. 165 // Update the default nudge delay.
156 void SetDefaultNudgeDelay(base::TimeDelta nudge_delay); 166 void SetDefaultNudgeDelay(base::TimeDelta nudge_delay);
157 167
158 private: 168 private:
159 using TypeTrackerMap = std::map<ModelType, std::unique_ptr<DataTypeTracker>>; 169 using TypeTrackerMap = std::map<ModelType, std::unique_ptr<DataTypeTracker>>;
160 170
171 friend class SyncSchedulerImplTest;
172
161 TypeTrackerMap type_trackers_; 173 TypeTrackerMap type_trackers_;
162 174
163 // Tracks whether or not invalidations are currently enabled. 175 // Tracks whether or not invalidations are currently enabled.
164 bool invalidations_enabled_; 176 bool invalidations_enabled_;
165 177
166 // This flag is set if suspect that some technical malfunction or known bug 178 // This flag is set if suspect that some technical malfunction or known bug
167 // may have left us with some unserviced invalidations. 179 // may have left us with some unserviced invalidations.
168 // 180 //
169 // Keeps track of whether or not we're fully in sync with the invalidation 181 // Keeps track of whether or not we're fully in sync with the invalidation
170 // server. This can be false even if invalidations are enabled and working 182 // server. This can be false even if invalidations are enabled and working
(...skipping 26 matching lines...) Expand all
197 base::TimeDelta minimum_local_nudge_delay_; 209 base::TimeDelta minimum_local_nudge_delay_;
198 base::TimeDelta local_refresh_nudge_delay_; 210 base::TimeDelta local_refresh_nudge_delay_;
199 base::TimeDelta remote_invalidation_nudge_delay_; 211 base::TimeDelta remote_invalidation_nudge_delay_;
200 212
201 DISALLOW_COPY_AND_ASSIGN(NudgeTracker); 213 DISALLOW_COPY_AND_ASSIGN(NudgeTracker);
202 }; 214 };
203 215
204 } // namespace syncer 216 } // namespace syncer
205 217
206 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_ 218 #endif // COMPONENTS_SYNC_ENGINE_IMPL_CYCLE_NUDGE_TRACKER_H_
OLDNEW
« no previous file with comments | « components/sync/engine_impl/cycle/data_type_tracker.cc ('k') | components/sync/engine_impl/cycle/nudge_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698