Home | History | Annotate | Download | only in engine
      1 // Copyright (c) 2012 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 SYNC_ENGINE_STORE_TIMESTAMPS_COMMAND_H_
      6 #define SYNC_ENGINE_STORE_TIMESTAMPS_COMMAND_H_
      7 
      8 #include "base/compiler_specific.h"
      9 #include "sync/base/sync_export.h"
     10 #include "sync/engine/syncer_command.h"
     11 #include "sync/engine/syncer_types.h"
     12 #include "sync/internal_api/public/base/model_type.h"
     13 
     14 namespace sync_pb {
     15 class GetUpdatesResponse;
     16 }  // namespace sync_pb
     17 
     18 namespace syncer {
     19 
     20 namespace syncable {
     21 class Directory;
     22 }  // namespace syncable
     23 
     24 // Sets |dir|'s progress markers from the data in |response|.  Returns
     25 // the set of model types with new progress markers.
     26 SYNC_EXPORT_PRIVATE ModelTypeSet ProcessNewProgressMarkers(
     27     const sync_pb::GetUpdatesResponse& response,
     28     syncable::Directory* dir);
     29 
     30 // A syncer command that extracts the changelog timestamp information from
     31 // a GetUpdatesResponse (fetched in DownloadUpdatesCommand) and stores
     32 // it in the directory.  This is meant to run immediately after
     33 // ProcessUpdatesCommand.
     34 //
     35 // Preconditions - all updates in the SyncerSesssion have been stored in the
     36 //                 database, meaning it is safe to update the persisted
     37 //                 timestamps.
     38 //
     39 // Postconditions - The next_timestamp returned by the server will be
     40 //                  saved into the directory (where it will be used
     41 //                  the next time that DownloadUpdatesCommand runs).
     42 class StoreTimestampsCommand : public SyncerCommand {
     43  public:
     44   StoreTimestampsCommand();
     45   virtual ~StoreTimestampsCommand();
     46 
     47   // SyncerCommand implementation.
     48   virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE;
     49 
     50  private:
     51   DISALLOW_COPY_AND_ASSIGN(StoreTimestampsCommand);
     52 };
     53 
     54 }  // namespace syncer
     55 
     56 #endif  // SYNC_ENGINE_STORE_TIMESTAMPS_COMMAND_H_
     57