| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Defines the public interface of the disk cache. For more details see | 5 // Defines the public interface of the disk cache. For more details see |
| 6 // http://wiki/Main/ChromeDiskCacheBackend | 6 // http://wiki/Main/ChromeDiskCacheBackend |
| 7 | 7 |
| 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H__ | 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H__ |
| 9 #define NET_DISK_CACHE_DISK_CACHE_H__ | 9 #define NET_DISK_CACHE_DISK_CACHE_H__ |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual bool CreateEntry(const std::string& key, Entry** entry) = 0; | 60 virtual bool CreateEntry(const std::string& key, Entry** entry) = 0; |
| 61 | 61 |
| 62 // Marks the entry, specified by the given key, for deletion. | 62 // Marks the entry, specified by the given key, for deletion. |
| 63 virtual bool DoomEntry(const std::string& key) = 0; | 63 virtual bool DoomEntry(const std::string& key) = 0; |
| 64 | 64 |
| 65 // Marks all entries for deletion. | 65 // Marks all entries for deletion. |
| 66 virtual bool DoomAllEntries() = 0; | 66 virtual bool DoomAllEntries() = 0; |
| 67 | 67 |
| 68 // Marks a range of entries for deletion. This supports unbounded deletes in | 68 // Marks a range of entries for deletion. This supports unbounded deletes in |
| 69 // either direction by using null Time values for either argument. | 69 // either direction by using null Time values for either argument. |
| 70 virtual bool DoomEntriesBetween(const Time initial_time, | 70 virtual bool DoomEntriesBetween(const base::Time initial_time, |
| 71 const Time end_time) = 0; | 71 const base::Time end_time) = 0; |
| 72 | 72 |
| 73 // Marks all entries accessed since initial_time for deletion. | 73 // Marks all entries accessed since initial_time for deletion. |
| 74 virtual bool DoomEntriesSince(const Time initial_time) = 0; | 74 virtual bool DoomEntriesSince(const base::Time initial_time) = 0; |
| 75 | 75 |
| 76 // Enumerate the cache. Initialize iter to NULL before calling this method | 76 // Enumerate the cache. Initialize iter to NULL before calling this method |
| 77 // the first time. That will cause the enumeration to start at the head of | 77 // the first time. That will cause the enumeration to start at the head of |
| 78 // the cache. For subsequent calls, pass the same iter pointer again without | 78 // the cache. For subsequent calls, pass the same iter pointer again without |
| 79 // changing its value. This method returns false when there are no more | 79 // changing its value. This method returns false when there are no more |
| 80 // entries to enumerate. When the entry pointer is no longer needed, the | 80 // entries to enumerate. When the entry pointer is no longer needed, the |
| 81 // Close method should be called. | 81 // Close method should be called. |
| 82 // | 82 // |
| 83 // NOTE: This method does not modify the last_used field of the entry, | 83 // NOTE: This method does not modify the last_used field of the entry, |
| 84 // and therefore it does not impact the eviction ranking of the entry. | 84 // and therefore it does not impact the eviction ranking of the entry. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 103 | 103 |
| 104 // Releases this entry. Calling this method does not cancel pending IO | 104 // Releases this entry. Calling this method does not cancel pending IO |
| 105 // operations on this entry. Even after the last reference to this object has | 105 // operations on this entry. Even after the last reference to this object has |
| 106 // been released, pending completion callbacks may be invoked. | 106 // been released, pending completion callbacks may be invoked. |
| 107 virtual void Close() = 0; | 107 virtual void Close() = 0; |
| 108 | 108 |
| 109 // Returns the key associated with this cache entry. | 109 // Returns the key associated with this cache entry. |
| 110 virtual std::string GetKey() const = 0; | 110 virtual std::string GetKey() const = 0; |
| 111 | 111 |
| 112 // Returns the time when this cache entry was last used. | 112 // Returns the time when this cache entry was last used. |
| 113 virtual Time GetLastUsed() const = 0; | 113 virtual base::Time GetLastUsed() const = 0; |
| 114 | 114 |
| 115 // Returns the time when this cache entry was last modified. | 115 // Returns the time when this cache entry was last modified. |
| 116 virtual Time GetLastModified() const = 0; | 116 virtual base::Time GetLastModified() const = 0; |
| 117 | 117 |
| 118 // Returns the size of the cache data with the given index. | 118 // Returns the size of the cache data with the given index. |
| 119 virtual int32 GetDataSize(int index) const = 0; | 119 virtual int32 GetDataSize(int index) const = 0; |
| 120 | 120 |
| 121 // Copies cache data into the given buffer of length |buf_len|. If | 121 // Copies cache data into the given buffer of length |buf_len|. If |
| 122 // completion_callback is null, then this call blocks until the read | 122 // completion_callback is null, then this call blocks until the read |
| 123 // operation is complete. Otherwise, completion_callback will be | 123 // operation is complete. Otherwise, completion_callback will be |
| 124 // called on the current thread once the read completes. Returns the | 124 // called on the current thread once the read completes. Returns the |
| 125 // number of bytes read or a network error code. If a completion callback is | 125 // number of bytes read or a network error code. If a completion callback is |
| 126 // provided then it will be called if this function returns ERR_IO_PENDING. | 126 // provided then it will be called if this function returns ERR_IO_PENDING. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 148 bool truncate) = 0; | 148 bool truncate) = 0; |
| 149 | 149 |
| 150 protected: | 150 protected: |
| 151 virtual ~Entry() {} | 151 virtual ~Entry() {} |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace disk_cache | 154 } // namespace disk_cache |
| 155 | 155 |
| 156 #endif // NET_DISK_CACHE_DISK_CACHE_H__ | 156 #endif // NET_DISK_CACHE_DISK_CACHE_H__ |
| 157 | 157 |
| OLD | NEW |