RebuildState.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_SRC_FS_UFS_REBUILDSTATE_H
10 #define SQUID_SRC_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 {
45  Flags() : need_to_validate(false), clean(false), init(false) {}
47  bool clean;
48  bool init;
49  } flags;
50  int in_dir;
51  int done;
52  int fn;
53 
54  dirent_t *entry;
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;
78  // TODO: (callback) should be hidden behind a proper human readable name
79  void (callback)(void *cbdata);
80  void *cbdata;
81 };
82 
83 } /* namespace Ufs */
84 } /* namespace Fs */
85 
86 #endif /* SQUID_SRC_FS_UFS_REBUILDSTATE_H */
87 
struct Fs::Ufs::RebuildState::Flags flags
void rebuildFromDirectory()
process one cache file
unsigned char cache_key
Store key.
Definition: forward.h:29
Definition: SBuf.h:93
cache_dir(s) indexing statistics
Definition: store_rebuild.h:19
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
CBDATA_CLASS(RebuildState)
virtual bool isDone() const
int size
Definition: ModDevPoll.cc:69
void rebuildFromSwapLog()
process one swap log entry
RefCount< UFSSwapDir > sd
Definition: RebuildState.h:37
void() callback(void *cbdata)
signed_int32_t sfileno
Definition: forward.h:22
void EVH(void *)
Definition: event.h:18
Fs::Ufs::UFSSwapLogParser * LogParser
Definition: RebuildState.h:40
Definition: Module.h:12
StoreRebuildData counts
Definition: RebuildState.h:59
bool evictStaleAndContinue(const cache_key *candidateKey, const time_t maxRef, int &staleCount)
int getNextFile(sfileno *, int *size)
RebuildState(const RefCount< UFSSwapDir > &sd)
Definition: RebuildState.cc:32
virtual bool error() const
static EVH RebuildStep
Definition: RebuildState.h:29
void rebuildStep()
load entries from swap.state or files until we run out of entries or time

 

Introduction

Documentation

Support

Miscellaneous