]>
Commit | Line | Data |
---|---|---|
2745fea5 | 1 | /* |
5b74111a | 2 | * Copyright (C) 1996-2018 The Squid Software Foundation and contributors |
2745fea5 AR |
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_STORE_DISKS_H | |
10 | #define SQUID_STORE_DISKS_H | |
11 | ||
12 | #include "store/Controlled.h" | |
13 | #include "store/forward.h" | |
14 | ||
15 | namespace Store { | |
16 | ||
17 | /// summary view of all disk caches (cache_dirs) combined | |
18 | class Disks: public Controlled | |
19 | { | |
20 | public: | |
5ca027f0 AR |
21 | Disks(); |
22 | ||
2745fea5 AR |
23 | /* Storage API */ |
24 | virtual void create() override; | |
25 | virtual void init() override; | |
26 | virtual StoreEntry *get(const cache_key *) override; | |
27 | virtual uint64_t maxSize() const override; | |
28 | virtual uint64_t minSize() const override; | |
29 | virtual uint64_t currentSize() const override; | |
30 | virtual uint64_t currentCount() const override; | |
31 | virtual int64_t maxObjectSize() const override; | |
32 | virtual void getStats(StoreInfoStats &stats) const override; | |
33 | virtual void stat(StoreEntry &) const override; | |
34 | virtual void sync() override; | |
35 | virtual void reference(StoreEntry &) override; | |
36 | virtual bool dereference(StoreEntry &e) override; | |
abf396ec | 37 | virtual void updateHeaders(StoreEntry *) override; |
2745fea5 | 38 | virtual void maintain() override; |
4310f8b0 EB |
39 | virtual bool anchorToCache(StoreEntry &e, bool &inSync) override; |
40 | virtual bool updateAnchored(StoreEntry &) override; | |
41 | virtual void evictCached(StoreEntry &) override; | |
42 | virtual void evictIfFound(const cache_key *) override; | |
2745fea5 AR |
43 | virtual int callback() override; |
44 | ||
5ca027f0 AR |
45 | /// slowly calculate (and cache) hi/lo watermarks and similar limits |
46 | void updateLimits(); | |
47 | ||
82bee387 | 48 | /// Additional unknown-size entry bytes required by disks in order to |
5ca027f0 AR |
49 | /// reduce the risk of selecting the wrong disk cache for the growing entry. |
50 | int64_t accumulateMore(const StoreEntry&) const; | |
1a210de4 | 51 | virtual bool smpAware() const override; |
4310f8b0 EB |
52 | /// whether any of disk caches has entry with e.key |
53 | bool hasReadableEntry(const StoreEntry &) const; | |
5ca027f0 | 54 | |
2745fea5 AR |
55 | private: |
56 | /* migration logic */ | |
57 | SwapDir *store(int const x) const; | |
58 | SwapDir &dir(int const idx) const; | |
5ca027f0 AR |
59 | |
60 | int64_t largestMinimumObjectSize; ///< maximum of all Disk::minObjectSize()s | |
61 | int64_t largestMaximumObjectSize; ///< maximum of all Disk::maxObjectSize()s | |
62 | int64_t secondLargestMaximumObjectSize; ///< the second-biggest Disk::maxObjectSize() | |
2745fea5 AR |
63 | }; |
64 | ||
65 | } // namespace Store | |
66 | ||
67 | /* Store::Disks globals that should be converted to use RegisteredRunner */ | |
68 | void storeDirOpenSwapLogs(void); | |
69 | int storeDirWriteCleanLogs(int reopen); | |
70 | void storeDirCloseSwapLogs(void); | |
71 | ||
72 | /* Globals that should be converted to static Store::Disks methods */ | |
73 | void allocate_new_swapdir(Store::DiskConfig *swap); | |
74 | void free_cachedir(Store::DiskConfig *swap); | |
75 | ||
76 | /* Globals that should be converted to Store::Disks private data members */ | |
77 | typedef int STDIRSELECT(const StoreEntry *e); | |
78 | extern STDIRSELECT *storeDirSelectSwapDir; | |
79 | ||
80 | /* Globals that should be moved to some Store::UFS-specific logging module */ | |
81 | void storeDirSwapLog(const StoreEntry *e, int op); | |
82 | ||
83 | #endif /* SQUID_STORE_DISKS_H */ | |
7d84d4ca | 84 |