]> git.ipfire.org Git - thirdparty/squid.git/blame - src/StoreHashIndex.h
Prep for 3.3.12 and 3.4.4
[thirdparty/squid.git] / src / StoreHashIndex.h
CommitLineData
c8f4eac4 1
2/*
c8f4eac4 3 *
4 * SQUID Web Proxy Cache http://www.squid-cache.org/
5 * ----------------------------------------------------------
6 *
7 * Squid is the result of efforts by numerous individuals from
8 * the Internet community; see the CONTRIBUTORS file for full
9 * details. Many organizations have provided support for Squid's
10 * development; see the SPONSORS file for full details. Squid is
11 * Copyrighted (C) 2001 by the Regents of the University of
12 * California; see the COPYRIGHT file for full details. Squid
13 * incorporates software developed and/or copyrighted by other
14 * sources; see the CREDITS file for full details.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
26ac0430 20 *
c8f4eac4 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26ac0430 25 *
c8f4eac4 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
29 *
30 */
31
32#ifndef SQUID_STOREHASHINDEX_H
33#define SQUID_STOREHASHINDEX_H
34
35#include "Store.h"
36#include "StoreSearch.h"
37
38/* A summary store that indexs all its children
39 * into a memory hash
40 */
41
42class StoreSearch;
43
44class StoreHashIndex : public Store
45{
46
47public:
48 StoreHashIndex();
49 StoreHashIndex(StoreHashIndex const &); /* to cause link failures */
50 virtual ~StoreHashIndex();
51 virtual int callback();
52 virtual void create();
53
54 virtual StoreEntry * get
26ac0430 55 (const cache_key *);
c8f4eac4 56
57 virtual void get
26ac0430 58 (String const, STOREGETCLIENT, void * cbdata);
c8f4eac4 59
60 virtual void init();
61
62 virtual void sync();
63
12e11a5c 64 virtual uint64_t maxSize() const;
c8f4eac4 65
12e11a5c 66 virtual uint64_t minSize() const;
c8f4eac4 67
39c1e1d9
DK
68 virtual uint64_t currentSize() const;
69
70 virtual uint64_t currentCount() const;
71
af2fda07
DK
72 virtual int64_t maxObjectSize() const;
73
93bc1434 74 virtual void getStats(StoreInfoStats &stats) const;
c8f4eac4 75 virtual void stat(StoreEntry&) const;
76
77 virtual void reference(StoreEntry&);
78
54347cbd 79 virtual bool dereference(StoreEntry&, bool);
c8f4eac4 80
81 virtual void maintain();
82
30abd221 83 virtual StoreSearch *search(String const url, HttpRequest *);
c8f4eac4 84
85private:
86 /* migration logic */
87 StorePointer store(int const x) const;
14911a4e 88 SwapDir &dir(int const idx) const;
c8f4eac4 89};
90
91class StoreHashIndexEntry : public StoreEntry
26ac0430 92 {};
c8f4eac4 93
94class StoreSearchHashIndex : public StoreSearch
95{
96
97public:
98 StoreSearchHashIndex(RefCount<StoreHashIndex> sd);
99 StoreSearchHashIndex(StoreSearchHashIndex const &);
100 virtual ~StoreSearchHashIndex();
101 /* Iterator API - garh, wrong place */
102 /* callback the client when a new StoreEntry is available
26ac0430 103 * or an error occurs
c8f4eac4 104 */
105 virtual void next(void (callback)(void *cbdata), void *cbdata);
106 /* return true if a new StoreEntry is immediately available */
107 virtual bool next();
108 virtual bool error() const;
109 virtual bool isDone() const;
110 virtual StoreEntry *currentItem();
111
112 RefCount<StoreHashIndex> sd;
113
114private:
c8f4eac4 115 void copyBucket();
116 void (*callback)(void *cbdata);
117 void *cbdata;
118 bool _done;
119 int bucket;
81481ec0 120 std::vector<StoreEntry *> entries;
d2bf2f90
AJ
121
122 // keep this last. it plays with private/public
123 CBDATA_CLASS2(StoreSearchHashIndex);
c8f4eac4 124};
125
126#endif /* SQUID_STOREHASHINDEX_H */