OLD | NEW |
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 """An implementation of the server side of the Chromium sync protocol. | 5 """An implementation of the server side of the Chromium sync protocol. |
6 | 6 |
7 The details of the protocol are described mostly by comments in the protocol | 7 The details of the protocol are described mostly by comments in the protocol |
8 buffer definition at chrome/browser/sync/protocol/sync.proto. | 8 buffer definition at chrome/browser/sync/protocol/sync.proto. |
9 """ | 9 """ |
10 | 10 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 if request.from_progress_marker: | 422 if request.from_progress_marker: |
423 for marker in request.from_progress_marker: | 423 for marker in request.from_progress_marker: |
424 data_type = ProtocolDataTypeIdToSyncType(marker.data_type_id) | 424 data_type = ProtocolDataTypeIdToSyncType(marker.data_type_id) |
425 if marker.HasField('timestamp_token_for_migration'): | 425 if marker.HasField('timestamp_token_for_migration'): |
426 timestamp = marker.timestamp_token_for_migration | 426 timestamp = marker.timestamp_token_for_migration |
427 if timestamp: | 427 if timestamp: |
428 self._migration_versions_to_check[data_type] = 1 | 428 self._migration_versions_to_check[data_type] = 1 |
429 elif marker.token: | 429 elif marker.token: |
430 (timestamp, version) = pickle.loads(marker.token) | 430 (timestamp, version) = pickle.loads(marker.token) |
431 self._migration_versions_to_check[data_type] = version | 431 self._migration_versions_to_check[data_type] = version |
432 elif marker.HasField('token'): | 432 else: |
433 timestamp = 0 | 433 timestamp = 0 |
434 else: | |
435 raise ValueError('No timestamp information in progress marker.') | |
436 data_type = ProtocolDataTypeIdToSyncType(marker.data_type_id) | 434 data_type = ProtocolDataTypeIdToSyncType(marker.data_type_id) |
437 self._state[data_type] = timestamp | 435 self._state[data_type] = timestamp |
438 elif request.HasField('from_timestamp'): | 436 elif request.HasField('from_timestamp'): |
439 for data_type in GetEntryTypesFromSpecifics(request.requested_types): | 437 for data_type in GetEntryTypesFromSpecifics(request.requested_types): |
440 self._state[data_type] = request.from_timestamp | 438 self._state[data_type] = request.from_timestamp |
441 self._migration_versions_to_check[data_type] = 1 | 439 self._migration_versions_to_check[data_type] = 1 |
442 if self._state: | 440 if self._state: |
443 self._state[TOP_LEVEL] = min(self._state.itervalues()) | 441 self._state[TOP_LEVEL] = min(self._state.itervalues()) |
444 | 442 |
445 def SummarizeRequest(self): | 443 def SummarizeRequest(self): |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 | 1640 |
1643 Args: | 1641 Args: |
1644 sessions_commit_delay_seconds: The desired sync delay time for sessions. | 1642 sessions_commit_delay_seconds: The desired sync delay time for sessions. |
1645 """ | 1643 """ |
1646 if not self._client_command: | 1644 if not self._client_command: |
1647 self._client_command = client_commands_pb2.ClientCommand() | 1645 self._client_command = client_commands_pb2.ClientCommand() |
1648 | 1646 |
1649 self._client_command.sessions_commit_delay_seconds = \ | 1647 self._client_command.sessions_commit_delay_seconds = \ |
1650 sessions_commit_delay_seconds | 1648 sessions_commit_delay_seconds |
1651 return self._client_command | 1649 return self._client_command |
OLD | NEW |