]>
Commit | Line | Data |
---|---|---|
c8f4eac4 | 1 | /* |
bde978a6 | 2 | * Copyright (C) 1996-2015 The Squid Software Foundation and contributors |
c8f4eac4 | 3 | * |
bbc27441 AJ |
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. | |
c8f4eac4 | 7 | */ |
8 | ||
9 | #ifndef SQUID_STOREHASHINDEX_H | |
10 | #define SQUID_STOREHASHINDEX_H | |
11 | ||
12 | #include "Store.h" | |
13 | #include "StoreSearch.h" | |
14 | ||
15 | /* A summary store that indexs all its children | |
16 | * into a memory hash | |
17 | */ | |
18 | ||
19 | class StoreSearch; | |
20 | ||
21 | class StoreHashIndex : public Store | |
22 | { | |
23 | ||
24 | public: | |
25 | StoreHashIndex(); | |
26 | StoreHashIndex(StoreHashIndex const &); /* to cause link failures */ | |
27 | virtual ~StoreHashIndex(); | |
28 | virtual int callback(); | |
29 | virtual void create(); | |
30 | ||
31 | virtual StoreEntry * get | |
26ac0430 | 32 | (const cache_key *); |
c8f4eac4 | 33 | |
34 | virtual void get | |
26ac0430 | 35 | (String const, STOREGETCLIENT, void * cbdata); |
c8f4eac4 | 36 | |
37 | virtual void init(); | |
38 | ||
39 | virtual void sync(); | |
40 | ||
12e11a5c | 41 | virtual uint64_t maxSize() const; |
c8f4eac4 | 42 | |
12e11a5c | 43 | virtual uint64_t minSize() const; |
c8f4eac4 | 44 | |
39c1e1d9 DK |
45 | virtual uint64_t currentSize() const; |
46 | ||
47 | virtual uint64_t currentCount() const; | |
48 | ||
af2fda07 DK |
49 | virtual int64_t maxObjectSize() const; |
50 | ||
93bc1434 | 51 | virtual void getStats(StoreInfoStats &stats) const; |
c8f4eac4 | 52 | virtual void stat(StoreEntry&) const; |
53 | ||
54 | virtual void reference(StoreEntry&); | |
55 | ||
54347cbd | 56 | virtual bool dereference(StoreEntry&, bool); |
c8f4eac4 | 57 | |
58 | virtual void maintain(); | |
59 | ||
30abd221 | 60 | virtual StoreSearch *search(String const url, HttpRequest *); |
c8f4eac4 | 61 | |
62 | private: | |
63 | /* migration logic */ | |
64 | StorePointer store(int const x) const; | |
14911a4e | 65 | SwapDir &dir(int const idx) const; |
c8f4eac4 | 66 | }; |
67 | ||
68 | class StoreHashIndexEntry : public StoreEntry | |
f53969cc | 69 | {}; |
c8f4eac4 | 70 | |
71 | class StoreSearchHashIndex : public StoreSearch | |
72 | { | |
5c2f68b7 | 73 | CBDATA_CLASS(StoreSearchHashIndex); |
c8f4eac4 | 74 | |
75 | public: | |
76 | StoreSearchHashIndex(RefCount<StoreHashIndex> sd); | |
77 | StoreSearchHashIndex(StoreSearchHashIndex const &); | |
78 | virtual ~StoreSearchHashIndex(); | |
79 | /* Iterator API - garh, wrong place */ | |
80 | /* callback the client when a new StoreEntry is available | |
26ac0430 | 81 | * or an error occurs |
c8f4eac4 | 82 | */ |
83 | virtual void next(void (callback)(void *cbdata), void *cbdata); | |
84 | /* return true if a new StoreEntry is immediately available */ | |
85 | virtual bool next(); | |
86 | virtual bool error() const; | |
87 | virtual bool isDone() const; | |
88 | virtual StoreEntry *currentItem(); | |
89 | ||
90 | RefCount<StoreHashIndex> sd; | |
91 | ||
92 | private: | |
c8f4eac4 | 93 | void copyBucket(); |
94 | void (*callback)(void *cbdata); | |
95 | void *cbdata; | |
96 | bool _done; | |
97 | int bucket; | |
81481ec0 | 98 | std::vector<StoreEntry *> entries; |
c8f4eac4 | 99 | }; |
100 | ||
101 | #endif /* SQUID_STOREHASHINDEX_H */ | |
f53969cc | 102 |