OLD | NEW |
| (Empty) |
1 // Copyright 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_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ | |
6 #define SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/files/file_path.h" | |
11 #include "base/macros.h" | |
12 #include "sync/base/sync_export.h" | |
13 #include "sync/syncable/directory_backing_store.h" | |
14 | |
15 namespace syncer { | |
16 namespace syncable { | |
17 | |
18 // This is the concrete class that provides a useful implementation of | |
19 // DirectoryBackingStore. | |
20 class SYNC_EXPORT OnDiskDirectoryBackingStore : public DirectoryBackingStore { | |
21 public: | |
22 OnDiskDirectoryBackingStore(const std::string& dir_name, | |
23 const base::FilePath& backing_file_path); | |
24 ~OnDiskDirectoryBackingStore() override; | |
25 DirOpenResult Load(Directory::MetahandlesMap* handles_map, | |
26 JournalIndex* delete_journals, | |
27 MetahandleSet* metahandles_to_purge, | |
28 Directory::KernelLoadInfo* kernel_load_info) override; | |
29 | |
30 protected: | |
31 // Subclasses may override this to avoid a possible DCHECK. | |
32 virtual void ReportFirstTryOpenFailure(); | |
33 | |
34 // Returns the file path of the back store. | |
35 const base::FilePath& backing_file_path() const; | |
36 | |
37 private: | |
38 // A helper function that will make one attempt to load the directory. | |
39 // Unlike Load(), it does not attempt to recover from failure. | |
40 DirOpenResult TryLoad(Directory::MetahandlesMap* handles_map, | |
41 JournalIndex* delete_journals, | |
42 MetahandleSet* metahandles_to_purge, | |
43 Directory::KernelLoadInfo* kernel_load_info); | |
44 | |
45 // The path to the sync DB. | |
46 const base::FilePath backing_file_path_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(OnDiskDirectoryBackingStore); | |
49 }; | |
50 | |
51 } // namespace syncable | |
52 } // namespace syncer | |
53 | |
54 #endif // SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ | |
OLD | NEW |