]> git.ipfire.org Git - thirdparty/squid.git/blame - src/store/Disks.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / store / Disks.h
CommitLineData
2745fea5 1/*
4ac4a490 2 * Copyright (C) 1996-2017 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
15namespace Store {
16
17/// summary view of all disk caches (cache_dirs) combined
18class Disks: public Controlled
19{
20public:
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
AR
38 virtual void maintain() override;
39 virtual bool anchorCollapsed(StoreEntry &e, bool &inSync) override;
40 virtual bool updateCollapsed(StoreEntry &e) override;
41 virtual void markForUnlink(StoreEntry &) override;
42 virtual void unlink(StoreEntry &) override;
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;
5ca027f0 52
2745fea5
AR
53private:
54 /* migration logic */
55 SwapDir *store(int const x) const;
56 SwapDir &dir(int const idx) const;
5ca027f0
AR
57
58 int64_t largestMinimumObjectSize; ///< maximum of all Disk::minObjectSize()s
59 int64_t largestMaximumObjectSize; ///< maximum of all Disk::maxObjectSize()s
60 int64_t secondLargestMaximumObjectSize; ///< the second-biggest Disk::maxObjectSize()
2745fea5
AR
61};
62
63} // namespace Store
64
65/* Store::Disks globals that should be converted to use RegisteredRunner */
66void storeDirOpenSwapLogs(void);
67int storeDirWriteCleanLogs(int reopen);
68void storeDirCloseSwapLogs(void);
69
70/* Globals that should be converted to static Store::Disks methods */
71void allocate_new_swapdir(Store::DiskConfig *swap);
72void free_cachedir(Store::DiskConfig *swap);
73
74/* Globals that should be converted to Store::Disks private data members */
75typedef int STDIRSELECT(const StoreEntry *e);
76extern STDIRSELECT *storeDirSelectSwapDir;
77
78/* Globals that should be moved to some Store::UFS-specific logging module */
79void storeDirSwapLog(const StoreEntry *e, int op);
80
81#endif /* SQUID_STORE_DISKS_H */
7d84d4ca 82