]> git.ipfire.org Git - thirdparty/squid.git/blob - src/store/Controlled.h
5d8604eb689617e07814fcd1afa01d793bcca2cc
[thirdparty/squid.git] / src / store / Controlled.h
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_CONTROLLED_H
10 #define SQUID_STORE_CONTROLLED_H
11
12 #include "store/Storage.h"
13
14 namespace Store {
15
16 /// Storage controlled by a Controller.
17 /// This API is shared among Disks, Disk, Memory caches and Transients.
18 class Controlled: public Storage
19 {
20 public:
21 /// somebody needs this entry (many cache replacement policies need to know)
22 virtual void reference(StoreEntry &e) = 0;
23
24 /// somebody no longer needs this entry (usually after calling reference())
25 /// return false iff the idle entry should be destroyed
26 virtual bool dereference(StoreEntry &e) = 0;
27
28 /// make stored metadata and HTTP headers the same as in the given entry
29 virtual void updateHeaders(StoreEntry *) {}
30
31 /// If this storage cannot cache collapsed entries, return false.
32 /// If the entry is not found, return false. Otherwise, return true after
33 /// tying the entry to this cache and setting inSync to updateCollapsed().
34 virtual bool anchorCollapsed(StoreEntry &, bool &/*inSync*/) { return false; }
35
36 /// Update a local collapsed entry with fresh info from this cache (if any).
37 /// Return true iff the cache supports collapsed entries and
38 /// the given local collapsed entry is now in sync with this storage.
39 virtual bool updateCollapsed(StoreEntry &) { return false; }
40 };
41
42 } // namespace Store
43
44 #endif /* SQUID_STORE_CONTROLLED_H */
45