]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/fs/ufs/RebuildState.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / fs / ufs / RebuildState.h
index 1f5201cd97bc27b574ef6f8393f13f6c106be9d7..dd7fe2a0f2965ca52591d1992231fbf50bf68dd7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -21,7 +21,7 @@ namespace Fs
 namespace Ufs
 {
 
-class RebuildState : public RefCountable
+class RebuildState
 {
     CBDATA_CLASS(RebuildState);
 
@@ -29,11 +29,10 @@ public:
     static EVH RebuildStep;
 
     RebuildState(RefCount<UFSSwapDir> sd);
-    ~RebuildState();
+    virtual ~RebuildState();
 
     virtual bool error() const;
     virtual bool isDone() const;
-    virtual StoreEntry *currentItem();
 
     RefCount<UFSSwapDir> sd;
     int n_read;
@@ -55,7 +54,7 @@ public:
     dirent_t *entry;
     DIR *td;
     char fullpath[MAXPATHLEN];
-    char fullfilename[MAXPATHLEN];
+    char fullfilename[MAXPATHLEN*2];
 
     StoreRebuildData counts;
 
@@ -63,11 +62,17 @@ private:
     void rebuildFromDirectory();
     void rebuildFromSwapLog();
     void rebuildStep();
-    void undoAdd();
+    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);
+    bool evictStaleAndContinue(const cache_key *candidateKey, const time_t maxRef, int &staleCount);
     int getNextFile(sfileno *, int *size);
-    StoreEntry *currentEntry() const;
-    void currentEntry(StoreEntry *);
-    StoreEntry *e;
     bool fromLog;
     bool _done;
     /// \bug (callback) should be hidden behind a proper human readable name