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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 FileCacheEntry entry_; | 96 FileCacheEntry entry_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(CacheEntryIterator); | 98 DISALLOW_COPY_AND_ASSIGN(CacheEntryIterator); |
99 }; | 99 }; |
100 | 100 |
101 ResourceMetadataStorage(const base::FilePath& directory_path, | 101 ResourceMetadataStorage(const base::FilePath& directory_path, |
102 base::SequencedTaskRunner* blocking_task_runner); | 102 base::SequencedTaskRunner* blocking_task_runner); |
103 | 103 |
104 const base::FilePath& directory_path() const { return directory_path_; } | 104 const base::FilePath& directory_path() const { return directory_path_; } |
105 | 105 |
| 106 // Returns true if the DB used by this storage was opened, not created, during |
| 107 // Initialize(). |
| 108 bool opened_existing_db() const { return opened_existing_db_; } |
| 109 |
106 // Destroys this object. | 110 // Destroys this object. |
107 void Destroy(); | 111 void Destroy(); |
108 | 112 |
109 // Initializes this object. | 113 // Initializes this object. |
110 bool Initialize(); | 114 bool Initialize(); |
111 | 115 |
112 // Sets the largest changestamp. | 116 // Sets the largest changestamp. |
113 bool SetLargestChangestamp(int64 largest_changestamp); | 117 bool SetLargestChangestamp(int64 largest_changestamp); |
114 | 118 |
115 // Gets the largest changestamp. | 119 // Gets the largest changestamp. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 170 |
167 // Gets header. | 171 // Gets header. |
168 bool GetHeader(ResourceMetadataHeader* out_header); | 172 bool GetHeader(ResourceMetadataHeader* out_header); |
169 | 173 |
170 // Checks validity of the data. | 174 // Checks validity of the data. |
171 bool CheckValidity(); | 175 bool CheckValidity(); |
172 | 176 |
173 // Path to the directory where the data is stored. | 177 // Path to the directory where the data is stored. |
174 base::FilePath directory_path_; | 178 base::FilePath directory_path_; |
175 | 179 |
| 180 bool opened_existing_db_; |
| 181 |
176 // Entries stored in this storage. | 182 // Entries stored in this storage. |
177 scoped_ptr<leveldb::DB> resource_map_; | 183 scoped_ptr<leveldb::DB> resource_map_; |
178 | 184 |
179 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 185 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
180 | 186 |
181 DISALLOW_COPY_AND_ASSIGN(ResourceMetadataStorage); | 187 DISALLOW_COPY_AND_ASSIGN(ResourceMetadataStorage); |
182 }; | 188 }; |
183 | 189 |
184 } // namespace internal | 190 } // namespace internal |
185 } // namespace drive | 191 } // namespace drive |
186 | 192 |
187 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_ | 193 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_RESOURCE_METADATA_STORAGE_H_ |
OLD | NEW |