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

Unified Diff: sync/sessions/session_state.h

Issue 10933075: FYI: Remove PerModelSafeGroupState + move ConflictResolution (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/internal_api/public/sessions/model_neutral_state.cc ('k') | sync/sessions/session_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/sessions/session_state.h
diff --git a/sync/sessions/session_state.h b/sync/sessions/session_state.h
deleted file mode 100644
index 290ecee05b4face314e2d2f6c0285fe5832a648d..0000000000000000000000000000000000000000
--- a/sync/sessions/session_state.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// The 'sessions' namespace comprises all the pieces of state that are
-// combined to form a SyncSession instance. In that way, it can be thought of
-// as an extension of the SyncSession type itself. Session scoping gives
-// context to things like "conflict progress", "update progress", etc, and the
-// separation this file provides allows clients to only include the parts they
-// need rather than the entire session stack.
-
-#ifndef SYNC_SESSIONS_SESSION_STATE_H_
-#define SYNC_SESSIONS_SESSION_STATE_H_
-
-#include <set>
-#include <vector>
-
-#include "sync/engine/syncer_types.h"
-#include "sync/protocol/sync.pb.h"
-#include "sync/syncable/syncable_id.h"
-
-namespace syncer {
-namespace sessions {
-
-// Tracks progress of conflicts and their resolutions.
-class ConflictProgress {
- public:
- explicit ConflictProgress();
- ~ConflictProgress();
-
- bool HasSimpleConflictItem(const syncable::Id &id) const;
-
- // Various mutators for tracking commit conflicts.
- void AddSimpleConflictingItemById(const syncable::Id& the_id);
- void EraseSimpleConflictingItemById(const syncable::Id& the_id);
- std::set<syncable::Id>::const_iterator SimpleConflictingItemsBegin() const;
- std::set<syncable::Id>::const_iterator SimpleConflictingItemsEnd() const;
- int SimpleConflictingItemsSize() const {
- return simple_conflicting_item_ids_.size();
- }
-
- // Mutators for unresolvable conflicting items (see description below).
- void AddEncryptionConflictingItemById(const syncable::Id& the_id);
- int EncryptionConflictingItemsSize() const {
- return num_encryption_conflicting_items;
- }
-
- void AddHierarchyConflictingItemById(const syncable::Id& id);
- int HierarchyConflictingItemsSize() const {
- return num_hierarchy_conflicting_items;
- }
-
- void AddServerConflictingItemById(const syncable::Id& id);
- int ServerConflictingItemsSize() const {
- return num_server_conflicting_items;
- }
-
- private:
- // Conflicts that occur when local and server changes collide and can be
- // resolved locally.
- std::set<syncable::Id> simple_conflicting_item_ids_;
-
- // Unresolvable conflicts are not processed by the conflict resolver. We wait
- // and hope the server will provide us with an update that resolves these
- // conflicts.
- std::set<syncable::Id> unresolvable_conflicting_item_ids_;
-
- size_t num_server_conflicting_items;
- size_t num_hierarchy_conflicting_items;
- size_t num_encryption_conflicting_items;
-};
-
-typedef std::pair<VerifyResult, sync_pb::SyncEntity> VerifiedUpdate;
-typedef std::pair<UpdateAttemptResponse, syncable::Id> AppliedUpdate;
-
-// Tracks update application and verification.
-class UpdateProgress {
- public:
- UpdateProgress();
- ~UpdateProgress();
-
- void AddVerifyResult(const VerifyResult& verify_result,
- const sync_pb::SyncEntity& entity);
-
- // Log a successful or failing update attempt.
- void AddAppliedUpdate(const UpdateAttemptResponse& response,
- const syncable::Id& id);
-
- // Various iterators.
- std::vector<AppliedUpdate>::iterator AppliedUpdatesBegin();
- std::vector<VerifiedUpdate>::const_iterator VerifiedUpdatesBegin() const;
- std::vector<AppliedUpdate>::const_iterator AppliedUpdatesEnd() const;
- std::vector<VerifiedUpdate>::const_iterator VerifiedUpdatesEnd() const;
-
- // Returns the number of update application attempts. This includes both
- // failures and successes.
- int AppliedUpdatesSize() const { return applied_updates_.size(); }
- int VerifiedUpdatesSize() const { return verified_updates_.size(); }
- bool HasVerifiedUpdates() const { return !verified_updates_.empty(); }
- bool HasAppliedUpdates() const { return !applied_updates_.empty(); }
- void ClearVerifiedUpdates() { verified_updates_.clear(); }
-
- // Count the number of successful update applications that have happend this
- // cycle. Note that if an item is successfully applied twice, it will be
- // double counted here.
- int SuccessfullyAppliedUpdateCount() const;
-
- // Returns true if at least one update application failed due to a conflict
- // during this sync cycle.
- bool HasConflictingUpdates() const;
-
- private:
- // Container for updates that passed verification.
- std::vector<VerifiedUpdate> verified_updates_;
-
- // Stores the result of the various ApplyUpdate attempts we've made.
- // May contain duplicate entries.
- std::vector<AppliedUpdate> applied_updates_;
-};
-
-// Grouping of all state that applies to a single ModelSafeGroup.
-struct PerModelSafeGroupState {
- explicit PerModelSafeGroupState();
- ~PerModelSafeGroupState();
-
- UpdateProgress update_progress;
- ConflictProgress conflict_progress;
-};
-
-} // namespace sessions
-} // namespace syncer
-
-#endif // SYNC_SESSIONS_SESSION_STATE_H_
« no previous file with comments | « sync/internal_api/public/sessions/model_neutral_state.cc ('k') | sync/sessions/session_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698