[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / sync / syncable / on_disk_directory_backing_store.h
blob5930bd27ba20d3740d7b43af71e0829ad30c43da
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.
5 #ifndef SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_
6 #define SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_
8 #include "base/files/file_path.h"
9 #include "sync/base/sync_export.h"
10 #include "sync/syncable/directory_backing_store.h"
12 namespace syncer {
13 namespace syncable {
15 // This is the concrete class that provides a useful implementation of
16 // DirectoryBackingStore.
17 class SYNC_EXPORT_PRIVATE OnDiskDirectoryBackingStore
18 : public DirectoryBackingStore {
19 public:
20 OnDiskDirectoryBackingStore(const std::string& dir_name,
21 const base::FilePath& backing_filepath);
22 virtual ~OnDiskDirectoryBackingStore();
23 virtual DirOpenResult Load(
24 Directory::MetahandlesMap* handles_map,
25 JournalIndex* delete_journals,
26 Directory::KernelLoadInfo* kernel_load_info) OVERRIDE;
28 // A helper function that will make one attempt to load the directory.
29 // Unlike Load(), it does not attempt to recover from failure.
30 DirOpenResult TryLoad(
31 Directory::MetahandlesMap* handles_map,
32 JournalIndex* delete_journals,
33 Directory::KernelLoadInfo* kernel_load_info);
35 protected:
36 // Subclasses may override this to avoid a possible DCHECK.
37 virtual void ReportFirstTryOpenFailure();
39 private:
40 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MinorCorruption);
42 bool allow_failure_for_test_;
43 base::FilePath backing_filepath_;
45 DISALLOW_COPY_AND_ASSIGN(OnDiskDirectoryBackingStore);
48 } // namespace syncable
49 } // namespace syncer
51 #endif // SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_