Controller.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_CONTROLLER_H
10 #define SQUID_STORE_CONTROLLER_H
11 
12 #include "store/Storage.h"
13 
14 class MemObject;
15 class RequestFlags;
16 class HttpRequestMethod;
17 
18 namespace Store {
19 
22 class Controller: public Storage
23 {
24 public:
25  Controller();
26  virtual ~Controller() override;
27 
28  /* Storage API */
29  virtual void create() override;
30  virtual void init() override;
31  virtual StoreEntry *get(const cache_key *) override;
32  virtual uint64_t maxSize() const override;
33  virtual uint64_t minSize() const override;
34  virtual uint64_t currentSize() const override;
35  virtual uint64_t currentCount() const override;
36  virtual int64_t maxObjectSize() const override;
37  virtual void getStats(StoreInfoStats &stats) const override;
38  virtual void stat(StoreEntry &) const override;
39  virtual void sync() override;
40  virtual void maintain() override;
41  virtual void markForUnlink(StoreEntry &) override;
42  virtual void unlink(StoreEntry &) override;
43  virtual int callback() override;
44  virtual bool smpAware() const override;
45 
48  int64_t accumulateMore(StoreEntry &) const;
49 
51  void updateLimits();
52 
55 
57  void memoryOut(StoreEntry &, const bool preserveSwappable);
58 
60  void updateOnNotModified(StoreEntry *old, const StoreEntry &newer);
61 
63  void allowCollapsing(StoreEntry *, const RequestFlags &, const HttpRequestMethod &);
64 
67 
69  void syncCollapsed(const sfileno);
70 
73 
75  int transientReaders(const StoreEntry &) const;
76 
79 
81  void memoryUnlink(StoreEntry &);
82 
85 
88 
91 
92 private:
94  void referenceBusy(StoreEntry &e);
96  bool dereferenceIdle(StoreEntry &, bool wantsLocalMemory);
97 
98  StoreEntry *find(const cache_key *key);
99  bool keepForLocalMemoryCache(StoreEntry &e) const;
100  bool anchorCollapsed(StoreEntry &, bool &inSync);
101 
104 
109 };
110 
112 extern Controller &Root();
113 
115 extern void Init(Controller *root = nullptr);
116 
118 extern void FreeMemory();
119 
120 } // namespace Store
121 
122 #endif /* SQUID_STORE_CONTROLLER_H */
123 
Memory * memStore
memory cache
Definition: Controller.h:103
void Init(Controller *root=nullptr)
initialize the storage module; a custom root is used by unit tests only
Definition: Controller.cc:626
StoreSearch * search()
Definition: Controller.cc:205
static int store_dirs_rebuilding
the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding
Definition: Controller.h:90
unsigned char cache_key
Store key.
Definition: forward.h:29
virtual void sync() override
prepare for shutdown
Definition: Controller.cc:212
class Ping::pingStats_ stats
bool dereferenceIdle(StoreEntry &, bool wantsLocalMemory)
dereference() an idle entry and return true if the entry should be deleted
Definition: Controller.cc:260
void referenceBusy(StoreEntry &e)
update reference counters of the recently touched entry
Definition: Controller.cc:237
Controller & Root()
safely access controller singleton
Definition: Controller.cc:619
High-level store statistics used by mgr:info action. Used inside PODs!
Definition: StoreStats.h:13
void transientsDisconnect(MemObject &)
disassociates the entry from the intransit table
Definition: Controller.cc:452
StoreEntry * find(const cache_key *key)
Definition: Controller.cc:304
void updateLimits()
slowly calculate (and cache) hi/lo watermarks and similar limits
Definition: Controller.cc:188
virtual bool smpAware() const override
Definition: Controller.cc:609
virtual uint64_t maxSize() const override
Definition: Controller.cc:153
int transientReaders(const StoreEntry &) const
number of the transient entry readers some time ago
Definition: Controller.cc:445
Disks * swapDir
summary view of all disk caches
Definition: Controller.h:102
virtual void maintain() override
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain
Definition: Controller.cc:89
virtual ~Controller() override
Definition: Controller.cc:44
void handleIdleEntry(StoreEntry &)
called when the entry is no longer needed by any transaction
Definition: Controller.cc:459
summary view of all disk caches (cache_dirs) combined
Definition: Disks.h:18
Transients * transients
Definition: Controller.h:108
void transientsAbandon(StoreEntry &)
calls Root().transients->abandon() if transients are tracked
Definition: Controller.cc:425
virtual void getStats(StoreInfoStats &stats) const override
collect statistics
Definition: Controller.cc:111
int64_t accumulateMore(StoreEntry &) const
Definition: Controller.cc:348
signed_int32_t sfileno
Definition: forward.h:22
virtual int callback() override
called once every main loop iteration; TODO: Move to UFS code.
Definition: Controller.cc:223
bool anchorCollapsed(StoreEntry &, bool &inSync)
Definition: Controller.cc:581
void allowCollapsing(StoreEntry *, const RequestFlags &, const HttpRequestMethod &)
makes the entry available for collapsing future requests
Definition: Controller.cc:517
void memoryDisconnect(StoreEntry &)
disassociates the entry from the memory cache, preserving cached data
Definition: Controller.cc:417
void transientsCompleteWriting(StoreEntry &)
marks the entry completed for collapsed requests
Definition: Controller.cc:435
virtual void create() override
create system resources needed for this store to operate in the future
Definition: Controller.cc:75
void FreeMemory()
undo Init()
Definition: Controller.cc:632
virtual void unlink(StoreEntry &) override
remove the entry from the store
Definition: Controller.cc:366
void const cache_key * key
virtual uint64_t minSize() const override
the minimum size the store will shrink to via normal housekeeping
Definition: Controller.cc:160
virtual void init() override
Definition: Controller.cc:58
void memoryOut(StoreEntry &, const bool preserveSwappable)
called to get rid of no longer needed entry data in RAM, if any
Definition: Controller.cc:393
virtual uint64_t currentCount() const override
the total number of objects stored right now
Definition: Controller.cc:174
void updateOnNotModified(StoreEntry *old, const StoreEntry &newer)
update old entry metadata and HTTP headers using a newer entry
Definition: Controller.cc:496
bool keepForLocalMemoryCache(StoreEntry &e) const
whether e should be kept in local RAM for possible future caching
Definition: Controller.cc:376
virtual void stat(StoreEntry &) const override
Definition: Controller.cc:131
virtual uint64_t currentSize() const override
current size
Definition: Controller.cc:167
virtual int64_t maxObjectSize() const override
the maximum size of a storable object; -1 if unlimited
Definition: Controller.cc:181
void syncCollapsed(const sfileno)
Update local intransit entry after changes made by appending worker.
Definition: Controller.cc:529
void memoryUnlink(StoreEntry &)
removes the entry from the memory cache
Definition: Controller.cc:408
virtual void markForUnlink(StoreEntry &) override
expect an unlink() call after the entry becomes idle
Definition: Controller.cc:355

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors