]>
Commit | Line | Data |
---|---|---|
58373ff8 | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors |
58373ff8 | 3 | * |
bbc27441 AJ |
4 | * Squid software is distributed under GPLv2+ license and includes |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
58373ff8 FC |
7 | */ |
8 | ||
9 | #ifndef SQUID_FS_UFS_REBUILDSTATE_H | |
10 | #define SQUID_FS_UFS_REBUILDSTATE_H | |
11 | ||
8bf217bd | 12 | #include "base/RefCount.h" |
602d9612 | 13 | #include "store_rebuild.h" |
58373ff8 | 14 | #include "UFSSwapDir.h" |
58373ff8 FC |
15 | #include "UFSSwapLogParser.h" |
16 | ||
17 | class StoreEntry; | |
18 | ||
19 | namespace Fs | |
20 | { | |
21 | namespace Ufs | |
22 | { | |
23 | ||
58373ff8 FC |
24 | class RebuildState : public RefCountable |
25 | { | |
5c2f68b7 AJ |
26 | CBDATA_CLASS(RebuildState); |
27 | ||
58373ff8 FC |
28 | public: |
29 | static EVH RebuildStep; | |
30 | ||
31 | RebuildState(RefCount<UFSSwapDir> sd); | |
32 | ~RebuildState(); | |
33 | ||
34 | virtual bool error() const; | |
35 | virtual bool isDone() const; | |
36 | virtual StoreEntry *currentItem(); | |
37 | ||
38 | RefCount<UFSSwapDir> sd; | |
39 | int n_read; | |
40 | /* FILE *log;*/ | |
41 | Fs::Ufs::UFSSwapLogParser *LogParser; | |
42 | int curlvl1; | |
43 | int curlvl2; | |
44 | ||
1a6347cd FC |
45 | struct Flags { |
46 | Flags() : need_to_validate(false), clean(false), init(false) {} | |
47 | bool need_to_validate; | |
48 | bool clean; | |
49 | bool init; | |
58373ff8 FC |
50 | } flags; |
51 | int in_dir; | |
52 | int done; | |
53 | int fn; | |
54 | ||
55 | dirent_t *entry; | |
56 | DIR *td; | |
57 | char fullpath[MAXPATHLEN]; | |
58 | char fullfilename[MAXPATHLEN]; | |
59 | ||
211e9ce2 | 60 | StoreRebuildData counts; |
58373ff8 FC |
61 | |
62 | private: | |
58373ff8 FC |
63 | void rebuildFromDirectory(); |
64 | void rebuildFromSwapLog(); | |
65 | void rebuildStep(); | |
66 | void undoAdd(); | |
67 | int getNextFile(sfileno *, int *size); | |
68 | StoreEntry *currentEntry() const; | |
69 | void currentEntry(StoreEntry *); | |
70 | StoreEntry *e; | |
71 | bool fromLog; | |
72 | bool _done; | |
73 | /// \bug (callback) should be hidden behind a proper human readable name | |
74 | void (callback)(void *cbdata); | |
75 | void *cbdata; | |
76 | }; | |
77 | ||
58373ff8 FC |
78 | } /* namespace Ufs */ |
79 | } /* namespace Fs */ | |
80 | ||
81 | #endif /* SQUID_FS_UFS_REBUILDSTATE_H */ | |
f53969cc | 82 |