| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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_INTERNAL_API_PUBLIC_BASE_INVALIDATION_INTERFACE_H_ | |
| 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_INTERFACE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <string> | |
| 11 | |
| 12 #include "sync/base/sync_export.h" | |
| 13 | |
| 14 namespace syncer { | |
| 15 | |
| 16 // An interface that wraps sync's interactions with the component that provides | |
| 17 // it with invalidations. | |
| 18 class SYNC_EXPORT InvalidationInterface { | |
| 19 public: | |
| 20 // Orders invalidations based on version number and IsUnknownVersion(). | |
| 21 static bool LessThanByVersion(const InvalidationInterface& a, | |
| 22 const InvalidationInterface& b); | |
| 23 | |
| 24 InvalidationInterface(); | |
| 25 virtual ~InvalidationInterface(); | |
| 26 | |
| 27 // Returns true if this is an 'unknown version' invalidation. | |
| 28 // Such invalidations have no valid payload or version number. | |
| 29 virtual bool IsUnknownVersion() const = 0; | |
| 30 | |
| 31 // Returns the payload of this item. | |
| 32 // DCHECKs if this is an unknown version invalidation. | |
| 33 virtual const std::string& GetPayload() const = 0; | |
| 34 | |
| 35 // Retursn the version of this item. | |
| 36 // DCHECKs if this is an unknown version invalidation. | |
| 37 // | |
| 38 // It is preferable to use the LessThan() function, which handles unknown | |
| 39 // versions properly, rather than this function. | |
| 40 virtual int64_t GetVersion() const = 0; | |
| 41 | |
| 42 // This function will be called when the invalidation has been handled | |
| 43 // successfully. | |
| 44 virtual void Acknowledge() = 0; | |
| 45 | |
| 46 // This function should be called if a lack of buffer space required that we | |
| 47 // drop this invalidation. | |
| 48 // | |
| 49 // To indicate recovery from a drop event, the receiver of this invalidation | |
| 50 // will call Acknowledge() on the most recently dropped invalidation. | |
| 51 virtual void Drop() = 0; | |
| 52 }; | |
| 53 | |
| 54 } // namespace syncer | |
| 55 | |
| 56 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_INTERFACE_H_ | |
| OLD | NEW |