]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/store/Disks.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / store / Disks.h
index 3b72034f9f28aa2c2287a28658b70405ab7deeb1..9c82df4e4274545f78f4d28b4b3c0c51d514d167 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2016 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.
@@ -36,23 +36,32 @@ public:
     virtual bool dereference(StoreEntry &e) override;
     virtual void updateHeaders(StoreEntry *) override;
     virtual void maintain() override;
-    virtual bool anchorCollapsed(StoreEntry &e, bool &inSync) override;
-    virtual bool updateCollapsed(StoreEntry &e) override;
-    virtual void markForUnlink(StoreEntry &) override;
-    virtual void unlink(StoreEntry &) override;
+    virtual bool anchorToCache(StoreEntry &e, bool &inSync) override;
+    virtual bool updateAnchored(StoreEntry &) override;
+    virtual void evictCached(StoreEntry &) override;
+    virtual void evictIfFound(const cache_key *) override;
     virtual int callback() override;
 
-    /// slowly calculate (and cache) hi/lo watermarks and similar limits
-    void updateLimits();
+    /// update configuration, including limits (re)calculation
+    void configure();
+    /// parses a single cache_dir configuration line
+    static void Parse(DiskConfig &);
+    /// prints the configuration into the provided StoreEntry
+    static void Dump(const DiskConfig &, StoreEntry &, const char *name);
 
-    /// Additional unknown-size entry bytes required by disks in order to 
+    /// Additional unknown-size entry bytes required by disks in order to
     /// reduce the risk of selecting the wrong disk cache for the growing entry.
     int64_t accumulateMore(const StoreEntry&) const;
+    /// whether any disk cache is SMP-aware
+    static bool SmpAware();
+    static SwapDir *SelectSwapDir(const StoreEntry *);
+    /// whether any of disk caches has entry with e.key
+    bool hasReadableEntry(const StoreEntry &) const;
 
 private:
     /* migration logic */
     SwapDir *store(int const x) const;
-    SwapDir &dir(int const idx) const;
+    static SwapDir &Dir(int const idx);
 
     int64_t largestMinimumObjectSize; ///< maximum of all Disk::minObjectSize()s
     int64_t largestMaximumObjectSize; ///< maximum of all Disk::maxObjectSize()s
@@ -67,13 +76,9 @@ int storeDirWriteCleanLogs(int reopen);
 void storeDirCloseSwapLogs(void);
 
 /* Globals that should be converted to static Store::Disks methods */
-void allocate_new_swapdir(Store::DiskConfig *swap);
+void allocate_new_swapdir(Store::DiskConfig &swap);
 void free_cachedir(Store::DiskConfig *swap);
 
-/* Globals that should be converted to Store::Disks private data members */
-typedef int STDIRSELECT(const StoreEntry *e);
-extern STDIRSELECT *storeDirSelectSwapDir;
-
 /* Globals that should be moved to some Store::UFS-specific logging module */
 void storeDirSwapLog(const StoreEntry *e, int op);