RebuildState.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
3  *
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.
7  */
8 
9 #ifndef SQUID_FS_UFS_REBUILDSTATE_H
10 #define SQUID_FS_UFS_REBUILDSTATE_H
11 
12 #include "base/RefCount.h"
13 #include "store_rebuild.h"
14 #include "UFSSwapDir.h"
15 #include "UFSSwapLogParser.h"
16 
17 class StoreEntry;
18 
19 namespace Fs
20 {
21 namespace Ufs
22 {
23 
25 {
27 
28 public:
29  static EVH RebuildStep;
30 
32  virtual ~RebuildState();
33 
34  virtual bool error() const;
35  virtual bool isDone() const;
36 
38  int n_read;
39  /* FILE *log;*/
41  int curlvl1;
42  int curlvl2;
43 
44  struct Flags {
47  bool clean;
48  bool init;
49  } flags;
50  int in_dir;
51  int done;
52  int fn;
53 
55  DIR *td;
58 
60 
61 private:
62  void rebuildFromDirectory();
63  void rebuildFromSwapLog();
64  void rebuildStep();
65  void addIfFresh(const cache_key *key,
66  sfileno file_number,
67  uint64_t swap_file_sz,
68  time_t expires,
69  time_t timestamp,
70  time_t lastref,
71  time_t lastmod,
72  uint32_t refcount,
73  uint16_t flags);
74  bool evictStaleAndContinue(const cache_key *candidateKey, const time_t maxRef, int &staleCount);
75  int getNextFile(sfileno *, int *size);
76  bool fromLog;
77  bool _done;
79  void (callback)(void *cbdata);
80  void *cbdata;
81 };
82 
83 } /* namespace Ufs */
84 } /* namespace Fs */
85 
86 #endif /* SQUID_FS_UFS_REBUILDSTATE_H */
87 
void rebuildStep()
load entries from swap.state or files until we run out of entries or time
RebuildState(RefCount< UFSSwapDir > sd)
Definition: RebuildState.cc:32
virtual bool isDone() const
unsigned char cache_key
Store key.
Definition: forward.h:29
#define MAXPATHLEN
Definition: stdio.h:62
CBDATA_CLASS(RebuildState)
void rebuildFromDirectory()
process one cache file
char fullfilename[MAXPATHLEN *2]
Definition: RebuildState.h:57
void EVH(void *)
Definition: event.h:19
bool evictStaleAndContinue(const cache_key *candidateKey, const time_t maxRef, int &staleCount)
static EVH RebuildStep
Definition: RebuildState.h:29
StoreRebuildData counts
Definition: RebuildState.h:59
int getNextFile(sfileno *, int *size)
signed_int32_t sfileno
Definition: forward.h:22
void() callback(void *cbdata)
virtual bool error() const
void addIfFresh(const cache_key *key, sfileno file_number, uint64_t swap_file_sz, time_t expires, time_t timestamp, time_t lastref, time_t lastmod, uint32_t refcount, uint16_t flags)
if the loaded entry metadata is still relevant, indexes the entry
#define dirent_t
Definition: compat_shared.h:71
RefCount< UFSSwapDir > sd
Definition: RebuildState.h:37
Fs::Ufs::UFSSwapLogParser * LogParser
Definition: RebuildState.h:40
char fullpath[MAXPATHLEN]
Definition: RebuildState.h:56
void rebuildFromSwapLog()
process one swap log entry
int size
Definition: ModDevPoll.cc:77
#define false
Definition: GnuRegex.c:233
struct Fs::Ufs::RebuildState::Flags flags

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors