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_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
17class StoreEntry;
18
19namespace Fs
20{
21namespace Ufs
22{
23
25{
27
28public:
30
32 virtual ~RebuildState();
33
34 virtual bool error() const;
35 virtual bool isDone() const;
36
38 int n_read;
39 /* FILE *log;*/
43
44 struct Flags {
45 Flags() : need_to_validate(false), clean(false), init(false) {}
47 bool clean;
48 bool init;
50 int in_dir;
51 int done;
52 int fn;
53
54 dirent_t *entry;
55 DIR *td;
58
60
61private:
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_FS_UFS_REBUILDSTATE_H */
87
int size
Definition: ModDevPoll.cc:75
RefCount< UFSSwapDir > sd
Definition: RebuildState.h:37
void rebuildFromDirectory()
process one cache file
void rebuildFromSwapLog()
process one swap log entry
virtual bool error() const
StoreRebuildData counts
Definition: RebuildState.h:59
bool evictStaleAndContinue(const cache_key *candidateKey, const time_t maxRef, int &staleCount)
Fs::Ufs::UFSSwapLogParser * LogParser
Definition: RebuildState.h:40
virtual bool isDone() const
struct Fs::Ufs::RebuildState::Flags flags
RebuildState(RefCount< UFSSwapDir > sd)
Definition: RebuildState.cc:31
static EVH RebuildStep
Definition: RebuildState.h:29
int getNextFile(sfileno *, int *size)
CBDATA_CLASS(RebuildState)
void rebuildStep()
load entries from swap.state or files until we run out of entries or time
void() callback(void *cbdata)
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
Definition: SBuf.h:94
cache_dir(s) indexing statistics
Definition: store_rebuild.h:20
void EVH(void *)
Definition: event.h:18
Definition: Module.h:13
unsigned char cache_key
Store key.
Definition: forward.h:29
signed_int32_t sfileno
Definition: forward.h:22

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors