/*
- * Copyright (C) 1996-2018 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.
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
/// reduce the risk of selecting the wrong disk cache for the growing entry.
int64_t accumulateMore(const StoreEntry&) const;
- virtual bool smpAware() const override;
+ /// 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
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);