Disks.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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 
18 class Disks: public Controlled
19 {
20 public:
21  Disks();
22 
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;
37  virtual void updateHeaders(StoreEntry *) override;
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 
46  void updateLimits();
47 
50  int64_t accumulateMore(const StoreEntry&) const;
51  virtual bool smpAware() const override;
52 
53 private:
54  /* migration logic */
55  SwapDir *store(int const x) const;
56  SwapDir &dir(int const idx) const;
57 
61 };
62 
63 } // namespace Store
64 
65 /* Store::Disks globals that should be converted to use RegisteredRunner */
66 void storeDirOpenSwapLogs(void);
67 int storeDirWriteCleanLogs(int reopen);
68 void storeDirCloseSwapLogs(void);
69 
70 /* Globals that should be converted to static Store::Disks methods */
73 
74 /* Globals that should be converted to Store::Disks private data members */
75 typedef int STDIRSELECT(const StoreEntry *e);
77 
78 /* Globals that should be moved to some Store::UFS-specific logging module */
79 void storeDirSwapLog(const StoreEntry *e, int op);
80 
81 #endif /* SQUID_STORE_DISKS_H */
82 
virtual void stat(StoreEntry &) const override
Definition: Disks.cc:435
int64_t secondLargestMaximumObjectSize
the second-biggest Disk::maxObjectSize()
Definition: Disks.h:60
virtual void unlink(StoreEntry &) override
remove the entry from the store
Definition: Disks.cc:495
void free_cachedir(Store::DiskConfig *swap)
Definition: Disks.cc:677
virtual void sync() override
prepare for shutdown
Definition: Disks.cc:482
virtual bool dereference(StoreEntry &e) override
Definition: Disks.cc:454
void updateLimits()
slowly calculate (and cache) hi/lo watermarks and similar limits
Definition: Disks.cc:358
int64_t largestMaximumObjectSize
maximum of all Disk::maxObjectSize()s
Definition: Disks.h:59
virtual uint64_t currentCount() const override
the total number of objects stored right now
Definition: Disks.cc:339
virtual uint64_t minSize() const override
the minimum size the store will shrink to via normal housekeeping
Definition: Disks.cc:313
unsigned char cache_key
Store key.
Definition: forward.h:29
void storeDirCloseSwapLogs(void)
Definition: Disks.cc:556
void storeDirSwapLog(const StoreEntry *e, int op)
Definition: Disks.cc:712
virtual void markForUnlink(StoreEntry &) override
expect an unlink() call after the entry becomes idle
Definition: Disks.cc:489
class Ping::pingStats_ stats
virtual void reference(StoreEntry &) override
somebody needs this entry (many cache replacement policies need to know)
Definition: Disks.cc:448
int64_t accumulateMore(const StoreEntry &) const
Definition: Disks.cc:382
High-level store statistics used by mgr:info action. Used inside PODs!
Definition: StoreStats.h:13
void allocate_new_swapdir(Store::DiskConfig *swap)
Definition: Disks.cc:660
SwapDir & dir(int const idx) const
Definition: Disks.cc:165
virtual void getStats(StoreInfoStats &stats) const override
collect statistics
Definition: Disks.cc:419
virtual uint64_t maxSize() const override
Definition: Disks.cc:300
void storeDirOpenSwapLogs(void)
Definition: Disks.cc:549
virtual void maintain() override
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain
Definition: Disks.cc:467
summary view of all disk caches (cache_dirs) combined
Definition: Disks.h:18
virtual bool updateCollapsed(StoreEntry &e) override
Definition: Disks.cc:527
int64_t largestMinimumObjectSize
maximum of all Disk::minObjectSize()s
Definition: Disks.h:58
int STDIRSELECT(const StoreEntry *e)
Definition: Disks.h:75
virtual void init() override
Definition: Disks.cc:244
virtual uint64_t currentSize() const override
current size
Definition: Disks.cc:326
STDIRSELECT * storeDirSelectSwapDir
Definition: Disks.cc:28
virtual bool anchorCollapsed(StoreEntry &e, bool &inSync) override
Definition: Disks.cc:501
SwapDir * store(int const x) const
Definition: Disks.cc:159
virtual bool smpAware() const override
Definition: Disks.cc:534
virtual void create() override
create system resources needed for this store to operate in the future
Definition: Disks.cc:205
virtual int callback() override
called once every main loop iteration; TODO: Move to UFS code.
Definition: Disks.cc:173
virtual int64_t maxObjectSize() const override
the maximum size of a storable object; -1 if unlimited
Definition: Disks.cc:352
int storeDirWriteCleanLogs(int reopen)
Definition: Disks.cc:572
virtual void updateHeaders(StoreEntry *) override
make stored metadata and HTTP headers the same as in the given entry
Definition: Disks.cc:460
manages a single cache_dir
Definition: Disk.h:21

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors